Commit 64c6ceee by 崔彦峰

feat(service): 优化日志记录功能

- 调整 CommonIndexQueryService 中的日志格式,统一参数顺序
- 在 DailyReportDataService 的 queryIndex 方法前后添加详细的日志记录
- 在 countOrderServiceYears 方法中增加输入输出日志记录
- 为月度统计查询方法添加完整的请求响应日志记录
- 优化日志信息的可读性和调试效率
1 parent 0c3a9f09
......@@ -29,14 +29,14 @@ public class CommonIndexQueryService {
// post请求
String jsonResponse;
try {
log.info("url,jsonBody: {},{}",url, jsonBody);
log.info("url:{},jsonBody:{}", url, jsonBody);
jsonResponse = HttpRequestUtils.postJson(url, jsonBody, new HashMap<>());
} catch (Exception e) {
throw new RpcServiceException("查询统计数据异常");
}
dataResp = JSONUtil.toBean(jsonResponse, new TypeReference<DataResp<List<DataBusinessDTO>>>() {
}, true);
log.info("查询公共指标数据dataResp:{}",JSONUtil.toJsonStr(dataResp));
log.info("查询公共指标数据url:{},jsonBody:{},dataResp:{}", url, jsonBody, JSONUtil.toJsonStr(dataResp));
return dataResp;
}
}
......@@ -380,16 +380,19 @@ public class DailyReportDataService {
String jsonBody = JSONUtil.toJsonStr(queryCopy);
DataResp<List<DataBusinessDTO>> listDataResp;
log.info("queryIndex,merchantId:{},jsonBody:{}", merchantId, jsonBody);
listDataResp = commonIndexQueryService.queryIndex(jsonBody);
log.info("queryIndex,merchantId:{},jsonBody:{},listDataResp:{}", merchantId, jsonBody, listDataResp);
BigDecimal todayTotalOutput = BigDecimal.ZERO;
if (CollectionUtils.isNotEmpty(listDataResp.getContent())) {
todayTotalOutput = listDataResp.getContent().get(0).getItemValue();
}
queryCopy.setItemCodes("A095");
jsonBody = JSONUtil.toJsonStr(queryCopy);
log.info("queryIndex,merchantId:{},jsonBody:{}", merchantId, jsonBody);
listDataResp = commonIndexQueryService.queryIndex(jsonBody);
log.info("queryIndex,merchantId:{},jsonBody:{},listDataResp:{}", merchantId, jsonBody, listDataResp);
BigDecimal todayAvgOrderPrice = BigDecimal.ZERO;
if (CollectionUtils.isNotEmpty(listDataResp.getContent())) {
todayAvgOrderPrice = listDataResp.getContent().get(0).getItemValue();
......@@ -581,7 +584,9 @@ public class DailyReportDataService {
goodsOrderDTO.setPaySuccessStartDate(reportDate + " 00:00:00");
goodsOrderDTO.setPaySuccessEndDate(reportDate + " 23:59:59");
log.info("countOrderServiceYears,goodsOrderDTO:{}",JSONUtil.toJsonStr(goodsOrderDTO));
RpcResponse<Integer> integerRpcResponse = goodsOrderRemote.countOrderServiceYears(goodsOrderDTO);
log.info("countOrderServiceYears,goodsOrderDTO:{},integerRpcResponse:{}",JSONUtil.toJsonStr(goodsOrderDTO),integerRpcResponse);
if (integerRpcResponse.isSuccess()) {
lanTuThreeYearDealCount = integerRpcResponse.getResult();
}
......@@ -621,7 +626,9 @@ public class DailyReportDataService {
goodsOrderDTO.setPaySuccessStartDate(startDate + " 00:00:00");
goodsOrderDTO.setPaySuccessEndDate(endDate + " 23:59:59");
log.info("countOrderServiceYears,goodsOrderDTO:{}",JSONUtil.toJsonStr(goodsOrderDTO));
RpcResponse<Integer> integerRpcResponse = goodsOrderRemote.countOrderServiceYears(goodsOrderDTO);
log.info("countOrderServiceYears,goodsOrderDTO:{},integerRpcResponse:{}",JSONUtil.toJsonStr(goodsOrderDTO),integerRpcResponse);
if (integerRpcResponse.isSuccess()) {
lanTuThreeYearDealCount = integerRpcResponse.getResult();
}
......@@ -1198,56 +1205,72 @@ public class DailyReportDataService {
queryCopy.setItemCodes("A036");
String jsonBody = JSONUtil.toJsonStr(queryCopy);
log.info("queryIndex,merchantId:{},jsonBody:{}", merchantId, jsonBody);
listDataResp = commonIndexQueryService.queryIndex(jsonBody);
log.info("queryIndex,merchantId:{},jsonBody:{},listDataResp:{}", merchantId, jsonBody, listDataResp);
if (CollectionUtils.isNotEmpty(listDataResp.getContent())) {
monthTotalOutput = listDataResp.getContent().get(0).getItemValue();
}
queryCopy.setItemCodes("A095");
jsonBody = JSONUtil.toJsonStr(queryCopy);
log.info("queryIndex,merchantId:{},jsonBody:{}", merchantId, jsonBody);
listDataResp = commonIndexQueryService.queryIndex(jsonBody);
log.info("queryIndex,merchantId:{},jsonBody:{},listDataResp:{}", merchantId, jsonBody, listDataResp);
if (CollectionUtils.isNotEmpty(listDataResp.getContent())) {
monthAvgOrderPriceTotal = listDataResp.getContent().get(0).getItemValue();
}
queryCopy.setItemCodes("A0106");
jsonBody = JSONUtil.toJsonStr(queryCopy);
log.info("queryIndex,merchantId:{},jsonBody:{}", merchantId, jsonBody);
listDataResp = commonIndexQueryService.queryIndex(jsonBody);
log.info("queryIndex,merchantId:{},jsonBody:{},listDataResp:{}", merchantId, jsonBody, listDataResp);
if (CollectionUtils.isNotEmpty(listDataResp.getContent())) {
monthOriginalFilmUpgradeCount = listDataResp.getContent().get(0).getItemValue().intValue();
}
queryCopy.setItemCodes("A0108");
jsonBody = JSONUtil.toJsonStr(queryCopy);
log.info("queryIndex,merchantId:{},jsonBody:{}", merchantId, jsonBody);
listDataResp = commonIndexQueryService.queryIndex(jsonBody);
log.info("queryIndex,merchantId:{},jsonBody:{},listDataResp:{}", merchantId, jsonBody, listDataResp);
if (CollectionUtils.isNotEmpty(listDataResp.getContent())) {
monthOriginalFilmSystemCount = listDataResp.getContent().get(0).getItemValue();
}
queryCopy.setItemCodes("A0111");
jsonBody = JSONUtil.toJsonStr(queryCopy);
log.info("queryIndex,merchantId:{},jsonBody:{}", merchantId, jsonBody);
listDataResp = commonIndexQueryService.queryIndex(jsonBody);
log.info("queryIndex,merchantId:{},jsonBody:{},listDataResp:{}", merchantId, jsonBody, listDataResp);
if (CollectionUtils.isNotEmpty(listDataResp.getContent())) {
monthOriginalCarCoatUpgradeCount = listDataResp.getContent().get(0).getItemValue().intValue();
}
queryCopy.setItemCodes("A0113");
jsonBody = JSONUtil.toJsonStr(queryCopy);
log.info("queryIndex,merchantId:{},jsonBody:{}", merchantId, jsonBody);
listDataResp = commonIndexQueryService.queryIndex(jsonBody);
log.info("queryIndex,merchantId:{},jsonBody:{},listDataResp:{}", merchantId, jsonBody, listDataResp);
if (CollectionUtils.isNotEmpty(listDataResp.getContent())) {
monthOriginalCarCoatSystemCount = listDataResp.getContent().get(0).getItemValue();
}
queryCopy.setItemCodes("A0116");
jsonBody = JSONUtil.toJsonStr(queryCopy);
log.info("queryIndex,merchantId:{},jsonBody:{}", merchantId, jsonBody);
listDataResp = commonIndexQueryService.queryIndex(jsonBody);
log.info("queryIndex,merchantId:{},jsonBody:{},listDataResp:{}", merchantId, jsonBody, listDataResp);
if (CollectionUtils.isNotEmpty(listDataResp.getContent())) {
monthBoutiqueUpgradeCount = listDataResp.getContent().get(0).getItemValue().intValue();
}
queryCopy.setItemCodes("A0118");
jsonBody = JSONUtil.toJsonStr(queryCopy);
log.info("queryIndex,merchantId:{},jsonBody:{}", merchantId, jsonBody);
listDataResp = commonIndexQueryService.queryIndex(jsonBody);
log.info("queryIndex,merchantId:{},jsonBody:{},listDataResp:{}", merchantId, jsonBody, listDataResp);
if (CollectionUtils.isNotEmpty(listDataResp.getContent())) {
monthBoutiqueSystemCount = listDataResp.getContent().get(0).getItemValue();
}
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!