You've already forked FrameTour-BE
feat(pricing): 添加查询接口并优化配置管理
- 新增多个查询接口,包括商品配置、阶梯配置和一口价配置的查询- 优化配置管理逻辑,支持 default 配置的创建和使用 - 重构部分代码,提高可维护性和可扩展性
This commit is contained in:
@@ -27,6 +27,71 @@ public class PricingConfigController {
|
||||
private final IPricingManagementService managementService;
|
||||
|
||||
|
||||
// ==================== 查询API ====================
|
||||
|
||||
/**
|
||||
* 获取所有商品配置
|
||||
*/
|
||||
@GetMapping("/products")
|
||||
public ApiResponse<List<PriceProductConfig>> getAllProductConfigs() {
|
||||
log.info("获取所有商品配置");
|
||||
List<PriceProductConfig> configs = productConfigService.getAllProductConfigs();
|
||||
return ApiResponse.success(configs);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据商品类型获取阶梯配置
|
||||
*/
|
||||
@GetMapping("/tiers/{productType}")
|
||||
public ApiResponse<List<PriceTierConfig>> getTierConfigs(@PathVariable String productType) {
|
||||
log.info("根据商品类型获取阶梯配置: {}", productType);
|
||||
List<PriceTierConfig> configs = productConfigService.getTierConfigs(productType);
|
||||
return ApiResponse.success(configs);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据商品类型和商品ID获取阶梯配置
|
||||
*/
|
||||
@GetMapping("/tiers/{productType}/{productId}")
|
||||
public ApiResponse<List<PriceTierConfig>> getTierConfigs(@PathVariable String productType,
|
||||
@PathVariable String productId) {
|
||||
log.info("根据商品类型和ID获取阶梯配置: {}, {}", productType, productId);
|
||||
List<PriceTierConfig> configs = productConfigService.getTierConfigs(productType, productId);
|
||||
return ApiResponse.success(configs);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据商品类型和商品ID获取具体配置
|
||||
*/
|
||||
@GetMapping("/products/{productType}/{productId}")
|
||||
public ApiResponse<PriceProductConfig> getProductConfig(@PathVariable String productType,
|
||||
@PathVariable String productId) {
|
||||
log.info("根据商品类型和ID获取商品配置: {}, {}", productType, productId);
|
||||
PriceProductConfig config = productConfigService.getProductConfig(productType, productId);
|
||||
return ApiResponse.success(config);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取所有阶梯配置
|
||||
*/
|
||||
@GetMapping("/tiers")
|
||||
public ApiResponse<List<PriceTierConfig>> getAllTierConfigs() {
|
||||
log.info("获取所有阶梯配置");
|
||||
List<PriceTierConfig> configs = productConfigService.getAllTierConfigs();
|
||||
return ApiResponse.success(configs);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取所有一口价配置
|
||||
*/
|
||||
@GetMapping("/bundles")
|
||||
public ApiResponse<List<PriceBundleConfig>> getAllBundleConfigs() {
|
||||
log.info("获取所有一口价配置");
|
||||
List<PriceBundleConfig> configs = bundleService.getAllBundles();
|
||||
return ApiResponse.success(configs);
|
||||
}
|
||||
|
||||
|
||||
// ==================== 配置管理API(手动处理时间) ====================
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user