Commit ac8f62a2be6a648776c16f5709a68cd9722bc99e

Authored by wuxiran
1 parent d2a9a49d

mall:上传自动化生成的模板文件

Showing 32 changed files with 2155 additions and 0 deletions
yudao-module-mall/pom.xml
... ... @@ -24,6 +24,8 @@
24 24 <module>yudao-module-product-biz</module>
25 25 <module>yudao-module-trade-api</module>
26 26 <module>yudao-module-trade-biz</module>
  27 + <module>yudao-module-coupon-api</module>
  28 + <module>yudao-module-coupon-biz</module>
27 29 </modules>
28 30  
29 31 </project>
... ...
yudao-module-mall/yudao-module-coupon-api/pom.xml 0 → 100644
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<project xmlns="http://maven.apache.org/POM/4.0.0"
  3 + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  4 + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  5 + <parent>
  6 + <groupId>cn.iocoder.boot</groupId>
  7 + <artifactId>yudao-module-mall</artifactId>
  8 + <version>${revision}</version>
  9 + </parent>
  10 +
  11 + <modelVersion>4.0.0</modelVersion>
  12 + <artifactId>yudao-module-coupon-api</artifactId>
  13 + <packaging>jar</packaging>
  14 +
  15 +
  16 + <name>${project.artifactId}</name>
  17 + <description>
  18 + coupon 模块 API,暴露给其它模块调用
  19 + </description>
  20 +
  21 + <dependencies>
  22 + <dependency>
  23 + <groupId>cn.iocoder.boot</groupId>
  24 + <artifactId>yudao-common</artifactId>
  25 + </dependency>
  26 + </dependencies>
  27 +
  28 +</project>
0 29 \ No newline at end of file
... ...
yudao-module-mall/yudao-module-coupon-api/src/main/java/cn/iocoder/yudao/module/CouponTemplete/enums/ErrorCodeConstants.java 0 → 100644
  1 +package cn.iocoder.yudao.module.CouponTemplete.enums;
  2 +
  3 +import cn.iocoder.yudao.framework.common.exception.ErrorCode;
  4 +
  5 +/**
  6 + * coupon 优惠券错误码枚举类
  7 + *
  8 + * coupon 优惠券系统,使用 1-010-000-000 段
  9 + */
  10 +public interface ErrorCodeConstants {
  11 + // ========== COUPON分类相关 1010001000 ============
  12 +
  13 + ErrorCode COUPON_TEMPLETE_NOT_EXISTS = new ErrorCode(1010001000, "优惠券模板不存在");
  14 +
  15 + // ========== COUPON分类相关 1010002000 ============
  16 + ErrorCode COUPON_NOT_EXISTS = new ErrorCode(1010001000, "优惠券模板不存在");
  17 +
  18 +
  19 +}
  20 +
... ...
yudao-module-mall/yudao-module-coupon-biz/pom.xml 0 → 100644
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<project xmlns="http://maven.apache.org/POM/4.0.0"
  3 + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  4 + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  5 + <parent>
  6 + <artifactId>yudao-module-mall</artifactId>
  7 + <groupId>cn.iocoder.boot</groupId>
  8 + <version>${revision}</version>
  9 + </parent>
  10 + <modelVersion>4.0.0</modelVersion>
  11 + <artifactId>yudao-module-coupon-biz</artifactId>
  12 + <packaging>jar</packaging>
  13 +
  14 +
  15 + <name>${project.artifactId}</name>
  16 + <description>
  17 + trade 模块,主要实现交易相关功能
  18 + 例如:订单、退款、购物车等功能。
  19 + </description>
  20 +
  21 + <dependencies>
  22 +
  23 + <dependency>
  24 + <groupId>cn.iocoder.boot</groupId>
  25 + <artifactId>yudao-module-coupon-api</artifactId>
  26 + <version>${revision}</version>
  27 + </dependency>
  28 +
  29 + <!-- 业务组件 -->
  30 + <dependency>
  31 + <groupId>cn.iocoder.boot</groupId>
  32 + <artifactId>yudao-spring-boot-starter-biz-operatelog</artifactId>
  33 + </dependency>
  34 + <dependency>
  35 + <groupId>cn.iocoder.boot</groupId>
  36 + <artifactId>yudao-spring-boot-starter-biz-tenant</artifactId>
  37 + </dependency>
  38 +
  39 + <!-- Web 相关 -->
  40 + <dependency>
  41 + <groupId>cn.iocoder.boot</groupId>
  42 + <artifactId>yudao-spring-boot-starter-web</artifactId>
  43 + </dependency>
  44 + <dependency>
  45 + <groupId>cn.iocoder.boot</groupId>
  46 + <artifactId>yudao-spring-boot-starter-excel</artifactId>
  47 + </dependency>
  48 +
  49 + <!-- DB 相关 -->
  50 + <dependency>
  51 + <groupId>cn.iocoder.boot</groupId>
  52 + <artifactId>yudao-spring-boot-starter-mybatis</artifactId>
  53 + </dependency>
  54 +
  55 + <!-- Test 测试相关 -->
  56 + <dependency>
  57 + <groupId>cn.iocoder.boot</groupId>
  58 + <artifactId>yudao-spring-boot-starter-test</artifactId>
  59 + </dependency>
  60 +
  61 + </dependencies>
  62 +
  63 +</project>
0 64 \ No newline at end of file
... ...
yudao-module-mall/yudao-module-coupon-biz/src/main/java/cn/iocoder/yudao/module/coupon/controller/admin/coupon/CouponController.java 0 → 100644
  1 +package cn.iocoder.yudao.module.coupon.controller.admin.coupon;
  2 +
  3 +import org.springframework.web.bind.annotation.*;
  4 +import javax.annotation.Resource;
  5 +import org.springframework.validation.annotation.Validated;
  6 +import org.springframework.security.access.prepost.PreAuthorize;
  7 +import io.swagger.annotations.*;
  8 +
  9 +import javax.validation.constraints.*;
  10 +import javax.validation.*;
  11 +import javax.servlet.http.*;
  12 +import java.util.*;
  13 +import java.io.IOException;
  14 +
  15 +import cn.iocoder.yudao.framework.common.pojo.PageResult;
  16 +import cn.iocoder.yudao.framework.common.pojo.CommonResult;
  17 +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
  18 +
  19 +import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
  20 +
  21 +import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
  22 +import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.*;
  23 +
  24 +import cn.iocoder.yudao.module.coupon.controller.admin.coupon.vo.*;
  25 +import cn.iocoder.yudao.module.coupon.dal.dataobject.coupon.CouponDO;
  26 +import cn.iocoder.yudao.module.coupon.convert.coupon.CouponConvert;
  27 +import cn.iocoder.yudao.module.coupon.service.coupon.CouponService;
  28 +
  29 +@Api(tags = "管理后台 - 优惠券")
  30 +@RestController
  31 +@RequestMapping("/coupon/")
  32 +@Validated
  33 +public class CouponController {
  34 +
  35 + @Resource
  36 + private CouponService Service;
  37 +
  38 + @PostMapping("/create")
  39 + @ApiOperation("创建优惠券")
  40 + @PreAuthorize("@ss.hasPermission('coupon::create')")
  41 + public CommonResult<Long> create(@Valid @RequestBody CouponCreateReqVO createReqVO) {
  42 + return success(Service.create(createReqVO));
  43 + }
  44 +
  45 + @PutMapping("/update")
  46 + @ApiOperation("更新优惠券")
  47 + @PreAuthorize("@ss.hasPermission('coupon::update')")
  48 + public CommonResult<Boolean> update(@Valid @RequestBody CouponUpdateReqVO updateReqVO) {
  49 + Service.update(updateReqVO);
  50 + return success(true);
  51 + }
  52 +
  53 + @DeleteMapping("/delete")
  54 + @ApiOperation("删除优惠券")
  55 + @ApiImplicitParam(name = "id", value = "编号", required = true, dataTypeClass = Long.class)
  56 + @PreAuthorize("@ss.hasPermission('coupon::delete')")
  57 + public CommonResult<Boolean> delete(@RequestParam("id") Long id) {
  58 + Service.delete(id);
  59 + return success(true);
  60 + }
  61 +
  62 + @GetMapping("/get")
  63 + @ApiOperation("获得优惠券")
  64 + @ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class)
  65 + @PreAuthorize("@ss.hasPermission('coupon::query')")
  66 + public CommonResult<CouponRespVO> get(@RequestParam("id") Long id) {
  67 + CouponDO couponDO = Service.get(id);
  68 + return success(CouponConvert.INSTANCE.convert(couponDO));
  69 + }
  70 +
  71 + @GetMapping("/list")
  72 + @ApiOperation("获得优惠券列表")
  73 + @ApiImplicitParam(name = "ids", value = "编号列表", required = true, example = "1024,2048", dataTypeClass = List.class)
  74 + @PreAuthorize("@ss.hasPermission('coupon::query')")
  75 + public CommonResult<List<CouponRespVO>> getList(@RequestParam("ids") Collection<Long> ids) {
  76 + List<CouponDO> list = Service.getList(ids);
  77 + return success(CouponConvert.INSTANCE.convertList(list));
  78 + }
  79 +
  80 + @GetMapping("/page")
  81 + @ApiOperation("获得优惠券分页")
  82 + @PreAuthorize("@ss.hasPermission('coupon::query')")
  83 + public CommonResult<PageResult<CouponRespVO>> getPage(@Valid CouponPageReqVO pageVO) {
  84 + PageResult<CouponDO> pageResult = Service.getPage(pageVO);
  85 + return success(CouponConvert.INSTANCE.convertPage(pageResult));
  86 + }
  87 +
  88 + @GetMapping("/export-excel")
  89 + @ApiOperation("导出优惠券 Excel")
  90 + @PreAuthorize("@ss.hasPermission('coupon::export')")
  91 + @OperateLog(type = EXPORT)
  92 + public void exportExcel(@Valid CouponExportReqVO exportReqVO,
  93 + HttpServletResponse response) throws IOException {
  94 + List<CouponDO> list = Service.getList(exportReqVO);
  95 + // 导出 Excel
  96 + List<CouponExcelVO> datas = CouponConvert.INSTANCE.convertList02(list);
  97 + ExcelUtils.write(response, "优惠券.xls", "数据", CouponExcelVO.class, datas);
  98 + }
  99 +
  100 +}
