对比新文件 |
| | |
| | | package com.mzl.flower.dto.request.coupon; |
| | | |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import javax.validation.constraints.NotNull; |
| | | import java.util.List; |
| | | |
| | | @ApiModel("优惠券批量操作") |
| | | @Data |
| | | public class BatchCouponTemplateDTO { |
| | | |
| | | |
| | | @ApiModelProperty(value = "ID列表不能为空") |
| | | @NotNull(message = "ID列表不能为空") |
| | | private List<String> idList; |
| | | |
| | | @ApiModelProperty(hidden = true) |
| | | private String updateBy; |
| | | |
| | | } |
对比新文件 |
| | |
| | | package com.mzl.flower.dto.request.coupon; |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import javax.validation.constraints.NotEmpty; |
| | | |
| | | @Data |
| | | public class CreateCouponRecordDTO { |
| | | |
| | | @ApiModelProperty(value = "id") |
| | | private String id; |
| | | |
| | | /** |
| | | * 优惠券ID |
| | | */ |
| | | @ApiModelProperty(value = "优惠券ID") |
| | | @NotEmpty(message = "优惠券ID不能为空") |
| | | private String couponId; |
| | | |
| | | /** |
| | | * 用户id |
| | | */ |
| | | |
| | | @ApiModelProperty(value = "用户id") |
| | | // @NotEmpty(message = "用户id不能为空") |
| | | private String userId; |
| | | |
| | | /** |
| | | * 商户ID |
| | | */ |
| | | @ApiModelProperty(value = "商户ID") |
| | | @NotEmpty(message = "商户ID不能为空") |
| | | private String customerId; |
| | | |
| | | /** |
| | | * 状态(coupon_record_status)未使用、已使用、已过期 |
| | | */ |
| | | // @ApiModelProperty(value = "状态") |
| | | // private String status; |
| | | |
| | | /** |
| | | * 有效开始时间 |
| | | */ |
| | | // @ApiModelProperty(value = "有效开始时间") |
| | | // @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss" ,timezone="GMT+8") |
| | | // @DateTimeFormat |
| | | // @NotNull(message = "有效开始时间不能为空") |
| | | // private LocalDateTime effectiveStart; |
| | | |
| | | /** |
| | | * 有效结束时间 |
| | | */ |
| | | // @ApiModelProperty(value = "有效结束时间") |
| | | // @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss" ,timezone="GMT+8") |
| | | // @DateTimeFormat |
| | | // @NotNull(message = "有效结束时间不能为空") |
| | | // private LocalDateTime effectiveEnd; |
| | | |
| | | /** |
| | | * 使用订单 |
| | | */ |
| | | // @ApiModelProperty(value = "订单号") |
| | | // private String orderId; |
| | | |
| | | /** |
| | | * 使用时间 |
| | | */ |
| | | // @ApiModelProperty(value = "使用时间") |
| | | // @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss" ,timezone="GMT+8") |
| | | // @DateTimeFormat |
| | | // private LocalDateTime usedTime; |
| | | |
| | | } |
对比新文件 |
| | |
| | | package com.mzl.flower.dto.request.coupon; |
| | | |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import javax.validation.constraints.Min; |
| | | import javax.validation.constraints.NotEmpty; |
| | | import javax.validation.constraints.NotNull; |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | |
| | | @Data |
| | | public class CreateCouponTemplateActivyDTO { |
| | | |
| | | @ApiModelProperty(value = "id") |
| | | private String id; |
| | | |
| | | /** |
| | | * 优惠券名称 |
| | | */ |
| | | @ApiModelProperty(value = "couponName") |
| | | @NotEmpty(message = "优惠券名称不能为空") |
| | | private String couponName; |
| | | |
| | | /** |
| | | * 优惠券类型(COUPON_TYPE)满减和无门槛 |
| | | */ |
| | | @ApiModelProperty(value = "优惠券类型(COUPON_TYPE)") |
| | | @NotEmpty(message = "优惠券类型不能为空(COUPON_TYPE)") |
| | | private String couponDiscountType; |
| | | |
| | | /** |
| | | * 领取渠道(COUPON_GET_TYPE)首页弹窗、活动入口、领券中心 |
| | | */ |
| | | @ApiModelProperty(value = "领取渠道(COUPON_GET_TYPE)") |
| | | @NotEmpty(message = "领取渠道不能为空(COUPON_GET_TYPE)") |
| | | private String getType; |
| | | |
| | | |
| | | /** |
| | | * 优惠券描述(使用规则) |
| | | */ |
| | | @ApiModelProperty(value = "使用规则") |
| | | @NotEmpty(message = "使用规则不能为空") |
| | | private String couponDescription; |
| | | |
| | | |
| | | /** |
| | | * 领取开始时间 |
| | | */ |
| | | @ApiModelProperty(value = "领取开始时间") |
| | | @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss" ,timezone="GMT+8") |
| | | @DateTimeFormat |
| | | @NotNull(message = "领取开始时间不能为空") |
| | | private LocalDateTime getStartDate; |
| | | |
| | | /** |
| | | * 领取结束时间 |
| | | */ |
| | | @ApiModelProperty(value = "领取结束时间") |
| | | @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss" ,timezone="GMT+8") |
| | | @DateTimeFormat |
| | | @NotNull(message = "领取结束时间不能为空") |
| | | private LocalDateTime getEndDate; |
| | | |
| | | |
| | | /** |
| | | * 使用时间类型(COUPON_USAGE_TYPE)与领取时间一致、固定时间、领取后有效 |
| | | */ |
| | | @ApiModelProperty(value = "使用时间类型(COUPON_USAGE_TYPE)") |
| | | @NotEmpty(message = "使用时间类型不能为空(COUPON_USAGE_TYPE)") |
| | | private String usageType; |
| | | |
| | | |
| | | /** |
| | | * 领取后有效类型(COUPON_usage_time_type)天、小时、分钟 |
| | | */ |
| | | @ApiModelProperty(value = "领取后有效类型 (COUPON_USAGE_TIME_TYPE)") |
| | | private String usageTimeType; |
| | | |
| | | /** |
| | | * 领取后有效时间整数,比如90(天,小时,分钟) |
| | | */ |
| | | @ApiModelProperty(value = "领取后有效时间整数") |
| | | private Integer usageTimeNum; |
| | | |
| | | |
| | | /** |
| | | * 使用开始时间 |
| | | */ |
| | | @ApiModelProperty(value = "使用时间-固定时间-开始日期") |
| | | @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss" ,timezone="GMT+8") |
| | | @DateTimeFormat |
| | | private LocalDateTime usageStartDate; |
| | | |
| | | /** |
| | | * 使用结束时间 |
| | | */ |
| | | @ApiModelProperty(value = "使用时间-固定时间-结束日期") |
| | | @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss" ,timezone="GMT+8") |
| | | @DateTimeFormat |
| | | private LocalDateTime usageEndDate; |
| | | |
| | | |
| | | /** |
| | | * 使用条件,最小订单金额(可选)=》使用条件 |
| | | */ |
| | | @ApiModelProperty(value = "使用条件,满多少钱") |
| | | @NotNull(message = "使用条件不能为空") |
| | | private BigDecimal minOrderAmount; |
| | | |
| | | /** |
| | | * 优惠券面值 折扣值(百分比或金额) |
| | | */ |
| | | @ApiModelProperty(value = "优惠券面值") |
| | | @NotNull(message = "优惠券面值不能为空") |
| | | private BigDecimal couponDiscountValue; |
| | | |
| | | |
| | | |
| | | /** |
| | | * 发放数量 |
| | | */ |
| | | @ApiModelProperty(value = "发放数量") |
| | | @NotNull(message = "发放数量不能为空") |
| | | @Min(value = 1,message = "发放数量必须大于0") |
| | | private Integer couponAmount; |
| | | |
| | | |
| | | /** |
| | | * 每人限领 |
| | | */ |
| | | @ApiModelProperty(value = "每人限领") |
| | | @NotNull(message = "每人限领不能为空") |
| | | @Min(value = 1,message = "每人限领必须大于0") |
| | | private Integer getLimit; |
| | | |
| | | |
| | | } |
对比新文件 |
| | |
| | | package com.mzl.flower.dto.request.coupon; |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.AllArgsConstructor; |
| | | import lombok.Data; |
| | | import lombok.NoArgsConstructor; |
| | | |
| | | import javax.validation.constraints.NotEmpty; |
| | | import javax.validation.constraints.NotNull; |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | import java.util.List; |
| | | |
| | | @NoArgsConstructor |
| | | @AllArgsConstructor |
| | | @Data |
| | | public class CreateCouponTemplateBO { |
| | | |
| | | private String id; |
| | | |
| | | |
| | | /** |
| | | * 优惠券种类(活动优惠券、用户优惠券、会员优惠券,积分优惠券) |
| | | */ |
| | | private String category; |
| | | /** |
| | | * 优惠券代码(唯一) |
| | | */ |
| | | private String couponCode; |
| | | |
| | | /** |
| | | * 优惠券名称 |
| | | */ |
| | | private String couponName; |
| | | |
| | | /** |
| | | * 优惠券描述(使用规则) |
| | | */ |
| | | private String couponDescription; |
| | | |
| | | /** |
| | | * 发放数量 |
| | | */ |
| | | private Integer couponAmount; |
| | | |
| | | /** |
| | | * 优惠券类型(COUPON_TYPE)满减和无门槛 |
| | | */ |
| | | private String couponDiscountType; |
| | | |
| | | /** |
| | | * 优惠券面值 折扣值(百分比或金额) |
| | | */ |
| | | private BigDecimal couponDiscountValue; |
| | | |
| | | /** |
| | | * 使用条件,最小订单金额(可选)=》使用条件 |
| | | */ |
| | | private BigDecimal minOrderAmount; |
| | | |
| | | /** |
| | | * 最大折扣金额(可选,仅对百分比折扣类型适用) |
| | | */ |
| | | private BigDecimal maxDiscountAmount; |
| | | |
| | | /** |
| | | * 领取渠道(COUPON_GET_TYPE)首页弹窗、活动入口、领券中心 |
| | | */ |
| | | private String getType; |
| | | |
| | | /** |
| | | * 领取用户类型(COUPON_GET_USER_TYPE)全部用户,指定用户 |
| | | */ |
| | | private String getUserType; |
| | | |
| | | /** |
| | | * 领取开始时间 |
| | | */ |
| | | private LocalDateTime getStartDate; |
| | | |
| | | /** |
| | | * 领取结束时间 |
| | | */ |
| | | private LocalDateTime getEndDate; |
| | | |
| | | /** |
| | | * 每人限领 |
| | | */ |
| | | private Integer getLimit; |
| | | |
| | | /** |
| | | * 使用时间类型(COUPON_USAGE_TIME_TYPE)与领取时间一致、固定时间、领取后有效 |
| | | */ |
| | | private String usageType; |
| | | |
| | | /** |
| | | * 使用次数限制 |
| | | */ |
| | | private Integer usageLimit; |
| | | |
| | | /** |
| | | * 每个用户的使用次数限制 |
| | | */ |
| | | private Integer usagePerUser; |
| | | |
| | | /** |
| | | * 使用开始时间 |
| | | */ |
| | | private LocalDateTime usageStartDate; |
| | | |
| | | /** |
| | | * 使用结束时间 |
| | | */ |
| | | private LocalDateTime usageEndDate; |
| | | |
| | | /** |
| | | * 领取后有效类型(COUPON_usage_time_type)天、小时、分钟 |
| | | */ |
| | | private String usageTimeType; |
| | | |
| | | /** |
| | | * 领取后有效时间整数,比如90(天,小时,分钟) |
| | | */ |
| | | private Integer usageTimeNum; |
| | | |
| | | /** |
| | | * 优惠券状态(COUPON_STATUS) |
| | | */ |
| | | private String status; |
| | | |
| | | /** |
| | | * 兑换积分 |
| | | */ |
| | | private Integer point; |
| | | |
| | | |
| | | /** |
| | | * |
| | | */ |
| | | @ApiModelProperty(value = "会员等级") |
| | | @NotEmpty(message = "会员等级不能为空") |
| | | private String vipGrade; |
| | | |
| | | |
| | | @ApiModelProperty(value = "指定的用户列表id") |
| | | @NotNull(message = "指定的用户列表id不能为空") |
| | | private List<String> pointCostomIdList; |
| | | |
| | | } |
对比新文件 |
| | |
| | | package com.mzl.flower.dto.request.coupon; |
| | | |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.mzl.flower.base.BaseAutoEntity; |
| | | import com.mzl.flower.base.BaseEntity; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import javax.validation.constraints.NotEmpty; |
| | | import javax.validation.constraints.NotNull; |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | public class CreateCouponTemplateDTO { |
| | | |
| | | @ApiModelProperty(value = "id") |
| | | private String id; |
| | | |
| | | /** |
| | | * 优惠券名称 |
| | | */ |
| | | @ApiModelProperty(value = "couponName") |
| | | @NotEmpty(message = "优惠券名称不能为空") |
| | | private String couponName; |
| | | |
| | | /** |
| | | * 优惠券类型(COUPON_TYPE)满减和无门槛 |
| | | */ |
| | | @ApiModelProperty(value = "优惠券类型") |
| | | @NotEmpty(message = "优惠券类型不能为空") |
| | | private String couponDiscountType; |
| | | |
| | | /** |
| | | * 领取渠道(COUPON_GET_TYPE)首页弹窗、活动入口、领券中心 |
| | | */ |
| | | @ApiModelProperty(value = "领取渠道") |
| | | @NotEmpty(message = "领取渠道不能为空") |
| | | private String getType; |
| | | |
| | | |
| | | /** |
| | | * 优惠券描述(使用规则) |
| | | */ |
| | | @ApiModelProperty(value = "使用规则") |
| | | @NotEmpty(message = "使用规则不能为空") |
| | | private String couponDescription; |
| | | |
| | | |
| | | /** |
| | | * 领取开始时间 |
| | | */ |
| | | @ApiModelProperty(value = "领取开始时间") |
| | | @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss" ,timezone="GMT+8") |
| | | @DateTimeFormat |
| | | @NotNull(message = "领取开始时间不能为空") |
| | | private LocalDateTime getStartDate; |
| | | |
| | | /** |
| | | * 领取结束时间 |
| | | */ |
| | | @ApiModelProperty(value = "领取结束时间") |
| | | @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss" ,timezone="GMT+8") |
| | | @DateTimeFormat |
| | | @NotNull(message = "领取结束时间不能为空") |
| | | private LocalDateTime getEndDate; |
| | | |
| | | |
| | | /** |
| | | * 使用时间类型(COUPON_USAGE_TIME_TYPE)与领取时间一致、固定时间、领取后有效 |
| | | */ |
| | | @ApiModelProperty(value = "使用时间类型") |
| | | @NotEmpty(message = "使用时间类型不能为空") |
| | | private String usageType; |
| | | |
| | | |
| | | /** |
| | | * 领取后有效类型(COUPON_usage_time_type)天、小时、分钟 |
| | | */ |
| | | @ApiModelProperty(value = "领取后有效类型 天、小时、分钟") |
| | | private String usageTimeType; |
| | | |
| | | /** |
| | | * 领取后有效时间整数,比如90(天,小时,分钟) |
| | | */ |
| | | @ApiModelProperty(value = "领取后有效时间整数") |
| | | private Integer usageTimeNum; |
| | | |
| | | |
| | | /** |
| | | * 使用开始时间 |
| | | */ |
| | | @ApiModelProperty(value = "使用时间-固定时间-开始日期") |
| | | @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss" ,timezone="GMT+8") |
| | | @DateTimeFormat |
| | | private LocalDateTime usageStartDate; |
| | | |
| | | /** |
| | | * 使用结束时间 |
| | | */ |
| | | @ApiModelProperty(value = "使用时间-固定时间-结束日期") |
| | | @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss" ,timezone="GMT+8") |
| | | @DateTimeFormat |
| | | private LocalDateTime usageEndDate; |
| | | |
| | | |
| | | /** |
| | | * 使用条件,最小订单金额(可选)=》使用条件 |
| | | */ |
| | | @ApiModelProperty(value = "使用条件,满多少钱") |
| | | @NotNull(message = "使用条件不能为空") |
| | | private BigDecimal minOrderAmount; |
| | | |
| | | /** |
| | | * 优惠券面值 折扣值(百分比或金额) |
| | | */ |
| | | @ApiModelProperty(value = "优惠券面值") |
| | | @NotNull(message = "优惠券面值不能为空") |
| | | private BigDecimal couponDiscountValue; |
| | | |
| | | |
| | | |
| | | /** |
| | | * 发放数量 |
| | | */ |
| | | @ApiModelProperty(value = "发放数量") |
| | | @NotNull(message = "发放数量不能为空") |
| | | private Integer couponAmount; |
| | | |
| | | |
| | | /** |
| | | * 每人限领 |
| | | */ |
| | | @ApiModelProperty(value = "每人限领") |
| | | @NotNull(message = "每人限领不能为空") |
| | | private Integer getLimit; |
| | | |
| | | |
| | | } |
对比新文件 |
| | |
| | | package com.mzl.flower.dto.request.coupon; |
| | | |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import javax.validation.constraints.Min; |
| | | import javax.validation.constraints.NotEmpty; |
| | | import javax.validation.constraints.NotNull; |
| | | import java.math.BigDecimal; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 积分优惠券 |
| | | */ |
| | | @Data |
| | | public class CreateCouponTemplatePointDTO { |
| | | |
| | | @ApiModelProperty(value = "id") |
| | | private String id; |
| | | |
| | | /** |
| | | * 优惠券名称 |
| | | */ |
| | | |
| | | @ApiModelProperty(value = "优惠券名称") |
| | | @NotEmpty(message = "优惠券名称不能为空") |
| | | private String couponName; |
| | | |
| | | |
| | | /** |
| | | * 优惠券类型(COUPON_TYPE)满减和无门槛 |
| | | */ |
| | | @ApiModelProperty(value = "优惠券类型") |
| | | @NotEmpty(message = "优惠券类型不能为空") |
| | | private String couponDiscountType; |
| | | |
| | | /** |
| | | * 优惠券描述(使用规则) |
| | | */ |
| | | @ApiModelProperty(value = "使用规则") |
| | | @NotEmpty(message = "使用规则不能为空") |
| | | private String couponDescription; |
| | | |
| | | /** |
| | | * 领取后有效类型(COUPON_usage_time_type)天、小时、分钟 |
| | | */ |
| | | @ApiModelProperty(value = "领取后有效类型(COUPON_USAGE_TYPE)天、小时、分钟") |
| | | @NotEmpty(message = "领取后有效类型不能为空") |
| | | private String usageTimeType; |
| | | |
| | | /** |
| | | * 领取后有效时间整数,比如90(天,小时,分钟) |
| | | */ |
| | | @ApiModelProperty(value ="领取后有效时间整数,比如90(天,小时,分钟)" ) |
| | | @NotNull(message = "领取后有效时间不能为空") |
| | | @Min(value = 1,message = "领取后有效时间必须大于等于1") |
| | | private Integer usageTimeNum; |
| | | |
| | | /** |
| | | * 使用条件,最小订单金额(可选)=》使用条件 |
| | | */ |
| | | @ApiModelProperty(value = "使用条件") |
| | | @NotNull(message = "使用条件不能为空") |
| | | private BigDecimal minOrderAmount; |
| | | |
| | | /** |
| | | * 优惠券面值 折扣值(百分比或金额) |
| | | */ |
| | | @ApiModelProperty(value = "优惠券面值") |
| | | @NotNull(message = "优惠券面值不能为空") |
| | | @Min(value = 1,message = "优惠券面值大于0") |
| | | private BigDecimal couponDiscountValue; |
| | | |
| | | /** |
| | | * 库存 |
| | | */ |
| | | @ApiModelProperty(value = "库存") |
| | | @NotNull(message = "库存不能为空") |
| | | @Min(value = 1,message = "库存数量必须大于0") |
| | | private Integer couponAmount; |
| | | |
| | | |
| | | @ApiModelProperty(value = "积分数量") |
| | | @NotNull(message = "积分数量不能为空") |
| | | @Min(value = 1,message = "积分数量必须大于0") |
| | | private Integer point; |
| | | |
| | | |
| | | } |
对比新文件 |
| | |
| | | package com.mzl.flower.dto.request.coupon; |
| | | |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import javax.validation.constraints.Min; |
| | | import javax.validation.constraints.NotEmpty; |
| | | import javax.validation.constraints.NotNull; |
| | | import java.math.BigDecimal; |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | public class CreateCouponTemplateUserDTO { |
| | | |
| | | @ApiModelProperty(value = "id") |
| | | private String id; |
| | | |
| | | /** |
| | | * 优惠券名称 |
| | | */ |
| | | |
| | | @ApiModelProperty(value = "优惠券名称") |
| | | @NotEmpty(message = "优惠券名称不能为空") |
| | | private String couponName; |
| | | |
| | | |
| | | /** |
| | | * 优惠券类型(COUPON_TYPE)满减和无门槛 |
| | | */ |
| | | @ApiModelProperty(value = "优惠券类型") |
| | | @NotEmpty(message = "优惠券类型不能为空") |
| | | private String couponDiscountType; |
| | | |
| | | /** |
| | | * 优惠券描述(使用规则) |
| | | */ |
| | | @ApiModelProperty(value = "使用规则") |
| | | @NotEmpty(message = "使用规则不能为空") |
| | | private String couponDescription; |
| | | |
| | | /** |
| | | * 领取后有效类型(COUPON_usage_time_type)天、小时、分钟 |
| | | */ |
| | | @ApiModelProperty(value = "领取后有效类型(COUPON_USAGE_TYPE)天、小时、分钟") |
| | | @NotEmpty(message = "领取后有效类型不能为空") |
| | | private String usageTimeType; |
| | | |
| | | /** |
| | | * 领取后有效时间整数,比如90(天,小时,分钟) |
| | | */ |
| | | @ApiModelProperty(value ="领取后有效时间整数,比如90(天,小时,分钟)" ) |
| | | @NotNull(message = "领取后有效时间不能为空") |
| | | @Min(value = 1,message = "领取后有效时间必须大于0") |
| | | private Integer usageTimeNum; |
| | | |
| | | /** |
| | | * 使用条件,最小订单金额(可选)=》使用条件 |
| | | */ |
| | | @ApiModelProperty(value = "使用条件") |
| | | @NotNull(message = "使用条件不能为空") |
| | | private BigDecimal minOrderAmount; |
| | | |
| | | /** |
| | | * 优惠券面值 折扣值(百分比或金额) |
| | | */ |
| | | @ApiModelProperty(value = "优惠券面值") |
| | | @NotNull(message = "优惠券面值不能为空") |
| | | @Min(value = 1,message = "优惠券面值大于0") |
| | | private BigDecimal couponDiscountValue; |
| | | |
| | | |
| | | @ApiModelProperty(value = "指定的用户列表id") |
| | | @NotNull(message = "指定的用户列表id不能为空") |
| | | private List<String> pointCostomIdList; |
| | | |
| | | } |
对比新文件 |
| | |
| | | package com.mzl.flower.dto.request.coupon; |
| | | |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import javax.validation.constraints.NotEmpty; |
| | | import javax.validation.constraints.NotNull; |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | |
| | | @Data |
| | | public class CreateCouponTemplateVipDTO { |
| | | |
| | | @ApiModelProperty(value = "id") |
| | | private String id; |
| | | |
| | | /** |
| | | * 优惠券名称 |
| | | */ |
| | | |
| | | @ApiModelProperty(value = "优惠券名称") |
| | | @NotEmpty(message = "优惠券名称不能为空") |
| | | private String couponName; |
| | | |
| | | /** |
| | | * 优惠券描述(使用规则) |
| | | */ |
| | | @ApiModelProperty(value = "使用规则") |
| | | @NotEmpty(message = "使用规则不能为空") |
| | | private String couponDescription; |
| | | |
| | | /** |
| | | * 优惠券类型(COUPON_TYPE)满减和无门槛 |
| | | */ |
| | | @ApiModelProperty(value = "优惠券类型") |
| | | @NotEmpty(message = "优惠券类型不能为空") |
| | | private String couponDiscountType; |
| | | |
| | | /** |
| | | * 优惠券面值 折扣值(百分比或金额) |
| | | */ |
| | | @ApiModelProperty(value = "优惠券面值") |
| | | @NotNull(message = "优惠券面值不能为空") |
| | | private BigDecimal couponDiscountValue; |
| | | |
| | | /** |
| | | * 使用条件,最小订单金额(可选)=》使用条件 |
| | | */ |
| | | @ApiModelProperty(value = "使用条件") |
| | | @NotNull(message = "使用条件不能为空") |
| | | private BigDecimal minOrderAmount; |
| | | |
| | | |
| | | /** |
| | | * 会员等级 |
| | | */ |
| | | @ApiModelProperty(value = "会员等级") |
| | | @NotEmpty(message = "会员等级不能为空") |
| | | private String vipGrade; |
| | | |
| | | } |
对比新文件 |
| | |
| | | package com.mzl.flower.dto.request.coupon; |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | |
| | | @Data |
| | | public class QueryCouponDTO extends QueryCouponVipDTO { |
| | | |
| | | |
| | | @ApiModelProperty(value = "id") |
| | | private String id; |
| | | |
| | | @ApiModelProperty(value = "优惠券名称") |
| | | private String name; |
| | | |
| | | @ApiModelProperty(value = "优惠券类型") |
| | | private String couponDiscountType; |
| | | |
| | | @ApiModelProperty(value = "领取渠道") |
| | | private String getType; |
| | | |
| | | @ApiModelProperty(value = "领取用户类型") |
| | | private String getUserType; |
| | | |
| | | @ApiModelProperty(value = "优惠券种类(活动优惠券、用户优惠券、会员优惠券,积分优惠券)") |
| | | private String category; |
| | | |
| | | } |
对比新文件 |
| | |
| | | package com.mzl.flower.dto.request.coupon; |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | |
| | | @Data |
| | | public class QueryCouponRecordDTO { |
| | | |
| | | |
| | | @ApiModelProperty(value = "id") |
| | | private String id; |
| | | |
| | | @ApiModelProperty(value = "优惠券名称") |
| | | private String name; |
| | | |
| | | @ApiModelProperty(value = "优惠券类型") |
| | | private String couponDiscountType; |
| | | |
| | | @ApiModelProperty(value = "订单号") |
| | | private String orderNo; |
| | | |
| | | @ApiModelProperty(value = "用户id/店铺名称") |
| | | private String keyword; |
| | | |
| | | @ApiModelProperty(value = "联系方式") |
| | | private String tel; |
| | | |
| | | @ApiModelProperty(value = "领取渠道") |
| | | private String getType; |
| | | |
| | | @ApiModelProperty(value = "状态") |
| | | private String status; |
| | | |
| | | @ApiModelProperty(value = "领取用户类型-全部用户,指定用户") |
| | | private String getUserType; |
| | | |
| | | } |
对比新文件 |
| | |
| | | package com.mzl.flower.dto.request.coupon; |
| | | |
| | | import lombok.Data; |
| | | |
| | | |
| | | @Data |
| | | public class QueryCouponStatisticsBO extends QueryCouponStatisticsDTO{ |
| | | |
| | | // @ApiModelProperty(value = "优惠券名称") |
| | | // private String name; |
| | | /** |
| | | * 优惠券总数 |
| | | */ |
| | | private String category; |
| | | |
| | | |
| | | |
| | | } |
对比新文件 |
| | |
| | | package com.mzl.flower.dto.request.coupon; |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | |
| | | @Data |
| | | public class QueryCouponStatisticsDTO { |
| | | |
| | | // @ApiModelProperty(value = "优惠券名称") |
| | | // private String name; |
| | | |
| | | @ApiModelProperty(hidden = true) |
| | | private String category; |
| | | |
| | | |
| | | } |
对比新文件 |
| | |
| | | package com.mzl.flower.dto.request.coupon; |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | |
| | | @Data |
| | | public class QueryCouponVipDTO { |
| | | |
| | | @ApiModelProperty(value = "优惠券名称") |
| | | private String name; |
| | | |
| | | @ApiModelProperty(value = "优惠券类型") |
| | | private String couponDiscountType; |
| | | |
| | | |
| | | @ApiModelProperty(value = "id") |
| | | private String id; |
| | | |
| | | |
| | | } |
对比新文件 |
| | |
| | | package com.mzl.flower.dto.response.coupon; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.mzl.flower.base.AbstractTransDTO; |
| | | import com.mzl.flower.base.annotation.DictTrans; |
| | | import com.mzl.flower.entity.coupon.CouponTemplateDO; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | |
| | | @Data |
| | | public class CouponRecordResultVO extends AbstractTransDTO { |
| | | |
| | | @ApiModelProperty(value = "ID ") |
| | | private String id; |
| | | |
| | | |
| | | |
| | | @ApiModelProperty(value = "领取用户类型(COUPON_GET_USER_TYPE)") |
| | | @DictTrans(target = "getUserTypeName",codeType = "COUPON_GET_USER_TYPE") |
| | | private String getUserType; |
| | | |
| | | /** |
| | | * 领取用户类型(COUPON_GET_USER_TYPE)全部用户,指定用户 |
| | | */ |
| | | @ApiModelProperty(value = "领取用户类型") |
| | | private String getUserTypeName; |
| | | |
| | | |
| | | |
| | | /** |
| | | * 商户名称 |
| | | */ |
| | | @ApiModelProperty(value = "店铺名称") |
| | | private String customerName; |
| | | |
| | | /** |
| | | * 电话 |
| | | */ |
| | | @ApiModelProperty(value = "联系方式") |
| | | private String tel; |
| | | |
| | | /** |
| | | * 优惠券名称 |
| | | */ |
| | | @ApiModelProperty(value = "优惠券名称") |
| | | private String couponName; |
| | | |
| | | |
| | | @ApiModelProperty(value = "优惠券类型(COUPON_TYPE) ") |
| | | @DictTrans(target = "couponDiscountTypeName",codeType = "COUPON_TYPE") |
| | | private String couponDiscountType; |
| | | |
| | | |
| | | @ApiModelProperty(value = "优惠券类型 ") |
| | | private String couponDiscountTypeName; |
| | | |
| | | |
| | | @ApiModelProperty(value = "状态(COUPON_RECORD_STATUS)") |
| | | @DictTrans(target = "statusName",codeType = "COUPON_USED_STATUS") |
| | | private String status; |
| | | /** |
| | | * 状态名称 |
| | | */ |
| | | @ApiModelProperty(value = "状态名称") |
| | | private String statusName; |
| | | |
| | | /** |
| | | * 领取结束时间 |
| | | */ |
| | | @ApiModelProperty(value = "领取时间") |
| | | @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss" ,timezone="GMT+8") |
| | | @DateTimeFormat |
| | | private LocalDateTime createTime; |
| | | |
| | | /** |
| | | * 有效开始时间 |
| | | */ |
| | | @ApiModelProperty(value = "有效开始时间") |
| | | @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss" ,timezone="GMT+8") |
| | | @DateTimeFormat |
| | | private LocalDateTime effectiveStart; |
| | | |
| | | /** |
| | | * 有效结束时间 |
| | | */ |
| | | @ApiModelProperty(value = "有效结束时间") |
| | | @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss" ,timezone="GMT+8") |
| | | @DateTimeFormat |
| | | private LocalDateTime effectiveEnd; |
| | | |
| | | |
| | | /** |
| | | * 优惠券面值 |
| | | */ |
| | | @ApiModelProperty(value = "优惠券面值") |
| | | private BigDecimal couponDiscountValue; |
| | | |
| | | /** |
| | | * 使用条件(满多少钱) |
| | | */ |
| | | @ApiModelProperty(value = "使用条件") |
| | | private BigDecimal minOrderAmount; |
| | | |
| | | /** |
| | | * 领取渠道(COUPON_GET_TYPE)首页弹窗、活动入口、领券中心 |
| | | */ |
| | | @ApiModelProperty(value = "领取渠道(COUPON_GET_TYPE)") |
| | | @DictTrans(target = "getTypeName",codeType = "COUPON_GET_TYPE") |
| | | private String getType; |
| | | |
| | | /** |
| | | * 领取渠道(COUPON_GET_TYPE)首页弹窗、活动入口、领券中心 |
| | | */ |
| | | @ApiModelProperty(value = "领取渠道") |
| | | private String getTypeName; |
| | | |
| | | |
| | | /** |
| | | * 订单号 |
| | | */ |
| | | @ApiModelProperty(value = "订单号") |
| | | private String orderNo; |
| | | |
| | | |
| | | } |
对比新文件 |
| | |
| | | package com.mzl.flower.dto.response.coupon; |
| | | |
| | | import com.mzl.flower.entity.coupon.CouponRecordDO; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class CouponRecordVO extends CouponRecordDO { |
| | | |
| | | /** |
| | | * 优惠券类型名称 COUPON_TYPE)满减和无门槛 |
| | | */ |
| | | private String couponDiscountTypeName; |
| | | |
| | | /** |
| | | * 领取渠道(COUPON_GET_TYPE)首页弹窗、活动入口、领券中心 |
| | | */ |
| | | private String getTypeName; |
| | | |
| | | /** |
| | | * 领取用户类型(COUPON_GET_USER_TYPE)全部用户,指定用户 |
| | | */ |
| | | private String getUserTypeName; |
| | | |
| | | |
| | | /** |
| | | * 状态名称 |
| | | */ |
| | | private String statusName; |
| | | |
| | | /** |
| | | * 商户名称 |
| | | */ |
| | | private String customerName; |
| | | |
| | | /** |
| | | * 电话 |
| | | */ |
| | | private String tel; |
| | | |
| | | |
| | | } |
对比新文件 |
| | |
| | | package com.mzl.flower.dto.response.coupon; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.mzl.flower.base.AbstractTransDTO; |
| | | import com.mzl.flower.base.annotation.DictTrans; |
| | | import com.mzl.flower.entity.coupon.CouponTemplateDO; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | |
| | | @Data |
| | | @ApiModel("活动优惠券") |
| | | public class CouponTemplateActivyVO extends AbstractTransDTO { |
| | | |
| | | @ApiModelProperty(value = "ID") |
| | | private String id; |
| | | |
| | | /** |
| | | * 优惠券名称 |
| | | */ |
| | | @ApiModelProperty(value = "优惠券名称") |
| | | private String couponName; |
| | | |
| | | /** |
| | | * 优惠券描述(使用规则) |
| | | */ |
| | | @ApiModelProperty(value = "优惠券描述(使用规则)") |
| | | private String couponDescription; |
| | | |
| | | /** |
| | | * 发放数量 |
| | | */ |
| | | @ApiModelProperty(value = "总数") |
| | | private Integer couponAmount; |
| | | |
| | | /** |
| | | * 优惠券类型(COUPON_TYPE)满减和无门槛 |
| | | */ |
| | | @ApiModelProperty(value = "优惠券类型(COUPON_TYPE) ") |
| | | @DictTrans(target = "couponDiscountTypeName",codeType = "COUPON_TYPE") |
| | | private String couponDiscountType; |
| | | |
| | | @ApiModelProperty(value = "领取用户类型") |
| | | @DictTrans(target = "getUserTypeName",codeType = "COUPON_GET_USER_TYPE") |
| | | private String getUserType; |
| | | |
| | | /** |
| | | * 优惠券面值 折扣值(百分比或金额) |
| | | */ |
| | | @ApiModelProperty(value = "优惠券面值") |
| | | private BigDecimal couponDiscountValue; |
| | | |
| | | /** |
| | | * 使用条件,最小订单金额(可选)=》使用条件 |
| | | */ |
| | | @ApiModelProperty(value = "使用条件") |
| | | private BigDecimal minOrderAmount; |
| | | |
| | | |
| | | /** |
| | | * 领取开始时间 |
| | | */ |
| | | @ApiModelProperty(value = "领取开始时间") |
| | | @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss" ,timezone="GMT+8") |
| | | @DateTimeFormat |
| | | private LocalDateTime getStartDate; |
| | | |
| | | /** |
| | | * 领取结束时间 |
| | | */ |
| | | @ApiModelProperty(value = "领取结束时间") |
| | | @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss" ,timezone="GMT+8") |
| | | @DateTimeFormat |
| | | private LocalDateTime getEndDate; |
| | | |
| | | |
| | | /** |
| | | * 优惠券状态(COUPON_STATUS) |
| | | */ |
| | | @ApiModelProperty(value = "优惠券状态(COUPON_STATUS)") |
| | | @DictTrans(target = "statusName",codeType = "COUPON_STATUS") |
| | | private String status; |
| | | |
| | | |
| | | |
| | | @ApiModelProperty(value = "使用开始时间") |
| | | @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss" ,timezone="GMT+8") |
| | | @DateTimeFormat |
| | | private LocalDateTime usageStartDate; |
| | | |
| | | /** |
| | | * 使用结束时间 |
| | | */ |
| | | @ApiModelProperty(value = "使用结束时间") |
| | | @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss" ,timezone="GMT+8") |
| | | @DateTimeFormat |
| | | private LocalDateTime usageEndDate; |
| | | |
| | | |
| | | /** |
| | | * 优惠券类型名称 COUPON_TYPE)满减和无门槛 |
| | | */ |
| | | @ApiModelProperty(value = "优惠券类型名称 ") |
| | | private String couponDiscountTypeName; |
| | | |
| | | /** |
| | | * 状态名称 |
| | | */ |
| | | @ApiModelProperty(value = "状态名称") |
| | | private String statusName; |
| | | |
| | | @ApiModelProperty(value = "操作人") |
| | | private String createByName; |
| | | |
| | | @ApiModelProperty(value = "领取用户类型") |
| | | private String getUserTypeName; |
| | | |
| | | /** |
| | | * 已经领取数 |
| | | */ |
| | | @ApiModelProperty(value = "已经领取数") |
| | | private Integer getNum; |
| | | |
| | | /** |
| | | * 未领取数 |
| | | */ |
| | | @ApiModelProperty(value = "未领取数") |
| | | private Integer unGetNum; |
| | | |
| | | } |
对比新文件 |
| | |
| | | package com.mzl.flower.dto.response.coupon; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.mzl.flower.base.AbstractTransDTO; |
| | | import com.mzl.flower.base.annotation.DictTrans; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | |
| | | @Data |
| | | @ApiModel("积分记录") |
| | | public class CouponTemplatePointVO extends AbstractTransDTO { |
| | | |
| | | |
| | | @ApiModelProperty(value = "ID") |
| | | private String id; |
| | | |
| | | |
| | | /** |
| | | * 优惠券名称 |
| | | */ |
| | | @ApiModelProperty(value = "优惠券名称") |
| | | private String couponName; |
| | | |
| | | /** |
| | | * 优惠券描述(使用规则) |
| | | */ |
| | | @ApiModelProperty(value = "优惠券描述(使用规则)") |
| | | private String couponDescription; |
| | | |
| | | /** |
| | | * 发放数量 |
| | | */ |
| | | @ApiModelProperty(value = "库存") |
| | | private Integer couponAmount; |
| | | |
| | | /** |
| | | * 优惠券类型(COUPON_TYPE)满减和无门槛 |
| | | */ |
| | | @ApiModelProperty(value = "优惠券类型(COUPON_TYPE) ") |
| | | @DictTrans(target = "couponDiscountTypeName",codeType = "COUPON_TYPE") |
| | | private String couponDiscountType; |
| | | |
| | | /** |
| | | * 优惠券面值 折扣值(百分比或金额) |
| | | */ |
| | | @ApiModelProperty(value = "优惠券面值") |
| | | private BigDecimal couponDiscountValue; |
| | | |
| | | /** |
| | | * 使用条件,最小订单金额(可选)=》使用条件 |
| | | */ |
| | | @ApiModelProperty(value = "使用条件") |
| | | private BigDecimal minOrderAmount; |
| | | |
| | | |
| | | |
| | | /** |
| | | * 优惠券状态(COUPON_STATUS) |
| | | */ |
| | | @ApiModelProperty(value = "优惠券状态(COUPON_STATUS)") |
| | | @DictTrans(target = "statusName",codeType = "COUPON_STATUS") |
| | | private String status; |
| | | |
| | | /** |
| | | * 兑换积分 |
| | | */ |
| | | @ApiModelProperty(value = "所需积分数量") |
| | | private Integer point; |
| | | |
| | | /** |
| | | * 优惠券类型名称 COUPON_TYPE)满减和无门槛 |
| | | */ |
| | | @ApiModelProperty(value = "优惠券类型名称 ") |
| | | private String couponDiscountTypeName; |
| | | |
| | | |
| | | /** |
| | | * 状态名称 |
| | | */ |
| | | @ApiModelProperty(value = "状态名称") |
| | | private String statusName; |
| | | |
| | | |
| | | |
| | | } |
对比新文件 |
| | |
| | | package com.mzl.flower.dto.response.coupon; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.mzl.flower.base.AbstractTransDTO; |
| | | import com.mzl.flower.base.annotation.DictTrans; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | |
| | | @Data |
| | | @ApiModel("用户优惠券") |
| | | public class CouponTemplateUserVO extends AbstractTransDTO { |
| | | |
| | | |
| | | @ApiModelProperty(value = "ID") |
| | | private String id; |
| | | |
| | | /** |
| | | * 优惠券名称 |
| | | */ |
| | | @ApiModelProperty(value = "优惠券名称") |
| | | private String couponName; |
| | | |
| | | /** |
| | | * 优惠券描述(使用规则) |
| | | */ |
| | | @ApiModelProperty(value = "优惠券描述(使用规则)") |
| | | private String couponDescription; |
| | | |
| | | /** |
| | | * 发放数量 |
| | | */ |
| | | @ApiModelProperty(value = "总数") |
| | | private Integer couponAmount; |
| | | |
| | | /** |
| | | * 优惠券类型(COUPON_TYPE)满减和无门槛 |
| | | */ |
| | | @ApiModelProperty(value = "优惠券类型(COUPON_TYPE) ") |
| | | @DictTrans(target = "couponDiscountTypeName",codeType = "COUPON_TYPE") |
| | | private String couponDiscountType; |
| | | |
| | | /** |
| | | * 优惠券面值 折扣值(百分比或金额) |
| | | */ |
| | | @ApiModelProperty(value = "优惠券面值") |
| | | private BigDecimal couponDiscountValue; |
| | | |
| | | /** |
| | | * 使用条件,最小订单金额(可选)=》使用条件 |
| | | */ |
| | | @ApiModelProperty(value = "使用条件") |
| | | private BigDecimal minOrderAmount; |
| | | |
| | | |
| | | |
| | | /** |
| | | * 优惠券状态(COUPON_STATUS) |
| | | */ |
| | | @ApiModelProperty(value = "优惠券状态(COUPON_STATUS)") |
| | | @DictTrans(target = "statusName",codeType = "COUPON_STATUS") |
| | | private String status; |
| | | |
| | | |
| | | |
| | | @ApiModelProperty(value = "使用开始时间") |
| | | @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss" ,timezone="GMT+8") |
| | | @DateTimeFormat |
| | | private LocalDateTime usageStartDate; |
| | | |
| | | /** |
| | | * 使用结束时间 |
| | | */ |
| | | @ApiModelProperty(value = "使用结束时间") |
| | | @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss" ,timezone="GMT+8") |
| | | @DateTimeFormat |
| | | private LocalDateTime usageEndDate; |
| | | |
| | | |
| | | /** |
| | | * 优惠券类型名称 COUPON_TYPE)满减和无门槛 |
| | | */ |
| | | @ApiModelProperty(value = "优惠券类型名称 ") |
| | | private String couponDiscountTypeName; |
| | | |
| | | /** |
| | | * 状态名称 |
| | | */ |
| | | @ApiModelProperty(value = "状态名称") |
| | | private String statusName; |
| | | |
| | | @ApiModelProperty(value = "操作人") |
| | | private String createByName; |
| | | |
| | | } |
对比新文件 |
| | |
| | | package com.mzl.flower.dto.response.coupon; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.mzl.flower.base.AbstractTransDTO; |
| | | import com.mzl.flower.base.annotation.DictTrans; |
| | | import com.mzl.flower.entity.coupon.CouponTemplateDO; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | |
| | | @Data |
| | | public class CouponTemplateVO extends AbstractTransDTO { |
| | | |
| | | @ApiModelProperty(value = "主键") |
| | | @DictTrans(target = "id",codeType = "id") |
| | | private String id; |
| | | |
| | | /** |
| | | * 优惠券种类(活动优惠券、用户优惠券、会员优惠券,积分优惠券) |
| | | */ |
| | | @ApiModelProperty(value = "优惠券种类") |
| | | @DictTrans(target = "categoryName",codeType = "COUPON_CATEGORY") |
| | | private String category; |
| | | /** |
| | | * 优惠券代码(唯一) |
| | | */ |
| | | @ApiModelProperty(value = "优惠券代码") |
| | | private String couponCode; |
| | | |
| | | /** |
| | | * 优惠券名称 |
| | | */ |
| | | @ApiModelProperty(value = "优惠券名称") |
| | | private String couponName; |
| | | |
| | | /** |
| | | * 优惠券描述(使用规则) |
| | | */ |
| | | @ApiModelProperty(value = "优惠券描述(使用规则)") |
| | | private String couponDescription; |
| | | |
| | | /** |
| | | * 发放数量 |
| | | */ |
| | | @ApiModelProperty(value = "发放数量") |
| | | private Integer couponAmount; |
| | | |
| | | /** |
| | | * 优惠券类型(COUPON_TYPE)满减和无门槛 |
| | | */ |
| | | @ApiModelProperty(value = "优惠券类型 ") |
| | | @DictTrans(target = "couponDiscountTypeName",codeType = "COUPON_TYPE") |
| | | private String couponDiscountType; |
| | | |
| | | /** |
| | | * 优惠券面值 折扣值(百分比或金额) |
| | | */ |
| | | @ApiModelProperty(value = "优惠券面值") |
| | | private BigDecimal couponDiscountValue; |
| | | |
| | | /** |
| | | * 使用条件,最小订单金额(可选)=》使用条件 |
| | | */ |
| | | @ApiModelProperty(value = "使用条件") |
| | | private BigDecimal minOrderAmount; |
| | | |
| | | /** |
| | | * 最大折扣金额(可选,仅对百分比折扣类型适用) |
| | | */ |
| | | private BigDecimal maxDiscountAmount; |
| | | |
| | | /** |
| | | * 领取渠道(COUPON_GET_TYPE)首页弹窗、活动入口、领券中心 |
| | | */ |
| | | @ApiModelProperty(value = "领取渠道(COUPON_GET_TYPE)") |
| | | @DictTrans(target = "getTypeName",codeType = "COUPON_GET_TYPE") |
| | | private String getType; |
| | | |
| | | /** |
| | | * 领取用户类型(COUPON_GET_USER_TYPE)全部用户,指定用户 |
| | | */ |
| | | @ApiModelProperty(value = "领取用户类型(COUPON_GET_USER_TYPE)") |
| | | @DictTrans(target = "getUserTypeName",codeType = "COUPON_GET_USER_TYPE") |
| | | private String getUserType; |
| | | |
| | | /** |
| | | * 领取开始时间 |
| | | */ |
| | | @ApiModelProperty(value = "领取开始时间") |
| | | @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss" ,timezone="GMT+8") |
| | | @DateTimeFormat |
| | | private LocalDateTime getStartDate; |
| | | |
| | | /** |
| | | * 领取结束时间 |
| | | */ |
| | | @ApiModelProperty(value = "领取结束时间") |
| | | @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss" ,timezone="GMT+8") |
| | | @DateTimeFormat |
| | | private LocalDateTime getEndDate; |
| | | |
| | | /** |
| | | * 每人限领 |
| | | */ |
| | | @ApiModelProperty(value = "每人限领") |
| | | private Integer getLimit; |
| | | |
| | | /** |
| | | * 使用时间类型(COUPON_USAGE_TYPE)与领取时间一致、固定时间、领取后有效 |
| | | */ |
| | | @ApiModelProperty(value = "使用时间类型(COUPON_USAGE_TYPE)") |
| | | @DictTrans(target = "usageTypeName",codeType = "COUPON_USAGE_TYPE") |
| | | private String usageType; |
| | | |
| | | /** |
| | | * 使用次数限制 |
| | | */ |
| | | @ApiModelProperty(value = "使用次数限制") |
| | | private Integer usageLimit; |
| | | |
| | | /** |
| | | * 每个用户的使用次数限制 |
| | | */ |
| | | @ApiModelProperty(value = "每个用户的使用次数限制") |
| | | private Integer usagePerUser; |
| | | |
| | | /** |
| | | * 使用开始时间 |
| | | */ |
| | | @ApiModelProperty(value = "使用开始时间") |
| | | @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss" ,timezone="GMT+8") |
| | | @DateTimeFormat |
| | | private LocalDateTime usageStartDate; |
| | | |
| | | /** |
| | | * 使用结束时间 |
| | | */ |
| | | @ApiModelProperty(value = "使用结束时间") |
| | | @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss" ,timezone="GMT+8") |
| | | @DateTimeFormat |
| | | private LocalDateTime usageEndDate; |
| | | |
| | | /** |
| | | * 领取后有效类型(COUPON_usage_time_type)天、小时、分钟 |
| | | */ |
| | | @ApiModelProperty(value = "领取后有效类型(COUPON_USAGE_TIME_TYPE)") |
| | | @DictTrans(target = "usageTimeTypeName",codeType = "COUPON_USAGE_TIME_TYPE") |
| | | private String usageTimeType; |
| | | |
| | | /** |
| | | * 领取后有效时间整数,比如90(天,小时,分钟) |
| | | */ |
| | | @ApiModelProperty(value = "领取后有效时间整数") |
| | | private Integer usageTimeNum; |
| | | |
| | | /** |
| | | * 优惠券状态(COUPON_STATUS) |
| | | */ |
| | | @ApiModelProperty(value = "优惠券状态(COUPON_STATUS)") |
| | | @DictTrans(target = "statusName",codeType = "COUPON_STATUS") |
| | | private String status; |
| | | |
| | | /** |
| | | * 兑换积分 |
| | | */ |
| | | @ApiModelProperty(value = "兑换积分") |
| | | private Integer point; |
| | | |
| | | /** |
| | | * 优惠券类型名称 COUPON_TYPE)满减和无门槛 |
| | | */ |
| | | @ApiModelProperty(value = "优惠券类型名称 ") |
| | | private String couponDiscountTypeName; |
| | | |
| | | /** |
| | | * 领取渠道(COUPON_GET_TYPE)首页弹窗、活动入口、领券中心 |
| | | */ |
| | | @ApiModelProperty(value = "领取渠道(COUPON_GET_TYPE)") |
| | | private String getTypeName; |
| | | |
| | | /** |
| | | * 领取用户类型(COUPON_GET_USER_TYPE)全部用户,指定用户 |
| | | */ |
| | | @ApiModelProperty(value = "领取用户类型") |
| | | private String getUserTypeName; |
| | | |
| | | /** |
| | | * 已经领取数 |
| | | */ |
| | | @ApiModelProperty(value = "已经领取数") |
| | | private Integer getNum; |
| | | |
| | | /** |
| | | * 未领取数 |
| | | */ |
| | | @ApiModelProperty(value = "未领取数") |
| | | private Integer unGetNum; |
| | | |
| | | @ApiModelProperty(value = "优惠券种类名称") |
| | | private String categoryName; |
| | | |
| | | /** |
| | | * 状态名称 |
| | | */ |
| | | @ApiModelProperty(value = "状态名称") |
| | | private String statusName; |
| | | |
| | | @ApiModelProperty(value = "领取后有效类型") |
| | | private String usageTimeTypeName; |
| | | |
| | | @ApiModelProperty(value = "使用时间类型") |
| | | private String usageTypeName; |
| | | |
| | | /** |
| | | * 创建人名称 |
| | | */ |
| | | @ApiModelProperty(value = "创建人名称") |
| | | private String createByName; |
| | | |
| | | /** |
| | | * 更新人名称 |
| | | */ |
| | | @ApiModelProperty(value = "更新人名称") |
| | | private String updateByName; |
| | | |
| | | @ApiModelProperty(value = "会员等级") |
| | | private String vipGrade; |
| | | |
| | | } |
对比新文件 |
| | |
| | | package com.mzl.flower.dto.response.coupon; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.mzl.flower.base.AbstractTransDTO; |
| | | import com.mzl.flower.base.annotation.DictTrans; |
| | | import com.mzl.flower.entity.coupon.CouponTemplateDO; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | |
| | | @Data |
| | | public class CouponTemplateVipVO extends AbstractTransDTO { |
| | | |
| | | |
| | | @ApiModelProperty(value = "ID") |
| | | private String id; |
| | | |
| | | /** |
| | | * 优惠券名称 |
| | | */ |
| | | @ApiModelProperty(value = "优惠券名称") |
| | | private String couponName; |
| | | |
| | | /** |
| | | * 优惠券描述(使用规则) |
| | | */ |
| | | @ApiModelProperty(value = "优惠券描述(使用规则)") |
| | | private String couponDescription; |
| | | |
| | | |
| | | /** |
| | | * 优惠券类型(COUPON_TYPE)满减和无门槛 |
| | | */ |
| | | @ApiModelProperty(value = "优惠券类型(COUPON_TYPE) ") |
| | | @DictTrans(target = "couponDiscountTypeName",codeType = "COUPON_TYPE") |
| | | private String couponDiscountType; |
| | | |
| | | |
| | | |
| | | /** |
| | | * 优惠券面值 折扣值(百分比或金额) |
| | | */ |
| | | @ApiModelProperty(value = "优惠券面值") |
| | | private BigDecimal couponDiscountValue; |
| | | |
| | | /** |
| | | * 使用条件,最小订单金额(可选)=》使用条件 |
| | | */ |
| | | @ApiModelProperty(value = "使用条件") |
| | | private BigDecimal minOrderAmount; |
| | | |
| | | |
| | | /** |
| | | * 优惠券状态(COUPON_STATUS) |
| | | */ |
| | | @ApiModelProperty(value = "优惠券状态(COUPON_STATUS)") |
| | | @DictTrans(target = "statusName",codeType = "COUPON_STATUS") |
| | | private String status; |
| | | |
| | | |
| | | @ApiModelProperty(value = "使用开始时间") |
| | | @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss" ,timezone="GMT+8") |
| | | @DateTimeFormat |
| | | private LocalDateTime usageStartDate; |
| | | |
| | | /** |
| | | * 使用结束时间 |
| | | */ |
| | | @ApiModelProperty(value = "使用结束时间") |
| | | @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss" ,timezone="GMT+8") |
| | | @DateTimeFormat |
| | | private LocalDateTime usageEndDate; |
| | | |
| | | |
| | | /** |
| | | * 优惠券类型名称 COUPON_TYPE)满减和无门槛 |
| | | */ |
| | | @ApiModelProperty(value = "优惠券类型名称 ") |
| | | private String couponDiscountTypeName; |
| | | |
| | | /** |
| | | * 状态名称 |
| | | */ |
| | | @ApiModelProperty(value = "状态名称") |
| | | private String statusName; |
| | | |
| | | @ApiModelProperty(value = "操作人") |
| | | private String createByName; |
| | | |
| | | /** |
| | | * 已经领取数 |
| | | */ |
| | | @ApiModelProperty(value = "已经领取数") |
| | | private Integer getNum; |
| | | |
| | | |
| | | } |
对比新文件 |
| | |
| | | package com.mzl.flower.entity.coupon; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.mzl.flower.base.BaseEntity; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import lombok.experimental.Accessors; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | |
| | | /** |
| | | * @author @TaoJie |
| | | * @since 2024-08-27 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = true) |
| | | @Accessors(chain = true) |
| | | @TableName("t_coupon_record") |
| | | public class CouponRecordDO extends BaseEntity { |
| | | |
| | | |
| | | /** |
| | | * 优惠券ID |
| | | */ |
| | | private String couponId; |
| | | |
| | | /** |
| | | * 用户id |
| | | */ |
| | | private String userId; |
| | | |
| | | /** |
| | | * 商户ID |
| | | */ |
| | | private String customerId; |
| | | |
| | | /** |
| | | * 状态(coupon_record_status)未使用、已使用、已过期 |
| | | */ |
| | | private String status; |
| | | |
| | | /** |
| | | * 有效开始时间 |
| | | */ |
| | | private LocalDateTime effectiveStart; |
| | | |
| | | /** |
| | | * 有效结束时间 |
| | | */ |
| | | private LocalDateTime effectiveEnd; |
| | | |
| | | /** |
| | | * 使用订单 |
| | | */ |
| | | private String orderId; |
| | | |
| | | /** |
| | | * 使用时间 |
| | | */ |
| | | private LocalDateTime usedTime; |
| | | |
| | | /** |
| | | * 优惠券面值 |
| | | */ |
| | | private BigDecimal couponDiscountValue; |
| | | |
| | | /** |
| | | * 使用条件(满多少钱) |
| | | */ |
| | | private BigDecimal minOrderAmount; |
| | | |
| | | /** |
| | | * 优惠券种类(活动优惠券、用户优惠券、会员优惠券,积分优惠券) |
| | | */ |
| | | private String category; |
| | | |
| | | /** |
| | | * 优惠券代码 |
| | | */ |
| | | private String couponCode; |
| | | |
| | | /** |
| | | * 优惠券名称 |
| | | */ |
| | | private String couponName; |
| | | |
| | | private String couponDiscountType; |
| | | |
| | | private String getType; |
| | | |
| | | /** |
| | | * 用户获取类型 |
| | | */ |
| | | private String getUserType; |
| | | |
| | | /** |
| | | * 积分数量 |
| | | */ |
| | | private Integer point; |
| | | |
| | | /** |
| | | * 订单号 |
| | | */ |
| | | private String orderNo; |
| | | |
| | | } |
对比新文件 |
| | |
| | | package com.mzl.flower.entity.coupon; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
| | | |
| | | /** |
| | | * @author @TaoJie |
| | | * @since 2024-08-24 |
| | | */ |
| | | @Data |
| | | @Accessors(chain = true) |
| | | @TableName("t_coupon_template_customer") |
| | | public class CouponTemplateCustomerDO { |
| | | |
| | | |
| | | @TableId("id") |
| | | private String id; |
| | | |
| | | /** |
| | | * 优惠券id |
| | | */ |
| | | @TableField("coupon_id") |
| | | private String couponId; |
| | | |
| | | /** |
| | | * 指定的顾客id |
| | | */ |
| | | @TableField("custom_id") |
| | | private String customId; |
| | | |
| | | |
| | | } |
对比新文件 |
| | |
| | | package com.mzl.flower.entity.coupon; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.mzl.flower.base.BaseEntity; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import lombok.experimental.Accessors; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | |
| | | /** |
| | | * @author @TaoJie |
| | | * @since 2024-08-22 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = true) |
| | | @Accessors(chain = true) |
| | | @TableName("t_coupon_template") |
| | | public class CouponTemplateDO extends BaseEntity { |
| | | |
| | | |
| | | /** |
| | | * 优惠券种类(活动优惠券、用户优惠券、会员优惠券,积分优惠券) |
| | | */ |
| | | private String category; |
| | | /** |
| | | * 优惠券代码(唯一) |
| | | */ |
| | | private String couponCode; |
| | | |
| | | /** |
| | | * 优惠券名称 |
| | | */ |
| | | private String couponName; |
| | | |
| | | /** |
| | | * 优惠券描述(使用规则) |
| | | */ |
| | | private String couponDescription; |
| | | |
| | | /** |
| | | * 发放数量 |
| | | */ |
| | | private Integer couponAmount; |
| | | |
| | | /** |
| | | * 优惠券类型(COUPON_TYPE)满减和无门槛 |
| | | */ |
| | | private String couponDiscountType; |
| | | |
| | | /** |
| | | * 优惠券面值 折扣值(百分比或金额) |
| | | */ |
| | | private BigDecimal couponDiscountValue; |
| | | |
| | | /** |
| | | * 使用条件,最小订单金额(可选)=》使用条件 |
| | | */ |
| | | private BigDecimal minOrderAmount; |
| | | |
| | | /** |
| | | * 最大折扣金额(可选,仅对百分比折扣类型适用) |
| | | */ |
| | | private BigDecimal maxDiscountAmount; |
| | | |
| | | /** |
| | | * 领取渠道(COUPON_GET_TYPE)首页弹窗、活动入口、领券中心 |
| | | */ |
| | | private String getType; |
| | | |
| | | /** |
| | | * 领取用户类型(COUPON_GET_USER_TYPE)全部用户,指定用户 |
| | | */ |
| | | private String getUserType; |
| | | |
| | | /** |
| | | * 领取开始时间 |
| | | */ |
| | | private LocalDateTime getStartDate; |
| | | |
| | | /** |
| | | * 领取结束时间 |
| | | */ |
| | | private LocalDateTime getEndDate; |
| | | |
| | | /** |
| | | * 每人限领 |
| | | */ |
| | | private Integer getLimit; |
| | | |
| | | /** |
| | | * 使用时间类型(COUPON_USAGE_TYPE)与领取时间一致、固定时间、领取后有效 |
| | | */ |
| | | private String usageType; |
| | | |
| | | /** |
| | | * 使用次数限制 |
| | | */ |
| | | private Integer usageLimit; |
| | | |
| | | /** |
| | | * 每个用户的使用次数限制 |
| | | */ |
| | | private Integer usagePerUser; |
| | | |
| | | /** |
| | | * 使用开始时间 |
| | | */ |
| | | private LocalDateTime usageStartDate; |
| | | |
| | | /** |
| | | * 使用结束时间 |
| | | */ |
| | | private LocalDateTime usageEndDate; |
| | | |
| | | /** |
| | | * 领取后有效类型(COUPON_usage_time_type)天、小时、分钟 |
| | | */ |
| | | private String usageTimeType; |
| | | |
| | | /** |
| | | * 领取后有效时间整数,比如90(天,小时,分钟) |
| | | */ |
| | | private Integer usageTimeNum; |
| | | |
| | | /** |
| | | * 优惠券状态(COUPON_STATUS) |
| | | */ |
| | | private String status; |
| | | |
| | | /** |
| | | * 兑换积分 |
| | | */ |
| | | private Integer point; |
| | | |
| | | @ApiModelProperty(value = "会员等级") |
| | | private String vipGrade; |
| | | |
| | | |
| | | } |
| | |
| | | |
| | | @TableField("third_id") |
| | | private String thirdId; |
| | | |
| | | @TableField("vip_grade") |
| | | private String vipGrade; |
| | | |
| | | } |
对比新文件 |
| | |
| | | package com.mzl.flower.enums; |
| | | |
| | | import lombok.Getter; |
| | | |
| | | public enum CouponCategoryEnum { |
| | | |
| | | ACTIVITY("activity","活动优惠券"), |
| | | USER("user","用户优惠券"), |
| | | MEMBER("member","会员优惠券"), |
| | | POINT("point","积分优惠券"), |
| | | ; |
| | | |
| | | @Getter |
| | | private String status; |
| | | |
| | | private String desc; |
| | | private CouponCategoryEnum(String status, String desc){ |
| | | this.status=status; |
| | | this.desc=desc; |
| | | } |
| | | |
| | | } |
对比新文件 |
| | |
| | | package com.mzl.flower.enums; |
| | | |
| | | import lombok.Getter; |
| | | |
| | | public enum CouponGetUserTypeEnum { |
| | | |
| | | |
| | | ALL("all","全部用户"), |
| | | POINT("point","指定用户"), |
| | | |
| | | ; |
| | | |
| | | @Getter |
| | | private String type; |
| | | |
| | | private String desc; |
| | | private CouponGetUserTypeEnum(String type, String desc){ |
| | | this.type=type; |
| | | this.desc=desc; |
| | | } |
| | | |
| | | } |
对比新文件 |
| | |
| | | package com.mzl.flower.enums; |
| | | |
| | | import lombok.Getter; |
| | | |
| | | public enum CouponStatusEnum { |
| | | |
| | | |
| | | INACTIVE("inactive","未发布"), |
| | | ACTIVE("active","已发布"), |
| | | EXPIRED("expired","下架"), |
| | | ; |
| | | |
| | | @Getter |
| | | private String status; |
| | | |
| | | private String desc; |
| | | private CouponStatusEnum(String status,String desc){ |
| | | this.status=status; |
| | | this.desc=desc; |
| | | } |
| | | |
| | | } |
对比新文件 |
| | |
| | | package com.mzl.flower.enums; |
| | | |
| | | import lombok.Getter; |
| | | |
| | | public enum CouponTypeEnum { |
| | | |
| | | |
| | | DISCOUNT("discount","满减"), |
| | | ZERO("zero","无门槛"), |
| | | |
| | | |
| | | ; |
| | | |
| | | @Getter |
| | | private String type; |
| | | |
| | | private String desc; |
| | | private CouponTypeEnum(String type, String desc){ |
| | | this.type=type; |
| | | this.desc=desc; |
| | | } |
| | | |
| | | } |
对比新文件 |
| | |
| | | package com.mzl.flower.enums; |
| | | |
| | | import lombok.Getter; |
| | | |
| | | public enum CouponUsageTimeTypeEnum { |
| | | |
| | | |
| | | DAY("day","天"), |
| | | HOUR("hour","小时"), |
| | | MINUTE("minute","分钟"), |
| | | |
| | | ; |
| | | |
| | | @Getter |
| | | private String type; |
| | | |
| | | private String desc; |
| | | private CouponUsageTimeTypeEnum(String type, String desc){ |
| | | this.type=type; |
| | | this.desc=desc; |
| | | } |
| | | |
| | | } |
对比新文件 |
| | |
| | | package com.mzl.flower.enums; |
| | | |
| | | import lombok.Getter; |
| | | |
| | | public enum CouponUsageTypeEnum { |
| | | |
| | | |
| | | GET("get","与领取时间一致"), |
| | | FIXED("fixed","固定时间"), |
| | | GET_AFTER_TIME("get_after_time","领取后有效时间"), |
| | | |
| | | ; |
| | | |
| | | @Getter |
| | | private String type; |
| | | |
| | | private String desc; |
| | | private CouponUsageTypeEnum(String type, String desc){ |
| | | this.type=type; |
| | | this.desc=desc; |
| | | } |
| | | |
| | | } |
对比新文件 |
| | |
| | | package com.mzl.flower.enums; |
| | | |
| | | import lombok.Getter; |
| | | |
| | | public enum CouponUsedStatusEnum { |
| | | |
| | | UNUSED("unused","待使用"), |
| | | USED("used","已使用"), |
| | | EXPIRED("expired","过期"), |
| | | |
| | | ; |
| | | |
| | | @Getter |
| | | private String type; |
| | | |
| | | private String desc; |
| | | private CouponUsedStatusEnum(String type, String desc){ |
| | | this.type=type; |
| | | this.desc=desc; |
| | | } |
| | | |
| | | |
| | | } |
对比新文件 |
| | |
| | | package com.mzl.flower.enums; |
| | | |
| | | import lombok.Getter; |
| | | |
| | | public enum TrueOrFalseEnum { |
| | | |
| | | |
| | | TRUE(true), |
| | | FALSE(false), |
| | | ; |
| | | |
| | | @Getter |
| | | private boolean flag; |
| | | private TrueOrFalseEnum(boolean flag){ |
| | | this.flag=flag; |
| | | } |
| | | } |
对比新文件 |
| | |
| | | package com.mzl.flower.enums; |
| | | |
| | | import lombok.Getter; |
| | | |
| | | public enum VipGradeEnum { |
| | | |
| | | NORMAL("0","普通会员"), |
| | | SILVER("1","银卡会员"), |
| | | GOLD("2","金卡会员"), |
| | | DIAMOND("3","钻石会员"), |
| | | |
| | | ; |
| | | |
| | | @Getter |
| | | private String type; |
| | | |
| | | private String desc; |
| | | private VipGradeEnum(String type, String desc){ |
| | | this.type=type; |
| | | this.desc=desc; |
| | | } |
| | | |
| | | |
| | | } |
对比新文件 |
| | |
| | | package com.mzl.flower.mapper.coupon; |
| | | |
| | | import com.mzl.flower.entity.coupon.CouponRecordDO; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | |
| | | /** |
| | | * <p> |
| | | * Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author @TaoJie |
| | | * @since 2024-08-27 |
| | | */ |
| | | public interface CouponRecordMapper extends BaseMapper<CouponRecordDO> { |
| | | |
| | | } |
对比新文件 |
| | |
| | | package com.mzl.flower.mapper.coupon; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.mzl.flower.dto.request.coupon.QueryCouponRecordDTO; |
| | | import com.mzl.flower.dto.request.coupon.QueryCouponStatisticsBO; |
| | | import com.mzl.flower.dto.response.coupon.CouponRecordVO; |
| | | import com.mzl.flower.entity.coupon.CouponRecordDO; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author @TaoJie |
| | | * @since 2024-08-27 |
| | | */ |
| | | public interface CouponRecordMapperCustom extends BaseMapper<CouponRecordDO> { |
| | | |
| | | List<CouponRecordVO> getPage(Page page, @Param("param") QueryCouponRecordDTO dto); |
| | | |
| | | List<CouponRecordVO> getList(@Param("param") QueryCouponRecordDTO dto); |
| | | |
| | | int statisCouponTemplateCount(@Param("param") QueryCouponStatisticsBO queryCouponStatisticsBO); |
| | | |
| | | int statisCouponTemplateCurMonCount(@Param("param") QueryCouponStatisticsBO queryCouponStatisticsBO); |
| | | |
| | | int statisCouponPointCurMonPointAmonut(@Param("param") QueryCouponStatisticsBO queryCouponStatisticsBO); |
| | | } |
对比新文件 |
| | |
| | | package com.mzl.flower.mapper.coupon; |
| | | |
| | | import com.mzl.flower.entity.coupon.CouponTemplateCustomerDO; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | |
| | | /** |
| | | * <p> |
| | | * Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author @TaoJie |
| | | * @since 2024-08-24 |
| | | */ |
| | | public interface CouponTemplateCustomerMapper extends BaseMapper<CouponTemplateCustomerDO> { |
| | | |
| | | } |
对比新文件 |
| | |
| | | package com.mzl.flower.mapper.coupon; |
| | | |
| | | import com.mzl.flower.entity.coupon.CouponTemplateDO; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | |
| | | /** |
| | | * <p> |
| | | * Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author @TaoJie |
| | | * @since 2024-08-22 |
| | | */ |
| | | public interface CouponTemplateMapper extends BaseMapper<CouponTemplateDO> { |
| | | |
| | | } |
对比新文件 |
| | |
| | | package com.mzl.flower.mapper.coupon; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.mzl.flower.dto.request.coupon.BatchCouponTemplateDTO; |
| | | import com.mzl.flower.dto.request.coupon.QueryCouponDTO; |
| | | import com.mzl.flower.dto.response.coupon.CouponTemplateVO; |
| | | import com.mzl.flower.entity.coupon.CouponTemplateDO; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author @TaoJie |
| | | * @since 2024-08-22 |
| | | */ |
| | | public interface CouponTemplateMapperCustom extends BaseMapper<CouponTemplateDO> { |
| | | |
| | | /** |
| | | * 获取普通分页信息 |
| | | * @param page |
| | | * @param dto |
| | | * @return |
| | | */ |
| | | List<CouponTemplateVO> getCouponTemplatePage(Page page,@Param("param") QueryCouponDTO dto); |
| | | |
| | | /** |
| | | * 获取普通会员全部列表信息 |
| | | * @param dto |
| | | * @return |
| | | */ |
| | | List<CouponTemplateVO> getList(@Param("param") QueryCouponDTO dto); |
| | | |
| | | int deleteBatchCouponTemplate(@Param("param") BatchCouponTemplateDTO dto); |
| | | |
| | | int activeBatchCouponTemplate(@Param("param") BatchCouponTemplateDTO dto); |
| | | |
| | | int expireBatchCouponTemplate(@Param("param") BatchCouponTemplateDTO dto); |
| | | |
| | | |
| | | } |
对比新文件 |
| | |
| | | package com.mzl.flower.service.coupon; |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.mzl.flower.dto.request.coupon.CreateCouponRecordDTO; |
| | | import com.mzl.flower.dto.request.coupon.QueryCouponRecordDTO; |
| | | import com.mzl.flower.dto.request.coupon.QueryCouponStatisticsBO; |
| | | import com.mzl.flower.dto.response.coupon.CouponRecordVO; |
| | | import com.mzl.flower.entity.coupon.CouponRecordDO; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务类 |
| | | * </p> |
| | | * |
| | | * @author @TaoJie |
| | | * @since 2024-08-27 |
| | | */ |
| | | public interface CouponRecordService extends IService<CouponRecordDO> { |
| | | |
| | | List<CouponRecordVO> getList(QueryCouponRecordDTO dto) ; |
| | | boolean createCouponRecord(CreateCouponRecordDTO dto); |
| | | |
| | | boolean updateCouponRecord(CreateCouponRecordDTO dto); |
| | | |
| | | boolean deleteCouponRecord(String id); |
| | | |
| | | CouponRecordVO getCouponRecordById(String id); |
| | | |
| | | Page<CouponRecordVO> getPage(Page page, QueryCouponRecordDTO dto); |
| | | |
| | | /** |
| | | * 会员定时任务 |
| | | * 根据会员等级定时下发刷优惠券 |
| | | * @return |
| | | */ |
| | | boolean grantVipCouponRecordList(); |
| | | |
| | | /** |
| | | * 根据当月日期设置上个月的日期的优惠券过期 |
| | | * @return |
| | | */ |
| | | boolean expiredCouponRecordByListCurMonth(); |
| | | |
| | | int statisCouponTemplateCount(QueryCouponStatisticsBO queryCouponStatisticsBO); |
| | | |
| | | int statisCouponTemplateCurMonCount(QueryCouponStatisticsBO queryCouponStatisticsBO); |
| | | |
| | | int statisCouponPointCurMonPontAmonut(QueryCouponStatisticsBO queryCouponStatisticsBO); |
| | | } |
对比新文件 |
| | |
| | | package com.mzl.flower.service.coupon; |
| | | |
| | | import com.mzl.flower.entity.coupon.CouponTemplateCustomerDO; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务类 |
| | | * </p> |
| | | * |
| | | * @author @TaoJie |
| | | * @since 2024-08-24 |
| | | */ |
| | | public interface CouponTemplateCustomerService extends IService<CouponTemplateCustomerDO> { |
| | | |
| | | /** |
| | | * 根据优惠券的id查找关联关系 |
| | | * @param couponTemplateId |
| | | * @return |
| | | */ |
| | | List<CouponTemplateCustomerDO> getPointCustomReList(String couponTemplateId); |
| | | |
| | | /** |
| | | * 根据优惠券的模版id删除关联关系 |
| | | * @param couponTemplateId |
| | | * @return |
| | | */ |
| | | boolean deleteByCouponTemplateId(String couponTemplateId); |
| | | } |
对比新文件 |
| | |
| | | package com.mzl.flower.service.coupon; |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.mzl.flower.dto.request.coupon.*; |
| | | import com.mzl.flower.dto.response.coupon.CouponTemplateVO; |
| | | import com.mzl.flower.entity.coupon.CouponTemplateDO; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务类 |
| | | * </p> |
| | | * |
| | | * @author @TaoJie |
| | | * @since 2024-08-22 |
| | | */ |
| | | public interface CouponTemplateService2 extends IService<CouponTemplateDO> { |
| | | |
| | | boolean createCouponTemplate(CreateCouponTemplateBO dto); |
| | | |
| | | |
| | | boolean updateCouponTemplate(CreateCouponTemplateBO dto); |
| | | |
| | | List<CouponTemplateVO> getList(QueryCouponDTO dto); |
| | | |
| | | Page<CouponTemplateVO> getPage(Page page, QueryCouponDTO dto); |
| | | |
| | | /** |
| | | * 详情 |
| | | * @param id |
| | | * @return |
| | | */ |
| | | CouponTemplateVO getDetailById(String id); |
| | | |
| | | boolean deleteCouponTemplate(String id); |
| | | |
| | | boolean activeCouponTemplate(String id); |
| | | /** |
| | | * 活动-下架优惠券 |
| | | * @param id |
| | | * @return |
| | | */ |
| | | boolean expireCouponTemplate(String id); |
| | | |
| | | |
| | | /** |
| | | * 获取所有会员优惠券模版 |
| | | * @return |
| | | */ |
| | | List<CouponTemplateDO> getVipCouponTemplate(); |
| | | |
| | | boolean deleteBatchCouponTemplate(BatchCouponTemplateDTO dto); |
| | | |
| | | boolean activeBatchCouponTemplate(BatchCouponTemplateDTO dto); |
| | | |
| | | boolean expireBatchCouponTemplate(BatchCouponTemplateDTO dto); |
| | | |
| | | /** |
| | | * 积分统计 |
| | | * @param queryCouponStatisticsBO |
| | | * @return |
| | | */ |
| | | CouponTemplateVO statisCouponTemplatePoint(QueryCouponStatisticsBO queryCouponStatisticsBO); |
| | | } |
对比新文件 |
| | |
| | | package com.mzl.flower.service.impl.coupon; |
| | | |
| | | import cn.hutool.core.util.IdUtil; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.mzl.flower.config.exception.ValidationException; |
| | | import com.mzl.flower.config.security.SecurityUtils; |
| | | import com.mzl.flower.dto.request.coupon.CreateCouponRecordDTO; |
| | | import com.mzl.flower.dto.request.coupon.QueryCouponRecordDTO; |
| | | import com.mzl.flower.dto.request.coupon.QueryCouponStatisticsBO; |
| | | import com.mzl.flower.dto.response.coupon.CouponRecordVO; |
| | | import com.mzl.flower.entity.coupon.CouponRecordDO; |
| | | import com.mzl.flower.entity.coupon.CouponTemplateDO; |
| | | import com.mzl.flower.entity.customer.Customer; |
| | | import com.mzl.flower.entity.system.User; |
| | | import com.mzl.flower.enums.CouponCategoryEnum; |
| | | import com.mzl.flower.enums.CouponUsageTimeTypeEnum; |
| | | import com.mzl.flower.enums.CouponUsageTypeEnum; |
| | | import com.mzl.flower.enums.CouponUsedStatusEnum; |
| | | import com.mzl.flower.mapper.coupon.CouponRecordMapper; |
| | | import com.mzl.flower.mapper.coupon.CouponRecordMapperCustom; |
| | | import com.mzl.flower.mapper.customer.CustomerMapper; |
| | | import com.mzl.flower.service.coupon.CouponRecordService; |
| | | import com.mzl.flower.service.coupon.CouponTemplateService2; |
| | | import com.mzl.flower.service.system.UserService; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.collections4.CollectionUtils; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.time.LocalDateTime; |
| | | import java.time.temporal.TemporalAdjusters; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务实现类 |
| | | * </p> |
| | | * |
| | | * @author @TaoJie |
| | | * @since 2024-08-27 |
| | | */ |
| | | @Slf4j |
| | | @Service |
| | | public class CouponRecordServiceImpl extends ServiceImpl<CouponRecordMapper, CouponRecordDO> implements CouponRecordService { |
| | | |
| | | @Autowired |
| | | private CouponRecordMapperCustom couponRecordMapperCustom; |
| | | |
| | | @Autowired |
| | | private CouponTemplateService2 couponTemplateService; |
| | | |
| | | @Autowired |
| | | private UserService userService; |
| | | |
| | | @Autowired |
| | | private CustomerMapper customerMapper; |
| | | |
| | | @Override |
| | | public List<CouponRecordVO> getList(QueryCouponRecordDTO dto) { |
| | | return couponRecordMapperCustom.getList(dto); |
| | | } |
| | | |
| | | @Override |
| | | public boolean createCouponRecord(CreateCouponRecordDTO dto) { |
| | | |
| | | final Customer customer = customerMapper.selectById(dto.getCustomerId()); |
| | | if(null==customer){ |
| | | throw new ValidationException("商户信息不存在"); |
| | | } |
| | | |
| | | CouponRecordDO couponRecordDO=new CouponRecordDO(); |
| | | BeanUtils.copyProperties(dto,couponRecordDO); |
| | | couponRecordDO.create(SecurityUtils.getUserId()); |
| | | // 设置为待使用状态 |
| | | couponRecordDO.setStatus(CouponUsedStatusEnum.UNUSED.getType()); |
| | | |
| | | // 优惠券字段冗余 |
| | | final CouponTemplateDO couponTemplateDO = couponTemplateService.getById(dto.getCouponId()); |
| | | if(null!=couponTemplateDO){ |
| | | couponRecordDO.setCategory(couponTemplateDO.getGetUserType()); |
| | | couponRecordDO.setCouponCode(couponTemplateDO.getCouponCode()); |
| | | couponRecordDO.setCouponName(couponTemplateDO.getCouponName()); |
| | | couponRecordDO.setCouponDiscountValue(couponTemplateDO.getCouponDiscountValue()); |
| | | couponRecordDO.setMinOrderAmount(couponTemplateDO.getMinOrderAmount()); |
| | | couponRecordDO.setGetType(couponTemplateDO.getGetType()); |
| | | couponRecordDO.setCouponDiscountType(couponTemplateDO.getCouponDiscountType()); |
| | | couponRecordDO.setGetUserType(couponTemplateDO.getGetUserType()); |
| | | couponRecordDO.setPoint(couponTemplateDO.getPoint()); |
| | | |
| | | |
| | | // 根据优惠券模板来计算优惠券的生效开始时间和结束时间 |
| | | if(StringUtils.isNotBlank(couponTemplateDO.getCategory()) && couponTemplateDO.getCategory().equals(CouponCategoryEnum.MEMBER.getStatus())){ |
| | | // 如果是会员优惠券的话,则设置为优惠券的使用条件为优惠券的时间 |
| | | couponRecordDO.setEffectiveStart(couponTemplateDO.getUsageStartDate()); |
| | | couponRecordDO.setEffectiveEnd(couponTemplateDO.getUsageEndDate()); |
| | | }else{ |
| | | // 非会员的根据领取时间类型来计算优惠券的时间 |
| | | if(StringUtils.isNotBlank(couponTemplateDO.getUsageType()) && couponTemplateDO.getUsageType().equals(CouponUsageTypeEnum.GET.getType())){ |
| | | // 与领取时间一致 |
| | | couponRecordDO.setEffectiveStart(couponTemplateDO.getGetStartDate()); |
| | | couponRecordDO.setEffectiveEnd(couponTemplateDO.getGetEndDate()); |
| | | } |
| | | if(StringUtils.isNotBlank(couponTemplateDO.getUsageType()) && couponTemplateDO.getUsageType().equals(CouponUsageTypeEnum.FIXED.getType())){ |
| | | // 固定时间 |
| | | couponRecordDO.setEffectiveStart(couponTemplateDO.getUsageStartDate()); |
| | | couponRecordDO.setEffectiveEnd(couponTemplateDO.getUsageEndDate()); |
| | | } |
| | | if(StringUtils.isNotBlank(couponTemplateDO.getUsageType()) && couponTemplateDO.getUsageType().equals(CouponUsageTypeEnum.GET_AFTER_TIME.getType())){ |
| | | // 领取后有段时间 领取后有效时间 |
| | | // 根据发放后有效期来设置时间 |
| | | if (couponTemplateDO.getUsageTimeNum() == null || couponTemplateDO.getUsageTimeNum() <= 0) { |
| | | throw new IllegalArgumentException("使用时间数量必须为正整数"); |
| | | } |
| | | LocalDateTime currentTime = LocalDateTime.now(); |
| | | couponRecordDO.setEffectiveStart(currentTime); |
| | | if (couponTemplateDO.getUsageTimeType().equals(CouponUsageTimeTypeEnum.DAY.getType())) { |
| | | // 天 |
| | | couponRecordDO.setEffectiveEnd(currentTime.plusDays(couponTemplateDO.getUsageTimeNum())); |
| | | } |
| | | if (couponTemplateDO.getUsageTimeType().equals(CouponUsageTimeTypeEnum.HOUR.getType())) { |
| | | // 小时 |
| | | couponRecordDO.setEffectiveEnd(currentTime.plusDays(couponTemplateDO.getUsageTimeNum())); |
| | | } |
| | | if (couponTemplateDO.getUsageTimeType().equals(CouponUsageTimeTypeEnum.MINUTE.getType())) { |
| | | // 分钟 |
| | | couponRecordDO.setEffectiveEnd(currentTime.plusDays(couponTemplateDO.getUsageTimeNum())); |
| | | } |
| | | |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | return baseMapper.insert(couponRecordDO)>0; |
| | | } |
| | | |
| | | @Override |
| | | public boolean updateCouponRecord(CreateCouponRecordDTO dto) { |
| | | CouponRecordDO couponRecordDO=baseMapper.selectById(dto.getId()); |
| | | BeanUtils.copyProperties(dto,couponRecordDO); |
| | | couponRecordDO.update(SecurityUtils.getUserId()); |
| | | |
| | | // 优惠券字段冗余 |
| | | final CouponTemplateDO couponTemplateDO = couponTemplateService.getById(dto.getCouponId()); |
| | | if(null!=couponTemplateDO){ |
| | | couponRecordDO.setCategory(couponTemplateDO.getGetUserType()); |
| | | couponRecordDO.setCouponCode(couponTemplateDO.getCouponCode()); |
| | | couponRecordDO.setCouponName(couponTemplateDO.getCouponName()); |
| | | couponRecordDO.setCouponDiscountValue(couponTemplateDO.getCouponDiscountValue()); |
| | | couponRecordDO.setMinOrderAmount(couponTemplateDO.getMinOrderAmount()); |
| | | } |
| | | |
| | | |
| | | return baseMapper.updateById(couponRecordDO)>0; |
| | | } |
| | | |
| | | @Override |
| | | public boolean deleteCouponRecord(String id) { |
| | | return baseMapper.deleteById(id)>0; |
| | | } |
| | | |
| | | @Override |
| | | public CouponRecordVO getCouponRecordById(String id) { |
| | | QueryCouponRecordDTO dto=new QueryCouponRecordDTO(); |
| | | dto.setId(id); |
| | | final List<CouponRecordVO> list = couponRecordMapperCustom.getList(dto); |
| | | if(CollectionUtils.isNotEmpty(list)){ |
| | | return list.get(0); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | @Override |
| | | public Page<CouponRecordVO> getPage(Page page, QueryCouponRecordDTO dto) { |
| | | List<CouponRecordVO> result=couponRecordMapperCustom.getPage(page,dto); |
| | | return page.setRecords(result); |
| | | } |
| | | |
| | | @Transactional |
| | | @Override |
| | | public boolean grantVipCouponRecordList() { |
| | | |
| | | try{ |
| | | LocalDateTime now = LocalDateTime.now(); |
| | | LocalDateTime firstDayStart = now.with(TemporalAdjusters.firstDayOfMonth()).withHour(0).withMinute(0).withSecond(0).withNano(0); |
| | | LocalDateTime lastDayEnd = now.with(TemporalAdjusters.lastDayOfMonth()).withHour(23).withMinute(59).withSecond(59).withNano(0); |
| | | |
| | | // 获取所有会员模版列表 |
| | | List<CouponTemplateDO> vipTemplateList= couponTemplateService.getVipCouponTemplate(); |
| | | |
| | | // 遍历所有相同等级用户信息,并根据优惠券设置的规则构造优惠券 |
| | | final List<CouponTemplateDO> updateCouponTemplateList = vipTemplateList.stream().map(couponTemplateDO -> { |
| | | final List<User> vipGradeUserList = userService.getVipGradeUserList(couponTemplateDO.getVipGrade()); |
| | | final List<CouponRecordDO> gradeCouponRecordList = vipGradeUserList.stream().map(user -> { |
| | | CouponRecordDO couponRecordDO = new CouponRecordDO(); |
| | | BeanUtils.copyProperties(couponTemplateDO, couponRecordDO); |
| | | couponRecordDO.setId(IdUtil.simpleUUID()); |
| | | couponRecordDO.setCouponId(couponTemplateDO.getId()); |
| | | couponRecordDO.setUserId(user.getId()); |
| | | couponRecordDO.setStatus(CouponUsedStatusEnum.UNUSED.getType()); |
| | | couponRecordDO.setEffectiveStart(firstDayStart); |
| | | couponRecordDO.setEffectiveEnd(lastDayEnd); |
| | | |
| | | // 创建信息 |
| | | couponRecordDO.create(); |
| | | return couponRecordDO; |
| | | }).collect(Collectors.toList()); |
| | | |
| | | // 批量保存等级下的优惠券信息 |
| | | saveBatch(gradeCouponRecordList); |
| | | |
| | | couponTemplateDO.setUsageStartDate(firstDayStart); |
| | | couponTemplateDO.setUsageEndDate(lastDayEnd); |
| | | couponTemplateDO.setGetStartDate(firstDayStart); |
| | | couponTemplateDO.setGetEndDate(lastDayEnd); |
| | | |
| | | // 设置默认类型固定 |
| | | couponTemplateDO.setUsageType(CouponUsageTypeEnum.FIXED.getType()); |
| | | |
| | | return couponTemplateDO; |
| | | |
| | | }).collect(Collectors.toList()); |
| | | |
| | | // 批量更新原模版时间 |
| | | couponTemplateService.updateBatchById(updateCouponTemplateList); |
| | | |
| | | return true; |
| | | }catch (Exception e){ |
| | | // 报错日志信息报错 |
| | | log.error(e.getMessage()); |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public boolean expiredCouponRecordByListCurMonth() { |
| | | |
| | | try{ |
| | | LocalDateTime now = LocalDateTime.now(); |
| | | LocalDateTime firstDayStart = now.with(TemporalAdjusters.firstDayOfMonth()).withHour(0).withMinute(0).withSecond(0).withNano(0); |
| | | LocalDateTime lastDayEnd = now.with(TemporalAdjusters.lastDayOfMonth()).withHour(23).withMinute(59).withSecond(59).withNano(0); |
| | | |
| | | // 只要找出时间小于当月的首天的设置成过期就可以 |
| | | |
| | | QueryWrapper<CouponRecordDO> queryWrapper=new QueryWrapper<>(); |
| | | queryWrapper.lambda().eq(CouponRecordDO::getOrderId,"") |
| | | .lt(CouponRecordDO::getEffectiveEnd,firstDayStart); |
| | | |
| | | final List<CouponRecordDO> couponRecordDOS = baseMapper.selectList(queryWrapper); |
| | | |
| | | final List<CouponRecordDO> expiredCouponRecordList = couponRecordDOS.stream().map(couponRecordDO -> { |
| | | couponRecordDO.setStatus(CouponUsedStatusEnum.EXPIRED.getType()); |
| | | return couponRecordDO; |
| | | }).collect(Collectors.toList()); |
| | | |
| | | //更新 |
| | | updateBatchById(expiredCouponRecordList); |
| | | |
| | | return true; |
| | | }catch (Exception e){ |
| | | log.error(e.getMessage()); |
| | | return false; |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public int statisCouponTemplateCount(QueryCouponStatisticsBO queryCouponStatisticsBO) { |
| | | return couponRecordMapperCustom.statisCouponTemplateCount(queryCouponStatisticsBO); |
| | | } |
| | | @Override |
| | | public int statisCouponTemplateCurMonCount(QueryCouponStatisticsBO queryCouponStatisticsBO) { |
| | | return couponRecordMapperCustom.statisCouponTemplateCurMonCount(queryCouponStatisticsBO); |
| | | } |
| | | |
| | | @Override |
| | | public int statisCouponPointCurMonPontAmonut(QueryCouponStatisticsBO queryCouponStatisticsBO) { |
| | | return couponRecordMapperCustom.statisCouponPointCurMonPointAmonut(queryCouponStatisticsBO); |
| | | } |
| | | } |
对比新文件 |
| | |
| | | package com.mzl.flower.service.impl.coupon; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.mzl.flower.entity.coupon.CouponTemplateCustomerDO; |
| | | import com.mzl.flower.mapper.coupon.CouponTemplateCustomerMapper; |
| | | import com.mzl.flower.service.coupon.CouponTemplateCustomerService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务实现类 |
| | | * </p> |
| | | * |
| | | * @author @TaoJie |
| | | * @since 2024-08-24 |
| | | */ |
| | | @Service |
| | | public class CouponTemplateCustomerServiceImpl extends ServiceImpl<CouponTemplateCustomerMapper, CouponTemplateCustomerDO> implements CouponTemplateCustomerService { |
| | | |
| | | @Override |
| | | public List<CouponTemplateCustomerDO> getPointCustomReList(String id) { |
| | | QueryWrapper<CouponTemplateCustomerDO> queryWrapper=new QueryWrapper<>(); |
| | | queryWrapper.lambda().eq(CouponTemplateCustomerDO::getCouponId,id); |
| | | return baseMapper.selectList(queryWrapper); |
| | | } |
| | | |
| | | @Override |
| | | public boolean deleteByCouponTemplateId(String couponTemplateId) { |
| | | QueryWrapper<CouponTemplateCustomerDO> queryWrapper=new QueryWrapper<>(); |
| | | queryWrapper.lambda().eq(CouponTemplateCustomerDO::getCouponId,couponTemplateId); |
| | | return baseMapper.delete(queryWrapper)>0; |
| | | } |
| | | } |
对比新文件 |
| | |
| | | package com.mzl.flower.service.impl.coupon; |
| | | |
| | | import cn.hutool.core.util.IdUtil; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.mzl.flower.config.security.SecurityUtils; |
| | | import com.mzl.flower.dto.request.coupon.*; |
| | | import com.mzl.flower.dto.response.coupon.CouponTemplateVO; |
| | | import com.mzl.flower.entity.coupon.CouponRecordDO; |
| | | import com.mzl.flower.entity.coupon.CouponTemplateCustomerDO; |
| | | import com.mzl.flower.entity.coupon.CouponTemplateDO; |
| | | import com.mzl.flower.entity.customer.Customer; |
| | | import com.mzl.flower.enums.*; |
| | | import com.mzl.flower.mapper.coupon.CouponTemplateMapper; |
| | | import com.mzl.flower.mapper.coupon.CouponTemplateMapperCustom; |
| | | import com.mzl.flower.mapper.customer.CustomerMapper; |
| | | import com.mzl.flower.service.coupon.CouponRecordService; |
| | | import com.mzl.flower.service.coupon.CouponTemplateCustomerService; |
| | | import com.mzl.flower.service.coupon.CouponTemplateService2; |
| | | import com.mzl.flower.service.payment.OrderService; |
| | | import org.apache.commons.collections4.CollectionUtils; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.time.LocalDateTime; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务实现类 |
| | | * </p> |
| | | * |
| | | * @author @TaoJie |
| | | * @since 2024-08-22 |
| | | */ |
| | | @Service |
| | | public class CouponTemplateServiceImpl2 extends ServiceImpl<CouponTemplateMapper, CouponTemplateDO> implements CouponTemplateService2 { |
| | | |
| | | @Autowired |
| | | private CouponTemplateMapperCustom couponTemplateMapperCustom; |
| | | |
| | | @Autowired |
| | | private CouponTemplateCustomerService pointCustomReService; |
| | | |
| | | @Autowired |
| | | private CouponRecordService couponRecordService; |
| | | |
| | | @Autowired |
| | | private CustomerMapper customerMapper; |
| | | |
| | | @Autowired |
| | | private OrderService orderService; |
| | | |
| | | @Transactional |
| | | @Override |
| | | public boolean createCouponTemplate(CreateCouponTemplateBO dto) { |
| | | CouponTemplateDO couponTemplateDO = new CouponTemplateDO(); |
| | | BeanUtils.copyProperties(dto, couponTemplateDO); |
| | | // 设置id,关联使用到的id |
| | | couponTemplateDO.setId(IdUtil.simpleUUID()); |
| | | |
| | | couponTemplateDO.create(SecurityUtils.getUserId()); |
| | | if (StringUtils.isBlank(dto.getStatus())) { |
| | | // 优惠券状态 初始化为未激活状态 |
| | | couponTemplateDO.setStatus(CouponStatusEnum.INACTIVE.getStatus()); |
| | | } |
| | | |
| | | // 指定会员:需要添加制定用户的关联信息 |
| | | if (CollectionUtils.isNotEmpty(dto.getPointCostomIdList())) { |
| | | |
| | | final List<CouponTemplateCustomerDO> couponCustomList = dto.getPointCostomIdList().stream().map(customId -> { |
| | | CouponTemplateCustomerDO customReDO = new CouponTemplateCustomerDO(); |
| | | customReDO.setCouponId(couponTemplateDO.getId()); |
| | | customReDO.setCustomId(customId); |
| | | return customReDO; |
| | | }).collect(Collectors.toList()); |
| | | |
| | | // 批量插入 优惠券与指定用户关联关系 |
| | | pointCustomReService.saveBatch(couponCustomList); |
| | | |
| | | // 设置优惠券的数量 |
| | | couponTemplateDO.setCouponAmount(dto.getPointCostomIdList().size()); |
| | | |
| | | } |
| | | |
| | | return baseMapper.insert(couponTemplateDO) > 0; |
| | | } |
| | | |
| | | @Transactional |
| | | @Override |
| | | public boolean updateCouponTemplate(CreateCouponTemplateBO dto) { |
| | | CouponTemplateDO couponTemplateDO = baseMapper.selectById(dto.getId()); |
| | | BeanUtils.copyProperties(dto, couponTemplateDO); |
| | | couponTemplateDO.update(SecurityUtils.getUserId()); |
| | | |
| | | if (CollectionUtils.isNotEmpty(dto.getPointCostomIdList())) { |
| | | // 根据优惠券的信息删除关联信息 |
| | | pointCustomReService.deleteByCouponTemplateId(couponTemplateDO.getId()); |
| | | } |
| | | // 指定会员:需要添加制定用户的关联信息 |
| | | if (CollectionUtils.isNotEmpty(dto.getPointCostomIdList())) { |
| | | |
| | | final List<CouponTemplateCustomerDO> couponCustomList = dto.getPointCostomIdList().stream().map(customId -> { |
| | | CouponTemplateCustomerDO customReDO = new CouponTemplateCustomerDO(); |
| | | customReDO.setCouponId(couponTemplateDO.getId()); |
| | | customReDO.setCustomId(customId); |
| | | return customReDO; |
| | | }).collect(Collectors.toList()); |
| | | |
| | | // 批量插入 优惠券与指定用户关联关系 |
| | | pointCustomReService.saveBatch(couponCustomList); |
| | | |
| | | // 设置优惠券总数当前人数 |
| | | couponTemplateDO.setCouponAmount(couponCustomList.size()); |
| | | |
| | | } |
| | | |
| | | |
| | | return baseMapper.updateById(couponTemplateDO) > 0; |
| | | } |
| | | |
| | | @Override |
| | | public List<CouponTemplateVO> getList(QueryCouponDTO dto) { |
| | | |
| | | List<CouponTemplateVO> list = couponTemplateMapperCustom.getList(dto); |
| | | return list; |
| | | } |
| | | |
| | | @Override |
| | | public Page<CouponTemplateVO> getPage(Page page, QueryCouponDTO dto) { |
| | | List<CouponTemplateVO> result = couponTemplateMapperCustom.getCouponTemplatePage(page, dto); |
| | | return page.setRecords(result); |
| | | } |
| | | |
| | | @Override |
| | | public CouponTemplateVO getDetailById(String id) { |
| | | QueryCouponDTO dto = new QueryCouponDTO(); |
| | | dto.setId(id); |
| | | final List<CouponTemplateVO> list = getList(dto); |
| | | if (CollectionUtils.isNotEmpty(list)) { |
| | | return list.get(0); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | @Transactional |
| | | @Override |
| | | public boolean deleteCouponTemplate(String id) { |
| | | return baseMapper.deleteById(id) > 0; |
| | | } |
| | | |
| | | @Transactional |
| | | @Override |
| | | public boolean activeCouponTemplate(String id) { |
| | | |
| | | CouponTemplateDO couponTemplateDO = baseMapper.selectById(id); |
| | | couponTemplateDO.setStatus(CouponStatusEnum.ACTIVE.getStatus()); |
| | | |
| | | // 判断当前的优惠券的用户类型是指定用户还是全部用户,如果是指定用户的情况下需要发布优惠券 |
| | | if (StringUtils.isNotBlank(couponTemplateDO.getGetUserType()) |
| | | && StringUtils.isNotBlank(couponTemplateDO.getCategory()) |
| | | && couponTemplateDO.getGetUserType().equals(CouponGetUserTypeEnum.POINT.getType()) |
| | | && couponTemplateDO.getCategory().equals(CouponCategoryEnum.USER.getStatus()) |
| | | ) { |
| | | |
| | | // 获取当前优惠券下的指定人员信息 |
| | | List<CouponTemplateCustomerDO> couponTemplateCustomerDOList = pointCustomReService.getPointCustomReList(id); |
| | | |
| | | if (CollectionUtils.isNotEmpty(couponTemplateCustomerDOList)) { |
| | | |
| | | // 根据发放后有效期来设置时间 |
| | | if (couponTemplateDO.getUsageTimeNum() == null || couponTemplateDO.getUsageTimeNum() <= 0) { |
| | | throw new IllegalArgumentException("使用时间数量必须为正整数"); |
| | | } |
| | | LocalDateTime currentTime = LocalDateTime.now(); |
| | | couponTemplateDO.setUsageStartDate(currentTime); |
| | | if (couponTemplateDO.getUsageTimeType().equals(CouponUsageTimeTypeEnum.DAY.getType())) { |
| | | // 天 |
| | | couponTemplateDO.setUsageEndDate(currentTime.plusDays(couponTemplateDO.getUsageTimeNum())); |
| | | } |
| | | if (couponTemplateDO.getUsageTimeType().equals(CouponUsageTimeTypeEnum.HOUR.getType())) { |
| | | // 小时 |
| | | couponTemplateDO.setUsageEndDate(currentTime.plusDays(couponTemplateDO.getUsageTimeNum())); |
| | | } |
| | | if (couponTemplateDO.getUsageTimeType().equals(CouponUsageTimeTypeEnum.MINUTE.getType())) { |
| | | // 分钟 |
| | | couponTemplateDO.setUsageEndDate(currentTime.plusDays(couponTemplateDO.getUsageTimeNum())); |
| | | } |
| | | |
| | | // 优惠券的总数等于下发人员的总数 |
| | | couponTemplateDO.setCouponAmount(couponTemplateCustomerDOList.size()); |
| | | |
| | | List<CouponRecordDO> couponUsageDOList = couponTemplateCustomerDOList.stream().map(pointCustomRe -> { |
| | | |
| | | CouponRecordDO couponRecordDO = new CouponRecordDO(); |
| | | couponRecordDO.setCouponId(pointCustomRe.getCouponId()); |
| | | couponRecordDO.setCustomerId(pointCustomRe.getCustomId()); |
| | | final Customer customer = customerMapper.selectById(pointCustomRe.getCustomId()); |
| | | if (null != customer && StringUtils.isNotBlank(customer.getUserId())) { |
| | | // 设置所属用户id |
| | | couponRecordDO.setUserId(customer.getUserId()); |
| | | } |
| | | couponRecordDO.setStatus(CouponUsedStatusEnum.UNUSED.getType()); |
| | | |
| | | // 设置优惠券的使用开始时间 |
| | | couponRecordDO.setEffectiveStart(couponTemplateDO.getUsageStartDate()); |
| | | // 设置优惠券的使用结束时间 |
| | | couponRecordDO.setEffectiveEnd(couponTemplateDO.getUsageEndDate()); |
| | | |
| | | // 优惠券的冗余字段 |
| | | couponRecordDO.setCouponCode(couponTemplateDO.getCouponCode()); |
| | | couponRecordDO.setCouponName(couponTemplateDO.getCouponName()); |
| | | // 优惠券种类 |
| | | couponRecordDO.setCategory(couponTemplateDO.getGetUserType()); |
| | | couponRecordDO.setMinOrderAmount(couponTemplateDO.getMinOrderAmount()); |
| | | couponRecordDO.setCouponDiscountValue(couponTemplateDO.getCouponDiscountValue()); |
| | | couponRecordDO.setGetType(couponTemplateDO.getGetType()); |
| | | couponRecordDO.setCouponDiscountType(couponTemplateDO.getCouponDiscountType()); |
| | | couponRecordDO.setGetUserType(couponTemplateDO.getGetUserType()); |
| | | couponRecordDO.setPoint(couponTemplateDO.getPoint()); |
| | | |
| | | // 创建相关信息 |
| | | couponRecordDO.create(SecurityUtils.getUserId()); |
| | | |
| | | return couponRecordDO; |
| | | }).collect(Collectors.toList()); |
| | | |
| | | // 批量保存优惠券信息 |
| | | couponRecordService.saveBatch(couponUsageDOList); |
| | | } |
| | | } |
| | | return baseMapper.updateById(couponTemplateDO) > 0; |
| | | } |
| | | |
| | | @Transactional |
| | | @Override |
| | | public boolean expireCouponTemplate(String id) { |
| | | CouponTemplateDO couponTemplateDO = baseMapper.selectById(id); |
| | | couponTemplateDO.setStatus(CouponStatusEnum.EXPIRED.getStatus()); |
| | | return baseMapper.updateById(couponTemplateDO) > 0; |
| | | } |
| | | |
| | | /** |
| | | * 获取所有会员优惠券模版 |
| | | * |
| | | * @return |
| | | */ |
| | | @Transactional |
| | | @Override |
| | | public List<CouponTemplateDO> getVipCouponTemplate() { |
| | | QueryWrapper<CouponTemplateDO> queryWrapper = new QueryWrapper<>(); |
| | | queryWrapper.lambda() |
| | | .eq(CouponTemplateDO::getDeleted, TrueOrFalseEnum.FALSE.isFlag()) |
| | | .eq(CouponTemplateDO::getCategory, CouponCategoryEnum.MEMBER.getStatus()) |
| | | .eq(CouponTemplateDO::getStatus, CouponStatusEnum.ACTIVE.getStatus()); |
| | | |
| | | return baseMapper.selectList(queryWrapper); |
| | | |
| | | } |
| | | |
| | | @Transactional |
| | | @Override |
| | | public boolean deleteBatchCouponTemplate(BatchCouponTemplateDTO dto) { |
| | | |
| | | if (CollectionUtils.isNotEmpty(dto.getIdList())) { |
| | | dto.setUpdateBy(SecurityUtils.getUserId()); |
| | | return couponTemplateMapperCustom.deleteBatchCouponTemplate(dto) > 0; |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | @Transactional |
| | | @Override |
| | | public boolean activeBatchCouponTemplate(BatchCouponTemplateDTO dto) { |
| | | if (CollectionUtils.isNotEmpty(dto.getIdList())) { |
| | | dto.setUpdateBy(SecurityUtils.getUserId()); |
| | | return couponTemplateMapperCustom.activeBatchCouponTemplate(dto) > 0; |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | @Transactional |
| | | @Override |
| | | public boolean expireBatchCouponTemplate(BatchCouponTemplateDTO dto) { |
| | | if (CollectionUtils.isNotEmpty(dto.getIdList())) { |
| | | dto.setUpdateBy(SecurityUtils.getUserId()); |
| | | return couponTemplateMapperCustom.expireBatchCouponTemplate(dto) > 0; |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | @Override |
| | | public CouponTemplateVO statisCouponTemplatePoint(QueryCouponStatisticsBO queryCouponStatisticsBO) { |
| | | |
| | | //TODO 优惠券总数 |
| | | couponRecordService.statisCouponTemplateCount(queryCouponStatisticsBO); |
| | | |
| | | //TODO 本月兑换优惠券总数 |
| | | couponRecordService.statisCouponTemplateCurMonCount(queryCouponStatisticsBO); |
| | | |
| | | //TODO 本月兑换积分总数 |
| | | couponRecordService.statisCouponPointCurMonPontAmonut(queryCouponStatisticsBO); |
| | | |
| | | return null; |
| | | } |
| | | } |
对比新文件 |
| | |
| | | package com.mzl.flower.utils; |
| | | |
| | | import org.springframework.beans.BeanUtils; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | import java.util.stream.Collectors; |
| | | |
| | | public class ConverterUtil { |
| | | |
| | | /** |
| | | * 单个对象的转换 |
| | | * @param source 源对象 |
| | | * @param targetClass 目标类的类型 |
| | | * @param <T> 源类型 |
| | | * @param <R> 目标类型 |
| | | * @return 转换后的目标对象 |
| | | */ |
| | | public static <T, R> R transObject(T source, Class<R> targetClass) { |
| | | if (source == null) { |
| | | return null; |
| | | } |
| | | try { |
| | | R targetObject = targetClass.getDeclaredConstructor().newInstance(); |
| | | BeanUtils.copyProperties(source, targetObject); |
| | | return targetObject; |
| | | } catch (Exception e) { |
| | | throw new RuntimeException("对象转换失败", e); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * List对象的转换 |
| | | * @param sourceList 源List对象 |
| | | * @param targetClass 目标类的类型 |
| | | * @param <T> 源类型 |
| | | * @param <R> 目标类型 |
| | | * @return 转换后的目标List对象 |
| | | */ |
| | | public static <T, R> List<R> transList(List<T> sourceList, Class<R> targetClass) { |
| | | if (sourceList == null || sourceList.isEmpty()) { |
| | | return new ArrayList<>(); |
| | | } |
| | | return sourceList.stream() |
| | | .filter(Objects::nonNull) |
| | | .map(sourceObject -> transObject(sourceObject, targetClass)) |
| | | .collect(Collectors.toList()); |
| | | } |
| | | |
| | | /** |
| | | * Page对象的转换 |
| | | * @param sourcePage 源Page对象 |
| | | * @param targetClass 目标类的类型 |
| | | * @param <T> 源类型 |
| | | * @param <R> 目标类型 |
| | | * @return 转换后的目标Page对象 |
| | | */ |
| | | public static <T, R> Page<R> transPage(Page<T> sourcePage, Class<R> targetClass) { |
| | | if (sourcePage == null) { |
| | | return new Page<>(); |
| | | } |
| | | |
| | | // 创建一个新的 Page 对象用于存放转换后的目标类型对象 |
| | | Page<R> targetPage = new Page<>(sourcePage.getCurrent(), sourcePage.getSize(), sourcePage.getTotal()); |
| | | |
| | | // 转换列表并设置到 Page 对象中 |
| | | List<R> targetList = transList(sourcePage.getRecords(), targetClass); |
| | | targetPage.setRecords(targetList); |
| | | return targetPage; |
| | | } |
| | | } |
对比新文件 |
| | |
| | | package com.mzl.flower.web.v2.coupon; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.mzl.flower.base.BaseController; |
| | | import com.mzl.flower.base.R; |
| | | import com.mzl.flower.base.ReturnDataDTO; |
| | | import com.mzl.flower.config.exception.ValidationException; |
| | | import com.mzl.flower.dto.request.coupon.CreateCouponRecordDTO; |
| | | import com.mzl.flower.dto.request.coupon.QueryCouponRecordDTO; |
| | | import com.mzl.flower.dto.response.coupon.CouponRecordResultVO; |
| | | import com.mzl.flower.dto.response.coupon.CouponRecordVO; |
| | | import com.mzl.flower.entity.coupon.CouponRecordDO; |
| | | import com.mzl.flower.entity.coupon.CouponTemplateDO; |
| | | import com.mzl.flower.enums.CouponStatusEnum; |
| | | import com.mzl.flower.service.coupon.CouponRecordService; |
| | | import com.mzl.flower.service.coupon.CouponTemplateService2; |
| | | import com.mzl.flower.utils.ConverterUtil; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.http.ResponseEntity; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | |
| | | /** |
| | | * @author @TaoJie |
| | | * @since 2024-08-27 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/v2/coupon-record") |
| | | @Api(value = "优惠券记录管理-活动", tags = "优惠券记录管理") |
| | | @Validated |
| | | public class CouponRecordController extends BaseController { |
| | | |
| | | @Autowired |
| | | CouponRecordService couponRecordService; |
| | | |
| | | @Autowired |
| | | private CouponTemplateService2 couponTemplateService; |
| | | |
| | | |
| | | |
| | | @PostMapping("") |
| | | @ApiOperation(value = "新增", notes = "新增") |
| | | public ResponseEntity<ReturnDataDTO> create(@Validated @RequestBody CreateCouponRecordDTO dto) { |
| | | |
| | | final CouponTemplateDO couponTemplateDO = couponTemplateService.getById(dto.getCouponId()); |
| | | if(null==couponTemplateDO){ |
| | | throw new ValidationException("优惠券不存在"); |
| | | } |
| | | |
| | | if(StringUtils.isNotBlank(couponTemplateDO.getStatus()) && !couponTemplateDO.getStatus().equals(CouponStatusEnum.INACTIVE.getStatus())){ |
| | | throw new ValidationException("优惠券还未发布"); |
| | | } |
| | | if(StringUtils.isNotBlank(couponTemplateDO.getStatus()) && !couponTemplateDO.getStatus().equals(CouponStatusEnum.EXPIRED.getStatus())){ |
| | | throw new ValidationException("优惠券已下架"); |
| | | } |
| | | |
| | | |
| | | couponRecordService.createCouponRecord(dto); |
| | | return returnData(R.SUCCESS.getCode(), null); |
| | | } |
| | | |
| | | @PutMapping("/{id}") |
| | | @ApiOperation(value = "修改", notes = "修改") |
| | | public ResponseEntity<ReturnDataDTO> update(@Validated @RequestBody CreateCouponRecordDTO dto) { |
| | | |
| | | CouponRecordDO couponRecordDO= couponRecordService.getById(dto.getId()); |
| | | if(null==couponRecordDO){ |
| | | throw new ValidationException("优惠券记录不存在"); |
| | | } |
| | | |
| | | return returnData(R.SUCCESS.getCode(), couponRecordService.updateCouponRecord(dto)); |
| | | } |
| | | |
| | | @DeleteMapping("/{id}") |
| | | @ApiOperation(value = "删除", notes = "删除") |
| | | public ResponseEntity<ReturnDataDTO> delete(@PathVariable String id ) { |
| | | |
| | | CouponRecordDO couponRecordDO= couponRecordService.getById(id); |
| | | if(null==couponRecordDO){ |
| | | throw new ValidationException("优惠券记录不存在"); |
| | | } |
| | | couponRecordService.deleteCouponRecord(id); |
| | | return returnData(R.SUCCESS.getCode(), null); |
| | | } |
| | | |
| | | @GetMapping("/{id}") |
| | | @ApiOperation(value = "详情", notes = "详情") |
| | | public ResponseEntity<ReturnDataDTO> get(@PathVariable String id) { |
| | | CouponRecordVO couponRecordVO=couponRecordService.getCouponRecordById(id); |
| | | return returnData(R.SUCCESS.getCode(),ConverterUtil.transObject(couponRecordVO, CouponRecordResultVO.class)); |
| | | } |
| | | |
| | | @GetMapping("/page") |
| | | @ApiOperation(value = "查询-分页", notes = "查询-分页") |
| | | public ResponseEntity<ReturnDataDTO<Page<CouponRecordVO>>> page( |
| | | Page page, QueryCouponRecordDTO dto |
| | | ) { |
| | | return returnData(R.SUCCESS.getCode(), ConverterUtil.transPage(couponRecordService.getPage(page,dto), CouponRecordResultVO.class)); |
| | | } |
| | | |
| | | @GetMapping("/list") |
| | | @ApiOperation(value = "查询-全部", notes = "查询-全部") |
| | | public ResponseEntity<ReturnDataDTO<Page<CouponRecordVO>>> list(QueryCouponRecordDTO dto |
| | | ) { |
| | | return returnData(R.SUCCESS.getCode(),ConverterUtil.transList(couponRecordService.getList(dto), CouponRecordResultVO.class)); |
| | | |
| | | } |
| | | |
| | | } |
对比新文件 |
| | |
| | | package com.mzl.flower.web.v2.coupon; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.mzl.flower.base.BaseController; |
| | | import com.mzl.flower.base.R; |
| | | import com.mzl.flower.base.ReturnDataDTO; |
| | | import com.mzl.flower.config.exception.ValidationException; |
| | | import com.mzl.flower.dto.request.coupon.*; |
| | | import com.mzl.flower.dto.response.coupon.CouponTemplateActivyVO; |
| | | import com.mzl.flower.dto.response.coupon.CouponTemplatePointVO; |
| | | import com.mzl.flower.dto.response.coupon.CouponTemplateVO; |
| | | import com.mzl.flower.entity.coupon.CouponTemplateDO; |
| | | import com.mzl.flower.enums.CouponCategoryEnum; |
| | | import com.mzl.flower.enums.CouponGetUserTypeEnum; |
| | | import com.mzl.flower.enums.CouponTypeEnum; |
| | | import com.mzl.flower.enums.CouponUsageTypeEnum; |
| | | import com.mzl.flower.service.coupon.CouponTemplateService2; |
| | | import com.mzl.flower.utils.ConverterUtil; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.http.ResponseEntity; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | |
| | | /** |
| | | * @author @TaoJie |
| | | * @since 2024-08-22 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/api/v2/coupon/avtivy") |
| | | @Api(value = "优惠券管理-活动", tags = "优惠券管理-活动") |
| | | @Validated |
| | | public class CouponTemplateActivyController extends BaseController { |
| | | |
| | | @Autowired |
| | | CouponTemplateService2 couponTemplateService; |
| | | |
| | | @PostMapping("") |
| | | @ApiOperation(value = "新增", notes = "新增") |
| | | public ResponseEntity<ReturnDataDTO> create(@Validated @RequestBody CreateCouponTemplateActivyDTO dto) { |
| | | |
| | | // 信息验证 |
| | | valid(dto); |
| | | |
| | | CreateCouponTemplateBO couponTemplateBO = new CreateCouponTemplateBO(); |
| | | BeanUtils.copyProperties(dto, couponTemplateBO); |
| | | |
| | | // 设置成积分优惠券 |
| | | couponTemplateBO.setCategory(CouponCategoryEnum.ACTIVITY.getStatus()); |
| | | couponTemplateBO.setGetUserType(CouponGetUserTypeEnum.ALL.getType()); |
| | | |
| | | |
| | | couponTemplateService.createCouponTemplate(couponTemplateBO); |
| | | return returnData(R.SUCCESS.getCode(), null); |
| | | |
| | | |
| | | } |
| | | |
| | | @PutMapping("/{id}") |
| | | @ApiOperation(value = "修改", notes = "修改") |
| | | public ResponseEntity<ReturnDataDTO> update(@Validated @RequestBody CreateCouponTemplateActivyDTO dto) { |
| | | |
| | | // 信息验证 |
| | | valid(dto); |
| | | |
| | | CouponTemplateDO couponTemplateDO = couponTemplateService.getById(dto.getId()); |
| | | if (null == couponTemplateDO) { |
| | | throw new ValidationException("优惠券不存在"); |
| | | } |
| | | |
| | | CreateCouponTemplateBO couponTemplateBO = new CreateCouponTemplateBO(); |
| | | BeanUtils.copyProperties(dto, couponTemplateBO); |
| | | |
| | | // 设置成积分优惠券 |
| | | couponTemplateBO.setCategory(CouponCategoryEnum.ACTIVITY.getStatus()); |
| | | couponTemplateBO.setGetUserType(CouponGetUserTypeEnum.ALL.getType()); |
| | | |
| | | couponTemplateService.updateCouponTemplate(couponTemplateBO); |
| | | |
| | | return returnData(R.SUCCESS.getCode(), null); |
| | | } |
| | | |
| | | @DeleteMapping("/{id}") |
| | | @ApiOperation(value = "删除", notes = "删除") |
| | | public ResponseEntity<ReturnDataDTO> delete(@PathVariable String id) { |
| | | |
| | | CouponTemplateDO couponTemplateDO = couponTemplateService.getById(id); |
| | | if (null == couponTemplateDO) { |
| | | throw new ValidationException("优惠券不存在"); |
| | | } |
| | | couponTemplateService.deleteCouponTemplate(id); |
| | | return returnData(R.SUCCESS.getCode(), null); |
| | | } |
| | | |
| | | @GetMapping("/{id}") |
| | | @ApiOperation(value = "详情", notes = "详情") |
| | | public ResponseEntity<ReturnDataDTO> get(@PathVariable String id) { |
| | | CouponTemplateVO couponTemplateVO = couponTemplateService.getDetailById(id); |
| | | return returnData(R.SUCCESS.getCode(), ConverterUtil.transObject(couponTemplateVO, CouponTemplateActivyVO.class)); |
| | | } |
| | | |
| | | @GetMapping("/page") |
| | | @ApiOperation(value = "查询-分页", notes = "查询-分页") |
| | | public ResponseEntity<ReturnDataDTO<Page<CouponTemplatePointVO>>> page(Page page, QueryCouponDTO dto) { |
| | | // 设置只查询积分优惠券的 |
| | | dto.setCategory(CouponCategoryEnum.ACTIVITY.getStatus()); |
| | | Page<CouponTemplateVO> resultPage = couponTemplateService.getPage(page, dto); |
| | | return returnData(R.SUCCESS.getCode(), ConverterUtil.transPage(resultPage, CouponTemplateActivyVO.class)); |
| | | } |
| | | |
| | | @GetMapping("/list") |
| | | @ApiOperation(value = "查询-全部", notes = "查询-全部") |
| | | public ResponseEntity<ReturnDataDTO<Page<CouponTemplateVO>>> list(QueryCouponDTO dto) { |
| | | // 设置只查询积分优惠券的 |
| | | dto.setCategory(CouponCategoryEnum.ACTIVITY.getStatus()); |
| | | return returnData(R.SUCCESS.getCode(), ConverterUtil.transList(couponTemplateService.getList(dto), CouponTemplateActivyVO.class)); |
| | | } |
| | | |
| | | |
| | | @PutMapping("/active/{id}") |
| | | @ApiOperation(value = "发布", notes = "发布") |
| | | public ResponseEntity<ReturnDataDTO> active(@PathVariable String id) { |
| | | |
| | | CouponTemplateDO couponTemplateDO = couponTemplateService.getById(id); |
| | | if (null == couponTemplateDO) { |
| | | throw new ValidationException("优惠券不存在"); |
| | | } |
| | | |
| | | couponTemplateService.activeCouponTemplate(id); |
| | | |
| | | return returnData(R.SUCCESS.getCode(), null); |
| | | } |
| | | |
| | | @PutMapping("/expire/{id}") |
| | | @ApiOperation(value = "下架", notes = "下架") |
| | | public ResponseEntity<ReturnDataDTO> expire(@PathVariable String id) { |
| | | |
| | | CouponTemplateDO couponTemplateDO = couponTemplateService.getById(id); |
| | | if (null == couponTemplateDO) { |
| | | throw new ValidationException("优惠券不存在"); |
| | | } |
| | | |
| | | couponTemplateService.expireCouponTemplate(id); |
| | | |
| | | return returnData(R.SUCCESS.getCode(), null); |
| | | } |
| | | |
| | | |
| | | private void valid(CreateCouponTemplateActivyDTO dto){ |
| | | |
| | | if (StringUtils.isNotBlank(dto.getCouponDiscountType()) |
| | | && dto.getCouponDiscountType().equals(CouponTypeEnum.DISCOUNT.getType()) |
| | | && dto.getMinOrderAmount().compareTo(dto.getCouponDiscountValue()) < 0) { |
| | | throw new ValidationException("订单金额不能小于折扣金额"); |
| | | } |
| | | if (StringUtils.isNotBlank(dto.getCouponDiscountType()) |
| | | && dto.getCouponDiscountType().equals(CouponTypeEnum.DISCOUNT.getType()) |
| | | && dto.getCouponDiscountValue().compareTo(BigDecimal.ZERO) <= 0) { |
| | | throw new ValidationException("折扣金额必须大于0"); |
| | | } |
| | | |
| | | if (StringUtils.isNotBlank(dto.getCouponDiscountType()) |
| | | && dto.getCouponDiscountType().equals(CouponTypeEnum.ZERO.getType()) |
| | | && dto.getMinOrderAmount().compareTo(BigDecimal.ZERO) != 0) { |
| | | throw new ValidationException("无门槛的订单金额必须为0"); |
| | | } |
| | | |
| | | // 领取后 固定时间 |
| | | if(StringUtils.isNotBlank(dto.getUsageType()) && dto.getUsageType().equals(CouponUsageTypeEnum.FIXED.getType()) ){ |
| | | // 如果使用时间是固定时间的话,那么固定时间的开始时间和结束时间就不能为空 |
| | | if(dto.getUsageStartDate()==null){ |
| | | throw new ValidationException("固定时间开始日期不能为空"); |
| | | } |
| | | if(dto.getUsageEndDate()==null){ |
| | | throw new ValidationException("固定时间结束日期不能为空"); |
| | | } |
| | | } |
| | | |
| | | // 领取后 有效时间 |
| | | if(StringUtils.isNotBlank(dto.getUsageType()) && dto.getUsageType().equals(CouponUsageTypeEnum.GET_AFTER_TIME.getType())){ |
| | | // 如果使用时间是领取后有效时间的话,那么领取后的时间类型不能为空,且时间不能为空 |
| | | if(StringUtils.isBlank(dto.getUsageTimeType())){ |
| | | throw new ValidationException("领取后有效时间类型(COUPON_USAGE_TIME_TYPE)不能为空"); |
| | | } |
| | | |
| | | if(dto.getUsageTimeNum()==null){ |
| | | throw new ValidationException("领取后有效时间整数不能为空"); |
| | | } |
| | | if(dto.getUsageTimeNum()<=0){ |
| | | throw new ValidationException("领取后有效时间整数需要大于0"); |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
对比新文件 |
| | |
| | | package com.mzl.flower.web.v2.coupon; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.mzl.flower.base.BaseController; |
| | | import com.mzl.flower.base.R; |
| | | import com.mzl.flower.base.ReturnDataDTO; |
| | | import com.mzl.flower.config.exception.ValidationException; |
| | | import com.mzl.flower.dto.request.coupon.CreateCouponTemplateDTO; |
| | | import com.mzl.flower.dto.request.coupon.QueryCouponDTO; |
| | | import com.mzl.flower.dto.response.coupon.CouponTemplateActivyVO; |
| | | import com.mzl.flower.enums.CouponUsageTypeEnum; |
| | | import com.mzl.flower.service.coupon.CouponTemplateService2; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.http.ResponseEntity; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import com.mzl.flower.entity.coupon.CouponTemplateDO; |
| | | |
| | | |
| | | /** |
| | | * @author @TaoJie |
| | | * @since 2024-08-22 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/api/v2/coupon/all") |
| | | //@Api(value = "优惠券管理-活动", tags = "优惠券管理-活动") |
| | | @Validated |
| | | public class CouponTemplateController extends BaseController { |
| | | |
| | | @Autowired |
| | | CouponTemplateService2 couponTemplateService; |
| | | |
| | | @PostMapping("") |
| | | @ApiOperation(value = "新增优惠券", notes = "新增优惠券") |
| | | public ResponseEntity<ReturnDataDTO> create(@Validated @RequestBody CreateCouponTemplateDTO dto) { |
| | | |
| | | // 信息验证 |
| | | valid(dto); |
| | | |
| | | // couponTemplateService.createCouponTemplate(dto); |
| | | return returnData(R.SUCCESS.getCode(), null); |
| | | } |
| | | |
| | | @PutMapping("/{id}") |
| | | @ApiOperation(value = "修改", notes = "修改") |
| | | public ResponseEntity<ReturnDataDTO> update(@Validated @RequestBody CreateCouponTemplateDTO dto) { |
| | | |
| | | CouponTemplateDO couponTemplateDO= couponTemplateService.getById(dto.getId()); |
| | | if(null==couponTemplateDO){ |
| | | throw new ValidationException("优惠券不存在"); |
| | | } |
| | | |
| | | // 信息验证 |
| | | valid(dto); |
| | | |
| | | // couponTemplateService.updateCouponTemplate(dto); |
| | | |
| | | return returnData(R.SUCCESS.getCode(), null); |
| | | } |
| | | |
| | | @DeleteMapping("/{id}") |
| | | @ApiOperation(value = "删除", notes = "删除") |
| | | public ResponseEntity<ReturnDataDTO> delete(@PathVariable String id ) { |
| | | |
| | | CouponTemplateDO couponTemplateDO= couponTemplateService.getById(id); |
| | | if(null==couponTemplateDO){ |
| | | throw new ValidationException("优惠券不存在"); |
| | | } |
| | | couponTemplateService.deleteCouponTemplate(id); |
| | | return returnData(R.SUCCESS.getCode(), null); |
| | | } |
| | | |
| | | @GetMapping("/{id}") |
| | | @ApiOperation(value = "详情", notes = "详情") |
| | | public ResponseEntity<ReturnDataDTO> get(@PathVariable String id) { |
| | | // CouponTemplateActivyVO couponTemplateActivyVO=couponTemplateService.getActivityCouponDetailById(id); |
| | | return returnData(R.SUCCESS.getCode(),null); |
| | | } |
| | | |
| | | @GetMapping("/page") |
| | | @ApiOperation(value = "查询-分页", notes = "查询-分页") |
| | | public ResponseEntity<ReturnDataDTO<Page<CouponTemplateActivyVO>>> page( |
| | | Page page, QueryCouponDTO dto |
| | | ) { |
| | | // couponTemplateService.getActivityPage(page,dto); |
| | | return returnData(R.SUCCESS.getCode(), null); |
| | | } |
| | | |
| | | @GetMapping("/list") |
| | | @ApiOperation(value = "查询-全部", notes = "查询-全部") |
| | | public ResponseEntity<ReturnDataDTO<Page<CouponTemplateActivyVO>>> list(QueryCouponDTO dto |
| | | ) { |
| | | // couponTemplateService.getActivityList(dto) |
| | | return returnData(R.SUCCESS.getCode(), null); |
| | | } |
| | | |
| | | |
| | | @PutMapping("/active/{id}") |
| | | @ApiOperation(value = "发布", notes = "发布") |
| | | public ResponseEntity<ReturnDataDTO> active(@PathVariable String id) { |
| | | |
| | | CouponTemplateDO couponTemplateDO= couponTemplateService.getById(id); |
| | | if(null==couponTemplateDO){ |
| | | throw new ValidationException("优惠券不存在"); |
| | | } |
| | | |
| | | couponTemplateService.activeCouponTemplate(id); |
| | | |
| | | return returnData(R.SUCCESS.getCode(), null); |
| | | } |
| | | |
| | | @PutMapping("/expire/{id}") |
| | | @ApiOperation(value = "下架", notes = "下架") |
| | | public ResponseEntity<ReturnDataDTO> expire(@PathVariable String id) { |
| | | |
| | | CouponTemplateDO couponTemplateDO= couponTemplateService.getById(id); |
| | | if(null==couponTemplateDO){ |
| | | throw new ValidationException("优惠券不存在"); |
| | | } |
| | | |
| | | couponTemplateService.expireCouponTemplate(id); |
| | | |
| | | return returnData(R.SUCCESS.getCode(), null); |
| | | } |
| | | |
| | | |
| | | private void valid(CreateCouponTemplateDTO dto){ |
| | | // 领取后 固定时间 |
| | | if(StringUtils.isNotBlank(dto.getUsageType()) && dto.getUsageType().equals(CouponUsageTypeEnum.FIXED.getType()) ){ |
| | | // 如果使用时间是固定时间的话,那么固定时间的开始时间和结束时间就不能为空 |
| | | if(dto.getUsageStartDate()==null){ |
| | | throw new ValidationException("固定时间开始日期不能为空"); |
| | | } |
| | | if(dto.getUsageEndDate()==null){ |
| | | throw new ValidationException("固定时间结束日期不能为空"); |
| | | } |
| | | } |
| | | |
| | | // 领取后 有效时间 |
| | | if(StringUtils.isNotBlank(dto.getUsageType()) && dto.getUsageType().equals(CouponUsageTypeEnum.GET_AFTER_TIME.getType())){ |
| | | // 如果使用时间是领取后有效时间的话,那么领取后的时间类型不能为空,且时间不能为空 |
| | | if(StringUtils.isBlank(dto.getUsageTimeType())){ |
| | | throw new ValidationException("领取后有效时间类型不能为空"); |
| | | } |
| | | |
| | | if(dto.getUsageTimeNum()==null){ |
| | | throw new ValidationException("领取后有效时间整数不能为空"); |
| | | } |
| | | if(dto.getUsageTimeNum()<=0){ |
| | | throw new ValidationException("领取后有效时间整数需要大于0"); |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
对比新文件 |
| | |
| | | package com.mzl.flower.web.v2.coupon; |
| | | |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | /** |
| | | * @author @TaoJie |
| | | * @since 2024-08-24 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/v2/coupon-template-point-custom-re") |
| | | public class CouponTemplateCustomerController { |
| | | |
| | | |
| | | } |
对比新文件 |
| | |
| | | package com.mzl.flower.web.v2.coupon; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.mzl.flower.base.BaseController; |
| | | import com.mzl.flower.base.R; |
| | | import com.mzl.flower.base.ReturnDataDTO; |
| | | import com.mzl.flower.config.exception.ValidationException; |
| | | import com.mzl.flower.dto.request.coupon.*; |
| | | import com.mzl.flower.dto.response.coupon.CouponTemplatePointVO; |
| | | import com.mzl.flower.dto.response.coupon.CouponTemplateVO; |
| | | import com.mzl.flower.entity.coupon.CouponTemplateDO; |
| | | import com.mzl.flower.enums.CouponCategoryEnum; |
| | | import com.mzl.flower.enums.CouponTypeEnum; |
| | | import com.mzl.flower.enums.CouponUsageTypeEnum; |
| | | import com.mzl.flower.service.coupon.CouponTemplateService2; |
| | | import com.mzl.flower.utils.ConverterUtil; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.http.ResponseEntity; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | |
| | | /** |
| | | * @author @TaoJie |
| | | * @since 2024-08-22 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/api/v2/coupon/point") |
| | | @Api(value = "优惠券管理-积分", tags = "优惠券管理-积分") |
| | | @Validated |
| | | public class CouponTemplatePointController extends BaseController { |
| | | |
| | | @Autowired |
| | | CouponTemplateService2 couponTemplateService; |
| | | |
| | | @PostMapping("") |
| | | @ApiOperation(value = "新增", notes = "新增") |
| | | public ResponseEntity<ReturnDataDTO> create(@Validated @RequestBody CreateCouponTemplatePointDTO dto) { |
| | | |
| | | // 信息校验 |
| | | valid(dto); |
| | | |
| | | CreateCouponTemplateBO couponTemplateBO = new CreateCouponTemplateBO(); |
| | | BeanUtils.copyProperties(dto, couponTemplateBO); |
| | | |
| | | // 设置成积分优惠券 |
| | | couponTemplateBO.setCategory(CouponCategoryEnum.POINT.getStatus()); |
| | | // 设置默认类型领取后有效 |
| | | couponTemplateBO.setUsageType(CouponUsageTypeEnum.GET_AFTER_TIME.getType()); |
| | | |
| | | couponTemplateService.createCouponTemplate(couponTemplateBO); |
| | | return returnData(R.SUCCESS.getCode(), null); |
| | | |
| | | |
| | | } |
| | | |
| | | @PutMapping("/{id}") |
| | | @ApiOperation(value = "修改", notes = "修改") |
| | | public ResponseEntity<ReturnDataDTO> update(@Validated @RequestBody CreateCouponTemplatePointDTO dto) { |
| | | // 信息校验 |
| | | valid(dto); |
| | | |
| | | CouponTemplateDO couponTemplateDO = couponTemplateService.getById(dto.getId()); |
| | | if (null == couponTemplateDO) { |
| | | throw new ValidationException("优惠券不存在"); |
| | | } |
| | | |
| | | CreateCouponTemplateBO couponTemplateBO = new CreateCouponTemplateBO(); |
| | | BeanUtils.copyProperties(dto, couponTemplateBO); |
| | | |
| | | // 设置成积分优惠券 |
| | | couponTemplateBO.setCategory(CouponCategoryEnum.POINT.getStatus()); |
| | | // 设置默认类型 |
| | | couponTemplateBO.setUsageType(CouponUsageTypeEnum.GET_AFTER_TIME.getType()); |
| | | |
| | | |
| | | couponTemplateService.updateCouponTemplate(couponTemplateBO); |
| | | |
| | | return returnData(R.SUCCESS.getCode(), null); |
| | | } |
| | | |
| | | @DeleteMapping("/{id}") |
| | | @ApiOperation(value = "删除", notes = "删除") |
| | | public ResponseEntity<ReturnDataDTO> delete(@PathVariable String id) { |
| | | |
| | | CouponTemplateDO couponTemplateDO = couponTemplateService.getById(id); |
| | | if (null == couponTemplateDO) { |
| | | throw new ValidationException("优惠券不存在"); |
| | | } |
| | | couponTemplateService.deleteCouponTemplate(id); |
| | | return returnData(R.SUCCESS.getCode(), null); |
| | | } |
| | | |
| | | @GetMapping("/{id}") |
| | | @ApiOperation(value = "详情", notes = "详情") |
| | | public ResponseEntity<ReturnDataDTO> get(@PathVariable String id) { |
| | | CouponTemplateVO couponTemplateVO = couponTemplateService.getDetailById(id); |
| | | return returnData(R.SUCCESS.getCode(), ConverterUtil.transObject(couponTemplateVO, CouponTemplatePointVO.class)); |
| | | } |
| | | |
| | | @GetMapping("/page") |
| | | @ApiOperation(value = "查询-分页", notes = "查询-分页") |
| | | public ResponseEntity<ReturnDataDTO<Page<CouponTemplatePointVO>>> page(Page page, QueryCouponDTO dto) { |
| | | // 设置只查询积分优惠券的 |
| | | dto.setCategory(CouponCategoryEnum.POINT.getStatus()); |
| | | Page<CouponTemplateVO> resultPage = couponTemplateService.getPage(page, dto); |
| | | return returnData(R.SUCCESS.getCode(), ConverterUtil.transPage(resultPage, CouponTemplatePointVO.class)); |
| | | } |
| | | |
| | | @GetMapping("/list") |
| | | @ApiOperation(value = "查询-全部", notes = "查询-全部") |
| | | public ResponseEntity<ReturnDataDTO<Page<CouponTemplateVO>>> list(QueryCouponDTO dto) { |
| | | // 设置只查询积分优惠券的 |
| | | dto.setCategory(CouponCategoryEnum.POINT.getStatus()); |
| | | return returnData(R.SUCCESS.getCode(), ConverterUtil.transList(couponTemplateService.getList(dto), CouponTemplatePointVO.class)); |
| | | } |
| | | |
| | | |
| | | @PutMapping("/active/{id}") |
| | | @ApiOperation(value = "发布", notes = "发布") |
| | | public ResponseEntity<ReturnDataDTO> active(@PathVariable String id) { |
| | | |
| | | CouponTemplateDO couponTemplateDO = couponTemplateService.getById(id); |
| | | if (null == couponTemplateDO) { |
| | | throw new ValidationException("优惠券不存在"); |
| | | } |
| | | |
| | | couponTemplateService.activeCouponTemplate(id); |
| | | |
| | | return returnData(R.SUCCESS.getCode(), null); |
| | | } |
| | | |
| | | @PutMapping("/expire/{id}") |
| | | @ApiOperation(value = "下架", notes = "下架") |
| | | public ResponseEntity<ReturnDataDTO> expire(@PathVariable String id) { |
| | | |
| | | CouponTemplateDO couponTemplateDO = couponTemplateService.getById(id); |
| | | if (null == couponTemplateDO) { |
| | | throw new ValidationException("优惠券不存在"); |
| | | } |
| | | |
| | | couponTemplateService.expireCouponTemplate(id); |
| | | |
| | | return returnData(R.SUCCESS.getCode(), null); |
| | | } |
| | | |
| | | @PutMapping("/batch/expire") |
| | | @ApiOperation(value = "批量下架", notes = "批量下架") |
| | | public ResponseEntity<ReturnDataDTO> expireBatch(BatchCouponTemplateDTO dto) { |
| | | |
| | | |
| | | couponTemplateService.expireBatchCouponTemplate(dto); |
| | | |
| | | return returnData(R.SUCCESS.getCode(), null); |
| | | } |
| | | |
| | | |
| | | |
| | | @PutMapping("/batch/active") |
| | | @ApiOperation(value = "批量发布", notes = "批量发布") |
| | | public ResponseEntity<ReturnDataDTO> activeBatch(BatchCouponTemplateDTO dto) { |
| | | |
| | | couponTemplateService.activeBatchCouponTemplate(dto); |
| | | |
| | | return returnData(R.SUCCESS.getCode(), null); |
| | | } |
| | | |
| | | |
| | | @DeleteMapping("/batch/del") |
| | | @ApiOperation(value = "批量删除", notes = "批量删除") |
| | | public ResponseEntity<ReturnDataDTO> deleteBatch(BatchCouponTemplateDTO dto) { |
| | | |
| | | couponTemplateService.deleteBatchCouponTemplate(dto); |
| | | return returnData(R.SUCCESS.getCode(), null); |
| | | } |
| | | |
| | | @GetMapping("/statistics") |
| | | @ApiOperation(value = "积分统计", notes = "积分统计") |
| | | public ResponseEntity<ReturnDataDTO> statistics(QueryCouponStatisticsDTO dto) { |
| | | QueryCouponStatisticsBO queryCouponStatisticsBO=new QueryCouponStatisticsBO(); |
| | | BeanUtils.copyProperties(dto,queryCouponStatisticsBO); |
| | | CouponTemplateVO couponTemplateVO = couponTemplateService.statisCouponTemplatePoint(queryCouponStatisticsBO); |
| | | return returnData(R.SUCCESS.getCode(), ConverterUtil.transObject(couponTemplateVO, CouponTemplatePointVO.class)); |
| | | } |
| | | |
| | | |
| | | private void valid(CreateCouponTemplatePointDTO dto){ |
| | | |
| | | if (StringUtils.isNotBlank(dto.getCouponDiscountType()) |
| | | && dto.getCouponDiscountType().equals(CouponTypeEnum.DISCOUNT.getType()) |
| | | && dto.getMinOrderAmount().compareTo(dto.getCouponDiscountValue()) < 0) { |
| | | throw new ValidationException("订单金额不能小于折扣金额"); |
| | | } |
| | | if (StringUtils.isNotBlank(dto.getCouponDiscountType()) |
| | | && dto.getCouponDiscountType().equals(CouponTypeEnum.DISCOUNT.getType()) |
| | | && dto.getCouponDiscountValue().compareTo(BigDecimal.ZERO) <= 0) { |
| | | throw new ValidationException("折扣金额必须大于0"); |
| | | } |
| | | |
| | | if (StringUtils.isNotBlank(dto.getCouponDiscountType()) |
| | | && dto.getCouponDiscountType().equals(CouponTypeEnum.ZERO.getType()) |
| | | && dto.getMinOrderAmount().compareTo(BigDecimal.ZERO) != 0) { |
| | | throw new ValidationException("无门槛的订单金额必须为0"); |
| | | } |
| | | |
| | | |
| | | } |
| | | } |
对比新文件 |
| | |
| | | package com.mzl.flower.web.v2.coupon; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.mzl.flower.base.BaseController; |
| | | import com.mzl.flower.base.R; |
| | | import com.mzl.flower.base.ReturnDataDTO; |
| | | import com.mzl.flower.config.exception.ValidationException; |
| | | import com.mzl.flower.dto.request.coupon.CreateCouponTemplateBO; |
| | | import com.mzl.flower.dto.request.coupon.CreateCouponTemplatePointDTO; |
| | | import com.mzl.flower.dto.request.coupon.CreateCouponTemplateUserDTO; |
| | | import com.mzl.flower.dto.request.coupon.QueryCouponDTO; |
| | | import com.mzl.flower.dto.response.coupon.CouponTemplatePointVO; |
| | | import com.mzl.flower.dto.response.coupon.CouponTemplateUserVO; |
| | | import com.mzl.flower.dto.response.coupon.CouponTemplateVO; |
| | | import com.mzl.flower.entity.coupon.CouponTemplateDO; |
| | | import com.mzl.flower.enums.CouponCategoryEnum; |
| | | import com.mzl.flower.enums.CouponGetUserTypeEnum; |
| | | import com.mzl.flower.enums.CouponTypeEnum; |
| | | import com.mzl.flower.enums.CouponUsageTypeEnum; |
| | | import com.mzl.flower.service.coupon.CouponTemplateService2; |
| | | import com.mzl.flower.utils.ConverterUtil; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.http.ResponseEntity; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.ArrayList; |
| | | import java.util.Collections; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | import java.util.stream.Collectors; |
| | | |
| | | |
| | | /** |
| | | * @author @TaoJie |
| | | * @since 2024-08-22 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/api/v2/coupon/user") |
| | | @Api(value = "优惠券管理-用户", tags = "优惠券管理-用户") |
| | | @Validated |
| | | public class CouponTemplateUserController extends BaseController { |
| | | |
| | | @Autowired |
| | | CouponTemplateService2 couponTemplateService; |
| | | |
| | | @PostMapping("") |
| | | @ApiOperation(value = "新增", notes = "新增") |
| | | public ResponseEntity<ReturnDataDTO> create(@Validated @RequestBody CreateCouponTemplateUserDTO dto) { |
| | | |
| | | if (dto.getCouponDiscountType().equals(CouponTypeEnum.DISCOUNT.getType()) && dto.getMinOrderAmount().compareTo(dto.getCouponDiscountValue()) < 0) { |
| | | throw new ValidationException("订单金额不能小于折扣金额"); |
| | | } |
| | | |
| | | if (dto.getCouponDiscountType().equals(CouponTypeEnum.ZERO.getType()) && dto.getMinOrderAmount().compareTo(BigDecimal.ZERO) != 0) { |
| | | throw new ValidationException("无门槛的订单金额必须为0"); |
| | | } |
| | | |
| | | |
| | | CreateCouponTemplateBO couponTemplateBO = new CreateCouponTemplateBO(); |
| | | BeanUtils.copyProperties(dto, couponTemplateBO); |
| | | |
| | | // 设置成指定用户 |
| | | couponTemplateBO.setGetUserType(CouponGetUserTypeEnum.POINT.getType()); |
| | | // 设置成积分优惠券 |
| | | couponTemplateBO.setCategory(CouponCategoryEnum.USER.getStatus()); |
| | | // 设置默认类型 |
| | | couponTemplateBO.setUsageType(CouponUsageTypeEnum.GET_AFTER_TIME.getType()); |
| | | |
| | | couponTemplateService.createCouponTemplate(couponTemplateBO); |
| | | |
| | | return returnData(R.SUCCESS.getCode(), null); |
| | | |
| | | |
| | | } |
| | | |
| | | @PutMapping("/{id}") |
| | | @ApiOperation(value = "修改", notes = "修改") |
| | | public ResponseEntity<ReturnDataDTO> update(@Validated @RequestBody CreateCouponTemplateUserDTO dto) { |
| | | |
| | | |
| | | if (dto.getCouponDiscountType().equals(CouponTypeEnum.DISCOUNT.getType()) && dto.getMinOrderAmount().compareTo(dto.getCouponDiscountValue()) < 0) { |
| | | throw new ValidationException("订单金额不能小于折扣金额"); |
| | | } |
| | | |
| | | if (dto.getCouponDiscountType().equals(CouponTypeEnum.ZERO.getType()) && dto.getMinOrderAmount().compareTo(BigDecimal.ZERO) != 0) { |
| | | throw new ValidationException("无门槛的订单金额必须为0"); |
| | | } |
| | | |
| | | |
| | | CouponTemplateDO couponTemplateDO = couponTemplateService.getById(dto.getId()); |
| | | if (null == couponTemplateDO) { |
| | | throw new ValidationException("优惠券不存在"); |
| | | } |
| | | |
| | | CreateCouponTemplateBO couponTemplateBO = new CreateCouponTemplateBO(); |
| | | BeanUtils.copyProperties(dto, couponTemplateBO); |
| | | |
| | | // 设置成指定用户 |
| | | couponTemplateBO.setGetUserType(CouponGetUserTypeEnum.POINT.getType()); |
| | | // 设置成积分优惠券 |
| | | couponTemplateBO.setCategory(CouponCategoryEnum.USER.getStatus()); |
| | | // 设置默认类型 |
| | | couponTemplateBO.setUsageType(CouponUsageTypeEnum.GET_AFTER_TIME.getType()); |
| | | |
| | | |
| | | couponTemplateService.updateCouponTemplate(couponTemplateBO); |
| | | |
| | | return returnData(R.SUCCESS.getCode(), null); |
| | | } |
| | | |
| | | @DeleteMapping("/{id}") |
| | | @ApiOperation(value = "删除", notes = "删除") |
| | | public ResponseEntity<ReturnDataDTO> delete(@PathVariable String id) { |
| | | |
| | | CouponTemplateDO couponTemplateDO = couponTemplateService.getById(id); |
| | | if (null == couponTemplateDO) { |
| | | throw new ValidationException("优惠券不存在"); |
| | | } |
| | | couponTemplateService.deleteCouponTemplate(id); |
| | | return returnData(R.SUCCESS.getCode(), null); |
| | | } |
| | | |
| | | @GetMapping("/{id}") |
| | | @ApiOperation(value = "详情", notes = "详情") |
| | | public ResponseEntity<ReturnDataDTO> get(@PathVariable String id) { |
| | | CouponTemplateVO couponTemplateVO = couponTemplateService.getDetailById(id); |
| | | return returnData(R.SUCCESS.getCode(), ConverterUtil.transObject(couponTemplateVO, CouponTemplateUserVO.class)); |
| | | } |
| | | |
| | | @GetMapping("/page") |
| | | @ApiOperation(value = "查询-分页", notes = "查询-分页") |
| | | public ResponseEntity<ReturnDataDTO<Page<CouponTemplatePointVO>>> page( |
| | | Page page, QueryCouponDTO dto |
| | | ) { |
| | | // 设置只查询积分优惠券的 |
| | | dto.setCategory(CouponCategoryEnum.USER.getStatus()); |
| | | Page<CouponTemplateVO> resultPage = couponTemplateService.getPage(page, dto); |
| | | return returnData(R.SUCCESS.getCode(), ConverterUtil.transPage(resultPage, CouponTemplateUserVO.class)); |
| | | } |
| | | |
| | | @GetMapping("/list") |
| | | @ApiOperation(value = "查询-全部", notes = "查询-全部") |
| | | public ResponseEntity<ReturnDataDTO<Page<CouponTemplateVO>>> list(QueryCouponDTO dto |
| | | ) { |
| | | // 设置只查询积分优惠券的 |
| | | dto.setCategory(CouponCategoryEnum.USER.getStatus()); |
| | | return returnData(R.SUCCESS.getCode(), ConverterUtil.transList(couponTemplateService.getList(dto), CouponTemplateUserVO.class)); |
| | | } |
| | | |
| | | |
| | | @PutMapping("/active/{id}") |
| | | @ApiOperation(value = "发布", notes = "发布") |
| | | public ResponseEntity<ReturnDataDTO> active(@PathVariable String id) { |
| | | |
| | | CouponTemplateDO couponTemplateDO = couponTemplateService.getById(id); |
| | | if (null == couponTemplateDO) { |
| | | throw new ValidationException("优惠券不存在"); |
| | | } |
| | | |
| | | couponTemplateService.activeCouponTemplate(id); |
| | | |
| | | return returnData(R.SUCCESS.getCode(), null); |
| | | } |
| | | |
| | | @PutMapping("/expire/{id}") |
| | | @ApiOperation(value = "下架", notes = "下架") |
| | | public ResponseEntity<ReturnDataDTO> expire(@PathVariable String id) { |
| | | |
| | | CouponTemplateDO couponTemplateDO = couponTemplateService.getById(id); |
| | | if (null == couponTemplateDO) { |
| | | throw new ValidationException("优惠券不存在"); |
| | | } |
| | | |
| | | couponTemplateService.expireCouponTemplate(id); |
| | | |
| | | return returnData(R.SUCCESS.getCode(), null); |
| | | } |
| | | |
| | | |
| | | } |
对比新文件 |
| | |
| | | package com.mzl.flower.web.v2.coupon; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.mzl.flower.base.BaseController; |
| | | import com.mzl.flower.base.R; |
| | | import com.mzl.flower.base.ReturnDataDTO; |
| | | import com.mzl.flower.config.exception.ValidationException; |
| | | import com.mzl.flower.dto.request.coupon.*; |
| | | import com.mzl.flower.dto.response.coupon.CouponTemplateVO; |
| | | import com.mzl.flower.dto.response.coupon.CouponTemplateVipVO; |
| | | import com.mzl.flower.entity.coupon.CouponTemplateDO; |
| | | import com.mzl.flower.enums.CouponCategoryEnum; |
| | | import com.mzl.flower.enums.CouponTypeEnum; |
| | | import com.mzl.flower.service.coupon.CouponTemplateService2; |
| | | import com.mzl.flower.utils.ConverterUtil; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.http.ResponseEntity; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | /** |
| | | * @author @TaoJie |
| | | * @since 2024-08-22 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/api/v2/coupon/vip") |
| | | @Api(value = "优惠券管理-会员", tags = "优惠券管理-会员") |
| | | @Validated |
| | | public class CouponTemplateVipController extends BaseController { |
| | | |
| | | @Autowired |
| | | CouponTemplateService2 couponTemplateService; |
| | | |
| | | @PostMapping("") |
| | | @ApiOperation(value = "新增", notes = "新增") |
| | | public ResponseEntity<ReturnDataDTO> create(@Validated @RequestBody CreateCouponTemplateVipDTO dto) { |
| | | |
| | | // 信息验证 |
| | | valid(dto); |
| | | |
| | | CreateCouponTemplateBO couponTemplateBO = new CreateCouponTemplateBO(); |
| | | BeanUtils.copyProperties(dto, couponTemplateBO); |
| | | |
| | | // 设置成积分优惠券 |
| | | couponTemplateBO.setCategory(CouponCategoryEnum.MEMBER.getStatus()); |
| | | |
| | | couponTemplateService.createCouponTemplate(couponTemplateBO); |
| | | |
| | | return returnData(R.SUCCESS.getCode(), null); |
| | | } |
| | | |
| | | @PutMapping("/{id}") |
| | | @ApiOperation(value = "修改", notes = "修改") |
| | | public ResponseEntity<ReturnDataDTO> update(@Validated @RequestBody CreateCouponTemplateVipDTO dto) { |
| | | |
| | | // 信息验证 |
| | | valid(dto); |
| | | |
| | | CouponTemplateDO couponTemplateDO = couponTemplateService.getById(dto.getId()); |
| | | if (null == couponTemplateDO) { |
| | | throw new ValidationException("优惠券不存在"); |
| | | } |
| | | |
| | | CreateCouponTemplateBO couponTemplateBO = new CreateCouponTemplateBO(); |
| | | BeanUtils.copyProperties(dto, couponTemplateBO); |
| | | |
| | | // 设置成积分优惠券 |
| | | couponTemplateBO.setCategory(CouponCategoryEnum.MEMBER.getStatus()); |
| | | |
| | | couponTemplateService.updateCouponTemplate(couponTemplateBO); |
| | | |
| | | return returnData(R.SUCCESS.getCode(), null); |
| | | } |
| | | |
| | | @DeleteMapping("/{id}") |
| | | @ApiOperation(value = "删除", notes = "删除") |
| | | public ResponseEntity<ReturnDataDTO> delete(@PathVariable String id ) { |
| | | |
| | | CouponTemplateDO couponTemplateDO= couponTemplateService.getById(id); |
| | | if(null==couponTemplateDO){ |
| | | throw new ValidationException("优惠券不存在"); |
| | | } |
| | | couponTemplateService.deleteCouponTemplate(id); |
| | | return returnData(R.SUCCESS.getCode(), null); |
| | | } |
| | | |
| | | @GetMapping("/{id}") |
| | | @ApiOperation(value = "详情", notes = "详情") |
| | | public ResponseEntity<ReturnDataDTO> get(@PathVariable String id) { |
| | | CouponTemplateVO couponTemplateVO = couponTemplateService.getDetailById(id); |
| | | return returnData(R.SUCCESS.getCode(), ConverterUtil.transObject(couponTemplateVO, CouponTemplateVipVO.class)); |
| | | } |
| | | |
| | | @GetMapping("/page") |
| | | @ApiOperation(value = "查询-分页", notes = "查询-分页") |
| | | public ResponseEntity<ReturnDataDTO<Page<CouponTemplateVipVO>>> page( |
| | | Page page, QueryCouponDTO dto |
| | | ) { |
| | | // 设置只查询积分优惠券的 |
| | | dto.setCategory(CouponCategoryEnum.MEMBER.getStatus()); |
| | | Page<CouponTemplateVO> resultPage = couponTemplateService.getPage(page, dto); |
| | | return returnData(R.SUCCESS.getCode(), ConverterUtil.transPage(resultPage, CouponTemplateVipVO.class)); |
| | | |
| | | } |
| | | |
| | | @GetMapping("/list") |
| | | @ApiOperation(value = "查询-全部", notes = "查询-全部") |
| | | public ResponseEntity<ReturnDataDTO<Page<CouponTemplateVipVO>>> list(QueryCouponDTO dto |
| | | ) { |
| | | dto.setCategory(CouponCategoryEnum.MEMBER.getStatus()); |
| | | return returnData(R.SUCCESS.getCode(), ConverterUtil.transList(couponTemplateService.getList(dto), CouponTemplateVipVO.class)); |
| | | } |
| | | |
| | | |
| | | private void valid(CreateCouponTemplateVipDTO dto){ |
| | | |
| | | if (StringUtils.isNotBlank(dto.getCouponDiscountType()) |
| | | && dto.getCouponDiscountType().equals(CouponTypeEnum.DISCOUNT.getType()) |
| | | && dto.getMinOrderAmount().compareTo(dto.getCouponDiscountValue()) < 0) { |
| | | throw new ValidationException("订单金额不能小于折扣金额"); |
| | | } |
| | | if (StringUtils.isNotBlank(dto.getCouponDiscountType()) |
| | | && dto.getCouponDiscountType().equals(CouponTypeEnum.DISCOUNT.getType()) |
| | | && dto.getCouponDiscountValue().compareTo(BigDecimal.ZERO) <= 0) { |
| | | throw new ValidationException("折扣金额必须大于0"); |
| | | } |
| | | |
| | | if (StringUtils.isNotBlank(dto.getCouponDiscountType()) |
| | | && dto.getCouponDiscountType().equals(CouponTypeEnum.ZERO.getType()) |
| | | && dto.getMinOrderAmount().compareTo(BigDecimal.ZERO) != 0) { |
| | | throw new ValidationException("无门槛的订单金额必须为0"); |
| | | } |
| | | |
| | | } |
| | | } |
| | |
| | | maxRequestSize: 50MB |
| | | |
| | | mybatis-plus: |
| | | mapper-locations: classpath:/mapper/*Mapper.xml,classpath:/mapper/**/*Mapper.xml |
| | | mapper-locations: classpath:/mapper/*Mapper.xml,classpath:/mapper/**/*Mapper.xml,classpath:/mapper/*Mapper*.xml,classpath:/mapper/**/*Mapper*.xml |
| | | global-config: |
| | | banner: false |
| | | db-config: |
对比新文件 |
| | |
| | | <?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="com.mzl.flower.mapper.coupon.CouponRecordMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.mzl.flower.entity.coupon.CouponRecordDO"> |
| | | <id column="id" property="id" /> |
| | | <result column="deleted" property="deleted" /> |
| | | <result column="create_by" property="createBy" /> |
| | | <result column="update_by" property="updateBy" /> |
| | | <result column="create_time" property="createTime" /> |
| | | <result column="update_time" property="updateTime" /> |
| | | <result column="coupon_id" property="couponId" /> |
| | | <result column="user_id" property="userId" /> |
| | | <result column="customer_id" property="customerId" /> |
| | | <result column="status" property="status" /> |
| | | <result column="effective_start" property="effectiveStart" /> |
| | | <result column="effective_end" property="effectiveEnd" /> |
| | | <result column="order_id" property="orderId" /> |
| | | <result column="used_time" property="usedTime" /> |
| | | <result column="coupon_discount_value" property="couponDiscountValue" /> |
| | | <result column="min_order_amount" property="minOrderAmount" /> |
| | | <result column="category" property="category" /> |
| | | <result column="coupon_code" property="couponCode" /> |
| | | <result column="coupon_name" property="couponName" /> |
| | | |
| | | <result column="point" property="point" /> |
| | | <result column="order_no" property="orderNo" /> |
| | | |
| | | </resultMap> |
| | | |
| | | </mapper> |
对比新文件 |
| | |
| | | <?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="com.mzl.flower.mapper.coupon.CouponRecordMapperCustom"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.mzl.flower.entity.coupon.CouponRecordDO"> |
| | | <id column="id" property="id" /> |
| | | <result column="deleted" property="deleted" /> |
| | | <result column="create_by" property="createBy" /> |
| | | <result column="update_by" property="updateBy" /> |
| | | <result column="create_time" property="createTime" /> |
| | | <result column="update_time" property="updateTime" /> |
| | | <result column="coupon_id" property="couponId" /> |
| | | <result column="user_id" property="userId" /> |
| | | <result column="customer_id" property="customerId" /> |
| | | <result column="status" property="status" /> |
| | | <result column="effective_start" property="effectiveStart" /> |
| | | <result column="effective_end" property="effectiveEnd" /> |
| | | <result column="order_id" property="orderId" /> |
| | | <result column="used_time" property="usedTime" /> |
| | | <result column="coupon_discount_value" property="couponDiscountValue" /> |
| | | <result column="min_order_amount" property="minOrderAmount" /> |
| | | <result column="category" property="category" /> |
| | | <result column="coupon_code" property="couponCode" /> |
| | | <result column="coupon_name" property="couponName" /> |
| | | <result column="get_type" property="getType" /> |
| | | <result column="coupon_discount_type" property="couponDiscountType" /> |
| | | <result column="get_user_type" property="getUserType" /> |
| | | |
| | | <result column="point" property="point" /> |
| | | <result column="order_no" property="orderNo" /> |
| | | |
| | | </resultMap> |
| | | |
| | | <select id="statisCouponTemplateCount" resultType="java.lang.Integer"> |
| | | select IFNULL(count(1),0) as cnt from t_coupon_record where deleted=false and category=#{dto.category} |
| | | </select> |
| | | <select id="statisCouponTemplateCurMonCount" resultType="java.lang.Integer"> |
| | | select IFNULL(count(1),0) as cnt from t_coupon_record where deleted=false and category=#{dto.category} AND DATE_FORMAT(create_time, '%Y-%m') = DATE_FORMAT(CURDATE(), '%Y-%m') |
| | | </select> |
| | | <select id="statisCouponPointCurMonPointAmonut" resultType="java.lang.Integer"> |
| | | |
| | | </select> |
| | | |
| | | <select id="getPage" resultType="com.mzl.flower.dto.response.coupon.CouponRecordVO"> |
| | | <include refid="QuerySql"></include> |
| | | </select> |
| | | <select id="getList" resultType="com.mzl.flower.dto.response.coupon.CouponRecordVO"> |
| | | <include refid="QuerySql"></include> |
| | | </select> |
| | | |
| | | <sql id="QuerySql"> |
| | | select * |
| | | from ( |
| | | select r.*, |
| | | i.name as customerName, |
| | | u.tel, |
| | | o.order_no |
| | | from t_coupon_record r |
| | | left join t_customer_info i |
| | | on r.customer_id=i.id |
| | | left join t_user u |
| | | on i.user_id=u.id |
| | | left join t_order o |
| | | on r.order_id=o.id |
| | | ) t |
| | | where t.deleted=0 |
| | | <if test="param.name != null and param.name != ''"> |
| | | AND t.coupon_name like concat('%', #{param.name},'%') |
| | | </if> |
| | | <if test="param.couponDiscountType != null and param.couponDiscountType != ''"> |
| | | AND t.coupon_discount_type = #{param.couponDiscountType} |
| | | </if> |
| | | <if test="param.getType != null and param.getType != ''"> |
| | | AND t.get_type = #{param.getType} |
| | | </if> |
| | | <if test="param.getUserType != null and param.getUserType != ''"> |
| | | AND t.get_user_type = #{param.getUserType} |
| | | </if> |
| | | <if test="param.id != null and param.id != ''"> |
| | | AND t.id = #{param.id} |
| | | </if> |
| | | <if test="param.orderNo != null and param.orderNo != ''"> |
| | | AND t.order_no like concat('%', #{param.orderNo},'%') |
| | | </if> |
| | | <if test="param.tel != null and param.tel != ''"> |
| | | AND t.tel like concat('%', #{param.tel},'%') |
| | | </if> |
| | | <if test="param.status != null and param.status != ''"> |
| | | AND t.status = #{param.status} |
| | | </if> |
| | | <if test="param.keyword != null and param.keyword != ''"> |
| | | AND (t.customerName like concat('%', #{param.keyword},'%') |
| | | or t.user_id like concat('%', #{param.keyword},'%') ) |
| | | </if> |
| | | order by t.create_time desc |
| | | </sql> |
| | | |
| | | |
| | | |
| | | </mapper> |
对比新文件 |
| | |
| | | <?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="com.mzl.flower.mapper.coupon.CouponTemplateCustomerMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.mzl.flower.entity.coupon.CouponTemplateCustomerDO"> |
| | | <id column="id" property="id" /> |
| | | <result column="coupon_id" property="couponId" /> |
| | | <result column="custom_id" property="customId" /> |
| | | </resultMap> |
| | | |
| | | </mapper> |
对比新文件 |
| | |
| | | <?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="com.mzl.flower.mapper.coupon.CouponTemplateMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.mzl.flower.entity.coupon.CouponTemplateDO"> |
| | | <id column="id" property="id" /> |
| | | <result column="create_by" property="createBy" /> |
| | | <result column="create_time" property="createTime" /> |
| | | <result column="update_by" property="updateBy" /> |
| | | <result column="update_time" property="updateTime" /> |
| | | <result column="deleted" property="deleted" /> |
| | | <result column="coupon_code" property="couponCode" /> |
| | | <result column="coupon_name" property="couponName" /> |
| | | <result column="coupon_description" property="couponDescription" /> |
| | | <result column="coupon_amount" property="couponAmount" /> |
| | | <result column="coupon_discount_type" property="couponDiscountType" /> |
| | | <result column="coupon_discount_value" property="couponDiscountValue" /> |
| | | <result column="min_order_amount" property="minOrderAmount" /> |
| | | <result column="max_discount_amount" property="maxDiscountAmount" /> |
| | | <result column="get_type" property="getType" /> |
| | | <result column="get_user_type" property="getUserType" /> |
| | | <result column="get_start_date" property="getStartDate" /> |
| | | <result column="get_end_date" property="getEndDate" /> |
| | | <result column="get_limit" property="getLimit" /> |
| | | <result column="usage_type" property="usageType" /> |
| | | <result column="usage_limit" property="usageLimit" /> |
| | | <result column="usage_per_user" property="usagePerUser" /> |
| | | <result column="usage_start_date" property="usageStartDate" /> |
| | | <result column="usage_end_date" property="usageEndDate" /> |
| | | <result column="usage_time_type" property="usageTimeType" /> |
| | | <result column="usage_time_num" property="usageTimeNum" /> |
| | | <result column="status" property="status" /> |
| | | |
| | | <result column="vip_grade" property="vipGrade" /> |
| | | |
| | | |
| | | </resultMap> |
| | | |
| | | </mapper> |
对比新文件 |
| | |
| | | <?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="com.mzl.flower.mapper.coupon.CouponTemplateMapperCustom"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.mzl.flower.entity.coupon.CouponTemplateDO"> |
| | | <id column="id" property="id" /> |
| | | <result column="create_by" property="createBy" /> |
| | | <result column="create_time" property="createTime" /> |
| | | <result column="update_by" property="updateBy" /> |
| | | <result column="update_time" property="updateTime" /> |
| | | <result column="deleted" property="deleted" /> |
| | | <result column="category" property="category" /> |
| | | <result column="coupon_code" property="couponCode" /> |
| | | <result column="coupon_name" property="couponName" /> |
| | | <result column="coupon_description" property="couponDescription" /> |
| | | <result column="coupon_amount" property="couponAmount" /> |
| | | <result column="coupon_discount_type" property="couponDiscountType" /> |
| | | <result column="coupon_discount_value" property="couponDiscountValue" /> |
| | | <result column="min_order_amount" property="minOrderAmount" /> |
| | | <result column="max_discount_amount" property="maxDiscountAmount" /> |
| | | <result column="get_type" property="getType" /> |
| | | <result column="get_user_type" property="getUserType" /> |
| | | <result column="get_start_date" property="getStartDate" /> |
| | | <result column="get_end_date" property="getEndDate" /> |
| | | <result column="get_limit" property="getLimit" /> |
| | | <result column="usage_type" property="usageType" /> |
| | | <result column="usage_limit" property="usageLimit" /> |
| | | <result column="usage_per_user" property="usagePerUser" /> |
| | | <result column="usage_start_date" property="usageStartDate" /> |
| | | <result column="usage_end_date" property="usageEndDate" /> |
| | | <result column="usage_time_type" property="usageTimeType" /> |
| | | <result column="usage_time_num" property="usageTimeNum" /> |
| | | <result column="status" property="status" /> |
| | | <result column="point" property="point" /> |
| | | <result column="vip_grade" property="vipGrade" /> |
| | | |
| | | </resultMap> |
| | | <update id="activeBatchCouponTemplate"> |
| | | update t_coupon_template set status='active',update_by=#{dto.updateBy},update_time=now() where id in |
| | | <foreach collection="dto.idList" item="item" open="(" separator="," close=")"> |
| | | #{item} |
| | | </foreach> |
| | | </update> |
| | | <update id="expireBatchCouponTemplate"> |
| | | update t_coupon_template set status='expired',update_by=#{dto.updateBy},update_time=now() where id in |
| | | <foreach collection="dto.idList" item="item" open="(" separator="," close=")"> |
| | | #{item} |
| | | </foreach> |
| | | </update> |
| | | |
| | | <update id="deleteBatchCouponTemplate"> |
| | | update t_coupon_template set deleted=true ,update_by=#{dto.updateBy},update_time=now() where id in |
| | | <foreach collection="dto.idList" item="item" open="(" separator="," close=")"> |
| | | #{item} |
| | | </foreach> |
| | | </update> |
| | | |
| | | <select id="getCouponTemplatePage" resultType="com.mzl.flower.dto.response.coupon.CouponTemplateVO"> |
| | | <include refid="QuerySql2"></include> |
| | | </select> |
| | | <select id="getList" resultType="com.mzl.flower.dto.response.coupon.CouponTemplateVO"> |
| | | <include refid="QuerySql2"></include> |
| | | </select> |
| | | |
| | | <sql id="QuerySql2"> |
| | | select * |
| | | from ( |
| | | select t.*, |
| | | create_by_user.nick_name as createByName, |
| | | IFNULL(get_num.cnt, 0) as getNum, |
| | | IFNULL(t.coupon_amount, 0) - IFNULL(get_num.cnt, 0) as unGetNum |
| | | from t_coupon_template t |
| | | left join t_user create_by_user |
| | | on t.create_by =create_by_user.id |
| | | left join (select coupon_template_id,count(1) as cnt from t_coupon_usage where deleted=0 group by coupon_template_id) get_num |
| | | on t.id=get_num.coupon_template_id |
| | | ) t |
| | | where t.deleted=0 |
| | | <if test="param.name != null and param.name != ''"> |
| | | AND t.coupon_name like concat('%', #{param.name},'%') |
| | | </if> |
| | | <if test="param.couponDiscountType != null and param.couponDiscountType != ''"> |
| | | AND t.coupon_discount_type = #{param.couponDiscountType} |
| | | </if> |
| | | <if test="param.getType != null and param.getType != ''"> |
| | | AND t.get_type = #{param.getType} |
| | | </if> |
| | | <if test="param.getUserType != null and param.getUserType != ''"> |
| | | AND t.get_user_type = #{param.getUserType} |
| | | </if> |
| | | <if test="param.id != null and param.id != ''"> |
| | | AND t.id = #{param.id} |
| | | </if> |
| | | <if test="param.category != null and param.category != ''"> |
| | | AND t.category = #{param.category} |
| | | </if> |
| | | order by t.create_time desc |
| | | </sql> |
| | | |
| | | </mapper> |