添加耗材判断
This commit is contained in:
@@ -85,6 +85,13 @@ public class CartService {
|
||||
|
||||
private final RedisTemplate<String, Object> redisTemplate;
|
||||
|
||||
|
||||
@Autowired
|
||||
private TbProskuConMapper tbProskuConMapper;
|
||||
|
||||
@Autowired
|
||||
TbConsInfoMapper tbConsInfoMapper;
|
||||
|
||||
public CartService(TbUserShopMsgMapper tbUserShopMsgMapper, WechatUtil wechatUtil, WxAccountUtil wxAccountUtil, TbShopOpenIdMapper shopOpenIdMapper, ProductService productService, TbProductMapper tbProductMapper, RedisTemplate<String, Object> redisTemplate) {
|
||||
this.tbUserShopMsgMapper = tbUserShopMsgMapper;
|
||||
this.wechatUtil = wechatUtil;
|
||||
@@ -171,6 +178,25 @@ public class CartService {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
List<TbProskuCon> proskuConList= tbProskuConMapper.selectByShopIdAndSkuIdAndProductId(Integer.valueOf(skuId),Integer.valueOf(shopId),Integer.valueOf(productId));
|
||||
if(Objects.nonNull(proskuConList)&&proskuConList.size()>0){
|
||||
for (TbProskuCon proskuCon : proskuConList) {
|
||||
if("1".equals(proskuCon.getStatus())){
|
||||
TbConsInfo consInfo= tbConsInfoMapper.selectByPrimaryKey(proskuCon.getConInfoId());
|
||||
if("1".equals(consInfo.getIsCheck())){
|
||||
if(N.gt(proskuCon.getSurplusStock(),consInfo.getStockNumber().abs().subtract(consInfo.getStockConsume().abs()))){
|
||||
return Result.fail("商品:".concat(tbProduct.getName()).concat("对应的:").concat(consInfo.getConName()).concat("耗材不足"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
JSONArray jsonArray = new JSONArray();
|
||||
BigDecimal amount = BigDecimal.ZERO;
|
||||
try{
|
||||
|
||||
Reference in New Issue
Block a user