promotion:完善 优惠劵模板 表~

pull/2/head
YunaiV 2022-10-31 21:19:18 +08:00
parent cca27636b7
commit 035c2cf28c
49 changed files with 292 additions and 2493 deletions

View File

@ -1,35 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<groupId>cn.iocoder.boot</groupId>
<artifactId>yudao-module-mall</artifactId>
<version>${revision}</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>yudao-module-coupon-api</artifactId>
<packaging>jar</packaging>
<name>${project.artifactId}</name>
<description>
coupon 模块 API暴露给其它模块调用
</description>
<dependencies>
<dependency>
<groupId>cn.iocoder.boot</groupId>
<artifactId>yudao-common</artifactId>
</dependency>
<!-- 参数校验 -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-validation</artifactId>
<optional>true</optional>
</dependency>
</dependencies>
</project>

View File

@ -1,29 +0,0 @@
package cn.iocoder.yudao.module.CouponTemplete.enums;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
/**
* -
*
* @author Sin
*/
@RequiredArgsConstructor
@Getter
public enum CouponExpireTimeTypeEnum {
OPEN(1,"不开启"),
CLOSE(0,"开启"),;
/**
*
*/
private final Integer type;
/**
*
*/
private final String name;
}

View File

@ -1,29 +0,0 @@
package cn.iocoder.yudao.module.CouponTemplete.enums;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
/**
* - 0
*
* @author Sin
*/
@RequiredArgsConstructor
@Getter
public enum CouponFetchTypeEnum {
LIMIT(1,"限制"),
NOT_LIMIT(0,"不限制"),;
/**
*
*/
private final Integer type;
/**
*
*/
private final String name;
}

View File

@ -1,29 +0,0 @@
package cn.iocoder.yudao.module.CouponTemplete.enums;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
/**
* -
*
* @author Sin
*/
@RequiredArgsConstructor
@Getter
public enum CouponForbidPreferenceEnum {
UN_FORBID(0,"不限制"),
FORBID(1,"优惠券仅原价购买商品时可用");
/**
*
*/
private final Integer type;
/**
*
*/
private final String name;
}

View File

@ -1,30 +0,0 @@
package cn.iocoder.yudao.module.CouponTemplete.enums;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
/**
* - 使
*
* @author Sin
*/
@RequiredArgsConstructor
@Getter
public enum CouponGoodsTypeEnum {
ALL(1,"全部商品可用"),
POINT_PRODUCT(2,"指定商品可用"),
POINT_PRODUCT_NOT(3,"指定商品不可用"),;
/**
* 使
*/
private final Integer type;
/**
* 使
*/
private final String name;
}

View File

@ -1,30 +0,0 @@
package cn.iocoder.yudao.module.CouponTemplete.enums;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
/**
* -
*
* @author Sin
*/
@RequiredArgsConstructor
@Getter
public enum CouponStatusTypeEnum {
PROCESSING(1,"进行中"),
END(2,"已结束"),
CLOSE(3,"已关闭"),;
/**
*
*/
private final Integer type;
/**
*
*/
private final String name;
}

View File

@ -1,30 +0,0 @@
package cn.iocoder.yudao.module.CouponTemplete.enums;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
/**
* -
*
* @author Sin
*/
@RequiredArgsConstructor
@Getter
public enum CouponTypeEnum {
REWARD(1,"满减"),
DISCOUNT(2,"折扣"),
RANDOW(3,"随机"),;
/**
*
*/
private final Integer type;
/**
*
*/
private final String name;
}

View File

@ -1,29 +0,0 @@
package cn.iocoder.yudao.module.CouponTemplete.enums;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
/**
* 使 - 使
*
* @author Sin
*/
@RequiredArgsConstructor
@Getter
public enum CouponUseLimitEnum {
HAS_LIMIT(1,"无门槛"),
NO_LIMIT(2,"有门槛"),;
/**
* 使
*/
private final Integer type;
/**
* 使
*/
private final String name;
}

View File

@ -1,29 +0,0 @@
package cn.iocoder.yudao.module.CouponTemplete.enums;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
/**
* -
*
* @author Sin
*/
@RequiredArgsConstructor
@Getter
public enum CouponValidityTypeEnum {
TIME_RANGE_EXPIRTED(1,"时间范围过期"),
EXPIRES_AFTER_FIXED_DATE(2,"领取之日固定日期后过期"),
EXPIRES_DATE_NEXT_FIEXD_DATE(3,"领取次日固定日期后过期"),;
/**
*
*/
private final Integer status;
/**
*
*/
private final String name;
}

View File

@ -1,27 +0,0 @@
package cn.iocoder.yudao.module.CouponTemplete.enums;
import cn.iocoder.yudao.framework.common.exception.ErrorCode;
/**
* coupon
*
* coupon 使 1-010-000-000
*/
public interface ErrorCodeConstants {
// ========== COUPON分类相关 1010001000 ============
ErrorCode COUPON_TEMPLETE_NOT_EXISTS = new ErrorCode(1010001000, "优惠券模板不存在");
ErrorCode MONEY_NOT_NULL = new ErrorCode(1010001001, "当type为reward时需要添加发放面额不能为空");
ErrorCode DISCOUNT_NOT_NULL = new ErrorCode(1010001001, "当type为discount时需要添加折扣不能为空");
ErrorCode DISCOUNT_LIMIT_NOT_NULL = new ErrorCode(1010001001, "当type为discount时可选择性添加最多折扣金额不能为空");
ErrorCode MIN_MAX_NOT_NULL = new ErrorCode(1010001001, "当type为radom时需要添加最低金额");
ErrorCode START_END_TIME_NOT_NULL = new ErrorCode(1010001001, "使用开始日期,使用结束日期不能为空");
ErrorCode FIXED_TERM_NOT_NULL = new ErrorCode(1010001001, "领取之日起或者次日N天内有效不能为空");
// ========== COUPON分类相关 1010002000 ============
ErrorCode COUPON_NOT_EXISTS = new ErrorCode(1010001000, "优惠券模板不存在");
}

View File

@ -1,64 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<groupId>cn.iocoder.boot</groupId>
<artifactId>yudao-module-mall</artifactId>
<version>${revision}</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<packaging>jar</packaging>
<artifactId>yudao-module-coupon-biz</artifactId>
<name>${project.artifactId}</name>
<description>
coupon模块主要负责优惠券的一些业务含发布优惠券模板分发优惠券等
</description>
<dependencies>
<dependency>
<groupId>cn.iocoder.boot</groupId>
<artifactId>yudao-module-coupon-api</artifactId>
<version>${revision}</version>
</dependency>
<!-- 业务组件 -->
<dependency>
<groupId>cn.iocoder.boot</groupId>
<artifactId>yudao-spring-boot-starter-biz-operatelog</artifactId>
</dependency>
<!-- Web 相关 -->
<dependency>
<groupId>cn.iocoder.boot</groupId>
<artifactId>yudao-spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>cn.iocoder.boot</groupId>
<artifactId>yudao-spring-boot-starter-security</artifactId>
</dependency>
<!-- DB 相关 -->
<dependency>
<groupId>cn.iocoder.boot</groupId>
<artifactId>yudao-spring-boot-starter-mybatis</artifactId>
</dependency>
<!-- Test 测试相关 -->
<dependency>
<groupId>cn.iocoder.boot</groupId>
<artifactId>yudao-spring-boot-starter-test</artifactId>
</dependency>
<!-- 工具类相关 -->
<dependency>
<groupId>cn.iocoder.boot</groupId>
<artifactId>yudao-spring-boot-starter-excel</artifactId>
</dependency>
</dependencies>
</project>

View File

@ -1,88 +0,0 @@
package cn.iocoder.yudao.module.coupon.controller.admin.coupon;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.security.access.prepost.PreAuthorize;
import io.swagger.annotations.*;
import javax.validation.*;
import java.util.*;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
import cn.iocoder.yudao.module.coupon.controller.admin.coupon.vo.*;
import cn.iocoder.yudao.module.coupon.dal.dataobject.coupon.CouponDO;
import cn.iocoder.yudao.module.coupon.convert.coupon.CouponConvert;
import cn.iocoder.yudao.module.coupon.service.coupon.CouponService;
@Api(tags = "管理后台 - 优惠券")
@RestController
@RequestMapping("/coupon/item")
@Validated
public class CouponController {
@Resource
private CouponService couponService;
//todo 用户优惠券
@PostMapping("/create")
@ApiOperation("用户领取优惠券")
@PreAuthorize("@ss.hasPermission('coupon::create')")
public CommonResult<Long> create(@RequestParam("couponTemplateId") Long couponTemplateId) {
return success(couponService.create(couponTemplateId));
}
@PutMapping("/update")
@ApiOperation("更新优惠券")
@PreAuthorize("@ss.hasPermission('coupon::update')")
public CommonResult<Boolean> update(@Valid @RequestBody CouponUpdateReqVO updateReqVO) {
couponService.update(updateReqVO);
return success(true);
}
@DeleteMapping("/delete")
@ApiOperation("删除优惠券")
@ApiImplicitParam(name = "id", value = "编号", required = true, dataTypeClass = Long.class)
@PreAuthorize("@ss.hasPermission('coupon::delete')")
public CommonResult<Boolean> delete(@RequestParam("id") Long id) {
couponService.delete(id);
return success(true);
}
@GetMapping("/get")
@ApiOperation("获得优惠券")
@ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class)
@PreAuthorize("@ss.hasPermission('coupon::query')")
public CommonResult<CouponRespVO> get(@RequestParam("id") Long id) {
CouponDO couponDO = couponService.get(id);
return success(CouponConvert.INSTANCE.convert(couponDO));
}
@GetMapping("/list")
@ApiOperation("获得优惠券列表")
@ApiImplicitParam(name = "ids", value = "编号列表", required = true, example = "1024,2048", dataTypeClass = List.class)
@PreAuthorize("@ss.hasPermission('coupon::query')")
public CommonResult<List<CouponRespVO>> getList(@RequestParam("ids") Collection<Long> ids) {
List<CouponDO> list = couponService.getList(ids);
return success(CouponConvert.INSTANCE.convertList(list));
}
@GetMapping("/page")
@ApiOperation("获得优惠券分页")
@PreAuthorize("@ss.hasPermission('coupon::query')")
public CommonResult<PageResult<CouponRespVO>> getPage(@Valid CouponPageReqVO pageVO) {
PageResult<CouponDO> pageResult = couponService.getPage(pageVO);
return success(CouponConvert.INSTANCE.convertPage(pageResult));
}
}

View File

