You've already forked FrameTour-BE
Compare commits
4 Commits
8745cde2fb
...
0ff0b75910
Author | SHA1 | Date | |
---|---|---|---|
0ff0b75910 | |||
aa717d0c2a | |||
e4da509964 | |||
9426d9c712 |
@@ -33,7 +33,7 @@ public class BceImageEnhancer implements IEnhancer {
|
||||
public MultipartFile enhance(String url) {
|
||||
AipImageProcess client = getClient();
|
||||
HashMap<String, String> options = new HashMap<>();
|
||||
JSONObject jsonObject = client.imageQualityEnhance(url, options);
|
||||
JSONObject jsonObject = client.imageDefinitionEnhance(url, options);
|
||||
return ImageUtils.base64ToMultipartFile(jsonObject.getString("image"));
|
||||
}
|
||||
|
||||
|
@@ -0,0 +1,43 @@
|
||||
package com.ycwl.basic.image.enhancer.adapter;
|
||||
|
||||
import com.baidu.aip.imageprocess.AipImageProcess;
|
||||
import com.ycwl.basic.image.enhancer.entity.BceEnhancerConfig;
|
||||
import com.ycwl.basic.utils.ImageUtils;
|
||||
import org.json.JSONObject;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class BceImageSR implements IEnhancer {
|
||||
private BceEnhancerConfig config;
|
||||
|
||||
public boolean setConfig(BceEnhancerConfig config) {
|
||||
this.config = config;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean loadConfig(Map<String, String> _config) {
|
||||
BceEnhancerConfig config = new BceEnhancerConfig();
|
||||
config.setAppId(_config.get("appId"));
|
||||
config.setApiKey(_config.get("apiKey"));
|
||||
config.setSecretKey(_config.get("secretKey"));
|
||||
config.setQps(Float.parseFloat(_config.get("qps")));
|
||||
this.config = config;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public MultipartFile enhance(String url) {
|
||||
AipImageProcess client = getClient();
|
||||
HashMap<String, String> options = new HashMap<>();
|
||||
JSONObject jsonObject = client.imageQualityEnhance(url, options);
|
||||
return ImageUtils.base64ToMultipartFile(jsonObject.getString("image"));
|
||||
}
|
||||
|
||||
public AipImageProcess getClient() {
|
||||
AipImageProcess client = new AipImageProcess(config.getAppId(), config.getApiKey(), config.getSecretKey());
|
||||
return client;
|
||||
}
|
||||
}
|
@@ -18,31 +18,26 @@ public class DefaultConfigIntegrationService {
|
||||
private final DefaultConfigClient defaultConfigClient;
|
||||
|
||||
public List<DefaultConfigDTO> listDefaultConfigs() {
|
||||
log.info("获取默认配置列表");
|
||||
CommonResponse<List<DefaultConfigDTO>> response = defaultConfigClient.listDefaultConfigs();
|
||||
return handleResponse(response, "获取默认配置列表失败");
|
||||
}
|
||||
|
||||
public DefaultConfigDTO getDefaultConfig(String configKey) {
|
||||
log.info("获取指定默认配置, configKey: {}", configKey);
|
||||
CommonResponse<DefaultConfigDTO> response = defaultConfigClient.getDefaultConfig(configKey);
|
||||
return handleResponse(response, "获取指定默认配置失败");
|
||||
}
|
||||
|
||||
public DefaultConfigDTO createDefaultConfig(DefaultConfigDTO request) {
|
||||
log.info("创建默认配置, configKey: {}", request.getConfigKey());
|
||||
CommonResponse<DefaultConfigDTO> response = defaultConfigClient.createDefaultConfig(request);
|
||||
return handleResponse(response, "创建默认配置失败");
|
||||
}
|
||||
|
||||
public DefaultConfigDTO updateDefaultConfig(String configKey, DefaultConfigDTO request) {
|
||||
log.info("更新默认配置, configKey: {}", configKey);
|
||||
CommonResponse<DefaultConfigDTO> response = defaultConfigClient.updateDefaultConfig(configKey, request);
|
||||
return handleResponse(response, "更新默认配置失败");
|
||||
}
|
||||
|
||||
public void deleteDefaultConfig(String configKey) {
|
||||
log.info("删除默认配置, configKey: {}", configKey);
|
||||
CommonResponse<Void> response = defaultConfigClient.deleteDefaultConfig(configKey);
|
||||
handleResponse(response, "删除默认配置失败");
|
||||
}
|
||||
|
@@ -19,49 +19,41 @@ public class ScenicConfigIntegrationService {
|
||||
private final ScenicConfigV2Client scenicConfigV2Client;
|
||||
|
||||
public List<ScenicConfigV2DTO> listConfigs(Long scenicId) {
|
||||
log.info("获取景区配置列表, scenicId: {}", scenicId);
|
||||
CommonResponse<List<ScenicConfigV2DTO>> response = scenicConfigV2Client.listConfigs(scenicId);
|
||||
return handleResponse(response, "获取景区配置列表失败");
|
||||
}
|
||||
|
||||
public ScenicConfigV2DTO getConfigByKey(Long scenicId, String configKey) {
|
||||
log.info("根据键获取景区配置, scenicId: {}, configKey: {}", scenicId, configKey);
|
||||
CommonResponse<ScenicConfigV2DTO> response = scenicConfigV2Client.getConfigByKey(scenicId, configKey);
|
||||
return handleResponse(response, "根据键获取景区配置失败");
|
||||
}
|
||||
|
||||
public Map<String, Object> getFlatConfigs(Long scenicId) {
|
||||
log.info("获取景区扁平化配置, scenicId: {}", scenicId);
|
||||
CommonResponse<Map<String, Object>> response = scenicConfigV2Client.getFlatConfigs(scenicId);
|
||||
return handleResponse(response, "获取景区扁平化配置失败");
|
||||
}
|
||||
|
||||
public ScenicConfigV2DTO createConfig(Long scenicId, CreateConfigRequest request) {
|
||||
log.info("创建景区配置, scenicId: {}, configKey: {}", scenicId, request.getConfigKey());
|
||||
CommonResponse<ScenicConfigV2DTO> response = scenicConfigV2Client.createConfig(scenicId, request);
|
||||
return handleResponse(response, "创建景区配置失败");
|
||||
}
|
||||
|
||||
public ScenicConfigV2DTO updateConfig(Long scenicId, String id, UpdateConfigRequest request) {
|
||||
log.info("更新景区配置, scenicId: {}, id: {}", scenicId, id);
|
||||
CommonResponse<ScenicConfigV2DTO> response = scenicConfigV2Client.updateConfig(scenicId, id, request);
|
||||
return handleResponse(response, "更新景区配置失败");
|
||||
}
|
||||
|
||||
public void deleteConfig(Long scenicId, String id) {
|
||||
log.info("删除景区配置, scenicId: {}, id: {}", scenicId, id);
|
||||
CommonResponse<Void> response = scenicConfigV2Client.deleteConfig(scenicId, id);
|
||||
handleResponse(response, "删除景区配置失败");
|
||||
}
|
||||
|
||||
public BatchUpdateResponse batchUpdateConfigs(Long scenicId, BatchConfigRequest request) {
|
||||
log.info("批量更新景区配置, scenicId: {}, configs count: {}", scenicId, request.getConfigs().size());
|
||||
CommonResponse<BatchUpdateResponse> response = scenicConfigV2Client.batchUpdateConfigs(scenicId, request);
|
||||
return handleResponse(response, "批量更新景区配置失败");
|
||||
}
|
||||
|
||||
public BatchUpdateResponse batchFlatUpdateConfigs(Long scenicId, Map<String, Object> configs) {
|
||||
log.info("扁平化批量更新景区配置, scenicId: {}, configs count: {}", scenicId, configs.size());
|
||||
CommonResponse<BatchUpdateResponse> response = scenicConfigV2Client.batchFlatUpdateConfigs(scenicId, configs);
|
||||
return handleResponse(response, "扁平化批量更新景区配置失败");
|
||||
}
|
||||
|
@@ -27,55 +27,46 @@ public class ScenicIntegrationService {
|
||||
private final ScenicConfigV2Client scenicConfigV2Client;
|
||||
|
||||
public ScenicV2DTO getScenic(Long scenicId) {
|
||||
log.info("获取景区信息, scenicId: {}", scenicId);
|
||||
CommonResponse<ScenicV2DTO> response = scenicV2Client.getScenic(scenicId);
|
||||
return handleResponse(response, "获取景区信息失败");
|
||||
}
|
||||
|
||||
public ScenicV2WithConfigDTO getScenicWithConfig(Long scenicId) {
|
||||
log.info("获取景区配置信息, scenicId: {}", scenicId);
|
||||
CommonResponse<ScenicV2WithConfigDTO> response = scenicV2Client.getScenicWithConfig(scenicId);
|
||||
return handleResponse(response, "获取景区配置信息失败");
|
||||
}
|
||||
|
||||
public Map<String, Object> getScenicFlatConfig(Long scenicId) {
|
||||
log.info("获取景区扁平化配置, scenicId: {}", scenicId);
|
||||
CommonResponse<Map<String, Object>> response = scenicConfigV2Client.getFlatConfigs(scenicId);
|
||||
return handleResponse(response, "获取景区扁平化配置失败");
|
||||
}
|
||||
|
||||
public ScenicV2DTO createScenic(CreateScenicRequest request) {
|
||||
log.info("创建景区, name: {}", request.getName());
|
||||
CommonResponse<ScenicV2DTO> response = scenicV2Client.createScenic(request);
|
||||
return handleResponse(response, "创建景区失败");
|
||||
}
|
||||
|
||||
public ScenicV2DTO updateScenic(Long scenicId, UpdateScenicRequest request) {
|
||||
log.info("更新景区信息, scenicId: {}", scenicId);
|
||||
CommonResponse<ScenicV2DTO> response = scenicV2Client.updateScenic(scenicId, request);
|
||||
return handleResponse(response, "更新景区信息失败");
|
||||
}
|
||||
|
||||
public void deleteScenic(Long scenicId) {
|
||||
log.info("删除景区, scenicId: {}", scenicId);
|
||||
CommonResponse<Void> response = scenicV2Client.deleteScenic(scenicId);
|
||||
handleResponse(response, "删除景区失败");
|
||||
}
|
||||
|
||||
public ScenicFilterPageResponse filterScenics(ScenicFilterRequest request) {
|
||||
log.info("筛选景区, filters: {}", request.getFilters().size());
|
||||
CommonResponse<ScenicFilterPageResponse> response = scenicV2Client.filterScenics(request);
|
||||
return handleResponse(response, "筛选景区失败");
|
||||
}
|
||||
|
||||
public ScenicV2ListResponse listScenics(Integer page, Integer pageSize, Integer status, String name) {
|
||||
log.info("分页查询景区列表, page: {}, pageSize: {}, status: {}, name: {}", page, pageSize, status, name);
|
||||
CommonResponse<ScenicV2ListResponse> response = scenicV2Client.listScenics(page, pageSize, status, name);
|
||||
return handleResponse(response, "分页查询景区列表失败");
|
||||
}
|
||||
|
||||
public ScenicV2WithConfigListResponse listScenicsWithConfig(Integer page, Integer pageSize, Integer status, String name) {
|
||||
log.info("分页查询景区带配置列表, page: {}, pageSize: {}, status: {}, name: {}", page, pageSize, status, name);
|
||||
CommonResponse<ScenicV2WithConfigListResponse> response = scenicV2Client.listScenicsWithConfig(page, pageSize, status, name);
|
||||
return handleResponse(response, "分页查询景区带配置列表失败");
|
||||
}
|
||||
|
@@ -1,6 +1,10 @@
|
||||
package com.ycwl.basic.pricing.controller;
|
||||
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.ycwl.basic.utils.ApiResponse;
|
||||
import com.ycwl.basic.pricing.dto.PricingFilterRequest;
|
||||
import com.ycwl.basic.pricing.dto.TierConfigFilterRequest;
|
||||
import com.ycwl.basic.pricing.dto.BundleConfigFilterRequest;
|
||||
import com.ycwl.basic.pricing.entity.PriceProductConfig;
|
||||
import com.ycwl.basic.pricing.entity.PriceTierConfig;
|
||||
import com.ycwl.basic.pricing.entity.PriceBundleConfig;
|
||||
@@ -237,6 +241,16 @@ public class PricingConfigController {
|
||||
return ApiResponse.success(configs);
|
||||
}
|
||||
|
||||
/**
|
||||
* 管理端:分页查询商品配置(包含禁用的),支持筛选
|
||||
*/
|
||||
@PostMapping("/admin/products/page")
|
||||
public ApiResponse<PageInfo<PriceProductConfig>> pageProductConfigsForAdmin(@RequestBody PricingFilterRequest request) {
|
||||
log.info("管理端分页查询商品配置: {}", request);
|
||||
PageInfo<PriceProductConfig> pageInfo = productConfigService.pageProductConfigsForAdmin(request);
|
||||
return ApiResponse.success(pageInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 管理端:获取所有阶梯配置(包含禁用的)
|
||||
*/
|
||||
@@ -247,6 +261,16 @@ public class PricingConfigController {
|
||||
return ApiResponse.success(configs);
|
||||
}
|
||||
|
||||
/**
|
||||
* 管理端:分页查询阶梯配置(包含禁用的),支持筛选
|
||||
*/
|
||||
@PostMapping("/admin/tiers/page")
|
||||
public ApiResponse<PageInfo<PriceTierConfig>> pageTierConfigsForAdmin(@RequestBody TierConfigFilterRequest request) {
|
||||
log.info("管理端分页查询阶梯配置: {}", request);
|
||||
PageInfo<PriceTierConfig> pageInfo = productConfigService.pageTierConfigsForAdmin(request);
|
||||
return ApiResponse.success(pageInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 管理端:根据商品类型获取阶梯配置(包含禁用的)
|
||||
*/
|
||||
@@ -278,6 +302,16 @@ public class PricingConfigController {
|
||||
return ApiResponse.success(configs);
|
||||
}
|
||||
|
||||
/**
|
||||
* 管理端:分页查询一口价配置(包含禁用的),支持筛选
|
||||
*/
|
||||
@PostMapping("/admin/bundles/page")
|
||||
public ApiResponse<PageInfo<PriceBundleConfig>> pageBundleConfigsForAdmin(@RequestBody BundleConfigFilterRequest request) {
|
||||
log.info("管理端分页查询一口价配置: {}", request);
|
||||
PageInfo<PriceBundleConfig> pageInfo = bundleService.pageBundleConfigsForAdmin(request);
|
||||
return ApiResponse.success(pageInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 管理端:获取所有优惠券配置(包含禁用的)
|
||||
*/
|
||||
|
@@ -0,0 +1,35 @@
|
||||
package com.ycwl.basic.pricing.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 一口价配置筛选请求DTO
|
||||
*/
|
||||
@Data
|
||||
public class BundleConfigFilterRequest {
|
||||
|
||||
/**
|
||||
* 页码(从1开始)
|
||||
*/
|
||||
private Integer pageNum = 1;
|
||||
|
||||
/**
|
||||
* 每页大小
|
||||
*/
|
||||
private Integer pageSize = 10;
|
||||
|
||||
/**
|
||||
* 景区ID
|
||||
*/
|
||||
private String scenicId;
|
||||
|
||||
/**
|
||||
* 套餐名称(支持模糊查询)
|
||||
*/
|
||||
private String bundleName;
|
||||
|
||||
/**
|
||||
* 状态(true=启用,false=禁用,null=全部)
|
||||
*/
|
||||
private Boolean isActive;
|
||||
}
|
@@ -0,0 +1,36 @@
|
||||
package com.ycwl.basic.pricing.dto;
|
||||
|
||||
import com.ycwl.basic.pricing.enums.ProductType;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 价格配置筛选请求DTO
|
||||
*/
|
||||
@Data
|
||||
public class PricingFilterRequest {
|
||||
|
||||
/**
|
||||
* 页码(从1开始)
|
||||
*/
|
||||
private Integer pageNum = 1;
|
||||
|
||||
/**
|
||||
* 每页大小
|
||||
*/
|
||||
private Integer pageSize = 10;
|
||||
|
||||
/**
|
||||
* 景区ID
|
||||
*/
|
||||
private String scenicId;
|
||||
|
||||
/**
|
||||
* 商品类型
|
||||
*/
|
||||
private ProductType productType;
|
||||
|
||||
/**
|
||||
* 状态(true=启用,false=禁用,null=全部)
|
||||
*/
|
||||
private Boolean isActive;
|
||||
}
|
@@ -0,0 +1,41 @@
|
||||
package com.ycwl.basic.pricing.dto;
|
||||
|
||||
import com.ycwl.basic.pricing.enums.ProductType;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 阶梯配置筛选请求DTO
|
||||
*/
|
||||
@Data
|
||||
public class TierConfigFilterRequest {
|
||||
|
||||
/**
|
||||
* 页码(从1开始)
|
||||
*/
|
||||
private Integer pageNum = 1;
|
||||
|
||||
/**
|
||||
* 每页大小
|
||||
*/
|
||||
private Integer pageSize = 10;
|
||||
|
||||
/**
|
||||
* 景区ID
|
||||
*/
|
||||
private String scenicId;
|
||||
|
||||
/**
|
||||
* 商品类型
|
||||
*/
|
||||
private ProductType productType;
|
||||
|
||||
/**
|
||||
* 具体商品ID
|
||||
*/
|
||||
private String productId;
|
||||
|
||||
/**
|
||||
* 状态(true=启用,false=禁用,null=全部)
|
||||
*/
|
||||
private Boolean isActive;
|
||||
}
|
@@ -1,5 +1,7 @@
|
||||
package com.ycwl.basic.pricing.service;
|
||||
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.ycwl.basic.pricing.dto.BundleConfigFilterRequest;
|
||||
import com.ycwl.basic.pricing.dto.ProductItem;
|
||||
import com.ycwl.basic.pricing.entity.PriceBundleConfig;
|
||||
|
||||
@@ -49,4 +51,12 @@ public interface IPriceBundleService {
|
||||
* @return 一口价配置列表
|
||||
*/
|
||||
List<PriceBundleConfig> getAllBundlesForAdmin();
|
||||
|
||||
/**
|
||||
* 分页查询一口价配置(包含禁用的)- 管理端使用
|
||||
*
|
||||
* @param request 筛选请求参数
|
||||
* @return 分页结果
|
||||
*/
|
||||
PageInfo<PriceBundleConfig> pageBundleConfigsForAdmin(BundleConfigFilterRequest request);
|
||||
}
|
@@ -1,5 +1,8 @@
|
||||
package com.ycwl.basic.pricing.service;
|
||||
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.ycwl.basic.pricing.dto.PricingFilterRequest;
|
||||
import com.ycwl.basic.pricing.dto.TierConfigFilterRequest;
|
||||
import com.ycwl.basic.pricing.entity.PriceProductConfig;
|
||||
import com.ycwl.basic.pricing.entity.PriceTierConfig;
|
||||
|
||||
@@ -107,4 +110,20 @@ public interface IProductConfigService {
|
||||
* @return 阶梯配置列表
|
||||
*/
|
||||
List<PriceTierConfig> getTierConfigsForAdmin(String productType, String productId);
|
||||
|
||||
/**
|
||||
* 分页查询商品配置(包含禁用的)- 管理端使用
|
||||
*
|
||||
* @param request 筛选请求参数
|
||||
* @return 分页结果
|
||||
*/
|
||||
PageInfo<PriceProductConfig> pageProductConfigsForAdmin(PricingFilterRequest request);
|
||||
|
||||
/**
|
||||
* 分页查询阶梯配置(包含禁用的)- 管理端使用
|
||||
*
|
||||
* @param request 筛选请求参数
|
||||
* @return 分页结果
|
||||
*/
|
||||
PageInfo<PriceTierConfig> pageTierConfigsForAdmin(TierConfigFilterRequest request);
|
||||
}
|
@@ -2,6 +2,10 @@ package com.ycwl.basic.pricing.service.impl;
|
||||
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.ycwl.basic.pricing.dto.BundleConfigFilterRequest;
|
||||
import com.ycwl.basic.pricing.dto.BundleProductItem;
|
||||
import com.ycwl.basic.pricing.dto.ProductItem;
|
||||
import com.ycwl.basic.pricing.entity.PriceBundleConfig;
|
||||
@@ -10,8 +14,8 @@ import com.ycwl.basic.pricing.mapper.PriceBundleConfigMapper;
|
||||
import com.ycwl.basic.pricing.service.IPriceBundleService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
//import org.springframework.cache.annotation.Cacheable;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.HashSet;
|
||||
@@ -90,6 +94,36 @@ public class PriceBundleServiceImpl implements IPriceBundleService {
|
||||
return bundleConfigMapper.selectAllBundlesForAdmin();
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageInfo<PriceBundleConfig> pageBundleConfigsForAdmin(BundleConfigFilterRequest request) {
|
||||
// 开启分页
|
||||
PageHelper.startPage(request.getPageNum(), request.getPageSize());
|
||||
|
||||
// 构建查询条件
|
||||
QueryWrapper<PriceBundleConfig> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("deleted", 0); // 未删除的记录
|
||||
|
||||
// 添加筛选条件
|
||||
if (StringUtils.hasText(request.getScenicId())) {
|
||||
queryWrapper.eq("scenic_id", request.getScenicId());
|
||||
}
|
||||
if (StringUtils.hasText(request.getBundleName())) {
|
||||
queryWrapper.like("bundle_name", request.getBundleName()); // 模糊查询
|
||||
}
|
||||
if (request.getIsActive() != null) {
|
||||
queryWrapper.eq("is_active", request.getIsActive());
|
||||
}
|
||||
|
||||
// 按创建时间降序排列
|
||||
queryWrapper.orderByDesc("create_time");
|
||||
|
||||
// 执行查询
|
||||
List<PriceBundleConfig> list = bundleConfigMapper.selectList(queryWrapper);
|
||||
|
||||
// 返回分页结果
|
||||
return new PageInfo<>(list);
|
||||
}
|
||||
|
||||
private boolean isProductsMatchBundle(Set<String> productTypes, PriceBundleConfig bundle) {
|
||||
try {
|
||||
// 检查包含的商品
|
||||
|
@@ -1,5 +1,10 @@
|
||||
package com.ycwl.basic.pricing.service.impl;
|
||||
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.ycwl.basic.pricing.dto.PricingFilterRequest;
|
||||
import com.ycwl.basic.pricing.dto.TierConfigFilterRequest;
|
||||
import com.ycwl.basic.pricing.entity.PriceProductConfig;
|
||||
import com.ycwl.basic.pricing.entity.PriceTierConfig;
|
||||
import com.ycwl.basic.pricing.exception.ProductConfigNotFoundException;
|
||||
@@ -8,8 +13,8 @@ import com.ycwl.basic.pricing.mapper.PriceTierConfigMapper;
|
||||
import com.ycwl.basic.pricing.service.IProductConfigService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
//import org.springframework.cache.annotation.Cacheable;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -118,4 +123,67 @@ public class ProductConfigServiceImpl implements IProductConfigService {
|
||||
public List<PriceTierConfig> getTierConfigsForAdmin(String productType, String productId) {
|
||||
return tierConfigMapper.selectByProductTypeAndIdForAdmin(productType, productId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageInfo<PriceProductConfig> pageProductConfigsForAdmin(PricingFilterRequest request) {
|
||||
// 开启分页
|
||||
PageHelper.startPage(request.getPageNum(), request.getPageSize());
|
||||
|
||||
// 构建查询条件
|
||||
QueryWrapper<PriceProductConfig> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("deleted", 0); // 未删除的记录
|
||||
|
||||
// 添加筛选条件
|
||||
if (StringUtils.hasText(request.getScenicId())) {
|
||||
queryWrapper.eq("scenic_id", request.getScenicId());
|
||||
}
|
||||
if (request.getProductType() != null) {
|
||||
queryWrapper.eq("product_type", request.getProductType().getCode());
|
||||
}
|
||||
if (request.getIsActive() != null) {
|
||||
queryWrapper.eq("is_active", request.getIsActive());
|
||||
}
|
||||
|
||||
// 按创建时间降序排列
|
||||
queryWrapper.orderByDesc("create_time");
|
||||
|
||||
// 执行查询
|
||||
List<PriceProductConfig> list = productConfigMapper.selectList(queryWrapper);
|
||||
|
||||
// 返回分页结果
|
||||
return new PageInfo<>(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageInfo<PriceTierConfig> pageTierConfigsForAdmin(TierConfigFilterRequest request) {
|
||||
// 开启分页
|
||||
PageHelper.startPage(request.getPageNum(), request.getPageSize());
|
||||
|
||||
// 构建查询条件
|
||||
QueryWrapper<PriceTierConfig> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("deleted", 0); // 未删除的记录
|
||||
|
||||
// 添加筛选条件
|
||||
if (StringUtils.hasText(request.getScenicId())) {
|
||||
queryWrapper.eq("scenic_id", request.getScenicId());
|
||||
}
|
||||
if (request.getProductType() != null) {
|
||||
queryWrapper.eq("product_type", request.getProductType().getCode());
|
||||
}
|
||||
if (StringUtils.hasText(request.getProductId())) {
|
||||
queryWrapper.eq("product_id", request.getProductId());
|
||||
}
|
||||
if (request.getIsActive() != null) {
|
||||
queryWrapper.eq("is_active", request.getIsActive());
|
||||
}
|
||||
|
||||
// 按排序字段升序,再按创建时间降序排列
|
||||
queryWrapper.orderByAsc("sort_order").orderByDesc("create_time");
|
||||
|
||||
// 执行查询
|
||||
List<PriceTierConfig> list = tierConfigMapper.selectList(queryWrapper);
|
||||
|
||||
// 返回分页结果
|
||||
return new PageInfo<>(list);
|
||||
}
|
||||
}
|
@@ -30,7 +30,7 @@ public class PriceCacheService {
|
||||
private static final String CACHE_PREFIX = "pricing:cache:";
|
||||
|
||||
// 缓存过期时间:5分钟
|
||||
private static final Duration CACHE_DURATION = Duration.ofMinutes(5);
|
||||
private static final Duration CACHE_DURATION = Duration.ofMinutes(10);
|
||||
|
||||
/**
|
||||
* 生成缓存键
|
||||
|
Reference in New Issue
Block a user