谐波(间谐波)结果展示调整

This commit is contained in:
caozehui
2025-10-22 09:19:31 +08:00
parent b0a4458c56
commit 071c6e3d64

View File

@@ -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<RawResultDataVO.DetectionData> cList = JSON.parseArray(fieldC.get(contrastHarmonicResult) + "", RawResultDataVO.DetectionData.class);
List<RawResultDataVO> rawResultDataVOList = new ArrayList<>();
List<Integer> 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<String, List<AlignDataVO.RawData>> getRawDataMap(DictTree dictTree, List<String> adTypeList, String monitorId, String unit, Integer num, Integer waveNum, Boolean isWave, String code) {
private Map<String, List<AlignDataVO.RawData>> getRawDataMap(DictTree dictTree, List<String> adTypeList, String monitorId, String unit, Integer num, Integer waveNum, Boolean isWave, String code, List<String> keys) {
Map<String, List<AlignDataVO.RawData>> rawMap = new LinkedHashMap<>();
List<ContrastNonHarmonicResult> 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<Double> 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<AlignDataVO.RawData> 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> devData = contrastToList(devNonHarmonicRawDataList, devHarmonicRawDataList, testItemMap, 0);
List<DevData> 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) -> {