diff --git a/management-web-app/pom.xml b/management-web-app/pom.xml
index 3649c3014..4cd3e466b 100644
--- a/management-web-app/pom.xml
+++ b/management-web-app/pom.xml
@@ -66,6 +66,12 @@
product-service-api
1.0-SNAPSHOT
+
+
+ cn.iocoder.mall
+ promotion-service-api
+ 1.0-SNAPSHOT
+
diff --git a/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/promotion/coupon/CouponTemplateController.java b/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/promotion/coupon/CouponTemplateController.java
new file mode 100644
index 000000000..cf17e175d
--- /dev/null
+++ b/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/promotion/coupon/CouponTemplateController.java
@@ -0,0 +1,63 @@
+package cn.iocoder.mall.managementweb.controller.promotion.coupon;
+
+import cn.iocoder.common.framework.vo.CommonResult;
+import cn.iocoder.mall.managementweb.controller.promotion.coupon.vo.template.CouponTemplateCardCreateReqVO;
+import cn.iocoder.mall.managementweb.controller.promotion.coupon.vo.template.CouponTemplateCardUpdateReqVO;
+import cn.iocoder.mall.managementweb.manager.promotion.coupon.CouponTemplateManager;
+import cn.iocoder.security.annotations.RequiresPermissions;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.validation.Valid;
+
+import static cn.iocoder.common.framework.vo.CommonResult.success;
+
+/**
+ * 优惠劵模板 Controller
+ */
+@RestController
+@RequestMapping("/promotion/coupon-template")
+@Api(tags = "优惠劵(码)模板 API")
+@Validated
+public class CouponTemplateController {
+
+ @Autowired
+ private CouponTemplateManager couponTemplateManager;
+
+ @PostMapping("/create-card")
+ @ApiOperation("创建优惠劵模板")
+ @RequiresPermissions("promotion:coupon-template:create-card")
+ public CommonResult createCouponTemplateCard(@Valid CouponTemplateCardCreateReqVO createVO) {
+ return success(couponTemplateManager.createCouponTemplateCard(createVO));
+ }
+
+ @PostMapping("/update-card")
+ @ApiOperation("更新优惠劵模板")
+ @RequiresPermissions("promotion:coupon-template:update-card")
+ public CommonResult updateCouponTemplateCard(@Valid CouponTemplateCardUpdateReqVO updateVO) {
+ couponTemplateManager.updateCouponTemplateCard(updateVO);
+ return success(true);
+ }
+
+ @PostMapping("/update-status")
+ @ApiOperation("更新优惠劵(码)模板")
+ @ApiImplicitParams({
+ @ApiImplicitParam(name = "id", value = "优惠劵(码)模板编号", required = true, example = "1"),
+ @ApiImplicitParam(name = "status", value = "状态。1 - 开启;2 - 禁用", required = true, example = "1"),
+ })
+ @RequiresPermissions("promotion:coupon-template:update-status")
+ public CommonResult updateCouponTemplateStatus(@RequestParam("id") Integer id,
+ @RequestParam("status") Integer status) {
+ couponTemplateManager.updateCouponTemplateStatus(id, status);
+ return success(true);
+ }
+
+}
diff --git a/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/promotion/coupon/vo/template/CouponTemplateCardCreateReqVO.java b/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/promotion/coupon/vo/template/CouponTemplateCardCreateReqVO.java
new file mode 100644
index 000000000..5cadd1adb
--- /dev/null
+++ b/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/promotion/coupon/vo/template/CouponTemplateCardCreateReqVO.java
@@ -0,0 +1,81 @@
+package cn.iocoder.mall.managementweb.controller.promotion.coupon.vo.template;
+
+import cn.iocoder.common.framework.validator.InEnum;
+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 io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.experimental.Accessors;
+import org.hibernate.validator.constraints.Length;
+
+import javax.validation.constraints.Max;
+import javax.validation.constraints.Min;
+import javax.validation.constraints.NotEmpty;
+import javax.validation.constraints.NotNull;
+import java.util.Date;
+
+@ApiModel("优惠劵模板创建 Request VO")
+@Data
+@Accessors(chain = true)
+public class CouponTemplateCardCreateReqVO {
+
+ // ========== 基本信息 BEGIN ==========
+ @ApiModelProperty(value = "标题", required = true, example = "优惠劵牛逼")
+ @NotEmpty(message = "标题不能为空")
+ @Length(min = 2, max = 16, message = "标题长度为 {min}-{max} 位")
+ private String title;
+ @ApiModelProperty(value = "使用说明", required = true, example = "我只是描述")
+ @Length(max = 255, message = "使用说明最大长度为 {max} 位")
+ private String description;
+ @ApiModelProperty(value = "每人限领个数", example = "1", notes = "null - 则表示不限制")
+ @Min(value = 1, message = "每人限领个数最小为 {value}")
+ private Integer quota;
+ @ApiModelProperty(value = "发放总量", example = "100")
+ @Min(value = 1, message = "每人限领个数最小为 {value}")
+ private Integer total;
+ // ========== 领取规则 END ==========
+
+ // ========== 使用规则 BEGIN ==========
+ @ApiModelProperty(value = "是否设置满多少金额可用,单位:分", required = true, example = "0", notes = "0-不限制;大于0-多少金额可用")
+ @Min(value = 0L, message = "使用金额门槛最低为 {value}")
+ private Integer priceAvailable;
+ @ApiModelProperty(value = "可用范围的类型", required = true, example = "10", notes = "参见 RangeTypeEnum 枚举")
+ @NotNull(message = "可用范围的类型不能为空")
+ @InEnum(value = RangeTypeEnum.class, message = "可用范围的类型必须在 {value}")
+ private Integer rangeType;
+ @ApiModelProperty(value = "指定商品 / 分类列表,使用逗号分隔商品编号", example = "1,3,5")
+ private String rangeValues;
+ @ApiModelProperty(value = "生效日期类型", example = "1", notes = "参见 CouponTemplateDateTypeEnum 枚举")
+ @NotNull(message = "生效日期类型不能为空")
+ @InEnum(value = CouponTemplateDateTypeEnum.class, message = "生效日期类型必须在 {value}")
+ private Integer dateType;
+ @ApiModelProperty(value = "固定日期-生效开始时间", notes = "当 dateType 为固定日期时,非空")
+ private Date validStartTime;
+ @ApiModelProperty(value = "固定日期-生效结束时间", notes = "当 dateType 为固定日期时,非空")
+ private Date validEndTime;
+ @ApiModelProperty(value = "领取日期-开始天数", example = "0", notes = "例如,0-当天;1-次天")
+ @Min(value = 0L, message = "领取日期开始时间最小为 {value}")
+ private Integer fixedStartTerm;
+ @ApiModelProperty(value = "领取日期-结束天数", example = "1", notes = "当 dateType 为领取日期时,非空")
+ @Min(value = 1L, message = "领取日期结束时间最小为 {value}")
+ private Integer fixedEndTerm;
+
+ // ========== 使用效果 BEGIN ==========
+ @ApiModelProperty(value = "优惠类型", required = true, example = "1", notes = "参见 PreferentialTypeEnum 枚举")
+ @NotNull(message = "优惠类型不能为空")
+ @InEnum(value = PreferentialTypeEnum.class, message = "优惠类型必须在 {value}")
+ private Integer preferentialType;
+ @ApiModelProperty(value = "折扣百分比", example = "80", notes = "当 preferentialType 为现金券时,非空")
+ @Max(value = 100, message = "折扣比最大值为 {value}")
+ private Integer percentOff;
+ @ApiModelProperty(value = "优惠金额,单位:分", example = "100", notes = "当 preferentialType 为折扣卷时,非空")
+ @Min(value = 1, message = "优惠金额最小值为 {value}")
+ private Integer priceOff;
+ @ApiModelProperty(value = "折扣上限", example = "100", notes = "当 preferentialType 为折扣卷时,非空")
+ @Min(value = 1, message = "折扣上限最小值为 {value}")
+ private Integer discountPriceLimit;
+ // ========== 使用效果 END ==========
+
+}
diff --git a/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/promotion/coupon/vo/template/CouponTemplateCardUpdateReqVO.java b/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/promotion/coupon/vo/template/CouponTemplateCardUpdateReqVO.java
new file mode 100644
index 000000000..ffcea26b6
--- /dev/null
+++ b/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/promotion/coupon/vo/template/CouponTemplateCardUpdateReqVO.java
@@ -0,0 +1,47 @@
+package cn.iocoder.mall.managementweb.controller.promotion.coupon.vo.template;
+
+import cn.iocoder.common.framework.validator.InEnum;
+import cn.iocoder.mall.promotion.api.enums.RangeTypeEnum;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.experimental.Accessors;
+import org.hibernate.validator.constraints.Length;
+
+import javax.validation.constraints.Min;
+import javax.validation.constraints.NotEmpty;
+import javax.validation.constraints.NotNull;
+
+@ApiModel("优惠劵模板更新 Request VO")
+@Data
+@Accessors(chain = true)
+public class CouponTemplateCardUpdateReqVO {
+
+ // ========== 基本信息 BEGIN ==========
+ @ApiModelProperty(value = "模板编号,自增唯一", required = true, example = "1")
+ @NotNull(message = "编号不能为空")
+ private Integer id;
+ @ApiModelProperty(value = "标题", required = true, example = "优惠劵牛逼")
+ @NotEmpty(message = "标题不能为空")
+ @Length(min = 2, max = 16, message = "标题长度为 {min}-{max} 位")
+ private String title;
+ @ApiModelProperty(value = "使用说明", required = true, example = "我只是描述")
+ @Length(max = 255, message = "使用说明最大长度为 {max} 位")
+ private String description;
+ @ApiModelProperty(value = "每人限领个数", example = "1", notes = "null - 则表示不限制")
+ @Min(value = 1, message = "每人限领个数最小为 {value}")
+ private Integer quota;
+ @ApiModelProperty(value = "发放总量", example = "100")
+ @Min(value = 1, message = "每人限领个数最小为 {value}")
+ private Integer total;
+ // ========== 领取规则 END ==========
+
+ // ========== 使用规则 BEGIN ==========
+ @NotNull(message = "可用范围的类型不能为空")
+ @InEnum(value = RangeTypeEnum.class, message = "可用范围的类型必须在 {value}")
+ private Integer rangeType;
+ @ApiModelProperty(value = "指定商品 / 分类列表,使用逗号分隔商品编号", example = "1,3,5")
+ private String rangeValues;
+ // ========== 使用规则 END ==========
+
+}
diff --git a/promotion/promotion-start/src/main/java/cn/iocoder/mall/promotion/application/vo/admins/AdminsCouponTemplateVO.java b/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/promotion/coupon/vo/template/CouponTemplateRespVO.java
similarity index 58%
rename from promotion/promotion-start/src/main/java/cn/iocoder/mall/promotion/application/vo/admins/AdminsCouponTemplateVO.java
rename to management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/promotion/coupon/vo/template/CouponTemplateRespVO.java
index cc5663ad1..846e307fb 100644
--- a/promotion/promotion-start/src/main/java/cn/iocoder/mall/promotion/application/vo/admins/AdminsCouponTemplateVO.java
+++ b/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/promotion/coupon/vo/template/CouponTemplateRespVO.java
@@ -1,4 +1,4 @@
-package cn.iocoder.mall.promotion.application.vo.admins;
+package cn.iocoder.mall.managementweb.controller.promotion.coupon.vo.template;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
@@ -7,10 +7,10 @@ import lombok.experimental.Accessors;
import java.util.Date;
-@ApiModel("CouponTemplate VO")
+@ApiModel("优惠劵(码)模板 VO")
@Data
@Accessors(chain = true)
-public class AdminsCouponTemplateVO {
+public class CouponTemplateRespVO {
// ========== 基本信息 BEGIN ==========
@ApiModelProperty(value = "模板编号,自增唯一", required = true, example = "1")
@@ -19,7 +19,7 @@ public class AdminsCouponTemplateVO {
private String title;
@ApiModelProperty(value = "使用说明", required = true, example = "我只是描述")
private String description;
- @ApiModelProperty(value = "优惠劵类型", required = true, example = "参见 CouponTemplateTypeEnum 枚举")
+ @ApiModelProperty(value = "优惠劵类型", required = true, example = "1", notes = "参见 CouponTemplateTypeEnum 枚举")
private Integer type;
/**
* 码类型
@@ -29,43 +29,42 @@ public class AdminsCouponTemplateVO {
*
* 【优惠码独有】 @see CouponCodeDO
*/
- // TODO
private Integer codeType;
- @ApiModelProperty(value = "优惠码状态", required = true, example = "参见 CouponTemplateStatusEnum 枚举")
+ @ApiModelProperty(value = "优惠码状态", required = true, example = "1", notes = "参见 CouponTemplateStatusEnum 枚举")
private Integer status;
- @ApiModelProperty(value = "每人限领个数", example = "null - 则表示不限制")
+ @ApiModelProperty(value = "每人限领个数", example = "1", notes = "null - 则表示不限制")
private Integer quota;
- @ApiModelProperty(value = "发放总量")
+ @ApiModelProperty(value = "发放总量", example = "100")
private Integer total;
// ========== 领取规则 END ==========
// ========== 使用规则 BEGIN ==========
- @ApiModelProperty(value = "是否设置满多少金额可用,单位:分", required = true, example = "0-不限制;大于0-多少金额可用")
+ @ApiModelProperty(value = "是否设置满多少金额可用,单位:分", required = true, example = "0", notes = "0-不限制;大于0-多少金额可用")
private Integer priceAvailable;
- @ApiModelProperty(value = "可用范围的类型", required = true, example = "参见 CouponTemplateRangeTypeEnum 枚举")
+ @ApiModelProperty(value = "可用范围的类型", required = true, example = "10", notes = "参见 RangeTypeEnum 枚举")
private Integer rangeType;
- @ApiModelProperty(value = "指定商品 / 分类列表,使用逗号分隔商品编号", example = "参见 CouponTemplateRangeTypeEnum 枚举")
+ @ApiModelProperty(value = "指定商品 / 分类列表,使用逗号分隔商品编号", example = "1,3,5")
private String rangeValues;
- @ApiModelProperty(value = "生效日期类型", example = "参见 CouponTemplateDateTypeEnum 枚举")
+ @ApiModelProperty(value = "生效日期类型", example = "1", notes = "参见 CouponTemplateDateTypeEnum 枚举")
private Integer dateType;
- @ApiModelProperty(value = "固定日期-生效开始时间")
+ @ApiModelProperty(value = "固定日期-生效开始时间", notes = "当 dateType 为固定日期时,非空")
private Date validStartTime;
- @ApiModelProperty(value = "固定日期-生效结束时间")
+ @ApiModelProperty(value = "固定日期-生效结束时间", notes = "当 dateType 为固定日期时,非空")
private Date validEndTime;
- @ApiModelProperty(value = "领取日期-开始天数", example = "例如,0-当天;1-次天")
+ @ApiModelProperty(value = "领取日期-开始天数", example = "0", notes = "例如,0-当天;1-次天")
private Integer fixedStartTerm;
- @ApiModelProperty(value = "领取日期-结束天数")
+ @ApiModelProperty(value = "领取日期-结束天数", example = "1", notes = "当 dateType 为领取日期时,非空")
private Integer fixedEndTerm;
// ========== 使用规则 END ==========
// ========== 使用效果 BEGIN ==========
- @ApiModelProperty(value = "优惠类型", required = true, example = "参见 CouponTemplatePreferentialTypeEnum 枚举")
+ @ApiModelProperty(value = "优惠类型", required = true, example = "1", notes = "参见 PreferentialTypeEnum 枚举")
private Integer preferentialType;
- @ApiModelProperty(value = "折扣百分比")
+ @ApiModelProperty(value = "折扣百分比", example = "80", notes = "当 preferentialType 为现金券时,非空")
private Integer percentOff;
- @ApiModelProperty(value = "优惠金额,单位:分")
+ @ApiModelProperty(value = "优惠金额,单位:分", example = "100", notes = "当 preferentialType 为折扣卷时,非空")
private Integer priceOff;
- @ApiModelProperty(value = "折扣上限")
+ @ApiModelProperty(value = "折扣上限", example = "100", notes = "当 preferentialType 为折扣卷时,非空")
private Integer discountPriceLimit;
// ========== 使用效果 END ==========
diff --git a/management-web-app/src/main/java/cn/iocoder/mall/managementweb/convert/promotion/coupon/CouponTemplateConvert.java b/management-web-app/src/main/java/cn/iocoder/mall/managementweb/convert/promotion/coupon/CouponTemplateConvert.java
new file mode 100644
index 000000000..c98af864b
--- /dev/null
+++ b/management-web-app/src/main/java/cn/iocoder/mall/managementweb/convert/promotion/coupon/CouponTemplateConvert.java
@@ -0,0 +1,15 @@
+package cn.iocoder.mall.managementweb.convert.promotion.coupon;
+
+import cn.iocoder.mall.managementweb.controller.promotion.coupon.vo.template.CouponTemplateCardUpdateReqVO;
+import cn.iocoder.mall.promotion.api.rpc.coupon.dto.template.CouponCardTemplateUpdateReqDTO;
+import org.mapstruct.Mapper;
+import org.mapstruct.factory.Mappers;
+
+@Mapper
+public interface CouponTemplateConvert {
+
+ CouponTemplateConvert INSTANCE = Mappers.getMapper(CouponTemplateConvert.class);
+
+ CouponCardTemplateUpdateReqDTO convert(CouponTemplateCardUpdateReqVO bean);
+
+}
diff --git a/management-web-app/src/main/java/cn/iocoder/mall/managementweb/manager/promotion/coupon/CouponTemplateManager.java b/management-web-app/src/main/java/cn/iocoder/mall/managementweb/manager/promotion/coupon/CouponTemplateManager.java
new file mode 100644
index 000000000..30653f74f
--- /dev/null
+++ b/management-web-app/src/main/java/cn/iocoder/mall/managementweb/manager/promotion/coupon/CouponTemplateManager.java
@@ -0,0 +1,36 @@
+package cn.iocoder.mall.managementweb.manager.promotion.coupon;
+
+import cn.iocoder.common.framework.vo.CommonResult;
+import cn.iocoder.mall.managementweb.controller.promotion.coupon.vo.template.CouponTemplateCardCreateReqVO;
+import cn.iocoder.mall.managementweb.controller.promotion.coupon.vo.template.CouponTemplateCardUpdateReqVO;
+import cn.iocoder.mall.managementweb.convert.promotion.coupon.CouponTemplateConvert;
+import cn.iocoder.mall.promotion.api.rpc.coupon.CouponTemplateRpc;
+import cn.iocoder.mall.promotion.api.rpc.coupon.dto.template.CouponCardTemplateUpdateStatusReqDTO;
+import org.apache.dubbo.config.annotation.DubboReference;
+import org.springframework.stereotype.Service;
+import org.springframework.validation.annotation.Validated;
+
+@Service
+@Validated
+public class CouponTemplateManager {
+
+ @DubboReference(version = "${dubbo.consumer.CouponTemplateRpc.version}")
+ private CouponTemplateRpc couponTemplateRpc;
+
+ public Integer createCouponTemplateCard(CouponTemplateCardCreateReqVO createVO) {
+ return null;
+ }
+
+ public void updateCouponTemplateCard(CouponTemplateCardUpdateReqVO updateVO) {
+ CommonResult updateCouponCardTemplateResult = couponTemplateRpc.updateCouponCardTemplate(
+ CouponTemplateConvert.INSTANCE.convert(updateVO));
+ updateCouponCardTemplateResult.checkError();
+ }
+
+ public void updateCouponTemplateStatus(Integer id, Integer status) {
+ CommonResult updateCouponTemplateStatusResult = couponTemplateRpc.updateCouponTemplateStatus(
+ new CouponCardTemplateUpdateStatusReqDTO().setId(id).setStatus(status));
+ updateCouponTemplateStatusResult.checkError();
+ }
+
+}
diff --git a/management-web-app/src/main/java/cn/iocoder/mall/managementweb/manager/systemlog/SystemAccessLogManager.java b/management-web-app/src/main/java/cn/iocoder/mall/managementweb/manager/systemlog/SystemAccessLogManager.java
index 8415b78ca..6e4d21e64 100644
--- a/management-web-app/src/main/java/cn/iocoder/mall/managementweb/manager/systemlog/SystemAccessLogManager.java
+++ b/management-web-app/src/main/java/cn/iocoder/mall/managementweb/manager/systemlog/SystemAccessLogManager.java
@@ -6,7 +6,7 @@ import cn.iocoder.mall.managementweb.controller.systemlog.dto.SystemAccessLogPag
import cn.iocoder.mall.managementweb.controller.systemlog.vo.SystemAccessLogVO;
import cn.iocoder.mall.managementweb.convert.systemlog.SystemAccessLogConvert;
import cn.iocoder.mall.systemservice.rpc.systemlog.SystemAccessLogRpc;
-import org.apache.dubbo.config.annotation.Reference;
+import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.stereotype.Service;
/**
@@ -15,7 +15,7 @@ import org.springframework.stereotype.Service;
@Service
public class SystemAccessLogManager {
- @Reference(version = "${dubbo.consumer.SystemAccessLogRpc.version}")
+ @DubboReference(version = "${dubbo.consumer.SystemAccessLogRpc.version}")
private SystemAccessLogRpc systemAccessLogRpc;
/**
diff --git a/management-web-app/src/main/resources/application.yml b/management-web-app/src/main/resources/application.yml
index 9a55f0fc0..4f6c87755 100644
--- a/management-web-app/src/main/resources/application.yml
+++ b/management-web-app/src/main/resources/application.yml
@@ -57,6 +57,8 @@ dubbo:
version: 1.0.0
ProductAttrRpc:
version: 1.0.0
+ CouponTemplateRpc:
+ version: 1.0.0
# Swagger 配置项
swagger:
diff --git a/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/coupon/CouponRpc.java b/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/coupon/CouponRpc.java
deleted file mode 100644
index 42ca8b3cd..000000000
--- a/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/coupon/CouponRpc.java
+++ /dev/null
@@ -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);
-
-}
diff --git a/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/coupon/CouponTemplateRpc.java b/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/coupon/CouponTemplateRpc.java
new file mode 100644
index 000000000..53ac4a3b9
--- /dev/null
+++ b/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/coupon/CouponTemplateRpc.java
@@ -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 getCouponTemplate(Integer couponTemplateId);
+
+ /**
+ * 获得优惠劵(码)模板分页
+ *
+ * @param pageDTO 优惠劵模板分页查询
+ * @return 优惠劵模板分页结果
+ */
+ CommonResult> pageCouponTemplate(CouponTemplatePageReqDTO pageDTO);
+
+ /**
+ * 更新优惠劵(码)模板的状态
+ *
+ * @param updateStatusReqDTO 更新状态 DTO
+ */
+ CommonResult updateCouponTemplateStatus(CouponCardTemplateUpdateStatusReqDTO updateStatusReqDTO);
+
+ // ========== 优惠劵模板 ==========
+
+ /**
+ * 创建优惠劵模板
+ *
+ * @param createDTO 创建优惠劵模板 DTO
+ * @return 优惠劵模板编号
+ */
+ CommonResult createCouponCardTemplate(CouponCardTemplateCreateReqDTO createDTO);
+
+ /**
+ * 更新优惠劵模板
+ *
+ * @param updateDTO 更新优惠劵模板 DTO
+ */
+ CommonResult updateCouponCardTemplate(CouponCardTemplateUpdateReqDTO updateDTO);
+
+ // ========== 优惠码模板 ==========
+
+
+}
diff --git a/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/coupon/dto/CouponCardSpuRespDTO.java b/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/coupon/dto/CouponCardSpuRespDTO.java
deleted file mode 100644
index 9f0709cd6..000000000
--- a/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/coupon/dto/CouponCardSpuRespDTO.java
+++ /dev/null
@@ -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;
-
-}
diff --git a/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/coupon/dto/CouponCodeTemplateAddReqDTO.java b/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/coupon/dto/CouponCodeTemplateAddReqDTO.java
deleted file mode 100644
index 3ba79b1fe..000000000
--- a/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/coupon/dto/CouponCodeTemplateAddReqDTO.java
+++ /dev/null
@@ -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 {
-}
diff --git a/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/coupon/dto/CouponCodeTemplateUpdateReqDTO.java b/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/coupon/dto/CouponCodeTemplateUpdateReqDTO.java
deleted file mode 100644
index 75cb85fa8..000000000
--- a/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/coupon/dto/CouponCodeTemplateUpdateReqDTO.java
+++ /dev/null
@@ -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 {
-}
diff --git a/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/coupon/dto/CouponTemplatePageReqDTO.java b/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/coupon/dto/CouponTemplatePageReqDTO.java
deleted file mode 100644
index d8e704dc2..000000000
--- a/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/coupon/dto/CouponTemplatePageReqDTO.java
+++ /dev/null
@@ -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;
-
-}
diff --git a/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/coupon/dto/CouponTemplatePageRespDTO.java b/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/coupon/dto/CouponTemplatePageRespDTO.java
deleted file mode 100644
index 3a86f3f55..000000000
--- a/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/coupon/dto/CouponTemplatePageRespDTO.java
+++ /dev/null
@@ -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 list;
- /**
- * 总量
- */
- private Integer total;
-
-}
diff --git a/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/coupon/dto/CouponTemplateReqDTO.java b/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/coupon/dto/CouponTemplateReqDTO.java
deleted file mode 100644
index f81e564d8..000000000
--- a/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/coupon/dto/CouponTemplateReqDTO.java
+++ /dev/null
@@ -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;
-
-}
diff --git a/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/coupon/dto/CouponCardTemplateAddReqDTO.java b/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/coupon/dto/template/CouponCardTemplateCreateReqDTO.java
similarity index 96%
rename from promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/coupon/dto/CouponCardTemplateAddReqDTO.java
rename to promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/coupon/dto/template/CouponCardTemplateCreateReqDTO.java
index afc629e3d..d7dcf0848 100644
--- a/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/coupon/dto/CouponCardTemplateAddReqDTO.java
+++ b/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/coupon/dto/template/CouponCardTemplateCreateReqDTO.java
@@ -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 ==========
/**
diff --git a/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/coupon/dto/CouponCardTemplateUpdateReqDTO.java b/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/coupon/dto/template/CouponCardTemplateUpdateReqDTO.java
similarity index 76%
rename from promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/coupon/dto/CouponCardTemplateUpdateReqDTO.java
rename to promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/coupon/dto/template/CouponCardTemplateUpdateReqDTO.java
index 8996c5aa9..11e0dfa25 100644
--- a/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/coupon/dto/CouponCardTemplateUpdateReqDTO.java
+++ b/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/coupon/dto/template/CouponCardTemplateUpdateReqDTO.java
@@ -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;
- }
}
diff --git a/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/coupon/dto/template/CouponCardTemplateUpdateStatusReqDTO.java b/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/coupon/dto/template/CouponCardTemplateUpdateStatusReqDTO.java
new file mode 100644
index 000000000..13fefd72c
--- /dev/null
+++ b/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/coupon/dto/template/CouponCardTemplateUpdateStatusReqDTO.java
@@ -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;
+
+}
diff --git a/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/coupon/dto/template/CouponTemplatePageReqDTO.java b/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/coupon/dto/template/CouponTemplatePageReqDTO.java
new file mode 100644
index 000000000..080c98514
--- /dev/null
+++ b/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/coupon/dto/template/CouponTemplatePageReqDTO.java
@@ -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;
+
+}
diff --git a/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/convert/coupon/card/CouponCardConvert.java b/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/convert/coupon/CouponCardConvert.java
similarity index 93%
rename from promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/convert/coupon/card/CouponCardConvert.java
rename to promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/convert/coupon/CouponCardConvert.java
index 1d23fcf31..be9870bb3 100644
--- a/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/convert/coupon/card/CouponCardConvert.java
+++ b/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/convert/coupon/CouponCardConvert.java
@@ -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;
diff --git a/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/convert/coupon/CouponTemplateConvert.java b/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/convert/coupon/CouponTemplateConvert.java
new file mode 100644
index 000000000..21a557d19
--- /dev/null
+++ b/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/convert/coupon/CouponTemplateConvert.java
@@ -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 convertPage(IPage couponTemplatePage);
+
+ @Named("translateStringToIntList")
+ default List translateStringToIntList(String str) {
+ return StringUtils.splitToInt(str, ",");
+ }
+
+}
diff --git a/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/convert/coupon/card/CouponTemplateConvert.java b/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/convert/coupon/card/CouponTemplateConvert.java
deleted file mode 100644
index 9d9371111..000000000
--- a/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/convert/coupon/card/CouponTemplateConvert.java
+++ /dev/null
@@ -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 convertToDTO(List 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 translateStringToIntList(String str) {
- return StringUtils.splitToInt(str, ",");
- }
-
-}
diff --git a/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/dal/mysql/dataobject/coupon/CouponTemplateDO.java b/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/dal/mysql/dataobject/coupon/CouponTemplateDO.java
index 24b763918..666ed99a2 100644
--- a/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/dal/mysql/dataobject/coupon/CouponTemplateDO.java
+++ b/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/dal/mysql/dataobject/coupon/CouponTemplateDO.java
@@ -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-折扣卷
*/
diff --git a/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/dal/mysql/mapper/coupon/CouponTemplateMapper.java b/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/dal/mysql/mapper/coupon/CouponTemplateMapper.java
index bd7d73c65..913121c8e 100644
--- a/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/dal/mysql/mapper/coupon/CouponTemplateMapper.java
+++ b/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/dal/mysql/mapper/coupon/CouponTemplateMapper.java
@@ -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 {
- List 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 selectPage(CouponTemplatePageReqDTO pageReqDTO) {
+ return selectPage(new Page<>(pageReqDTO.getPageNo(), pageReqDTO.getPageSize()),
+ new QueryWrapperX().eqIfPresent("type", pageReqDTO.getType())
+ .likeIfPresent("title", pageReqDTO.getTitle())
+ .eqIfPresent("status", pageReqDTO.getStatus())
+ .eqIfPresent("preferential_type", pageReqDTO.getPreferentialType()));
+ }
/**
* 更新优惠劵模板已领取的数量
diff --git a/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/manager/coupon/card/CouponCardManager.java b/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/manager/coupon/CouponCardManager.java
similarity index 95%
rename from promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/manager/coupon/card/CouponCardManager.java
rename to promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/manager/coupon/CouponCardManager.java
index f0c4159e8..75cd6c122 100644
--- a/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/manager/coupon/card/CouponCardManager.java
+++ b/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/manager/coupon/CouponCardManager.java
@@ -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.*;
diff --git a/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/manager/coupon/CouponTemplateManager.java b/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/manager/coupon/CouponTemplateManager.java
new file mode 100644
index 000000000..e10ecd494
--- /dev/null
+++ b/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/manager/coupon/CouponTemplateManager.java
@@ -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 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);
+ }
+
+}
diff --git a/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/rpc/coupon/CouponCardRpcImpl.java b/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/rpc/coupon/CouponCardRpcImpl.java
index bdd523759..aa1dc30b0 100644
--- a/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/rpc/coupon/CouponCardRpcImpl.java
+++ b/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/rpc/coupon/CouponCardRpcImpl.java
@@ -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;
diff --git a/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/rpc/coupon/CouponTemplateRpcImpl.java b/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/rpc/coupon/CouponTemplateRpcImpl.java
new file mode 100644
index 000000000..f43d5f2c0
--- /dev/null
+++ b/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/rpc/coupon/CouponTemplateRpcImpl.java
@@ -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 getCouponTemplate(Integer couponTemplateId) {
+ return success(couponTemplateManager.getCouponTemplate(couponTemplateId));
+ }
+
+ @Override
+ public CommonResult> pageCouponTemplate(CouponTemplatePageReqDTO pageDTO) {
+ return success(couponTemplateManager.pageCouponTemplate(pageDTO));
+ }
+
+ @Override
+ public CommonResult updateCouponTemplateStatus(CouponCardTemplateUpdateStatusReqDTO updateStatusReqDTO) {
+ couponTemplateManager.updateCouponTemplateStatus(updateStatusReqDTO);
+ return success(true);
+ }
+
+ // ========== 优惠劵模板 ==========
+
+ @Override
+ public CommonResult createCouponCardTemplate(CouponCardTemplateCreateReqDTO createDTO) {
+ return success(couponTemplateManager.createCouponCardTemplate(createDTO));
+ }
+
+ @Override
+ public CommonResult updateCouponCardTemplate(CouponCardTemplateUpdateReqDTO updateDTO) {
+ couponTemplateManager.updateCouponCardTemplate(updateDTO);
+ return success(true);
+ }
+
+}
diff --git a/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/service/coupon/CouponCardService.java b/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/service/coupon/CouponCardService.java
index b2b7d60b2..c95425bc2 100644
--- a/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/service/coupon/CouponCardService.java
+++ b/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/service/coupon/CouponCardService.java
@@ -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) {
diff --git a/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/service/coupon/CouponService.java b/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/service/coupon/CouponService.java
deleted file mode 100644
index 62b699832..000000000
--- a/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/service/coupon/CouponService.java
+++ /dev/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;
- }
-
- // ========== 优惠劵 ==========
-
-
-
-}
diff --git a/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/service/coupon/CouponTemplateService.java b/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/service/coupon/CouponTemplateService.java
index d964c0d51..5ece056c1 100644
--- a/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/service/coupon/CouponTemplateService.java
+++ b/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/service/coupon/CouponTemplateService.java
@@ -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 pageCouponTemplate(CouponTemplatePageReqDTO pageDTO) {
+ IPage 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 芋艿:以后开发 ==========
+
+
}
diff --git a/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/service/coupon/bo/CouponCardTemplateAddBO.java b/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/service/coupon/bo/CouponCardTemplateAddBO.java
deleted file mode 100644
index 0f096b254..000000000
--- a/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/service/coupon/bo/CouponCardTemplateAddBO.java
+++ /dev/null
@@ -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 ==========
-
-}
diff --git a/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/service/coupon/bo/CouponCardTemplateUpdateBO.java b/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/service/coupon/bo/CouponCardTemplateUpdateBO.java
deleted file mode 100644
index c2ef21e65..000000000
--- a/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/service/coupon/bo/CouponCardTemplateUpdateBO.java
+++ /dev/null
@@ -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;
- }
-}
diff --git a/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/service/coupon/bo/CouponCodeTemplateUpdateBO.java b/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/service/coupon/bo/CouponCodeTemplateUpdateBO.java
deleted file mode 100644
index a8e9f80da..000000000
--- a/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/service/coupon/bo/CouponCodeTemplateUpdateBO.java
+++ /dev/null
@@ -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 {
-}
diff --git a/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/service/coupon/bo/CouponTemplatePageBO.java b/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/service/coupon/bo/CouponTemplatePageBO.java
deleted file mode 100644
index 437ba0bcc..000000000
--- a/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/service/coupon/bo/CouponTemplatePageBO.java
+++ /dev/null
@@ -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 list;
- /**
- * 总量
- */
- private Integer total;
-
-}
diff --git a/promotion/promotion-application/pom.xml b/promotion/promotion-application/pom.xml
deleted file mode 100644
index bec1721a7..000000000
--- a/promotion/promotion-application/pom.xml
+++ /dev/null
@@ -1,26 +0,0 @@
-
-
-
- promotion
- cn.iocoder.mall
- 1.0-SNAPSHOT
-
- 4.0.0
-
- promotion-application
-
-
-
- cn.iocoder.mall
- promotion-biz
- 1.0-SNAPSHOT
-
-
- cn.iocoder.mall
- promotion-rpc
- 1.0-SNAPSHOT
-
-
-
\ No newline at end of file
diff --git a/promotion/promotion-biz-api/pom.xml b/promotion/promotion-biz-api/pom.xml
deleted file mode 100644
index 15dee904f..000000000
--- a/promotion/promotion-biz-api/pom.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-
-
-
- promotion
- cn.iocoder.mall
- 1.0-SNAPSHOT
-
- 4.0.0
-
- promotion-biz-api
-
-
-
-
- cn.iocoder.mall
- common-framework
- 1.0-SNAPSHOT
-
-
-
\ No newline at end of file
diff --git a/promotion/promotion-biz-api/src/main/java/cn/iocoder/mall/promotion/biz/api/enums/PromotionErrorCodeEnum.java b/promotion/promotion-biz-api/src/main/java/cn/iocoder/mall/promotion/biz/api/enums/PromotionErrorCodeEnum.java
deleted file mode 100644
index 6f8d03cf3..000000000
--- a/promotion/promotion-biz-api/src/main/java/cn/iocoder/mall/promotion/biz/api/enums/PromotionErrorCodeEnum.java
+++ /dev/null
@@ -1,53 +0,0 @@
-package cn.iocoder.mall.promotion.biz.api.enums;
-
-/**
- * 错误码枚举类
- *
- * 营销系统,使用 1-006-000-000 段
- */
-public enum PromotionErrorCodeEnum {
-
- // ========== Banner 模块 ==========
- BANNER_NOT_EXISTS(1006000000, "账号不存在"),
-
-// // ========== PRODUCT RECOMMEND 模块 ==========
-// PRODUCT_RECOMMEND_NOT_EXISTS(1006001000, "商品推荐不存在"),
-// PRODUCT_RECOMMEND_PRODUCT_NOT_EXISTS(1006001001, "商品不存在"),
-// PRODUCT_RECOMMEND_EXISTS(1006001002, "该商品推荐已经存在"),
-//
-//
-// // ========== COUPON TEMPLATE 模块 ==========
-// COUPON_TEMPLATE_NOT_EXISTS(1006002000, "优惠劵模板(码)不存在"),
-// COUPON_TEMPLATE_NOT_CARD(1006002001, "不是优惠劵模板"),
-// COUPON_TEMPLATE_NOT_CODE(1006002002, "不是优惠码模板"),
-// COUPON_TEMPLATE_TOTAL_CAN_NOT_REDUCE(1006002003, "优惠劵(码)模板的发放数量不能减小"),
-// COUPON_TEMPLATE_STATUS_NOT_ENABLE(1006002004, "优惠劵模板(码)未开启"),
-// COUPON_TEMPLATE_TOTAL_NOT_ENOUGH(1006002005, "优惠劵(码)模板的发放量不足"),
-// COUPON_TEMPLATE_CARD_ADD_EXCEED_QUOTA(1006002006, "优惠劵领取到达上限"),
-//
-// // ========== COUPON CARD 模块 ==========
-// COUPON_CARD_NOT_EXISTS(1006003000, "优惠劵不存在"),
-// COUPON_CARD_ERROR_USER(1006003001, "优惠劵不属于当前用户"),
-// COUPON_CARD_NOT_MATCH(1006003002, "优惠劵不匹配,无法使用"),
-// COUPON_CARD_STATUS_NOT_UNUSED(1006003003, "优惠劵不处于待使用状态"),
-// COUPON_CARD_STATUS_NOT_USED(1006003004, "优惠劵不处于已使用状态"),
- ;
-
-
- private final int code;
- private final String message;
-
- PromotionErrorCodeEnum(int code, String message) {
- this.code = code;
- this.message = message;
- }
-
- public int getCode() {
- return code;
- }
-
- public String getMessage() {
- return message;
- }
-
-}
diff --git a/promotion/promotion-biz-api/src/main/java/cn/iocoder/mall/promotion/biz/api/package-info.java b/promotion/promotion-biz-api/src/main/java/cn/iocoder/mall/promotion/biz/api/package-info.java
deleted file mode 100644
index ea366ee90..000000000
--- a/promotion/promotion-biz-api/src/main/java/cn/iocoder/mall/promotion/biz/api/package-info.java
+++ /dev/null
@@ -1,5 +0,0 @@
-/**
- * author: sin
- * time: 2020/5/14 15:25
- */
-package cn.iocoder.mall.promotion.biz.api;
\ No newline at end of file
diff --git a/promotion/promotion-biz/pom.xml b/promotion/promotion-biz/pom.xml
deleted file mode 100644
index f5fe48cf5..000000000
--- a/promotion/promotion-biz/pom.xml
+++ /dev/null
@@ -1,83 +0,0 @@
-
-
-
- promotion
- cn.iocoder.mall
- 1.0-SNAPSHOT
-
- 4.0.0
-
- promotion-biz
-
-
-
-
- cn.iocoder.mall
- promotion-biz-api
- 1.0-SNAPSHOT
-
-
-
-
- org.springframework.boot
- spring-boot-starter
-
-
-
-
- mysql
- mysql-connector-java
-
-
-
- org.springframework
- spring-tx
-
-
- org.springframework
- spring-jdbc
-
-
- com.alibaba
- druid-spring-boot-starter
-
-
-
- cn.iocoder.mall
- mall-spring-boot-starter-mybatis
- 1.0-SNAPSHOT
-
-
-
-
- com.yunpian.sdk
- yunpian-java-sdk
-
-
- com.aliyun
- aliyun-java-sdk-core
-
-
-
-
- com.qiniu
- qiniu-java-sdk
-
-
-
-
- org.mapstruct
- mapstruct
-
-
- org.mapstruct
- mapstruct-jdk8
-
-
- org.projectlombok
- lombok
-
-
-
\ No newline at end of file
diff --git a/promotion/promotion-biz/src/main/java/cn/iocoder/mall/promotion/biz/bo/banner/BannerListBO.java b/promotion/promotion-biz/src/main/java/cn/iocoder/mall/promotion/biz/bo/banner/BannerListBO.java
deleted file mode 100644
index 935f5897d..000000000
--- a/promotion/promotion-biz/src/main/java/cn/iocoder/mall/promotion/biz/bo/banner/BannerListBO.java
+++ /dev/null
@@ -1,51 +0,0 @@
-package cn.iocoder.mall.promotion.biz.bo.banner;
-
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-import lombok.experimental.Accessors;
-
-import java.io.Serializable;
-import java.util.Date;
-
-/**
- * banner:list
- *
- * author: sin
- * time: 2020/5/14 16:00
- */
-@Data
-@Accessors(chain = true)
-// TODO FROM 芋艿 to 小范:捉摸是不是先统一的 BannerBO;另外,biz 不使用 swagger 注解哈,其他 banner 的 dto 和 bo 也一起改改哈;
-public class BannerListBO implements Serializable {
-
-
- @ApiModelProperty("编号")
- private Integer id;
-
- @ApiModelProperty("标题")
- private String title;
-
- @ApiModelProperty("跳转链接")
- private String url;
-
- @ApiModelProperty("图片链接")
- private String picUrl;
-
- @ApiModelProperty("排序")
- private Integer sort;
-
- @ApiModelProperty("状态")
- private Integer status;
-
- @ApiModelProperty("备注")
- private String memo;
-
- //
- // 其他
-
- @ApiModelProperty("更新时间")
- private Date updatedTime;
-
- @ApiModelProperty("创建时间")
- private Date createdTime;
-}
diff --git a/promotion/promotion-biz/src/main/java/cn/iocoder/mall/promotion/biz/bo/banner/BannerListOnReleaseBO.java b/promotion/promotion-biz/src/main/java/cn/iocoder/mall/promotion/biz/bo/banner/BannerListOnReleaseBO.java
deleted file mode 100644
index c460f4b3a..000000000
--- a/promotion/promotion-biz/src/main/java/cn/iocoder/mall/promotion/biz/bo/banner/BannerListOnReleaseBO.java
+++ /dev/null
@@ -1,35 +0,0 @@
-package cn.iocoder.mall.promotion.biz.bo.banner;
-
-import lombok.Data;
-import lombok.experimental.Accessors;
-
-import java.io.Serializable;
-import java.util.Date;
-
-/**
- * banner - 已发布的banner
- *
- * author: sin
- * time: 2020/5/14 16:56
- */
-@Data
-@Accessors(chain = true)
-public class BannerListOnReleaseBO implements Serializable {
-
- /**
- * 编号
- */
- private Integer id;
- /**
- * 标题
- */
- private String title;
- /**
- * 跳转链接
- */
- private String url;
- /**
- * 图片链接
- */
- private String picUrl;
-}
diff --git a/promotion/promotion-biz/src/main/java/cn/iocoder/mall/promotion/biz/bo/package-info.java b/promotion/promotion-biz/src/main/java/cn/iocoder/mall/promotion/biz/bo/package-info.java
deleted file mode 100644
index b2dce8565..000000000
--- a/promotion/promotion-biz/src/main/java/cn/iocoder/mall/promotion/biz/bo/package-info.java
+++ /dev/null
@@ -1,5 +0,0 @@
-/**
- * author: sin
- * time: 2020/5/14 16:46
- */
-package cn.iocoder.mall.promotion.biz.bo;
\ No newline at end of file
diff --git a/promotion/promotion-biz/src/main/java/cn/iocoder/mall/promotion/biz/convert/BannerConvert.java b/promotion/promotion-biz/src/main/java/cn/iocoder/mall/promotion/biz/convert/BannerConvert.java
deleted file mode 100644
index 59fdcc20d..000000000
--- a/promotion/promotion-biz/src/main/java/cn/iocoder/mall/promotion/biz/convert/BannerConvert.java
+++ /dev/null
@@ -1,26 +0,0 @@
-package cn.iocoder.mall.promotion.biz.convert;
-
-import cn.iocoder.mall.promotion.biz.bo.banner.BannerListBO;
-import cn.iocoder.mall.promotion.biz.bo.banner.BannerListOnReleaseBO;
-import cn.iocoder.mall.promotion.biz.dataobject.BannerDO;
-import cn.iocoder.mall.promotion.biz.dto.banner.BannerAddDTO;
-import cn.iocoder.mall.promotion.biz.dto.banner.BannerUpdateDTO;
-import org.mapstruct.Mapper;
-import org.mapstruct.factory.Mappers;
-
-import java.util.List;
-
-@Mapper
-public interface BannerConvert {
-
- BannerConvert INSTANCE = Mappers.getMapper(BannerConvert.class);
-
- List convert(List bannerDO);
-
- List convertToBO(List bannerList);
-
- BannerDO convert(BannerAddDTO bannerAddDTO);
-
- BannerDO convert(BannerUpdateDTO bannerUpdateDTO);
-
-}
\ No newline at end of file
diff --git a/promotion/promotion-biz/src/main/java/cn/iocoder/mall/promotion/biz/dao/BannerMapper.java b/promotion/promotion-biz/src/main/java/cn/iocoder/mall/promotion/biz/dao/BannerMapper.java
deleted file mode 100644
index 5d3d46ca3..000000000
--- a/promotion/promotion-biz/src/main/java/cn/iocoder/mall/promotion/biz/dao/BannerMapper.java
+++ /dev/null
@@ -1,45 +0,0 @@
-package cn.iocoder.mall.promotion.biz.dao;
-
-import cn.iocoder.mall.promotion.biz.dataobject.BannerDO;
-import cn.iocoder.mall.promotion.biz.dto.banner.BannerListDTO;
-import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
-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.Mapper;
-import org.springframework.stereotype.Repository;
-import org.springframework.util.StringUtils;
-
-/**
- * banner
- *
- * author: sin
- * time: 2020/5/14 14:19
- */
-@Repository
-@Mapper
-public interface BannerMapper extends BaseMapper {
-
- /**
- * 查询 - 列表
- *
- * @param dto
- * @return
- */
- // TODO FROM 芋艿 to 小范:Page 方法哈
- default IPage selectBannerList(BannerListDTO dto) {
- LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>();
- if (StringUtils.isEmpty(dto.getStatus())) {
- queryWrapper.eq(BannerDO::getStatus, dto.getStatus());
- }
-
- if (StringUtils.isEmpty(dto.getTitle())) {
- queryWrapper.like(BannerDO::getTitle, dto.getTitle());
- }
-
- queryWrapper.orderByDesc(BannerDO::getId);
- IPage result = selectPage(new Page<>(), queryWrapper);
- return result;
- }
-
-}
diff --git a/promotion/promotion-biz/src/main/java/cn/iocoder/mall/promotion/biz/dataobject/BannerDO.java b/promotion/promotion-biz/src/main/java/cn/iocoder/mall/promotion/biz/dataobject/BannerDO.java
deleted file mode 100644
index a51893842..000000000
--- a/promotion/promotion-biz/src/main/java/cn/iocoder/mall/promotion/biz/dataobject/BannerDO.java
+++ /dev/null
@@ -1,47 +0,0 @@
-package cn.iocoder.mall.promotion.biz.dataobject;
-
-import cn.iocoder.mall.mybatis.core.dataobject.DeletableDO;
-import lombok.Data;
-import lombok.experimental.Accessors;
-
-/**
- * Banner 广告页
- */
-@Data
-@Accessors(chain = true)
-public class BannerDO extends DeletableDO {
-
- /**
- * 编号
- */
- private Integer id;
- /**
- * 标题
- */
- private String title;
- /**
- * 跳转链接
- */
- private String url;
- /**
- * 图片链接
- */
- private String picUrl;
- /**
- * 排序
- */
- private Integer sort;
- /**
- * 状态
- *
- * {@link cn.iocoder.common.framework.enums.CommonStatusEnum}
- */
- private Integer status;
- /**
- * 备注
- */
- private String memo;
-
- // TODO 芋艿 点击次数。&& 其他数据相关
-
-}
diff --git a/promotion/promotion-biz/src/main/java/cn/iocoder/mall/promotion/biz/dto/banner/BannerAddDTO.java b/promotion/promotion-biz/src/main/java/cn/iocoder/mall/promotion/biz/dto/banner/BannerAddDTO.java
deleted file mode 100644
index cfea28fff..000000000
--- a/promotion/promotion-biz/src/main/java/cn/iocoder/mall/promotion/biz/dto/banner/BannerAddDTO.java
+++ /dev/null
@@ -1,41 +0,0 @@
-package cn.iocoder.mall.promotion.biz.dto.banner;
-
-import lombok.Data;
-import lombok.experimental.Accessors;
-import org.hibernate.validator.constraints.Length;
-import org.hibernate.validator.constraints.URL;
-
-import javax.validation.constraints.NotEmpty;
-import javax.validation.constraints.NotNull;
-import java.io.Serializable;
-
-/**
- * Banner 添加 DTO
- */
-@Data
-@Accessors(chain = true)
-public class BannerAddDTO implements Serializable {
-
- @NotNull
- private Integer adminId;
-
- @NotEmpty(message = "标题不能为空")
- @Length(min = 2, max = 32, message = "标题长度为 2-32 位")
- private String title;
-
- @NotEmpty(message = "跳转链接不能为空")
- @URL(message = "跳转链接格式不正确")
- @Length(max = 255, message = "跳转链接最大长度为 255 位")
- private String url;
-
- @NotEmpty(message = "图片链接不能为空")
- @URL(message = "图片链接格式不正确")
- @Length(max = 255, message = "图片链接最大长度为 255 位")
- private String picUrl;
-
- @NotNull(message = "排序不能为空")
- private Integer sort;
-
- @Length(max = 255, message = "备注最大长度为 255 位")
- private String memo;
-}
diff --git a/promotion/promotion-biz/src/main/java/cn/iocoder/mall/promotion/biz/dto/banner/BannerListDTO.java b/promotion/promotion-biz/src/main/java/cn/iocoder/mall/promotion/biz/dto/banner/BannerListDTO.java
deleted file mode 100644
index 96e954d6f..000000000
--- a/promotion/promotion-biz/src/main/java/cn/iocoder/mall/promotion/biz/dto/banner/BannerListDTO.java
+++ /dev/null
@@ -1,26 +0,0 @@
-package cn.iocoder.mall.promotion.biz.dto.banner;
-
-import cn.iocoder.common.framework.vo.PageParam;
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-import lombok.experimental.Accessors;
-
-import javax.validation.constraints.NotNull;
-import java.io.Serializable;
-
-/**
- * Banner 分页 DTO
- */
-@Data
-@Accessors(chain = true)
-public class BannerListDTO extends PageParam {
-
- @ApiModelProperty("标题")
- @NotNull(message = "页码不能为空")
- private String title;
-
- @ApiModelProperty("标题")
- @NotNull(message = "页码不能为空")
- private Integer status;
-
-}
diff --git a/promotion/promotion-biz/src/main/java/cn/iocoder/mall/promotion/biz/dto/banner/BannerUpdateDTO.java b/promotion/promotion-biz/src/main/java/cn/iocoder/mall/promotion/biz/dto/banner/BannerUpdateDTO.java
deleted file mode 100644
index a522796fe..000000000
--- a/promotion/promotion-biz/src/main/java/cn/iocoder/mall/promotion/biz/dto/banner/BannerUpdateDTO.java
+++ /dev/null
@@ -1,45 +0,0 @@
-package cn.iocoder.mall.promotion.biz.dto.banner;
-
-import lombok.Data;
-import lombok.experimental.Accessors;
-import org.hibernate.validator.constraints.Length;
-import org.hibernate.validator.constraints.URL;
-
-import javax.validation.constraints.NotEmpty;
-import javax.validation.constraints.NotNull;
-import java.io.Serializable;
-
-/**
- * Banner 更新 DTO
- */
-@Data
-@Accessors(chain = true)
-public class BannerUpdateDTO implements Serializable {
-
- @NotNull
- Integer adminId;
-
- @NotNull(message = "编号不能为空")
- private Integer id;
-
- @NotEmpty(message = "标题不能为空")
- @Length(min = 2, max = 32, message = "标题长度为 2-32 位")
- private String title;
-
- @NotEmpty(message = "跳转链接不能为空")
- @URL(message = "跳转链接格式不正确")
- @Length(max = 255, message = "跳转链接最大长度为 255 位")
- private String url;
-
- @NotEmpty(message = "图片链接不能为空")
- @URL(message = "图片链接格式不正确")
- @Length(max = 255, message = "图片链接最大长度为 255 位")
- private String picUrl;
-
- @NotNull(message = "排序不能为空")
- private Integer sort;
-
- @Length(max = 255, message = "备注最大长度为 255 位")
- private String memo;
-
-}
diff --git a/promotion/promotion-biz/src/main/java/cn/iocoder/mall/promotion/biz/dto/package-info.java b/promotion/promotion-biz/src/main/java/cn/iocoder/mall/promotion/biz/dto/package-info.java
deleted file mode 100644
index c7f03ef5b..000000000
--- a/promotion/promotion-biz/src/main/java/cn/iocoder/mall/promotion/biz/dto/package-info.java
+++ /dev/null
@@ -1,5 +0,0 @@
-/**
- * author: sin
- * time: 2020/5/14 16:46
- */
-package cn.iocoder.mall.promotion.biz.dto;
\ No newline at end of file
diff --git a/promotion/promotion-biz/src/main/java/cn/iocoder/mall/promotion/biz/package-info.java b/promotion/promotion-biz/src/main/java/cn/iocoder/mall/promotion/biz/package-info.java
deleted file mode 100644
index 5435c0654..000000000
--- a/promotion/promotion-biz/src/main/java/cn/iocoder/mall/promotion/biz/package-info.java
+++ /dev/null
@@ -1,6 +0,0 @@
-
-/**
- * author: sin
- * time: 2020/5/14 14:19
- */
-package cn.iocoder.mall.promotion.biz;
\ No newline at end of file
diff --git a/promotion/promotion-biz/src/main/java/cn/iocoder/mall/promotion/biz/service/banner/BannerService.java b/promotion/promotion-biz/src/main/java/cn/iocoder/mall/promotion/biz/service/banner/BannerService.java
deleted file mode 100644
index d76a27e19..000000000
--- a/promotion/promotion-biz/src/main/java/cn/iocoder/mall/promotion/biz/service/banner/BannerService.java
+++ /dev/null
@@ -1,69 +0,0 @@
-package cn.iocoder.mall.promotion.biz.service.banner;
-
-import cn.iocoder.common.framework.enums.CommonStatusEnum;
-import cn.iocoder.common.framework.validator.InEnum;
-import cn.iocoder.common.framework.vo.PageResult;
-import cn.iocoder.mall.promotion.biz.bo.banner.BannerListBO;
-import cn.iocoder.mall.promotion.biz.bo.banner.BannerListOnReleaseBO;
-import cn.iocoder.mall.promotion.biz.dto.banner.BannerAddDTO;
-import cn.iocoder.mall.promotion.biz.dto.banner.BannerListDTO;
-import cn.iocoder.mall.promotion.biz.dto.banner.BannerUpdateDTO;
-
-import java.util.List;
-
-/**
- * banner
- *
- * author: sin
- * time: 2020/5/14 14:19
- */
-public interface BannerService {
-
- /**
- * 列表 - 获取已发布的banner
- *
- * @return
- */
- List listBannerOnRelease();
-
- /**
- * 列表 - banner 列表
- *
- * @param bannerPageDTO
- * @return
- */
- PageResult listBanner(BannerListDTO bannerPageDTO);
-
- /**
- * 添加 - 一个banner
- *
- * @param adminsBannerAddDTO
- */
- void addBanner(BannerAddDTO adminsBannerAddDTO);
-
- /**
- * 更新 - 根据id更新
- *
- * @param adminsBannerUpdateDTO
- */
- void updateBanner(BannerUpdateDTO adminsBannerUpdateDTO);
-
- // TODO FROM 芋艿 to 小范:貌似要把 dto 搞起来,嘿嘿;
- /**
- * 更新 - banner 状态
- *
- * @param adminId
- * @param bannerId
- * @param status
- * @return
- */
- void updateBannerStatus(Integer adminId, Integer bannerId, @InEnum(value = CommonStatusEnum.class, message = "修改状态必须是 {value}") Integer status);
-
- /**
- * 删除 - 根据id删除一个banner
- *
- * @param adminId
- * @param bannerId
- */
- void deleteBanner(Integer adminId, Integer bannerId);
-}
diff --git a/promotion/promotion-biz/src/main/java/cn/iocoder/mall/promotion/biz/service/banner/BannerServiceImpl.java b/promotion/promotion-biz/src/main/java/cn/iocoder/mall/promotion/biz/service/banner/BannerServiceImpl.java
deleted file mode 100644
index 11a4f1546..000000000
--- a/promotion/promotion-biz/src/main/java/cn/iocoder/mall/promotion/biz/service/banner/BannerServiceImpl.java
+++ /dev/null
@@ -1,105 +0,0 @@
-package cn.iocoder.mall.promotion.biz.service.banner;
-
-import cn.iocoder.common.framework.enums.CommonStatusEnum;
-import cn.iocoder.common.framework.util.ServiceExceptionUtil;
-import cn.iocoder.common.framework.vo.PageResult;
-import cn.iocoder.mall.mybatis.core.enums.DeletedStatusEnum;
-import cn.iocoder.mall.promotion.biz.api.enums.PromotionErrorCodeEnum;
-import cn.iocoder.mall.promotion.biz.bo.banner.BannerListBO;
-import cn.iocoder.mall.promotion.biz.bo.banner.BannerListOnReleaseBO;
-import cn.iocoder.mall.promotion.biz.convert.BannerConvert;
-import cn.iocoder.mall.promotion.biz.dao.BannerMapper;
-import cn.iocoder.mall.promotion.biz.dataobject.BannerDO;
-import cn.iocoder.mall.promotion.biz.dto.banner.BannerAddDTO;
-import cn.iocoder.mall.promotion.biz.dto.banner.BannerListDTO;
-import cn.iocoder.mall.promotion.biz.dto.banner.BannerUpdateDTO;
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
-import java.util.Date;
-import java.util.List;
-
-/**
- * banner
- *
- * author: sin
- * time: 2020/5/14 14:19
- */
-@Service
-public class BannerServiceImpl implements BannerService {
-
- @Autowired
- private BannerMapper bannerMapper;
-
- @Override
- public List listBannerOnRelease() {
- PageResult pageResult = this.listBanner(
- (BannerListDTO) new BannerListDTO()
- .setStatus(CommonStatusEnum.ENABLE.getValue())
- .setTitle(null)
- .setPageNo(1)
- .setPageSize(10)
- );
- return BannerConvert.INSTANCE.convertToBO(pageResult.getList());
- }
-
- @Override
- public PageResult listBanner(BannerListDTO dto) {
- IPage page = bannerMapper.selectBannerList(dto);
- List list = BannerConvert.INSTANCE.convert(page.getRecords());
- return new PageResult().setList(list).setTotal(page.getTotal());
- }
-
- @Override
- public void addBanner(BannerAddDTO adminsBannerAddDTO) {
- // 转换DO
- BannerDO banner = BannerConvert.INSTANCE.convert(adminsBannerAddDTO);
- // 设置默认数据
- banner.setStatus(CommonStatusEnum.ENABLE.getValue());
- banner.setDeleted(DeletedStatusEnum.DELETED_NO.getValue());
- banner.setCreateTime(new Date());
- // 保存数据
- bannerMapper.insert(banner);
- }
-
- @Override
- public void updateBanner(BannerUpdateDTO adminsBannerUpdateDTO) {
- // 校验 Banner 存在
- if (bannerMapper.selectById(adminsBannerUpdateDTO.getId()) == null) {
- throw ServiceExceptionUtil.exception(PromotionErrorCodeEnum.BANNER_NOT_EXISTS.getCode());
- }
- // 更新到数据库
- BannerDO updateBanner = BannerConvert.INSTANCE.convert(adminsBannerUpdateDTO);
- updateBanner.setUpdateTime(new Date());
- bannerMapper.updateById(updateBanner);
- }
-
- @Override
- public void updateBannerStatus(Integer adminId, Integer bannerId, Integer status) {
- // 校验 Banner 存在
- if (bannerMapper.selectById(bannerId) == null) {
- throw ServiceExceptionUtil.exception(PromotionErrorCodeEnum.BANNER_NOT_EXISTS.getCode());
- }
- // 更新到数据库
- BannerDO updateBanner = new BannerDO();
- updateBanner.setId(bannerId);
- updateBanner.setStatus(status);
- updateBanner.setUpdateTime(new Date());
- bannerMapper.updateById(updateBanner);
- }
-
- @Override
- public void deleteBanner(Integer adminId, Integer bannerId) {
- // 校验 Banner 存在
- if (bannerMapper.selectById(bannerId) == null) {
- throw ServiceExceptionUtil.exception(PromotionErrorCodeEnum.BANNER_NOT_EXISTS.getCode());
- }
- // 更新到数据库
- BannerDO updateBanner = new BannerDO();
- updateBanner.setId(bannerId);
- updateBanner.setUpdateTime(new Date());
- updateBanner.setDeleted(DeletedStatusEnum.DELETED_YES.getValue());
- bannerMapper.updateById(updateBanner);
- }
-}
diff --git a/promotion/promotion-biz/src/main/java/cn/iocoder/mall/promotion/biz/service/package-info.java b/promotion/promotion-biz/src/main/java/cn/iocoder/mall/promotion/biz/service/package-info.java
deleted file mode 100644
index bdfe46ced..000000000
--- a/promotion/promotion-biz/src/main/java/cn/iocoder/mall/promotion/biz/service/package-info.java
+++ /dev/null
@@ -1,5 +0,0 @@
-/**
- * author: sin
- * time: 2020/5/14 16:47
- */
-package cn.iocoder.mall.promotion.biz.service;
\ No newline at end of file
diff --git a/promotion/promotion-rest/pom.xml b/promotion/promotion-rest/pom.xml
deleted file mode 100644
index d5451a0ab..000000000
--- a/promotion/promotion-rest/pom.xml
+++ /dev/null
@@ -1,39 +0,0 @@
-
-
-
- promotion
- cn.iocoder.mall
- 1.0-SNAPSHOT
-
- 4.0.0
-
- promotion-rest
-
-
-
-
- cn.iocoder.mall
- promotion-biz
- 1.0-SNAPSHOT
-
-
-
-
- cn.iocoder.mall
- mall-spring-boot-starter-web
- 1.0-SNAPSHOT
-
-
- cn.iocoder.mall
- mall-spring-boot-starter-security
- 1.0-SNAPSHOT
-
-
- cn.iocoder.mall
- mall-spring-boot-starter-swagger
- 1.0-SNAPSHOT
-
-
-
\ No newline at end of file
diff --git a/promotion/promotion-rest/src/main/java/cn/iocoder/mall/promotion/rest/controller/banner/AdminsBannerController.java b/promotion/promotion-rest/src/main/java/cn/iocoder/mall/promotion/rest/controller/banner/AdminsBannerController.java
deleted file mode 100644
index d47689dc0..000000000
--- a/promotion/promotion-rest/src/main/java/cn/iocoder/mall/promotion/rest/controller/banner/AdminsBannerController.java
+++ /dev/null
@@ -1,84 +0,0 @@
-package cn.iocoder.mall.promotion.rest.controller.banner;
-
-import cn.iocoder.common.framework.vo.CommonResult;
-import cn.iocoder.common.framework.vo.PageResult;
-import cn.iocoder.mall.promotion.biz.bo.banner.BannerListBO;
-import cn.iocoder.mall.promotion.biz.dto.banner.BannerAddDTO;
-import cn.iocoder.mall.promotion.biz.dto.banner.BannerListDTO;
-import cn.iocoder.mall.promotion.biz.dto.banner.BannerUpdateDTO;
-import cn.iocoder.mall.promotion.biz.service.banner.BannerService;
-import cn.iocoder.mall.promotion.rest.convert.BannerConvert;
-import cn.iocoder.mall.promotion.rest.request.banner.BannerAddRequest;
-import cn.iocoder.mall.promotion.rest.request.banner.BannerListRequest;
-import cn.iocoder.mall.promotion.rest.request.banner.BannerUpdateRequest;
-import cn.iocoder.mall.promotion.rest.request.banner.BannerUpdateStatusRequest;
-import cn.iocoder.mall.promotion.rest.response.banner.BannerListResponse;
-import cn.iocoder.mall.security.core.context.AdminSecurityContextHolder;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiImplicitParam;
-import io.swagger.annotations.ApiOperation;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.*;
-
-import javax.validation.Valid;
-import java.util.List;
-
-/**
- * Banner(管理员API)
- *
- * author: sin
- * time: 2020/5/14 15:27
- */
-@RestController
-@RequestMapping("/admins/banner")
-@Api(tags = "Banner(管理员API)")
-public class AdminsBannerController {
-
- @Autowired
- private BannerService bannerService;
-
- @PostMapping("/list")
- @ApiOperation(value = "列表-banner列表")
- public CommonResult> page(@RequestBody @Valid BannerListRequest request) {
- // 获取数据
- BannerListDTO pageDTO = BannerConvert.INSTANCE.convert(request);
- PageResult pageResult = bannerService.listBanner(pageDTO);
- // 转换 response
- List responseList = BannerConvert.INSTANCE.convert(pageResult.getList());
- return CommonResult.success(new PageResult().setList(responseList).setTotal(pageResult.getTotal()));
- }
-
- @PostMapping("/add")
- @ApiOperation(value = "添加-Banner")
- public CommonResult add(@RequestBody @Valid BannerAddRequest request) {
- BannerAddDTO bannerAddDTO = BannerConvert.INSTANCE.convert(request);
- bannerAddDTO.setAdminId(AdminSecurityContextHolder.getContext().getAdminId());
- bannerService.addBanner(bannerAddDTO);
- return CommonResult.success(null);
- }
-
- @PutMapping("/update")
- @ApiOperation(value = "更新-Banner信息")
- public CommonResult update(@RequestBody @Valid BannerUpdateRequest request) {
- BannerUpdateDTO bannerUpdateDTO = BannerConvert.INSTANCE.convert(request);
- bannerUpdateDTO.setAdminId(AdminSecurityContextHolder.getContext().getAdminId());
- bannerService.updateBanner(bannerUpdateDTO);
- return CommonResult.success(null);
- }
-
- @PutMapping("/update-status")
- @ApiOperation(value = "更新-banner状态")
- public CommonResult updateStatus(@RequestBody @Valid BannerUpdateStatusRequest request) {
- Integer adminId = AdminSecurityContextHolder.getContext().getAdminId();
- bannerService.updateBannerStatus(adminId, request.getBannerId(), request.getStatus());
- return CommonResult.success(null);
- }
-
- @DeleteMapping("/delete")
- @ApiOperation(value = "删除-根据id删除")
- @ApiImplicitParam(name = "id", value = "Banner 编号", required = true, example = "1")
- public CommonResult delete(@RequestParam("id") Integer id) {
- bannerService.deleteBanner(AdminSecurityContextHolder.getContext().getAdminId(), id);
- return CommonResult.success(null);
- }
-}
diff --git a/promotion/promotion-rest/src/main/java/cn/iocoder/mall/promotion/rest/controller/banner/UsersBannerController.java b/promotion/promotion-rest/src/main/java/cn/iocoder/mall/promotion/rest/controller/banner/UsersBannerController.java
deleted file mode 100644
index 4d69100d7..000000000
--- a/promotion/promotion-rest/src/main/java/cn/iocoder/mall/promotion/rest/controller/banner/UsersBannerController.java
+++ /dev/null
@@ -1,37 +0,0 @@
-package cn.iocoder.mall.promotion.rest.controller.banner;
-
-import cn.iocoder.common.framework.vo.CommonResult;
-import cn.iocoder.mall.promotion.biz.bo.banner.BannerListOnReleaseBO;
-import cn.iocoder.mall.promotion.biz.service.banner.BannerService;
-import cn.iocoder.mall.promotion.rest.convert.BannerConvert;
-import cn.iocoder.mall.promotion.rest.response.banner.BannerListOnReleaseResponse;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-
-import java.util.List;
-
-/**
- * Banner(用户API)
- *
- * author: sin
- * time: 2020/5/14 15:27
- */
-@RestController
-@RequestMapping("/users/banner")
-@Api(tags = "Banner(用户API)")
-public class UsersBannerController {
-
- @Autowired
- private BannerService bannerService;
-
- @GetMapping("/listBannerOnRelease")
- @ApiOperation("获取-已发布的banner")
- public CommonResult> listBannerOnRelease() {
- List releaseBOList = bannerService.listBannerOnRelease();
- return CommonResult.success(BannerConvert.INSTANCE.convertReleaseResponse(releaseBOList));
- }
-}
diff --git a/promotion/promotion-rest/src/main/java/cn/iocoder/mall/promotion/rest/controller/package-info.java b/promotion/promotion-rest/src/main/java/cn/iocoder/mall/promotion/rest/controller/package-info.java
deleted file mode 100644
index 636b0a891..000000000
--- a/promotion/promotion-rest/src/main/java/cn/iocoder/mall/promotion/rest/controller/package-info.java
+++ /dev/null
@@ -1,5 +0,0 @@
-/**
- * author: sin
- * time: 2020/5/14 15:27
- */
-package cn.iocoder.mall.promotion.rest.controller;
\ No newline at end of file
diff --git a/promotion/promotion-rest/src/main/java/cn/iocoder/mall/promotion/rest/convert/BannerConvert.java b/promotion/promotion-rest/src/main/java/cn/iocoder/mall/promotion/rest/convert/BannerConvert.java
deleted file mode 100644
index 19a1f502c..000000000
--- a/promotion/promotion-rest/src/main/java/cn/iocoder/mall/promotion/rest/convert/BannerConvert.java
+++ /dev/null
@@ -1,33 +0,0 @@
-package cn.iocoder.mall.promotion.rest.convert;
-
-import cn.iocoder.mall.promotion.biz.bo.banner.BannerListBO;
-import cn.iocoder.mall.promotion.biz.bo.banner.BannerListOnReleaseBO;
-import cn.iocoder.mall.promotion.biz.dto.banner.BannerAddDTO;
-import cn.iocoder.mall.promotion.biz.dto.banner.BannerUpdateDTO;
-import cn.iocoder.mall.promotion.biz.dto.banner.BannerListDTO;
-import cn.iocoder.mall.promotion.rest.request.banner.BannerAddRequest;
-import cn.iocoder.mall.promotion.rest.request.banner.BannerListRequest;
-import cn.iocoder.mall.promotion.rest.request.banner.BannerUpdateRequest;
-import cn.iocoder.mall.promotion.rest.response.banner.BannerListResponse;
-import cn.iocoder.mall.promotion.rest.response.banner.BannerListOnReleaseResponse;
-import org.mapstruct.Mapper;
-import org.mapstruct.factory.Mappers;
-
-import java.util.List;
-
-@Mapper
-public interface BannerConvert {
-
- BannerConvert INSTANCE = Mappers.getMapper(BannerConvert.class);
-
- BannerAddDTO convert(BannerAddRequest request);
-
- BannerUpdateDTO convert(BannerUpdateRequest request);
-
- BannerListDTO convert(BannerListRequest request);
-
- List convert(List bannerListBO);
-
- List convertReleaseResponse(List bannerListOnReleaseBOS);
-
-}
\ No newline at end of file
diff --git a/promotion/promotion-rest/src/main/java/cn/iocoder/mall/promotion/rest/request/banner/BannerAddRequest.java b/promotion/promotion-rest/src/main/java/cn/iocoder/mall/promotion/rest/request/banner/BannerAddRequest.java
deleted file mode 100644
index ffb49b443..000000000
--- a/promotion/promotion-rest/src/main/java/cn/iocoder/mall/promotion/rest/request/banner/BannerAddRequest.java
+++ /dev/null
@@ -1,35 +0,0 @@
-package cn.iocoder.mall.promotion.rest.request.banner;
-
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-import lombok.experimental.Accessors;
-
-import javax.validation.constraints.NotNull;
-import java.io.Serializable;
-
-/**
- * banner:更新 banner
- *
- * author: sin
- * time: 2020/5/14 15:44
- */
-@Data
-@Accessors(chain = true)
-public class BannerAddRequest implements Serializable {
-
- @NotNull // TODO FROM 芋艿 to 小范:提示要加下,哈哈哈
- @ApiModelProperty("跳转链接")
- private Integer url;
-
- @NotNull
- @ApiModelProperty("图片链接")
- private Integer picUrl;
-
- @NotNull
- @ApiModelProperty("排序")
- private Integer sort;
-
- @NotNull
- @ApiModelProperty("备注")
- private Integer memo;
-}
diff --git a/promotion/promotion-rest/src/main/java/cn/iocoder/mall/promotion/rest/request/banner/BannerListRequest.java b/promotion/promotion-rest/src/main/java/cn/iocoder/mall/promotion/rest/request/banner/BannerListRequest.java
deleted file mode 100644
index ec08a13d8..000000000
--- a/promotion/promotion-rest/src/main/java/cn/iocoder/mall/promotion/rest/request/banner/BannerListRequest.java
+++ /dev/null
@@ -1,27 +0,0 @@
-package cn.iocoder.mall.promotion.rest.request.banner;
-
-import cn.iocoder.common.framework.vo.PageParam;
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-import lombok.experimental.Accessors;
-import org.springframework.web.bind.annotation.RequestParam;
-
-import javax.validation.constraints.NotNull;
-import java.io.Serializable;
-
-/**
- * banner:更新 banner
- *
- * author: sin
- * time: 2020/5/14 15:44
- */
-@Data
-@Accessors(chain = true)
-public class BannerListRequest extends PageParam {
-
- @ApiModelProperty("标题")
- private String title;
-
- @ApiModelProperty("状态")
- private Integer status;
-}
diff --git a/promotion/promotion-rest/src/main/java/cn/iocoder/mall/promotion/rest/request/banner/BannerUpdateRequest.java b/promotion/promotion-rest/src/main/java/cn/iocoder/mall/promotion/rest/request/banner/BannerUpdateRequest.java
deleted file mode 100644
index 38f4171b6..000000000
--- a/promotion/promotion-rest/src/main/java/cn/iocoder/mall/promotion/rest/request/banner/BannerUpdateRequest.java
+++ /dev/null
@@ -1,39 +0,0 @@
-package cn.iocoder.mall.promotion.rest.request.banner;
-
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-import lombok.experimental.Accessors;
-
-import javax.validation.constraints.NotNull;
-import java.io.Serializable;
-
-/**
- * banner:更新 banner
- *
- * author: sin
- * time: 2020/5/14 15:44
- */
-@Data
-@Accessors(chain = true)
-public class BannerUpdateRequest implements Serializable {
-
- @NotNull
- @ApiModelProperty("banner编号")
- private Integer bannerId;
-
- @NotNull
- @ApiModelProperty("跳转链接")
- private Integer url;
-
- @NotNull
- @ApiModelProperty("图片链接")
- private Integer picUrl;
-
- @NotNull
- @ApiModelProperty("排序")
- private Integer sort;
-
- @NotNull
- @ApiModelProperty("备注")
- private Integer memo;
-}
diff --git a/promotion/promotion-rest/src/main/java/cn/iocoder/mall/promotion/rest/request/banner/BannerUpdateStatusRequest.java b/promotion/promotion-rest/src/main/java/cn/iocoder/mall/promotion/rest/request/banner/BannerUpdateStatusRequest.java
deleted file mode 100644
index 025261849..000000000
--- a/promotion/promotion-rest/src/main/java/cn/iocoder/mall/promotion/rest/request/banner/BannerUpdateStatusRequest.java
+++ /dev/null
@@ -1,27 +0,0 @@
-package cn.iocoder.mall.promotion.rest.request.banner;
-
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-import lombok.experimental.Accessors;
-
-import javax.validation.constraints.NotNull;
-import java.io.Serializable;
-
-/**
- * banner:更新 status
- *
- * author: sin
- * time: 2020/5/14 15:44
- */
-@Data
-@Accessors(chain = true)
-public class BannerUpdateStatusRequest implements Serializable {
-
- @NotNull
- @ApiModelProperty("banner编号")
- private Integer bannerId;
-
- @NotNull
- @ApiModelProperty("status状态")
- private Integer status;
-}
diff --git a/promotion/promotion-rest/src/main/java/cn/iocoder/mall/promotion/rest/request/package-info.java b/promotion/promotion-rest/src/main/java/cn/iocoder/mall/promotion/rest/request/package-info.java
deleted file mode 100644
index d4f960f57..000000000
--- a/promotion/promotion-rest/src/main/java/cn/iocoder/mall/promotion/rest/request/package-info.java
+++ /dev/null
@@ -1,6 +0,0 @@
-
-/**
- * author: sin
- * time: 2020/5/14 17:00
- */
-package cn.iocoder.mall.promotion.rest.request;
\ No newline at end of file
diff --git a/promotion/promotion-rest/src/main/java/cn/iocoder/mall/promotion/rest/response/banner/BannerListOnReleaseResponse.java b/promotion/promotion-rest/src/main/java/cn/iocoder/mall/promotion/rest/response/banner/BannerListOnReleaseResponse.java
deleted file mode 100644
index 8a880b437..000000000
--- a/promotion/promotion-rest/src/main/java/cn/iocoder/mall/promotion/rest/response/banner/BannerListOnReleaseResponse.java
+++ /dev/null
@@ -1,34 +0,0 @@
-package cn.iocoder.mall.promotion.rest.response.banner;
-
-import lombok.Data;
-import lombok.experimental.Accessors;
-
-import java.io.Serializable;
-
-/**
- * banner - 已发布的banner
- *
- * author: sin
- * time: 2020/5/14 16:56
- */
-@Data
-@Accessors(chain = true)
-public class BannerListOnReleaseResponse implements Serializable {
-
- /**
- * 编号
- */
- private Integer id;
- /**
- * 标题
- */
- private String title;
- /**
- * 跳转链接
- */
- private String url;
- /**
- * 图片链接
- */
- private String picUrl;
-}
diff --git a/promotion/promotion-rest/src/main/java/cn/iocoder/mall/promotion/rest/response/banner/BannerListResponse.java b/promotion/promotion-rest/src/main/java/cn/iocoder/mall/promotion/rest/response/banner/BannerListResponse.java
deleted file mode 100644
index 6357d5048..000000000
--- a/promotion/promotion-rest/src/main/java/cn/iocoder/mall/promotion/rest/response/banner/BannerListResponse.java
+++ /dev/null
@@ -1,49 +0,0 @@
-package cn.iocoder.mall.promotion.rest.response.banner;
-
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-import lombok.experimental.Accessors;
-
-import java.io.Serializable;
-import java.util.Date;
-
-/**
- * banner:list
- *
- * author: sin
- * time: 2020/5/14 16:00
- */
-@Data
-@Accessors(chain = true)
-public class BannerListResponse implements Serializable {
-
- @ApiModelProperty("编号")
- private Integer id;
-
- @ApiModelProperty("标题")
- private String title;
-
- @ApiModelProperty("跳转链接")
- private String url;
-
- @ApiModelProperty("图片链接")
- private String picUrl;
-
- @ApiModelProperty("排序")
- private Integer sort;
-
- @ApiModelProperty("状态")
- private Integer status;
-
- @ApiModelProperty("备注")
- private String memo;
-
- //
- // 其他
-
- @ApiModelProperty("更新时间")
- private Date updatedTime;
-
- @ApiModelProperty("创建时间")
- private Date createdTime;
-}
diff --git a/promotion/promotion-rest/src/main/java/cn/iocoder/mall/promotion/rest/response/package-info.java b/promotion/promotion-rest/src/main/java/cn/iocoder/mall/promotion/rest/response/package-info.java
deleted file mode 100644
index 4fd8e1cce..000000000
--- a/promotion/promotion-rest/src/main/java/cn/iocoder/mall/promotion/rest/response/package-info.java
+++ /dev/null
@@ -1,5 +0,0 @@
-/**
- * author: sin
- * time: 2020/5/14 15:26
- */
-package cn.iocoder.mall.promotion.rest.response;
\ No newline at end of file
diff --git a/promotion/promotion-rpc-api/pom.xml b/promotion/promotion-rpc-api/pom.xml
deleted file mode 100644
index 330b69b7e..000000000
--- a/promotion/promotion-rpc-api/pom.xml
+++ /dev/null
@@ -1,31 +0,0 @@
-
-
-
- promotion
- cn.iocoder.mall
- 1.0-SNAPSHOT
-
- 4.0.0
-
- promotion-rpc-api
-
-
-
-
- cn.iocoder.mall
- promotion-biz-api
- 1.0-SNAPSHOT
-
-
-
- javax.validation
- validation-api
-
-
- org.projectlombok
- lombok
-
-
-
\ No newline at end of file
diff --git a/promotion/promotion-rpc/pom.xml b/promotion/promotion-rpc/pom.xml
deleted file mode 100644
index 5b7a3ad5c..000000000
--- a/promotion/promotion-rpc/pom.xml
+++ /dev/null
@@ -1,39 +0,0 @@
-
-
-
- promotion
- cn.iocoder.mall
- 1.0-SNAPSHOT
-
- 4.0.0
-
- promotion-rpc
-
-
-
-
- cn.iocoder.mall
- promotion-rpc-api
- 1.0-SNAPSHOT
-
-
- cn.iocoder.mall
- system-biz
- 1.0-SNAPSHOT
-
-
-
-
- com.alibaba.cloud
- spring-cloud-starter-dubbo
-
-
-
-
- com.alibaba.cloud
- spring-cloud-starter-alibaba-nacos-discovery
-
-
-
\ No newline at end of file
diff --git a/promotion/promotion-start/src/main/java/cn/iocoder/mall/promotion/application/controller/admins/AdminsCouponController.java b/promotion/promotion-start/src/main/java/cn/iocoder/mall/promotion/application/controller/admins/AdminsCouponController.java
index 3a22f90f4..204cf1211 100644
--- a/promotion/promotion-start/src/main/java/cn/iocoder/mall/promotion/application/controller/admins/AdminsCouponController.java
+++ b/promotion/promotion-start/src/main/java/cn/iocoder/mall/promotion/application/controller/admins/AdminsCouponController.java
@@ -56,100 +56,4 @@ public class AdminsCouponController {
return success(CouponTemplateConvert.ADMINS.convertPage(result));
}
- @PostMapping("/template/add_card")
- @ApiOperation(value = "创建优惠劵模板")
- @ApiImplicitParams({
- @ApiImplicitParam(name = "title", value = "标题", required = true, example = "优惠劵牛逼"),
- @ApiImplicitParam(name = "description", value = "使用说明", example = "我只是描述"),
- @ApiImplicitParam(name = "quota", value = "每人限领个数", required = true),
- @ApiImplicitParam(name = "total", value = "发行总量"),
- @ApiImplicitParam(name = "priceAvailable", value = "是否设置满多少金额可用,单位:分", example = "0-不限制;大于0-多少金额可用"),
- @ApiImplicitParam(name = "rangeType", value = "可用范围的类型", required = true, example = "参见 CouponTemplateRangeTypeEnum 枚举"),
- @ApiImplicitParam(name = "rangeValues", value = "指定商品 / 分类列表,使用逗号分隔商品编号"),
- @ApiImplicitParam(name = "dateType", value = "生效日期类型", example = "参见 CouponTemplateDateTypeEnum 枚举"),
- @ApiImplicitParam(name = "validStartTime", value = "固定日期-生效开始时间", example = "当 dateType 为固定日期时,非空"),
- @ApiImplicitParam(name = "validEndTime", value = "固定日期-生效结束时间", example = "当 dateType 为固定日期时,非空"),
- @ApiImplicitParam(name = "fixedBeginTerm", value = "领取日期-开始天数", example = "当 dateType 为领取日期时,非空"),
- @ApiImplicitParam(name = "fixedEndTerm", value = "领取日期-结束天数", example = "当 dateType 为领取日期时,非空"),
- @ApiImplicitParam(name = "preferentialType", value = "优惠类型", example = "参见 CouponTemplatePreferentialTypeEnum 枚举"),
- @ApiImplicitParam(name = "priceOff", value = "优惠金额,单位:分", example = "当 preferentialType 为现金券时,非空"),
- @ApiImplicitParam(name = "percentOff", value = "折扣百分比", example = "当 preferentialType 为折扣卷时,非空"),
- @ApiImplicitParam(name = "discountPriceLimit", value = "折扣上限", example = "当 preferentialType 为折扣卷时,非空"),
- })
- public CommonResult templateCardAdd(@RequestParam(value = "title") String title,
- @RequestParam(value = "description", required = false) String description,
- @RequestParam(value = "quota") Integer quota,
- @RequestParam(value = "total", required = false) Integer total,
- @RequestParam(value = "priceAvailable") Integer priceAvailable,
- @RequestParam(value = "rangeType") Integer rangeType,
- @RequestParam(value = "rangeValues", required = false) String rangeValues,
- @RequestParam(value = "dateType") Integer dateType,
- @DateTimeFormat(pattern = "yyyy-MM-dd")
- @RequestParam(value = "validStartTime", required = false) Date validStartTime,
- @DateTimeFormat(pattern = "yyyy-MM-dd")
- @RequestParam(value = "validEndTime", required = false) Date validEndTime,
- @RequestParam(value = "fixedBeginTerm", required = false) Integer fixedBeginTerm,
- @RequestParam(value = "fixedEndTerm", required = false) Integer fixedEndTerm,
- @RequestParam(value = "preferentialType") Integer preferentialType,
- @RequestParam(value = "priceOff", required = false) Integer priceOff,
- @RequestParam(value = "percentOff", required = false) Integer percentOff,
- @RequestParam(value = "discountPriceLimit", required = false) Integer discountPriceLimit) {
- // 创建 CouponCardTemplateAddDTO 对象
- validStartTime = DateUtil.getDayBegin(validStartTime); // 开始时间,以当前 00:00:00 为准
- validEndTime = DateUtil.getDayBegin(validEndTime); // 结束时间,以当前 25:59:59 为准
- CouponCardTemplateAddDTO couponCardTemplateAddDTO = new CouponCardTemplateAddDTO()
- .setTitle(title).setDescription(description)
- .setQuota(quota).setTotal(total)
- .setPriceAvailable(priceAvailable).setRangeType(rangeType).setRangeValues(rangeValues)
- .setDateType(dateType).setValidStartTime(validStartTime).setValidEndTime(validEndTime)
- .setFixedBeginTerm(fixedBeginTerm).setFixedEndTerm(fixedEndTerm)
- .setPreferentialType(preferentialType).setPriceOff(priceOff).setPercentOff(percentOff).setDiscountPriceLimit(discountPriceLimit);
- // 提交请求
- CouponTemplateBO result = couponService.addCouponCardTemplate(couponCardTemplateAddDTO);
- // 返回结果
- return success(CouponTemplateConvert.ADMINS.convert(result));
- }
-
- @PostMapping("/template/update_card")
- @ApiOperation(value = "更新优惠劵模板")
- @ApiImplicitParams({
- @ApiImplicitParam(name = "id", value = "编号", required = true, example = "1"),
- @ApiImplicitParam(name = "title", value = "标题", required = true, example = "优惠劵牛逼"),
- @ApiImplicitParam(name = "description", value = "使用说明", example = "我只是描述"),
- @ApiImplicitParam(name = "quota", value = "每人限领个数", required = true),
- @ApiImplicitParam(name = "total", value = "发行总量"),
- @ApiImplicitParam(name = "rangeType", value = "可用范围的类型", required = true, example = "参见 CouponTemplateRangeTypeEnum 枚举"),
- @ApiImplicitParam(name = "rangeValues", value = "指定商品 / 分类列表,使用逗号分隔商品编号"),
- })
- public CommonResult templateCardUpdate(@RequestParam(value = "id") Integer id,
- @RequestParam(value = "title") String title,
- @RequestParam(value = "description", required = false) String description,
- @RequestParam(value = "quota") Integer quota,
- @RequestParam(value = "total", required = false) Integer total,
- @RequestParam(value = "rangeType") Integer rangeType,
- @RequestParam(value = "rangeValues", required = false) String rangeValues) {
- // 创建 CouponCardTemplateAddDTO 对象
- CouponCardTemplateUpdateDTO couponCardTemplateUpdateDTO = new CouponCardTemplateUpdateDTO()
- .setId(id)
- .setTitle(title).setDescription(description)
- .setQuota(quota).setTotal(total)
- .setRangeType(rangeType).setRangeValues(rangeValues);
- return success(couponService.updateCouponCardTemplate(couponCardTemplateUpdateDTO));
- }
-
- @PostMapping("/template/update_status")
- @ApiOperation(value = "更新优惠劵(码)模板状态")
- @ApiImplicitParams({
- @ApiImplicitParam(name = "id", value = "Banner 编号", required = true, example = "1"),
- @ApiImplicitParam(name = "status", value = "状态。1 - 开启;2 - 禁用", required = true, example = "1"),
- })
- public CommonResult templateUpdateStatus(@RequestParam("id") Integer id,
- @RequestParam("status") Integer status) {
- return success(couponService.updateCouponTemplateStatus(AdminSecurityContextHolder.getContext().getAdminId(), id, status));
- }
-
- // ========== 优惠劵 ==========
-
- // ========== 优惠码 ==========
-
}
diff --git a/promotion/promotion-start/src/main/java/cn/iocoder/mall/promotion/application/vo/admins/AdminsCouponTemplatePageVO.java b/promotion/promotion-start/src/main/java/cn/iocoder/mall/promotion/application/vo/admins/AdminsCouponTemplatePageVO.java
deleted file mode 100644
index 89495b1f7..000000000
--- a/promotion/promotion-start/src/main/java/cn/iocoder/mall/promotion/application/vo/admins/AdminsCouponTemplatePageVO.java
+++ /dev/null
@@ -1,20 +0,0 @@
-package cn.iocoder.mall.promotion.application.vo.admins;
-
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-import lombok.experimental.Accessors;
-
-import java.util.List;
-
-@ApiModel("优惠劵(码)分页 VO")
-@Data
-@Accessors(chain = true)
-public class AdminsCouponTemplatePageVO {
-
- @ApiModelProperty(value = "优惠劵(码)数组")
- private List list;
- @ApiModelProperty(value = "优惠劵(码)总数")
- private Integer total;
-
-}
diff --git a/promotion/promotion-start/src/main/java/cn/iocoder/mall/promotion/application/vo/admins/AdminsProductRecommendPageVO.java b/promotion/promotion-start/src/main/java/cn/iocoder/mall/promotion/application/vo/admins/AdminsProductRecommendPageVO.java
deleted file mode 100644
index 278c512eb..000000000
--- a/promotion/promotion-start/src/main/java/cn/iocoder/mall/promotion/application/vo/admins/AdminsProductRecommendPageVO.java
+++ /dev/null
@@ -1,20 +0,0 @@
-package cn.iocoder.mall.promotion.application.vo.admins;
-
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-import lombok.experimental.Accessors;
-
-import java.util.List;
-
-@ApiModel("商品推荐分页 VO")
-@Data
-@Accessors(chain = true)
-public class AdminsProductRecommendPageVO {
-
- @ApiModelProperty(value = "商品推荐数组")
- private List list;
- @ApiModelProperty(value = "商品推荐总数")
- private Integer total;
-
-}