You've already forked FrameTour-BE
- 添加打包购买优惠信息类 BundleDiscountInfo - 实现打包购买优惠提供者 BundleDiscountProvider - 添加打包购买优惠服务接口 IBundleDiscountService 及其实现类 BundleDiscountServiceImpl - 在 DiscountInfo 中添加 bundleDiscountInfo 字段以支持打包优惠 - 更新 CLAUDE.md 文档,详细说明打包购买优惠系统的设计和实现
68 lines
2.0 KiB
Java
68 lines
2.0 KiB
Java
package com.ycwl.basic.pricing.service;
|
|
|
|
import com.ycwl.basic.pricing.dto.BundleDiscountInfo;
|
|
import com.ycwl.basic.pricing.dto.DiscountDetectionContext;
|
|
import com.ycwl.basic.pricing.dto.ProductItem;
|
|
|
|
import java.math.BigDecimal;
|
|
import java.util.List;
|
|
|
|
/**
|
|
* 打包购买优惠服务接口
|
|
*/
|
|
public interface IBundleDiscountService {
|
|
|
|
/**
|
|
* 检测可用的打包优惠
|
|
*
|
|
* @param context 优惠检测上下文
|
|
* @return 可用的打包优惠列表
|
|
*/
|
|
List<BundleDiscountInfo> detectAvailableBundleDiscounts(DiscountDetectionContext context);
|
|
|
|
/**
|
|
* 计算打包优惠金额
|
|
*
|
|
* @param bundleDiscount 打包优惠信息
|
|
* @param products 商品列表
|
|
* @return 优惠金额
|
|
*/
|
|
BigDecimal calculateBundleDiscount(BundleDiscountInfo bundleDiscount, List<ProductItem> products);
|
|
|
|
/**
|
|
* 检查是否符合打包条件
|
|
*
|
|
* @param products 商品列表
|
|
* @param minQuantity 最少数量要求
|
|
* @param minAmount 最少金额要求
|
|
* @return 是否符合条件
|
|
*/
|
|
boolean isEligibleForBundle(List<ProductItem> products, Integer minQuantity, BigDecimal minAmount);
|
|
|
|
/**
|
|
* 根据商品类型和数量获取打包优惠规则
|
|
*
|
|
* @param products 商品列表
|
|
* @param scenicId 景区ID(可选)
|
|
* @return 匹配的打包优惠规则
|
|
*/
|
|
List<BundleDiscountInfo> getBundleDiscountRules(List<ProductItem> products, Long scenicId);
|
|
|
|
/**
|
|
* 验证打包优惠是否仍然有效
|
|
*
|
|
* @param bundleDiscount 打包优惠信息
|
|
* @param context 优惠检测上下文
|
|
* @return 是否有效
|
|
*/
|
|
boolean isBundleDiscountValid(BundleDiscountInfo bundleDiscount, DiscountDetectionContext context);
|
|
|
|
/**
|
|
* 获取最优的打包优惠组合
|
|
*
|
|
* @param products 商品列表
|
|
* @param scenicId 景区ID(可选)
|
|
* @return 最优打包优惠
|
|
*/
|
|
BundleDiscountInfo getBestBundleDiscount(List<ProductItem> products, Long scenicId);
|
|
} |