feat(pricing): 增加券码重复使用功能并优化相关接口

- 在 VoucherCodeResp 和 VoucherInfo 中添加可重复使用券码相关字段
- 新增 getVoucherDetail、getVoucherUsageSummary 和 getBatchOverview接口
- 优化 calculateVoucherDiscount 接口,支持重复使用券码的计算
- 在 PriceVoucherUsageRecordMapper 中添加按券码ID和用户ID查询使用记录的方法
This commit is contained in:
2025-09-16 19:46:56 +08:00
parent 90a21c0933
commit 8380b02fbb
6 changed files with 346 additions and 0 deletions

View File

@@ -2,6 +2,9 @@ package com.ycwl.basic.pricing.service;
import com.ycwl.basic.pricing.dto.DiscountDetectionContext;
import com.ycwl.basic.pricing.dto.VoucherInfo;
import com.ycwl.basic.pricing.dto.resp.VoucherBatchOverviewResp;
import com.ycwl.basic.pricing.dto.resp.VoucherDetailResp;
import com.ycwl.basic.pricing.dto.resp.VoucherUsageSummaryResp;
import java.math.BigDecimal;
import java.util.List;
@@ -61,6 +64,28 @@ public interface IVoucherService {
*/
BigDecimal calculateVoucherDiscount(VoucherInfo voucherInfo, DiscountDetectionContext context);
/**
* 获取券码详细信息
* @param voucherCode 券码
* @param faceId 用户人脸ID(可选)
* @return 券码详细信息
*/
VoucherDetailResp getVoucherDetail(String voucherCode, Long faceId);
/**
* 获取券码使用统计摘要
* @param voucherCode 券码
* @return 券码使用统计摘要
*/
VoucherUsageSummaryResp getVoucherUsageSummary(String voucherCode);
/**
* 获取批次券码概览
* @param batchId 批次ID
* @return 批次概览信息
*/
VoucherBatchOverviewResp getBatchOverview(Long batchId);
/**
* 获取最优的券码(如果用户有多个可用券码)
* @param faceId 用户faceId