From 3cc4fbb377427c01056d01f6cc28a94ff371cb10 Mon Sep 17 00:00:00 2001 From: paulGao Date: Fri, 15 Oct 2021 11:57:41 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=BB=A1=E4=BC=98=E6=83=A0?= =?UTF-8?q?=E5=88=B8=E6=B4=BB=E5=8A=A8=E8=B5=A0=E4=BC=98=E6=83=A0=E5=88=B8?= =?UTF-8?q?/=E7=A7=AF=E5=88=86/=E5=95=86=E5=93=81=E4=B8=8D=E7=94=9F?= =?UTF-8?q?=E6=95=88=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cn/lili/event/impl/FullDiscountExecute.java | 16 +++++++--------- .../order/cart/entity/vo/FullDiscountVO.java | 5 +++++ .../promotion/entity/dos/FullDiscount.java | 2 ++ 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/consumer/src/main/java/cn/lili/event/impl/FullDiscountExecute.java b/consumer/src/main/java/cn/lili/event/impl/FullDiscountExecute.java index abf17cee..fadf757a 100644 --- a/consumer/src/main/java/cn/lili/event/impl/FullDiscountExecute.java +++ b/consumer/src/main/java/cn/lili/event/impl/FullDiscountExecute.java @@ -79,9 +79,9 @@ public class FullDiscountExecute implements TradeEvent, OrderStatusChangeEvent { tradeDTO.getCartList().forEach( cartVO -> { //有满减优惠,则记录信息 - if (cartVO.getGiftList() != null && cartVO.getGiftList().size() > 0 - && cartVO.getGiftPoint() != null && cartVO.getGiftPoint() > 0 - && cartVO.getGiftCouponList() != null && cartVO.getGiftCouponList().size() > 0) { + if ((cartVO.getGiftList() != null && !cartVO.getGiftList().isEmpty()) + || (cartVO.getGiftPoint() != null && cartVO.getGiftPoint() > 0) + || (cartVO.getGiftCouponList() != null && !cartVO.getGiftCouponList().isEmpty())) { cache.put(CachePrefix.ORDER.getPrefix() + cartVO.getSn(), cartVO); } } @@ -90,8 +90,8 @@ public class FullDiscountExecute implements TradeEvent, OrderStatusChangeEvent { @Override public void orderChange(OrderMessage orderMessage) { - System.out.println(CachePrefix.ORDER.getPrefix() + orderMessage.getOrderSn()); if (orderMessage.getNewStatus().equals(OrderStatusEnum.PAID)) { + log.debug("满减活动,订单状态操作 {}", CachePrefix.ORDER.getPrefix() + orderMessage.getOrderSn()); renderGift((CartVO) cache.get(CachePrefix.ORDER.getPrefix() + orderMessage.getOrderSn()), orderMessage); } } @@ -118,10 +118,8 @@ public class FullDiscountExecute implements TradeEvent, OrderStatusChangeEvent { try { //优惠券判定 - if (cartVO.getGiftCouponList() != null && cartVO.getGiftCouponList().size() > 0) { - cartVO.getGiftCouponList().forEach(couponId -> { - memberCouponService.receiveCoupon(couponId, order.getMemberId(), order.getMemberName()); - }); + if (cartVO.getGiftCouponList() != null && !cartVO.getGiftCouponList().isEmpty()) { + cartVO.getGiftCouponList().forEach(couponId -> memberCouponService.receiveCoupon(couponId, order.getMemberId(), order.getMemberName())); } } catch (Exception e) { log.error("订单赠送优惠券异常", e); @@ -129,7 +127,7 @@ public class FullDiscountExecute implements TradeEvent, OrderStatusChangeEvent { try { //赠品潘迪ing - if (cartVO.getGiftList() != null && cartVO.getGiftList().size() > 0) { + if (cartVO.getGiftList() != null && !cartVO.getGiftList().isEmpty()) { generatorGiftOrder(cartVO.getGiftList(), order); } } catch (Exception e) { diff --git a/framework/src/main/java/cn/lili/modules/order/cart/entity/vo/FullDiscountVO.java b/framework/src/main/java/cn/lili/modules/order/cart/entity/vo/FullDiscountVO.java index 586a31a8..9c9d1e91 100644 --- a/framework/src/main/java/cn/lili/modules/order/cart/entity/vo/FullDiscountVO.java +++ b/framework/src/main/java/cn/lili/modules/order/cart/entity/vo/FullDiscountVO.java @@ -4,6 +4,7 @@ import cn.lili.modules.goods.entity.dos.GoodsSku; import cn.lili.modules.promotion.entity.dos.FullDiscount; import cn.lili.modules.promotion.entity.dos.PromotionGoods; import lombok.Data; +import lombok.EqualsAndHashCode; import java.util.List; @@ -13,6 +14,7 @@ import java.util.List; * @author Chopper * @since 2020-04-01 10:42 上午 */ +@EqualsAndHashCode(callSuper = true) @Data public class FullDiscountVO extends FullDiscount { @@ -47,6 +49,9 @@ public class FullDiscountVO extends FullDiscount { if (Boolean.TRUE.equals(this.getIsPoint())) { stringBuffer.append(" 赠").append(this.getPoint()).append("积分 "); } + if (Boolean.TRUE.equals(this.getIsCoupon())) { + stringBuffer.append(" 赠").append("优惠券 "); + } if (Boolean.TRUE.equals(this.getIsGift() && giftSku != null)) { stringBuffer.append(" 赠品[").append(giftSku.getGoodsName()).append("]"); } diff --git a/framework/src/main/java/cn/lili/modules/promotion/entity/dos/FullDiscount.java b/framework/src/main/java/cn/lili/modules/promotion/entity/dos/FullDiscount.java index 42cfa140..c0d937cf 100644 --- a/framework/src/main/java/cn/lili/modules/promotion/entity/dos/FullDiscount.java +++ b/framework/src/main/java/cn/lili/modules/promotion/entity/dos/FullDiscount.java @@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.annotation.TableName; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; +import lombok.EqualsAndHashCode; import javax.validation.constraints.DecimalMax; import javax.validation.constraints.NotEmpty; @@ -16,6 +17,7 @@ import javax.validation.constraints.NotNull; * @author Chopper * @since 2020-03-19 10:44 上午 */ +@EqualsAndHashCode(callSuper = true) @Data @TableName("li_full_discount") @ApiModel(value = "满优惠活动")