修改交班落地数据逻辑

This commit is contained in:
19991905653 2024-04-03 09:44:12 +08:00
parent 8e1b70e3a8
commit 433a03ebb8
5 changed files with 9 additions and 6 deletions

View File

@ -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);
}

View File

@ -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) {

View File

@ -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)){

View File

@ -222,6 +222,6 @@
where id = #{id,jdbcType=INTEGER}
</update>
<update id="updateStatusByTokenId">
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'
</update>
</mapper>

View File

@ -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
</select>
</mapper>