tb_product

删除 库存警戒线 库存开关 库存数量
新增 是否自动售罄 标识
tb_shop_prod_category
新增 refund_mode 退菜是否退库存
tb_shop_config 新增 refund_mode 退菜退库存模式

删除 扣除库存模式
This commit is contained in:
2026-04-09 15:54:14 +08:00
parent fa33586aae
commit 4116f7cc0d
31 changed files with 62 additions and 841 deletions

View File

@@ -43,7 +43,6 @@ import com.czg.order.enums.PayEnums;
import com.czg.order.service.*;
import com.czg.order.vo.*;
import com.czg.pay.PayNotifyRespDTO;
import com.czg.product.entity.Product;
import com.czg.product.service.ProductRpcService;
import com.czg.product.service.ProductService;
import com.czg.resp.CzgResult;
@@ -1041,14 +1040,15 @@ public class OrderInfoCustomServiceImpl implements OrderInfoCustomService {
BigDecimal packFee = BigDecimal.ZERO;
for (OrderDetail detail : orderDetails) {
if (!detail.getIsTemporary().equals(1) && detail.getProductId() > 0) {
Product product = productService.getOne(QueryWrapper.create()
.eq(Product::getId, detail.getProductId())
.eq(Product::getShopId, detail.getShopId())
.eq(Product::getIsDel, 0)
.eq(Product::getIsStock, 1));
if (product != null && detail.getNum().compareTo(new BigDecimal(product.getStockNumber())) > 0) {
throw new CzgException("下单失败" + product.getName() + "库存不足");
}
//TODO 库存问题 商品无库存 统一走 耗材
// Product product = productService.getOne(QueryWrapper.create()
// .eq(Product::getId, detail.getProductId())
// .eq(Product::getShopId, detail.getShopId())
// .eq(Product::getIsDel, 0)
// .eq(Product::getIsStock, 1));
// if (product != null && detail.getNum().compareTo(new BigDecimal(product.getStockNumber())) > 0) {
// throw new CzgException("下单失败" + product.getName() + "库存不足");
// }
}
if (detail.getDiscountSaleAmount() != null && detail.getDiscountSaleAmount().compareTo(BigDecimal.ZERO) > 0) {
detail.setUnitPrice(detail.getDiscountSaleAmount());