... ...
yudao-module-mall/yudao-module-coupon-biz/src/main/java/cn/iocoder/yudao/module/coupon/controller/admin/coupon/vo/CouponBaseVO.java 0 → 100644
  1 +package cn.iocoder.yudao.module.coupon.controller.admin.coupon.vo;
  2 +
  3 +import lombok.*;
  4 +import java.util.*;
  5 +import java.math.BigDecimal;
  6 +import io.swagger.annotations.*;
  7 +import javax.validation.constraints.*;
  8 +import org.springframework.format.annotation.DateTimeFormat;
  9 +
  10 +import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
  11 +
  12 +/**
  13 +* 优惠券 Base VO,提供给添加、修改、详细的子 VO 使用
  14 +* 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成
  15 +*/
  16 +@Data
  17 +public class CouponBaseVO {
  18 +
  19 + @ApiModelProperty(value = "优惠券类型 reward-满减 discount-折扣 random-随机", required = true)
  20 + @NotNull(message = "优惠券类型 reward-满减 discount-折扣 random-随机不能为空")
  21 + private String type;
  22 +
  23 + @ApiModelProperty(value = "优惠券名称", required = true)
  24 + @NotNull(message = "优惠券名称不能为空")
  25 + private String name;
  26 +
  27 + @ApiModelProperty(value = "优惠券类型id")
  28 + private Long couponTypeId;
  29 +
  30 + @ApiModelProperty(value = "优惠券编码", required = true)
  31 + @NotNull(message = "优惠券编码不能为空")
  32 + private String couponCode;
  33 +
  34 + @ApiModelProperty(value = "领用人", required = true)
  35 + @NotNull(message = "领用人不能为空")
  36 + private Long memberId;
  37 +
  38 + @ApiModelProperty(value = "优惠券使用订单id", required = true)
  39 + @NotNull(message = "优惠券使用订单id不能为空")
  40 + private Long useOrderId;
  41 +
  42 + @ApiModelProperty(value = "适用商品类型1-全部商品可用;2-指定商品可用;3-指定商品不可用", required = true)
  43 + @NotNull(message = "适用商品类型1-全部商品可用;2-指定商品可用;3-指定商品不可用不能为空")
  44 + private Boolean goodsType;
  45 +
  46 + @ApiModelProperty(value = "适用商品id", required = true)
  47 + @NotNull(message = "适用商品id不能为空")
  48 + private String goodsIds;
  49 +
  50 + @ApiModelProperty(value = "最小金额", required = true)
  51 + @NotNull(message = "最小金额不能为空")
  52 + private BigDecimal atLeast;
  53 +
  54 + @ApiModelProperty(value = "面额", required = true)
  55 + @NotNull(message = "面额不能为空")
  56 + private BigDecimal money;
  57 +
  58 + @ApiModelProperty(value = "1 =< 折扣 <= 9.9 当type为discount时需要添加", required = true)
  59 + @NotNull(message = "1 =< 折扣 <= 9.9 当type为discount时需要添加不能为空")
  60 + private BigDecimal discount;
  61 +
  62 + @ApiModelProperty(value = "最多折扣金额 当type为discount时可选择性添加", required = true)
  63 + @NotNull(message = "最多折扣金额 当type为discount时可选择性添加不能为空")
  64 + private BigDecimal discountLimit;
  65 +
  66 + @ApiModelProperty(value = "优惠叠加 0-不限制 1- 优惠券仅原价购买商品时可用", required = true)
  67 + @NotNull(message = "优惠叠加 0-不限制 1- 优惠券仅原价购买商品时可用不能为空")
  68 + private Boolean whetherForbidPreference;
  69 +
  70 + @ApiModelProperty(value = "是否开启过期提醒0-不开启 1-开启", required = true)
  71 + @NotNull(message = "是否开启过期提醒0-不开启 1-开启不能为空")
  72 + private Boolean whetherExpireNotice;
  73 +
  74 + @ApiModelProperty(value = "过期前N天提醒", required = true)
  75 + @NotNull(message = "过期前N天提醒不能为空")
  76 + private Integer expireNoticeFixedTerm;
  77 +
  78 + @ApiModelProperty(value = "是否已提醒", required = true)
  79 + @NotNull(message = "是否已提醒不能为空")
  80 + private Boolean whetherNoticed;
  81 +
  82 + @ApiModelProperty(value = "优惠券状态 1已领用(未使用) 2已使用 3已过期", required = true)
  83 + @NotNull(message = "优惠券状态 1已领用(未使用) 2已使用 3已过期不能为空")
  84 + private Integer state;
  85 +
  86 + @ApiModelProperty(value = "获取方式1订单2.直接领取3.活动领取 4转赠 5分享获取", required = true)
  87 + @NotNull(message = "获取方式1订单2.直接领取3.活动领取 4转赠 5分享获取不能为空")
  88 + private Boolean getType;
  89 +
  90 + @ApiModelProperty(value = "领取时间", required = true)
  91 + @NotNull(message = "领取时间不能为空")
  92 + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
  93 + private Date fetchTime;
  94 +
  95 + @ApiModelProperty(value = "使用时间", required = true)
  96 + @NotNull(message = "使用时间不能为空")
  97 + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
  98 + private Date useTime;
  99 +
  100 + @ApiModelProperty(value = "可使用的开始时间", required = true)
  101 + @NotNull(message = "可使用的开始时间不能为空")
  102 + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
  103 + private Date startTime;
  104 +
  105 + @ApiModelProperty(value = "有效期结束时间", required = true)
  106 + @NotNull(message = "有效期结束时间不能为空")
  107 + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
  108 + private Date endTime;
  109 +
  110 +}
... ...
yudao-module-mall/yudao-module-coupon-biz/src/main/java/cn/iocoder/yudao/module/coupon/controller/admin/coupon/vo/CouponCreateReqVO.java 0 → 100644
  1 +package cn.iocoder.yudao.module.coupon.controller.admin.coupon.vo;
  2 +
  3 +import lombok.*;
  4 +import java.util.*;
  5 +import io.swagger.annotations.*;
  6 +import javax.validation.constraints.*;
  7 +
  8 +@ApiModel("管理后台 - 优惠券创建 Request VO")
  9 +@Data
  10 +@EqualsAndHashCode(callSuper = true)
  11 +@ToString(callSuper = true)
  12 +public class CouponCreateReqVO extends CouponBaseVO {
  13 +
  14 +}
... ...
yudao-module-mall/yudao-module-coupon-biz/src/main/java/cn/iocoder/yudao/module/coupon/controller/admin/coupon/vo/CouponExcelVO.java 0 → 100644
  1 +package cn.iocoder.yudao.module.coupon.controller.admin.coupon.vo;
  2 +
  3 +import lombok.*;
  4 +import java.util.*;
  5 +import java.math.BigDecimal;
  6 +import io.swagger.annotations.*;
  7 +
  8 +import com.alibaba.excel.annotation.ExcelProperty;
  9 +
  10 +/**
  11 + * 优惠券 Excel VO
  12 + *
  13 + * @author wxr
  14 + */
  15 +@Data
  16 +public class CouponExcelVO {
  17 +
  18 + @ExcelProperty("用户ID")
  19 + private Long id;
  20 +
  21 + @ExcelProperty("优惠券类型 reward-满减 discount-折扣 random-随机")
  22 + private String type;
  23 +
  24 + @ExcelProperty("优惠券名称")
  25 + private String name;
  26 +
  27 + @ExcelProperty("优惠券类型id")
  28 + private Long couponTypeId;
  29 +
  30 + @ExcelProperty("优惠券编码")
  31 + private String couponCode;
  32 +
  33 + @ExcelProperty("领用人")
  34 + private Long memberId;
  35 +
  36 + @ExcelProperty("优惠券使用订单id")
  37 + private Long useOrderId;
  38 +
  39 + @ExcelProperty("适用商品类型1-全部商品可用;2-指定商品可用;3-指定商品不可用")
  40 + private Boolean goodsType;
  41 +
  42 + @ExcelProperty("适用商品id")
  43 + private String goodsIds;
  44 +
  45 + @ExcelProperty("最小金额")
  46 + private BigDecimal atLeast;
  47 +
  48 + @ExcelProperty("面额")
  49 + private BigDecimal money;
  50 +
  51 + @ExcelProperty("1 =< 折扣 <= 9.9 当type为discount时需要添加")
  52 + private BigDecimal discount;
  53 +
  54 + @ExcelProperty("最多折扣金额 当type为discount时可选择性添加")
  55 + private BigDecimal discountLimit;
  56 +
  57 + @ExcelProperty("优惠叠加 0-不限制 1- 优惠券仅原价购买商品时可用")
  58 + private Boolean whetherForbidPreference;
  59 +
  60 + @ExcelProperty("是否开启过期提醒0-不开启 1-开启")
  61 + private Boolean whetherExpireNotice;
  62 +
  63 + @ExcelProperty("过期前N天提醒")
  64 + private Integer expireNoticeFixedTerm;
  65 +
  66 + @ExcelProperty("是否已提醒")
  67 + private Boolean whetherNoticed;
  68 +
  69 + @ExcelProperty("优惠券状态 1已领用(未使用) 2已使用 3已过期")
  70 + private Integer state;
  71 +
  72 + @ExcelProperty("获取方式1订单2.直接领取3.活动领取 4转赠 5分享获取")
  73 + private Boolean getType;
  74 +
  75 + @ExcelProperty("领取时间")
  76 + private Date fetchTime;
  77 +
  78 + @ExcelProperty("使用时间")
  79 + private Date useTime;
  80 +
  81 + @ExcelProperty("可使用的开始时间")
  82 + private Date startTime;
  83 +
  84 + @ExcelProperty("有效期结束时间")
  85 + private Date endTime;
  86 +
  87 + @ExcelProperty("创建时间")
  88 + private Date createTime;
  89 +
  90 +}
... ...
yudao-module-mall/yudao-module-coupon-biz/src/main/java/cn/iocoder/yudao/module/coupon/controller/admin/coupon/vo/CouponExportReqVO.java 0 → 100644
  1 +package cn.iocoder.yudao.module.coupon.controller.admin.coupon.vo;
  2 +
  3 +import lombok.*;
  4 +
  5 +import java.math.BigDecimal;
  6 +import java.util.*;
  7 +import io.swagger.annotations.*;
  8 +import cn.iocoder.yudao.framework.common.pojo.PageParam;
  9 +import org.springframework.format.annotation.DateTimeFormat;
  10 +
  11 +import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
  12 +
  13 +@ApiModel(value = "管理后台 - 优惠券 Excel 导出 Request VO", description = "参数和 CouponPageReqVO 是一致的")
  14 +@Data
  15 +public class CouponExportReqVO {
  16 +
  17 + @ApiModelProperty(value = "优惠券类型 reward-满减 discount-折扣 random-随机")
  18 + private String type;
  19 +
  20 + @ApiModelProperty(value = "优惠券名称")
  21 + private String name;
  22 +
  23 + @ApiModelProperty(value = "优惠券类型id")
  24 + private Long couponTypeId;
  25 +
  26 + @ApiModelProperty(value = "优惠券编码")
  27 + private String couponCode;
  28 +
  29 + @ApiModelProperty(value = "领用人")
  30 + private Long memberId;
  31 +
  32 + @ApiModelProperty(value = "优惠券使用订单id")
  33 + private Long useOrderId;
  34 +
  35 + @ApiModelProperty(value = "适用商品类型1-全部商品可用;2-指定商品可用;3-指定商品不可用")
  36 + private Boolean goodsType;
  37 +
  38 + @ApiModelProperty(value = "适用商品id")
  39 + private String goodsIds;
  40 +
  41 + @ApiModelProperty(value = "最小金额")
  42 + private BigDecimal atLeast;
  43 +
  44 + @ApiModelProperty(value = "面额")
  45 + private BigDecimal money;
  46 +
  47 + @ApiModelProperty(value = "1 =< 折扣 <= 9.9 当type为discount时需要添加")
  48 + private BigDecimal discount;
  49 +
  50 + @ApiModelProperty(value = "最多折扣金额 当type为discount时可选择性添加")
  51 + private BigDecimal discountLimit;
  52 +
  53 + @ApiModelProperty(value = "优惠叠加 0-不限制 1- 优惠券仅原价购买商品时可用")
  54 + private Boolean whetherForbidPreference;
  55 +
  56 + @ApiModelProperty(value = "是否开启过期提醒0-不开启 1-开启")
  57 + private Boolean whetherExpireNotice;
  58 +
  59 + @ApiModelProperty(value = "过期前N天提醒")
  60 + private Integer expireNoticeFixedTerm;
  61 +
  62 + @ApiModelProperty(value = "是否已提醒")
  63 + private Boolean whetherNoticed;
  64 +
  65 + @ApiModelProperty(value = "优惠券状态 1已领用(未使用) 2已使用 3已过期")
  66 + private Integer state;
  67 +
  68 + @ApiModelProperty(value = "获取方式1订单2.直接领取3.活动领取 4转赠 5分享获取")
  69 + private Boolean getType;
  70 +
  71 + @ApiModelProperty(value = "领取时间")
  72 + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
  73 + private Date[] fetchTime;
  74 +
  75 + @ApiModelProperty(value = "使用时间")
  76 + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
  77 + private Date[] useTime;
  78 +
  79 + @ApiModelProperty(value = "可使用的开始时间")
  80 + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
  81 + private Date[] startTime;
  82 +
  83 + @ApiModelProperty(value = "有效期结束时间")
  84 + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
  85 + private Date[] endTime;
  86 +
  87 + @ApiModelProperty(value = "创建时间")
  88 + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
  89 + private Date[] createTime;
  90 +
  91 +}
