交班修改业务逻辑 ,跨天统计
This commit is contained in:
@@ -34,6 +34,7 @@ public interface ShopUserDutyMapper {
|
|||||||
ShopUserDuty selectByTokenIdAndTradeDay(@Param("tokenId") int tokenId, @Param("day") String day,@Param("shopId") String shopId);
|
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 selectByShopIdAndTrade(@Param("shopId") Integer shopId,@Param("day") String day);
|
||||||
|
ShopUserDuty selectByShopIdAndStatus(@Param("shopId") Integer shopId,@Param("status") String status);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -73,8 +73,10 @@ public class DutyService {
|
|||||||
throw new MsgException("订单不存在");
|
throw new MsgException("订单不存在");
|
||||||
}
|
}
|
||||||
List<TbOrderDetail> list = orderDetailMapper.selectAllByOrderId(orderId);
|
List<TbOrderDetail> list = orderDetailMapper.selectAllByOrderId(orderId);
|
||||||
|
TbShopInfo shopInfo = shopInfoMapper.selectByPrimaryKey(shopId);
|
||||||
// ShopUserDuty shopUserDuty = shopUserDutyMapper.selectByTokenId(tokenId);
|
// 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());
|
// ShopUserDuty shopUserDuty = shopUserDutyMapper.selectByTokenIdAndTradeDay(tokenId, day, orderInfo.getShopId());
|
||||||
BigDecimal cashAmount = BigDecimal.ZERO;
|
BigDecimal cashAmount = BigDecimal.ZERO;
|
||||||
|
|
||||||
@@ -83,7 +85,7 @@ public class DutyService {
|
|||||||
cashAmount = orderInfo.getPayAmount();
|
cashAmount = orderInfo.getPayAmount();
|
||||||
}
|
}
|
||||||
if (Objects.isNull(shopUserDuty)) {
|
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, "");
|
orderInfo.getOrderAmount(), shopId, BigDecimal.ZERO, cashAmount, BigDecimal.ZERO, "");
|
||||||
shopUserDuty.setTokenId(tokenId);
|
shopUserDuty.setTokenId(tokenId);
|
||||||
shopUserDuty.setReturnAmount(BigDecimal.ZERO);
|
shopUserDuty.setReturnAmount(BigDecimal.ZERO);
|
||||||
@@ -187,7 +189,8 @@ public class DutyService {
|
|||||||
if (orderInfo.getPayType().equals("cash")) {
|
if (orderInfo.getPayType().equals("cash")) {
|
||||||
cashAmount = orderInfo.getPayAmount();
|
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());
|
// ShopUserDuty shopUserDuty = shopUserDutyMapper.selectByTokenIdAndTradeDay(0, day, orderInfo.getShopId());
|
||||||
TbShopInfo shopInfo = shopInfoMapper.selectByPrimaryKey(Integer.valueOf(orderInfo.getShopId()));
|
TbShopInfo shopInfo = shopInfoMapper.selectByPrimaryKey(Integer.valueOf(orderInfo.getShopId()));
|
||||||
if (Objects.isNull(shopUserDuty)) {
|
if (Objects.isNull(shopUserDuty)) {
|
||||||
@@ -199,6 +202,7 @@ public class DutyService {
|
|||||||
shopUserDuty.setUserName(shopInfo.getShopName());
|
shopUserDuty.setUserName(shopInfo.getShopName());
|
||||||
}
|
}
|
||||||
shopUserDuty.setTradeDay(DateUtils.getDay());
|
shopUserDuty.setTradeDay(DateUtils.getDay());
|
||||||
|
shopUserDuty.setReturnAmount(BigDecimal.ZERO);
|
||||||
shopUserDutyMapper.insert(shopUserDuty);
|
shopUserDutyMapper.insert(shopUserDuty);
|
||||||
List<ShopUserDutyDetail> detaiList = new ArrayList<>();
|
List<ShopUserDutyDetail> detaiList = new ArrayList<>();
|
||||||
for (TbOrderDetail orderDetail : list) {
|
for (TbOrderDetail orderDetail : list) {
|
||||||
|
|||||||
@@ -41,7 +41,7 @@
|
|||||||
select ifnull(sum(amount),0) from tb_shop_user_duty where shop_id = #{shopId}
|
select ifnull(sum(amount),0) from tb_shop_user_duty where shop_id = #{shopId}
|
||||||
</select>
|
</select>
|
||||||
<select id="selectByTokenIdAndTradeDay"
|
<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 * from tb_shop_user_duty where shop_id = #{shopId} and trade_day = #{day} and token_id = #{tokenId};
|
||||||
</select>
|
</select>
|
||||||
<select id="selectByShopIdAndTrade"
|
<select id="selectByShopIdAndTrade"
|
||||||
@@ -169,7 +169,7 @@
|
|||||||
order_num = #{orderNum,jdbcType=INTEGER},
|
order_num = #{orderNum,jdbcType=INTEGER},
|
||||||
</if>
|
</if>
|
||||||
<if test="amount != null">
|
<if test="amount != null">
|
||||||
amount = #{amount,jdbcType=VARCHAR},
|
amount = #{amount,jdbcType=DECIMAL},
|
||||||
</if>
|
</if>
|
||||||
<if test="loginOutTime != null">
|
<if test="loginOutTime != null">
|
||||||
login_out_time = #{loginOutTime,jdbcType=TIMESTAMP},
|
login_out_time = #{loginOutTime,jdbcType=TIMESTAMP},
|
||||||
@@ -199,7 +199,7 @@
|
|||||||
equipment = #{equipment,jdbcType=VARCHAR},
|
equipment = #{equipment,jdbcType=VARCHAR},
|
||||||
</if>
|
</if>
|
||||||
<if test="returnAmount != null">
|
<if test="returnAmount != null">
|
||||||
return_amount = #{returnAmount,jdbcType=VARCHAR},
|
return_amount = #{returnAmount,jdbcType=DECIMAL},
|
||||||
</if>
|
</if>
|
||||||
</set>
|
</set>
|
||||||
where id = #{id,jdbcType=INTEGER}
|
where id = #{id,jdbcType=INTEGER}
|
||||||
@@ -228,4 +228,9 @@
|
|||||||
<select id="selectByShopIdAndDay" resultMap="BaseResultMap">
|
<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 * from tb_shop_user_duty where trade_day = #{day} and shop_id = #{shopId} order by id desc limit 1
|
||||||
</select>
|
</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>
|
</mapper>
|
||||||
Reference in New Issue
Block a user