!41 修复满优惠券活动赠优惠券/积分/商品不生效问题

Merge pull request !41 from OceansDeep/feature/pg
This commit is contained in:
OceansDeep 2021-10-15 06:30:36 +00:00 committed by Gitee
commit 15c6b74829
3 changed files with 14 additions and 9 deletions

View File

@ -79,9 +79,9 @@ public class FullDiscountExecute implements TradeEvent, OrderStatusChangeEvent {
tradeDTO.getCartList().forEach( tradeDTO.getCartList().forEach(
cartVO -> { cartVO -> {
//有满减优惠则记录信息 //有满减优惠则记录信息
if (cartVO.getGiftList() != null && cartVO.getGiftList().size() > 0 if ((cartVO.getGiftList() != null && !cartVO.getGiftList().isEmpty())
&& cartVO.getGiftPoint() != null && cartVO.getGiftPoint() > 0 || (cartVO.getGiftPoint() != null && cartVO.getGiftPoint() > 0)
&& cartVO.getGiftCouponList() != null && cartVO.getGiftCouponList().size() > 0) { || (cartVO.getGiftCouponList() != null && !cartVO.getGiftCouponList().isEmpty())) {
cache.put(CachePrefix.ORDER.getPrefix() + cartVO.getSn(), cartVO); cache.put(CachePrefix.ORDER.getPrefix() + cartVO.getSn(), cartVO);
} }
} }
@ -90,8 +90,8 @@ public class FullDiscountExecute implements TradeEvent, OrderStatusChangeEvent {
@Override @Override
public void orderChange(OrderMessage orderMessage) { public void orderChange(OrderMessage orderMessage) {
System.out.println(CachePrefix.ORDER.getPrefix() + orderMessage.getOrderSn());
if (orderMessage.getNewStatus().equals(OrderStatusEnum.PAID)) { if (orderMessage.getNewStatus().equals(OrderStatusEnum.PAID)) {
log.debug("满减活动,订单状态操作 {}", CachePrefix.ORDER.getPrefix() + orderMessage.getOrderSn());
renderGift((CartVO) cache.get(CachePrefix.ORDER.getPrefix() + orderMessage.getOrderSn()), orderMessage); renderGift((CartVO) cache.get(CachePrefix.ORDER.getPrefix() + orderMessage.getOrderSn()), orderMessage);
} }
} }
@ -118,10 +118,8 @@ public class FullDiscountExecute implements TradeEvent, OrderStatusChangeEvent {
try { try {
//优惠券判定 //优惠券判定
if (cartVO.getGiftCouponList() != null && cartVO.getGiftCouponList().size() > 0) { if (cartVO.getGiftCouponList() != null && !cartVO.getGiftCouponList().isEmpty()) {
cartVO.getGiftCouponList().forEach(couponId -> { cartVO.getGiftCouponList().forEach(couponId -> memberCouponService.receiveCoupon(couponId, order.getMemberId(), order.getMemberName()));
memberCouponService.receiveCoupon(couponId, order.getMemberId(), order.getMemberName());
});
} }
} catch (Exception e) { } catch (Exception e) {
log.error("订单赠送优惠券异常", e); log.error("订单赠送优惠券异常", e);
@ -129,7 +127,7 @@ public class FullDiscountExecute implements TradeEvent, OrderStatusChangeEvent {
try { try {
//赠品潘迪ing //赠品潘迪ing
if (cartVO.getGiftList() != null && cartVO.getGiftList().size() > 0) { if (cartVO.getGiftList() != null && !cartVO.getGiftList().isEmpty()) {
generatorGiftOrder(cartVO.getGiftList(), order); generatorGiftOrder(cartVO.getGiftList(), order);
} }
} catch (Exception e) { } catch (Exception e) {

View File

@ -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.FullDiscount;
import cn.lili.modules.promotion.entity.dos.PromotionGoods; import cn.lili.modules.promotion.entity.dos.PromotionGoods;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.List; import java.util.List;
@ -13,6 +14,7 @@ import java.util.List;
* @author Chopper * @author Chopper
* @since 2020-04-01 10:42 上午 * @since 2020-04-01 10:42 上午
*/ */
@EqualsAndHashCode(callSuper = true)
@Data @Data
public class FullDiscountVO extends FullDiscount { public class FullDiscountVO extends FullDiscount {
@ -47,6 +49,9 @@ public class FullDiscountVO extends FullDiscount {
if (Boolean.TRUE.equals(this.getIsPoint())) { if (Boolean.TRUE.equals(this.getIsPoint())) {
stringBuffer.append("").append(this.getPoint()).append("积分 "); stringBuffer.append("").append(this.getPoint()).append("积分 ");
} }
if (Boolean.TRUE.equals(this.getIsCoupon())) {
stringBuffer.append("").append("优惠券 ");
}
if (Boolean.TRUE.equals(this.getIsGift() && giftSku != null)) { if (Boolean.TRUE.equals(this.getIsGift() && giftSku != null)) {
stringBuffer.append(" 赠品[").append(giftSku.getGoodsName()).append("]"); stringBuffer.append(" 赠品[").append(giftSku.getGoodsName()).append("]");
} }

View File

@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode;
import javax.validation.constraints.DecimalMax; import javax.validation.constraints.DecimalMax;
import javax.validation.constraints.NotEmpty; import javax.validation.constraints.NotEmpty;
@ -16,6 +17,7 @@ import javax.validation.constraints.NotNull;
* @author Chopper * @author Chopper
* @since 2020-03-19 10:44 上午 * @since 2020-03-19 10:44 上午
*/ */
@EqualsAndHashCode(callSuper = true)
@Data @Data
@TableName("li_full_discount") @TableName("li_full_discount")
@ApiModel(value = "满优惠活动") @ApiModel(value = "满优惠活动")