diff --git a/src/main/java/com/chaozhanggui/system/cashierservice/dao/TbProductMapper.java b/src/main/java/com/chaozhanggui/system/cashierservice/dao/TbProductMapper.java index fcc2685..f7a130b 100644 --- a/src/main/java/com/chaozhanggui/system/cashierservice/dao/TbProductMapper.java +++ b/src/main/java/com/chaozhanggui/system/cashierservice/dao/TbProductMapper.java @@ -34,6 +34,6 @@ public interface TbProductMapper { - Integer countOrderByshopIdAndProductId(@Param("shopId") String shopId, @Param("productId") String productId, @Param("masterId") String masterId); + Integer countOrderByshopIdAndProductId(@Param("shopId") String shopId, @Param("productId") String productId, @Param("masterId") String masterId,@Param("day") String day); } \ No newline at end of file diff --git a/src/main/java/com/chaozhanggui/system/cashierservice/service/DutyService.java b/src/main/java/com/chaozhanggui/system/cashierservice/service/DutyService.java index 07db6b6..44d6803 100644 --- a/src/main/java/com/chaozhanggui/system/cashierservice/service/DutyService.java +++ b/src/main/java/com/chaozhanggui/system/cashierservice/service/DutyService.java @@ -51,7 +51,6 @@ public class DutyService { String type = jsonObject.getString("type"); TbToken tbToken = tbTokenMapper.selectByToken(token); String day = DateUtils.getDay(); - Integer shop = 0; if (type.equals("return") || type.equals("create")) { if (Objects.isNull(tbToken)) { throw new MsgException("当前用户不存在"); @@ -60,7 +59,6 @@ public class DutyService { Integer orderId = jsonObject.getInteger("orderId"); JSONObject tokenJson = TokenUtil.parseParamFromToken(tbToken.getToken()); Integer shopId = tokenJson.getInteger("shopId"); - shop = shopId; Integer userId = tokenJson.getInteger("staffId"); String loginName = tokenJson.getString("loginName"); TbOrderInfo orderInfo = orderInfoMapper.selectByPrimaryKey(orderId); @@ -264,7 +262,9 @@ public class DutyService { } }else{ if (type.equals("close")){ - shopUserDutyMapper.updateStatusByTokenId(day,shop); + JSONObject tokenJson = TokenUtil.parseParamFromToken(tbToken.getToken()); + Integer shopId = tokenJson.getInteger("shopId"); + shopUserDutyMapper.updateStatusByTokenId(day,shopId); } } } catch (Exception e) { diff --git a/src/main/java/com/chaozhanggui/system/cashierservice/service/ProductService.java b/src/main/java/com/chaozhanggui/system/cashierservice/service/ProductService.java index fcc94d6..546fad0 100644 --- a/src/main/java/com/chaozhanggui/system/cashierservice/service/ProductService.java +++ b/src/main/java/com/chaozhanggui/system/cashierservice/service/ProductService.java @@ -5,6 +5,7 @@ import com.chaozhanggui.system.cashierservice.dao.*; import com.chaozhanggui.system.cashierservice.entity.*; import com.chaozhanggui.system.cashierservice.sign.CodeEnum; import com.chaozhanggui.system.cashierservice.sign.Result; +import com.chaozhanggui.system.cashierservice.util.DateUtils; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; import lombok.extern.slf4j.Slf4j; @@ -54,9 +55,10 @@ public class ProductService { tbProductWithBLOBs=tbProductMapper.selectByShopIdAndShopType(shopId,categoryId,commdityName); } + String day = DateUtils.getDay(); if(ObjectUtil.isNotEmpty(tbProductWithBLOBs)){ tbProductWithBLOBs.parallelStream().forEach(it->{ - Integer orderCount=tbProductMapper.countOrderByshopIdAndProductId(it.getShopId(),it.getId().toString(),masterId); + Integer orderCount=tbProductMapper.countOrderByshopIdAndProductId(it.getShopId(),it.getId().toString(),masterId,day); it.setOrderCount((ObjectUtil.isNull(orderCount)||ObjectUtil.isEmpty(orderCount))?0:orderCount); TbProductSpec tbProductSpec= tbProductSpecMapper.selectByPrimaryKey(it.getSpecId()); if(ObjectUtil.isEmpty(tbProductSpec)){ diff --git a/src/main/resources/mapper/ShopUserDutyMapper.xml b/src/main/resources/mapper/ShopUserDutyMapper.xml index 64062d8..a10c479 100644 --- a/src/main/resources/mapper/ShopUserDutyMapper.xml +++ b/src/main/resources/mapper/ShopUserDutyMapper.xml @@ -222,6 +222,6 @@ where id = #{id,jdbcType=INTEGER} - update tb_shop_user_duty set status = '1' , login_out_time = now() where shop_id = #{shopId} and trade_day = #{day} + update tb_shop_user_duty set status = '1' , login_out_time = now() where shop_id = #{shopId} and trade_day = #{day} and status = '0' \ No newline at end of file diff --git a/src/main/resources/mapper/TbProductMapper.xml b/src/main/resources/mapper/TbProductMapper.xml index 1cdae6f..ba0a13c 100644 --- a/src/main/resources/mapper/TbProductMapper.xml +++ b/src/main/resources/mapper/TbProductMapper.xml @@ -913,6 +913,7 @@ AND product_id = #{productId} AND `status` = 'create' and master_id = #{masterId} + and trade_day = #{day} group by shop_id,product_id \ No newline at end of file