From a006c0df3361edecfd0a26f2a8552a211408a33a Mon Sep 17 00:00:00 2001 From: wr <1754607820@qq.com> Date: Fri, 14 Feb 2025 10:58:09 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BE=AE=E8=B0=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/DetectionServiceImpl.java | 16 ++-- .../service/impl/ResultServiceImpl.java | 79 ++++++++++--------- 2 files changed, 48 insertions(+), 47 deletions(-) diff --git a/detection/src/main/java/com/njcn/gather/detection/service/impl/DetectionServiceImpl.java b/detection/src/main/java/com/njcn/gather/detection/service/impl/DetectionServiceImpl.java index 7bf5fd57..58d258e1 100644 --- a/detection/src/main/java/com/njcn/gather/detection/service/impl/DetectionServiceImpl.java +++ b/detection/src/main/java/com/njcn/gather/detection/service/impl/DetectionServiceImpl.java @@ -113,7 +113,7 @@ public class DetectionServiceImpl { */ case HV: AdHarmonicResult harmV = isHarmQualified(dev, devIdMapComm, errDtlsCheckData, U, sourceIssue, dataRule, 2); - if (ObjectUtil.isNull(harmV)) { + if (ObjectUtil.isNotNull(harmV)) { detectionDataDealService.acceptAdResult(Arrays.asList(harmV), code); return harmV.getResultFlag(); } @@ -123,7 +123,7 @@ public class DetectionServiceImpl { */ case HI: AdHarmonicResult harmI = isHarmQualified(dev, devIdMapComm, errDtlsCheckData, I, sourceIssue, dataRule, 2); - if (ObjectUtil.isNull(harmI)) { + if (ObjectUtil.isNotNull(harmI)) { detectionDataDealService.acceptAdResult(Arrays.asList(harmI), code); return harmI.getResultFlag(); } @@ -133,7 +133,7 @@ public class DetectionServiceImpl { */ case HSV: AdHarmonicResult harmInV = isHarmQualified(dev, devIdMapComm, errDtlsCheckData, U, sourceIssue, dataRule, 1); - if (ObjectUtil.isNull(harmInV)) { + if (ObjectUtil.isNotNull(harmInV)) { detectionDataDealService.acceptAdResult(Arrays.asList(harmInV), code); return harmInV.getResultFlag(); } @@ -143,7 +143,7 @@ public class DetectionServiceImpl { */ case HSI: AdHarmonicResult harmInI = isHarmQualified(dev, devIdMapComm, errDtlsCheckData, I, sourceIssue, dataRule, 1); - if (ObjectUtil.isNull(harmInI)) { + if (ObjectUtil.isNotNull(harmInI)) { detectionDataDealService.acceptAdResult(Arrays.asList(harmInI), code); return harmInI.getResultFlag(); } @@ -153,7 +153,7 @@ public class DetectionServiceImpl { */ case IMBV: AdNonHarmonicResult vUnban = isUnBalanceOrFlickerQualified(dev, devIdMapComm, errDtlsCheckData, U, sourceIssue, dataRule, "V_UNBAN"); - if (ObjectUtil.isNull(vUnban)) { + if (ObjectUtil.isNotNull(vUnban)) { detectionDataDealService.acceptAdNonResult(Arrays.asList(vUnban), code); return vUnban.getResultFlag(); } @@ -163,7 +163,7 @@ public class DetectionServiceImpl { */ case IMBA: AdNonHarmonicResult iUnban = isUnBalanceOrFlickerQualified(dev, devIdMapComm, errDtlsCheckData, I, sourceIssue, dataRule, "I_UNBAN"); - if (ObjectUtil.isNull(iUnban)) { + if (ObjectUtil.isNotNull(iUnban)) { detectionDataDealService.acceptAdNonResult(Arrays.asList(iUnban), code); return iUnban.getResultFlag(); } @@ -173,7 +173,7 @@ public class DetectionServiceImpl { */ case HP: AdHarmonicResult harmP = isHarmQualified(dev, devIdMapComm, errDtlsCheckData, P, sourceIssue, dataRule, 2); - if (ObjectUtil.isNull(harmP)) { + if (ObjectUtil.isNotNull(harmP)) { detectionDataDealService.acceptAdResult(Arrays.asList(harmP), code); return harmP.getResultFlag(); } @@ -183,7 +183,7 @@ public class DetectionServiceImpl { */ case F: AdNonHarmonicResult pst = isUnBalanceOrFlickerQualified(dev, devIdMapComm, errDtlsCheckData, null, sourceIssue, dataRule, "PST"); - if (ObjectUtil.isNull(pst)) { + if (ObjectUtil.isNotNull(pst)) { detectionDataDealService.acceptAdNonResult(Arrays.asList(pst), code); return pst.getResultFlag(); } 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 80afed75..15f0ec29 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 @@ -129,16 +129,18 @@ public class ResultServiceImpl implements IResultService { .ne(PqScriptDtls::getIndex, -1) .eq(PqScriptDtls::getEnable, DataStateEnum.ENABLE.getCode()) ); - List allResultList = new ArrayList<>(); - List indexList = new ArrayList<>(); - if (StrUtil.isNotBlank(param.getScriptType())) { - indexList = pqScriptDtlsService.getIndexList(param.getScriptType(), param.getScriptId()); - } - allResultList.addAll(adNonHarmonicService.get(param.getScriptId(), indexList, param.getDevId(), param.getDevNum(), param.getCode())); - allResultList.addAll(adHarmonicService.get(param.getScriptId(), indexList, param.getDevId(), param.getDevNum(), param.getCode())); Map> resultMap = new HashMap<>(5); - if (CollUtil.isNotEmpty(allResultList)) { - resultMap = allResultList.stream().collect(Collectors.groupingBy(AdBaseResult::getSort, Collectors.mapping(AdBaseResult::getResultFlag, Collectors.toSet()))); + if(StrUtil.isNotBlank(param.getDevId())){ + List allResultList = new ArrayList<>(); + List indexList = new ArrayList<>(); + if (StrUtil.isNotBlank(param.getScriptType())) { + indexList = pqScriptDtlsService.getIndexList(param.getScriptType(), param.getScriptId()); + } + allResultList.addAll(adNonHarmonicService.get(param.getScriptId(), indexList, param.getDevId(), param.getDevNum(), param.getCode())); + allResultList.addAll(adHarmonicService.get(param.getScriptId(), indexList, param.getDevId(), param.getDevNum(), param.getCode())); + if (CollUtil.isNotEmpty(allResultList)) { + resultMap = allResultList.stream().collect(Collectors.groupingBy(AdBaseResult::getSort, Collectors.mapping(AdBaseResult::getResultFlag, Collectors.toSet()))); + } } Map> dtlsSortMap = dtlsList.stream() @@ -179,15 +181,15 @@ public class ResultServiceImpl implements IResultService { .collect(Collectors.groupingBy(PqScriptDtls::getIndex, LinkedHashMap::new, Collectors.toList())); List subTypeList = new ArrayList<>(); indexMap.forEach((index, scriptDtlIndexList) -> { + TreeDataVO dtlType = new TreeDataVO(); + dtlType.setIndex(index); + dtlType.setScriptType(scriptDtlIndexList.get(0).getScriptType()); + ratedScriptTypeName(scriptDtlIndexList, isValueType, dtlType, dictTree); + dtlType.setSourceDesc(ScriptDtlsDesc.getStringBuffer(scriptDtlIndexList, isValueType).toString()); if (finalResultMap.containsKey(index)) { - TreeDataVO dtlType = new TreeDataVO(); - dtlType.setIndex(index); - dtlType.setScriptType(scriptDtlIndexList.get(0).getScriptType()); - ratedScriptTypeName(scriptDtlIndexList, isValueType, dtlType, dictTree); - dtlType.setSourceDesc(ScriptDtlsDesc.getStringBuffer(scriptDtlIndexList, isValueType).toString()); dtlType.setFly(conform(finalResultMap.get(index))); - subTypeList.add(dtlType); } + subTypeList.add(dtlType); }); if (CollUtil.isNotEmpty(subTypeList)) { subType.setChildren(subTypeList); @@ -221,23 +223,22 @@ public class ResultServiceImpl implements IResultService { .sorted(Comparator.comparing(PqScriptDtls::getIndex)) .collect(Collectors.groupingBy(PqScriptDtls::getIndex, LinkedHashMap::new, Collectors.toList())); indexMap.forEach((index, scriptDtlIndexList) -> { - if (finalResultMap.containsKey(index)) { - TreeDataVO dtlType = new TreeDataVO(); - dtlType.setIndex(index); - if ("Harm".equals(subKey)) { - harmScriptTypeName(scriptDtlIndexList, dictTree, isValueType, dtlType); - } - if ("VOL".equals(subKey)) { - volScriptTypeName(scriptDtlIndexList, dictTree, isValueType, dtlType); - } - if ("Freq".equals(subKey)) { - freqScriptTypeName(scriptDtlIndexList, dictTree, isValueType, dtlType); - } - dtlType.setSourceDesc(ScriptDtlsDesc.getStringBuffer(scriptDtlIndexList, isValueType).toString()); - dtlType.setFly(conform(finalResultMap.get(index))); - subTypeList.add(dtlType); + TreeDataVO dtlType = new TreeDataVO(); + dtlType.setIndex(index); + if ("Harm".equals(subKey)) { + harmScriptTypeName(scriptDtlIndexList, dictTree, isValueType, dtlType); } - + if ("VOL".equals(subKey)) { + volScriptTypeName(scriptDtlIndexList, dictTree, isValueType, dtlType); + } + if ("Freq".equals(subKey)) { + freqScriptTypeName(scriptDtlIndexList, dictTree, isValueType, dtlType); + } + dtlType.setSourceDesc(ScriptDtlsDesc.getStringBuffer(scriptDtlIndexList, isValueType).toString()); + if (finalResultMap.containsKey(index)) { + dtlType.setFly(conform(finalResultMap.get(index))); + } + subTypeList.add(dtlType); }); if (CollUtil.isNotEmpty(subTypeList)) { treeDataVO.setChildren(subTypeList); @@ -269,17 +270,17 @@ public class ResultServiceImpl implements IResultService { vo.setScriptTypeName(name); TreeDataVO dlt; for (PqScriptDtls dtls : dip) { + dlt = new TreeDataVO(); + List scriptDtlIndexList = subValue.stream().filter(x -> dtls.getIndex().equals(x.getIndex())).collect(Collectors.toList()); + //特征幅值=20%Un,持续时间=1周波 + dlt.setScriptTypeName("特征幅值=" + dtls.getTransValue() + "%Un,持续时间=" + dtls.getRetainTime().intValue() + "周波"); + dlt.setIndex(dtls.getIndex()); + dlt.setScriptType(scriptDtlIndexList.get(0).getScriptType()); + dlt.setSourceDesc(ScriptDtlsDesc.getStringBuffer(scriptDtlIndexList, isValueType).toString()); if (finalResultMap.containsKey(dtls.getIndex())) { - dlt = new TreeDataVO(); - List scriptDtlIndexList = subValue.stream().filter(x -> dtls.getIndex().equals(x.getIndex())).collect(Collectors.toList()); - //特征幅值=20%Un,持续时间=1周波 - dlt.setScriptTypeName("特征幅值=" + dtls.getTransValue() + "%Un,持续时间=" + dtls.getRetainTime().intValue() + "周波"); - dlt.setIndex(dtls.getIndex()); - dlt.setScriptType(scriptDtlIndexList.get(0).getScriptType()); - dlt.setSourceDesc(ScriptDtlsDesc.getStringBuffer(scriptDtlIndexList, isValueType).toString()); dlt.setFly(conform(finalResultMap.get(dtls.getIndex()))); - info.add(dlt); } + info.add(dlt); } if (CollUtil.isNotEmpty(info)) {