From 1db86f2865627db0e77ad4224fc35bb3fd092dbb Mon Sep 17 00:00:00 2001 From: Chopper Date: Wed, 22 Dec 2021 17:00:30 +0800 Subject: [PATCH] =?UTF-8?q?es=E4=B8=AD=E5=95=86=E5=93=81=E7=B4=A2=E5=BC=95?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=EF=BC=8C=E4=BB=A5=E5=8F=8A=E8=99=9A=E6=8B=9F?= =?UTF-8?q?=E5=95=86=E5=93=81=E4=BC=9A=E6=90=BA=E5=B8=A6=E5=A4=A7=E9=87=8F?= =?UTF-8?q?=E4=BC=98=E6=83=A0=E5=88=B8=E4=BF=A1=E6=81=AF=E4=B8=8B=E5=8D=95?= =?UTF-8?q?=E9=97=AE=E9=A2=98=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cart/render/impl/SkuPromotionRender.java | 19 ++++++++++++++++--- .../entity/vos/CouponSearchParams.java | 8 ++++---- .../serviceimpl/PromotionServiceImpl.java | 2 ++ 3 files changed, 22 insertions(+), 7 deletions(-) diff --git a/framework/src/main/java/cn/lili/modules/order/cart/render/impl/SkuPromotionRender.java b/framework/src/main/java/cn/lili/modules/order/cart/render/impl/SkuPromotionRender.java index 2251aedf..adc4bc60 100644 --- a/framework/src/main/java/cn/lili/modules/order/cart/render/impl/SkuPromotionRender.java +++ b/framework/src/main/java/cn/lili/modules/order/cart/render/impl/SkuPromotionRender.java @@ -116,7 +116,6 @@ public class SkuPromotionRender implements CartRenderStep { return; case CART: case BUY_NOW: - return; case VIRTUAL: //循环购物车 for (CartVO cartVO : tradeDTO.getCartList()) { @@ -124,10 +123,10 @@ public class SkuPromotionRender implements CartRenderStep { for (CartSkuVO cartSkuVO : cartVO.getCheckedSkuList()) { //赋予商品促销信息 for (Map.Entry entry : cartSkuVO.getPromotionMap().entrySet()) { - // 忽略拼团活动 - if (entry.getKey().contains(PromotionTypeEnum.PINTUAN.name())) { + if (ignorePromotion(entry.getKey())) { continue; } + BasePromotions basePromotions = (BasePromotions) entry.getValue(); PromotionSkuVO promotionSkuVO = new PromotionSkuVO(entry.getKey().split("-")[0], basePromotions.getId()); cartSkuVO.setSubTotal(CurrencyUtil.mul(cartSkuVO.getPurchasePrice(), cartSkuVO.getNum())); @@ -142,5 +141,19 @@ public class SkuPromotionRender implements CartRenderStep { } } + /** + * 购物车促销类型 + */ + private Boolean ignorePromotion(String promotionKey) { + + // 忽略积分活动活动 忽略砍价活动 忽略优惠券活动 忽略拼团活动 + if (promotionKey.contains(PromotionTypeEnum.POINTS_GOODS.name()) + || promotionKey.contains(PromotionTypeEnum.KANJIA.name()) + || promotionKey.contains(PromotionTypeEnum.COUPON.name()) + || promotionKey.contains(PromotionTypeEnum.PINTUAN.name())) { + return true; + } + return false; + } } diff --git a/framework/src/main/java/cn/lili/modules/promotion/entity/vos/CouponSearchParams.java b/framework/src/main/java/cn/lili/modules/promotion/entity/vos/CouponSearchParams.java index aafa8bc0..17c95a1b 100644 --- a/framework/src/main/java/cn/lili/modules/promotion/entity/vos/CouponSearchParams.java +++ b/framework/src/main/java/cn/lili/modules/promotion/entity/vos/CouponSearchParams.java @@ -66,6 +66,7 @@ public class CouponSearchParams extends BasePromotionsSearchParams implements Se @ApiModelProperty(value = "会员优惠券状态") private String memberCouponStatus; + @Override public QueryWrapper queryWrapper() { QueryWrapper queryWrapper = new QueryWrapper<>(); @@ -96,12 +97,11 @@ public class CouponSearchParams extends BasePromotionsSearchParams implements Se if (CharSequenceUtil.isNotEmpty(this.getPromotionStatus())) { switch (PromotionsStatusEnum.valueOf(this.getPromotionStatus())) { case NEW: - queryWrapper.nested(i -> i.gt(PromotionTools.START_TIME_COLUMN, new Date()).gt(PromotionTools.END_TIME_COLUMN, new Date())) - ; + queryWrapper.nested(i -> i.gt(PromotionTools.START_TIME_COLUMN, new Date()).gt(PromotionTools.END_TIME_COLUMN, new Date())); break; case START: - queryWrapper.nested(i -> i.le(PromotionTools.START_TIME_COLUMN, new Date()).ge(PromotionTools.END_TIME_COLUMN, new Date())) - .or(i -> i.gt("effective_days", 0).eq(RANGE_DAY_TYPE_COLUMN, CouponRangeDayEnum.DYNAMICTIME.name())); + queryWrapper.nested(i -> i.le(PromotionTools.START_TIME_COLUMN, new Date()).ge(PromotionTools.END_TIME_COLUMN, new Date())); +// .or(i -> i.gt("effective_days", 0).eq(RANGE_DAY_TYPE_COLUMN, CouponRangeDayEnum.DYNAMICTIME.name())); break; case END: queryWrapper.nested(i -> i.lt(PromotionTools.START_TIME_COLUMN, new Date()).lt(PromotionTools.END_TIME_COLUMN, new Date())); diff --git a/framework/src/main/java/cn/lili/modules/promotion/serviceimpl/PromotionServiceImpl.java b/framework/src/main/java/cn/lili/modules/promotion/serviceimpl/PromotionServiceImpl.java index 70c224de..68dea115 100644 --- a/framework/src/main/java/cn/lili/modules/promotion/serviceimpl/PromotionServiceImpl.java +++ b/framework/src/main/java/cn/lili/modules/promotion/serviceimpl/PromotionServiceImpl.java @@ -2,6 +2,7 @@ package cn.lili.modules.promotion.serviceimpl; import cn.lili.common.enums.PromotionTypeEnum; import cn.lili.modules.promotion.entity.dos.*; +import cn.lili.modules.promotion.entity.enums.CouponGetEnum; import cn.lili.modules.promotion.entity.enums.PromotionsScopeTypeEnum; import cn.lili.modules.promotion.entity.enums.PromotionsStatusEnum; import cn.lili.modules.promotion.entity.vos.*; @@ -125,6 +126,7 @@ public class PromotionServiceImpl implements PromotionService { CouponSearchParams couponSearchParams = new CouponSearchParams(); couponSearchParams.setScopeType(PromotionsScopeTypeEnum.ALL.name()); couponSearchParams.setPromotionStatus(PromotionsStatusEnum.START.name()); + couponSearchParams.setGetType(CouponGetEnum.FREE.name()); List couponVOS = this.couponService.listFindAll(couponSearchParams); for (Coupon coupon : couponVOS) { if (("platform").equals(coupon.getStoreId()) || index.getStoreId().equals(coupon.getStoreId())) {