商品列表 校验 耗材

This commit is contained in:
2024-08-21 14:49:25 +08:00
parent 58fa177785
commit d264f79c9e

View File

@@ -408,17 +408,22 @@ 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();
@@ -430,6 +435,7 @@ public class ProductService {
if ("1".equals(consInfo.getIsCheck())) {
if (N.gt(proskuCon.getSurplusStock(), consInfo.getStockNumber().abs().subtract(consInfo.getStockConsume().abs()))) {
iterator.remove();
break;
}
}
}
@@ -441,8 +447,6 @@ public class ProductService {
}
}
}
}
}
public Result queryProductSku(String code, String shopId, String productId, String spec_tag) {