From c83101eb62f5d4906b9c01ceea6b21a37f9e84d8 Mon Sep 17 00:00:00 2001
From: zxl <763096477@qq.com>
Date: 星期二, 18 十一月 2025 09:24:53 +0800
Subject: [PATCH] bug修复
---
ycl-server/src/main/java/com/ycl/platform/service/impl/ReportServiceImpl.java | 20 ++++++++++++++++++--
1 files changed, 18 insertions(+), 2 deletions(-)
diff --git a/ycl-server/src/main/java/com/ycl/platform/service/impl/ReportServiceImpl.java b/ycl-server/src/main/java/com/ycl/platform/service/impl/ReportServiceImpl.java
index 0cd1b19..e9e1726 100644
--- a/ycl-server/src/main/java/com/ycl/platform/service/impl/ReportServiceImpl.java
+++ b/ycl-server/src/main/java/com/ycl/platform/service/impl/ReportServiceImpl.java
@@ -1,5 +1,6 @@
package com.ycl.platform.service.impl;
+import com.alibaba.fastjson2.JSON;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
@@ -33,6 +34,7 @@
import jakarta.servlet.http.HttpServletResponse;
import lombok.RequiredArgsConstructor;
import lombok.SneakyThrows;
+import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@@ -50,6 +52,7 @@
*/
@Service
@RequiredArgsConstructor
+@Slf4j
public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> implements ReportService {
private final YwUnitMapper unitMapper;
@@ -266,9 +269,15 @@
if (query.getEffectTimeEnd() != null) {
query.setEffectTimeEnd(DateUtils.getDayEnd(query.getEffectTimeEnd()));
}
-
+ long dbStartTime = System.currentTimeMillis();
baseMapper.page(page, query);
+ long dbCostTime = System.currentTimeMillis() - dbStartTime;
+ // 5. 鎵撳嵃鑰楁椂鏃ュ織锛堝惈璇锋眰鍙傛暟锛屾柟渚垮悗缁帓鏌ユ參鏌ヨ锛�
+ log.info("鎶ヨ〃鏁版嵁搴撴煡璇㈣�楁椂锛歿}ms锛屾煡璇㈠弬鏁帮細{}", dbCostTime, JSON.toJSONString(query));
+
+ long dictStartTime = System.currentTimeMillis();
List<SysDictData> errorTypeList = dictTypeService.selectDictDataByType("report_error_type");
+ long dictEndTime = System.currentTimeMillis() - dictStartTime;
Map<String, String> dictMap = errorTypeList.stream().collect(Collectors.toMap(SysDictData::getDictValue, SysDictData::getDictLabel));
page.getRecords().stream().forEach(item -> {
if (StringUtils.hasText(item.getErrorType())) {
@@ -280,9 +289,16 @@
sb.append(s).append("銆�");
}
});
- item.setErrorType(sb.substring(0, sb.length() - 1));
+ if (sb.length() > 0) {
+ item.setErrorType(sb.substring(0, sb.length() - 1));
+ } else {
+ // 鏃犲尮閰嶆爣绛炬椂锛屽彲璁句负绌哄瓧绗︿覆鎴栦繚鐣欏師濮� errorType
+ item.setErrorType("");
+ // 鎴� item.setErrorType(item.getErrorType()); // 淇濈暀鍘熷缂栫爜
+ }
}
});
+ log.info("缁勮淇℃伅鑰楁椂锛歿}ms", dictEndTime);
return Result.ok().data(page).total(page.getTotal());
}
--
Gitblit v1.8.0