|
@@ -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());
|