... ...
yudao-module-mall/yudao-module-coupon-biz/src/main/java/cn/iocoder/yudao/module/coupon/controller/admin/coupon/vo/CouponPageReqVO.java 0 → 100644
  1 +package cn.iocoder.yudao.module.coupon.controller.admin.coupon.vo;
  2 +
  3 +import lombok.*;
  4 +
  5 +import java.math.BigDecimal;
  6 +import java.util.*;
  7 +import io.swagger.annotations.*;
  8 +import cn.iocoder.yudao.framework.common.pojo.PageParam;
  9 +import org.springframework.format.annotation.DateTimeFormat;
  10 +
  11 +import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
  12 +
  13 +@ApiModel("管理后台 - 优惠券分页 Request VO")
  14 +@Data
  15 +@EqualsAndHashCode(callSuper = true)
  16 +@ToString(callSuper = true)
  17 +public class CouponPageReqVO extends PageParam {
  18 +
  19 + @ApiModelProperty(value = "优惠券类型 reward-满减 discount-折扣 random-随机")
  20 + private String type;
  21 +
  22 + @ApiModelProperty(value = "优惠券名称")
  23 + private String name;
  24 +
  25 + @ApiModelProperty(value = "优惠券类型id")
  26 + private Long couponTypeId;
  27 +
  28 + @ApiModelProperty(value = "优惠券编码")
  29 + private String couponCode;
  30 +
  31 + @ApiModelProperty(value = "领用人")
  32 + private Long memberId;
  33 +
  34 + @ApiModelProperty(value = "优惠券使用订单id")
  35 + private Long useOrderId;
  36 +
  37 + @ApiModelProperty(value = "适用商品类型1-全部商品可用;2-指定商品可用;3-指定商品不可用")
  38 + private Boolean goodsType;
  39 +
  40 + @ApiModelProperty(value = "适用商品id")
  41 + private String goodsIds;
  42 +
  43 + @ApiModelProperty(value = "最小金额")
  44 + private BigDecimal atLeast;
  45 +
  46 + @ApiModelProperty(value = "面额")
  47 + private BigDecimal money;
  48 +
  49 + @ApiModelProperty(value = "1 =< 折扣 <= 9.9 当type为discount时需要添加")
  50 + private BigDecimal discount;
  51 +
  52 + @ApiModelProperty(value = "最多折扣金额 当type为discount时可选择性添加")
  53 + private BigDecimal discountLimit;
  54 +
  55 + @ApiModelProperty(value = "优惠叠加 0-不限制 1- 优惠券仅原价购买商品时可用")
  56 + private Boolean whetherForbidPreference;
  57 +
  58 + @ApiModelProperty(value = "是否开启过期提醒0-不开启 1-开启")
  59 + private Boolean whetherExpireNotice;
  60 +
  61 + @ApiModelProperty(value = "过期前N天提醒")
  62 + private Integer expireNoticeFixedTerm;
  63 +
  64 + @ApiModelProperty(value = "是否已提醒")
  65 + private Boolean whetherNoticed;
  66 +
  67 + @ApiModelProperty(value = "优惠券状态 1已领用(未使用) 2已使用 3已过期")
  68 + private Integer state;
  69 +
  70 + @ApiModelProperty(value = "获取方式1订单2.直接领取3.活动领取 4转赠 5分享获取")
  71 + private Boolean getType;
  72 +
  73 + @ApiModelProperty(value = "领取时间")
  74 + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
  75 + private Date[] fetchTime;
  76 +
  77 + @ApiModelProperty(value = "使用时间")
  78 + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
  79 + private Date[] useTime;
  80 +
  81 + @ApiModelProperty(value = "可使用的开始时间")
  82 + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
  83 + private Date[] startTime;
  84 +
  85 + @ApiModelProperty(value = "有效期结束时间")
  86 + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
  87 + private Date[] endTime;
  88 +
  89 + @ApiModelProperty(value = "创建时间")
  90 + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
  91 + private Date[] createTime;
  92 +
  93 +}
... ...
yudao-module-mall/yudao-module-coupon-biz/src/main/java/cn/iocoder/yudao/module/coupon/controller/admin/coupon/vo/CouponRespVO.java 0 → 100644
  1 +package cn.iocoder.yudao.module.coupon.controller.admin.coupon.vo;
  2 +
  3 +import lombok.*;
  4 +import java.util.*;
  5 +import io.swagger.annotations.*;
  6 +
  7 +@ApiModel("管理后台 - 优惠券 Response VO")
  8 +@Data
  9 +@EqualsAndHashCode(callSuper = true)
  10 +@ToString(callSuper = true)
  11 +public class CouponRespVO extends CouponBaseVO {
  12 +
  13 + @ApiModelProperty(value = "用户ID", required = true)
  14 + private Long id;
  15 +
  16 + @ApiModelProperty(value = "创建时间", required = true)
  17 + private Date createTime;
  18 +
  19 +}
... ...
yudao-module-mall/yudao-module-coupon-biz/src/main/java/cn/iocoder/yudao/module/coupon/controller/admin/coupon/vo/CouponUpdateReqVO.java 0 → 100644
  1 +package cn.iocoder.yudao.module.coupon.controller.admin.coupon.vo;
  2 +
  3 +import lombok.*;
  4 +import java.util.*;
  5 +import io.swagger.annotations.*;
  6 +import javax.validation.constraints.*;
  7 +
  8 +@ApiModel("管理后台 - 优惠券更新 Request VO")
  9 +@Data
  10 +@EqualsAndHashCode(callSuper = true)
  11 +@ToString(callSuper = true)
  12 +public class CouponUpdateReqVO extends CouponBaseVO {
  13 +
  14 + @ApiModelProperty(value = "用户ID", required = true)
  15 + @NotNull(message = "用户ID不能为空")
  16 + private Long id;
  17 +
  18 +}
... ...
yudao-module-mall/yudao-module-coupon-biz/src/main/java/cn/iocoder/yudao/module/coupon/controller/admin/coupontemplete/CouponTempleteController.java 0 → 100644
  1 +package cn.iocoder.yudao.module.coupon.controller.admin.coupontemplete;
  2 +
  3 +import cn.iocoder.yudao.module.coupon.controller.admin.coupontemplete.vo.*;
  4 +import cn.iocoder.yudao.module.coupon.convert.CouponTemplete.CouponTempleteConvert;
  5 +import cn.iocoder.yudao.module.coupon.dal.dataobject.CouponTemplete.CouponTempleteDO;
  6 +import cn.iocoder.yudao.module.coupon.service.CouponTemplete.CouponTempleteService;
  7 +import org.springframework.web.bind.annotation.*;
  8 +import javax.annotation.Resource;
  9 +import org.springframework.validation.annotation.Validated;
  10 +import org.springframework.security.access.prepost.PreAuthorize;
  11 +import io.swagger.annotations.*;
  12 +
  13 +import javax.validation.*;
  14 +import javax.servlet.http.*;
  15 +import java.util.*;
  16 +import java.io.IOException;
  17 +
  18 +import cn.iocoder.yudao.framework.common.pojo.PageResult;
  19 +import cn.iocoder.yudao.framework.common.pojo.CommonResult;
  20 +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
  21 +
  22 +import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
  23 +
  24 +import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
  25 +import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.*;
  26 +
  27 +
  28 +
  29 +@Api(tags = "管理后台 - 优惠券模板")
  30 +@RestController
  31 +@RequestMapping("/CouponTemplete/")
  32 +@Validated
  33 +public class CouponTempleteController {
  34 +
  35 + @Resource
  36 + private CouponTempleteService Service;
  37 +
  38 + @PostMapping("/create")
  39 + @ApiOperation("创建优惠券模板")
  40 + @PreAuthorize("@ss.hasPermission('CouponTemplete::create')")
  41 + public CommonResult<Long> create(@Valid @RequestBody CouponTempleteCreateReqVO createReqVO) {
  42 + return success(Service.create(createReqVO));
  43 + }
  44 +
  45 + @PutMapping("/update")
  46 + @ApiOperation("更新优惠券模板")
  47 + @PreAuthorize("@ss.hasPermission('CouponTemplete::update')")
  48 + public CommonResult<Boolean> update(@Valid @RequestBody CouponTempleteUpdateReqVO updateReqVO) {
  49 + Service.update(updateReqVO);
  50 + return success(true);
  51 + }
  52 +
  53 + @DeleteMapping("/delete")
  54 + @ApiOperation("删除优惠券模板")
  55 + @ApiImplicitParam(name = "id", value = "编号", required = true, dataTypeClass = Long.class)
  56 + @PreAuthorize("@ss.hasPermission('CouponTemplete::delete')")
  57 + public CommonResult<Boolean> delete(@RequestParam("id") Long id) {
  58 + Service.delete(id);
  59 + return success(true);
  60 + }
  61 +
  62 + @GetMapping("/get")
  63 + @ApiOperation("获得优惠券模板")
  64 + @ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class)
  65 + @PreAuthorize("@ss.hasPermission('CouponTemplete::query')")
  66 + public CommonResult<CouponTempleteRespVO> get(@RequestParam("id") Long id) {
  67 + CouponTempleteDO couponTempleteDO = Service.get(id);
  68 + return success(CouponTempleteConvert.INSTANCE.convert(couponTempleteDO));
  69 + }
  70 +
  71 + @GetMapping("/list")
  72 + @ApiOperation("获得优惠券模板列表")
  73 + @ApiImplicitParam(name = "ids", value = "编号列表", required = true, example = "1024,2048", dataTypeClass = List.class)
  74 + @PreAuthorize("@ss.hasPermission('CouponTemplete::query')")
  75 + public CommonResult<List<CouponTempleteRespVO>> getList(@RequestParam("ids") Collection<Long> ids) {
  76 + List<CouponTempleteDO> list = Service.getList(ids);
  77 + return success(CouponTempleteConvert.INSTANCE.convertList(list));
  78 + }
  79 +
  80 + @GetMapping("/page")
  81 + @ApiOperation("获得优惠券模板分页")
  82 + @PreAuthorize("@ss.hasPermission('CouponTemplete::query')")
  83 + public CommonResult<PageResult<CouponTempleteRespVO>> getPage(@Valid CouponTempletePageReqVO pageVO) {
  84 + PageResult<CouponTempleteDO> pageResult = Service.getPage(pageVO);
  85 + return success(CouponTempleteConvert.INSTANCE.convertPage(pageResult));
  86 + }
  87 +
  88 + @GetMapping("/export-excel")
  89 + @ApiOperation("导出优惠券模板 Excel")
  90 + @PreAuthorize("@ss.hasPermission('CouponTemplete::export')")
  91 + @OperateLog(type = EXPORT)
  92 + public void exportExcel(@Valid CouponTempleteExportReqVO exportReqVO,
  93 + HttpServletResponse response) throws IOException {
  94 + List<CouponTempleteDO> list = Service.getList(exportReqVO);
  95 + // 导出 Excel
  96 + List<CouponTempleteExcelVO> datas = CouponTempleteConvert.INSTANCE.convertList02(list);
  97 + ExcelUtils.write(response, "优惠券模板.xls", "数据", CouponTempleteExcelVO.class, datas);
  98 + }
  99 +
  100 +}
