Browse Source

perf: 优化巡视报告列表页接口加载速度

master
yinhuaiwei 1 month ago
parent
commit
69b336ba68
2 changed files with 16 additions and 8 deletions
  1. +11
    -8
      inspect-main/inspect-main-task/src/main/java/com/inspect/insreport/controller/InspectionReportController.java
  2. +5
    -0
      inspect-main/inspect-main-task/src/main/resources/mapper/task/InspectionReportDataMapper.xml

+ 11
- 8
inspect-main/inspect-main-task/src/main/java/com/inspect/insreport/controller/InspectionReportController.java View File

@ -39,6 +39,7 @@ import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import java.util.zip.Adler32;
import java.util.zip.CheckedOutputStream;
import java.util.zip.ZipEntry;
@ -98,15 +99,17 @@ public class InspectionReportController extends BaseController {
Map<String, String> imgMap = getImgMap();
List<InspectionReport> inspectionReportList = inspectionReportService.selectByAllList(inspectionReport);
logger.info("[REPORT] inspectionReportList size: {}", inspectionReportList.size());
for (InspectionReport report : inspectionReportList) {
InspectionReportData inspectionReportData = new InspectionReportData();
inspectionReportData.setReportId(String.valueOf(report.getLineId()));
List<InspectionReportData> inspectionReportDataList =
inspectionReportDataService.selectInspectionReportDataList(inspectionReportData);
if (!inspectionReportDataList.isEmpty()) {
report.setInfo(inspectionReportDataList);
InspectionReportData reportParam = new InspectionReportData();
Map<String, Object> map = new HashMap<>();
String[] reportIds = inspectionReportList.stream().map((item) -> item.getLineId().toString()).toArray(String[]::new);
map.put("reportIds", reportIds);
reportParam.setParams(map);
List<InspectionReportData> inspectionReportDataList = inspectionReportDataService.selectInspectionReportDataList(reportParam);
for(InspectionReport report : inspectionReportList) {
List<InspectionReportData> infoList = inspectionReportDataList.stream().filter(item -> item.getReportId().equals(report.getLineId())).collect(Collectors.toList());
if(infoList != null && !infoList.isEmpty()) {
report.setInfo(infoList);
}
for (InspectionReportData reportData : inspectionReportDataList) {
if (imgMap != null && imgMap.get((reportData.getLineId()).trim()) != null) {
reportData.setInspectionImg(imgMap.get((reportData.getLineId()).trim()));


+ 5
- 0
inspect-main/inspect-main-task/src/main/resources/mapper/task/InspectionReportDataMapper.xml View File

@ -57,6 +57,11 @@
<if test="pointStatus != null and pointStatus != ''">and point_status = #{pointStatus}</if>
<if test="inspectionImg != null and inspectionImg != ''">and inspection_img = #{inspectionImg}</if>
<if test="reportId != null and reportId != ''">and report_id = #{reportId}</if>
<if test="params.reportIds != null and params.reportIds != ''">and report_id in
<foreach collection="params.reportIds" item="reportId" open="(" separator="," close=")">
#{reportId}
</foreach>
</if>
</where>
</select>
<select id="selectListByStatus" parameterType="InspectionReportData" resultMap="InspectionReportDataResult">


Loading…
Cancel
Save