From 2e7612ac93b74e55ca944cc1dbcb3b4c5e8595d6 Mon Sep 17 00:00:00 2001 From: liyj <1617420630@qq.com> Date: Fri, 7 Nov 2025 17:42:04 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E5=95=86=E5=93=81=E4=B8=8D?= =?UTF-8?q?=E5=AD=98=E5=9C=A8=E6=97=B6=E7=9A=84=E6=89=A3=E5=87=8F=E5=87=BA?= =?UTF-8?q?=E9=94=99=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/ShopOrderBaseServiceImpl.java | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/mall-shop/src/main/java/com/suisung/mall/shop/order/service/impl/ShopOrderBaseServiceImpl.java b/mall-shop/src/main/java/com/suisung/mall/shop/order/service/impl/ShopOrderBaseServiceImpl.java index 8c4f0576..5819ad5b 100644 --- a/mall-shop/src/main/java/com/suisung/mall/shop/order/service/impl/ShopOrderBaseServiceImpl.java +++ b/mall-shop/src/main/java/com/suisung/mall/shop/order/service/impl/ShopOrderBaseServiceImpl.java @@ -5321,16 +5321,15 @@ public class ShopOrderBaseServiceImpl extends BaseServiceImpl 0 ? quantity_frozen : 0); - - if (!shopProductItemService.edit(shopProductItem)) { - throw new ApiException(I18nUtil._("修改商品冻结库存失败!")); + if (shopProductItem != null) { + logger.info("无法获取订单中的商品,请检查!");//商品存在才执行库存扣减 + // throw new ApiException(I18nUtil._("无法获取订单中的商品,请检查!")); + Integer item_quantity_frozen = shopProductItem.getItem_quantity_frozen(); + int quantity_frozen = item_quantity_frozen - order_item_quantity; + shopProductItem.setItem_quantity_frozen(quantity_frozen > 0 ? quantity_frozen : 0); + if (!shopProductItemService.edit(shopProductItem)) { + throw new ApiException(I18nUtil._("修改商品冻结库存失败!")); + } } }