交班修改业务逻辑 ,跨天统计

This commit is contained in:
19991905653 2024-04-11 15:21:52 +08:00
parent 49ed813f63
commit c3c169d2b5
3 changed files with 16 additions and 6 deletions

View File

@ -34,6 +34,7 @@ public interface ShopUserDutyMapper {
ShopUserDuty selectByTokenIdAndTradeDay(@Param("tokenId") int tokenId, @Param("day") String day,@Param("shopId") String shopId);
ShopUserDuty selectByShopIdAndTrade(@Param("shopId") Integer shopId,@Param("day") String day);
ShopUserDuty selectByShopIdAndStatus(@Param("shopId") Integer shopId,@Param("status") String status);

View File

@ -73,8 +73,10 @@ public class DutyService {
throw new MsgException("订单不存在");
}
List<TbOrderDetail> list = orderDetailMapper.selectAllByOrderId(orderId);
TbShopInfo shopInfo = shopInfoMapper.selectByPrimaryKey(shopId);
// ShopUserDuty shopUserDuty = shopUserDutyMapper.selectByTokenId(tokenId);
ShopUserDuty shopUserDuty = shopUserDutyMapper.selectByShopIdAndTrade(shopId, day);
ShopUserDuty shopUserDuty = shopUserDutyMapper.selectByShopIdAndStatus(shopId, "0");
// ShopUserDuty shopUserDuty = shopUserDutyMapper.selectByShopIdAndTrade(shopId, day);
// ShopUserDuty shopUserDuty = shopUserDutyMapper.selectByTokenIdAndTradeDay(tokenId, day, orderInfo.getShopId());
BigDecimal cashAmount = BigDecimal.ZERO;
@ -83,7 +85,7 @@ public class DutyService {
cashAmount = orderInfo.getPayAmount();
}
if (Objects.isNull(shopUserDuty)) {
shopUserDuty = new ShopUserDuty(userId, tbToken.getCreateTime(), 1, orderInfo.getOrderAmount(), loginName, "0",
shopUserDuty = new ShopUserDuty(userId, tbToken.getCreateTime(), 1, orderInfo.getOrderAmount(), shopInfo.getShopName(), "0",
orderInfo.getOrderAmount(), shopId, BigDecimal.ZERO, cashAmount, BigDecimal.ZERO, "");
shopUserDuty.setTokenId(tokenId);
shopUserDuty.setReturnAmount(BigDecimal.ZERO);
@ -187,7 +189,8 @@ public class DutyService {
if (orderInfo.getPayType().equals("cash")) {
cashAmount = orderInfo.getPayAmount();
}
ShopUserDuty shopUserDuty = shopUserDutyMapper.selectByShopIdAndTrade(Integer.valueOf(orderInfo.getShopId()), day);
ShopUserDuty shopUserDuty = shopUserDutyMapper.selectByShopIdAndStatus(Integer.valueOf(orderInfo.getShopId()), "0");
// ShopUserDuty shopUserDuty = shopUserDutyMapper.selectByShopIdAndTrade(Integer.valueOf(orderInfo.getShopId()), day);
// ShopUserDuty shopUserDuty = shopUserDutyMapper.selectByTokenIdAndTradeDay(0, day, orderInfo.getShopId());
TbShopInfo shopInfo = shopInfoMapper.selectByPrimaryKey(Integer.valueOf(orderInfo.getShopId()));
if (Objects.isNull(shopUserDuty)) {
@ -199,6 +202,7 @@ public class DutyService {
shopUserDuty.setUserName(shopInfo.getShopName());
}
shopUserDuty.setTradeDay(DateUtils.getDay());
shopUserDuty.setReturnAmount(BigDecimal.ZERO);
shopUserDutyMapper.insert(shopUserDuty);
List<ShopUserDutyDetail> detaiList = new ArrayList<>();
for (TbOrderDetail orderDetail : list) {

View File

@ -41,7 +41,7 @@
select ifnull(sum(amount),0) from tb_shop_user_duty where shop_id = #{shopId}
</select>
<select id="selectByTokenIdAndTradeDay"
resultType="com.chaozhanggui.system.cashierservice.entity.ShopUserDuty">
resultMap="BaseResultMap">
select * from tb_shop_user_duty where shop_id = #{shopId} and trade_day = #{day} and token_id = #{tokenId};
</select>
<select id="selectByShopIdAndTrade"
@ -169,7 +169,7 @@
order_num = #{orderNum,jdbcType=INTEGER},
</if>
<if test="amount != null">
amount = #{amount,jdbcType=VARCHAR},
amount = #{amount,jdbcType=DECIMAL},
</if>
<if test="loginOutTime != null">
login_out_time = #{loginOutTime,jdbcType=TIMESTAMP},
@ -199,7 +199,7 @@
equipment = #{equipment,jdbcType=VARCHAR},
</if>
<if test="returnAmount != null">
return_amount = #{returnAmount,jdbcType=VARCHAR},
return_amount = #{returnAmount,jdbcType=DECIMAL},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
@ -228,4 +228,9 @@
<select id="selectByShopIdAndDay" resultMap="BaseResultMap">
select * from tb_shop_user_duty where trade_day = #{day} and shop_id = #{shopId} order by id desc limit 1
</select>
<select id="selectByShopIdAndStatus"
resultType="com.chaozhanggui.system.cashierservice.entity.ShopUserDuty">
select * from tb_shop_user_duty where status = #{status} and shop_id = #{shopId} order by id desc limit 1
</select>
</mapper>