You've already forked FrameTour-BE
- 在 VoucherCodeResp 和 VoucherInfo 中添加可重复使用券码相关字段 - 新增 getVoucherDetail、getVoucherUsageSummary 和 getBatchOverview接口 - 优化 calculateVoucherDiscount 接口,支持重复使用券码的计算 - 在 PriceVoucherUsageRecordMapper 中添加按券码ID和用户ID查询使用记录的方法
97 lines
3.1 KiB
Java
97 lines
3.1 KiB
Java
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;
|
|
|
|
/**
|
|
* 券码服务接口
|
|
*/
|
|
public interface IVoucherService {
|
|
|
|
/**
|
|
* 验证并获取券码信息
|
|
* @param voucherCode 券码
|
|
* @param faceId 用户faceId
|
|
* @param scenicId 景区ID
|
|
* @return 券码信息(如果有效)
|
|
*/
|
|
VoucherInfo validateAndGetVoucherInfo(String voucherCode, Long faceId, Long scenicId);
|
|
|
|
/**
|
|
* 获取用户在指定景区的可用券码列表
|
|
* @param faceId 用户faceId
|
|
* @param scenicId 景区ID
|
|
* @return 可用券码列表
|
|
*/
|
|
List<VoucherInfo> getAvailableVouchers(Long faceId, Long scenicId);
|
|
/**
|
|
* 标记券码为已使用
|
|
* @param voucherCode 券码
|
|
* @param remark 使用备注
|
|
* @param faceId 人脸ID
|
|
*/
|
|
void markVoucherAsUsed(String voucherCode, String remark, Long faceId);
|
|
|
|
void markVoucherAsUsed(String voucherCode, String remark, String orderId, BigDecimal discountAmount, Long faceId);
|
|
|
|
/**
|
|
* 检查用户是否可以在指定景区领取券码
|
|
* @param faceId 用户faceId
|
|
* @param scenicId 景区ID
|
|
* @return 是否可以领取
|
|
*/
|
|
boolean canClaimVoucher(Long faceId, Long scenicId);
|
|
|
|
/**
|
|
* 获取该faceId在scenicId下的券码详情列表
|
|
* @param faceId 用户面部ID
|
|
* @param scenicId 景区ID
|
|
* @return 券码详情列表,包含所有状态的券码(已领取未使用、已使用等),如果没有券码则返回空列表
|
|
*/
|
|
List<VoucherInfo> getVoucherDetails(Long faceId, Long scenicId);
|
|
|
|
/**
|
|
* 计算券码优惠金额
|
|
* @param voucherInfo 券码信息
|
|
* @param context 检测上下文
|
|
* @return 优惠金额
|
|
*/
|
|
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
|
|
* @param scenicId 景区ID
|
|
* @param context 检测上下文
|
|
* @return 最优券码信息
|
|
*/
|
|
VoucherInfo getBestVoucher(Long faceId, Long scenicId, DiscountDetectionContext context);
|
|
} |