... ...
yudao-module-mall/yudao-module-coupon-biz/src/main/java/cn/iocoder/yudao/module/coupon/controller/admin/coupontemplete/vo/CouponTempleteBaseVO.java 0 → 100644
  1 +package cn.iocoder.yudao.module.coupon.controller.admin.coupontemplete.vo;
  2 +
  3 +import lombok.*;
  4 +import java.util.*;
  5 +import java.math.BigDecimal;
  6 +import io.swagger.annotations.*;
  7 +import javax.validation.constraints.*;
  8 +import org.springframework.format.annotation.DateTimeFormat;
  9 +
  10 +import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
  11 +
  12 +/**
  13 +* 优惠券模板 Base VO,提供给添加、修改、详细的子 VO 使用
  14 +* 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成
  15 +*/
  16 +@Data
  17 +public class CouponTempleteBaseVO {
  18 +
  19 + @ApiModelProperty(value = "优惠券类型 reward-满减 discount-折扣 random-随机", required = true)
  20 + @NotNull(message = "优惠券类型 reward-满减 discount-折扣 random-随机不能为空")
  21 + private String type;
  22 +
  23 + @ApiModelProperty(value = "优惠券名称", required = true)
  24 + @NotNull(message = "优惠券名称不能为空")
  25 + private String name;
  26 +
  27 + @ApiModelProperty(value = "名称备注")
  28 + private String couponNameRemark;
  29 +
  30 + @ApiModelProperty(value = "优惠券图片")
  31 + private String image;
  32 +
  33 + @ApiModelProperty(value = "发放数量", required = true)
  34 + @NotNull(message = "发放数量不能为空")
  35 + private Integer count;
  36 +
  37 + @ApiModelProperty(value = "已领取数量", required = true)
  38 + @NotNull(message = "已领取数量不能为空")
  39 + private Integer leadCount;
  40 +
  41 + @ApiModelProperty(value = "已使用数量", required = true)
  42 + @NotNull(message = "已使用数量不能为空")
  43 + private Integer usedCount;
  44 +
  45 + @ApiModelProperty(value = "适用商品类型1-全部商品可用;2-指定商品可用;3-指定商品不可用", required = true)
  46 + @NotNull(message = "适用商品类型1-全部商品可用;2-指定商品可用;3-指定商品不可用不能为空")
  47 + private Boolean goodsType;
  48 +
  49 + @ApiModelProperty(value = "适用商品id")
  50 + private String productIds;
  51 +
  52 + @ApiModelProperty(value = "使用门槛0-无门槛 1-有门槛", required = true)
  53 + @NotNull(message = "使用门槛0-无门槛 1-有门槛不能为空")
  54 + private Boolean hasUseLimit;
  55 +
  56 + @ApiModelProperty(value = "满多少元使用 0代表无限制", required = true)
  57 + @NotNull(message = "满多少元使用 0代表无限制不能为空")
  58 + private BigDecimal atLeast;
  59 +
  60 + @ApiModelProperty(value = "发放面额 当type为reward时需要添加", required = true)
  61 + @NotNull(message = "发放面额 当type为reward时需要添加不能为空")
  62 + private BigDecimal money;
  63 +
  64 + @ApiModelProperty(value = "1 =< 折扣 <= 9.9 当type为discount时需要添加", required = true)
  65 + @NotNull(message = "1 =< 折扣 <= 9.9 当type为discount时需要添加不能为空")
  66 + private BigDecimal discount;
  67 +
  68 + @ApiModelProperty(value = "最多折扣金额 当type为discount时可选择性添加", required = true)
  69 + @NotNull(message = "最多折扣金额 当type为discount时可选择性添加不能为空")
  70 + private BigDecimal discountLimit;
  71 +
  72 + @ApiModelProperty(value = "最低金额 当type为radom时需要添加", required = true)
  73 + @NotNull(message = "最低金额 当type为radom时需要添加不能为空")
  74 + private BigDecimal minMoney;
  75 +
  76 + @ApiModelProperty(value = "最大金额 当type为radom时需要添加", required = true)
  77 + @NotNull(message = "最大金额 当type为radom时需要添加不能为空")
  78 + private BigDecimal maxMoney;
  79 +
  80 + @ApiModelProperty(value = "过期类型1-时间范围过期 2-领取之日固定日期后过期 3-领取次日固定日期后过期", required = true)
  81 + @NotNull(message = "过期类型1-时间范围过期 2-领取之日固定日期后过期 3-领取次日固定日期后过期不能为空")
  82 + private Boolean validityType;
  83 +
  84 + @ApiModelProperty(value = "使用开始日期 过期类型1时必填")
  85 + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
  86 + private Date startUseTime;
  87 +
  88 + @ApiModelProperty(value = "使用结束日期 过期类型1时必填")
  89 + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
  90 + private Date endUseTime;
  91 +
  92 + @ApiModelProperty(value = "当validity_type为2或者3时需要添加 领取之日起或者次日N天内有效", required = true)
  93 + @NotNull(message = "当validity_type为2或者3时需要添加 领取之日起或者次日N天内有效不能为空")
  94 + private Integer fixedTerm;
  95 +
  96 + @ApiModelProperty(value = "是否无限制0-否 1是", required = true)
  97 + @NotNull(message = "是否无限制0-否 1是不能为空")
  98 + private Boolean whetherLimitless;
  99 +
  100 + @ApiModelProperty(value = "每人最大领取个数", required = true)
  101 + @NotNull(message = "每人最大领取个数不能为空")
  102 + private Integer maxFetch;
  103 +
  104 + @ApiModelProperty(value = "是否开启过期提醒0-不开启 1-开启", required = true)
  105 + @NotNull(message = "是否开启过期提醒0-不开启 1-开启不能为空")
  106 + private Boolean whetherExpireNotice;
  107 +
  108 + @ApiModelProperty(value = "过期前N天提醒", required = true)
  109 + @NotNull(message = "过期前N天提醒不能为空")
  110 + private Integer expireNoticeFixedTerm;
  111 +
  112 + @ApiModelProperty(value = "优惠叠加 0-不限制 1- 优惠券仅原价购买商品时可用", required = true)
  113 + @NotNull(message = "优惠叠加 0-不限制 1- 优惠券仅原价购买商品时可用不能为空")
  114 + private Boolean whetherForbidPreference;
  115 +
  116 + @ApiModelProperty(value = "是否显示", required = true)
  117 + @NotNull(message = "是否显示不能为空")
  118 + private Integer whetherShow;
  119 +
  120 + @ApiModelProperty(value = "订单的优惠总金额", required = true)
  121 + @NotNull(message = "订单的优惠总金额不能为空")
  122 + private BigDecimal discountOrderMoney;
  123 +
  124 + @ApiModelProperty(value = "用券总成交额", required = true)
  125 + @NotNull(message = "用券总成交额不能为空")
  126 + private BigDecimal orderMoney;
  127 +
  128 + @ApiModelProperty(value = "是否禁止发放0-否 1-是", required = true)
  129 + @NotNull(message = "是否禁止发放0-否 1-是不能为空")
  130 + private Boolean whetherForbidden;
  131 +
  132 + @ApiModelProperty(value = "使用优惠券购买的商品数量", required = true)
  133 + @NotNull(message = "使用优惠券购买的商品数量不能为空")
  134 + private Integer orderGoodsNum;
  135 +
  136 + @ApiModelProperty(value = "状态(1进行中2已结束-1已关闭)", required = true)
  137 + @NotNull(message = "状态(1进行中2已结束-1已关闭)不能为空")
  138 + private Integer status;
  139 +
  140 + @ApiModelProperty(value = "有效日期结束时间")
  141 + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
  142 + private Date endTime;
  143 +
  144 +}
... ...
yudao-module-mall/yudao-module-coupon-biz/src/main/java/cn/iocoder/yudao/module/coupon/controller/admin/coupontemplete/vo/CouponTempleteCreateReqVO.java 0 → 100644
  1 +package cn.iocoder.yudao.module.coupon.controller.admin.coupontemplete.vo;
  2 +
  3 +import lombok.*;
  4 +import io.swagger.annotations.*;
  5 +
  6 +@ApiModel("管理后台 - 优惠券模板创建 Request VO")
  7 +@Data
  8 +@EqualsAndHashCode(callSuper = true)
  9 +@ToString(callSuper = true)
  10 +public class CouponTempleteCreateReqVO extends CouponTempleteBaseVO {
  11 +
  12 +}
... ...
yudao-module-mall/yudao-module-coupon-biz/src/main/java/cn/iocoder/yudao/module/coupon/controller/admin/coupontemplete/vo/CouponTempleteExcelVO.java 0 → 100644
  1 +package cn.iocoder.yudao.module.coupon.controller.admin.coupontemplete.vo;
  2 +
  3 +import lombok.*;
  4 +import java.util.*;
  5 +import java.math.BigDecimal;
  6 +
  7 +import com.alibaba.excel.annotation.ExcelProperty;
  8 +
  9 +/**
  10 + * 优惠券模板 Excel VO
  11 + *
  12 + * @author wxr
  13 + */
  14 +@Data
  15 +public class CouponTempleteExcelVO {
  16 +
  17 + @ExcelProperty("用户ID")
  18 + private Long id;
  19 +
  20 + @ExcelProperty("优惠券类型 reward-满减 discount-折扣 random-随机")
  21 + private String type;
  22 +
  23 + @ExcelProperty("优惠券名称")
  24 + private String name;
  25 +
  26 + @ExcelProperty("名称备注")
  27 + private String couponNameRemark;
  28 +
  29 + @ExcelProperty("优惠券图片")
  30 + private String image;
  31 +
  32 + @ExcelProperty("发放数量")
  33 + private Integer count;
  34 +
  35 + @ExcelProperty("已领取数量")
  36 + private Integer leadCount;
  37 +
  38 + @ExcelProperty("已使用数量")
  39 + private Integer usedCount;
  40 +
  41 + @ExcelProperty("适用商品类型1-全部商品可用;2-指定商品可用;3-指定商品不可用")
  42 + private Boolean goodsType;
  43 +
  44 + @ExcelProperty("适用商品id")
  45 + private String productIds;
  46 +
  47 + @ExcelProperty("使用门槛0-无门槛 1-有门槛")
  48 + private Boolean hasUseLimit;
  49 +
  50 + @ExcelProperty("满多少元使用 0代表无限制")
  51 + private BigDecimal atLeast;
  52 +
  53 + @ExcelProperty("发放面额 当type为reward时需要添加")
  54 + private BigDecimal money;
  55 +
  56 + @ExcelProperty("1 =< 折扣 <= 9.9 当type为discount时需要添加")
  57 + private BigDecimal discount;
  58 +
  59 + @ExcelProperty("最多折扣金额 当type为discount时可选择性添加")
  60 + private BigDecimal discountLimit;
  61 +
  62 + @ExcelProperty("最低金额 当type为radom时需要添加")
  63 + private BigDecimal minMoney;
  64 +
  65 + @ExcelProperty("最大金额 当type为radom时需要添加")
  66 + private BigDecimal maxMoney;
  67 +
  68 + @ExcelProperty("过期类型1-时间范围过期 2-领取之日固定日期后过期 3-领取次日固定日期后过期")
  69 + private Boolean validityType;
  70 +
  71 + @ExcelProperty("使用开始日期 过期类型1时必填")
  72 + private Date startUseTime;
  73 +
  74 + @ExcelProperty("使用结束日期 过期类型1时必填")
  75 + private Date endUseTime;
  76 +
  77 + @ExcelProperty("当validity_type为2或者3时需要添加 领取之日起或者次日N天内有效")
  78 + private Integer fixedTerm;
  79 +
  80 + @ExcelProperty("是否无限制0-否 1是")
  81 + private Boolean whetherLimitless;
  82 +
  83 + @ExcelProperty("每人最大领取个数")
  84 + private Integer maxFetch;
  85 +
  86 + @ExcelProperty("是否开启过期提醒0-不开启 1-开启")
  87 + private Boolean whetherExpireNotice;
  88 +
  89 + @ExcelProperty("过期前N天提醒")
  90 + private Integer expireNoticeFixedTerm;
  91 +
  92 + @ExcelProperty("优惠叠加 0-不限制 1- 优惠券仅原价购买商品时可用")
  93 + private Boolean whetherForbidPreference;
  94 +
  95 + @ExcelProperty("是否显示")
  96 + private Integer whetherShow;
  97 +
  98 + @ExcelProperty("订单的优惠总金额")
  99 + private BigDecimal discountOrderMoney;
  100 +
  101 + @ExcelProperty("用券总成交额")
  102 + private BigDecimal orderMoney;
  103 +
  104 + @ExcelProperty("是否禁止发放0-否 1-是")
  105 + private Boolean whetherForbidden;
  106 +
  107 + @ExcelProperty("使用优惠券购买的商品数量")
  108 + private Integer orderGoodsNum;
  109 +
  110 + @ExcelProperty("状态(1进行中2已结束-1已关闭)")
  111 + private Integer status;
  112 +
  113 + @ExcelProperty("有效日期结束时间")
  114 + private Date endTime;
  115 +
  116 + @ExcelProperty("创建时间")
  117 + private Date createTime;
  118 +
  119 +}
