chao 3 rokov pred
rodič
commit
a25c398ff6

+ 23 - 19
src/main/java/com/caimei365/order/service/impl/CartClubServiceImpl.java

@@ -925,6 +925,7 @@ public class CartClubServiceImpl implements CartClubService {
         /*
          * 设置商品促销优惠
          */
+        boolean hasGift = false;
         if (null != promotions) {
             // 当前促销活动的价格计算列表
             List<PromotionPriceVo> promotionPriceList = productService.getPromotionProducts(promotions, cartItemVo, taxFlag);
@@ -939,25 +940,9 @@ public class CartClubServiceImpl implements CartClubService {
                     // 优惠总额 + 满减金额
                     reducedPrice.set(MathUtil.add(reducedPrice.get(), promotions.getReducedPrice()).doubleValue());
                 } else if (promotions.getMode() == 3) {
-                    // 满赠
+                    // 满足满赠
+                    hasGift = true;
                     List<CartItemVo> giftList = baseMapper.getPromotionGifts(promotions.getId());
-                    giftList.forEach(gift -> {
-                        if (shopIds.contains(gift.getShopId())) {
-                            // 赠品在当前订单内的供应商下
-                            shopList.forEach(s -> {
-                                if (s.getShopId().equals(gift.getShopId())) {
-                                    s.getCartList().add(gift);
-                                }
-                            });
-                        } else {
-                            // 获取赠品供应商
-                            CartShopVo giftShop = baseMapper.getShopByProductId(gift.getProductId());
-                            shopIds.add(giftShop.getShopId());
-                            giftShop.setCartList(new ArrayList<>());
-                            giftShop.getCartList().add(gift);
-                            shopList.add(giftShop);
-                        }
-                    });
                     promotions.setGiftList(giftList);
                 }
             }
@@ -1002,7 +987,26 @@ public class CartClubServiceImpl implements CartClubService {
         shop.setOriginalPrice(originalPrice.get());
         // 当前供应商添加到首位
         shopList.add(0, shop);
-
+        // 满足促销满赠
+        if (hasGift) {
+            promotions.getGiftList().forEach(gift -> {
+                if (shopIds.contains(gift.getShopId())) {
+                    // 赠品在当前订单内的供应商下
+                    shopList.forEach(s -> {
+                        if (s.getShopId().equals(gift.getShopId())) {
+                            s.getCartList().add(gift);
+                        }
+                    });
+                } else {
+                    // 获取赠品供应商
+                    CartShopVo giftShop = baseMapper.getShopByProductId(gift.getProductId());
+                    shopIds.add(giftShop.getShopId());
+                    giftShop.setCartList(new ArrayList<>());
+                    giftShop.getCartList().add(gift);
+                    shopList.add(giftShop);
+                }
+            });
+        }
         // 是否充值商品
         boolean includeRecharge = false;
         boolean recharge = productService.isRechargeProduct(cartDto.getProductId());

+ 1 - 1
src/main/java/com/caimei365/order/service/impl/PayOrderServiceImpl.java

@@ -897,7 +897,7 @@ public class PayOrderServiceImpl implements PayOrderService {
                     double shopTotalAmount = 0.00;
                     String subUserNo = "";
                     for (SplitAccountPo account : splitBillDetail) {
-                        if (4 == account.getType() && shopOrder.getShopId().equals(account.getShopId())) {
+                        if (null!= account.getType() && 4 == account.getType() && shopOrder.getShopId().equals(account.getShopId())) {
                             shopTotalAmount = MathUtil.add(shopTotalAmount, account.getSplitAccount()).doubleValue();
                             subUserNo = account.getSubUserNo();
                         }

+ 3 - 1
src/main/java/com/caimei365/order/service/impl/SubmitServiceImpl.java

@@ -433,7 +433,9 @@ public class SubmitServiceImpl implements SubmitService {
                 // 赠品数
                 presentCount.updateAndGet(v -> v + presentNum);
                 // 获取数据库商品信息
-                OrderProductPo product = submitMapper.getProductDetails(productId);
+                OrderProductPo dbProduct = submitMapper.getProductDetails(productId);
+                OrderProductPo product = new OrderProductPo();
+                BeanUtils.copyProperties(dbProduct, product);
                 if (null == product) {
                     return ResponseJson.error("订单商品不存在!", null);
                 }