Commit 7c270c05 by 林永健

perf(service): 优化数据统计服务性能

- 添加查询统计数据耗时监控日志
- 调整 merchantId 查询参数范围以提升性能
1 parent ef8f88d8
...@@ -24,7 +24,6 @@ import java.util.List; ...@@ -24,7 +24,6 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
import java.util.stream.Collectors;
@Service @Service
@Slf4j @Slf4j
...@@ -37,6 +36,8 @@ public class GetDataStatsService { ...@@ -37,6 +36,8 @@ public class GetDataStatsService {
DataResp<List<DataBusinessDTO>> dataResp; DataResp<List<DataBusinessDTO>> dataResp;
// String url = OrePropertyConfigurer.getProperty("total.data.url", String.class, "http://dc.glsx.com.cn/data"); // String url = OrePropertyConfigurer.getProperty("total.data.url", String.class, "http://dc.glsx.com.cn/data");
String url = OrePropertyConfigurer.getProperty("total.data.url", String.class, "http://192.168.3.211:8021/data"); String url = OrePropertyConfigurer.getProperty("total.data.url", String.class, "http://192.168.3.211:8021/data");
long l = System.currentTimeMillis();
// post请求 // post请求
String jsonResponse; String jsonResponse;
try { try {
...@@ -44,6 +45,8 @@ public class GetDataStatsService { ...@@ -44,6 +45,8 @@ public class GetDataStatsService {
jsonResponse = HttpRequestUtils.postJson(url, jsonBody, new HashMap<>()); jsonResponse = HttpRequestUtils.postJson(url, jsonBody, new HashMap<>());
} catch (Exception e) { } catch (Exception e) {
throw new RpcServiceException("查询统计数据异常"); throw new RpcServiceException("查询统计数据异常");
} finally {
log.info("查询统计数据耗时: {}ms", System.currentTimeMillis() - l);
} }
dataResp = JSONUtil.toBean(jsonResponse, new TypeReference<DataResp<List<DataBusinessDTO>>>() { dataResp = JSONUtil.toBean(jsonResponse, new TypeReference<DataResp<List<DataBusinessDTO>>>() {
}, true); }, true);
......
...@@ -475,7 +475,7 @@ public class MerchantBiFollowService { ...@@ -475,7 +475,7 @@ public class MerchantBiFollowService {
// 构建查询参数 // 构建查询参数
SceneBaseReq newReq = new SceneBaseReq(); SceneBaseReq newReq = new SceneBaseReq();
BeanUtils.copyProperties(req, newReq); BeanUtils.copyProperties(req, newReq);
newReq.setExts("merchantId,biz,itemCode"); newReq.setExts("merchantId,biz");
DataBizQueryParamsDTO queryParams = newReq.convertQueryParam(); DataBizQueryParamsDTO queryParams = newReq.convertQueryParam();
queryParams.setBrandIds(dataStatsConfig.defaultBrandId); queryParams.setBrandIds(dataStatsConfig.defaultBrandId);
queryParams.setBizs(null); queryParams.setBizs(null);
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!