es中商品索引信息,以及虚拟商品会携带大量优惠券信息下单问题处理

This commit is contained in:
Chopper 2021-12-22 17:00:30 +08:00
parent e5f725cf16
commit 1db86f2865
3 changed files with 22 additions and 7 deletions

View File

@ -116,7 +116,6 @@ public class SkuPromotionRender implements CartRenderStep {
return; return;
case CART: case CART:
case BUY_NOW: case BUY_NOW:
return;
case VIRTUAL: case VIRTUAL:
//循环购物车 //循环购物车
for (CartVO cartVO : tradeDTO.getCartList()) { for (CartVO cartVO : tradeDTO.getCartList()) {
@ -124,10 +123,10 @@ public class SkuPromotionRender implements CartRenderStep {
for (CartSkuVO cartSkuVO : cartVO.getCheckedSkuList()) { for (CartSkuVO cartSkuVO : cartVO.getCheckedSkuList()) {
//赋予商品促销信息 //赋予商品促销信息
for (Map.Entry<String, Object> entry : cartSkuVO.getPromotionMap().entrySet()) { for (Map.Entry<String, Object> entry : cartSkuVO.getPromotionMap().entrySet()) {
// 忽略拼团活动 if (ignorePromotion(entry.getKey())) {
if (entry.getKey().contains(PromotionTypeEnum.PINTUAN.name())) {
continue; continue;
} }
BasePromotions basePromotions = (BasePromotions) entry.getValue(); BasePromotions basePromotions = (BasePromotions) entry.getValue();
PromotionSkuVO promotionSkuVO = new PromotionSkuVO(entry.getKey().split("-")[0], basePromotions.getId()); PromotionSkuVO promotionSkuVO = new PromotionSkuVO(entry.getKey().split("-")[0], basePromotions.getId());
cartSkuVO.setSubTotal(CurrencyUtil.mul(cartSkuVO.getPurchasePrice(), cartSkuVO.getNum())); 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;
}
} }

View File

@ -66,6 +66,7 @@ public class CouponSearchParams extends BasePromotionsSearchParams implements Se
@ApiModelProperty(value = "会员优惠券状态") @ApiModelProperty(value = "会员优惠券状态")
private String memberCouponStatus; private String memberCouponStatus;
@Override @Override
public <T> QueryWrapper<T> queryWrapper() { public <T> QueryWrapper<T> queryWrapper() {
QueryWrapper<T> queryWrapper = new QueryWrapper<>(); QueryWrapper<T> queryWrapper = new QueryWrapper<>();
@ -96,12 +97,11 @@ public class CouponSearchParams extends BasePromotionsSearchParams implements Se
if (CharSequenceUtil.isNotEmpty(this.getPromotionStatus())) { if (CharSequenceUtil.isNotEmpty(this.getPromotionStatus())) {
switch (PromotionsStatusEnum.valueOf(this.getPromotionStatus())) { switch (PromotionsStatusEnum.valueOf(this.getPromotionStatus())) {
case NEW: 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; break;
case START: case START:
queryWrapper.nested(i -> i.le(PromotionTools.START_TIME_COLUMN, new Date()).ge(PromotionTools.END_TIME_COLUMN, new Date())) 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())); // .or(i -> i.gt("effective_days", 0).eq(RANGE_DAY_TYPE_COLUMN, CouponRangeDayEnum.DYNAMICTIME.name()));
break; break;
case END: case END:
queryWrapper.nested(i -> i.lt(PromotionTools.START_TIME_COLUMN, new Date()).lt(PromotionTools.END_TIME_COLUMN, new Date())); queryWrapper.nested(i -> i.lt(PromotionTools.START_TIME_COLUMN, new Date()).lt(PromotionTools.END_TIME_COLUMN, new Date()));

View File

@ -2,6 +2,7 @@ package cn.lili.modules.promotion.serviceimpl;
import cn.lili.common.enums.PromotionTypeEnum; import cn.lili.common.enums.PromotionTypeEnum;
import cn.lili.modules.promotion.entity.dos.*; 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.PromotionsScopeTypeEnum;
import cn.lili.modules.promotion.entity.enums.PromotionsStatusEnum; import cn.lili.modules.promotion.entity.enums.PromotionsStatusEnum;
import cn.lili.modules.promotion.entity.vos.*; import cn.lili.modules.promotion.entity.vos.*;
@ -125,6 +126,7 @@ public class PromotionServiceImpl implements PromotionService {
CouponSearchParams couponSearchParams = new CouponSearchParams(); CouponSearchParams couponSearchParams = new CouponSearchParams();
couponSearchParams.setScopeType(PromotionsScopeTypeEnum.ALL.name()); couponSearchParams.setScopeType(PromotionsScopeTypeEnum.ALL.name());
couponSearchParams.setPromotionStatus(PromotionsStatusEnum.START.name()); couponSearchParams.setPromotionStatus(PromotionsStatusEnum.START.name());
couponSearchParams.setGetType(CouponGetEnum.FREE.name());
List<Coupon> couponVOS = this.couponService.listFindAll(couponSearchParams); List<Coupon> couponVOS = this.couponService.listFindAll(couponSearchParams);
for (Coupon coupon : couponVOS) { for (Coupon coupon : couponVOS) {
if (("platform").equals(coupon.getStoreId()) || index.getStoreId().equals(coupon.getStoreId())) { if (("platform").equals(coupon.getStoreId()) || index.getStoreId().equals(coupon.getStoreId())) {