refactor(pricing): 移除商品阶梯定价中的 default 配置逻辑

- 删除了尝试使用 default 配置的代码块
- 保留了缓存注释(已注释)
- 优化了日志输出,当找不到配置时直接记录警告日志
This commit is contained in:
2025-08-30 11:31:26 +08:00
parent 60af636639
commit 1ac375e491

View File

@@ -44,18 +44,18 @@ public class ProductConfigServiceImpl implements IProductConfigService {
// @Cacheable(value = "tier-config", key = "#productType + '_' + #productId + '_' + #quantity")
public PriceTierConfig getTierConfig(String productType, String productId, Integer quantity) {
PriceTierConfig config = tierConfigMapper.selectByProductTypeAndQuantity(productType, productId, quantity);
// 如果没有找到特定商品的阶梯配置,尝试使用default配置
if (config == null && !"default".equals(productId)) {
log.warn("阶梯定价配置未找到: productType={}, productId={}, quantity={}, 尝试使用default配置",
productType, productId, quantity);
config = tierConfigMapper.selectByProductTypeAndQuantity(productType, "default", quantity);
if (config != null) {
log.debug("使用default阶梯配置: productType={}, quantity={}, price={}",
productType, quantity, config.getPrice());
}
}
// 不使用default配置,没查到就算了
// // 如果没有找到特定商品的阶梯配置,尝试使用default配置
// if (config == null && !"default".equals(productId)) {
// log.warn("阶梯定价配置未找到: productType={}, productId={}, quantity={}, 尝试使用default配置",
// productType, productId, quantity);
// config = tierConfigMapper.selectByProductTypeAndQuantity(productType, "default", quantity);
// if (config != null) {
// log.debug("使用default阶梯配置: productType={}, quantity={}, price={}",
// productType, quantity, config.getPrice());
// }
// }
//
if (config == null) {
log.warn("阶梯定价配置未找到: productType={}, productId={}, quantity={}",
productType, productId, quantity);