... ...
yudao-module-mall/yudao-module-coupon-biz/src/main/java/cn/iocoder/yudao/module/coupon/controller/admin/coupontemplete/vo/CouponTempleteExportReqVO.java 0 → 100644
  1 +package cn.iocoder.yudao.module.coupon.controller.admin.coupontemplete.vo;
  2 +
  3 +import lombok.*;
  4 +
  5 +import java.math.BigDecimal;
  6 +import java.util.*;
  7 +import io.swagger.annotations.*;
  8 +import org.springframework.format.annotation.DateTimeFormat;
  9 +
  10 +import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
  11 +
  12 +@ApiModel(value = "管理后台 - 优惠券模板 Excel 导出 Request VO", description = "参数和 CouponTempletePageReqVO 是一致的")
  13 +@Data
  14 +public class CouponTempleteExportReqVO {
  15 +
  16 + @ApiModelProperty(value = "优惠券类型 reward-满减 discount-折扣 random-随机")
  17 + private String type;
  18 +
  19 + @ApiModelProperty(value = "优惠券名称")
  20 + private String name;
  21 +
  22 + @ApiModelProperty(value = "名称备注")
  23 + private String couponNameRemark;
  24 +
  25 + @ApiModelProperty(value = "优惠券图片")
  26 + private String image;
  27 +
  28 + @ApiModelProperty(value = "发放数量")
  29 + private Integer count;
  30 +
  31 + @ApiModelProperty(value = "已领取数量")
  32 + private Integer leadCount;
  33 +
  34 + @ApiModelProperty(value = "已使用数量")
  35 + private Integer usedCount;
  36 +
  37 + @ApiModelProperty(value = "适用商品类型1-全部商品可用;2-指定商品可用;3-指定商品不可用")
  38 + private Boolean goodsType;
  39 +
  40 + @ApiModelProperty(value = "适用商品id")
  41 + private String productIds;
  42 +
  43 + @ApiModelProperty(value = "使用门槛0-无门槛 1-有门槛")
  44 + private Boolean hasUseLimit;
  45 +
  46 + @ApiModelProperty(value = "满多少元使用 0代表无限制")
  47 + private BigDecimal atLeast;
  48 +
  49 + @ApiModelProperty(value = "发放面额 当type为reward时需要添加")
  50 + private BigDecimal money;
  51 +
  52 + @ApiModelProperty(value = "1 =< 折扣 <= 9.9 当type为discount时需要添加")
  53 + private BigDecimal discount;
  54 +
  55 + @ApiModelProperty(value = "最多折扣金额 当type为discount时可选择性添加")
  56 + private BigDecimal discountLimit;
  57 +
  58 + @ApiModelProperty(value = "最低金额 当type为radom时需要添加")
  59 + private BigDecimal minMoney;
  60 +
  61 + @ApiModelProperty(value = "最大金额 当type为radom时需要添加")
  62 + private BigDecimal maxMoney;
  63 +
  64 + @ApiModelProperty(value = "过期类型1-时间范围过期 2-领取之日固定日期后过期 3-领取次日固定日期后过期")
  65 + private Boolean validityType;
  66 +
  67 + @ApiModelProperty(value = "使用开始日期 过期类型1时必填")
  68 + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
  69 + private Date[] startUseTime;
  70 +
  71 + @ApiModelProperty(value = "使用结束日期 过期类型1时必填")
  72 + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
  73 + private Date[] endUseTime;
  74 +
  75 + @ApiModelProperty(value = "当validity_type为2或者3时需要添加 领取之日起或者次日N天内有效")
  76 + private Integer fixedTerm;
  77 +
  78 + @ApiModelProperty(value = "是否无限制0-否 1是")
  79 + private Boolean whetherLimitless;
  80 +
  81 + @ApiModelProperty(value = "每人最大领取个数")
  82 + private Integer maxFetch;
  83 +
  84 + @ApiModelProperty(value = "是否开启过期提醒0-不开启 1-开启")
  85 + private Boolean whetherExpireNotice;
  86 +
  87 + @ApiModelProperty(value = "过期前N天提醒")
  88 + private Integer expireNoticeFixedTerm;
  89 +
  90 + @ApiModelProperty(value = "优惠叠加 0-不限制 1- 优惠券仅原价购买商品时可用")
  91 + private Boolean whetherForbidPreference;
  92 +
  93 + @ApiModelProperty(value = "是否显示")
  94 + private Integer whetherShow;
  95 +
  96 + @ApiModelProperty(value = "订单的优惠总金额")
  97 + private BigDecimal discountOrderMoney;
  98 +
  99 + @ApiModelProperty(value = "用券总成交额")
  100 + private BigDecimal orderMoney;
  101 +
  102 + @ApiModelProperty(value = "是否禁止发放0-否 1-是")
  103 + private Boolean whetherForbidden;
  104 +
  105 + @ApiModelProperty(value = "使用优惠券购买的商品数量")
  106 + private Integer orderGoodsNum;
  107 +
  108 + @ApiModelProperty(value = "状态(1进行中2已结束-1已关闭)")
  109 + private Integer status;
  110 +
  111 + @ApiModelProperty(value = "有效日期结束时间")
  112 + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
  113 + private Date[] endTime;
  114 +
  115 + @ApiModelProperty(value = "创建时间")
  116 + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
  117 + private Date[] createTime;
  118 +
  119 +}
... ...
yudao-module-mall/yudao-module-coupon-biz/src/main/java/cn/iocoder/yudao/module/coupon/controller/admin/coupontemplete/vo/CouponTempletePageReqVO.java 0 → 100644
  1 +package cn.iocoder.yudao.module.coupon.controller.admin.coupontemplete.vo;
  2 +
  3 +import lombok.*;
  4 +
  5 +import java.math.BigDecimal;
  6 +import java.util.*;
  7 +import io.swagger.annotations.*;
  8 +import cn.iocoder.yudao.framework.common.pojo.PageParam;
  9 +import org.springframework.format.annotation.DateTimeFormat;
  10 +
  11 +import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
  12 +
  13 +@ApiModel("管理后台 - 优惠券模板分页 Request VO")
  14 +@Data
  15 +@EqualsAndHashCode(callSuper = true)
  16 +@ToString(callSuper = true)
  17 +public class CouponTempletePageReqVO extends PageParam {
  18 +
  19 + @ApiModelProperty(value = "优惠券类型 reward-满减 discount-折扣 random-随机")
  20 + private String type;
  21 +
  22 + @ApiModelProperty(value = "优惠券名称")
  23 + private String name;
  24 +
  25 + @ApiModelProperty(value = "名称备注")
  26 + private String couponNameRemark;
  27 +
  28 + @ApiModelProperty(value = "优惠券图片")
  29 + private String image;
  30 +
  31 + @ApiModelProperty(value = "发放数量")
  32 + private Integer count;
  33 +
  34 + @ApiModelProperty(value = "已领取数量")
  35 + private Integer leadCount;
  36 +
  37 + @ApiModelProperty(value = "已使用数量")
  38 + private Integer usedCount;
  39 +
  40 + @ApiModelProperty(value = "适用商品类型1-全部商品可用;2-指定商品可用;3-指定商品不可用")
  41 + private Boolean goodsType;
  42 +
  43 + @ApiModelProperty(value = "适用商品id")
  44 + private String productIds;
  45 +
  46 + @ApiModelProperty(value = "使用门槛0-无门槛 1-有门槛")
  47 + private Boolean hasUseLimit;
  48 +
  49 + @ApiModelProperty(value = "满多少元使用 0代表无限制")
  50 + private BigDecimal atLeast;
  51 +
  52 + @ApiModelProperty(value = "发放面额 当type为reward时需要添加")
  53 + private BigDecimal money;
  54 +
  55 + @ApiModelProperty(value = "1 =< 折扣 <= 9.9 当type为discount时需要添加")
  56 + private BigDecimal discount;
  57 +
  58 + @ApiModelProperty(value = "最多折扣金额 当type为discount时可选择性添加")
  59 + private BigDecimal discountLimit;
  60 +
  61 + @ApiModelProperty(value = "最低金额 当type为radom时需要添加")
  62 + private BigDecimal minMoney;
  63 +
  64 + @ApiModelProperty(value = "最大金额 当type为radom时需要添加")
  65 + private BigDecimal maxMoney;
  66 +
  67 + @ApiModelProperty(value = "过期类型1-时间范围过期 2-领取之日固定日期后过期 3-领取次日固定日期后过期")
  68 + private Boolean validityType;
  69 +
  70 + @ApiModelProperty(value = "使用开始日期 过期类型1时必填")
  71 + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
  72 + private Date[] startUseTime;
  73 +
  74 + @ApiModelProperty(value = "使用结束日期 过期类型1时必填")
  75 + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
  76 + private Date[] endUseTime;
  77 +
  78 + @ApiModelProperty(value = "当validity_type为2或者3时需要添加 领取之日起或者次日N天内有效")
  79 + private Integer fixedTerm;
  80 +
  81 + @ApiModelProperty(value = "是否无限制0-否 1是")
  82 + private Boolean whetherLimitless;
  83 +
  84 + @ApiModelProperty(value = "每人最大领取个数")
  85 + private Integer maxFetch;
  86 +
  87 + @ApiModelProperty(value = "是否开启过期提醒0-不开启 1-开启")
  88 + private Boolean whetherExpireNotice;
  89 +
  90 + @ApiModelProperty(value = "过期前N天提醒")
  91 + private Integer expireNoticeFixedTerm;
  92 +
  93 + @ApiModelProperty(value = "优惠叠加 0-不限制 1- 优惠券仅原价购买商品时可用")
  94 + private Boolean whetherForbidPreference;
  95 +
  96 + @ApiModelProperty(value = "是否显示")
  97 + private Integer whetherShow;
  98 +
  99 + @ApiModelProperty(value = "订单的优惠总金额")
  100 + private BigDecimal discountOrderMoney;
  101 +
  102 + @ApiModelProperty(value = "用券总成交额")
  103 + private BigDecimal orderMoney;
  104 +
  105 + @ApiModelProperty(value = "是否禁止发放0-否 1-是")
  106 + private Boolean whetherForbidden;
  107 +
  108 + @ApiModelProperty(value = "使用优惠券购买的商品数量")
  109 + private Integer orderGoodsNum;
  110 +
  111 + @ApiModelProperty(value = "状态(1进行中2已结束-1已关闭)")
  112 + private Integer status;
  113 +
  114 + @ApiModelProperty(value = "有效日期结束时间")
  115 + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
  116 + private Date[] endTime;
  117 +
  118 + @ApiModelProperty(value = "创建时间")
  119 + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
  120 + private Date[] createTime;
  121 +
  122 +}
... ...
yudao-module-mall/yudao-module-coupon-biz/src/main/java/cn/iocoder/yudao/module/coupon/controller/admin/coupontemplete/vo/CouponTempleteRespVO.java 0 → 100644
  1 +package cn.iocoder.yudao.module.coupon.controller.admin.coupontemplete.vo;
  2 +
  3 +import lombok.*;
  4 +import java.util.*;
  5 +import io.swagger.annotations.*;
  6 +
  7 +@ApiModel("管理后台 - 优惠券模板 Response VO")
  8 +@Data
  9 +@EqualsAndHashCode(callSuper = true)
  10 +@ToString(callSuper = true)
  11 +public class CouponTempleteRespVO extends CouponTempleteBaseVO {
  12 +
  13 + @ApiModelProperty(value = "用户ID", required = true)
  14 + private Long id;
  15 +
  16 + @ApiModelProperty(value = "创建时间", required = true)
  17 + private Date createTime;
  18 +
  19 +}
... ...
yudao-module-mall/yudao-module-coupon-biz/src/main/java/cn/iocoder/yudao/module/coupon/controller/admin/coupontemplete/vo/CouponTempleteUpdateReqVO.java 0 → 100644
  1 +package cn.iocoder.yudao.module.coupon.controller.admin.coupontemplete.vo;
  2 +
  3 +import lombok.*;
  4 +import io.swagger.annotations.*;
  5 +import javax.validation.constraints.*;
  6 +
  7 +@ApiModel("管理后台 - 优惠券模板更新 Request VO")
  8 +@Data
  9 +@EqualsAndHashCode(callSuper = true)
  10 +@ToString(callSuper = true)
  11 +public class CouponTempleteUpdateReqVO extends CouponTempleteBaseVO {
  12 +
  13 + @ApiModelProperty(value = "用户ID", required = true)
  14 + @NotNull(message = "用户ID不能为空")
  15 + private Long id;
  16 +
  17 +}
... ...
yudao-module-mall/yudao-module-coupon-biz/src/main/java/cn/iocoder/yudao/module/coupon/convert/CouponTemplete/CouponTempleteConvert.java 0 → 100644
  1 +package cn.iocoder.yudao.module.coupon.convert.CouponTemplete;
  2 +
  3 +import java.util.*;
  4 +
  5 +import cn.iocoder.yudao.framework.common.pojo.PageResult;
  6 +
  7 +import cn.iocoder.yudao.module.coupon.controller.admin.coupontemplete.vo.CouponTempleteCreateReqVO;
  8 +import cn.iocoder.yudao.module.coupon.controller.admin.coupontemplete.vo.CouponTempleteExcelVO;
  9 +import cn.iocoder.yudao.module.coupon.controller.admin.coupontemplete.vo.CouponTempleteRespVO;
  10 +import cn.iocoder.yudao.module.coupon.controller.admin.coupontemplete.vo.CouponTempleteUpdateReqVO;
  11 +import cn.iocoder.yudao.module.coupon.dal.dataobject.CouponTemplete.CouponTempleteDO;
  12 +import org.mapstruct.Mapper;
  13 +import org.mapstruct.factory.Mappers;
  14 +
  15 +
  16 +/**
  17 + * 优惠券模板 Convert
  18 + *
  19 + * @author wxr
  20 + */
  21 +@Mapper
  22 +public interface CouponTempleteConvert {
  23 +
  24 + CouponTempleteConvert INSTANCE = Mappers.getMapper(CouponTempleteConvert.class);
  25 +
  26 + CouponTempleteDO convert(CouponTempleteCreateReqVO bean);
  27 +
  28 + CouponTempleteDO convert(CouponTempleteUpdateReqVO bean);
  29 +
  30 + CouponTempleteRespVO convert(CouponTempleteDO bean);
  31 +
  32 + List<CouponTempleteRespVO> convertList(List<CouponTempleteDO> list);
  33 +
  34 + PageResult<CouponTempleteRespVO> convertPage(PageResult<CouponTempleteDO> page);
  35 +
  36 + List<CouponTempleteExcelVO> convertList02(List<CouponTempleteDO> list);
  37 +
  38 +}
