【代码优化】商城: 满减送活动

This commit is contained in:
puhui999 2024-09-02 11:35:33 +08:00
parent 5ea3e5db0d
commit 81e3866665
3 changed files with 1 additions and 21 deletions

View File

@ -1,7 +1,6 @@
package cn.iocoder.yudao.module.promotion.controller.admin.reward.vo;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.BooleanUtil;
import cn.iocoder.yudao.framework.common.validation.InEnum;
import cn.iocoder.yudao.module.promotion.enums.common.PromotionConditionTypeEnum;
import cn.iocoder.yudao.module.promotion.enums.common.PromotionProductScopeEnum;
@ -77,24 +76,16 @@ public class RewardActivityBaseVO {
@NotNull(message = "规则是否包邮不能为空")
private Boolean freeDelivery;
@Schema(description = "是否赠送积分", requiredMode = Schema.RequiredMode.REQUIRED, example = "true")
@NotNull(message = "规则是否赠送积分不能为空")
private Boolean givePoint;
@Schema(description = "赠送的积分", requiredMode = Schema.RequiredMode.REQUIRED, example = "100")
private Integer point;
@Schema(description = "是否赠送优惠券", requiredMode = Schema.RequiredMode.REQUIRED, example = "true")
@NotNull(message = "规则是否赠送优惠券不能为空")
private Boolean giveCoupon;
@Schema(description = "赠送的优惠劵编号的数组", example = "1,2,3")
private Map<Long, Integer> giveCouponsMap;
@AssertTrue(message = "赠送的积分不能小于 1")
@JsonIgnore
public boolean isPointValid() {
return BooleanUtil.isFalse(givePoint) || (point != null && point >= 1);
return point == null || point >= 1;
}
}

View File

@ -100,20 +100,10 @@ public class RewardActivityDO extends BaseDO {
* 是否包邮
*/
private Boolean freeDelivery;
// TODO @puhui999是不是大于零就认为赠送积分哈简洁一点
/**
* 是否赠送积分
*/
private Boolean givePoint;
/**
* 赠送的积分
*/
private Integer point;
// TODO @puhui999非空就认为赠送优惠劵
/**
* 是否赠送优惠券
*/
private Boolean giveCoupon;
/**
* 赠送的优惠劵
*

View File

@ -159,7 +159,6 @@ public class RewardActivityServiceImpl implements RewardActivityService {
@Override
public List<RewardActivityMatchRespDTO> getMatchRewardActivityList(Collection<Long> spuIds) {
// TODO 芋艿待实现先指定然后再全局的
List<RewardActivityDO> list = rewardActivityMapper.selectListBySpuIdsAndStatus(spuIds, CommonStatusEnum.ENABLE.getStatus());
return BeanUtils.toBean(list, RewardActivityMatchRespDTO.class);
}