mirror of
				https://gitee.com/hhyykk/ipms-sjy.git
				synced 2025-11-04 12:18:42 +08:00 
			
		
		
		
	!602 mall: 发送优惠券功能优化
Merge pull request !602 from 疯狂的世界/mall_coupon_take
This commit is contained in:
		@@ -15,11 +15,9 @@ import java.util.Arrays;
 | 
			
		||||
@Getter
 | 
			
		||||
public enum CouponTakeTypeEnum implements IntArrayValuable {
 | 
			
		||||
 | 
			
		||||
    COMMON(0, "通用"), // TODO @疯狂:要不去掉“通用"和“兑换”,保持和 crmeb 一致;就手动领取、指定发送、新人券
 | 
			
		||||
    BY_USER(1, "直接领取"), // 用户可在首页、每日领劵直接领取
 | 
			
		||||
    BY_ADMIN(2, "指定发放"), // 后台指定会员赠送优惠劵
 | 
			
		||||
    BY_REGISTER(3, "新人券"), // 注册时自动领取
 | 
			
		||||
    BY_EXCHANGE(4, "兑换"), // 一般渠道券通过兑换领取
 | 
			
		||||
    ;
 | 
			
		||||
 | 
			
		||||
    public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(CouponTakeTypeEnum::getValue).toArray();
 | 
			
		||||
 
 | 
			