@ -1,110 +0,0 @@
package cn.iocoder.yudao.module.coupon.controller.admin.coupon.vo;
import lombok.*;
import java.util.*;
import java.math.BigDecimal;
import io.swagger.annotations.*;
import javax.validation.constraints.*;
import org.springframework.format.annotation.DateTimeFormat;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
/**
* Base VO VO 使
* VO Swagger
*/
@Data
public class CouponBaseVO {
@ApiModelProperty(value = "优惠券类型 reward-满减 discount-折扣 random-随机", required = true)
@NotNull(message = "优惠券类型 reward-满减 discount-折扣 random-随机不能为空")
private String type;
@ApiModelProperty(value = "优惠券名称", required = true)
@NotNull(message = "优惠券名称不能为空")
private String name;
@ApiModelProperty(value = "优惠券类型id")
private Long couponTypeId;
@ApiModelProperty(value = "优惠券编码", required = true)
@NotNull(message = "优惠券编码不能为空")
private String couponCode;
@ApiModelProperty(value = "领用人", required = true)
@NotNull(message = "领用人不能为空")
private Long memberId;
@ApiModelProperty(value = "优惠券使用订单id", required = true)
@NotNull(message = "优惠券使用订单id不能为空")
private Long useOrderId;
@ApiModelProperty(value = "适用商品类型1-全部商品可用2-指定商品可用3-指定商品不可用", required = true)
@NotNull(message = "适用商品类型1-全部商品可用2-指定商品可用3-指定商品不可用不能为空")
private Boolean goodsType;
@ApiModelProperty(value = "适用商品id", required = true)
@NotNull(message = "适用商品id不能为空")
private String goodsIds;
@ApiModelProperty(value = "最小金额", required = true)
@NotNull(message = "最小金额不能为空")
private BigDecimal atLeast;
@ApiModelProperty(value = "面额", required = true)
@NotNull(message = "面额不能为空")
private BigDecimal money;
@ApiModelProperty(value = "1 =< 折扣 <= 9.9 当type为discount时需要添加", required = true)
@NotNull(message = "1 =< 折扣 <= 9.9 当type为discount时需要添加不能为空")
private BigDecimal discount;
@ApiModelProperty(value = "最多折扣金额 当type为discount时可选择性添加", required = true)
@NotNull(message = "最多折扣金额 当type为discount时可选择性添加不能为空")
private BigDecimal discountLimit;
@ApiModelProperty(value = "优惠叠加 0-不限制 1- 优惠券仅原价购买商品时可用", required = true)
@NotNull(message = "优惠叠加 0-不限制 1- 优惠券仅原价购买商品时可用不能为空")
private Boolean whetherForbidPreference;
@ApiModelProperty(value = "是否开启过期提醒0-不开启 1-开启", required = true)
@NotNull(message = "是否开启过期提醒0-不开启 1-开启")
private Boolean whetherExpireNotice;
@ApiModelProperty(value = "过期前N天提醒", required = true)
@NotNull(message = "过期前N天提醒不能为空")
private Integer expireNoticeFixedTerm;
@ApiModelProperty(value = "是否已提醒", required = true)
@NotNull(message = "是否已提醒不能为空")
private Boolean whetherNoticed;
@ApiModelProperty(value = "优惠券状态 1已领用未使用 2已使用 3已过期", required = true)
@NotNull(message = "优惠券状态 1已领用未使用 2已使用 3已过期不能为空")
private Integer state;
@ApiModelProperty(value = "获取方式1订单2.直接领取3.活动领取 4转赠 5分享获取", required = true)
@NotNull(message = "获取方式1订单2.直接领取3.活动领取 4转赠 5分享获取不能为空")
private Boolean getType;
@ApiModelProperty(value = "领取时间", required = true)
@NotNull(message = "领取时间不能为空")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private Date fetchTime;
@ApiModelProperty(value = "使用时间", required = true)
@NotNull(message = "使用时间不能为空")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private Date useTime;
@ApiModelProperty(value = "可使用的开始时间", required = true)
@NotNull(message = "可使用的开始时间不能为空")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private Date startTime;
@ApiModelProperty(value = "有效期结束时间", required = true)
@NotNull(message = "有效期结束时间不能为空")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private Date endTime;
}

View File

@ -1,14 +0,0 @@
package cn.iocoder.yudao.module.coupon.controller.admin.coupon.vo;
import lombok.*;
import java.util.*;
import io.swagger.annotations.*;
import javax.validation.constraints.*;
@ApiModel("管理后台 - 优惠券创建 Request VO")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class CouponCreateReqVO extends CouponBaseVO {
}

View File

@ -1,90 +0,0 @@
package cn.iocoder.yudao.module.coupon.controller.admin.coupon.vo;
import lombok.*;
import java.util.*;
import java.math.BigDecimal;
import io.swagger.annotations.*;
import com.alibaba.excel.annotation.ExcelProperty;
/**
* Excel VO
*
* @author wxr
*/
@Data
public class CouponExcelVO {
@ExcelProperty("用户ID")
private Long id;
@ExcelProperty("优惠券类型 reward-满减 discount-折扣 random-随机")
private String type;
@ExcelProperty("优惠券名称")
private String name;
@ExcelProperty("优惠券类型id")
private Long couponTypeId;
@ExcelProperty("优惠券编码")
private String couponCode;
@ExcelProperty("领用人")
private Long memberId;
@ExcelProperty("优惠券使用订单id")
private Long useOrderId;
@ExcelProperty("适用商品类型1-全部商品可用2-指定商品可用3-指定商品不可用")
private Boolean goodsType;
@ExcelProperty("适用商品id")
private String goodsIds;
@ExcelProperty("最小金额")
private BigDecimal atLeast;
@ExcelProperty("面额")
private BigDecimal money;
@ExcelProperty("1 =< 折扣 <= 9.9 当type为discount时需要添加")
private BigDecimal discount;
@ExcelProperty("最多折扣金额 当type为discount时可选择性添加")
private BigDecimal discountLimit;
@ExcelProperty("优惠叠加 0-不限制 1- 优惠券仅原价购买商品时可用")
private Boolean whetherForbidPreference;
@ExcelProperty("是否开启过期提醒0-不开启 1-开启")
private Boolean whetherExpireNotice;
@ExcelProperty("过期前N天提醒")
private Integer expireNoticeFixedTerm;
@ExcelProperty("是否已提醒")
private Boolean whetherNoticed;
@ExcelProperty("优惠券状态 1已领用未使用 2已使用 3已过期")
private Integer state;
@ExcelProperty("获取方式1订单2.直接领取3.活动领取 4转赠 5分享获取")
private Boolean getType;
@ExcelProperty("领取时间")
private Date fetchTime;
@ExcelProperty("使用时间")
private Date useTime;
@ExcelProperty("可使用的开始时间")
private Date startTime;
@ExcelProperty("有效期结束时间")
private Date endTime;
@ExcelProperty("创建时间")
private Date createTime;
}

View File

