加入购物车添加耗材控制
This commit is contained in:
@@ -77,6 +77,12 @@ public class OrderService {
|
|||||||
|
|
||||||
private final TbShopOpenIdMapper shopOpenIdMapper;
|
private final TbShopOpenIdMapper shopOpenIdMapper;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private TbProskuConMapper tbProskuConMapper;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
TbConsInfoMapper tbConsInfoMapper;
|
||||||
|
|
||||||
|
|
||||||
private static ConcurrentHashMap<String, HashSet<Integer>> codeMap = new ConcurrentHashMap<>();
|
private static ConcurrentHashMap<String, HashSet<Integer>> codeMap = new ConcurrentHashMap<>();
|
||||||
private static ConcurrentHashMap<String, HashSet<String>> userMap = new ConcurrentHashMap<>();
|
private static ConcurrentHashMap<String, HashSet<String>> userMap = new ConcurrentHashMap<>();
|
||||||
@@ -123,6 +129,28 @@ public class OrderService {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
List<TbProskuCon> proskuConList= tbProskuConMapper.selectByShopIdAndSkuIdAndProductId(skuId,shopInfo.getId(),product.getId());
|
||||||
|
if(Objects.nonNull(proskuConList)&&proskuConList.size()>0){
|
||||||
|
for (TbProskuCon proskuCon : proskuConList) {
|
||||||
|
if("1".equals(proskuCon.getStatus())){
|
||||||
|
TbConsInfo consInfo= tbConsInfoMapper.selectByPrimaryKey(proskuCon.getConInfoId());
|
||||||
|
if(N.egt(proskuCon.getSurplusStock(),consInfo.getStockNumber().abs().subtract(consInfo.getStockConsume().abs()))){
|
||||||
|
return Result.fail("商品:".concat(product.getName()).concat("对应的:").concat(consInfo.getConName()).concat("耗材不足"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
String exists = redisUtil.getMessage(RedisCst.ORDER_CART_EXISTS + cartId);
|
String exists = redisUtil.getMessage(RedisCst.ORDER_CART_EXISTS + cartId);
|
||||||
|
|
||||||
// 首次加入购物车,并且拥有起售数,设置为起售数
|
// 首次加入购物车,并且拥有起售数,设置为起售数
|
||||||
|
|||||||
Reference in New Issue
Block a user