From 071c6e3d64b6500e1319b4cc101d098ccacd5180 Mon Sep 17 00:00:00 2001 From: caozehui <2427765068@qq.com> Date: Wed, 22 Oct 2025 09:19:31 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=90=E6=B3=A2=EF=BC=88=E9=97=B4=E8=B0=90?= =?UTF-8?q?=E6=B3=A2=EF=BC=89=E7=BB=93=E6=9E=9C=E5=B1=95=E7=A4=BA=E8=B0=83?= =?UTF-8?q?=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/ResultServiceImpl.java | 38 ++++++++++++------- 1 file changed, 24 insertions(+), 14 deletions(-) diff --git a/detection/src/main/java/com/njcn/gather/result/service/impl/ResultServiceImpl.java b/detection/src/main/java/com/njcn/gather/result/service/impl/ResultServiceImpl.java index 23dfa85c..42fa2735 100644 --- a/detection/src/main/java/com/njcn/gather/result/service/impl/ResultServiceImpl.java +++ b/detection/src/main/java/com/njcn/gather/result/service/impl/ResultServiceImpl.java @@ -22,6 +22,7 @@ import com.njcn.common.pojo.exception.BusinessException; import com.njcn.common.utils.PubUtils; import com.njcn.gather.detection.handler.SocketContrastResponseService; import com.njcn.gather.detection.pojo.enums.DetectionCodeEnum; +import com.njcn.gather.detection.pojo.enums.ResultEnum; import com.njcn.gather.detection.pojo.param.PreDetectionParam; import com.njcn.gather.detection.pojo.po.AdPair; import com.njcn.gather.detection.pojo.po.DevData; @@ -1604,7 +1605,7 @@ public class ResultServiceImpl implements IResultService { } contrastResultVO.setResultMap(this.getResultMap(dictTree, adTypeList, queryParam.getDeviceId() + CnSocketUtil.SPLIT_TAG + queryParam.getChnNum(), unit, queryParam.getNum(), queryParam.getWaveNum(), queryParam.getIsWave(), String.valueOf(plan.getCode()))); - contrastResultVO.setRawDataMap(this.getRawDataMap(dictTree, adTypeList, queryParam.getDeviceId() + CnSocketUtil.SPLIT_TAG + queryParam.getChnNum(), unit, queryParam.getNum(), queryParam.getWaveNum(), queryParam.getIsWave(), String.valueOf(plan.getCode()))); + contrastResultVO.setRawDataMap(this.getRawDataMap(dictTree, adTypeList, queryParam.getDeviceId() + CnSocketUtil.SPLIT_TAG + queryParam.getChnNum(), unit, queryParam.getNum(), queryParam.getWaveNum(), queryParam.getIsWave(), String.valueOf(plan.getCode()), contrastResultVO.getResultMap().keySet().stream().collect(Collectors.toList()))); return contrastResultVO; } @@ -1983,9 +1984,9 @@ public class ResultServiceImpl implements IResultService { if (isZeroFiltered) { zeroFilteredPoints++; // 统计双零点 // 双零情况,记录但不加入结果判定 - zeroFilteredPhases.add(phase.toUpperCase() + "相"); - // 将结果改为特殊标记,不参与整体结论判定 - singlePhaseData.put(ItemReportKeyEnum.RESULT.getKey(), "符合"); + zeroFilteredPhases.add(phase.toUpperCase() + "相"); + // 将结果改为特殊标记,不参与整体结论判定 + singlePhaseData.put(ItemReportKeyEnum.RESULT.getKey(), "符合"); } else { // 有非双零数据 hasNonZeroData = true; @@ -2442,9 +2443,9 @@ public class ResultServiceImpl implements IResultService { // 误差 - 根据参数决定是否格式化 String errorValue = String.valueOf(detectionData.getErrorData()); - if (decimalPlaces != null && detectionData.getErrorData() != null ) { + if (decimalPlaces != null && detectionData.getErrorData() != null) { errorValue = formatSignificantDigits(detectionData.getErrorData().doubleValue(), decimalPlaces); - }else{ + } else { errorValue = "/"; } dataMap.put(ItemReportKeyEnum.ERROR.getKey(), errorValue); @@ -2453,7 +2454,7 @@ public class ResultServiceImpl implements IResultService { String errorScope = String.valueOf(detectionData.getRadius()); if (decimalPlaces != null && detectionData.getRadius() != null) { errorScope = formatErrorRange(detectionData.getRadius(), decimalPlaces); - }else{ + } else { errorScope = "/"; } dataMap.put(ItemReportKeyEnum.A_ERROR_SCOPE.getKey(), errorScope); @@ -2577,7 +2578,7 @@ public class ResultServiceImpl implements IResultService { String errorValue = String.valueOf(detectionData.getErrorData()); if (decimalPlaces != null && detectionData.getErrorData() != null) { errorValue = formatSignificantDigits(detectionData.getErrorData().doubleValue(), decimalPlaces); - }else{ + } else { errorValue = "/"; } dataMap.put(ItemReportKeyEnum.ERROR.getKey(), errorValue); @@ -2586,7 +2587,7 @@ public class ResultServiceImpl implements IResultService { String errorScope = String.valueOf(detectionData.getRadius()); if (decimalPlaces != null && detectionData.getRadius() != null) { errorScope = formatErrorRange(detectionData.getRadius(), decimalPlaces); - }else{ + } else { errorScope = "/"; } dataMap.put(ItemReportKeyEnum.A_ERROR_SCOPE.getKey(), errorScope); @@ -2739,6 +2740,7 @@ public class ResultServiceImpl implements IResultService { List cList = JSON.parseArray(fieldC.get(contrastHarmonicResult) + "", RawResultDataVO.DetectionData.class); List rawResultDataVOList = new ArrayList<>(); + List isDataList = new ArrayList<>(); for (int j = 0; j < aList.size(); j++) { RawResultDataVO dataVO = new RawResultDataVO(); dataVO.setHarmNum(n); @@ -2748,9 +2750,11 @@ public class ResultServiceImpl implements IResultService { dataVO.setDataC(cList.get(j)); dataVO.setRadius(aList.get(j).getRadius()); dataVO.setIsData(StorageUtil.setResultFlag(Arrays.asList(aList.get(j), bList.get(j), cList.get(j)))); + isDataList.add(dataVO.getIsData()); rawResultDataVOList.add(dataVO); } - resultMap.put(String.valueOf(n), rawResultDataVOList); + Integer isData = StorageUtil.getInteger(isDataList); + resultMap.put(n + (isData == ResultEnum.NOT_QUALIFIED.getValue() ? "(不符合)" : (isData == ResultEnum.NO_ERROR_SYS.getValue() ? "(/)" : "")), rawResultDataVOList); } catch (NoSuchFieldException e) { throw new RuntimeException(e); } catch (IllegalAccessException e) { @@ -2761,7 +2765,7 @@ public class ResultServiceImpl implements IResultService { return resultMap; } - private Map> getRawDataMap(DictTree dictTree, List adTypeList, String monitorId, String unit, Integer num, Integer waveNum, Boolean isWave, String code) { + private Map> getRawDataMap(DictTree dictTree, List adTypeList, String monitorId, String unit, Integer num, Integer waveNum, Boolean isWave, String code, List keys) { Map> rawMap = new LinkedHashMap<>(); List devNonHarmonicRawDataList = contrastNonHarmonicService.listAllRawData(code, num, waveNum, isWave, 0, monitorId, adTypeList); @@ -2800,11 +2804,14 @@ public class ResultServiceImpl implements IResultService { if (CollUtil.isNotEmpty(devHarmonicRawDataList) && CollUtil.isNotEmpty(stdDevHarmonicRawDataList)) { List harmonicNum = null; + boolean isHarm = true; if (DicDataEnum.HV.getCode().equals(dictTree.getCode()) || DicDataEnum.HI.getCode().equals(dictTree.getCode()) || DicDataEnum.HP.getCode().equals(dictTree.getCode())) { harmonicNum = Stream.iterate(2.0, n -> n + 1).limit(49).collect(Collectors.toList()); + isHarm = true; } if (DicDataEnum.HSV.getCode().equals(dictTree.getCode()) || DicDataEnum.HSI.getCode().equals(dictTree.getCode())) { harmonicNum = Stream.iterate(0.5, n -> n + 1).limit(50).collect(Collectors.toList()); + isHarm = false; } for (Double n : harmonicNum) { List rawDataVOList1 = new ArrayList<>(); @@ -2855,7 +2862,10 @@ public class ResultServiceImpl implements IResultService { } rawDataVOList1.add(rawDataVO); } - rawMap.put(String.valueOf(n), rawDataVOList1); + int num1 = n.intValue(); + num1 = isHarm ? num1 - 2 : num1; + String key = keys.get(num1); + rawMap.put(key, rawDataVOList1); } } @@ -2932,7 +2942,7 @@ public class ResultServiceImpl implements IResultService { "A_Value_0 json NULL COMMENT 'A相基波有效值',\n" + "B_Value_0 json NULL COMMENT 'B相基波有效值',\n" + "C_Value_0 json NULL COMMENT 'B相基波有效值',\n" + - "Wave_Num tinyint(1) unsigned DEFAULT null COMMENT '录波数据第几组',\n"+ + "Wave_Num tinyint(1) unsigned DEFAULT null COMMENT '录波数据第几组',\n" + "PRIMARY KEY (Id)\n" : " Script_Id CHAR(32) NOT NULL COMMENT '检测脚本表Id',\n" + @@ -3131,7 +3141,7 @@ public class ResultServiceImpl implements IResultService { List devData = contrastToList(devNonHarmonicRawDataList, devHarmonicRawDataList, testItemMap, 0); List standardDevData = contrastToList(stdDevNonHarmonicRawDataList, stdDevHarmonicRawDataList, testItemMap, 1); - if(CollUtil.isNotEmpty(devData)&&CollUtil.isNotEmpty(standardDevData)){ + if (CollUtil.isNotEmpty(devData) && CollUtil.isNotEmpty(standardDevData)) { detectionServiceImpl.processing(devData, standardDevData, parsIp, devIdMapComm, testItemMap.keySet().stream().collect(Collectors.toList()), errorSysId, dataRule, numMap, code, null, finalNonWaveDataSourceEnum); parsId.forEach((devMonitorId, stdDevMonitorId) -> {