Browse Source

下单库存问题修复

macro 1 year ago
parent
commit
c8cf97f6db

+ 4 - 1
mall-portal/src/main/java/com/macro/mall/portal/service/impl/OmsPortalOrderServiceImpl.java

@@ -716,7 +716,10 @@ public class OmsPortalOrderServiceImpl implements OmsPortalOrderService {
      */
     private boolean hasStock(List<CartPromotionItem> cartPromotionItemList) {
         for (CartPromotionItem cartPromotionItem : cartPromotionItemList) {
-            if (cartPromotionItem.getRealStock()==null||cartPromotionItem.getRealStock() <= 0) {
+            if (cartPromotionItem.getRealStock()==null //判断真实库存是否为空
+                    ||cartPromotionItem.getRealStock() <= 0 //判断真实库存是否小于0
+                    || cartPromotionItem.getRealStock() < cartPromotionItem.getQuantity()) //判断真实库存是否小于下单的数量
+            {
                 return false;
             }
         }