@ -1,91 +0,0 @@
package cn.iocoder.yudao.module.coupon.controller.admin.coupon.vo;
import lombok.*;
import java.math.BigDecimal;
import java.util.*;
import io.swagger.annotations.*;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import org.springframework.format.annotation.DateTimeFormat;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@ApiModel(value = "管理后台 - 优惠券 Excel 导出 Request VO", description = "参数和 CouponPageReqVO 是一致的")
@Data
public class CouponExportReqVO {
@ApiModelProperty(value = "优惠券类型 reward-满减 discount-折扣 random-随机")
private String type;
@ApiModelProperty(value = "优惠券名称")
private String name;
@ApiModelProperty(value = "优惠券类型id")
private Long couponTypeId;
@ApiModelProperty(value = "优惠券编码")
private String couponCode;
@ApiModelProperty(value = "领用人")
private Long memberId;
@ApiModelProperty(value = "优惠券使用订单id")
private Long useOrderId;
@ApiModelProperty(value = "适用商品类型1-全部商品可用2-指定商品可用3-指定商品不可用")
private Boolean goodsType;
@ApiModelProperty(value = "适用商品id")
private String goodsIds;
@ApiModelProperty(value = "最小金额")
private BigDecimal atLeast;
@ApiModelProperty(value = "面额")
private BigDecimal money;
@ApiModelProperty(value = "1 =< 折扣 <= 9.9 当type为discount时需要添加")
private BigDecimal discount;
@ApiModelProperty(value = "最多折扣金额 当type为discount时可选择性添加")
private BigDecimal discountLimit;
@ApiModelProperty(value = "优惠叠加 0-不限制 1- 优惠券仅原价购买商品时可用")
private Boolean whetherForbidPreference;
@ApiModelProperty(value = "是否开启过期提醒0-不开启 1-开启")
private Boolean whetherExpireNotice;
@ApiModelProperty(value = "过期前N天提醒")
private Integer expireNoticeFixedTerm;
@ApiModelProperty(value = "是否已提醒")
private Boolean whetherNoticed;
@ApiModelProperty(value = "优惠券状态 1已领用未使用 2已使用 3已过期")
private Integer state;
@ApiModelProperty(value = "获取方式1订单2.直接领取3.活动领取 4转赠 5分享获取")
private Boolean getType;
@ApiModelProperty(value = "领取时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private Date[] fetchTime;
@ApiModelProperty(value = "使用时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private Date[] useTime;
@ApiModelProperty(value = "可使用的开始时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private Date[] startTime;
@ApiModelProperty(value = "有效期结束时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private Date[] endTime;
@ApiModelProperty(value = "创建时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private Date[] createTime;
}

View File

@ -1,93 +0,0 @@
package cn.iocoder.yudao.module.coupon.controller.admin.coupon.vo;
import lombok.*;
import java.math.BigDecimal;
import java.util.*;
import io.swagger.annotations.*;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import org.springframework.format.annotation.DateTimeFormat;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@ApiModel("管理后台 - 优惠券分页 Request VO")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class CouponPageReqVO extends PageParam {
@ApiModelProperty(value = "优惠券类型 reward-满减 discount-折扣 random-随机")
private String type;
@ApiModelProperty(value = "优惠券名称")
private String name;
@ApiModelProperty(value = "优惠券类型id")
private Long couponTypeId;
@ApiModelProperty(value = "优惠券编码")
private String couponCode;
@ApiModelProperty(value = "领用人")
private Long memberId;
@ApiModelProperty(value = "优惠券使用订单id")
private Long useOrderId;
@ApiModelProperty(value = "适用商品类型1-全部商品可用2-指定商品可用3-指定商品不可用")
private Boolean goodsType;
@ApiModelProperty(value = "适用商品id")
private String goodsIds;
@ApiModelProperty(value = "最小金额")
private BigDecimal atLeast;
@ApiModelProperty(value = "面额")
private BigDecimal money;
@ApiModelProperty(value = "1 =< 折扣 <= 9.9 当type为discount时需要添加")
private BigDecimal discount;
@ApiModelProperty(value = "最多折扣金额 当type为discount时可选择性添加")
private BigDecimal discountLimit;
@ApiModelProperty(value = "优惠叠加 0-不限制 1- 优惠券仅原价购买商品时可用")
private Boolean whetherForbidPreference;
@ApiModelProperty(value = "是否开启过期提醒0-不开启 1-开启")
private Boolean whetherExpireNotice;
@ApiModelProperty(value = "过期前N天提醒")
private Integer expireNoticeFixedTerm;
@ApiModelProperty(value = "是否已提醒")
private Boolean whetherNoticed;
@ApiModelProperty(value = "优惠券状态 1已领用未使用 2已使用 3已过期")
private Integer state;
@ApiModelProperty(value = "获取方式1订单2.直接领取3.活动领取 4转赠 5分享获取")
private Boolean getType;
@ApiModelProperty(value = "领取时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private Date[] fetchTime;
@ApiModelProperty(value = "使用时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private Date[] useTime;
@ApiModelProperty(value = "可使用的开始时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private Date[] startTime;
@ApiModelProperty(value = "有效期结束时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private Date[] endTime;
@ApiModelProperty(value = "创建时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private Date[] createTime;
}

View File

@ -1,19 +0,0 @@
package cn.iocoder.yudao.module.coupon.controller.admin.coupon.vo;
import lombok.*;
import java.util.*;
import io.swagger.annotations.*;
@ApiModel("管理后台 - 优惠券 Response VO")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class CouponRespVO extends CouponBaseVO {
@ApiModelProperty(value = "用户ID", required = true)
private Long id;
@ApiModelProperty(value = "创建时间", required = true)
private Date createTime;
}

View File

@ -1,18 +0,0 @@
package cn.iocoder.yudao.module.coupon.controller.admin.coupon.vo;
import lombok.*;
import java.util.*;
import io.swagger.annotations.*;
import javax.validation.constraints.*;
@ApiModel("管理后台 - 优惠券更新 Request VO")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class CouponUpdateReqVO extends CouponBaseVO {
@ApiModelProperty(value = "用户ID", required = true)
@NotNull(message = "用户ID不能为空")
private Long id;
}

View File

@ -1,81 +0,0 @@
package cn.iocoder.yudao.module.coupon.controller.admin.templete;
import cn.iocoder.yudao.module.coupon.controller.admin.templete.vo.*;
import cn.iocoder.yudao.module.coupon.convert.CouponTemplete.CouponTempleteConvert;
import cn.iocoder.yudao.module.coupon.dal.dataobject.CouponTemplete.CouponTempleteDO;
import cn.iocoder.yudao.module.coupon.service.CouponTemplete.CouponTempleteService;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.security.access.prepost.PreAuthorize;
import io.swagger.annotations.*;
import javax.validation.*;
import java.util.*;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
@Api(tags = "管理后台 - 优惠券模板")
@RestController
@RequestMapping("/coupon/template")
@Validated
public class CouponTempleteController {
@Resource
private CouponTempleteService couponTempleteServiceService;
@PostMapping("/create")
@ApiOperation("创建优惠券模板")
@PreAuthorize("@ss.hasPermission('CouponTemplete::create')")
public CommonResult<Long> create(@Valid @RequestBody CouponTempleteCreateReqVO createReqVO) {
return success(couponTempleteServiceService.create(createReqVO));
}
// @PutMapping("/update")
// @ApiOperation("更新优惠券模板")
// @PreAuthorize("@ss.hasPermission('CouponTemplete::update')")
// public CommonResult<Boolean> update(@Valid @RequestBody CouponTempleteUpdateReqVO updateReqVO) {
// couponTempleteServiceService.update(updateReqVO);
// return success(true);
// }
//
// @DeleteMapping("/delete")
// @ApiOperation("删除优惠券模板")
// @ApiImplicitParam(name = "id", value = "编号", required = true, dataTypeClass = Long.class)
// @PreAuthorize("@ss.hasPermission('CouponTemplete::delete')")
// public CommonResult<Boolean> delete(@RequestParam("id") Long id) {
// couponTempleteServiceService.delete(id);
// return success(true);
// }
//
// @GetMapping("/get")
// @ApiOperation("获得优惠券模板")
// @ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class)
// @PreAuthorize("@ss.hasPermission('CouponTemplete::query')")
// public CommonResult<CouponTempleteRespVO> get(@RequestParam("id") Long id) {
// CouponTempleteDO couponTempleteDO = couponTempleteServiceService.get(id);
// return success(CouponTempleteConvert.INSTANCE.convert(couponTempleteDO));
// }
//
// @GetMapping("/list")
// @ApiOperation("获得优惠券模板列表")
// @ApiImplicitParam(name = "ids", value = "编号列表", required = true, example = "1024,2048", dataTypeClass = List.class)
// @PreAuthorize("@ss.hasPermission('CouponTemplete::query')")
// public CommonResult<List<CouponTempleteRespVO>> getList(@RequestParam("ids") Collection<Long> ids) {
// List<CouponTempleteDO> list = couponTempleteServiceService.getList(ids);
// return success(CouponTempleteConvert.INSTANCE.convertList(list));
// }
//
@GetMapping("/page")
@ApiOperation("获得优惠券模板分页")
@PreAuthorize("@ss.hasPermission('CouponTemplete::query')")
public CommonResult<PageResult<CouponTempleteRespVO>> getPage(@Valid CouponTempletePageReqVO pageVO) {
PageResult<CouponTempleteDO> pageResult = couponTempleteServiceService.getPage(pageVO);
return success(CouponTempleteConvert.INSTANCE.convertPage(pageResult));
}
}

View File

@ -1,172 +0,0 @@
package cn.iocoder.yudao.module.coupon.controller.admin.templete.vo;
import lombok.*;
import java.util.*;
import java.math.BigDecimal;
import io.swagger.annotations.*;
import javax.validation.constraints.*;
import org.springframework.format.annotation.DateTimeFormat;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
/**
* Base VO VO 使
* VO Swagger
*/
@Data
public class CouponTempleteBaseVO {
//基本信息
@ApiModelProperty(value = "优惠券名称", required = true)
@NotNull(message = "优惠券名称不能为空")
private String name;
@ApiModelProperty(value = "名称备注")
private String couponNameRemark;
@ApiModelProperty(value = "优惠券图片")
private String image;
/* ============判断适用商品——开始============= */
@ApiModelProperty(value = "适用商品类型1-全部商品可用2-指定商品可用3-指定商品不可用", required = true)
@NotNull(message = "适用商品类型1-全部商品可用2-指定商品可用3-指定商品不可用不能为空")
private Integer goodsType;
@ApiModelProperty(value = "适用商品id")
private String productIds;
@ApiModelProperty(value = "使用门槛0-无门槛 1-有门槛", required = true)
@NotNull(message = "使用门槛0-无门槛 1-有门槛不能为空")
private Boolean hasUseLimit;
@ApiModelProperty(value = "满多少元使用 0代表无限制", required = true)
@NotNull(message = "满多少元使用 0代表无限制不能为空")
private BigDecimal atLeast;
/* ============折扣类型——开始============= */
@ApiModelProperty(value = "优惠券类型 reward-满减 discount-折扣 random-随机", required = true)
@NotNull(message = "优惠券类型 reward-满减 discount-折扣 random-随机不能为空")
private String type;
@ApiModelProperty(value = "发放面额 当type为reward时需要添加")
@NotNull(message = "发放面额 当type为reward时需要添加不能为空")
private BigDecimal money;
@ApiModelProperty(value = "1 =< 折扣 <= 9.9 当type为discount时需要添加")
@NotNull(message = "1 =< 折扣 <= 9.9 当type为discount时需要添加不能为空")
private BigDecimal discount;
@ApiModelProperty(value = "最多折扣金额 当type为discount时可选择性添加")
@NotNull(message = "最多折扣金额 当type为discount时可选择性添加不能为空")
private BigDecimal discountLimit;
@ApiModelProperty(value = "最低金额 当type为radom时需要添加", required = true)
@NotNull(message = "最低金额 当type为radom时需要添加不能为空")
private BigDecimal minMoney;
@ApiModelProperty(value = "最大金额 当type为radom时需要添加", required = true)
@NotNull(message = "最大金额 当type为radom时需要添加不能为空")
private BigDecimal maxMoney;
/* ============折扣类型——结束============= */
/* ============过期类型——开始============= */
@ApiModelProperty(value = "过期类型1-时间范围过期 2-领取之日固定日期后过期 3-领取次日固定日期后过期", required = true)
@NotNull(message = "过期类型1-时间范围过期 2-领取之日固定日期后过期 3-领取次日固定日期后过期 不能为空")
private Integer validityType;
@ApiModelProperty(value = "使用开始日期 过期类型1时必填")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private Date startUseTime;
@ApiModelProperty(value = "使用结束日期 过期类型1时必填")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private Date endUseTime;
@ApiModelProperty(value = "当validity_type为2或者3时需要添加 领取之日起或者次日N天内有效")
@NotNull(message = "当validity_type为2或者3时需要添加 领取之日起或者次日N天内有效不能为空")
private Integer fixedTerm;
@ApiModelProperty(value = "有效日期结束时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private Date endTime;
/* ============过期类型——结束============= */
@ApiModelProperty(value = "领取是否无限制0-否 1是", required = true)
@NotNull(message = "是否无限制0-否 1是")
private Boolean whetherLimitless;
@ApiModelProperty(value = "每人最大领取个数", required = true)
@NotNull(message = "每人最大领取个数不能为空")
private Integer maxFetch;
@ApiModelProperty(value = "是否开启过期提醒 0-不开启 1-开启", required = true)
@NotNull(message = "是否开启过期提醒0-不开启 1-开启不能为空")
private Boolean whetherExpireNotice;
@ApiModelProperty(value = "过期前N天提醒", required = true)
@NotNull(message = "过期前N天提醒不能为空")
private Integer expireNoticeFixedTerm;
@ApiModelProperty(value = "优惠叠加 0-不限制 1- 优惠券仅原价购买商品时可用", required = true)
@NotNull(message = "优惠叠加 0-不限制 1- 优惠券仅原价购买商品时可用不能为空")
private Boolean whetherForbidPreference;
@ApiModelProperty(value = "是否显示", required = true)
@NotNull(message = "是否显示不能为空")
private Integer whetherShow;
@ApiModelProperty(value = "是否禁止发放0-否 1-是", required = true)
@NotNull(message = "是否禁止发放0-否 1-是不能为空")
private Boolean whetherForbidden;
/* ============汇总计算——开始============= */
@ApiModelProperty(value = "使用优惠券购买的商品数量", required = true)
@NotNull(message = "使用优惠券购买的商品数量不能为空")
private Integer orderGoodsNum;
@ApiModelProperty(value = "订单的优惠总金额", required = true)
@NotNull(message = "订单的优惠总金额不能为空")
private BigDecimal discountOrderMoney;
@ApiModelProperty(value = "用券总成交额", required = true)
@NotNull(message = "用券总成交额不能为空")
private BigDecimal orderMoney;
@ApiModelProperty(value = "发放数量", required = true)
@NotNull(message = "发放数量不能为空")
private Integer count;
@ApiModelProperty(value = "已领取数量", required = true)
@NotNull(message = "已领取数量不能为空")
private Integer leadCount;
@ApiModelProperty(value = "已使用数量", required = true)
@NotNull(message = "已使用数量不能为空")
private Integer usedCount;
/* ============汇总计算——结束============= */
@ApiModelProperty(value = "状态1进行中2已结束3已关闭", required = true)
@NotNull(message = "状态1进行中2已结束-1已关闭不能为空")
private Integer status;
}

View File

@ -1,12 +0,0 @@
package cn.iocoder.yudao.module.coupon.controller.admin.templete.vo;
import lombok.*;
import io.swagger.annotations.*;
@ApiModel("管理后台 - 优惠券模板创建 Request VO")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class CouponTempleteCreateReqVO extends CouponTempleteBaseVO {
}

View File

@ -1,119 +0,0 @@
package cn.iocoder.yudao.module.coupon.controller.admin.templete.vo;
import lombok.*;
import java.util.*;
import java.math.BigDecimal;
import com.alibaba.excel.annotation.ExcelProperty;
/**
* Excel VO
*
* @author wxr
*/
@Data
public class CouponTempleteExcelVO {
@ExcelProperty("用户ID")
private Long id;
@ExcelProperty("优惠券类型 reward-满减 discount-折扣 random-随机")
private String type;
@ExcelProperty("优惠券名称")
private String name;
@ExcelProperty("名称备注")
private String couponNameRemark;
@ExcelProperty("优惠券图片")
private String image;
@ExcelProperty("发放数量")
private Integer count;
@ExcelProperty("已领取数量")
private Integer leadCount;
@ExcelProperty("已使用数量")
private Integer usedCount;
@ExcelProperty("适用商品类型1-全部商品可用2-指定商品可用3-指定商品不可用")
private Integer goodsType;
@ExcelProperty("适用商品id")
private String productIds;
@ExcelProperty("使用门槛0-无门槛 1-有门槛")
private Boolean hasUseLimit;
@ExcelProperty("满多少元使用 0代表无限制")
private BigDecimal atLeast;
@ExcelProperty("发放面额 当type为reward时需要添加")
private BigDecimal money;
@ExcelProperty("1 =< 折扣 <= 9.9 当type为discount时需要添加")
private BigDecimal discount;
@ExcelProperty("最多折扣金额 当type为discount时可选择性添加")
private BigDecimal discountLimit;
@ExcelProperty("最低金额 当type为radom时需要添加")
private BigDecimal minMoney;
@ExcelProperty("最大金额 当type为radom时需要添加")
private BigDecimal maxMoney;
@ExcelProperty("过期类型1-时间范围过期 2-领取之日固定日期后过期 3-领取次日固定日期后过期")
private Integer validityType;
@ExcelProperty("使用开始日期 过期类型1时必填")
private Date startUseTime;
@ExcelProperty("使用结束日期 过期类型1时必填")
private Date endUseTime;
@ExcelProperty("当validity_type为2或者3时需要添加 领取之日起或者次日N天内有效")
private Integer fixedTerm;
@ExcelProperty("是否无限制0-否 1是")
private Boolean whetherLimitless;
@ExcelProperty("每人最大领取个数")
private Integer maxFetch;
@ExcelProperty("是否开启过期提醒0-不开启 1-开启")
private Boolean whetherExpireNotice;
@ExcelProperty("过期前N天提醒")
private Integer expireNoticeFixedTerm;
@ExcelProperty("优惠叠加 0-不限制 1- 优惠券仅原价购买商品时可用")
private Boolean whetherForbidPreference;
@ExcelProperty("是否显示")
private Integer whetherShow;
@ExcelProperty("订单的优惠总金额")
private BigDecimal discountOrderMoney;
@ExcelProperty("用券总成交额")
private BigDecimal orderMoney;
@ExcelProperty("是否禁止发放0-否 1-是")
private Boolean whetherForbidden;
@ExcelProperty("使用优惠券购买的商品数量")
private Integer orderGoodsNum;
@ExcelProperty("状态1进行中2已结束-1已关闭")
private Integer status;
@ExcelProperty("有效日期结束时间")
private Date endTime;
@ExcelProperty("创建时间")
private Date createTime;
}

View File

@ -1,119 +0,0 @@
package cn.iocoder.yudao.module.coupon.controller.admin.templete.vo;
import lombok.*;
import java.math.BigDecimal;
import java.util.*;
import io.swagger.annotations.*;
import org.springframework.format.annotation.DateTimeFormat;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@ApiModel(value = "管理后台 - 优惠券模板 Excel 导出 Request VO", description = "参数和 CouponTempletePageReqVO 是一致的")
@Data
public class CouponTempleteExportReqVO {
@ApiModelProperty(value = "优惠券类型 reward-满减 discount-折扣 random-随机")
private String type;
@ApiModelProperty(value = "优惠券名称")
private String name;
@ApiModelProperty(value = "名称备注")
private String couponNameRemark;
@ApiModelProperty(value = "优惠券图片")
private String image;
@ApiModelProperty(value = "发放数量")
private Integer count;
@ApiModelProperty(value = "已领取数量")
private Integer leadCount;
@ApiModelProperty(value = "已使用数量")
private Integer usedCount;
@ApiModelProperty(value = "适用商品类型1-全部商品可用2-指定商品可用3-指定商品不可用")
private Boolean goodsType;
@ApiModelProperty(value = "适用商品id")
private String productIds;
@ApiModelProperty(value = "使用门槛0-无门槛 1-有门槛")
private Boolean hasUseLimit;
@ApiModelProperty(value = "满多少元使用 0代表无限制")
private BigDecimal atLeast;
@ApiModelProperty(value = "发放面额 当type为reward时需要添加")
private BigDecimal money;
@ApiModelProperty(value = "1 =< 折扣 <= 9.9 当type为discount时需要添加")
private BigDecimal discount;
@ApiModelProperty(value = "最多折扣金额 当type为discount时可选择性添加")
private BigDecimal discountLimit;
@ApiModelProperty(value = "最低金额 当type为radom时需要添加")
private BigDecimal minMoney;
@ApiModelProperty(value = "最大金额 当type为radom时需要添加")
private BigDecimal maxMoney;
@ApiModelProperty(value = "过期类型1-时间范围过期 2-领取之日固定日期后过期 3-领取次日固定日期后过期")
private Boolean validityType;
@ApiModelProperty(value = "使用开始日期 过期类型1时必填")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private Date[] startUseTime;
@ApiModelProperty(value = "使用结束日期 过期类型1时必填")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private Date[] endUseTime;
@ApiModelProperty(value = "当validity_type为2或者3时需要添加 领取之日起或者次日N天内有效")
private Integer fixedTerm;
@ApiModelProperty(value = "是否无限制0-否 1是")
private Boolean whetherLimitless;
@ApiModelProperty(value = "每人最大领取个数")
private Integer maxFetch;
@ApiModelProperty(value = "是否开启过期提醒0-不开启 1-开启")
private Boolean whetherExpireNotice;
@ApiModelProperty(value = "过期前N天提醒")
private Integer expireNoticeFixedTerm;
@ApiModelProperty(value = "优惠叠加 0-不限制 1- 优惠券仅原价购买商品时可用")
private Boolean whetherForbidPreference;
@ApiModelProperty(value = "是否显示")
private Integer whetherShow;
@ApiModelProperty(value = "订单的优惠总金额")
private BigDecimal discountOrderMoney;
@ApiModelProperty(value = "用券总成交额")
private BigDecimal orderMoney;
@ApiModelProperty(value = "是否禁止发放0-否 1-是")
private Boolean whetherForbidden;
@ApiModelProperty(value = "使用优惠券购买的商品数量")
private Integer orderGoodsNum;
@ApiModelProperty(value = "状态1进行中2已结束-1已关闭")
private Integer status;
@ApiModelProperty(value = "有效日期结束时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private Date[] endTime;
@ApiModelProperty(value = "创建时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private Date[] createTime;
}

View File

@ -1,122 +0,0 @@
package cn.iocoder.yudao.module.coupon.controller.admin.templete.vo;
import lombok.*;
import java.math.BigDecimal;
import java.util.*;
import io.swagger.annotations.*;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import org.springframework.format.annotation.DateTimeFormat;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@ApiModel("管理后台 - 优惠券模板分页 Request VO")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class CouponTempletePageReqVO extends PageParam {
@ApiModelProperty(value = "优惠券类型 reward-满减 discount-折扣 random-随机")
private String type;
@ApiModelProperty(value = "优惠券名称")
private String name;
@ApiModelProperty(value = "名称备注")
private String couponNameRemark;
@ApiModelProperty(value = "优惠券图片")
private String image;
@ApiModelProperty(value = "发放数量")
private Integer count;
@ApiModelProperty(value = "已领取数量")
private Integer leadCount;
@ApiModelProperty(value = "已使用数量")
private Integer usedCount;
@ApiModelProperty(value = "适用商品类型1-全部商品可用2-指定商品可用3-指定商品不可用")
private Boolean goodsType;
@ApiModelProperty(value = "适用商品id")
private String productIds;
@ApiModelProperty(value = "使用门槛0-无门槛 1-有门槛")
private Boolean hasUseLimit;
@ApiModelProperty(value = "满多少元使用 0代表无限制")
private BigDecimal atLeast;
@ApiModelProperty(value = "发放面额 当type为reward时需要添加")
private BigDecimal money;
@ApiModelProperty(value = "1 =< 折扣 <= 9.9 当type为discount时需要添加")
private BigDecimal discount;
@ApiModelProperty(value = "最多折扣金额 当type为discount时可选择性添加")
private BigDecimal discountLimit;
@ApiModelProperty(value = "最低金额 当type为radom时需要添加")
private BigDecimal minMoney;
@ApiModelProperty(value = "最大金额 当type为radom时需要添加")
private BigDecimal maxMoney;
@ApiModelProperty(value = "过期类型1-时间范围过期 2-领取之日固定日期后过期 3-领取次日固定日期后过期")
private Boolean validityType;
@ApiModelProperty(value = "使用开始日期 过期类型1时必填")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private Date[] startUseTime;
@ApiModelProperty(value = "使用结束日期 过期类型1时必填")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private Date[] endUseTime;
@ApiModelProperty(value = "当validity_type为2或者3时需要添加 领取之日起或者次日N天内有效")
private Integer fixedTerm;
@ApiModelProperty(value = "是否无限制0-否 1是")
private Boolean whetherLimitless;
@ApiModelProperty(value = "每人最大领取个数")
private Integer maxFetch;
@ApiModelProperty(value = "是否开启过期提醒0-不开启 1-开启")
private Boolean whetherExpireNotice;
@ApiModelProperty(value = "过期前N天提醒")
private Integer expireNoticeFixedTerm;
@ApiModelProperty(value = "优惠叠加 0-不限制 1- 优惠券仅原价购买商品时可用")
private Boolean whetherForbidPreference;
@ApiModelProperty(value = "是否显示")
private Integer whetherShow;
@ApiModelProperty(value = "订单的优惠总金额")
private BigDecimal discountOrderMoney;
@ApiModelProperty(value = "用券总成交额")
private BigDecimal orderMoney;
@ApiModelProperty(value = "是否禁止发放0-否 1-是")
private Boolean whetherForbidden;
@ApiModelProperty(value = "使用优惠券购买的商品数量")
private Integer orderGoodsNum;
@ApiModelProperty(value = "状态1进行中2已结束-1已关闭")
private Integer status;
@ApiModelProperty(value = "有效日期结束时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private Date[] endTime;
@ApiModelProperty(value = "创建时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private Date[] createTime;
}

View File

@ -1,19 +0,0 @@
package cn.iocoder.yudao.module.coupon.controller.admin.templete.vo;
import lombok.*;
import java.util.*;
import io.swagger.annotations.*;
@ApiModel("管理后台 - 优惠券模板 Response VO")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class CouponTempleteRespVO extends CouponTempleteBaseVO {
@ApiModelProperty(value = "用户ID", required = true)
private Long id;
@ApiModelProperty(value = "创建时间", required = true)
private Date createTime;
}

View File

@ -1,17 +0,0 @@
package cn.iocoder.yudao.module.coupon.controller.admin.templete.vo;
import lombok.*;
import io.swagger.annotations.*;
import javax.validation.constraints.*;
@ApiModel("管理后台 - 优惠券模板更新 Request VO")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class CouponTempleteUpdateReqVO extends CouponTempleteBaseVO {
@ApiModelProperty(value = "用户ID", required = true)
@NotNull(message = "用户ID不能为空")
private Long id;
}

View File

@ -1,38 +0,0 @@
package cn.iocoder.yudao.module.coupon.convert.CouponTemplete;
import java.util.*;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.coupon.controller.admin.templete.vo.CouponTempleteCreateReqVO;
import cn.iocoder.yudao.module.coupon.controller.admin.templete.vo.CouponTempleteExcelVO;
import cn.iocoder.yudao.module.coupon.controller.admin.templete.vo.CouponTempleteRespVO;
import cn.iocoder.yudao.module.coupon.controller.admin.templete.vo.CouponTempleteUpdateReqVO;
import cn.iocoder.yudao.module.coupon.dal.dataobject.CouponTemplete.CouponTempleteDO;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;
/**
* Convert
*
* @author wxr
*/
@Mapper
public interface CouponTempleteConvert {
CouponTempleteConvert INSTANCE = Mappers.getMapper(CouponTempleteConvert.class);
CouponTempleteDO convert(CouponTempleteCreateReqVO bean);
CouponTempleteDO convert(CouponTempleteUpdateReqVO bean);
CouponTempleteRespVO convert(CouponTempleteDO bean);
List<CouponTempleteRespVO> convertList(List<CouponTempleteDO> list);
PageResult<CouponTempleteRespVO> convertPage(PageResult<CouponTempleteDO> page);
List<CouponTempleteExcelVO> convertList02(List<CouponTempleteDO> list);
}

View File

@ -1,34 +0,0 @@
package cn.iocoder.yudao.module.coupon.convert.coupon;
import java.util.*;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;
import cn.iocoder.yudao.module.coupon.controller.admin.coupon.vo.*;
import cn.iocoder.yudao.module.coupon.dal.dataobject.coupon.CouponDO;
/**
* Convert
*
* @author wxr
*/
@Mapper
public interface CouponConvert {
CouponConvert INSTANCE = Mappers.getMapper(CouponConvert.class);
CouponDO convert(CouponCreateReqVO bean);
CouponDO convert(CouponUpdateReqVO bean);
CouponRespVO convert(CouponDO bean);
List<CouponRespVO> convertList(List<CouponDO> list);
PageResult<CouponRespVO> convertPage(PageResult<CouponDO> page);
List<CouponExcelVO> convertList02(List<CouponDO> list);
}

View File

@ -1,158 +0,0 @@
package cn.iocoder.yudao.module.coupon.dal.dataobject.CouponTemplete;
import lombok.*;
import java.util.*;
import java.math.BigDecimal;
import com.baomidou.mybatisplus.annotation.*;
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
/**
* DO
*
* @author wxr
*/
@TableName("coupon_templete")
@KeySequence("coupon_templete_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class CouponTempleteDO extends BaseDO {
/**
* ID
*/
@TableId
private Long id;
/**
* reward- discount- random-
*/
private String type;
/**
*
*/
private String name;
/**
*
*/
private String couponNameRemark;
/**
*
*/
private String image;
/**
*
*/
private Integer count;
/**
*
*/
private Integer leadCount;
/**
* 使
*/
private Integer usedCount;
/**
* 1-2-3-
*/
private Integer goodsType;
/**
* id
*/
private String productIds;
/**
* 使0- 1-
*/
private Boolean hasUseLimit;
/**
* 使 0
*/
private BigDecimal atLeast;
/**
* typereward
*/
private BigDecimal money;
/**
* 1 =< <= 9.9 typediscount
*/
private BigDecimal discount;
/**
* typediscount
*/
private BigDecimal discountLimit;
/**
* typeradom
*/
private BigDecimal minMoney;
/**
* typeradom
*/
private BigDecimal maxMoney;
/**
* 1- 2- 3-
*/
private Integer validityType;
/**
* 使 1
*/
private Date startUseTime;
/**
* 使 1
*/
private Date endUseTime;
/**
* validity_type23 N
*/
private Integer fixedTerm;
/**
* 0- 1
*/
private Boolean whetherLimitless;
/**
*
*/
private Integer maxFetch;
/**
* 0- 1-
*/
private Boolean whetherExpireNotice;
/**
* N
*/
private Integer expireNoticeFixedTerm;
/**
* 0- 1-
*/
private Boolean whetherForbidPreference;
/**
*
*/
private Integer whetherShow;
/**
*
*/
private BigDecimal discountOrderMoney;
/**
*
*/
private BigDecimal orderMoney;
/**
* 0- 1-
*/
private Boolean whetherForbidden;
/**
* 使
*/
private Integer orderGoodsNum;
/**
* 12-1
*/
private Integer status;
/**
*
*/
private Date endTime;
}

View File

@ -1,118 +0,0 @@
package cn.iocoder.yudao.module.coupon.dal.dataobject.coupon;
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
import lombok.*;
import java.util.*;
import java.math.BigDecimal;
import com.baomidou.mybatisplus.annotation.*;
/**
* DO
*
* @author wxr
*/
@TableName("coupon")
@KeySequence("coupon_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class CouponDO extends BaseDO {
/**
* ID
*/
@TableId
private Long id;
/**
* reward- discount- random-
*/
private String type;
/**
*
*/
private String name;
/**
* id
*/
private Long couponTypeId;
/**
*
*/
private String couponCode;
/**
*
*/
private Long memberId;
/**
* 使id
*/
private Long useOrderId;
/**
* 1-2-3-
*/
private Boolean goodsType;
/**
* id
*/
private String goodsIds;
/**
*
*/
private BigDecimal atLeast;
/**
*
*/
private BigDecimal money;
/**
* 1 =< <= 9.9 typediscount
*/
private BigDecimal discount;
/**
* typediscount
*/
private BigDecimal discountLimit;
/**
* 0- 1-
*/
private Boolean whetherForbidPreference;
/**
* 0- 1-
*/
private Boolean whetherExpireNotice;
/**
* N
*/
private Integer expireNoticeFixedTerm;
/**
*
*/
private Boolean whetherNoticed;
/**
* 1使 2使 3
*/
private Integer state;
/**
* 12.3. 4 5
*/
private Boolean getType;
/**
*
*/
private Date fetchTime;
/**
* 使
*/
private Date useTime;
/**
* 使
*/
private Date startTime;
/**
*
*/
private Date endTime;
}

View File

@ -1,98 +0,0 @@
package cn.iocoder.yudao.module.coupon.dal.mysql.CouponTemplete;
import java.util.*;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.coupon.controller.admin.templete.vo.CouponTempleteExportReqVO;
import cn.iocoder.yudao.module.coupon.controller.admin.templete.vo.CouponTempletePageReqVO;
import cn.iocoder.yudao.module.coupon.dal.dataobject.CouponTemplete.CouponTempleteDO;
import org.apache.ibatis.annotations.Mapper;
/**
* Mapper
*
* @author wxr
*/
@Mapper
public interface CouponTempleteMapper extends BaseMapperX<CouponTempleteDO> {
default PageResult<CouponTempleteDO> selectPage(CouponTempletePageReqVO reqVO) {
return selectPage(reqVO, new LambdaQueryWrapperX<CouponTempleteDO>()
.eqIfPresent(CouponTempleteDO::getType, reqVO.getType())
.likeIfPresent(CouponTempleteDO::getName, reqVO.getName())
.eqIfPresent(CouponTempleteDO::getCouponNameRemark, reqVO.getCouponNameRemark())
.eqIfPresent(CouponTempleteDO::getImage, reqVO.getImage())
.eqIfPresent(CouponTempleteDO::getCount, reqVO.getCount())
.eqIfPresent(CouponTempleteDO::getLeadCount, reqVO.getLeadCount())
.eqIfPresent(CouponTempleteDO::getUsedCount, reqVO.getUsedCount())
.eqIfPresent(CouponTempleteDO::getGoodsType, reqVO.getGoodsType())
.eqIfPresent(CouponTempleteDO::getProductIds, reqVO.getProductIds())
.eqIfPresent(CouponTempleteDO::getHasUseLimit, reqVO.getHasUseLimit())
.eqIfPresent(CouponTempleteDO::getAtLeast, reqVO.getAtLeast())
.eqIfPresent(CouponTempleteDO::getMoney, reqVO.getMoney())
.eqIfPresent(CouponTempleteDO::getDiscount, reqVO.getDiscount())
.eqIfPresent(CouponTempleteDO::getDiscountLimit, reqVO.getDiscountLimit())
.eqIfPresent(CouponTempleteDO::getMinMoney, reqVO.getMinMoney())
.eqIfPresent(CouponTempleteDO::getMaxMoney, reqVO.getMaxMoney())
.eqIfPresent(CouponTempleteDO::getValidityType, reqVO.getValidityType())
.betweenIfPresent(CouponTempleteDO::getStartUseTime, reqVO.getStartUseTime())
.betweenIfPresent(CouponTempleteDO::getEndUseTime, reqVO.getEndUseTime())
.eqIfPresent(CouponTempleteDO::getFixedTerm, reqVO.getFixedTerm())
.eqIfPresent(CouponTempleteDO::getWhetherLimitless, reqVO.getWhetherLimitless())
.eqIfPresent(CouponTempleteDO::getMaxFetch, reqVO.getMaxFetch())
.eqIfPresent(CouponTempleteDO::getWhetherExpireNotice, reqVO.getWhetherExpireNotice())
.eqIfPresent(CouponTempleteDO::getExpireNoticeFixedTerm, reqVO.getExpireNoticeFixedTerm())
.eqIfPresent(CouponTempleteDO::getWhetherForbidPreference, reqVO.getWhetherForbidPreference())
.eqIfPresent(CouponTempleteDO::getWhetherShow, reqVO.getWhetherShow())
.eqIfPresent(CouponTempleteDO::getDiscountOrderMoney, reqVO.getDiscountOrderMoney())
.eqIfPresent(CouponTempleteDO::getOrderMoney, reqVO.getOrderMoney())
.eqIfPresent(CouponTempleteDO::getWhetherForbidden, reqVO.getWhetherForbidden())
.eqIfPresent(CouponTempleteDO::getOrderGoodsNum, reqVO.getOrderGoodsNum())
.eqIfPresent(CouponTempleteDO::getStatus, reqVO.getStatus())
.betweenIfPresent(CouponTempleteDO::getEndTime, reqVO.getEndTime())
.betweenIfPresent(CouponTempleteDO::getCreateTime, reqVO.getCreateTime())
.orderByDesc(CouponTempleteDO::getId));
}
default List<CouponTempleteDO> selectList(CouponTempleteExportReqVO reqVO) {
return selectList(new LambdaQueryWrapperX<CouponTempleteDO>()
.eqIfPresent(CouponTempleteDO::getType, reqVO.getType())
.likeIfPresent(CouponTempleteDO::getName, reqVO.getName())
.eqIfPresent(CouponTempleteDO::getCouponNameRemark, reqVO.getCouponNameRemark())
.eqIfPresent(CouponTempleteDO::getImage, reqVO.getImage())
.eqIfPresent(CouponTempleteDO::getCount, reqVO.getCount())
.eqIfPresent(CouponTempleteDO::getLeadCount, reqVO.getLeadCount())
.eqIfPresent(CouponTempleteDO::getUsedCount, reqVO.getUsedCount())
.eqIfPresent(CouponTempleteDO::getGoodsType, reqVO.getGoodsType())
.eqIfPresent(CouponTempleteDO::getProductIds, reqVO.getProductIds())
.eqIfPresent(CouponTempleteDO::getHasUseLimit, reqVO.getHasUseLimit())
.eqIfPresent(CouponTempleteDO::getAtLeast, reqVO.getAtLeast())
.eqIfPresent(CouponTempleteDO::getMoney, reqVO.getMoney())
.eqIfPresent(CouponTempleteDO::getDiscount, reqVO.getDiscount())
.eqIfPresent(CouponTempleteDO::getDiscountLimit, reqVO.getDiscountLimit())
.eqIfPresent(CouponTempleteDO::getMinMoney, reqVO.getMinMoney())
.eqIfPresent(CouponTempleteDO::getMaxMoney, reqVO.getMaxMoney())
.eqIfPresent(CouponTempleteDO::getValidityType, reqVO.getValidityType())
.betweenIfPresent(CouponTempleteDO::getStartUseTime, reqVO.getStartUseTime())
.betweenIfPresent(CouponTempleteDO::getEndUseTime, reqVO.getEndUseTime())
.eqIfPresent(CouponTempleteDO::getFixedTerm, reqVO.getFixedTerm())
.eqIfPresent(CouponTempleteDO::getWhetherLimitless, reqVO.getWhetherLimitless())
.eqIfPresent(CouponTempleteDO::getMaxFetch, reqVO.getMaxFetch())
.eqIfPresent(CouponTempleteDO::getWhetherExpireNotice, reqVO.getWhetherExpireNotice())
.eqIfPresent(CouponTempleteDO::getExpireNoticeFixedTerm, reqVO.getExpireNoticeFixedTerm())
.eqIfPresent(CouponTempleteDO::getWhetherForbidPreference, reqVO.getWhetherForbidPreference())
.eqIfPresent(CouponTempleteDO::getWhetherShow, reqVO.getWhetherShow())
.eqIfPresent(CouponTempleteDO::getDiscountOrderMoney, reqVO.getDiscountOrderMoney())
.eqIfPresent(CouponTempleteDO::getOrderMoney, reqVO.getOrderMoney())
.eqIfPresent(CouponTempleteDO::getWhetherForbidden, reqVO.getWhetherForbidden())
.eqIfPresent(CouponTempleteDO::getOrderGoodsNum, reqVO.getOrderGoodsNum())
.eqIfPresent(CouponTempleteDO::getStatus, reqVO.getStatus())
.betweenIfPresent(CouponTempleteDO::getEndTime, reqVO.getEndTime())
.betweenIfPresent(CouponTempleteDO::getCreateTime, reqVO.getCreateTime())
.orderByDesc(CouponTempleteDO::getId));
}
}

View File

@ -1,76 +0,0 @@
package cn.iocoder.yudao.module.coupon.dal.mysql.coupon;
import java.util.*;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.coupon.dal.dataobject.coupon.CouponDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.coupon.controller.admin.coupon.vo.*;
/**
* Mapper
*
* @author wxr
*/
@Mapper
public interface CouponMapper extends BaseMapperX<CouponDO> {
default PageResult<CouponDO> selectPage(CouponPageReqVO reqVO) {
return selectPage(reqVO, new LambdaQueryWrapperX<CouponDO>()
.eqIfPresent(CouponDO::getType, reqVO.getType())
.likeIfPresent(CouponDO::getName, reqVO.getName())
.eqIfPresent(CouponDO::getCouponTypeId, reqVO.getCouponTypeId())
.eqIfPresent(CouponDO::getCouponCode, reqVO.getCouponCode())
.eqIfPresent(CouponDO::getMemberId, reqVO.getMemberId())
.eqIfPresent(CouponDO::getUseOrderId, reqVO.getUseOrderId())
.eqIfPresent(CouponDO::getGoodsType, reqVO.getGoodsType())
.eqIfPresent(CouponDO::getGoodsIds, reqVO.getGoodsIds())
.eqIfPresent(CouponDO::getAtLeast, reqVO.getAtLeast())
.eqIfPresent(CouponDO::getMoney, reqVO.getMoney())
.eqIfPresent(CouponDO::getDiscount, reqVO.getDiscount())
.eqIfPresent(CouponDO::getDiscountLimit, reqVO.getDiscountLimit())
.eqIfPresent(CouponDO::getWhetherForbidPreference, reqVO.getWhetherForbidPreference())
.eqIfPresent(CouponDO::getWhetherExpireNotice, reqVO.getWhetherExpireNotice())
.eqIfPresent(CouponDO::getExpireNoticeFixedTerm, reqVO.getExpireNoticeFixedTerm())
.eqIfPresent(CouponDO::getWhetherNoticed, reqVO.getWhetherNoticed())
.eqIfPresent(CouponDO::getState, reqVO.getState())
.eqIfPresent(CouponDO::getGetType, reqVO.getGetType())
.betweenIfPresent(CouponDO::getFetchTime, reqVO.getFetchTime())
.betweenIfPresent(CouponDO::getUseTime, reqVO.getUseTime())
.betweenIfPresent(CouponDO::getStartTime, reqVO.getStartTime())
.betweenIfPresent(CouponDO::getEndTime, reqVO.getEndTime())
.betweenIfPresent(CouponDO::getCreateTime, reqVO.getCreateTime())
.orderByDesc(CouponDO::getId));
}
default List<CouponDO> selectList(CouponExportReqVO reqVO) {
return selectList(new LambdaQueryWrapperX<CouponDO>()
.eqIfPresent(CouponDO::getType, reqVO.getType())
.likeIfPresent(CouponDO::getName, reqVO.getName())
.eqIfPresent(CouponDO::getCouponTypeId, reqVO.getCouponTypeId())
.eqIfPresent(CouponDO::getCouponCode, reqVO.getCouponCode())
.eqIfPresent(CouponDO::getMemberId, reqVO.getMemberId())
.eqIfPresent(CouponDO::getUseOrderId, reqVO.getUseOrderId())
.eqIfPresent(CouponDO::getGoodsType, reqVO.getGoodsType())
.eqIfPresent(CouponDO::getGoodsIds, reqVO.getGoodsIds())
.eqIfPresent(CouponDO::getAtLeast, reqVO.getAtLeast())
.eqIfPresent(CouponDO::getMoney, reqVO.getMoney())
.eqIfPresent(CouponDO::getDiscount, reqVO.getDiscount())
.eqIfPresent(CouponDO::getDiscountLimit, reqVO.getDiscountLimit())
.eqIfPresent(CouponDO::getWhetherForbidPreference, reqVO.getWhetherForbidPreference())
.eqIfPresent(CouponDO::getWhetherExpireNotice, reqVO.getWhetherExpireNotice())
.eqIfPresent(CouponDO::getExpireNoticeFixedTerm, reqVO.getExpireNoticeFixedTerm())
.eqIfPresent(CouponDO::getWhetherNoticed, reqVO.getWhetherNoticed())
.eqIfPresent(CouponDO::getState, reqVO.getState())
.eqIfPresent(CouponDO::getGetType, reqVO.getGetType())
.betweenIfPresent(CouponDO::getFetchTime, reqVO.getFetchTime())
.betweenIfPresent(CouponDO::getUseTime, reqVO.getUseTime())
.betweenIfPresent(CouponDO::getStartTime, reqVO.getStartTime())
.betweenIfPresent(CouponDO::getEndTime, reqVO.getEndTime())
.betweenIfPresent(CouponDO::getCreateTime, reqVO.getCreateTime())
.orderByDesc(CouponDO::getId));
}
}

View File

@ -1,6 +0,0 @@
/**
* coupon
*
* 1. Controller URL /coumon/ Module
*/
package cn.iocoder.yudao.module.coupon;

View File

@ -1,70 +0,0 @@
package cn.iocoder.yudao.module.coupon.service.CouponTemplete;
import java.util.*;
import javax.validation.*;
import cn.iocoder.yudao.module.coupon.controller.admin.templete.vo.*;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.coupon.dal.dataobject.CouponTemplete.CouponTempleteDO;
/**
* Service
*
* @author wxr
*/
public interface CouponTempleteService {
/**
*
*
* @param createReqVO
* @return
*/
Long create(@Valid CouponTempleteCreateReqVO createReqVO);
/**
*
*
* @param updateReqVO
*/
void update(@Valid CouponTempleteUpdateReqVO updateReqVO);
/**
*
*
* @param id
*/
void delete(Long id);
/**
*
*
* @param id
* @return
*/
CouponTempleteDO get(Long id);
/**
*
*
* @param ids
* @return
*/
List<CouponTempleteDO> getList(Collection<Long> ids);
/**
*
*
* @param pageReqVO
* @return
*/
PageResult<CouponTempleteDO> getPage(CouponTempletePageReqVO pageReqVO);
/**
* , Excel
*
* @param exportReqVO
* @return
*/
List<CouponTempleteDO> getList(CouponTempleteExportReqVO exportReqVO);
}

View File

@ -1,134 +0,0 @@
package cn.iocoder.yudao.module.coupon.service.CouponTemplete;
import cn.iocoder.yudao.module.CouponTemplete.enums.CouponTypeEnum;
import cn.iocoder.yudao.module.CouponTemplete.enums.CouponValidityTypeEnum;
import cn.iocoder.yudao.module.coupon.controller.admin.templete.vo.CouponTempleteCreateReqVO;
import cn.iocoder.yudao.module.coupon.controller.admin.templete.vo.CouponTempleteExportReqVO;
import cn.iocoder.yudao.module.coupon.controller.admin.templete.vo.CouponTempletePageReqVO;
import cn.iocoder.yudao.module.coupon.controller.admin.templete.vo.CouponTempleteUpdateReqVO;
import cn.iocoder.yudao.module.coupon.convert.CouponTemplete.CouponTempleteConvert;
import cn.iocoder.yudao.module.coupon.dal.dataobject.CouponTemplete.CouponTempleteDO;
import cn.iocoder.yudao.module.coupon.dal.mysql.CouponTemplete.CouponTempleteMapper;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import java.util.*;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
import static cn.iocoder.yudao.module.CouponTemplete.enums.ErrorCodeConstants.*;
/**
* Service
*
* @author wxr
*/
@Service
@Validated
public class CouponTempleteServiceImpl implements CouponTempleteService {
@Resource
private CouponTempleteMapper couponTempleteMapper;
@Override
public Long create(CouponTempleteCreateReqVO createReqVO) {
// 插入
CouponTempleteDO couponTempleteDO = CouponTempleteConvert.INSTANCE.convert(createReqVO);
/* 验证类型、判断必填*/
checkCouponType(createReqVO);
/*验证过期类型、判断必填*/
checkValidityType(createReqVO);
couponTempleteMapper.insert(couponTempleteDO);
// 返回
return couponTempleteDO.getId();
}
/*确认优惠券类型*/
private void checkValidityType(CouponTempleteCreateReqVO createReqVO) {
Integer validtyType = createReqVO.getValidityType();
if(CouponValidityTypeEnum.TIME_RANGE_EXPIRTED.getStatus().equals(validtyType)){
if(createReqVO.getStartUseTime() == null||createReqVO.getEndUseTime() == null){
throw exception(START_END_TIME_NOT_NULL);
}
}else{
if(createReqVO.getFixedTerm() == null){
throw exception(FIXED_TERM_NOT_NULL);
}
}
}
private void checkCouponType(CouponTempleteCreateReqVO createReqVO) {
String couponType = createReqVO.getType();
//当type=reward时候需要添加
if(couponType.equals(CouponTypeEnum.REWARD.getName())){
if(createReqVO.getMoney()==null){
throw exception(MONEY_NOT_NULL);
}
}else if(couponType.equals(CouponTypeEnum.DISCOUNT.getName())){
if(createReqVO.getDiscount()==null){
throw exception(DISCOUNT_NOT_NULL);
}
if(createReqVO.getDiscountLimit()==null){
throw exception(DISCOUNT_LIMIT_NOT_NULL);
}
}else if (couponType.equals(CouponTypeEnum.RANDOW.getName())){
//当type为radom时需要添加不能为空
if(createReqVO.getMinMoney()==null||createReqVO.getMaxMoney()==null){
throw exception(MIN_MAX_NOT_NULL);
}
}
}
@Override
public void update(CouponTempleteUpdateReqVO updateReqVO) {
// 校验存在
this.validateExists(updateReqVO.getId());
// 更新
CouponTempleteDO updateObj = CouponTempleteConvert.INSTANCE.convert(updateReqVO);
couponTempleteMapper.updateById(updateObj);
}
@Override
public void delete(Long id) {
// 校验存在
this.validateExists(id);
// 删除
couponTempleteMapper.deleteById(id);
}
private void validateExists(Long id) {
if (couponTempleteMapper.selectById(id) == null) {
throw exception(COUPON_TEMPLETE_NOT_EXISTS);
}
}
@Override
public CouponTempleteDO get(Long id) {
return couponTempleteMapper.selectById(id);
}
@Override
public List<CouponTempleteDO> getList(Collection<Long> ids) {
return couponTempleteMapper.selectBatchIds(ids);
}
@Override
public PageResult<CouponTempleteDO> getPage(CouponTempletePageReqVO pageReqVO) {
return couponTempleteMapper.selectPage(pageReqVO);
}
@Override
public List<CouponTempleteDO> getList(CouponTempleteExportReqVO exportReqVO) {
return couponTempleteMapper.selectList(exportReqVO);
}
}

View File

@ -1,70 +0,0 @@
package cn.iocoder.yudao.module.coupon.service.coupon;
import java.util.*;
import javax.validation.*;
import cn.iocoder.yudao.module.coupon.controller.admin.coupon.vo.*;
import cn.iocoder.yudao.module.coupon.dal.dataobject.coupon.CouponDO;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
/**
* Service
*
* @author wxr
*/
public interface CouponService {
/**
*
*
* @param templateId id
* @return
*/
Long create(Long templateId);
/**
*
*
* @param updateReqVO
*/
void update(@Valid CouponUpdateReqVO updateReqVO);
/**
*
*
* @param id
*/
void delete(Long id);
/**
*
*
* @param id
* @return
*/
CouponDO get(Long id);
/**
*
*
* @param ids
* @return
*/
List<CouponDO> getList(Collection<Long> ids);
/**
*
*
* @param pageReqVO
* @return
*/
PageResult<CouponDO> getPage(CouponPageReqVO pageReqVO);
/**
* , Excel
*
* @param exportReqVO
* @return
*/
List<CouponDO> getList(CouponExportReqVO exportReqVO);
}

View File

@ -1,106 +0,0 @@
package cn.iocoder.yudao.module.coupon.service.coupon;
import cn.hutool.core.bean.BeanUtil;
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
import cn.iocoder.yudao.module.coupon.dal.dataobject.CouponTemplete.CouponTempleteDO;
import cn.iocoder.yudao.module.coupon.dal.mysql.CouponTemplete.CouponTempleteMapper;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import java.util.*;
import cn.iocoder.yudao.module.coupon.controller.admin.coupon.vo.*;
import cn.iocoder.yudao.module.coupon.dal.dataobject.coupon.CouponDO;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.coupon.convert.coupon.CouponConvert;
import cn.iocoder.yudao.module.coupon.dal.mysql.coupon.CouponMapper;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
import static cn.iocoder.yudao.module.CouponTemplete.enums.ErrorCodeConstants.COUPON_NOT_EXISTS;
/**
* Service
*
* @author wxr
*/
@Service
@Validated
public class CouponServiceImpl implements CouponService {
@Resource
private CouponMapper couponMapper;
@Resource
private CouponTempleteMapper couponTempleteMapper;
public Long create(CouponCreateReqVO createReqVO) {
// 插入
CouponDO couponDO = CouponConvert.INSTANCE.convert(createReqVO);
couponMapper.insert(couponDO);
// 返回
return couponDO.getId();
}
/**
*todo id
*@author:wxr
*@date:2022-08-13 3:11
*@Description
*/
@Override
public Long create(Long templateId) {
Long userid = SecurityFrameworkUtils.getLoginUserId();
CouponDO couponDO = CouponDO.builder().memberId(userid).build();
CouponTempleteDO couponTempleteDO = couponTempleteMapper.selectById(templateId);
//todo 缺少判空
BeanUtil.copyProperties(couponTempleteDO,couponTempleteDO);
couponMapper.insert(couponDO);
return couponDO.getId();
}
@Override
public void update(CouponUpdateReqVO updateReqVO) {
// 校验存在
this.validateExists(updateReqVO.getId());
// 更新
CouponDO updateObj = CouponConvert.INSTANCE.convert(updateReqVO);
couponMapper.updateById(updateObj);
}
@Override
public void delete(Long id) {
// 校验存在
this.validateExists(id);
// 删除
couponMapper.deleteById(id);
}
private void validateExists(Long id) {
if (couponMapper.selectById(id) == null) {
throw exception(COUPON_NOT_EXISTS);
}
}
@Override
public CouponDO get(Long id) {
return couponMapper.selectById(id);
}
@Override
public List<CouponDO> getList(Collection<Long> ids) {
return couponMapper.selectBatchIds(ids);
}
@Override
public PageResult<CouponDO> getPage(CouponPageReqVO pageReqVO) {
return couponMapper.selectPage(pageReqVO);
}
@Override
public List<CouponDO> getList(CouponExportReqVO exportReqVO) {
return couponMapper.selectList(exportReqVO);
}
}

View File

@ -1,12 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cn.iocoder.yudao.module.coupon.dal.mysql.CouponTemplete.CouponTempleteMapper">
<!--
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
文档可见https://www.iocoder.cn/MyBatis/x-plugins/
-->
</mapper>

View File

@ -1,12 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cn.iocoder.yudao.module.coupon.dal.mysql.coupon.CouponMapper">
<!--
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
文档可见https://www.iocoder.cn/MyBatis/x-plugins/
-->
</mapper>

View File

@ -0,0 +1,38 @@
package cn.iocoder.yudao.module.promotion.enums.common;
import cn.iocoder.yudao.framework.common.core.IntArrayValuable;
import lombok.AllArgsConstructor;
import lombok.Getter;
import java.util.Arrays;
/**
*
*
* @author
*/
@Getter
@AllArgsConstructor
public enum PromotionDiscountTypeEnum implements IntArrayValuable {
PRICE(1, "减价"), // 具体金额
PERCENT(2, "打折"), // 百分比
;
public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(PromotionDiscountTypeEnum::getType).toArray();
/**
*
*/
private final Integer type;
/**
*
*/
private final String name;
@Override
public int[] array() {
return ARRAYS;
}
}

View File

@ -0,0 +1,46 @@
package cn.iocoder.yudao.module.promotion.enums.coupon;
import cn.iocoder.yudao.framework.common.core.IntArrayValuable;
import java.util.Arrays;
/**
*
*
* @author
*/
public enum CouponTakeTypeEnum implements IntArrayValuable {
BY_USER(1, "直接领取"), // 用户可在首页、每日领劵直接领取
BY_ADMIN(2, "指定发放"), // 后台指定会员赠送优惠劵
;
public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(CouponTakeTypeEnum::getValue).toArray();
/**
*
*/
private final Integer value;
/**
*
*/
private final String name;
CouponTakeTypeEnum(Integer value, String name) {
this.value = value;
this.name = name;
}
public Integer getValue() {
return value;
}
public String getName() {
return name;
}
@Override
public int[] array() {
return ARRAYS;
}
}

View File

@ -0,0 +1,38 @@
package cn.iocoder.yudao.module.promotion.enums.coupon;
import cn.iocoder.yudao.framework.common.core.IntArrayValuable;
import lombok.AllArgsConstructor;
import lombok.Getter;
import java.util.Arrays;
/**
*
*
* @author
*/
@AllArgsConstructor
@Getter
public enum CouponTemplateValidityTypeEnum implements IntArrayValuable {
FIXED_DATE(1, "固定日期"),
FIXED_TERM_TODAY(2, "领取日期"),
;
public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(CouponTemplateValidityTypeEnum::getType).toArray();
/**
*
*/
private final Integer type;
/**
*
*/
private final String name;
@Override
public int[] array() {
return ARRAYS;
}
}

View File

@ -2,24 +2,23 @@ package cn.iocoder.yudao.module.promotion.dal.dataobject.coupon;
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
import cn.iocoder.yudao.module.promotion.enums.common.PromotionProductScopeEnum;
import com.baomidou.mybatisplus.annotation.KeySequence;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.util.Date;
import java.util.List;
// TODO 芋艿:待完善该实体
/**
* DO
*/
@TableName("coupon")
@TableName(value = "promotion_coupon", autoResultMap = true)
@KeySequence("promotion_coupo_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
public class CouponDO extends BaseDO {
// ========== 基本信息 BEGIN ==========
@ -28,7 +27,9 @@ public class CouponDO extends BaseDO {
*/
private Long id;
/**
* {@link CouponTemplateDO} id
*
*
* {@link CouponTemplateDO#getId()}
*/
private Integer templateId;
/**

View File

@ -0,0 +1,154 @@
package cn.iocoder.yudao.module.promotion.dal.dataobject.coupon;
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
import cn.iocoder.yudao.module.promotion.enums.common.PromotionDiscountTypeEnum;
import cn.iocoder.yudao.module.promotion.enums.common.PromotionProductScopeEnum;
import cn.iocoder.yudao.module.promotion.enums.coupon.CouponTakeTypeEnum;
import cn.iocoder.yudao.module.promotion.enums.coupon.CouponTemplateValidityTypeEnum;
import com.baomidou.mybatisplus.annotation.KeySequence;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Date;
import java.util.List;
/**
* DO
*
* {@link CouponDO}
*/
@TableName(value = "promotion_coupon_template", autoResultMap = true)
@KeySequence("promotion_coupon_template_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
@Data
@EqualsAndHashCode(callSuper = true)
public class CouponTemplateDO extends BaseDO {
// ========== 基本信息 BEGIN ==========
/**
*
*/
@TableId
private Long id;
/**
*
*/
private String name;
/**
*
*
* {@link CommonStatusEnum}
*/
private Integer status;
// ========== 基本信息 END ==========
// ========== 领取规则 BEGIN ==========
/**
*
*
* -1 -
*/
private Integer totalCount;
/**
*
*
* -1 -
*/
private Integer takeLimitCount;
/**
*
*
* {@link CouponTakeTypeEnum}
*/
private Integer takeType;
// ========== 领取规则 END ==========
// ========== 使用规则 BEGIN ==========
/**
*
*
* 0 -
* 0 -
*/
private Integer usePrice;
/**
*
*
* {@link PromotionProductScopeEnum}
*/
private Integer productScope;
/**
* SPU
*/
@TableField(typeHandler = JacksonTypeHandler.class)
private List<Long> productSpuIds;
/**
*
*
* {@link CouponTemplateValidityTypeEnum}
*/
private Integer validityType;
/**
* -
*
* {@link #validityType} {@link CouponTemplateValidityTypeEnum#FIXED_DATE}
*/
private Date validStartTime;
/**
* -
*
* {@link #validityType} {@link CouponTemplateValidityTypeEnum#FIXED_DATE}
*/
private Date validEndTime;
/**
* -
*
* {@link #validityType} {@link CouponTemplateValidityTypeEnum#FIXED_TERM_TODAY}
*/
private Integer fixedEndTerm;
// ========== 使用规则 END ==========
// ========== 使用效果 BEGIN ==========
/**
*
*
* {@link PromotionDiscountTypeEnum}
*/
private Integer discountType;
/**
*
*
* 80% 80
*/
private Integer discountPercent;
/**
*
*
* {@link #discountType} {@link PromotionDiscountTypeEnum#PRICE}
*/
private Integer discountPrice;
/**
* {@link #discountType} {@link PromotionDiscountTypeEnum#PRICE}
*
* 20 使 8 1000 20 80
*/
private Integer discountLimitPrice;
// ========== 使用效果 END ==========
// ========== 统计信息 BEGIN ==========
/**
*
*/
private Integer takeCount;
/**
* 使
*/
private Integer useCount;
// ========== 统计信息 END ==========
}

View File

@ -69,7 +69,7 @@ public class RewardActivityDO extends BaseDO {
* SPU
*/
@TableField(typeHandler = JacksonTypeHandler.class)
private List<Long> spuIds;
private List<Long> productSpuIds;
/**
*
*/

View File

@ -114,24 +114,24 @@ public class PriceServiceImpl implements PriceService {
*/
private void calculatePriceForSkuLevel(Long userId, PriceCalculateRespDTO priceCalculate) {
// 获取 SKU 级别的所有优惠信息
Supplier<Double> memberDiscountSupplier = getMemberDiscountSupplier(userId);
Supplier<Double> memberDiscountPercentSupplier = getMemberDiscountPercentSupplier(userId);
Map<Long, DiscountProductDO> discountProducts = discountService.getMatchDiscountProducts(
convertSet(priceCalculate.getOrder().getItems(), PriceCalculateRespDTO.OrderItem::getSkuId));
// 处理每个 SKU 的优惠
priceCalculate.getOrder().getItems().forEach(orderItem -> {
// 获取该 SKU 的优惠信息
Double memberDiscount = memberDiscountSupplier.get();
Double memberDiscountPercent = memberDiscountPercentSupplier.get();
DiscountProductDO discountProduct = discountProducts.get(orderItem.getSkuId());
if (discountProduct != null // 假设优惠价格更贵,则认为没优惠
&& discountProduct.getPromotionPrice() >= orderItem.getOriginalUnitPrice()) {
discountProduct = null;
}
if (memberDiscount == null && discountProduct == null) {
if (memberDiscountPercent == null && discountProduct == null) {
return;
}
// 计算价格,判断选择哪个折扣
Integer memberPrice = memberDiscount != null ? (int) (orderItem.getPayPrice() * memberDiscount / 100) : null;
Integer memberPrice = memberDiscountPercent != null ? (int) (orderItem.getPayPrice() * memberDiscountPercent / 100) : null;
Integer promotionPrice = discountProduct != null ? discountProduct.getPromotionPrice() * orderItem.getCount() : null;
if (memberPrice == null) {
calculatePriceByDiscountActivity(priceCalculate, orderItem, discountProduct, promotionPrice);
@ -166,7 +166,7 @@ public class PriceServiceImpl implements PriceService {
}
// TODO 芋艿:提前实现
private Supplier<Double> getMemberDiscountSupplier(Long userId) {
private Supplier<Double> getMemberDiscountPercentSupplier(Long userId) {
return Suppliers.memoize(() -> {
if (userId == 1) {
return 90d;

View File

@ -198,10 +198,10 @@ public class PriceServiceTest extends BaseMockitoUnitTest {
when(productSkuApi.getSkuList(eq(asSet(10L, 20L, 30L)))).thenReturn(asList(productSku01, productSku02, productSku03));
// mock 方法(限时折扣 DiscountActivity 信息)
RewardActivityDO rewardActivity01 = randomPojo(RewardActivityDO.class, o -> o.setId(1000L).setName("活动 1000 号")
.setSpuIds(asList(10L, 20L)).setConditionType(PromotionConditionTypeEnum.PRICE.getType())
.setProductSpuIds(asList(10L, 20L)).setConditionType(PromotionConditionTypeEnum.PRICE.getType())
.setRules(singletonList(new RewardActivityDO.Rule().setLimit(200).setDiscountPrice(70))));
RewardActivityDO rewardActivity02 = randomPojo(RewardActivityDO.class, o -> o.setId(2000L).setName("活动 2000 号")
.setSpuIds(singletonList(30L)).setConditionType(PromotionConditionTypeEnum.COUNT.getType())
.setProductSpuIds(singletonList(30L)).setConditionType(PromotionConditionTypeEnum.COUNT.getType())
.setRules(asList(new RewardActivityDO.Rule().setLimit(1).setDiscountPrice(10),
new RewardActivityDO.Rule().setLimit(2).setDiscountPrice(60), // 最大可满足,因为是 4 个
new RewardActivityDO.Rule().setLimit(10).setDiscountPrice(100))));
@ -301,7 +301,7 @@ public class PriceServiceTest extends BaseMockitoUnitTest {
when(productSkuApi.getSkuList(eq(asSet(10L, 20L)))).thenReturn(asList(productSku01, productSku02));
// mock 方法(限时折扣 DiscountActivity 信息)
RewardActivityDO rewardActivity01 = randomPojo(RewardActivityDO.class, o -> o.setId(1000L).setName("活动 1000 号")
.setSpuIds(asList(10L, 20L)).setConditionType(PromotionConditionTypeEnum.PRICE.getType())
.setProductSpuIds(asList(10L, 20L)).setConditionType(PromotionConditionTypeEnum.PRICE.getType())
.setRules(singletonList(new RewardActivityDO.Rule().setLimit(351).setDiscountPrice(70))));
Map<RewardActivityDO, Set<Long>> matchRewardActivities = new LinkedHashMap<>();
matchRewardActivities.put(rewardActivity01, asSet(1L, 2L));

View File

@ -1,8 +1,7 @@
<template>
<div class="app-container">
<!-- 搜索工作栏 -->
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
« <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="品牌名称" prop="name">
<el-input v-model="queryParams.name" placeholder="请输入品牌名称" clearable @keyup.enter.native="handleQuery"/>
</el-form-item>