feat(voucher): 支持券码重复使用

- 新增VoucherBatchCreateReqV2 请求对象,用于创建支持重复使用的券码批次
- 添加 VoucherUsageController 控制器,实现券码使用记录和统计功能
- 在VoucherInfo 对象中增加与重复使用相关的字段
- 修改 PriceVoucherBatchConfig 和 PriceVoucherCode 实体,支持重复使用相关属性
- 更新 VoucherBatchServiceImpl 和 VoucherServiceImpl,增加处理重复使用逻辑的方法
This commit is contained in:
2025-09-16 01:08:54 +08:00
parent 5531c576e0
commit ce3f7aae1e
17 changed files with 1167 additions and 21 deletions

View File

@@ -96,6 +96,21 @@ public class PriceVoucherBatchConfig {
private Long updateBy;
/**
* 每个券码最大使用次数(NULL表示无限次,1表示单次使用兼容原有逻辑)
*/
private Integer maxUseCount;
/**
* 每个用户最大使用次数(NULL表示无限次)
*/
private Integer maxUsePerUser;
/**
* 两次使用间隔小时数(NULL表示无间隔限制)
*/
private Integer useIntervalHours;
private Integer deleted;
private Date deletedAt;

View File

@@ -58,6 +58,16 @@ public class PriceVoucherCode {
*/
private String remark;
/**
* 当前使用次数
*/
private Integer currentUseCount;
/**
* 最后使用时间
*/
private Date lastUsedTime;
@TableField("create_time")
private Date createTime;

View File

@@ -0,0 +1,76 @@
package com.ycwl.basic.pricing.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import java.math.BigDecimal;
import java.util.Date;
/**
* 券码使用记录实体
*/
@Data
@TableName("price_voucher_usage_record")
public class PriceVoucherUsageRecord {
@TableId(value = "id", type = IdType.AUTO)
private Long id;
/**
* 券码ID
*/
private Long voucherCodeId;
/**
* 券码
*/
private String voucherCode;
/**
* 使用用户faceId
*/
private Long faceId;
/**
* 景区ID
*/
private Long scenicId;
/**
* 批次ID
*/
private Long batchId;
/**
* 使用时间
*/
private Date useTime;
/**
* 关联订单ID
*/
private String orderId;
/**
* 优惠金额
*/
private BigDecimal discountAmount;
/**
* 使用备注
*/
private String remark;
@TableField("create_time")
private Date createTime;
@TableField("update_time")
private Date updateTime;
private Integer deleted;
private Date deletedAt;
}