You've already forked FrameTour-BE
添加景区、删除子类型
This commit is contained in:
@@ -26,61 +26,6 @@ public class PricingConfigController {
|
||||
private final IPriceBundleService bundleService;
|
||||
private final IPricingManagementService managementService;
|
||||
|
||||
/**
|
||||
* 获取所有商品配置
|
||||
*/
|
||||
@GetMapping("/products")
|
||||
public ApiResponse<List<PriceProductConfig>> getProductConfigs() {
|
||||
List<PriceProductConfig> configs = productConfigService.getActiveProductConfigs();
|
||||
return ApiResponse.success(configs);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据商品类型获取阶梯配置
|
||||
*/
|
||||
@GetMapping("/tiers/{productType}")
|
||||
public ApiResponse<List<PriceTierConfig>> getTierConfigs(@PathVariable String 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) {
|
||||
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) {
|
||||
PriceProductConfig config = productConfigService.getProductConfig(productType, productId);
|
||||
return ApiResponse.success(config);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取所有阶梯配置
|
||||
*/
|
||||
@GetMapping("/tiers")
|
||||
public ApiResponse<List<PriceTierConfig>> getAllTierConfigs() {
|
||||
log.info("获取所有阶梯定价配置");
|
||||
return ApiResponse.success(List.of());
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取所有一口价配置
|
||||
*/
|
||||
@GetMapping("/bundles")
|
||||
public ApiResponse<List<PriceBundleConfig>> getBundleConfigs() {
|
||||
List<PriceBundleConfig> configs = bundleService.getActiveBundles();
|
||||
return ApiResponse.success(configs);
|
||||
}
|
||||
|
||||
// ==================== 配置管理API(手动处理时间) ====================
|
||||
|
||||
@@ -146,4 +91,121 @@ public class PricingConfigController {
|
||||
boolean success = managementService.updateBundleConfig(config);
|
||||
return ApiResponse.success(success);
|
||||
}
|
||||
|
||||
// ==================== 启用/禁用API ====================
|
||||
|
||||
/**
|
||||
* 启用/禁用商品配置
|
||||
*/
|
||||
@PutMapping("/products/{id}/status")
|
||||
public ApiResponse<Boolean> updateProductConfigStatus(@PathVariable Long id, @RequestParam Boolean isActive) {
|
||||
log.info("修改商品配置状态: id={}, isActive={}", id, isActive);
|
||||
boolean success = managementService.updateProductConfigStatus(id, isActive);
|
||||
return ApiResponse.success(success);
|
||||
}
|
||||
|
||||
/**
|
||||
* 启用/禁用阶梯配置
|
||||
*/
|
||||
@PutMapping("/tiers/{id}/status")
|
||||
public ApiResponse<Boolean> updateTierConfigStatus(@PathVariable Long id, @RequestParam Boolean isActive) {
|
||||
log.info("修改阶梯配置状态: id={}, isActive={}", id, isActive);
|
||||
boolean success = managementService.updateTierConfigStatus(id, isActive);
|
||||
return ApiResponse.success(success);
|
||||
}
|
||||
|
||||
/**
|
||||
* 启用/禁用一口价配置
|
||||
*/
|
||||
@PutMapping("/bundles/{id}/status")
|
||||
public ApiResponse<Boolean> updateBundleConfigStatus(@PathVariable Long id, @RequestParam Boolean isActive) {
|
||||
log.info("修改一口价配置状态: id={}, isActive={}", id, isActive);
|
||||
boolean success = managementService.updateBundleConfigStatus(id, isActive);
|
||||
return ApiResponse.success(success);
|
||||
}
|
||||
|
||||
// ==================== 删除API ====================
|
||||
|
||||
/**
|
||||
* 删除商品配置
|
||||
*/
|
||||
@DeleteMapping("/products/{id}")
|
||||
public ApiResponse<Boolean> deleteProductConfig(@PathVariable Long id) {
|
||||
log.info("删除商品配置: id={}", id);
|
||||
boolean success = managementService.deleteProductConfig(id);
|
||||
return ApiResponse.success(success);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除阶梯配置
|
||||
*/
|
||||
@DeleteMapping("/tiers/{id}")
|
||||
public ApiResponse<Boolean> deleteTierConfig(@PathVariable Long id) {
|
||||
log.info("删除阶梯配置: id={}", id);
|
||||
boolean success = managementService.deleteTierConfig(id);
|
||||
return ApiResponse.success(success);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除一口价配置
|
||||
*/
|
||||
@DeleteMapping("/bundles/{id}")
|
||||
public ApiResponse<Boolean> deleteBundleConfig(@PathVariable Long id) {
|
||||
log.info("删除一口价配置: id={}", id);
|
||||
boolean success = managementService.deleteBundleConfig(id);
|
||||
return ApiResponse.success(success);
|
||||
}
|
||||
|
||||
// ==================== 管理端接口(包含禁用的配置) ====================
|
||||
|
||||
/**
|
||||
* 管理端:获取所有商品配置(包含禁用的)
|
||||
*/
|
||||
@GetMapping("/admin/products")
|
||||
public ApiResponse<List<PriceProductConfig>> getAllProductConfigsForAdmin() {
|
||||
log.info("管理端获取所有商品配置");
|
||||
List<PriceProductConfig> configs = productConfigService.getAllProductConfigsForAdmin();
|
||||
return ApiResponse.success(configs);
|
||||
}
|
||||
|
||||
/**
|
||||
* 管理端:获取所有阶梯配置(包含禁用的)
|
||||
*/
|
||||
@GetMapping("/admin/tiers")
|
||||
public ApiResponse<List<PriceTierConfig>> getAllTierConfigsForAdmin() {
|
||||
log.info("管理端获取所有阶梯配置");
|
||||
List<PriceTierConfig> configs = productConfigService.getAllTierConfigsForAdmin();
|
||||
return ApiResponse.success(configs);
|
||||
}
|
||||
|
||||
/**
|
||||
* 管理端:根据商品类型获取阶梯配置(包含禁用的)
|
||||
*/
|
||||
@GetMapping("/admin/tiers/{productType}")
|
||||
public ApiResponse<List<PriceTierConfig>> getTierConfigsForAdmin(@PathVariable String productType) {
|
||||
log.info("管理端根据商品类型获取阶梯配置: {}", productType);
|
||||
List<PriceTierConfig> configs = productConfigService.getTierConfigsForAdmin(productType);
|
||||
return ApiResponse.success(configs);
|
||||
}
|
||||
|
||||
/**
|
||||
* 管理端:根据商品类型和商品ID获取阶梯配置(包含禁用的)
|
||||
*/
|
||||
@GetMapping("/admin/tiers/{productType}/{productId}")
|
||||
public ApiResponse<List<PriceTierConfig>> getTierConfigsForAdmin(@PathVariable String productType,
|
||||
@PathVariable String productId) {
|
||||
log.info("管理端根据商品类型和ID获取阶梯配置: {}, {}", productType, productId);
|
||||
List<PriceTierConfig> configs = productConfigService.getTierConfigsForAdmin(productType, productId);
|
||||
return ApiResponse.success(configs);
|
||||
}
|
||||
|
||||
/**
|
||||
* 管理端:获取所有一口价配置(包含禁用的)
|
||||
*/
|
||||
@GetMapping("/admin/bundles")
|
||||
public ApiResponse<List<PriceBundleConfig>> getAllBundleConfigsForAdmin() {
|
||||
log.info("管理端获取所有一口价配置");
|
||||
List<PriceBundleConfig> configs = bundleService.getAllBundlesForAdmin();
|
||||
return ApiResponse.success(configs);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user