编辑商品导致库存为0的bug

This commit is contained in:
GYJ
2024-07-03 18:12:46 +08:00
parent 876faff7a2
commit 9edb6cde36

View File

@@ -237,6 +237,7 @@ public class TbProductServiceImpl implements TbProductService {
Threads.call(tbProductSkus, tbProductSpec);
//组装
TbProductVo tbProductVo = new TbProductVo();
tbProductVo.setStockNumber(tbProduct.getStockNumber() == null ? 0.00 : tbProduct.getStockNumber());
tbProductVo.setCategoryId(StringUtils.isNotBlank(tbProduct.getCategoryId())?Integer.valueOf(tbProduct.getCategoryId()):null);
//单位
// if (tbProduct.getUnitId() == null) {
@@ -426,6 +427,7 @@ public class TbProductServiceImpl implements TbProductService {
product.setStatus(1);
product.setUpdatedAt(Instant.now().toEpochMilli());
product.setImages(resources.getImages().toString());
product.setStockNumber(resources.getStockNumber().intValue());
if ("sku".equals(resources.getTypeEnum())) {
List<BigDecimal> collect = resources.getSkuList().stream().map(TbProductSku::getSalePrice).sorted().collect(Collectors.toList());
product.setLowPrice(collect.get(0));