... ...
yudao-module-mall/yudao-module-coupon-biz/src/main/java/cn/iocoder/yudao/module/coupon/convert/coupon/CouponConvert.java 0 → 100644
  1 +package cn.iocoder.yudao.module.coupon.convert.coupon;
  2 +
  3 +import java.util.*;
  4 +
  5 +import cn.iocoder.yudao.framework.common.pojo.PageResult;
  6 +
  7 +import org.mapstruct.Mapper;
  8 +import org.mapstruct.factory.Mappers;
  9 +import cn.iocoder.yudao.module.coupon.controller.admin.coupon.vo.*;
  10 +import cn.iocoder.yudao.module.coupon.dal.dataobject.coupon.CouponDO;
  11 +
  12 +/**
  13 + * 优惠券 Convert
  14 + *
  15 + * @author wxr
  16 + */
  17 +@Mapper
  18 +public interface CouponConvert {
  19 +
  20 + CouponConvert INSTANCE = Mappers.getMapper(CouponConvert.class);
  21 +
  22 + CouponDO convert(CouponCreateReqVO bean);
  23 +
  24 + CouponDO convert(CouponUpdateReqVO bean);
  25 +
  26 + CouponRespVO convert(CouponDO bean);
  27 +
  28 + List<CouponRespVO> convertList(List<CouponDO> list);
  29 +
  30 + PageResult<CouponRespVO> convertPage(PageResult<CouponDO> page);
  31 +
  32 + List<CouponExcelVO> convertList02(List<CouponDO> list);
  33 +
  34 +}
