修改交班落地数据逻辑
This commit is contained in:
parent
8e1b70e3a8
commit
433a03ebb8
|
|
@ -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);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -51,7 +51,6 @@ public class DutyService {
|
||||||
String type = jsonObject.getString("type");
|
String type = jsonObject.getString("type");
|
||||||
TbToken tbToken = tbTokenMapper.selectByToken(token);
|
TbToken tbToken = tbTokenMapper.selectByToken(token);
|
||||||
String day = DateUtils.getDay();
|
String day = DateUtils.getDay();
|
||||||
Integer shop = 0;
|
|
||||||
if (type.equals("return") || type.equals("create")) {
|
if (type.equals("return") || type.equals("create")) {
|
||||||
if (Objects.isNull(tbToken)) {
|
if (Objects.isNull(tbToken)) {
|
||||||
throw new MsgException("当前用户不存在");
|
throw new MsgException("当前用户不存在");
|
||||||
|
|
@ -60,7 +59,6 @@ public class DutyService {
|
||||||
Integer orderId = jsonObject.getInteger("orderId");
|
Integer orderId = jsonObject.getInteger("orderId");
|
||||||
JSONObject tokenJson = TokenUtil.parseParamFromToken(tbToken.getToken());
|
JSONObject tokenJson = TokenUtil.parseParamFromToken(tbToken.getToken());
|
||||||
Integer shopId = tokenJson.getInteger("shopId");
|
Integer shopId = tokenJson.getInteger("shopId");
|
||||||
shop = shopId;
|
|
||||||
Integer userId = tokenJson.getInteger("staffId");
|
Integer userId = tokenJson.getInteger("staffId");
|
||||||
String loginName = tokenJson.getString("loginName");
|
String loginName = tokenJson.getString("loginName");
|
||||||
TbOrderInfo orderInfo = orderInfoMapper.selectByPrimaryKey(orderId);
|
TbOrderInfo orderInfo = orderInfoMapper.selectByPrimaryKey(orderId);
|
||||||
|
|
@ -264,7 +262,9 @@ public class DutyService {
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
if (type.equals("close")){
|
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) {
|
} catch (Exception e) {
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ import com.chaozhanggui.system.cashierservice.dao.*;
|
||||||
import com.chaozhanggui.system.cashierservice.entity.*;
|
import com.chaozhanggui.system.cashierservice.entity.*;
|
||||||
import com.chaozhanggui.system.cashierservice.sign.CodeEnum;
|
import com.chaozhanggui.system.cashierservice.sign.CodeEnum;
|
||||||
import com.chaozhanggui.system.cashierservice.sign.Result;
|
import com.chaozhanggui.system.cashierservice.sign.Result;
|
||||||
|
import com.chaozhanggui.system.cashierservice.util.DateUtils;
|
||||||
import com.github.pagehelper.PageHelper;
|
import com.github.pagehelper.PageHelper;
|
||||||
import com.github.pagehelper.PageInfo;
|
import com.github.pagehelper.PageInfo;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
@ -54,9 +55,10 @@ public class ProductService {
|
||||||
tbProductWithBLOBs=tbProductMapper.selectByShopIdAndShopType(shopId,categoryId,commdityName);
|
tbProductWithBLOBs=tbProductMapper.selectByShopIdAndShopType(shopId,categoryId,commdityName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String day = DateUtils.getDay();
|
||||||
if(ObjectUtil.isNotEmpty(tbProductWithBLOBs)){
|
if(ObjectUtil.isNotEmpty(tbProductWithBLOBs)){
|
||||||
tbProductWithBLOBs.parallelStream().forEach(it->{
|
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);
|
it.setOrderCount((ObjectUtil.isNull(orderCount)||ObjectUtil.isEmpty(orderCount))?0:orderCount);
|
||||||
TbProductSpec tbProductSpec= tbProductSpecMapper.selectByPrimaryKey(it.getSpecId());
|
TbProductSpec tbProductSpec= tbProductSpecMapper.selectByPrimaryKey(it.getSpecId());
|
||||||
if(ObjectUtil.isEmpty(tbProductSpec)){
|
if(ObjectUtil.isEmpty(tbProductSpec)){
|
||||||
|
|
|
||||||
|
|
@ -222,6 +222,6 @@
|
||||||
where id = #{id,jdbcType=INTEGER}
|
where id = #{id,jdbcType=INTEGER}
|
||||||
</update>
|
</update>
|
||||||
<update id="updateStatusByTokenId">
|
<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>
|
</update>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
@ -913,6 +913,7 @@
|
||||||
AND product_id = #{productId}
|
AND product_id = #{productId}
|
||||||
AND `status` = 'create'
|
AND `status` = 'create'
|
||||||
and master_id = #{masterId}
|
and master_id = #{masterId}
|
||||||
|
and trade_day = #{day}
|
||||||
group by shop_id,product_id
|
group by shop_id,product_id
|
||||||
</select>
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
Loading…
Reference in New Issue