|
|
|
|
@@ -29,6 +29,7 @@ import com.njcn.gather.detection.pojo.vo.DetectionData;
|
|
|
|
|
import com.njcn.gather.detection.service.IAdPariService;
|
|
|
|
|
import com.njcn.gather.detection.service.impl.DetectionServiceImpl;
|
|
|
|
|
import com.njcn.gather.detection.util.socket.CnSocketUtil;
|
|
|
|
|
import com.njcn.gather.detection.util.socket.FormalTestManager;
|
|
|
|
|
import com.njcn.gather.device.pojo.enums.CommonEnum;
|
|
|
|
|
import com.njcn.gather.device.pojo.enums.PatternEnum;
|
|
|
|
|
import com.njcn.gather.device.pojo.po.PqDev;
|
|
|
|
|
@@ -1565,16 +1566,19 @@ public class ResultServiceImpl implements IResultService {
|
|
|
|
|
formContentVO.setErrorSysId(plan.getErrorSysId());
|
|
|
|
|
|
|
|
|
|
List<DictTree> dictTreeList = null;
|
|
|
|
|
if (DataSourceEnum.WAVE_DATA.getValue().equals(queryParam.getScriptType())) {
|
|
|
|
|
List<Map<String, String>> bigTestItem = adPlanService.getBigTestItem(1, queryParam.getPlanId(), Collections.singletonList(queryParam.getDeviceId()), queryParam.getPatternId(), DataSourceEnum.WAVE_DATA.getValue());
|
|
|
|
|
List<String> ids = bigTestItem.stream().filter(x -> !DetectionCodeEnum.FREQ.getCode().equals(x.get("code"))).map(x -> x.get("id")).collect(Collectors.toList());
|
|
|
|
|
dictTreeList = dictTreeService.getDictTreeById(ids);
|
|
|
|
|
} else {
|
|
|
|
|
dictTreeList = dictTreeService.getDictTreeById(Collections.singletonList(queryParam.getScriptType()));
|
|
|
|
|
List<String> adTypeList = null;
|
|
|
|
|
if (StrUtil.isNotBlank(queryParam.getScriptType())) {
|
|
|
|
|
if (DataSourceEnum.WAVE_DATA.getValue().equals(queryParam.getScriptType())) {
|
|
|
|
|
List<Map<String, String>> bigTestItem = adPlanService.getBigTestItem(1, queryParam.getPlanId(), Collections.singletonList(queryParam.getDeviceId()), queryParam.getPatternId(), DataSourceEnum.WAVE_DATA.getValue());
|
|
|
|
|
List<String> ids = bigTestItem.stream().filter(x -> !DetectionCodeEnum.FREQ.getCode().equals(x.get("code"))).map(x -> x.get("id")).collect(Collectors.toList());
|
|
|
|
|
dictTreeList = dictTreeService.getDictTreeById(ids);
|
|
|
|
|
} else {
|
|
|
|
|
dictTreeList = dictTreeService.getDictTreeById(Collections.singletonList(queryParam.getScriptType()));
|
|
|
|
|
}
|
|
|
|
|
List<String> fatherIdList = dictTreeList.stream().map(DictTree::getId).collect(Collectors.toList());
|
|
|
|
|
List<DictTree> childDictTreeList = dictTreeService.listByFatherIds(fatherIdList);
|
|
|
|
|
adTypeList = childDictTreeList.stream().map(DictTree::getId).collect(Collectors.toList());
|
|
|
|
|
}
|
|
|
|
|
List<String> fatherIdList = dictTreeList.stream().map(DictTree::getId).collect(Collectors.toList());
|
|
|
|
|
List<DictTree> childDictTreeList = dictTreeService.listByFatherIds(fatherIdList);
|
|
|
|
|
List<String> adTypeList = childDictTreeList.stream().map(DictTree::getId).collect(Collectors.toList());
|
|
|
|
|
List<ContrastBaseResult> allResultList = new ArrayList<>();
|
|
|
|
|
|
|
|
|
|
List<ContrastNonHarmonicResult> contrastNonHarmonicResults = contrastNonHarmonicService.listAllResultData(String.valueOf(plan.getCode()), null, null, false, queryParam.getDeviceId(), adTypeList);
|
|
|
|
|
@@ -1778,6 +1782,63 @@ public class ResultServiceImpl implements IResultService {
|
|
|
|
|
return pqMonitorService.updateById(monitor);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public List<ContrastTestItemVO> getCheckItem(String devId, String chnNum, Integer num) {
|
|
|
|
|
PqDev dev = pqDevService.getById(devId);
|
|
|
|
|
AdPlan plan = adPlanService.getById(dev.getPlanId());
|
|
|
|
|
String code = String.valueOf(plan.getCode());
|
|
|
|
|
|
|
|
|
|
String monitorId = devId + CnSocketUtil.SPLIT_TAG + chnNum;
|
|
|
|
|
|
|
|
|
|
List<ContrastNonHarmonicResult> realNoHarmonicResults = contrastNonHarmonicService.listAllResultData(code, num, null, false, monitorId, null);
|
|
|
|
|
List<ContrastHarmonicResult> realHarmonicResults = contrastHarmonicService.listAllResultData(code, num, null, false, monitorId, null);
|
|
|
|
|
|
|
|
|
|
Map<String, List<Integer>> checkItemResultMap = realNoHarmonicResults.stream().collect(Collectors.groupingBy(ContrastNonHarmonicResult::getAdType, Collectors.mapping(ContrastNonHarmonicResult::getResultFlag, Collectors.toList())));
|
|
|
|
|
checkItemResultMap.putAll(realHarmonicResults.stream().collect(Collectors.groupingBy(ContrastHarmonicResult::getAdType, Collectors.mapping(ContrastHarmonicResult::getResultFlag, Collectors.toList()))));
|
|
|
|
|
|
|
|
|
|
List<ContrastTestItemVO> result = new ArrayList<>();
|
|
|
|
|
checkItemResultMap.forEach((adType, resultList) -> {
|
|
|
|
|
ContrastTestItemVO contrastTestItemVO = new ContrastTestItemVO();
|
|
|
|
|
DictTree childDictTree = dictTreeService.getById(adType);
|
|
|
|
|
DictTree fatherDictTree = dictTreeService.getById(childDictTree.getPid());
|
|
|
|
|
contrastTestItemVO.setId(fatherDictTree.getId());
|
|
|
|
|
contrastTestItemVO.setCode(fatherDictTree.getCode());
|
|
|
|
|
contrastTestItemVO.setScriptName(fatherDictTree.getName());
|
|
|
|
|
contrastTestItemVO.setResultFlag(StorageUtil.getInteger(resultList));
|
|
|
|
|
result.add(contrastTestItemVO);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
checkItemResultMap.clear();
|
|
|
|
|
|
|
|
|
|
List<ContrastNonHarmonicResult> waveNoHarmonicResults = contrastNonHarmonicService.listAllResultData(code, num, null, true, monitorId, null);
|
|
|
|
|
List<ContrastHarmonicResult> waveHarmonicResults = contrastHarmonicService.listAllResultData(code, num, null, true, monitorId, null);
|
|
|
|
|
|
|
|
|
|
checkItemResultMap.putAll(waveNoHarmonicResults.stream().collect(Collectors.groupingBy(ContrastNonHarmonicResult::getAdType, Collectors.mapping(ContrastNonHarmonicResult::getResultFlag, Collectors.toList()))));
|
|
|
|
|
checkItemResultMap.putAll(waveHarmonicResults.stream().collect(Collectors.groupingBy(ContrastHarmonicResult::getAdType, Collectors.mapping(ContrastHarmonicResult::getResultFlag, Collectors.toList()))));
|
|
|
|
|
|
|
|
|
|
ContrastTestItemVO contrastTestItemVO = new ContrastTestItemVO();
|
|
|
|
|
contrastTestItemVO.setId(DataSourceEnum.WAVE_DATA.getValue());
|
|
|
|
|
contrastTestItemVO.setCode(DataSourceEnum.WAVE_DATA.getValue());
|
|
|
|
|
contrastTestItemVO.setScriptName(DataSourceEnum.WAVE_DATA.getMsg());
|
|
|
|
|
|
|
|
|
|
List<ContrastTestItemVO> setSubItems = new ArrayList<>();
|
|
|
|
|
checkItemResultMap.forEach((adType, resultList) -> {
|
|
|
|
|
ContrastTestItemVO subContrastTestItemVO = new ContrastTestItemVO();
|
|
|
|
|
DictTree childDictTree = dictTreeService.getById(adType);
|
|
|
|
|
DictTree fatherDictTree = dictTreeService.getById(childDictTree.getPid());
|
|
|
|
|
subContrastTestItemVO.setId(fatherDictTree.getId());
|
|
|
|
|
subContrastTestItemVO.setCode(fatherDictTree.getCode());
|
|
|
|
|
subContrastTestItemVO.setScriptName(fatherDictTree.getName());
|
|
|
|
|
subContrastTestItemVO.setResultFlag(StorageUtil.getInteger(resultList));
|
|
|
|
|
setSubItems.add(subContrastTestItemVO);
|
|
|
|
|
});
|
|
|
|
|
contrastTestItemVO.setResultFlag(StorageUtil.getInteger(checkItemResultMap.values().stream().flatMap(List::stream).distinct().collect(Collectors.toList())));
|
|
|
|
|
contrastTestItemVO.setSubItems(setSubItems);
|
|
|
|
|
result.add(contrastTestItemVO);
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private Map<String, List<RawResultDataVO>> getResultMap(DictTree dictTree, List<String> adTypeList, String monitorId, String unit, Integer num, Integer waveNum, Boolean isWave, String code) {
|
|
|
|
|
Map<String, List<RawResultDataVO>> resultMap = new LinkedHashMap<>();
|
|
|
|
|
|
|
|
|
|
@@ -2183,6 +2244,7 @@ public class ResultServiceImpl implements IResultService {
|
|
|
|
|
Map<Integer, List<AdPair>> numAdPairsMap = adPairList.stream().collect(Collectors.groupingBy(AdPair::getNum, Collectors.toList()));
|
|
|
|
|
numAdPairsMap.forEach((num, pairList) -> {
|
|
|
|
|
BiMap<String, String> parsIp = HashBiMap.create();
|
|
|
|
|
BiMap<String, String> parsId = HashBiMap.create();
|
|
|
|
|
Map<String, Integer> numMap = new HashMap<>();
|
|
|
|
|
Map<String, List<AdPair>> devMonitroIdMap = pairList.stream().collect(Collectors.groupingBy(AdPair::getDevMonitorId, Collectors.toList()));
|
|
|
|
|
devMonitroIdMap.forEach((devMonitorId, pairList1) -> {
|
|
|
|
|
@@ -2192,6 +2254,7 @@ public class ResultServiceImpl implements IResultService {
|
|
|
|
|
|
|
|
|
|
PqDev stdDev = pqDevService.getById(split2[1]);
|
|
|
|
|
parsIp.put(dev.getIp() + split1[1], stdDev.getIp() + split2[1]);
|
|
|
|
|
parsId.put(dev.getId() + split1[1], stdDev.getId() + split2[1]);
|
|
|
|
|
numMap.put(devMonitorId, num);
|
|
|
|
|
numMap.put(adPair.getStdDevMonitorId(), num);
|
|
|
|
|
});
|
|
|
|
|
@@ -2206,6 +2269,12 @@ public class ResultServiceImpl implements IResultService {
|
|
|
|
|
|
|
|
|
|
detectionServiceImpl.processing(devData, standardDevData, parsIp, devIdMapComm, testItemMap.keySet().stream().collect(Collectors.toList()), errorSysId, dataRule, numMap, code, null);
|
|
|
|
|
|
|
|
|
|
parsId.forEach((devMonitorId, stdDevMonitorId) -> {
|
|
|
|
|
pqMonitorService.updateMonitorResult(devMonitorId, null, DataSourceEnum.REAL_DATA, FormalTestManager.numMap.get(devMonitorId), null, oldCode);
|
|
|
|
|
pqDevService.updateResult(devMonitorId.split(CnSocketUtil.SPLIT_TAG)[0], null);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
boolean waveFlag = true;
|
|
|
|
|
AdPlanTestConfig adPlanTestConfig = adPlanTestConfigService.getByPlanId(planId);
|
|
|
|
|
for (int i = 1; i <= adPlanTestConfig.getWaveRecord(); i++) {
|
|
|
|
|
devNonHarmonicRawDataList = contrastNonHarmonicService.listAllRawData(oldCode, num, i, true, 0, deviceId, null);
|
|
|
|
|
@@ -2213,10 +2282,23 @@ public class ResultServiceImpl implements IResultService {
|
|
|
|
|
devHarmonicRawDataList = contrastHarmonicService.listAllRawData(oldCode, num, i, true, 0, deviceId, null);
|
|
|
|
|
stdDevHarmonicRawDataList = contrastHarmonicService.listAllRawData(oldCode, num, i, true, 1, deviceId, null);
|
|
|
|
|
|
|
|
|
|
devData = contrastToList(devNonHarmonicRawDataList, devHarmonicRawDataList, testItemMap);
|
|
|
|
|
standardDevData = contrastToList(stdDevNonHarmonicRawDataList, stdDevHarmonicRawDataList, testItemMap);
|
|
|
|
|
if (CollUtil.isNotEmpty(devNonHarmonicRawDataList) && CollUtil.isNotEmpty(stdDevNonHarmonicRawDataList) && CollUtil.isNotEmpty(devHarmonicRawDataList) && CollUtil.isNotEmpty(stdDevHarmonicRawDataList)) {
|
|
|
|
|
devData = contrastToList(devNonHarmonicRawDataList, devHarmonicRawDataList, testItemMap);
|
|
|
|
|
standardDevData = contrastToList(stdDevNonHarmonicRawDataList, stdDevHarmonicRawDataList, testItemMap);
|
|
|
|
|
detectionServiceImpl.processing(devData, standardDevData, parsIp, devIdMapComm, testItemMap.keySet().stream().collect(Collectors.toList()), errorSysId, dataRule, numMap, oldCode, i);
|
|
|
|
|
} else {
|
|
|
|
|
waveFlag = false;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
detectionServiceImpl.processing(devData, standardDevData, parsIp, devIdMapComm, testItemMap.keySet().stream().collect(Collectors.toList()), errorSysId, dataRule, numMap, code, i);
|
|
|
|
|
if (waveFlag) {
|
|
|
|
|
parsId.forEach((devMonitorId, stdDevMonitorId) -> {
|
|
|
|
|
String[] split = devMonitorId.split(CnSocketUtil.SPLIT_TAG);
|
|
|
|
|
String id = FormalTestManager.devIdMapComm.get(split[0]);
|
|
|
|
|
pqMonitorService.updateMonitorResult(devMonitorId, null, DataSourceEnum.WAVE_DATA, num, adPlanTestConfig.getWaveRecord(), oldCode);
|
|
|
|
|
pqDevService.updateResult(id, null);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|