You've already forked FrameTour-BE
refactor(pricing): 移除商品阶梯定价中的 default 配置逻辑
- 删除了尝试使用 default 配置的代码块 - 保留了缓存注释(已注释) - 优化了日志输出,当找不到配置时直接记录警告日志
This commit is contained in:
@@ -44,18 +44,18 @@ public class ProductConfigServiceImpl implements IProductConfigService {
|
|||||||
// @Cacheable(value = "tier-config", key = "#productType + '_' + #productId + '_' + #quantity")
|
// @Cacheable(value = "tier-config", key = "#productType + '_' + #productId + '_' + #quantity")
|
||||||
public PriceTierConfig getTierConfig(String productType, String productId, Integer quantity) {
|
public PriceTierConfig getTierConfig(String productType, String productId, Integer quantity) {
|
||||||
PriceTierConfig config = tierConfigMapper.selectByProductTypeAndQuantity(productType, productId, quantity);
|
PriceTierConfig config = tierConfigMapper.selectByProductTypeAndQuantity(productType, productId, quantity);
|
||||||
|
// 不使用default配置,没查到就算了
|
||||||
// 如果没有找到特定商品的阶梯配置,尝试使用default配置
|
// // 如果没有找到特定商品的阶梯配置,尝试使用default配置
|
||||||
if (config == null && !"default".equals(productId)) {
|
// if (config == null && !"default".equals(productId)) {
|
||||||
log.warn("阶梯定价配置未找到: productType={}, productId={}, quantity={}, 尝试使用default配置",
|
// log.warn("阶梯定价配置未找到: productType={}, productId={}, quantity={}, 尝试使用default配置",
|
||||||
productType, productId, quantity);
|
// productType, productId, quantity);
|
||||||
config = tierConfigMapper.selectByProductTypeAndQuantity(productType, "default", quantity);
|
// config = tierConfigMapper.selectByProductTypeAndQuantity(productType, "default", quantity);
|
||||||
if (config != null) {
|
// if (config != null) {
|
||||||
log.debug("使用default阶梯配置: productType={}, quantity={}, price={}",
|
// log.debug("使用default阶梯配置: productType={}, quantity={}, price={}",
|
||||||
productType, quantity, config.getPrice());
|
// productType, quantity, config.getPrice());
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
if (config == null) {
|
if (config == null) {
|
||||||
log.warn("阶梯定价配置未找到: productType={}, productId={}, quantity={}",
|
log.warn("阶梯定价配置未找到: productType={}, productId={}, quantity={}",
|
||||||
productType, productId, quantity);
|
productType, productId, quantity);
|
||||||
|
Reference in New Issue
Block a user