From 6ef908ff601b826588a766d4f3087e934ee637c4 Mon Sep 17 00:00:00 2001 From: caozehui <2427765068@qq.com> Date: Wed, 3 Sep 2025 20:32:14 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BE=AE=E8=B0=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/PqReportServiceImpl.java | 21 +++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/detection/src/main/java/com/njcn/gather/report/service/impl/PqReportServiceImpl.java b/detection/src/main/java/com/njcn/gather/report/service/impl/PqReportServiceImpl.java index 3ef6a2f6..68463f72 100644 --- a/detection/src/main/java/com/njcn/gather/report/service/impl/PqReportServiceImpl.java +++ b/detection/src/main/java/com/njcn/gather/report/service/impl/PqReportServiceImpl.java @@ -1474,10 +1474,10 @@ public class PqReportServiceImpl extends ServiceImpl i //String scriptId = adPlan.getScriptId(); Integer devChns = pqDevVO.getDevChns(); for (int i = 1; i <= devChns; i++) { - String path="/model/report_table.docx"; + String path = "/model/report_table.docx"; DevType devType = devTypeService.getById(pqDevVO.getDevType()); - if(devType.getName().equals("PQ-COM")){ - path="/model/report_table - PQ-COM.docx"; + if (devType.getName().equals("PQ-COM")) { + path = "/model/report_table - PQ-COM.docx"; } ClassPathResource resource = new ClassPathResource(path); XWPFDocument dataModelDocumentTemp = new XWPFDocument(resource.getInputStream()); @@ -1507,11 +1507,20 @@ public class PqReportServiceImpl extends ServiceImpl i List adHarmonicResultList = adHarmonicService.listAllResultData(devReportParam.getScriptId(), devReportParam.getPlanCode(), devReportParam.getDevId() + "_" + i); // 填充数据 + int finalI = i; indexKeysMap.forEach((index, keys) -> { String s1 = keys.stream().findFirst().get(); // 谐波类 if (DetectionCodeEnum.V2_50.getCode().equals(s1) || DetectionCodeEnum.I2_50.getCode().equals(s1) || DetectionCodeEnum.SV_1_49.getCode().equals(s1) || DetectionCodeEnum.SI_1_49.getCode().equals(s1)) { - fillMapValueHarm(adHarmonicResultList, dataModelMap, keys, index); + // 查找一下U1 + double u1 = 57.74; + List rawData = adHarmonicService.listAllRawData(devReportParam.getScriptId(), devReportParam.getPlanCode(), devReportParam.getDevId() + "_" + finalI); + AdHarmonicResult adHarmonicResult = rawData.stream().filter(obj -> obj.getAdType().equals(DetectionCodeEnum.V2_50.getCode())).sorted((obj1, obj2) -> obj2.getTimeId().compareTo(obj1.getTimeId())).findFirst().orElse(null); + if (ObjectUtil.isNotNull(adHarmonicResult)) { + String aValue1 = adHarmonicResult.getAValue1(); + u1 = Double.parseDouble(aValue1); + } + fillMapValueHarm(adHarmonicResultList, dataModelMap, keys, index, u1); } else { // 非谐波类 if (DetectionCodeEnum.V_UNBAN.getCode().equals(s1) || DetectionCodeEnum.FREQ.getCode().equals(s1)) { @@ -1579,14 +1588,14 @@ public class PqReportServiceImpl extends ServiceImpl i * @param keys * @param index */ - private void fillMapValueHarm(List allHarmonicResultList, Map dataModelMap, Set keys, String index) { + private void fillMapValueHarm(List allHarmonicResultList, Map dataModelMap, Set keys, String index, double baseValue) { keys.forEach(key -> { List resultList = allHarmonicResultList.stream().filter(obj -> obj.getAdType().equals(key) && obj.getSort().toString().equals(index)).collect(Collectors.toList()); if (CollectionUtil.isNotEmpty(resultList)) { AdHarmonicResult adHarmonicResult = resultList.get(0); if (Objects.nonNull(adHarmonicResult)) { if (DetectionCodeEnum.V2_50.getCode().equals(key) || DetectionCodeEnum.SV_1_49.getCode().equals(key)) { - fillHarm(dataModelMap, adHarmonicResult, index, key, 57.74, 100); + fillHarm(dataModelMap, adHarmonicResult, index, key, baseValue, 100); } if (DetectionCodeEnum.I2_50.getCode().equals(key) || DetectionCodeEnum.SI_1_49.getCode().equals(key)) { fillHarm(dataModelMap, adHarmonicResult, index, key, 1, 1);