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 = "满优惠活动")