商品列表 校验 耗材
This commit is contained in:
@@ -408,39 +408,43 @@ public class ProductService {
|
||||
if (Integer.valueOf(tbProduct.getIsDistribute()).equals(1)) {//共享库存 1开启
|
||||
if (tbProduct.getStockNumber() != null && tbProduct.getStockNumber() <= 0) {
|
||||
tbProduct.setIsPauseSale(Byte.parseByte("1"));//售罄 1暂停
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
if (!tbProduct.getTypeEnum().equals("sku")) {
|
||||
if (skus.stream().anyMatch(sku -> sku.getStockNumber() != null && sku.getStockNumber() <= 0))
|
||||
if (skus.stream().anyMatch(sku -> sku.getStockNumber() != null && sku.getStockNumber() <= 0)){
|
||||
tbProduct.setIsPauseSale(Byte.parseByte("1"));//售罄 1暂停
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
skus.removeIf(sku -> sku.getStockNumber() != null && sku.getStockNumber() <= 0);
|
||||
if (CollectionUtils.isEmpty(skus)) {
|
||||
tbProduct.setIsPauseSale(Byte.parseByte("1"));//售罄 1暂停
|
||||
return;
|
||||
}
|
||||
Iterator<TbProductSku> iterator = skus.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
TbProductSku tbProductSku = iterator.next();
|
||||
List<TbProskuCon> proskuConList = tbProskuConMapper.selectByShopIdAndSkuIdAndProductId(Integer.valueOf(tbProductSku.getId()), Integer.valueOf(tbProductSku.getShopId()), Integer.valueOf(tbProductSku.getProductId()));
|
||||
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()))) {
|
||||
iterator.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Iterator<TbProductSku> iterator = skus.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
TbProductSku tbProductSku = iterator.next();
|
||||
List<TbProskuCon> proskuConList = tbProskuConMapper.selectByShopIdAndSkuIdAndProductId(Integer.valueOf(tbProductSku.getId()), Integer.valueOf(tbProductSku.getShopId()), Integer.valueOf(tbProductSku.getProductId()));
|
||||
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()))) {
|
||||
iterator.remove();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (CollectionUtils.isEmpty(skus)) {
|
||||
tbProduct.setIsPauseSale(Byte.parseByte("1"));//售罄 1暂停
|
||||
}
|
||||
}
|
||||
}
|
||||
if (CollectionUtils.isEmpty(skus)) {
|
||||
tbProduct.setIsPauseSale(Byte.parseByte("1"));//售罄 1暂停
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user