		||||
@@ -76,8 +76,8 @@ public class CouponController {
 | 
			
		||||
    @Operation(summary = "发送优惠劵")
 | 
			
		||||
    @PreAuthorize("@ss.hasPermission('promotion:coupon:send')")
 | 
			
		||||
    public CommonResult<Boolean> sendCoupon(@Valid @RequestBody CouponSendReqVO reqVO) {
 | 
			
		||||
        Boolean result = couponService.sendCoupon(reqVO.getTemplateId(), reqVO.getUserIds());
 | 
			
		||||
        return success(result);
 | 
			
		||||
        couponService.takeCouponByAdmin(reqVO.getTemplateId(), reqVO.getUserIds());
 | 
			
		||||
        return success(true);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -1,12 +1,10 @@
 | 
			
		||||
package cn.iocoder.yudao.module.promotion.controller.admin.coupon;
 | 
			
		||||
 | 
			
		||||
import cn.hutool.core.collection.ListUtil;
 | 
			
		||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
 | 
			
		||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
 | 
			
		||||
import cn.iocoder.yudao.module.promotion.controller.admin.coupon.vo.template.*;
 | 
			
		||||
import cn.iocoder.yudao.module.promotion.convert.coupon.CouponTemplateConvert;
 | 
			
		||||
import cn.iocoder.yudao.module.promotion.dal.dataobject.coupon.CouponTemplateDO;
 | 
			
		||||
import cn.iocoder.yudao.module.promotion.enums.coupon.CouponTakeTypeEnum;
 | 
			
		||||
import cn.iocoder.yudao.module.promotion.service.coupon.CouponTemplateService;
 | 
			
		||||
import io.swagger.v3.oas.annotations.Operation;
 | 
			
		||||
import io.swagger.v3.oas.annotations.Parameter;
 | 
			
		||||
@@ -17,7 +15,6 @@ import org.springframework.web.bind.annotation.*;
 | 
			
		||||
 | 
			
		||||
import javax.annotation.Resource;
 | 
			
		||||
import javax.validation.Valid;
 | 
			
		||||
import java.util.List;
 | 
			
		||||
 | 
			
		||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
 | 
			
		||||
 | 
			
		||||
@@ -78,15 +75,4 @@ public class CouponTemplateController {
 | 
			
		||||
        PageResult<CouponTemplateDO> pageResult = couponTemplateService.getCouponTemplatePage(pageVO);
 | 
			
		||||
        return success(CouponTemplateConvert.INSTANCE.convertPage(pageResult));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    // TODO @疯狂:是不是可以合并到 getCouponTemplatePage 接口,作为一个参数选择
 | 
			
		||||
    @GetMapping("/can-take-page")
 | 
			
		||||
    @Operation(summary = "获得可用于领取的优惠劵模板分页")
 | 
			
		||||
    @PreAuthorize("@ss.hasPermission('promotion:coupon-template:query')")
 | 
			
		||||
    public CommonResult<PageResult<CouponTemplateRespVO>> getCanTakeCouponTemplatePage(@Valid CouponTemplatePageReqVO pageVO) {
 | 
			
		||||
        List<Integer> canTakeTypes = ListUtil.of(CouponTakeTypeEnum.COMMON.getValue(), CouponTakeTypeEnum.BY_ADMIN.getValue());
 | 
			
		||||
        PageResult<CouponTemplateDO> pageResult = couponTemplateService.getCanTakeCouponTemplatePage(pageVO, canTakeTypes);
 | 
			
		||||
        return success(CouponTemplateConvert.INSTANCE.convertPage(pageResult));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -8,6 +8,7 @@ import lombok.ToString;
 | 
			
		||||
import org.springframework.format.annotation.DateTimeFormat;
 | 
			
		||||
 | 
			
		||||
import java.time.LocalDateTime;
 | 
			
		||||
import java.util.List;
 | 
			
		||||
 | 
			
		||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
 | 
			
		||||
 | 
			
		||||
@@ -30,4 +31,6 @@ public class CouponTemplatePageReqVO extends PageParam {
 | 
			
		||||
    @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
 | 
			
		||||
    private LocalDateTime[] createTime;
 | 
			
		||||
 | 
			
		||||
    @Schema(description = "可以领取的类型", example = "[1,2]")
 | 
			
		||||
    private List<Integer> canTakeTypes;
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -55,8 +55,7 @@ public interface CouponMapper extends BaseMapperX<CouponDO> {
 | 
			
		||||
                .eq(CouponDO::getStatus, status));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    // TODO @疯狂:要 selectList 哈;
 | 
			
		||||
    default List<CouponDO> selectByTemplateIdAndUserId(Long templateId, Collection<Long> userIds) {
 | 
			
		||||
    default List<CouponDO> selectListByTemplateIdAndUserId(Long templateId, Collection<Long> userIds) {
 | 
			
		||||
        return selectList(new LambdaQueryWrapperX<CouponDO>()
 | 
			
		||||
                .eq(CouponDO::getTemplateId, templateId)
 | 
			
		||||
                .in(CouponDO::getUserId, userIds)
 | 
			
		||||
 
 | 
			
		||||
@@ -1,5 +1,6 @@
 | 
			
		||||
package cn.iocoder.yudao.module.promotion.dal.mysql.coupon;
 | 
			
		||||
 | 
			
		||||
import cn.hutool.core.collection.CollUtil;
 | 
			
		||||
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
 | 
			
		||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
 | 
			
		||||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
 | 
			
		||||
@@ -11,7 +12,6 @@ import org.apache.ibatis.annotations.Mapper;
 | 
			
		||||
import org.apache.ibatis.annotations.Param;
 | 
			
		||||
 | 
			
		||||
import java.time.LocalDateTime;
 | 
			
		||||
import java.util.Collection;
 | 
			
		||||
import java.util.function.Consumer;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
@@ -23,27 +23,23 @@ import java.util.function.Consumer;
 | 
			
		||||
public interface CouponTemplateMapper extends BaseMapperX<CouponTemplateDO> {
 | 
			
		||||
 | 
			
		||||
    default PageResult<CouponTemplateDO> selectPage(CouponTemplatePageReqVO reqVO) {
 | 
			
		||||
        Consumer<LambdaQueryWrapper<CouponTemplateDO>> canTakeConsumer = null;
 | 
			
		||||
        if (CollUtil.isNotEmpty(reqVO.getCanTakeTypes())) {
 | 
			
		||||
            // 构建可领取的查询条件, 好啰嗦  ( ╯-_-)╯┴—┴
 | 
			
		||||
            canTakeConsumer = w ->
 | 
			
		||||
                    w.eq(CouponTemplateDO::getStatus, CommonStatusEnum.ENABLE.getStatus()) // 1. 状态为可用的
 | 
			
		||||
                            .in(CouponTemplateDO::getTakeType, reqVO.getCanTakeTypes()) // 2. 领取方式一致
 | 
			
		||||
                            .and(ww -> ww.isNull(CouponTemplateDO::getValidEndTime)  // 3. 未过期
 | 
			
		||||
                                    .or().gt(CouponTemplateDO::getValidEndTime, LocalDateTime.now()))
 | 
			
		||||
                            .apply(" take_count < total_count "); // 4. 剩余数量大于 0
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return selectPage(reqVO, new LambdaQueryWrapperX<CouponTemplateDO>()
 | 
			
		||||
                .likeIfPresent(CouponTemplateDO::getName, reqVO.getName())
 | 
			
		||||
                .eqIfPresent(CouponTemplateDO::getStatus, reqVO.getStatus())
 | 
			
		||||
                .eqIfPresent(CouponTemplateDO::getDiscountType, reqVO.getDiscountType())
 | 
			
		||||
                .betweenIfPresent(CouponTemplateDO::getCreateTime, reqVO.getCreateTime())
 | 
			
		||||
                .orderByDesc(CouponTemplateDO::getId));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    default PageResult<CouponTemplateDO> selectCanTakePage(CouponTemplatePageReqVO reqVO, Collection<Integer> takeTypes) {
 | 
			
		||||
        // 构建可领取的查询条件, 好啰嗦  ( ╯-_-)╯┴—┴
 | 
			
		||||
        Consumer<LambdaQueryWrapper<CouponTemplateDO>> canTakeConsumer = w ->
 | 
			
		||||
                w.eq(CouponTemplateDO::getStatus, CommonStatusEnum.ENABLE.getStatus()) // 1. 状态为可用的
 | 
			
		||||
                        .in(CouponTemplateDO::getTakeType, takeTypes) // 2. 领取方式一致
 | 
			
		||||
                        .and(ww ->  ww.isNull(CouponTemplateDO::getValidEndTime)  // 3. 未过期
 | 
			
		||||
                                .or().gt(CouponTemplateDO::getValidEndTime, LocalDateTime.now()))
 | 
			
		||||
                        .apply(" take_count < total_count "); // 4. 剩余数量大于 0
 | 
			
		||||
        return selectPage(reqVO, new LambdaQueryWrapperX<CouponTemplateDO>()
 | 
			
		||||
                .likeIfPresent(CouponTemplateDO::getName, reqVO.getName())
 | 
			
		||||
                .eqIfPresent(CouponTemplateDO::getDiscountType, reqVO.getDiscountType())
 | 
			
		||||
                .betweenIfPresent(CouponTemplateDO::getCreateTime, reqVO.getCreateTime())
 | 
			
		||||
                .and(canTakeConsumer)
 | 
			
		||||
                .and(canTakeConsumer != null, canTakeConsumer)
 | 
			
		||||
                .orderByDesc(CouponTemplateDO::getId));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -78,27 +78,23 @@ public interface CouponService {
 | 
			
		||||
     */
 | 
			
		||||
    Long getUnusedCouponCount(Long userId);
 | 
			
		||||
 | 
			
		||||
    // TODO @疯狂:可以返回 void;因为都是 true = =
 | 
			
		||||
    /**
 | 
			
		||||
     * 领取优惠券
 | 
			
		||||
     *
 | 
			
		||||
     * @param templateId 优惠券模板编号
 | 
			
		||||
     * @param userIds    用户编号列表
 | 
			
		||||
     * @param takeType    领取方式
 | 
			
		||||
     * @return 领取结果
 | 
			
		||||
     * @param takeType   领取方式
 | 
			
		||||
     */
 | 
			
		||||
    Boolean takeCoupon(Long templateId, Set<Long> userIds, CouponTakeTypeEnum takeType);
 | 
			
		||||
    void takeCoupon(Long templateId, Set<Long> userIds, CouponTakeTypeEnum takeType);
 | 
			
		||||
 | 
			
		||||
    // TODO @疯狂:感觉 3 个方法的命名,改成 takeCouponByAdmin;takeCouponByUser;takeCouponByRegister 会更容易理解哈;现在两个都叫 sendCoupon ,感觉不太好懂
 | 
			
		||||
    /**
 | 
			
		||||
     * 【管理员】给用户发送优惠券
 | 
			
		||||
     *
 | 
			
		||||
     * @param templateId 优惠券模板编号
 | 
			
		||||
     * @param userIds    用户编号列表
 | 
			
		||||
     * @return 发送结果
 | 
			
		||||
     */
 | 
			
		||||
    default Boolean sendCoupon(Long templateId, Set<Long> userIds) {
 | 
			
		||||
        return takeCoupon(templateId, userIds, CouponTakeTypeEnum.BY_ADMIN);
 | 
			
		||||
    default void takeCouponByAdmin(Long templateId, Set<Long> userIds) {
 | 
			
		||||
        takeCoupon(templateId, userIds, CouponTakeTypeEnum.BY_ADMIN);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
@@ -106,10 +102,9 @@ public interface CouponService {
 | 
			
		||||
     *
 | 
			
		||||
     * @param templateId 优惠券模板编号
 | 
			
		||||
     * @param userId     用户编号
 | 
			
		||||
     * @return 发送结果
 | 
			
		||||
     */
 | 
			
		||||
    default Boolean receiveCoupon(Long templateId, Long userId) {
 | 
			
		||||
        return takeCoupon(templateId, CollUtil.newHashSet(userId), CouponTakeTypeEnum.BY_USER);
 | 
			
		||||
    default void takeCouponByUser(Long templateId, Long userId) {
 | 
			
		||||
        takeCoupon(templateId, CollUtil.newHashSet(userId), CouponTakeTypeEnum.BY_USER);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
@@ -117,9 +112,8 @@ public interface CouponService {
 | 
			
		||||
     *
 | 
			
		||||
     * @param templateId 优惠券模板编号
 | 
			
		||||
     * @param userId     用户编号列表
 | 
			
		||||
     * @return 发送结果
 | 
			
		||||
     */
 | 
			
		||||
    default Boolean sendCoupon(Long templateId, Long userId) {
 | 
			
		||||
        return takeCoupon(templateId, CollUtil.newHashSet(userId), CouponTakeTypeEnum.BY_REGISTER);
 | 
			
		||||
    default void takeCouponByRegister(Long templateId, Long userId) {
 | 
			
		||||
        takeCoupon(templateId, CollUtil.newHashSet(userId), CouponTakeTypeEnum.BY_REGISTER);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -30,6 +30,7 @@ import java.util.Set;
 | 
			
		||||
import java.util.stream.Collectors;
 | 
			
		||||
 | 
			
		||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
 | 
			
		||||
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertList;
 | 
			
		||||
import static cn.iocoder.yudao.module.promotion.enums.ErrorCodeConstants.*;
 | 
			
		||||
import static java.util.Arrays.asList;
 | 
			
		||||
 | 
			
		||||
@@ -134,74 +135,63 @@ public class CouponServiceImpl implements CouponService {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public Boolean takeCoupon(Long templateId, Set<Long> userIds, CouponTakeTypeEnum takeType) {
 | 
			
		||||
        // 1. 校验并过滤用户
 | 
			
		||||
    public void takeCoupon(Long templateId, Set<Long> userIds, CouponTakeTypeEnum takeType) {
 | 
			
		||||
        CouponTemplateDO template = couponTemplateService.getCouponTemplate(templateId);
 | 
			
		||||
        userIds = validateAndFilterTakeUserId(template, userIds, takeType);
 | 
			
		||||
        // 1. 过滤掉达到领取限制的用户
 | 
			
		||||
        removeTakeLimitUserId(template, userIds);
 | 
			
		||||
        // 2. 校验用户
 | 
			
		||||
        validateCanTake(template, userIds, takeType);
 | 
			
		||||
 | 
			
		||||
        // 2. 批量保存优惠劵
 | 
			
		||||
        // TODO @疯狂:这里可以使用 CollectionUtils.convertList 更简洁;stream 可以简化很多代码,常用的 stream 操作,使用 util 可以进一步简洁,同时提升可读性
 | 
			
		||||
        List<CouponDO> couponList = userIds.stream()
 | 
			
		||||
                .map(userId -> CouponConvert.INSTANCE.convert(template, userId))
 | 
			
		||||
                .collect(Collectors.toList());
 | 
			
		||||
        couponMapper.insertBatch(couponList);
 | 
			
		||||
        // 3. 批量保存优惠劵
 | 
			
		||||
        couponMapper.insertBatch(convertList(userIds, userId -> CouponConvert.INSTANCE.convert(template, userId)));
 | 
			
		||||
 | 
			
		||||
        // 3. 增加优惠劵模板的领取数量
 | 
			
		||||
        couponTemplateService.updateCouponTemplateTakeCount(templateId, userIds.size());
 | 
			
		||||
        return true;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 校验优惠券模板, 并过滤不可以领取的用户
 | 
			
		||||
     * 校验优惠券是否可以领取
 | 
			
		||||
     *
 | 
			
		||||
     * @param couponTemplate 优惠券模板
 | 
			
		||||
     * @param userIds        领取人列表
 | 
			
		||||
     * @param takeType       领取方式
 | 
			
		||||
     * @return 可领取此券的用户列表
 | 
			
		||||
     */
 | 
			
		||||
    // TODO @疯狂:我建议哈,校验模版,和过滤用户分成两个方法;混在一起,有点小重,后续单测可能也比较难写哈;
 | 
			
		||||
    private Set<Long> validateAndFilterTakeUserId(CouponTemplateDO couponTemplate, Set<Long> userIds, CouponTakeTypeEnum takeType) {
 | 
			
		||||
        // 1.1 校验模板
 | 
			
		||||
    private void validateCanTake(CouponTemplateDO couponTemplate, Set<Long> userIds, CouponTakeTypeEnum takeType) {
 | 
			
		||||
        // 如果所有用户都领取过,则抛出异常
 | 
			
		||||
        if (userIds.isEmpty()) {
 | 
			
		||||
            throw exception(COUPON_TEMPLATE_USER_ALREADY_TAKE);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        // 校验模板
 | 
			
		||||
        if (couponTemplate == null) {
 | 
			
		||||
            throw exception(COUPON_TEMPLATE_NOT_EXISTS);
 | 
			
		||||
        }
 | 
			
		||||
        // 1.2 校验剩余数量
 | 
			
		||||
        // 校验剩余数量
 | 
			
		||||
        if (couponTemplate.getTakeCount() + userIds.size() > couponTemplate.getTotalCount()) {
 | 
			
		||||
            throw exception(COUPON_TEMPLATE_NOT_ENOUGH);
 | 
			
		||||
        }
 | 
			
		||||
        // 1.3 校验"固定日期"的有效期类型是否过期
 | 
			
		||||
        // 校验"固定日期"的有效期类型是否过期
 | 
			
		||||
        if (CouponTemplateValidityTypeEnum.DATE.getType().equals(couponTemplate.getValidityType())) {
 | 
			
		||||
            if (LocalDateTimeUtils.beforeNow(couponTemplate.getValidEndTime())) {
 | 
			
		||||
                throw exception(COUPON_TEMPLATE_EXPIRED);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        // 1.4 校验领取方式
 | 
			
		||||
        // TODO @疯狂:如果要做这样的判断,使用 !ObjectUtils.equalsAny() 会更简洁
 | 
			
		||||
        if (!CouponTakeTypeEnum.COMMON.getValue().equals(couponTemplate.getTakeType())) {
 | 
			
		||||
            if (ObjectUtil.notEqual(couponTemplate.getTakeType(), takeType.getValue())) {
 | 
			
		||||
                throw exception(COUPON_TEMPLATE_CANNOT_TAKE);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        // 2.1 过滤掉,已经领取到上限的用户
 | 
			
		||||
        List<CouponDO> alreadyTakeCoupons = couponMapper.selectByTemplateIdAndUserId(couponTemplate.getId(), userIds);
 | 
			
		||||
        // 校验新人券
 | 
			
		||||
        // TODO @疯狂:我在想,这个判断,是不是和下面的 couponTemplate.getTakeLimitCount() > 0 冗余了;可以先都过滤,然后最终去判断 userIds 是不是空了;
 | 
			
		||||
        if (CouponTakeTypeEnum.BY_REGISTER.equals(takeType)) {
 | 
			
		||||
            if (!alreadyTakeCoupons.isEmpty()) {
 | 
			
		||||
                throw exception(COUPON_TEMPLATE_USER_ALREADY_TAKE);
 | 
			
		||||
            }
 | 
			
		||||
        // 校验领取方式
 | 
			
		||||
        if (ObjectUtil.notEqual(couponTemplate.getTakeType(), takeType.getValue())) {
 | 
			
		||||
            throw exception(COUPON_TEMPLATE_CANNOT_TAKE);
 | 
			
		||||
        }
 | 
			
		||||
        // 校验领取数量限制
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private void removeTakeLimitUserId(CouponTemplateDO couponTemplate, Set<Long> userIds) {
 | 
			
		||||
        // 查询已领过券的用户
 | 
			
		||||
        List<CouponDO> alreadyTakeCoupons = couponMapper.selectListByTemplateIdAndUserId(couponTemplate.getId(), userIds);
 | 
			
		||||
 | 
			
		||||
        // 移除达到领取限制的用户
 | 
			
		||||
        if (couponTemplate.getTakeLimitCount() > 0) {
 | 
			
		||||
            Map<Long, Integer> userTakeCountMap = CollStreamUtil.groupBy(alreadyTakeCoupons, CouponDO::getUserId, Collectors.summingInt(c -> 1));
 | 
			
		||||
            userIds.removeIf(userId -> MapUtil.getInt(userTakeCountMap, userId, 0) >= couponTemplate.getTakeLimitCount());
 | 
			
		||||
            // 2.2 如果所有用户都领取过,则抛出异常
 | 
			
		||||
            if (userIds.isEmpty()) {
 | 
			
		||||
                throw exception(COUPON_TEMPLATE_USER_ALREADY_TAKE);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        return userIds;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -7,7 +7,6 @@ import cn.iocoder.yudao.module.promotion.controller.admin.coupon.vo.template.Cou
 | 
			
		||||
import cn.iocoder.yudao.module.promotion.dal.dataobject.coupon.CouponTemplateDO;
 | 
			
		||||
 | 
			
		||||
import javax.validation.Valid;
 | 
			
		||||
import java.util.List;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * 优惠劵模板 Service 接口
 | 
			
		||||
@@ -62,17 +61,6 @@ public interface CouponTemplateService {
 | 
			
		||||
     */
 | 
			
		||||
    PageResult<CouponTemplateDO> getCouponTemplatePage(CouponTemplatePageReqVO pageReqVO);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 获得优惠劵模板分页
 | 
			
		||||
     *
 | 
			
		||||
     * @param pageReqVO    分页查询
 | 
			
		||||
     * @param canTakeTypes 可领取的方式
 | 
			
		||||
     * @return 优惠劵模板分页
 | 
			
		||||
     */
 | 
			
		||||
    PageResult<CouponTemplateDO> getCanTakeCouponTemplatePage(CouponTemplatePageReqVO pageReqVO,
 | 
			
		||||
                                                              List<Integer> canTakeTypes);
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 更新优惠劵模板的领取数量
 | 
			
		||||
     *
 | 
			
		||||
 
 | 
			
		||||
@@ -12,7 +12,6 @@ import org.springframework.stereotype.Service;
 | 
			
		||||
import org.springframework.validation.annotation.Validated;
 | 
			
		||||
 | 
			
		||||
import javax.annotation.Resource;
 | 
			
		||||
import java.util.List;
 | 
			
		||||
 | 
			
		||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
 | 
			
		||||
import static cn.iocoder.yudao.module.promotion.enums.ErrorCodeConstants.COUPON_TEMPLATE_NOT_EXISTS;
 | 
			
		||||
@@ -88,11 +87,6 @@ public class CouponTemplateServiceImpl implements CouponTemplateService {
 | 
			
		||||
        return couponTemplateMapper.selectPage(pageReqVO);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public PageResult<CouponTemplateDO> getCanTakeCouponTemplatePage(CouponTemplatePageReqVO pageReqVO, List<Integer> canTakeTypes) {
 | 
			
		||||
        return couponTemplateMapper.selectCanTakePage(pageReqVO, canTakeTypes);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void updateCouponTemplateTakeCount(Long id, int incrCount) {
 | 
			
		||||
        couponTemplateMapper.updateTakeCount(id, incrCount);
 | 
			
		||||
 
 | 
			
		||||
@@ -217,8 +217,6 @@ public class TradeOrderUpdateServiceImpl implements TradeOrderUpdateService {
 | 
			
		||||
 | 
			
		||||
    // TODO @puhui999:订单超时,自动取消;
 | 
			
		||||
 | 
			
		||||
    // TODO @疯狂:用户手动取消订单;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 校验收件地址是否存在
 | 
			
		||||
     *
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user