优惠劵模板相关逻辑的迁移
This commit is contained in:
@@ -1,58 +0,0 @@
|
||||
package cn.iocoder.mall.promotion.api.rpc.coupon;
|
||||
|
||||
import cn.iocoder.common.framework.validator.InEnum;
|
||||
import cn.iocoder.mall.promotion.api.enums.coupon.template.CouponTemplateStatusEnum;
|
||||
import cn.iocoder.mall.promotion.api.rpc.coupon.dto.*;
|
||||
|
||||
public interface CouponRpc {
|
||||
|
||||
// ========== 优惠劵(码)模板 ==========
|
||||
|
||||
CouponTemplateReqDTO getCouponTemplate(Integer couponTemplateId);
|
||||
|
||||
CouponTemplatePageRespDTO getCouponTemplatePage(CouponTemplatePageReqDTO couponTemplatePageDTO);
|
||||
|
||||
/**
|
||||
* 创建优惠码模板
|
||||
*
|
||||
* @param couponCodeTemplateAddDTO 优惠码模板添加 DTO
|
||||
* @return 优惠码模板
|
||||
*/
|
||||
CouponTemplateReqDTO addCouponCodeTemplate(CouponCodeTemplateAddReqDTO couponCodeTemplateAddDTO);
|
||||
|
||||
/**
|
||||
* 创建优惠劵模板
|
||||
*
|
||||
* @param couponCardTemplateAddDTO 优惠码模板添加 DTO
|
||||
* @return 优惠劵模板
|
||||
*/
|
||||
CouponTemplateReqDTO addCouponCardTemplate(CouponCardTemplateAddReqDTO couponCardTemplateAddDTO);
|
||||
|
||||
/**
|
||||
* 更新优惠码模板
|
||||
*
|
||||
* @param couponCodeTemplateUpdateDTO 优惠码模板修改 DTO
|
||||
* @return 是否成功
|
||||
*/
|
||||
Boolean updateCouponCodeTemplate(CouponCodeTemplateUpdateReqDTO couponCodeTemplateUpdateDTO);
|
||||
|
||||
/**
|
||||
* 更新优惠劵模板
|
||||
*
|
||||
* @param couponCardTemplateUpdateDTO 优惠劵模板修改 DTO
|
||||
* @return 是否成功
|
||||
*/
|
||||
Boolean updateCouponCardTemplate(CouponCardTemplateUpdateReqDTO couponCardTemplateUpdateDTO);
|
||||
|
||||
/**
|
||||
* 更新优惠劵(码)模板的状态
|
||||
*
|
||||
* @param adminId 操作管理员编号
|
||||
* @param couponTemplateId 模板编号
|
||||
* @param status 状态
|
||||
* @return 是否成功
|
||||
*/
|
||||
Boolean updateCouponTemplateStatus(Integer adminId, Integer couponTemplateId,
|
||||
@InEnum(value = CouponTemplateStatusEnum.class, message = "修改状态必须是 {value}") Integer status);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
package cn.iocoder.mall.promotion.api.rpc.coupon;
|
||||
|
||||
import cn.iocoder.common.framework.vo.CommonResult;
|
||||
import cn.iocoder.common.framework.vo.PageResult;
|
||||
import cn.iocoder.mall.promotion.api.rpc.coupon.dto.template.*;
|
||||
|
||||
/**
|
||||
* 优惠劵模板 Rpc 接口
|
||||
*/
|
||||
public interface CouponTemplateRpc {
|
||||
|
||||
// ========== 通用逻辑 =========
|
||||
|
||||
/**
|
||||
* 获得优惠劵(码)模板
|
||||
*
|
||||
* @param couponTemplateId 优惠劵模板编号
|
||||
* @return 优惠劵模板
|
||||
*/
|
||||
CommonResult<CouponTemplateRespDTO> getCouponTemplate(Integer couponTemplateId);
|
||||
|
||||
/**
|
||||
* 获得优惠劵(码)模板分页
|
||||
*
|
||||
* @param pageDTO 优惠劵模板分页查询
|
||||
* @return 优惠劵模板分页结果
|
||||
*/
|
||||
CommonResult<PageResult<CouponTemplateRespDTO>> pageCouponTemplate(CouponTemplatePageReqDTO pageDTO);
|
||||
|
||||
/**
|
||||
* 更新优惠劵(码)模板的状态
|
||||
*
|
||||
* @param updateStatusReqDTO 更新状态 DTO
|
||||
*/
|
||||
CommonResult<Boolean> updateCouponTemplateStatus(CouponCardTemplateUpdateStatusReqDTO updateStatusReqDTO);
|
||||
|
||||
// ========== 优惠劵模板 ==========
|
||||
|
||||
/**
|
||||
* 创建优惠劵模板
|
||||
*
|
||||
* @param createDTO 创建优惠劵模板 DTO
|
||||
* @return 优惠劵模板编号
|
||||
*/
|
||||
CommonResult<Integer> createCouponCardTemplate(CouponCardTemplateCreateReqDTO createDTO);
|
||||
|
||||
/**
|
||||
* 更新优惠劵模板
|
||||
*
|
||||
* @param updateDTO 更新优惠劵模板 DTO
|
||||
*/
|
||||
CommonResult<Boolean> updateCouponCardTemplate(CouponCardTemplateUpdateReqDTO updateDTO);
|
||||
|
||||
// ========== 优惠码模板 ==========
|
||||
|
||||
|
||||
}
|
||||
@@ -1,40 +0,0 @@
|
||||
package cn.iocoder.mall.promotion.api.rpc.coupon.dto;
|
||||
|
||||
import cn.iocoder.mall.promotion.api.rpc.coupon.CouponRpc;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 优惠劵商品 DTO
|
||||
*
|
||||
* 主要用于 {@link CouponRpc#getCouponCardList(Integer, List)}
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class CouponCardSpuRespDTO implements Serializable {
|
||||
|
||||
/**
|
||||
* 商品 SPU 编号
|
||||
*/
|
||||
private Integer spuId;
|
||||
/**
|
||||
* 商品 SKU 编号
|
||||
*/
|
||||
private Integer skuId;
|
||||
/**
|
||||
* 分类编号
|
||||
*/
|
||||
private Integer categoryId;
|
||||
/**
|
||||
* 价格
|
||||
*/
|
||||
private Integer price;
|
||||
/**
|
||||
* 数量
|
||||
*/
|
||||
private Integer quantity;
|
||||
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
package cn.iocoder.mall.promotion.api.rpc.coupon.dto;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 优惠码模板添加 DTO
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class CouponCodeTemplateAddReqDTO implements Serializable {
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
package cn.iocoder.mall.promotion.api.rpc.coupon.dto;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 优惠码模板更新 DTO
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class CouponCodeTemplateUpdateReqDTO implements Serializable {
|
||||
}
|
||||
@@ -1,38 +0,0 @@
|
||||
package cn.iocoder.mall.promotion.api.rpc.coupon.dto;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 优惠劵模板分页 DTO
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class CouponTemplatePageReqDTO implements Serializable {
|
||||
|
||||
/**
|
||||
* 类型
|
||||
*/
|
||||
private Integer type;
|
||||
/**
|
||||
* 标题
|
||||
*/
|
||||
private String title;
|
||||
/**
|
||||
* 状态
|
||||
*/
|
||||
private Integer status;
|
||||
/**
|
||||
* 优惠类型
|
||||
*/
|
||||
private Integer preferentialType;
|
||||
|
||||
@NotNull(message = "页码不能为空")
|
||||
private Integer pageNo;
|
||||
@NotNull(message = "每页条数不能为空")
|
||||
private Integer pageSize;
|
||||
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
package cn.iocoder.mall.promotion.api.rpc.coupon.dto;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 优惠劵(码)模板分页 BO
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class CouponTemplatePageRespDTO implements Serializable {
|
||||
|
||||
/**
|
||||
* 优惠劵(码)数组
|
||||
*/
|
||||
private List<CouponTemplateReqDTO> list;
|
||||
/**
|
||||
* 总量
|
||||
*/
|
||||
private Integer total;
|
||||
|
||||
}
|
||||
@@ -1,155 +0,0 @@
|
||||
package cn.iocoder.mall.promotion.api.rpc.coupon.dto;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 优惠劵(码)模板 BO
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class CouponTemplateReqDTO implements Serializable {
|
||||
|
||||
// ========== 基本信息 BEGIN ==========
|
||||
/**
|
||||
* 模板编号,自增唯一。
|
||||
*/
|
||||
private Integer id;
|
||||
/**
|
||||
* 标题
|
||||
*/
|
||||
private String title;
|
||||
/**
|
||||
* 使用说明
|
||||
*/
|
||||
private String description;
|
||||
/**
|
||||
* 类型
|
||||
*
|
||||
* 1-优惠劵
|
||||
* 2-优惠码
|
||||
*/
|
||||
private Integer type;
|
||||
/**
|
||||
* 码类型
|
||||
*
|
||||
* 1-一卡一码(UNIQUE)
|
||||
* 2-通用码(GENERAL)
|
||||
*
|
||||
* 【优惠码独有】 @see CouponCodeDO
|
||||
*/
|
||||
private Integer codeType;
|
||||
/**
|
||||
* 优惠码状态
|
||||
*
|
||||
* 1-开启中
|
||||
* 2-禁用中
|
||||
* 3-已过期
|
||||
*
|
||||
* 当优惠劵(码)开启中,可以手动操作,设置禁用中。
|
||||
*/
|
||||
private Integer status;
|
||||
/**
|
||||
* 每人限领个数
|
||||
*
|
||||
* null - 则表示不限制
|
||||
*/
|
||||
private Integer quota;
|
||||
/**
|
||||
* 发放总量
|
||||
*/
|
||||
private Integer total;
|
||||
// ========== 领取规则 END ==========
|
||||
|
||||
// ========== 使用规则 BEGIN ==========
|
||||
/**
|
||||
* 是否设置满多少金额可用,单位:分
|
||||
*
|
||||
* 0-不限制
|
||||
* 大于0-多少金额可用
|
||||
*/
|
||||
private Integer priceAvailable;
|
||||
/**
|
||||
* 可用范围的类型
|
||||
*
|
||||
* 10-全部(ALL):所有可用
|
||||
* 20-部分(PART):部分商品可用,或指定商品可用
|
||||
* 21-部分(PART):部分商品不可用,或指定商品可用
|
||||
* 30-部分(PART):部分分类可用,或指定商品可用
|
||||
* 31-部分(PART):部分分类不可用,或指定商品可用
|
||||
*/
|
||||
private Integer rangeType;
|
||||
/**
|
||||
* 指定商品 / 分类列表,使用逗号分隔商品编号
|
||||
*/
|
||||
private String rangeValues;
|
||||
/**
|
||||
* 生效日期类型
|
||||
*
|
||||
* 1-固定日期
|
||||
* 2-领取日期:领到券 {@link #fixedStartTerm} 日开始 N 天内有效
|
||||
*/
|
||||
private Integer dateType;
|
||||
/**
|
||||
* 固定日期-生效开始时间
|
||||
*/
|
||||
private Date validStartTime;
|
||||
/**
|
||||
* 固定日期-生效结束时间
|
||||
*/
|
||||
private Date validEndTime;
|
||||
/**
|
||||
* 领取日期-开始天数
|
||||
*
|
||||
* 例如,0-当天;1-次天
|
||||
*/
|
||||
private Integer fixedStartTerm;
|
||||
/**
|
||||
* 领取日期-结束天数
|
||||
*/
|
||||
private Integer fixedEndTerm;
|
||||
// ========== 使用规则 END ==========
|
||||
|
||||
// ========== 使用效果 BEGIN ==========
|
||||
/**
|
||||
* 优惠类型
|
||||
*
|
||||
* 1-代金卷
|
||||
* 2-折扣卷
|
||||
*/
|
||||
private Integer preferentialType;
|
||||
/**
|
||||
* 折扣百分比。
|
||||
*
|
||||
* 例如,80% 为 80。
|
||||
* 当 100% 为 100 ,则代表免费。
|
||||
*/
|
||||
private Integer percentOff;
|
||||
/**
|
||||
* 优惠金额,单位:分
|
||||
*/
|
||||
private Integer priceOff;
|
||||
/**
|
||||
* 折扣上限,仅在 {@link #preferentialType} 等于 2 时生效。
|
||||
*
|
||||
* 例如,折扣上限为 20 元,当使用 8 折优惠券,订单金额为 1000 元时,最高只可折扣 20 元,而非 80 元。
|
||||
*/
|
||||
private Integer discountPriceLimit;
|
||||
// ========== 使用效果 END ==========
|
||||
|
||||
// ========== 统计信息 BEGIN ==========
|
||||
/**
|
||||
* 领取优惠券的次数
|
||||
*/
|
||||
private Integer statFetchNum;
|
||||
// ========== 统计信息 END ==========
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Date createTime;
|
||||
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package cn.iocoder.mall.promotion.api.rpc.coupon.dto;
|
||||
package cn.iocoder.mall.promotion.api.rpc.coupon.dto.template;
|
||||
|
||||
import cn.iocoder.common.framework.validator.InEnum;
|
||||
import cn.iocoder.mall.promotion.api.enums.coupon.template.CouponTemplateDateTypeEnum;
|
||||
@@ -16,11 +16,11 @@ import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 优惠劵模板添加 DTO
|
||||
* 优惠劵模板创建 Request DTO
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class CouponCardTemplateAddReqDTO implements Serializable {
|
||||
public class CouponCardTemplateCreateReqDTO implements Serializable {
|
||||
|
||||
// ========== 基本信息 BEGIN ==========
|
||||
/**
|
||||
@@ -1,4 +1,4 @@
|
||||
package cn.iocoder.mall.promotion.api.rpc.coupon.dto;
|
||||
package cn.iocoder.mall.promotion.api.rpc.coupon.dto.template;
|
||||
|
||||
import cn.iocoder.common.framework.validator.InEnum;
|
||||
import cn.iocoder.mall.promotion.api.enums.RangeTypeEnum;
|
||||
@@ -12,7 +12,7 @@ import javax.validation.constraints.NotNull;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 优惠劵模板更新 DTO
|
||||
* 优惠劵模板更新 Request DTO
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@@ -139,66 +139,4 @@ public class CouponCardTemplateUpdateReqDTO implements Serializable {
|
||||
// private Integer discountPriceLimit;
|
||||
// ========== 使用效果 END ==========
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public CouponCardTemplateUpdateReqDTO setId(Integer id) {
|
||||
this.id = id;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
public CouponCardTemplateUpdateReqDTO setTitle(String title) {
|
||||
this.title = title;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public CouponCardTemplateUpdateReqDTO setDescription(String description) {
|
||||
this.description = description;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Integer getQuota() {
|
||||
return quota;
|
||||
}
|
||||
|
||||
public CouponCardTemplateUpdateReqDTO setQuota(Integer quota) {
|
||||
this.quota = quota;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Integer getTotal() {
|
||||
return total;
|
||||
}
|
||||
|
||||
public CouponCardTemplateUpdateReqDTO setTotal(Integer total) {
|
||||
this.total = total;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Integer getRangeType() {
|
||||
return rangeType;
|
||||
}
|
||||
|
||||
public CouponCardTemplateUpdateReqDTO setRangeType(Integer rangeType) {
|
||||
this.rangeType = rangeType;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getRangeValues() {
|
||||
return rangeValues;
|
||||
}
|
||||
|
||||
public CouponCardTemplateUpdateReqDTO setRangeValues(String rangeValues) {
|
||||
this.rangeValues = rangeValues;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package cn.iocoder.mall.promotion.api.rpc.coupon.dto.template;
|
||||
|
||||
import cn.iocoder.common.framework.validator.InEnum;
|
||||
import cn.iocoder.mall.promotion.api.enums.coupon.template.CouponTemplateStatusEnum;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 优惠劵(码)模板更新状态 Request DTO
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class CouponCardTemplateUpdateStatusReqDTO implements Serializable {
|
||||
|
||||
/**
|
||||
* 编号
|
||||
*/
|
||||
@NotNull(message = "编号不能为空")
|
||||
private Integer id;
|
||||
/**
|
||||
* 状态
|
||||
*/
|
||||
@NotNull(message = "状态不能为空")
|
||||
@InEnum(value = CouponTemplateStatusEnum.class, message = "状态必须是 {value}")
|
||||
private Integer status;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package cn.iocoder.mall.promotion.api.rpc.coupon.dto.template;
|
||||
|
||||
import cn.iocoder.common.framework.vo.PageParam;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* 优惠劵模板分页 Request DTO
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Accessors(chain = true)
|
||||
public class CouponTemplatePageReqDTO extends PageParam {
|
||||
|
||||
/**
|
||||
* 类型
|
||||
*/
|
||||
private Integer type;
|
||||
/**
|
||||
* 标题
|
||||
*/
|
||||
private String title;
|
||||
/**
|
||||
* 状态
|
||||
*/
|
||||
private Integer status;
|
||||
/**
|
||||
* 优惠类型
|
||||
*/
|
||||
private Integer preferentialType;
|
||||
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package cn.iocoder.mall.promotionservice.convert.coupon.card;
|
||||
package cn.iocoder.mall.promotionservice.convert.coupon;
|
||||
|
||||
import cn.iocoder.common.framework.vo.PageResult;
|
||||
import cn.iocoder.mall.promotion.api.rpc.coupon.dto.card.CouponCardAvailableRespDTO;
|
||||
@@ -0,0 +1,37 @@
|
||||
package cn.iocoder.mall.promotionservice.convert.coupon;
|
||||
|
||||
import cn.iocoder.common.framework.util.StringUtils;
|
||||
import cn.iocoder.common.framework.vo.PageResult;
|
||||
import cn.iocoder.mall.promotion.api.rpc.coupon.dto.template.CouponCardTemplateCreateReqDTO;
|
||||
import cn.iocoder.mall.promotion.api.rpc.coupon.dto.template.CouponCardTemplateUpdateReqDTO;
|
||||
import cn.iocoder.mall.promotion.api.rpc.coupon.dto.template.CouponTemplateRespDTO;
|
||||
import cn.iocoder.mall.promotionservice.dal.mysql.dataobject.coupon.CouponTemplateDO;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.Mapping;
|
||||
import org.mapstruct.Named;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface CouponTemplateConvert {
|
||||
|
||||
CouponTemplateConvert INSTANCE = Mappers.getMapper(CouponTemplateConvert.class);
|
||||
|
||||
@Mapping(source = "rangeValues", target = "rangeValues", qualifiedByName = "translateStringToIntList")
|
||||
CouponTemplateRespDTO convert(CouponTemplateDO bean);
|
||||
|
||||
CouponTemplateDO convert(CouponCardTemplateCreateReqDTO bean);
|
||||
|
||||
CouponTemplateDO convert(CouponCardTemplateUpdateReqDTO bean);
|
||||
|
||||
@Mapping(source = "records", target = "list")
|
||||
PageResult<CouponTemplateRespDTO> convertPage(IPage<CouponTemplateDO> couponTemplatePage);
|
||||
|
||||
@Named("translateStringToIntList")
|
||||
default List<Integer> translateStringToIntList(String str) {
|
||||
return StringUtils.splitToInt(str, ",");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,54 +0,0 @@
|
||||
package cn.iocoder.mall.promotionservice.convert.coupon.card;
|
||||
|
||||
import cn.iocoder.common.framework.util.StringUtils;
|
||||
import cn.iocoder.mall.promotion.api.rpc.coupon.dto.*;
|
||||
import cn.iocoder.mall.promotion.api.rpc.coupon.dto.template.CouponTemplateRespDTO;
|
||||
import cn.iocoder.mall.promotionservice.dal.mysql.dataobject.coupon.CouponTemplateDO;
|
||||
import cn.iocoder.mall.promotionservice.service.coupon.bo.CouponCardTemplateAddBO;
|
||||
import cn.iocoder.mall.promotionservice.service.coupon.bo.CouponCardTemplateUpdateBO;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.Mapping;
|
||||
import org.mapstruct.Mappings;
|
||||
import org.mapstruct.Named;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface CouponTemplateConvert {
|
||||
|
||||
CouponTemplateConvert INSTANCE = Mappers.getMapper(CouponTemplateConvert.class);
|
||||
|
||||
// @Mappings({})
|
||||
// CouponTemplateBO convertToBO(CouponTemplateDO banner);
|
||||
|
||||
|
||||
List<CouponTemplateReqDTO> convertToDTO(List<CouponTemplateDO> templateList);
|
||||
|
||||
@Mappings({})
|
||||
CouponTemplateDO convert(CouponCodeTemplateUpdateReqDTO template);
|
||||
|
||||
@Mappings({})
|
||||
CouponTemplateDO convert(CouponCardTemplateAddReqDTO template);
|
||||
|
||||
@Mappings({})
|
||||
CouponTemplateDO convert(CouponCardTemplateUpdateReqDTO template);
|
||||
|
||||
@Mappings({})
|
||||
CouponTemplateDO convert(CouponCodeTemplateAddReqDTO template);
|
||||
|
||||
@Mappings({})
|
||||
CouponTemplateDO convert(CouponCardTemplateAddBO template);
|
||||
|
||||
@Mappings({})
|
||||
CouponTemplateDO convert(CouponCardTemplateUpdateBO template);
|
||||
|
||||
@Mapping(source = "rangeValues", target = "rangeValues", qualifiedByName = "translateStringToIntList")
|
||||
CouponTemplateRespDTO convert(CouponTemplateDO bean);
|
||||
|
||||
@Named("translateStringToIntList")
|
||||
default List<Integer> translateStringToIntList(String str) {
|
||||
return StringUtils.splitToInt(str, ",");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,7 +1,11 @@
|
||||
package cn.iocoder.mall.promotionservice.dal.mysql.dataobject.coupon;
|
||||
|
||||
import cn.iocoder.mall.mybatis.core.dataobject.BaseDO;
|
||||
import cn.iocoder.mall.promotion.api.enums.PreferentialTypeEnum;
|
||||
import cn.iocoder.mall.promotion.api.enums.RangeTypeEnum;
|
||||
import cn.iocoder.mall.promotion.api.enums.coupon.template.CouponTemplateDateTypeEnum;
|
||||
import cn.iocoder.mall.promotion.api.enums.coupon.template.CouponTemplateStatusEnum;
|
||||
import cn.iocoder.mall.promotion.api.enums.coupon.template.CouponTemplateTypeEnum;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
@@ -36,6 +40,8 @@ public class CouponTemplateDO extends BaseDO {
|
||||
/**
|
||||
* 类型
|
||||
*
|
||||
* 枚举 {@link CouponTemplateTypeEnum}
|
||||
*
|
||||
* 1-优惠劵
|
||||
* 2-优惠码
|
||||
*/
|
||||
@@ -43,7 +49,7 @@ public class CouponTemplateDO extends BaseDO {
|
||||
/**
|
||||
* 优惠码状态
|
||||
*
|
||||
* {@link CouponTemplateStatusEnum}
|
||||
* 枚举 {@link CouponTemplateStatusEnum}
|
||||
*
|
||||
* 当优惠劵(码)开启中,可以手动操作,设置禁用中。
|
||||
*/
|
||||
@@ -103,6 +109,8 @@ public class CouponTemplateDO extends BaseDO {
|
||||
/**
|
||||
* 可用范围的类型
|
||||
*
|
||||
* 枚举 {@link RangeTypeEnum}
|
||||
*
|
||||
* 10-全部(ALL):所有可用
|
||||
* 20-部分(PART):部分商品可用,或指定商品可用
|
||||
* 21-部分(PART):部分商品不可用,或指定商品可用
|
||||
@@ -117,6 +125,8 @@ public class CouponTemplateDO extends BaseDO {
|
||||
/**
|
||||
* 生效日期类型
|
||||
*
|
||||
* 枚举 {@link CouponTemplateDateTypeEnum}
|
||||
*
|
||||
* 1-固定日期
|
||||
* 2-领取日期:领到券 {@link #fixedStartTerm} 日开始 N 天内有效
|
||||
*/
|
||||
@@ -152,6 +162,8 @@ public class CouponTemplateDO extends BaseDO {
|
||||
/**
|
||||
* 优惠类型
|
||||
*
|
||||
* 枚举 {@link PreferentialTypeEnum}
|
||||
*
|
||||
* 1-代金卷
|
||||
* 2-折扣卷
|
||||
*/
|
||||
|
||||
@@ -1,26 +1,24 @@
|
||||
package cn.iocoder.mall.promotionservice.dal.mysql.mapper.coupon;
|
||||
|
||||
import cn.iocoder.mall.mybatis.core.query.QueryWrapperX;
|
||||
import cn.iocoder.mall.promotion.api.rpc.coupon.dto.template.CouponTemplatePageReqDTO;
|
||||
import cn.iocoder.mall.promotionservice.dal.mysql.dataobject.coupon.CouponTemplateDO;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Repository
|
||||
public interface CouponTemplateMapper extends BaseMapper<CouponTemplateDO> {
|
||||
|
||||
List<CouponTemplateDO> selectListByPage(@Param("type") Integer type,
|
||||
@Param("title") String title,
|
||||
@Param("status") Integer status,
|
||||
@Param("preferentialType") Integer preferentialType,
|
||||
@Param("offset") Integer offset,
|
||||
@Param("limit") Integer limit);
|
||||
|
||||
Integer selectCountByPage(@Param("type") Integer type,
|
||||
@Param("title") String title,
|
||||
@Param("status") Integer status,
|
||||
@Param("preferentialType") Integer preferentialType);
|
||||
default IPage<CouponTemplateDO> selectPage(CouponTemplatePageReqDTO pageReqDTO) {
|
||||
return selectPage(new Page<>(pageReqDTO.getPageNo(), pageReqDTO.getPageSize()),
|
||||
new QueryWrapperX<CouponTemplateDO>().eqIfPresent("type", pageReqDTO.getType())
|
||||
.likeIfPresent("title", pageReqDTO.getTitle())
|
||||
.eqIfPresent("status", pageReqDTO.getStatus())
|
||||
.eqIfPresent("preferential_type", pageReqDTO.getPreferentialType()));
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新优惠劵模板已领取的数量
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package cn.iocoder.mall.promotionservice.manager.coupon.card;
|
||||
package cn.iocoder.mall.promotionservice.manager.coupon;
|
||||
|
||||
import cn.iocoder.common.framework.vo.PageResult;
|
||||
import cn.iocoder.mall.promotion.api.rpc.coupon.dto.card.*;
|
||||
@@ -0,0 +1,43 @@
|
||||
package cn.iocoder.mall.promotionservice.manager.coupon;
|
||||
|
||||
import cn.iocoder.common.framework.vo.PageResult;
|
||||
import cn.iocoder.mall.promotion.api.rpc.coupon.dto.template.*;
|
||||
import cn.iocoder.mall.promotionservice.service.coupon.CouponTemplateService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* 优惠劵(码)模板 Manager
|
||||
*/
|
||||
@Service
|
||||
public class CouponTemplateManager {
|
||||
|
||||
@Autowired
|
||||
private CouponTemplateService couponTemplateService;
|
||||
|
||||
// ========== 通用逻辑 =========
|
||||
|
||||
public CouponTemplateRespDTO getCouponTemplate(Integer couponTemplateId) {
|
||||
return couponTemplateService.getCouponTemplate(couponTemplateId);
|
||||
}
|
||||
|
||||
public PageResult<CouponTemplateRespDTO> pageCouponTemplate(CouponTemplatePageReqDTO pageDTO) {
|
||||
return couponTemplateService.pageCouponTemplate(pageDTO);
|
||||
}
|
||||
|
||||
public void updateCouponTemplateStatus(CouponCardTemplateUpdateStatusReqDTO updateStatusReqDTO) {
|
||||
couponTemplateService.updateCouponTemplateStatus(updateStatusReqDTO.getId(), updateStatusReqDTO.getStatus());
|
||||
}
|
||||
|
||||
// ========== 优惠劵模板 ==========
|
||||
|
||||
public Integer createCouponCardTemplate(CouponCardTemplateCreateReqDTO createDTO) {
|
||||
return couponTemplateService.createCouponCardTemplate(createDTO);
|
||||
}
|
||||
|
||||
|
||||
public void updateCouponCardTemplate(CouponCardTemplateUpdateReqDTO updateDTO) {
|
||||
couponTemplateService.updateCouponCardTemplate(updateDTO);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -4,7 +4,7 @@ import cn.iocoder.common.framework.vo.CommonResult;
|
||||
import cn.iocoder.common.framework.vo.PageResult;
|
||||
import cn.iocoder.mall.promotion.api.rpc.coupon.CouponCardRpc;
|
||||
import cn.iocoder.mall.promotion.api.rpc.coupon.dto.card.*;
|
||||
import cn.iocoder.mall.promotionservice.manager.coupon.card.CouponCardManager;
|
||||
import cn.iocoder.mall.promotionservice.manager.coupon.CouponCardManager;
|
||||
import org.apache.dubbo.config.annotation.DubboService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
package cn.iocoder.mall.promotionservice.rpc.coupon;
|
||||
|
||||
import cn.iocoder.common.framework.vo.CommonResult;
|
||||
import cn.iocoder.common.framework.vo.PageResult;
|
||||
import cn.iocoder.mall.promotion.api.rpc.coupon.CouponTemplateRpc;
|
||||
import cn.iocoder.mall.promotion.api.rpc.coupon.dto.template.*;
|
||||
import cn.iocoder.mall.promotionservice.manager.coupon.CouponTemplateManager;
|
||||
import org.apache.dubbo.config.annotation.DubboService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import static cn.iocoder.common.framework.vo.CommonResult.success;
|
||||
|
||||
@DubboService
|
||||
public class CouponTemplateRpcImpl implements CouponTemplateRpc {
|
||||
|
||||
@Autowired
|
||||
private CouponTemplateManager couponTemplateManager;
|
||||
|
||||
// ========== 通用逻辑 =========
|
||||
|
||||
@Override
|
||||
public CommonResult<CouponTemplateRespDTO> getCouponTemplate(Integer couponTemplateId) {
|
||||
return success(couponTemplateManager.getCouponTemplate(couponTemplateId));
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommonResult<PageResult<CouponTemplateRespDTO>> pageCouponTemplate(CouponTemplatePageReqDTO pageDTO) {
|
||||
return success(couponTemplateManager.pageCouponTemplate(pageDTO));
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommonResult<Boolean> updateCouponTemplateStatus(CouponCardTemplateUpdateStatusReqDTO updateStatusReqDTO) {
|
||||
couponTemplateManager.updateCouponTemplateStatus(updateStatusReqDTO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
// ========== 优惠劵模板 ==========
|
||||
|
||||
@Override
|
||||
public CommonResult<Integer> createCouponCardTemplate(CouponCardTemplateCreateReqDTO createDTO) {
|
||||
return success(couponTemplateManager.createCouponCardTemplate(createDTO));
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommonResult<Boolean> updateCouponCardTemplate(CouponCardTemplateUpdateReqDTO updateDTO) {
|
||||
couponTemplateManager.updateCouponCardTemplate(updateDTO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -16,7 +16,7 @@ import cn.iocoder.mall.promotion.api.rpc.coupon.dto.card.CouponCardAvailableList
|
||||
import cn.iocoder.mall.promotion.api.rpc.coupon.dto.card.CouponCardAvailableRespDTO;
|
||||
import cn.iocoder.mall.promotion.api.rpc.coupon.dto.card.CouponCardPageReqDTO;
|
||||
import cn.iocoder.mall.promotion.api.rpc.coupon.dto.card.CouponCardRespDTO;
|
||||
import cn.iocoder.mall.promotionservice.convert.coupon.card.CouponCardConvert;
|
||||
import cn.iocoder.mall.promotionservice.convert.coupon.CouponCardConvert;
|
||||
import cn.iocoder.mall.promotionservice.dal.mysql.dataobject.coupon.CouponCardDO;
|
||||
import cn.iocoder.mall.promotionservice.dal.mysql.dataobject.coupon.CouponTemplateDO;
|
||||
import cn.iocoder.mall.promotionservice.dal.mysql.mapper.coupon.CouponCardMapper;
|
||||
@@ -42,6 +42,13 @@ public class CouponCardService {
|
||||
@Autowired
|
||||
private CouponTemplateMapper couponTemplateMapper;
|
||||
|
||||
/**
|
||||
* 获得用户的优惠劵
|
||||
*
|
||||
* @param userId 用户编号
|
||||
* @param couponCardId 优惠劵编号
|
||||
* @return 优惠劵
|
||||
*/
|
||||
public CouponCardRespDTO getCouponCard(Integer userId, Integer couponCardId) {
|
||||
CouponCardDO card = couponCardMapper.selectById(couponCardId);
|
||||
if (card == null) {
|
||||
|
||||
@@ -1,153 +0,0 @@
|
||||
package cn.iocoder.mall.promotionservice.service.coupon;
|
||||
|
||||
import cn.iocoder.common.framework.exception.util.ServiceExceptionUtil;
|
||||
import cn.iocoder.mall.promotion.api.enums.PromotionErrorCodeConstants;
|
||||
import cn.iocoder.mall.promotion.api.enums.coupon.template.CouponTemplateStatusEnum;
|
||||
import cn.iocoder.mall.promotion.api.enums.coupon.template.CouponTemplateTypeEnum;
|
||||
import cn.iocoder.mall.promotion.api.rpc.coupon.dto.CouponTemplatePageReqDTO;
|
||||
import cn.iocoder.mall.promotion.api.rpc.coupon.dto.CouponTemplatePageRespDTO;
|
||||
import cn.iocoder.mall.promotionservice.convert.coupon.card.CouponTemplateConvert;
|
||||
import cn.iocoder.mall.promotionservice.dal.mysql.dataobject.coupon.CouponTemplateDO;
|
||||
import cn.iocoder.mall.promotionservice.dal.mysql.mapper.coupon.CouponCardMapper;
|
||||
import cn.iocoder.mall.promotionservice.dal.mysql.mapper.coupon.CouponTemplateMapper;
|
||||
import cn.iocoder.mall.promotionservice.service.coupon.bo.CouponCardTemplateAddBO;
|
||||
import cn.iocoder.mall.promotionservice.service.coupon.bo.CouponCardTemplateUpdateBO;
|
||||
import cn.iocoder.mall.promotionservice.service.coupon.bo.CouponCodeTemplateUpdateBO;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@Service
|
||||
@Validated
|
||||
public class CouponService {
|
||||
|
||||
@Autowired
|
||||
private CouponTemplateMapper couponTemplateMapper;
|
||||
@Autowired
|
||||
private CouponCardMapper couponCardMapper;
|
||||
|
||||
// ========== 优惠劵(码)模板 ==========
|
||||
|
||||
public CouponTemplatePageRespDTO getCouponTemplatePage(CouponTemplatePageReqDTO couponTemplatePageDTO) {
|
||||
CouponTemplatePageRespDTO couponTemplatePageBO = new CouponTemplatePageRespDTO();
|
||||
// 查询分页数据
|
||||
int offset = (couponTemplatePageDTO.getPageNo() - 1) * couponTemplatePageDTO.getPageSize();
|
||||
couponTemplatePageBO.setList(CouponTemplateConvert.INSTANCE.convertToDTO(couponTemplateMapper.selectListByPage(
|
||||
couponTemplatePageDTO.getType(), couponTemplatePageDTO.getTitle(),
|
||||
couponTemplatePageDTO.getStatus(), couponTemplatePageDTO.getPreferentialType(),
|
||||
offset, couponTemplatePageDTO.getPageSize())));
|
||||
// 查询分页总数
|
||||
couponTemplatePageBO.setTotal(couponTemplateMapper.selectCountByPage(
|
||||
couponTemplatePageDTO.getType(), couponTemplatePageDTO.getTitle(),
|
||||
couponTemplatePageDTO.getStatus(), couponTemplatePageDTO.getPreferentialType()));
|
||||
return couponTemplatePageBO;
|
||||
}
|
||||
|
||||
public Integer addCouponCardTemplate(CouponCardTemplateAddBO couponCardTemplateAddDTO) {
|
||||
// 校验生效日期相关
|
||||
checkCouponTemplateDateType(couponCardTemplateAddDTO.getDateType(),
|
||||
couponCardTemplateAddDTO.getValidStartTime(), couponCardTemplateAddDTO.getValidEndTime(),
|
||||
couponCardTemplateAddDTO.getFixedBeginTerm(), couponCardTemplateAddDTO.getFixedEndTerm());
|
||||
// 校验优惠类型
|
||||
Boolean checkCouponTemplateDateTypeResult = checkCouponTemplatePreferentialType(
|
||||
couponCardTemplateAddDTO.getPreferentialType(), couponCardTemplateAddDTO.getPercentOff(),
|
||||
couponCardTemplateAddDTO.getPriceOff(), couponCardTemplateAddDTO.getPriceAvailable());
|
||||
// 保存优惠劵模板到数据库
|
||||
CouponTemplateDO template = CouponTemplateConvert.INSTANCE.convert(couponCardTemplateAddDTO)
|
||||
.setType(CouponTemplateTypeEnum.CARD.getValue())
|
||||
.setStatus(CouponTemplateStatusEnum.ENABLE.getValue())
|
||||
.setStatFetchNum(0);
|
||||
template.setCreateTime(new Date());
|
||||
couponTemplateMapper.insert(template);
|
||||
// 返回成功
|
||||
return template.getId();
|
||||
}
|
||||
|
||||
public Boolean updateCouponCodeTemplate(CouponCodeTemplateUpdateBO couponCodeTemplateUpdateDTO) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public Boolean updateCouponCardTemplate(CouponCardTemplateUpdateBO couponCardTemplateUpdateDTO) {
|
||||
// 校验 CouponCardTemplate 存在
|
||||
CouponTemplateDO template = couponTemplateMapper.selectById(couponCardTemplateUpdateDTO.getId());
|
||||
if (template == null) {
|
||||
throw ServiceExceptionUtil.exception(PromotionErrorCodeConstants.COUPON_TEMPLATE_NOT_EXISTS.getCode());
|
||||
}
|
||||
// 校验 CouponCardTemplate 是 CARD
|
||||
if (!CouponTemplateTypeEnum.CARD.getValue().equals(template.getType())) {
|
||||
throw ServiceExceptionUtil.exception(PromotionErrorCodeConstants.COUPON_TEMPLATE_NOT_CARD.getCode());
|
||||
}
|
||||
// 校验发放数量不能减少
|
||||
if (couponCardTemplateUpdateDTO.getTotal() < template.getTotal()) {
|
||||
throw ServiceExceptionUtil.exception(PromotionErrorCodeConstants.COUPON_TEMPLATE_TOTAL_CAN_NOT_REDUCE.getCode());
|
||||
}
|
||||
// 更新优惠劵模板到数据库
|
||||
CouponTemplateDO updateTemplateDO = CouponTemplateConvert.INSTANCE.convert(couponCardTemplateUpdateDTO);
|
||||
couponTemplateMapper.updateById(updateTemplateDO);
|
||||
// 返回成功
|
||||
return true;
|
||||
}
|
||||
|
||||
public Boolean updateCouponTemplateStatus(Integer adminId, Integer couponTemplateId, Integer status) {
|
||||
// 校验 CouponCardTemplate 存在
|
||||
CouponTemplateDO template = couponTemplateMapper.selectById(couponTemplateId);
|
||||
if (template == null) {
|
||||
throw ServiceExceptionUtil.exception(PromotionErrorCodeConstants.COUPON_TEMPLATE_NOT_EXISTS.getCode());
|
||||
}
|
||||
// 更新到数据库
|
||||
CouponTemplateDO updateTemplateDO = new CouponTemplateDO().setId(couponTemplateId).setStatus(status);
|
||||
couponTemplateMapper.updateById(updateTemplateDO);
|
||||
// 返回成功
|
||||
return true;
|
||||
}
|
||||
|
||||
private Boolean checkCouponTemplateDateType(Integer dateType, Date validStartTime, Date validEndTime, Integer fixedBeginTerm, Integer fixedEndTerm) {
|
||||
/*if (CouponTemplateDateTypeEnum.FIXED_DATE.getValue().equals(dateType)) { // 固定日期
|
||||
if (validStartTime == null) {
|
||||
throw ServiceExceptionUtil.exception(SysErrorCodeEnum.VALIDATION_REQUEST_PARAM_ERROR.getCode(), "生效开始时间不能为空");
|
||||
}
|
||||
if (validEndTime == null) {
|
||||
throw ServiceExceptionUtil.exception(SysErrorCodeEnum.VALIDATION_REQUEST_PARAM_ERROR.getCode(), "生效结束时间不能为空");
|
||||
}
|
||||
if (validStartTime.after(validEndTime)) {
|
||||
throw ServiceExceptionUtil.exception(SysErrorCodeEnum.VALIDATION_REQUEST_PARAM_ERROR.getCode(), "生效开始时间不能大于生效结束时间");
|
||||
}
|
||||
} else if (CouponTemplateDateTypeEnum.FIXED_TERM.getValue().equals(dateType)) { // 领取日期
|
||||
if (fixedBeginTerm == null) {
|
||||
throw ServiceExceptionUtil.exception(SysErrorCodeEnum.VALIDATION_REQUEST_PARAM_ERROR.getCode(), "领取日期开始时间不能为空");
|
||||
}
|
||||
if (fixedEndTerm == null) {
|
||||
throw ServiceExceptionUtil.exception(SysErrorCodeEnum.VALIDATION_REQUEST_PARAM_ERROR.getCode(), "领取日期结束时间不能为空");
|
||||
}
|
||||
} else {
|
||||
throw new IllegalArgumentException("未知的生效日期类型:" + dateType);
|
||||
}*/
|
||||
return true;
|
||||
}
|
||||
|
||||
private Boolean checkCouponTemplatePreferentialType(Integer preferentialType, Integer percentOff,
|
||||
Integer priceOff, Integer priceAvailable) {
|
||||
/*if (PreferentialTypeEnum.PRICE.getValue().equals(preferentialType)) {
|
||||
if (priceOff == null) {
|
||||
throw ServiceExceptionUtil.exception(SysErrorCodeEnum.VALIDATION_REQUEST_PARAM_ERROR.getCode(), "优惠金额不能为空");
|
||||
}
|
||||
if (priceOff >= priceAvailable) {
|
||||
throw ServiceExceptionUtil.exception(SysErrorCodeEnum.VALIDATION_REQUEST_PARAM_ERROR.getCode(), "优惠金额不能d大于等于使用金额门槛");
|
||||
}
|
||||
} else if (PreferentialTypeEnum.DISCOUNT.getValue().equals(preferentialType)) {
|
||||
if (percentOff == null) {
|
||||
throw ServiceExceptionUtil.exception(SysErrorCodeEnum.VALIDATION_REQUEST_PARAM_ERROR.getCode(), "折扣百分比不能为空");
|
||||
}
|
||||
} else {
|
||||
throw new IllegalArgumentException("未知的优惠类型:" + preferentialType);
|
||||
}*/
|
||||
return true;
|
||||
}
|
||||
|
||||
// ========== 优惠劵 ==========
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -1,12 +1,28 @@
|
||||
package cn.iocoder.mall.promotionservice.service.coupon;
|
||||
|
||||
import cn.iocoder.common.framework.exception.util.ServiceExceptionUtil;
|
||||
import cn.iocoder.common.framework.vo.PageResult;
|
||||
import cn.iocoder.mall.promotion.api.enums.PreferentialTypeEnum;
|
||||
import cn.iocoder.mall.promotion.api.enums.PromotionErrorCodeConstants;
|
||||
import cn.iocoder.mall.promotion.api.enums.coupon.template.CouponTemplateDateTypeEnum;
|
||||
import cn.iocoder.mall.promotion.api.enums.coupon.template.CouponTemplateStatusEnum;
|
||||
import cn.iocoder.mall.promotion.api.enums.coupon.template.CouponTemplateTypeEnum;
|
||||
import cn.iocoder.mall.promotion.api.rpc.coupon.dto.template.CouponCardTemplateCreateReqDTO;
|
||||
import cn.iocoder.mall.promotion.api.rpc.coupon.dto.template.CouponCardTemplateUpdateReqDTO;
|
||||
import cn.iocoder.mall.promotion.api.rpc.coupon.dto.template.CouponTemplatePageReqDTO;
|
||||
import cn.iocoder.mall.promotion.api.rpc.coupon.dto.template.CouponTemplateRespDTO;
|
||||
import cn.iocoder.mall.promotionservice.convert.coupon.card.CouponTemplateConvert;
|
||||
import cn.iocoder.mall.promotionservice.convert.coupon.CouponTemplateConvert;
|
||||
import cn.iocoder.mall.promotionservice.dal.mysql.dataobject.coupon.CouponTemplateDO;
|
||||
import cn.iocoder.mall.promotionservice.dal.mysql.mapper.coupon.CouponTemplateMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import static cn.iocoder.common.framework.exception.enums.GlobalErrorCodeConstants.BAD_REQUEST;
|
||||
|
||||
/**
|
||||
* 优惠劵模板 Service
|
||||
*/
|
||||
@@ -17,8 +33,141 @@ public class CouponTemplateService {
|
||||
@Autowired
|
||||
private CouponTemplateMapper couponTemplateMapper;
|
||||
|
||||
// ========== 通用逻辑 =========
|
||||
|
||||
/**
|
||||
* 获得优惠劵(码)模板
|
||||
*
|
||||
* @param couponCardId 优惠劵模板编号
|
||||
* @return 优惠劵(码)模板
|
||||
*/
|
||||
public CouponTemplateRespDTO getCouponTemplate(Integer couponCardId) {
|
||||
return CouponTemplateConvert.INSTANCE.convert(couponTemplateMapper.selectById(couponCardId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获得优惠劵(码)分页
|
||||
*
|
||||
* @param pageDTO 分页条件
|
||||
* @return 优惠劵(码)分页
|
||||
*/
|
||||
public PageResult<CouponTemplateRespDTO> pageCouponTemplate(CouponTemplatePageReqDTO pageDTO) {
|
||||
IPage<CouponTemplateDO> couponTemplatePage = couponTemplateMapper.selectPage(pageDTO);
|
||||
return CouponTemplateConvert.INSTANCE.convertPage(couponTemplatePage);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新优惠劵(码)模板的状态
|
||||
*
|
||||
* @param couponTemplateId 优惠劵模板编号
|
||||
* @param status 状态
|
||||
*/
|
||||
public void updateCouponTemplateStatus(Integer couponTemplateId, Integer status) {
|
||||
// 校验 CouponCardTemplate 存在
|
||||
CouponTemplateDO template = couponTemplateMapper.selectById(couponTemplateId);
|
||||
if (template == null) {
|
||||
throw ServiceExceptionUtil.exception(PromotionErrorCodeConstants.COUPON_TEMPLATE_NOT_EXISTS.getCode());
|
||||
}
|
||||
// 更新到数据库
|
||||
CouponTemplateDO updateTemplateDO = new CouponTemplateDO().setId(couponTemplateId).setStatus(status);
|
||||
couponTemplateMapper.updateById(updateTemplateDO);
|
||||
}
|
||||
|
||||
private Boolean checkCouponTemplateDateType(Integer dateType, Date validStartTime, Date validEndTime, Integer fixedBeginTerm, Integer fixedEndTerm) {
|
||||
// TODO 芋艿:后续这种类型的校验,看看怎么优化到对象里
|
||||
if (CouponTemplateDateTypeEnum.FIXED_DATE.getValue().equals(dateType)) { // 固定日期
|
||||
if (validStartTime == null) {
|
||||
throw ServiceExceptionUtil.exception(BAD_REQUEST, "生效开始时间不能为空");
|
||||
}
|
||||
if (validEndTime == null) {
|
||||
throw ServiceExceptionUtil.exception(BAD_REQUEST, "生效结束时间不能为空");
|
||||
}
|
||||
if (validStartTime.after(validEndTime)) {
|
||||
throw ServiceExceptionUtil.exception(BAD_REQUEST, "生效开始时间不能大于生效结束时间");
|
||||
}
|
||||
} else if (CouponTemplateDateTypeEnum.FIXED_TERM.getValue().equals(dateType)) { // 领取日期
|
||||
if (fixedBeginTerm == null) {
|
||||
throw ServiceExceptionUtil.exception(BAD_REQUEST, "领取日期开始时间不能为空");
|
||||
}
|
||||
if (fixedEndTerm == null) {
|
||||
throw ServiceExceptionUtil.exception(BAD_REQUEST, "领取日期结束时间不能为空");
|
||||
}
|
||||
} else {
|
||||
throw new IllegalArgumentException("未知的生效日期类型:" + dateType);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private Boolean checkCouponTemplatePreferentialType(Integer preferentialType, Integer percentOff,
|
||||
Integer priceOff, Integer priceAvailable) {
|
||||
if (PreferentialTypeEnum.PRICE.getValue().equals(preferentialType)) {
|
||||
if (priceOff == null) {
|
||||
throw ServiceExceptionUtil.exception(BAD_REQUEST, "优惠金额不能为空");
|
||||
}
|
||||
if (priceOff >= priceAvailable) {
|
||||
throw ServiceExceptionUtil.exception(BAD_REQUEST, "优惠金额不能d大于等于使用金额门槛");
|
||||
}
|
||||
} else if (PreferentialTypeEnum.DISCOUNT.getValue().equals(preferentialType)) {
|
||||
if (percentOff == null) {
|
||||
throw ServiceExceptionUtil.exception(BAD_REQUEST, "折扣百分比不能为空");
|
||||
}
|
||||
} else {
|
||||
throw new IllegalArgumentException("未知的优惠类型:" + preferentialType);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// ========== 优惠劵模板 ==========
|
||||
|
||||
/**
|
||||
* 添加优惠劵模板
|
||||
*
|
||||
* @param createReqDTO 优惠劵模板添加信息
|
||||
* @return 优惠劵模板编号
|
||||
*/
|
||||
public Integer createCouponCardTemplate(CouponCardTemplateCreateReqDTO createReqDTO) {
|
||||
// 校验生效日期相关
|
||||
checkCouponTemplateDateType(createReqDTO.getDateType(),
|
||||
createReqDTO.getValidStartTime(), createReqDTO.getValidEndTime(),
|
||||
createReqDTO.getFixedBeginTerm(), createReqDTO.getFixedEndTerm());
|
||||
// 校验优惠类型
|
||||
checkCouponTemplatePreferentialType(createReqDTO.getPreferentialType(), createReqDTO.getPercentOff(),
|
||||
createReqDTO.getPriceOff(), createReqDTO.getPriceAvailable());
|
||||
// 保存优惠劵模板到数据库
|
||||
CouponTemplateDO template = CouponTemplateConvert.INSTANCE.convert(createReqDTO)
|
||||
.setType(CouponTemplateTypeEnum.CARD.getValue())
|
||||
.setStatus(CouponTemplateStatusEnum.ENABLE.getValue())
|
||||
.setStatFetchNum(0);
|
||||
couponTemplateMapper.insert(template);
|
||||
// 返回成功
|
||||
return template.getId();
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新优惠劵模板
|
||||
*
|
||||
* @param updateReqDTO 优惠劵模板修改信息
|
||||
*/
|
||||
public void updateCouponCardTemplate(CouponCardTemplateUpdateReqDTO updateReqDTO) {
|
||||
// 校验 CouponCardTemplate 存在
|
||||
CouponTemplateDO template = couponTemplateMapper.selectById(updateReqDTO.getId());
|
||||
if (template == null) {
|
||||
throw ServiceExceptionUtil.exception(PromotionErrorCodeConstants.COUPON_TEMPLATE_NOT_EXISTS.getCode());
|
||||
}
|
||||
// 校验 CouponCardTemplate 是 CARD
|
||||
if (!CouponTemplateTypeEnum.CARD.getValue().equals(template.getType())) {
|
||||
throw ServiceExceptionUtil.exception(PromotionErrorCodeConstants.COUPON_TEMPLATE_NOT_CARD.getCode());
|
||||
}
|
||||
// 校验发放数量不能减少
|
||||
if (updateReqDTO.getTotal() < template.getTotal()) {
|
||||
throw ServiceExceptionUtil.exception(PromotionErrorCodeConstants.COUPON_TEMPLATE_TOTAL_CAN_NOT_REDUCE.getCode());
|
||||
}
|
||||
// 更新优惠劵模板到数据库
|
||||
CouponTemplateDO updateTemplateDO = CouponTemplateConvert.INSTANCE.convert(updateReqDTO);
|
||||
couponTemplateMapper.updateById(updateTemplateDO);
|
||||
}
|
||||
|
||||
// ========== 优惠码模板 TODO 芋艿:以后开发 ==========
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,140 +0,0 @@
|
||||
package cn.iocoder.mall.promotionservice.service.coupon.bo;
|
||||
|
||||
import cn.iocoder.common.framework.validator.InEnum;
|
||||
import cn.iocoder.mall.promotion.api.enums.coupon.template.CouponTemplateDateTypeEnum;
|
||||
import cn.iocoder.mall.promotion.api.enums.PreferentialTypeEnum;
|
||||
import cn.iocoder.mall.promotion.api.enums.RangeTypeEnum;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import javax.validation.constraints.Max;
|
||||
import javax.validation.constraints.Min;
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 优惠劵模板添加 DTO
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class CouponCardTemplateAddBO implements Serializable {
|
||||
|
||||
// ========== 基本信息 BEGIN ==========
|
||||
/**
|
||||
* 标题
|
||||
*/
|
||||
@NotEmpty(message = "标题不能为空")
|
||||
private String title;
|
||||
/**
|
||||
* 使用说明
|
||||
*/
|
||||
private String description;
|
||||
// ========== 基本信息 END ==========
|
||||
|
||||
// ========== 领取规则 BEGIN ==========
|
||||
/**
|
||||
* 每人限领个数
|
||||
*/
|
||||
@NotNull(message = "每人限领个数不能为空")
|
||||
@Min(value = 1, message = "每人限领个数最小为 {value}")
|
||||
private Integer quota;
|
||||
/**
|
||||
* 发放总量
|
||||
*/
|
||||
@NotNull(message = "发放总量不能为空")
|
||||
@Min(value = 1, message = "每人限领个数最小为 {value}")
|
||||
private Integer total;
|
||||
// ========== 领取规则 END ==========
|
||||
|
||||
// ========== 使用规则 BEGIN ==========
|
||||
/**
|
||||
* 是否设置满多少金额可用,单位:分
|
||||
*
|
||||
* 0-不限制
|
||||
* 大于0-多少金额可用
|
||||
*/
|
||||
@NotNull(message = "使用金额门槛不能为空")
|
||||
@Min(value = 0L, message = "使用金额门槛最低为 {value}")
|
||||
private Integer priceAvailable;
|
||||
/**
|
||||
* 可用范围的类型
|
||||
*
|
||||
* 10-全部(ALL):所有可用
|
||||
* 20-部分(PART):部分商品可用,或指定商品可用
|
||||
* 21-部分(PART):部分商品不可用,或指定商品可用
|
||||
* 30-部分(PART):部分分类可用,或指定分类可用
|
||||
* 31-部分(PART):部分分类不可用,或指定分类可用
|
||||
*/
|
||||
@NotNull(message = "可用范围的类型不能为空")
|
||||
@InEnum(value = RangeTypeEnum.class, message = "可用范围的类型必须在 {value}")
|
||||
private Integer rangeType;
|
||||
/**
|
||||
* 指定商品 / 分类列表,使用逗号分隔商品编号
|
||||
*/
|
||||
private String rangeValues;
|
||||
/**
|
||||
* 生效日期类型
|
||||
*
|
||||
* 1-固定日期
|
||||
* 2-领取日期:领到券 {@link #fixedEndTerm} 日开始 N 天内有效
|
||||
*/
|
||||
@NotNull(message = "生效日期类型不能为空")
|
||||
@InEnum(value = CouponTemplateDateTypeEnum.class, message = "生效日期类型必须在 {value}")
|
||||
private Integer dateType;
|
||||
/**
|
||||
* 固定日期-生效开始时间
|
||||
*/
|
||||
private Date validStartTime;
|
||||
/**
|
||||
* 固定日期-生效结束时间
|
||||
*/
|
||||
private Date validEndTime;
|
||||
/**
|
||||
* 领取日期-开始天数
|
||||
*
|
||||
* 例如,0-当天;1-次天
|
||||
*/
|
||||
@Min(value = 0L, message = "领取日期开始时间最小为 {value}")
|
||||
private Integer fixedBeginTerm;
|
||||
/**
|
||||
* 领取日期-结束天数
|
||||
*/
|
||||
@Min(value = 1L, message = "领取日期结束时间最小为 {value}")
|
||||
private Integer fixedEndTerm;
|
||||
// ========== 使用规则 END ==========
|
||||
|
||||
// ========== 使用效果 BEGIN ==========
|
||||
/**
|
||||
* 优惠类型
|
||||
*
|
||||
* 1-代金卷
|
||||
* 2-折扣卷
|
||||
*/
|
||||
@NotNull(message = "优惠类型不能为空")
|
||||
@InEnum(value = PreferentialTypeEnum.class, message = "优惠类型必须在 {value}")
|
||||
private Integer preferentialType;
|
||||
/**
|
||||
* 优惠金额,单位:分
|
||||
*/
|
||||
@Min(value = 1, message = "优惠金额最小值为 {value}")
|
||||
private Integer priceOff;
|
||||
/**
|
||||
* 折扣百分比。
|
||||
*
|
||||
* 例如,80% 为 80。
|
||||
* 当 100% 为 100 ,则代表免费。
|
||||
*/
|
||||
@Max(value = 100, message = "折扣比最大值为 {value}")
|
||||
private Integer percentOff;
|
||||
/**
|
||||
* 折扣上限,仅在 {@link #preferentialType} 等于 2 时生效。
|
||||
*
|
||||
* 例如,折扣上限为 20 元,当使用 8 折优惠券,订单金额为 1000 元时,最高只可折扣 20 元,而非 80 元。
|
||||
*/
|
||||
@Min(value = 1, message = "折扣上限最小值为 {value}")
|
||||
private Integer discountPriceLimit;
|
||||
// ========== 使用效果 END ==========
|
||||
|
||||
}
|
||||
@@ -1,201 +0,0 @@
|
||||
package cn.iocoder.mall.promotionservice.service.coupon.bo;
|
||||
|
||||
import cn.iocoder.common.framework.validator.InEnum;
|
||||
import cn.iocoder.mall.promotion.api.enums.RangeTypeEnum;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import javax.validation.constraints.Min;
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 优惠劵模板更新 DTO
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class CouponCardTemplateUpdateBO implements Serializable {
|
||||
|
||||
@NotNull(message = "编号不能为空")
|
||||
private Integer id;
|
||||
|
||||
// ========== 基本信息 BEGIN ==========
|
||||
/**
|
||||
* 标题
|
||||
*/
|
||||
@NotEmpty(message = "标题不能为空")
|
||||
private String title;
|
||||
/**
|
||||
* 使用说明
|
||||
*/
|
||||
private String description;
|
||||
// ========== 基本信息 END ==========
|
||||
|
||||
// ========== 领取规则 BEGIN ==========
|
||||
/**
|
||||
* 每人限领个数
|
||||
*/
|
||||
@NotNull(message = "每人限领个数不能为空")
|
||||
@Min(value = 1, message = "每人限领个数最小为 {value}")
|
||||
private Integer quota;
|
||||
/**
|
||||
* 发放总量
|
||||
*/
|
||||
@NotNull(message = "发放总量不能为空")
|
||||
@Min(value = 1, message = "每人限领个数最小为 {value}")
|
||||
private Integer total;
|
||||
// ========== 领取规则 END ==========
|
||||
|
||||
// ========== 使用规则 BEGIN ==========
|
||||
// /**
|
||||
// * 是否设置满多少金额可用,单位:分
|
||||
// *
|
||||
// * 0-不限制
|
||||
// * 大于0-多少金额可用
|
||||
// */
|
||||
// @NotNull(message = "使用金额门槛不能为空")
|
||||
// @Min(value = 0L, message = "使用金额门槛最低为 {value}")
|
||||
// private Integer priceAvailable;
|
||||
/**
|
||||
* 可用范围的类型
|
||||
*
|
||||
* 10-全部(ALL):所有可用
|
||||
* 20-部分(PART):部分商品可用,或指定商品可用
|
||||
* 21-部分(PART):部分商品不可用,或指定商品可用
|
||||
* 30-部分(PART):部分分类可用,或指定分类可用
|
||||
* 31-部分(PART):部分分类不可用,或指定分类可用
|
||||
*/
|
||||
@NotNull(message = "可用范围的类型不能为空")
|
||||
@InEnum(value = RangeTypeEnum.class, message = "可用范围的类型必须在 {value}")
|
||||
private Integer rangeType;
|
||||
/**
|
||||
* 指定商品 / 分类列表,使用逗号分隔商品编号
|
||||
*/
|
||||
private String rangeValues;
|
||||
// /**
|
||||
// * 生效日期类型
|
||||
// *
|
||||
// * 1-固定日期
|
||||
// * 2-领取日期:领到券 {@link #fixedEndTerm} 日开始 N 天内有效
|
||||
// */
|
||||
// @NotNull(message = "生效日期类型不能为空")
|
||||
// @InEnum(value = CouponTemplateDateTypeEnum.class, message = "生效日期类型必须在 {value}")
|
||||
// private Integer dateType;
|
||||
// /**
|
||||
// * 固定日期-生效开始时间
|
||||
// */
|
||||
// private Date validStartTime;
|
||||
// /**
|
||||
// * 固定日期-生效结束时间
|
||||
// */
|
||||
// private Date validEndTime;
|
||||
// /**
|
||||
// * 领取日期-开始天数
|
||||
// *
|
||||
// * 例如,0-当天;1-次天
|
||||
// */
|
||||
// @Min(value = 0L, message = "领取日期开始时间最小为 {value}")
|
||||
// private Integer fixedBeginTerm;
|
||||
// /**
|
||||
// * 领取日期-结束天数
|
||||
// */
|
||||
// @Min(value = 1L, message = "领取日期结束时间最小为 {value}")
|
||||
// private Integer fixedEndTerm;
|
||||
// ========== 使用规则 END ==========
|
||||
|
||||
// ========== 使用效果 BEGIN ==========
|
||||
// /**
|
||||
// * 优惠类型
|
||||
// *
|
||||
// * 1-代金卷
|
||||
// * 2-折扣卷
|
||||
// */
|
||||
// @NotNull(message = "优惠类型不能为空")
|
||||
// @InEnum(value = CouponTemplatePreferentialTypeEnum.class, message = "优惠类型必须在 {value}")
|
||||
// private Integer preferentialType;
|
||||
// /**
|
||||
// * 优惠金额,单位:分
|
||||
// */
|
||||
// @Min(value = 1, message = "优惠金额最小值为 {value}")
|
||||
// private Integer priceOff;
|
||||
// /**
|
||||
// * 折扣百分比。
|
||||
// *
|
||||
// * 例如,80% 为 80。
|
||||
// * 当 100% 为 100 ,则代表免费。
|
||||
// */
|
||||
// @Max(value = 100, message = "折扣比最大值为 {value}")
|
||||
// private Integer percentOff;
|
||||
// /**
|
||||
// * 折扣上限,仅在 {@link #preferentialType} 等于 2 时生效。
|
||||
// *
|
||||
// * 例如,折扣上限为 20 元,当使用 8 折优惠券,订单金额为 1000 元时,最高只可折扣 20 元,而非 80 元。
|
||||
// */
|
||||
// @Min(value = 1, message = "折扣上限最小值为 {value}")
|
||||
// private Integer discountPriceLimit;
|
||||
// ========== 使用效果 END ==========
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public CouponCardTemplateUpdateBO setId(Integer id) {
|
||||
this.id = id;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
public CouponCardTemplateUpdateBO setTitle(String title) {
|
||||
this.title = title;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public CouponCardTemplateUpdateBO setDescription(String description) {
|
||||
this.description = description;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Integer getQuota() {
|
||||
return quota;
|
||||
}
|
||||
|
||||
public CouponCardTemplateUpdateBO setQuota(Integer quota) {
|
||||
this.quota = quota;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Integer getTotal() {
|
||||
return total;
|
||||
}
|
||||
|
||||
public CouponCardTemplateUpdateBO setTotal(Integer total) {
|
||||
this.total = total;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Integer getRangeType() {
|
||||
return rangeType;
|
||||
}
|
||||
|
||||
public CouponCardTemplateUpdateBO setRangeType(Integer rangeType) {
|
||||
this.rangeType = rangeType;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getRangeValues() {
|
||||
return rangeValues;
|
||||
}
|
||||
|
||||
public CouponCardTemplateUpdateBO setRangeValues(String rangeValues) {
|
||||
this.rangeValues = rangeValues;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
package cn.iocoder.mall.promotionservice.service.coupon.bo;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 优惠码模板更新 DTO
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class CouponCodeTemplateUpdateBO implements Serializable {
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
package cn.iocoder.mall.promotionservice.service.coupon.bo;
|
||||
|
||||
import cn.iocoder.mall.promotion.api.rpc.coupon.dto.CouponTemplateReqDTO;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 优惠劵(码)模板分页 BO
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class CouponTemplatePageBO implements Serializable {
|
||||
|
||||
/**
|
||||
* 优惠劵(码)数组
|
||||
*/
|
||||
private List<CouponTemplateReqDTO> list;
|
||||
/**
|
||||
* 总量
|
||||
*/
|
||||
private Integer total;
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user