feat(pricing): 集成定价服务并优化价格查询逻辑- 在 OrderBiz 中添加 IPriceCalculationService 依赖,用于计算价格
All checks were successful
ZhenTu-BE/pipeline/head This commit looks good

- 重构 queryPrice 方法,使用定价服务计算价格而不是直接从数据库读取
- 移除 PriceObj 中未使用的 scenicAllPrice 字段
- 删除 ScenicEntity 和 ScenicAddOrUpdateReq 中的冗余价格字段
-优化 ProductConfigServiceImpl 中的 getTierConfig 方法,增加参数校验
This commit is contained in:
2025-09-01 09:21:26 +08:00
parent f91b98c68e
commit cdd434317f
5 changed files with 27 additions and 17 deletions

View File

@@ -43,6 +43,9 @@ public class ProductConfigServiceImpl implements IProductConfigService {
@Override
// @Cacheable(value = "tier-config", key = "#productType + '_' + #productId + '_' + #quantity")
public PriceTierConfig getTierConfig(String productType, String productId, Integer quantity) {
if (quantity == null || quantity <= 0) {
return null;
}
PriceTierConfig config = tierConfigMapper.selectByProductTypeAndQuantity(productType, productId, quantity);
// 不使用default配置,没查到就算了
// // 如果没有找到特定商品的阶梯配置,尝试使用default配置
@@ -57,9 +60,10 @@ public class ProductConfigServiceImpl implements IProductConfigService {
// }
//
if (config == null) {
log.warn("阶梯定价配置未找到: productType={}, productId={}, quantity={}",
productType, productId, quantity);
return null;
}
log.warn("阶梯定价: productType={}, productId={}, quantity={},config={}",
productType, productId, quantity, config);
return config;
}