Commit 7c270c05 by 林永健

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

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