Commit 81e38666659cea502f9d1c921fa5278f8d12764c
1 parent
5ea3e5db
【代码优化】商城: 满减送活动
Showing
3 changed files
with
1 additions
and
21 deletions
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/reward/vo/RewardActivityBaseVO.java
| 1 | package cn.iocoder.yudao.module.promotion.controller.admin.reward.vo; | 1 | package cn.iocoder.yudao.module.promotion.controller.admin.reward.vo; |
| 2 | 2 | ||
| 3 | import cn.hutool.core.collection.CollUtil; | 3 | import cn.hutool.core.collection.CollUtil; |
| 4 | -import cn.hutool.core.util.BooleanUtil; | ||
| 5 | import cn.iocoder.yudao.framework.common.validation.InEnum; | 4 | import cn.iocoder.yudao.framework.common.validation.InEnum; |
| 6 | import cn.iocoder.yudao.module.promotion.enums.common.PromotionConditionTypeEnum; | 5 | import cn.iocoder.yudao.module.promotion.enums.common.PromotionConditionTypeEnum; |
| 7 | import cn.iocoder.yudao.module.promotion.enums.common.PromotionProductScopeEnum; | 6 | import cn.iocoder.yudao.module.promotion.enums.common.PromotionProductScopeEnum; |
| @@ -77,24 +76,16 @@ public class RewardActivityBaseVO { | @@ -77,24 +76,16 @@ public class RewardActivityBaseVO { | ||
| 77 | @NotNull(message = "规则是否包邮不能为空") | 76 | @NotNull(message = "规则是否包邮不能为空") |
| 78 | private Boolean freeDelivery; | 77 | private Boolean freeDelivery; |
| 79 | 78 | ||
| 80 | - @Schema(description = "是否赠送积分", requiredMode = Schema.RequiredMode.REQUIRED, example = "true") | ||
| 81 | - @NotNull(message = "规则是否赠送积分不能为空") | ||
| 82 | - private Boolean givePoint; | ||
| 83 | - | ||
| 84 | @Schema(description = "赠送的积分", requiredMode = Schema.RequiredMode.REQUIRED, example = "100") | 79 | @Schema(description = "赠送的积分", requiredMode = Schema.RequiredMode.REQUIRED, example = "100") |
| 85 | private Integer point; | 80 | private Integer point; |
| 86 | 81 | ||
| 87 | - @Schema(description = "是否赠送优惠券", requiredMode = Schema.RequiredMode.REQUIRED, example = "true") | ||
| 88 | - @NotNull(message = "规则是否赠送优惠券不能为空") | ||
| 89 | - private Boolean giveCoupon; | ||
| 90 | - | ||
| 91 | @Schema(description = "赠送的优惠劵编号的数组", example = "1,2,3") | 82 | @Schema(description = "赠送的优惠劵编号的数组", example = "1,2,3") |
| 92 | private Map<Long, Integer> giveCouponsMap; | 83 | private Map<Long, Integer> giveCouponsMap; |
| 93 | 84 | ||
| 94 | @AssertTrue(message = "赠送的积分不能小于 1") | 85 | @AssertTrue(message = "赠送的积分不能小于 1") |
| 95 | @JsonIgnore | 86 | @JsonIgnore |
| 96 | public boolean isPointValid() { | 87 | public boolean isPointValid() { |
| 97 | - return BooleanUtil.isFalse(givePoint) || (point != null && point >= 1); | 88 | + return point == null || point >= 1; |
| 98 | } | 89 | } |
| 99 | 90 | ||
| 100 | } | 91 | } |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/dataobject/reward/RewardActivityDO.java
| @@ -100,20 +100,10 @@ public class RewardActivityDO extends BaseDO { | @@ -100,20 +100,10 @@ public class RewardActivityDO extends BaseDO { | ||
| 100 | * 是否包邮 | 100 | * 是否包邮 |
| 101 | */ | 101 | */ |
| 102 | private Boolean freeDelivery; | 102 | private Boolean freeDelivery; |
| 103 | - // TODO @puhui999:是不是大于零,就认为赠送积分哈;简洁一点; | ||
| 104 | - /** | ||
| 105 | - * 是否赠送积分 | ||
| 106 | - */ | ||
| 107 | - private Boolean givePoint; | ||
| 108 | /** | 103 | /** |
| 109 | * 赠送的积分 | 104 | * 赠送的积分 |
| 110 | */ | 105 | */ |
| 111 | private Integer point; | 106 | private Integer point; |
| 112 | - // TODO @puhui999:非空,就认为赠送优惠劵 | ||
| 113 | - /** | ||
| 114 | - * 是否赠送优惠券 | ||
| 115 | - */ | ||
| 116 | - private Boolean giveCoupon; | ||
| 117 | /** | 107 | /** |
| 118 | * 赠送的优惠劵 | 108 | * 赠送的优惠劵 |
| 119 | * | 109 | * |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/reward/RewardActivityServiceImpl.java
| @@ -159,7 +159,6 @@ public class RewardActivityServiceImpl implements RewardActivityService { | @@ -159,7 +159,6 @@ public class RewardActivityServiceImpl implements RewardActivityService { | ||
| 159 | 159 | ||
| 160 | @Override | 160 | @Override |
| 161 | public List<RewardActivityMatchRespDTO> getMatchRewardActivityList(Collection<Long> spuIds) { | 161 | public List<RewardActivityMatchRespDTO> getMatchRewardActivityList(Collection<Long> spuIds) { |
| 162 | - // TODO 芋艿:待实现;先指定,然后再全局的; | ||
| 163 | List<RewardActivityDO> list = rewardActivityMapper.selectListBySpuIdsAndStatus(spuIds, CommonStatusEnum.ENABLE.getStatus()); | 162 | List<RewardActivityDO> list = rewardActivityMapper.selectListBySpuIdsAndStatus(spuIds, CommonStatusEnum.ENABLE.getStatus()); |
| 164 | return BeanUtils.toBean(list, RewardActivityMatchRespDTO.class); | 163 | return BeanUtils.toBean(list, RewardActivityMatchRespDTO.class); |
| 165 | } | 164 | } |