4 Commits

Author SHA1 Message Date
caozehui
5d161acfad 导入测试后数据,查看数据报错BUG 2025-10-23 13:28:14 +08:00
caozehui
1534327f6f Merge remote-tracking branch 'origin/master' 2025-10-23 13:27:56 +08:00
caozehui
98cca582f6 Merge remote-tracking branch 'origin/master' 2025-10-22 15:49:14 +08:00
caozehui
071c6e3d64 谐波(间谐波)结果展示调整 2025-10-22 09:19:31 +08:00
6 changed files with 38 additions and 22 deletions

View File

@@ -67,7 +67,8 @@ public class PqStandardDevServiceImpl extends ServiceImpl<PqStandardDevMapper, P
wrapper.like(StrUtil.isNotBlank(queryParam.getName()), "name", queryParam.getName())
.eq(StrUtil.isNotBlank(queryParam.getManufacturer()), "manufacturer", queryParam.getManufacturer())
.eq(StrUtil.isNotBlank(queryParam.getDevType()), "dev_type", queryParam.getDevType())
.eq("state", DataStateEnum.ENABLE.getCode());
.eq("state", DataStateEnum.ENABLE.getCode())
.orderByDesc("create_time");
return this.page(new Page<>(PageFactory.getPageNum(queryParam), PageFactory.getPageSize(queryParam)), wrapper);
}

View File

@@ -198,7 +198,7 @@ public class ResultController extends BaseController {
String methodDescribe = getMethodDescribe("getCheckItem");
LogUtil.njcnDebug(log, "{},查询数据为:{}", methodDescribe, monitorQueryParam);
List<ContrastTestItemVO> result = resultService.getCheckItem(monitorQueryParam.getDevId(),monitorQueryParam.getChnNum(), monitorQueryParam.getNum());
List<ContrastTestItemVO> result = resultService.getCheckItem(monitorQueryParam.getPlanId(), monitorQueryParam.getDevId(), monitorQueryParam.getChnNum(), monitorQueryParam.getNum());
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
}
}

View File

@@ -15,4 +15,6 @@ public class MonitorQueryParam {
private Integer num;
private Integer waveNum;
private String planId;
}

View File

@@ -119,17 +119,19 @@ public interface IResultService {
/**
* 获取检测项
*
* @param planId
* @param devId
* @param chnNum
* @param num
* @return
*/
List<ContrastTestItemVO> getCheckItem(String devId, String chnNum, Integer num);
List<ContrastTestItemVO> getCheckItem(String planId, String devId, String chnNum, Integer num);
/**
* 获取设备比对式结果,用于出比对检测的报告
*
* @param devReportParam 设备报告参数
* @param pqDevVO 设备信息 省去一次sql查询
* @param pqDevVO 设备信息 省去一次sql查询
* @return 该设备的比对式结果
*/
Map<Integer, List<ContrastTestResult>> getContrastResultForReport(DevReportParam devReportParam, PqDevVO pqDevVO);

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;
}
@@ -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) -> {

View File

@@ -40,7 +40,8 @@ public class DevTypeServiceImpl extends ServiceImpl<DevTypeMapper, DevType> impl
@Override
public List<DevType> listAll() {
LambdaQueryWrapper<DevType> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(DevType::getState, DataStateEnum.ENABLE.getCode());
queryWrapper.eq(DevType::getState, DataStateEnum.ENABLE.getCode())
.orderByAsc(DevType::getName);
List<DevType> devTypes = this.baseMapper.selectList(queryWrapper);
return devTypes;
}