... ...
yudao-module-mall/yudao-module-coupon-biz/src/main/java/cn/iocoder/yudao/module/coupon/dal/dataobject/CouponTemplete/CouponTempleteDO.java 0 → 100644
  1 +package cn.iocoder.yudao.module.coupon.dal.dataobject.CouponTemplete;
  2 +
  3 +import lombok.*;
  4 +import java.util.*;
  5 +import java.math.BigDecimal;
  6 +import com.baomidou.mybatisplus.annotation.*;
  7 +import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
  8 +
  9 +/**
  10 + * 优惠券模板 DO
  11 + *
  12 + * @author wxr
  13 + */
  14 +@TableName("coupon_templete")
  15 +@KeySequence("coupon_templete_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
  16 +@Data
  17 +@EqualsAndHashCode(callSuper = true)
  18 +@ToString(callSuper = true)
  19 +@Builder
  20 +@NoArgsConstructor
  21 +@AllArgsConstructor
  22 +public class CouponTempleteDO extends BaseDO {
  23 +
  24 + /**
  25 + * 用户ID
  26 + */
  27 + @TableId
  28 + private Long id;
  29 + /**
  30 + * 优惠券类型 reward-满减 discount-折扣 random-随机
  31 + */
  32 + private String type;
  33 + /**
  34 + * 优惠券名称
  35 + */
  36 + private String name;
  37 + /**
  38 + * 名称备注
  39 + */
  40 + private String couponNameRemark;
  41 + /**
  42 + * 优惠券图片
  43 + */
  44 + private String image;
  45 + /**
  46 + * 发放数量
  47 + */
  48 + private Integer count;
  49 + /**
  50 + * 已领取数量
  51 + */
  52 + private Integer leadCount;
  53 + /**
  54 + * 已使用数量
  55 + */
  56 + private Integer usedCount;
  57 + /**
  58 + * 适用商品类型1-全部商品可用;2-指定商品可用;3-指定商品不可用
  59 + */
  60 + private Boolean goodsType;
  61 + /**
  62 + * 适用商品id
  63 + */
  64 + private String productIds;
  65 + /**
  66 + * 使用门槛0-无门槛 1-有门槛
  67 + */
  68 + private Boolean hasUseLimit;
  69 + /**
  70 + * 满多少元使用 0代表无限制
  71 + */
  72 + private BigDecimal atLeast;
  73 + /**
  74 + * 发放面额 当type为reward时需要添加
  75 + */
  76 + private BigDecimal money;
  77 + /**
  78 + * 1 =< 折扣 <= 9.9 当type为discount时需要添加
  79 + */
  80 + private BigDecimal discount;
  81 + /**
  82 + * 最多折扣金额 当type为discount时可选择性添加
  83 + */
  84 + private BigDecimal discountLimit;
  85 + /**
  86 + * 最低金额 当type为radom时需要添加
  87 + */
  88 + private BigDecimal minMoney;
  89 + /**
  90 + * 最大金额 当type为radom时需要添加
  91 + */
  92 + private BigDecimal maxMoney;
  93 + /**
  94 + * 过期类型1-时间范围过期 2-领取之日固定日期后过期 3-领取次日固定日期后过期
  95 + */
  96 + private Boolean validityType;
  97 + /**
  98 + * 使用开始日期 过期类型1时必填
  99 + */
  100 + private Date startUseTime;
  101 + /**
  102 + * 使用结束日期 过期类型1时必填
  103 + */
  104 + private Date endUseTime;
  105 + /**
  106 + * 当validity_type为2或者3时需要添加 领取之日起或者次日N天内有效
  107 + */
  108 + private Integer fixedTerm;
  109 + /**
  110 + * 是否无限制0-否 1是
  111 + */
  112 + private Boolean whetherLimitless;
  113 + /**
  114 + * 每人最大领取个数
  115 + */
  116 + private Integer maxFetch;
  117 + /**
  118 + * 是否开启过期提醒0-不开启 1-开启
  119 + */
  120 + private Boolean whetherExpireNotice;
  121 + /**
  122 + * 过期前N天提醒
  123 + */
  124 + private Integer expireNoticeFixedTerm;
  125 + /**
  126 + * 优惠叠加 0-不限制 1- 优惠券仅原价购买商品时可用
  127 + */
  128 + private Boolean whetherForbidPreference;
  129 + /**
  130 + * 是否显示
  131 + */
  132 + private Integer whetherShow;
  133 + /**
  134 + * 订单的优惠总金额
  135 + */
  136 + private BigDecimal discountOrderMoney;
  137 + /**
  138 + * 用券总成交额
  139 + */
  140 + private BigDecimal orderMoney;
  141 + /**
  142 + * 是否禁止发放0-否 1-是
  143 + */
  144 + private Boolean whetherForbidden;
  145 + /**
  146 + * 使用优惠券购买的商品数量
  147 + */
  148 + private Integer orderGoodsNum;
  149 + /**
  150 + * 状态(1进行中2已结束-1已关闭)
  151 + */
  152 + private Integer status;
  153 + /**
  154 + * 有效日期结束时间
  155 + */
  156 + private Date endTime;
  157 +
  158 +}
... ...
yudao-module-mall/yudao-module-coupon-biz/src/main/java/cn/iocoder/yudao/module/coupon/dal/dataobject/coupon/CouponDO.java 0 → 100644
  1 +package cn.iocoder.yudao.module.coupon.dal.dataobject.coupon;
  2 +
  3 +import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
  4 +import lombok.*;
  5 +import java.util.*;
  6 +import java.math.BigDecimal;
  7 +import com.baomidou.mybatisplus.annotation.*;
  8 +
  9 +/**
  10 + * 优惠券 DO
  11 + *
  12 + * @author wxr
  13 + */
  14 +@TableName("coupon")
  15 +@KeySequence("coupon_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
  16 +@Data
  17 +@EqualsAndHashCode(callSuper = true)
  18 +@ToString(callSuper = true)
  19 +@Builder
  20 +@NoArgsConstructor
  21 +@AllArgsConstructor
  22 +public class CouponDO extends BaseDO {
  23 +
  24 + /**
  25 + * 用户ID
  26 + */
  27 + @TableId
  28 + private Long id;
  29 + /**
  30 + * 优惠券类型 reward-满减 discount-折扣 random-随机
  31 + */
  32 + private String type;
  33 + /**
  34 + * 优惠券名称
  35 + */
  36 + private String name;
  37 + /**
  38 + * 优惠券类型id
  39 + */
  40 + private Long couponTypeId;
  41 + /**
  42 + * 优惠券编码
  43 + */
  44 + private String couponCode;
  45 + /**
  46 + * 领用人
  47 + */
  48 + private Long memberId;
  49 + /**
  50 + * 优惠券使用订单id
  51 + */
  52 + private Long useOrderId;
  53 + /**
  54 + * 适用商品类型1-全部商品可用;2-指定商品可用;3-指定商品不可用
  55 + */
  56 + private Boolean goodsType;
  57 + /**
  58 + * 适用商品id
  59 + */
  60 + private String goodsIds;
  61 + /**
  62 + * 最小金额
  63 + */
  64 + private BigDecimal atLeast;
  65 + /**
  66 + * 面额
  67 + */
  68 + private BigDecimal money;
  69 + /**
  70 + * 1 =< 折扣 <= 9.9 当type为discount时需要添加
  71 + */
  72 + private BigDecimal discount;
  73 + /**
  74 + * 最多折扣金额 当type为discount时可选择性添加
  75 + */
  76 + private BigDecimal discountLimit;
  77 + /**
  78 + * 优惠叠加 0-不限制 1- 优惠券仅原价购买商品时可用
  79 + */
  80 + private Boolean whetherForbidPreference;
  81 + /**
  82 + * 是否开启过期提醒0-不开启 1-开启
  83 + */
  84 + private Boolean whetherExpireNotice;
  85 + /**
  86 + * 过期前N天提醒
  87 + */
  88 + private Integer expireNoticeFixedTerm;
  89 + /**
  90 + * 是否已提醒
  91 + */
  92 + private Boolean whetherNoticed;
  93 + /**
  94 + * 优惠券状态 1已领用(未使用) 2已使用 3已过期
  95 + */
  96 + private Integer state;
  97 + /**
  98 + * 获取方式1订单2.直接领取3.活动领取 4转赠 5分享获取
  99 + */
  100 + private Boolean getType;
  101 + /**
  102 + * 领取时间
  103 + */
  104 + private Date fetchTime;
  105 + /**
  106 + * 使用时间
  107 + */
  108 + private Date useTime;
  109 + /**
  110 + * 可使用的开始时间
  111 + */
  112 + private Date startTime;
  113 + /**
  114 + * 有效期结束时间
  115 + */
  116 + private Date endTime;
  117 +
  118 +}
... ...
yudao-module-mall/yudao-module-coupon-biz/src/main/java/cn/iocoder/yudao/module/coupon/dal/mysql/CouponTemplete/CouponTempleteMapper.java 0 → 100644
  1 +package cn.iocoder.yudao.module.coupon.dal.mysql.CouponTemplete;
  2 +
  3 +import java.util.*;
  4 +
  5 +import cn.iocoder.yudao.framework.common.pojo.PageResult;
  6 +import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
  7 +import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
  8 +import cn.iocoder.yudao.module.coupon.controller.admin.coupontemplete.vo.CouponTempleteExportReqVO;
  9 +import cn.iocoder.yudao.module.coupon.controller.admin.coupontemplete.vo.CouponTempletePageReqVO;
  10 +import cn.iocoder.yudao.module.coupon.dal.dataobject.CouponTemplete.CouponTempleteDO;
  11 +import org.apache.ibatis.annotations.Mapper;
  12 +
  13 +
  14 +/**
  15 + * 优惠券模板 Mapper
  16 + *
  17 + * @author wxr
  18 + */
  19 +@Mapper
  20 +public interface CouponTempleteMapper extends BaseMapperX<CouponTempleteDO> {
  21 +
  22 + default PageResult<CouponTempleteDO> selectPage(CouponTempletePageReqVO reqVO) {
  23 + return selectPage(reqVO, new LambdaQueryWrapperX<CouponTempleteDO>()
  24 + .eqIfPresent(CouponTempleteDO::getType, reqVO.getType())
  25 + .likeIfPresent(CouponTempleteDO::getName, reqVO.getName())
  26 + .eqIfPresent(CouponTempleteDO::getCouponNameRemark, reqVO.getCouponNameRemark())
  27 + .eqIfPresent(CouponTempleteDO::getImage, reqVO.getImage())
  28 + .eqIfPresent(CouponTempleteDO::getCount, reqVO.getCount())
  29 + .eqIfPresent(CouponTempleteDO::getLeadCount, reqVO.getLeadCount())
  30 + .eqIfPresent(CouponTempleteDO::getUsedCount, reqVO.getUsedCount())
  31 + .eqIfPresent(CouponTempleteDO::getGoodsType, reqVO.getGoodsType())
  32 + .eqIfPresent(CouponTempleteDO::getProductIds, reqVO.getProductIds())
  33 + .eqIfPresent(CouponTempleteDO::getHasUseLimit, reqVO.getHasUseLimit())
  34 + .eqIfPresent(CouponTempleteDO::getAtLeast, reqVO.getAtLeast())
  35 + .eqIfPresent(CouponTempleteDO::getMoney, reqVO.getMoney())
  36 + .eqIfPresent(CouponTempleteDO::getDiscount, reqVO.getDiscount())
  37 + .eqIfPresent(CouponTempleteDO::getDiscountLimit, reqVO.getDiscountLimit())
  38 + .eqIfPresent(CouponTempleteDO::getMinMoney, reqVO.getMinMoney())
  39 + .eqIfPresent(CouponTempleteDO::getMaxMoney, reqVO.getMaxMoney())
  40 + .eqIfPresent(CouponTempleteDO::getValidityType, reqVO.getValidityType())
  41 + .betweenIfPresent(CouponTempleteDO::getStartUseTime, reqVO.getStartUseTime())
  42 + .betweenIfPresent(CouponTempleteDO::getEndUseTime, reqVO.getEndUseTime())
  43 + .eqIfPresent(CouponTempleteDO::getFixedTerm, reqVO.getFixedTerm())
  44 + .eqIfPresent(CouponTempleteDO::getWhetherLimitless, reqVO.getWhetherLimitless())
  45 + .eqIfPresent(CouponTempleteDO::getMaxFetch, reqVO.getMaxFetch())
  46 + .eqIfPresent(CouponTempleteDO::getWhetherExpireNotice, reqVO.getWhetherExpireNotice())
  47 + .eqIfPresent(CouponTempleteDO::getExpireNoticeFixedTerm, reqVO.getExpireNoticeFixedTerm())
  48 + .eqIfPresent(CouponTempleteDO::getWhetherForbidPreference, reqVO.getWhetherForbidPreference())
  49 + .eqIfPresent(CouponTempleteDO::getWhetherShow, reqVO.getWhetherShow())
  50 + .eqIfPresent(CouponTempleteDO::getDiscountOrderMoney, reqVO.getDiscountOrderMoney())
  51 + .eqIfPresent(CouponTempleteDO::getOrderMoney, reqVO.getOrderMoney())
  52 + .eqIfPresent(CouponTempleteDO::getWhetherForbidden, reqVO.getWhetherForbidden())
  53 + .eqIfPresent(CouponTempleteDO::getOrderGoodsNum, reqVO.getOrderGoodsNum())
  54 + .eqIfPresent(CouponTempleteDO::getStatus, reqVO.getStatus())
  55 + .betweenIfPresent(CouponTempleteDO::getEndTime, reqVO.getEndTime())
  56 + .betweenIfPresent(CouponTempleteDO::getCreateTime, reqVO.getCreateTime())
  57 + .orderByDesc(CouponTempleteDO::getId));
  58 + }
  59 +
  60 + default List<CouponTempleteDO> selectList(CouponTempleteExportReqVO reqVO) {
  61 + return selectList(new LambdaQueryWrapperX<CouponTempleteDO>()
  62 + .eqIfPresent(CouponTempleteDO::getType, reqVO.getType())
  63 + .likeIfPresent(CouponTempleteDO::getName, reqVO.getName())
  64 + .eqIfPresent(CouponTempleteDO::getCouponNameRemark, reqVO.getCouponNameRemark())
  65 + .eqIfPresent(CouponTempleteDO::getImage, reqVO.getImage())
  66 + .eqIfPresent(CouponTempleteDO::getCount, reqVO.getCount())
  67 + .eqIfPresent(CouponTempleteDO::getLeadCount, reqVO.getLeadCount())
  68 + .eqIfPresent(CouponTempleteDO::getUsedCount, reqVO.getUsedCount())
  69 + .eqIfPresent(CouponTempleteDO::getGoodsType, reqVO.getGoodsType())
  70 + .eqIfPresent(CouponTempleteDO::getProductIds, reqVO.getProductIds())
  71 + .eqIfPresent(CouponTempleteDO::getHasUseLimit, reqVO.getHasUseLimit())
  72 + .eqIfPresent(CouponTempleteDO::getAtLeast, reqVO.getAtLeast())
  73 + .eqIfPresent(CouponTempleteDO::getMoney, reqVO.getMoney())
  74 + .eqIfPresent(CouponTempleteDO::getDiscount, reqVO.getDiscount())
  75 + .eqIfPresent(CouponTempleteDO::getDiscountLimit, reqVO.getDiscountLimit())
  76 + .eqIfPresent(CouponTempleteDO::getMinMoney, reqVO.getMinMoney())
  77 + .eqIfPresent(CouponTempleteDO::getMaxMoney, reqVO.getMaxMoney())
  78 + .eqIfPresent(CouponTempleteDO::getValidityType, reqVO.getValidityType())
  79 + .betweenIfPresent(CouponTempleteDO::getStartUseTime, reqVO.getStartUseTime())
  80 + .betweenIfPresent(CouponTempleteDO::getEndUseTime, reqVO.getEndUseTime())
  81 + .eqIfPresent(CouponTempleteDO::getFixedTerm, reqVO.getFixedTerm())
  82 + .eqIfPresent(CouponTempleteDO::getWhetherLimitless, reqVO.getWhetherLimitless())
  83 + .eqIfPresent(CouponTempleteDO::getMaxFetch, reqVO.getMaxFetch())
  84 + .eqIfPresent(CouponTempleteDO::getWhetherExpireNotice, reqVO.getWhetherExpireNotice())
  85 + .eqIfPresent(CouponTempleteDO::getExpireNoticeFixedTerm, reqVO.getExpireNoticeFixedTerm())
  86 + .eqIfPresent(CouponTempleteDO::getWhetherForbidPreference, reqVO.getWhetherForbidPreference())
  87 + .eqIfPresent(CouponTempleteDO::getWhetherShow, reqVO.getWhetherShow())
  88 + .eqIfPresent(CouponTempleteDO::getDiscountOrderMoney, reqVO.getDiscountOrderMoney())
  89 + .eqIfPresent(CouponTempleteDO::getOrderMoney, reqVO.getOrderMoney())
  90 + .eqIfPresent(CouponTempleteDO::getWhetherForbidden, reqVO.getWhetherForbidden())
  91 + .eqIfPresent(CouponTempleteDO::getOrderGoodsNum, reqVO.getOrderGoodsNum())
  92 + .eqIfPresent(CouponTempleteDO::getStatus, reqVO.getStatus())
  93 + .betweenIfPresent(CouponTempleteDO::getEndTime, reqVO.getEndTime())
  94 + .betweenIfPresent(CouponTempleteDO::getCreateTime, reqVO.getCreateTime())
  95 + .orderByDesc(CouponTempleteDO::getId));
  96 + }
  97 +
  98 +}
... ...
yudao-module-mall/yudao-module-coupon-biz/src/main/java/cn/iocoder/yudao/module/coupon/dal/mysql/coupon/CouponMapper.java 0 → 100644
  1 +package cn.iocoder.yudao.module.coupon.dal.mysql.coupon;
  2 +
  3 +import java.util.*;
  4 +
  5 +import cn.iocoder.yudao.framework.common.pojo.PageResult;
  6 +import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
  7 +import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
  8 +import cn.iocoder.yudao.module.coupon.dal.dataobject.coupon.CouponDO;
  9 +import org.apache.ibatis.annotations.Mapper;
  10 +import cn.iocoder.yudao.module.coupon.controller.admin.coupon.vo.*;
  11 +
  12 +/**
  13 + * 优惠券 Mapper
  14 + *
  15 + * @author wxr
  16 + */
  17 +@Mapper
  18 +public interface CouponMapper extends BaseMapperX<CouponDO> {
  19 +
  20 + default PageResult<CouponDO> selectPage(CouponPageReqVO reqVO) {
  21 + return selectPage(reqVO, new LambdaQueryWrapperX<CouponDO>()
  22 + .eqIfPresent(CouponDO::getType, reqVO.getType())
  23 + .likeIfPresent(CouponDO::getName, reqVO.getName())
  24 + .eqIfPresent(CouponDO::getCouponTypeId, reqVO.getCouponTypeId())
  25 + .eqIfPresent(CouponDO::getCouponCode, reqVO.getCouponCode())
  26 + .eqIfPresent(CouponDO::getMemberId, reqVO.getMemberId())
  27 + .eqIfPresent(CouponDO::getUseOrderId, reqVO.getUseOrderId())
  28 + .eqIfPresent(CouponDO::getGoodsType, reqVO.getGoodsType())
  29 + .eqIfPresent(CouponDO::getGoodsIds, reqVO.getGoodsIds())
  30 + .eqIfPresent(CouponDO::getAtLeast, reqVO.getAtLeast())
  31 + .eqIfPresent(CouponDO::getMoney, reqVO.getMoney())
  32 + .eqIfPresent(CouponDO::getDiscount, reqVO.getDiscount())
  33 + .eqIfPresent(CouponDO::getDiscountLimit, reqVO.getDiscountLimit())
  34 + .eqIfPresent(CouponDO::getWhetherForbidPreference, reqVO.getWhetherForbidPreference())
  35 + .eqIfPresent(CouponDO::getWhetherExpireNotice, reqVO.getWhetherExpireNotice())
  36 + .eqIfPresent(CouponDO::getExpireNoticeFixedTerm, reqVO.getExpireNoticeFixedTerm())
  37 + .eqIfPresent(CouponDO::getWhetherNoticed, reqVO.getWhetherNoticed())
  38 + .eqIfPresent(CouponDO::getState, reqVO.getState())
  39 + .eqIfPresent(CouponDO::getGetType, reqVO.getGetType())
  40 + .betweenIfPresent(CouponDO::getFetchTime, reqVO.getFetchTime())
  41 + .betweenIfPresent(CouponDO::getUseTime, reqVO.getUseTime())
  42 + .betweenIfPresent(CouponDO::getStartTime, reqVO.getStartTime())
  43 + .betweenIfPresent(CouponDO::getEndTime, reqVO.getEndTime())
  44 + .betweenIfPresent(CouponDO::getCreateTime, reqVO.getCreateTime())
  45 + .orderByDesc(CouponDO::getId));
  46 + }
  47 +
  48 + default List<CouponDO> selectList(CouponExportReqVO reqVO) {
  49 + return selectList(new LambdaQueryWrapperX<CouponDO>()
  50 + .eqIfPresent(CouponDO::getType, reqVO.getType())
  51 + .likeIfPresent(CouponDO::getName, reqVO.getName())
  52 + .eqIfPresent(CouponDO::getCouponTypeId, reqVO.getCouponTypeId())
  53 + .eqIfPresent(CouponDO::getCouponCode, reqVO.getCouponCode())
  54 + .eqIfPresent(CouponDO::getMemberId, reqVO.getMemberId())
  55 + .eqIfPresent(CouponDO::getUseOrderId, reqVO.getUseOrderId())
  56 + .eqIfPresent(CouponDO::getGoodsType, reqVO.getGoodsType())
  57 + .eqIfPresent(CouponDO::getGoodsIds, reqVO.getGoodsIds())
  58 + .eqIfPresent(CouponDO::getAtLeast, reqVO.getAtLeast())
  59 + .eqIfPresent(CouponDO::getMoney, reqVO.getMoney())
  60 + .eqIfPresent(CouponDO::getDiscount, reqVO.getDiscount())
  61 + .eqIfPresent(CouponDO::getDiscountLimit, reqVO.getDiscountLimit())
  62 + .eqIfPresent(CouponDO::getWhetherForbidPreference, reqVO.getWhetherForbidPreference())
  63 + .eqIfPresent(CouponDO::getWhetherExpireNotice, reqVO.getWhetherExpireNotice())
  64 + .eqIfPresent(CouponDO::getExpireNoticeFixedTerm, reqVO.getExpireNoticeFixedTerm())
  65 + .eqIfPresent(CouponDO::getWhetherNoticed, reqVO.getWhetherNoticed())
  66 + .eqIfPresent(CouponDO::getState, reqVO.getState())
  67 + .eqIfPresent(CouponDO::getGetType, reqVO.getGetType())
  68 + .betweenIfPresent(CouponDO::getFetchTime, reqVO.getFetchTime())
  69 + .betweenIfPresent(CouponDO::getUseTime, reqVO.getUseTime())
  70 + .betweenIfPresent(CouponDO::getStartTime, reqVO.getStartTime())
  71 + .betweenIfPresent(CouponDO::getEndTime, reqVO.getEndTime())
  72 + .betweenIfPresent(CouponDO::getCreateTime, reqVO.getCreateTime())
  73 + .orderByDesc(CouponDO::getId));
  74 + }
  75 +
  76 +}
... ...
yudao-module-mall/yudao-module-coupon-biz/src/main/java/cn/iocoder/yudao/module/coupon/service/CouponTemplete/CouponTempleteService.java 0 → 100644
  1 +package cn.iocoder.yudao.module.coupon.service.CouponTemplete;
  2 +
  3 +import java.util.*;
  4 +import javax.validation.*;
  5 +import cn.iocoder.yudao.module.coupon.controller.admin.coupontemplete.vo.*;
  6 +import cn.iocoder.yudao.framework.common.pojo.PageResult;
  7 +import cn.iocoder.yudao.module.coupon.dal.dataobject.CouponTemplete.CouponTempleteDO;
  8 +
  9 +/**
  10 + * 优惠券模板 Service 接口
  11 + *
  12 + * @author wxr
  13 + */
  14 +public interface CouponTempleteService {
  15 +
  16 + /**
  17 + * 创建优惠券模板
  18 + *
  19 + * @param createReqVO 创建信息
  20 + * @return 编号
  21 + */
  22 + Long create(@Valid CouponTempleteCreateReqVO createReqVO);
  23 +
  24 + /**
  25 + * 更新优惠券模板
  26 + *
  27 + * @param updateReqVO 更新信息
  28 + */
  29 + void update(@Valid CouponTempleteUpdateReqVO updateReqVO);
  30 +
  31 + /**
  32 + * 删除优惠券模板
  33 + *
  34 + * @param id 编号
  35 + */
  36 + void delete(Long id);
  37 +
  38 + /**
  39 + * 获得优惠券模板
  40 + *
  41 + * @param id 编号
  42 + * @return 优惠券模板
  43 + */
  44 + CouponTempleteDO get(Long id);
  45 +
  46 + /**
  47 + * 获得优惠券模板列表
  48 + *
  49 + * @param ids 编号
  50 + * @return 优惠券模板列表
  51 + */
  52 + List<CouponTempleteDO> getList(Collection<Long> ids);
  53 +
  54 + /**
  55 + * 获得优惠券模板分页
  56 + *
  57 + * @param pageReqVO 分页查询
  58 + * @return 优惠券模板分页
  59 + */
  60 + PageResult<CouponTempleteDO> getPage(CouponTempletePageReqVO pageReqVO);
  61 +
  62 + /**
  63 + * 获得优惠券模板列表, 用于 Excel 导出
  64 + *
  65 + * @param exportReqVO 查询条件
  66 + * @return 优惠券模板列表
  67 + */
  68 + List<CouponTempleteDO> getList(CouponTempleteExportReqVO exportReqVO);
  69 +
  70 +}
... ...
yudao-module-mall/yudao-module-coupon-biz/src/main/java/cn/iocoder/yudao/module/coupon/service/CouponTemplete/CouponTempleteServiceImpl.java 0 → 100644
  1 +package cn.iocoder.yudao.module.coupon.service.CouponTemplete;
  2 +
  3 +import cn.iocoder.yudao.module.coupon.controller.admin.coupontemplete.vo.CouponTempleteCreateReqVO;
  4 +import cn.iocoder.yudao.module.coupon.controller.admin.coupontemplete.vo.CouponTempleteExportReqVO;
  5 +import cn.iocoder.yudao.module.coupon.controller.admin.coupontemplete.vo.CouponTempletePageReqVO;
  6 +import cn.iocoder.yudao.module.coupon.controller.admin.coupontemplete.vo.CouponTempleteUpdateReqVO;
  7 +import cn.iocoder.yudao.module.coupon.convert.CouponTemplete.CouponTempleteConvert;
  8 +import cn.iocoder.yudao.module.coupon.dal.dataobject.CouponTemplete.CouponTempleteDO;
  9 +import cn.iocoder.yudao.module.coupon.dal.mysql.CouponTemplete.CouponTempleteMapper;
  10 +import cn.iocoder.yudao.module.coupon.service.CouponTemplete.CouponTempleteService;
  11 +import org.springframework.stereotype.Service;
  12 +import javax.annotation.Resource;
  13 +import org.springframework.validation.annotation.Validated;
  14 +
  15 +import java.util.*;
  16 +import cn.iocoder.yudao.framework.common.pojo.PageResult;
  17 +
  18 +
  19 +
  20 +import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
  21 +import static cn.iocoder.yudao.module.CouponTemplete.enums.ErrorCodeConstants.COUPON_TEMPLETE_NOT_EXISTS;
  22 +
  23 +/**
  24 + * 优惠券模板 Service 实现类
  25 + *
  26 + * @author wxr
  27 + */
  28 +@Service
  29 +@Validated
  30 +public class CouponTempleteServiceImpl implements CouponTempleteService {
  31 +
  32 + @Resource
  33 + private CouponTempleteMapper couponTempleteMapper;
  34 +
  35 + @Override
  36 + public Long create(CouponTempleteCreateReqVO createReqVO) {
  37 + // 插入
  38 + CouponTempleteDO couponTempleteDO = CouponTempleteConvert.INSTANCE.convert(createReqVO);
  39 + couponTempleteMapper.insert(couponTempleteDO);
  40 + // 返回
  41 + return couponTempleteDO.getId();
  42 + }
  43 +
  44 + @Override
  45 + public void update(CouponTempleteUpdateReqVO updateReqVO) {
  46 + // 校验存在
  47 + this.validateExists(updateReqVO.getId());
  48 + // 更新
  49 + CouponTempleteDO updateObj = CouponTempleteConvert.INSTANCE.convert(updateReqVO);
  50 + couponTempleteMapper.updateById(updateObj);
  51 + }
  52 +
  53 + @Override
  54 + public void delete(Long id) {
  55 + // 校验存在
  56 + this.validateExists(id);
  57 + // 删除
  58 + couponTempleteMapper.deleteById(id);
  59 + }
  60 +
  61 + private void validateExists(Long id) {
  62 + if (couponTempleteMapper.selectById(id) == null) {
  63 + throw exception(COUPON_TEMPLETE_NOT_EXISTS);
  64 + }
  65 + }
  66 +
  67 + @Override
  68 + public CouponTempleteDO get(Long id) {
  69 + return couponTempleteMapper.selectById(id);
  70 + }
  71 +
  72 + @Override
  73 + public List<CouponTempleteDO> getList(Collection<Long> ids) {
  74 + return couponTempleteMapper.selectBatchIds(ids);
  75 + }
  76 +
  77 + @Override
  78 + public PageResult<CouponTempleteDO> getPage(CouponTempletePageReqVO pageReqVO) {
  79 + return couponTempleteMapper.selectPage(pageReqVO);
  80 + }
  81 +
  82 + @Override
  83 + public List<CouponTempleteDO> getList(CouponTempleteExportReqVO exportReqVO) {
  84 + return couponTempleteMapper.selectList(exportReqVO);
  85 + }
  86 +
  87 +}
... ...
yudao-module-mall/yudao-module-coupon-biz/src/main/java/cn/iocoder/yudao/module/coupon/service/coupon/CouponService.java 0 → 100644
  1 +package cn.iocoder.yudao.module.coupon.service.coupon;
  2 +
  3 +import java.util.*;
  4 +import javax.validation.*;
  5 +import cn.iocoder.yudao.module.coupon.controller.admin.coupon.vo.*;
  6 +import cn.iocoder.yudao.module.coupon.dal.dataobject.coupon.CouponDO;
  7 +import cn.iocoder.yudao.framework.common.pojo.PageResult;
  8 +
  9 +/**
  10 + * 优惠券 Service 接口
  11 + *
  12 + * @author wxr
  13 + */
  14 +public interface CouponService {
  15 +
  16 + /**
  17 + * 创建优惠券
  18 + *
  19 + * @param createReqVO 创建信息
  20 + * @return 编号
  21 + */
  22 + Long create(@Valid CouponCreateReqVO createReqVO);
  23 +
  24 + /**
  25 + * 更新优惠券
  26 + *
  27 + * @param updateReqVO 更新信息
  28 + */
  29 + void update(@Valid CouponUpdateReqVO updateReqVO);
  30 +
  31 + /**
  32 + * 删除优惠券
  33 + *
  34 + * @param id 编号
  35 + */
  36 + void delete(Long id);
  37 +
  38 + /**
  39 + * 获得优惠券
  40 + *
  41 + * @param id 编号
  42 + * @return 优惠券
  43 + */
  44 + CouponDO get(Long id);
  45 +
  46 + /**
  47 + * 获得优惠券列表
  48 + *
  49 + * @param ids 编号
  50 + * @return 优惠券列表
  51 + */
  52 + List<CouponDO> getList(Collection<Long> ids);
  53 +
  54 + /**
  55 + * 获得优惠券分页
  56 + *
  57 + * @param pageReqVO 分页查询
  58 + * @return 优惠券分页
  59 + */
  60 + PageResult<CouponDO> getPage(CouponPageReqVO pageReqVO);
  61 +
  62 + /**
  63 + * 获得优惠券列表, 用于 Excel 导出
  64 + *
  65 + * @param exportReqVO 查询条件
  66 + * @return 优惠券列表
  67 + */
  68 + List<CouponDO> getList(CouponExportReqVO exportReqVO);
  69 +
  70 +}
... ...
yudao-module-mall/yudao-module-coupon-biz/src/main/java/cn/iocoder/yudao/module/coupon/service/coupon/CouponServiceImpl.java 0 → 100644
  1 +package cn.iocoder.yudao.module.coupon.service.coupon;
  2 +
  3 +import org.springframework.stereotype.Service;
  4 +import javax.annotation.Resource;
  5 +import org.springframework.validation.annotation.Validated;
  6 +
  7 +import java.util.*;
  8 +import cn.iocoder.yudao.module.coupon.controller.admin.coupon.vo.*;
  9 +import cn.iocoder.yudao.module.coupon.dal.dataobject.coupon.CouponDO;
  10 +import cn.iocoder.yudao.framework.common.pojo.PageResult;
  11 +
  12 +import cn.iocoder.yudao.module.coupon.convert.coupon.CouponConvert;
  13 +import cn.iocoder.yudao.module.coupon.dal.mysql.coupon.CouponMapper;
  14 +
  15 +import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
  16 +import static cn.iocoder.yudao.module.CouponTemplete.enums.ErrorCodeConstants.COUPON_NOT_EXISTS;
  17 +
  18 +/**
  19 + * 优惠券 Service 实现类
  20 + *
  21 + * @author wxr
  22 + */
  23 +@Service
  24 +@Validated
  25 +public class CouponServiceImpl implements CouponService {
  26 +
  27 + @Resource
  28 + private CouponMapper couponMapper;
  29 +
  30 + @Override
  31 + public Long create(CouponCreateReqVO createReqVO) {
  32 + // 插入
  33 + CouponDO couponDO = CouponConvert.INSTANCE.convert(createReqVO);
  34 + couponMapper.insert(couponDO);
  35 + // 返回
  36 + return couponDO.getId();
  37 + }
  38 +
  39 + @Override
  40 + public void update(CouponUpdateReqVO updateReqVO) {
  41 + // 校验存在
  42 + this.validateExists(updateReqVO.getId());
  43 + // 更新
  44 + CouponDO updateObj = CouponConvert.INSTANCE.convert(updateReqVO);
  45 + couponMapper.updateById(updateObj);
  46 + }
  47 +
  48 + @Override
  49 + public void delete(Long id) {
  50 + // 校验存在
  51 + this.validateExists(id);
  52 + // 删除
  53 + couponMapper.deleteById(id);
  54 + }
  55 +
  56 + private void validateExists(Long id) {
  57 + if (couponMapper.selectById(id) == null) {
  58 + throw exception(COUPON_NOT_EXISTS);
  59 + }
  60 + }
  61 +
  62 + @Override
  63 + public CouponDO get(Long id) {
  64 + return couponMapper.selectById(id);
  65 + }
  66 +
  67 + @Override
  68 + public List<CouponDO> getList(Collection<Long> ids) {
  69 + return couponMapper.selectBatchIds(ids);
  70 + }
  71 +
  72 + @Override
  73 + public PageResult<CouponDO> getPage(CouponPageReqVO pageReqVO) {
  74 + return couponMapper.selectPage(pageReqVO);
  75 + }
  76 +
  77 + @Override
  78 + public List<CouponDO> getList(CouponExportReqVO exportReqVO) {
  79 + return couponMapper.selectList(exportReqVO);
  80 + }
  81 +
  82 +}
... ...
yudao-module-mall/yudao-module-coupon-biz/src/main/resources/mapper/CouponTemplete/CouponTempleteMapper.xml 0 → 100644
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  3 +<mapper namespace="cn.iocoder.yudao.module.coupon.dal.mysql.CouponTemplete.CouponTempleteMapper">
  4 +
  5 + <!--
  6 + 一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
  7 + 无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
  8 + 代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
  9 + 文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
  10 + -->
  11 +
  12 +</mapper>
... ...
yudao-module-mall/yudao-module-coupon-biz/src/main/resources/mapper/coupon/CouponMapper.xml 0 → 100644
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  3 +<mapper namespace="cn.iocoder.yudao.module.coupon.dal.mysql.coupon.CouponMapper">
  4 +
  5 + <!--
  6 + 一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
  7 + 无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
  8 + 代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
  9 + 文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
  10 + -->
  11 +
  12 +</mapper>
... ...