|
|
|
|
@@ -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;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -1806,9 +1807,9 @@ public class ResultServiceImpl implements IResultService {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public List<ContrastTestItemVO> getCheckItem(String devId, String chnNum, Integer num) {
|
|
|
|
|
PqDev dev = pqDevService.getById(devId);
|
|
|
|
|
AdPlan plan = adPlanService.getById(dev.getPlanId());
|
|
|
|
|
public List<ContrastTestItemVO> getCheckItem(String planId, String devId, String chnNum, Integer num) {
|
|
|
|
|
// PqDev dev = pqDevService.getById(devId);
|
|
|
|
|
AdPlan plan = adPlanService.getById(planId);
|
|
|
|
|
String code = String.valueOf(plan.getCode());
|
|
|
|
|
|
|
|
|
|
String monitorId = devId + CnSocketUtil.SPLIT_TAG + chnNum;
|
|
|
|
|
@@ -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;
|
|
|
|
|
@@ -2452,9 +2453,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);
|
|
|
|
|
@@ -2463,7 +2464,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);
|
|
|
|
|
@@ -2587,7 +2588,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);
|
|
|
|
|
@@ -2596,7 +2597,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);
|
|
|
|
|
@@ -2749,6 +2750,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);
|
|
|
|
|
@@ -2758,9 +2760,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) {
|
|
|
|
|
@@ -2771,7 +2775,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);
|
|
|
|
|
@@ -2810,11 +2814,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<>();
|
|
|
|
|
@@ -2865,7 +2872,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);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -2942,7 +2952,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" +
|
|
|
|
|
@@ -3141,7 +3151,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) -> {
|
|
|
|
|
|