From 06b13fdfe1db5303d0c53875b7d16c3fb824f52a Mon Sep 17 00:00:00 2001 From: wr <1754607820@qq.com> Date: Thu, 27 Feb 2025 14:51:50 +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 | 27 +++++++++++-------- 1 file changed, 16 insertions(+), 11 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 b8bb6e60..a0d145fe 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 @@ -233,7 +233,7 @@ public class DetectionServiceImpl { List resultFlag = new ArrayList<>(); map.forEach((key, value) -> { List checkData = dtlsCheckData.stream().filter(x -> key.equals(x.getPhase())).collect(Collectors.toList()); - if(CollUtil.isNotEmpty(checkData)){ + if (CollUtil.isNotEmpty(checkData)) { DetectionData detectionData; if (DUR.equals(devIndex)) { detectionData = rangeDURComparisonList(value, new ArrayList<>(), sourceIssue.getFFreq(), checkData.get(0).getValue(), dataRule); @@ -278,11 +278,12 @@ public class DetectionServiceImpl { } } if (devIndex.contains("I")) { - fundCode = DetectionCodeEnum.I1.getCode();; + fundCode = DetectionCodeEnum.I1.getCode(); + ; type = I; fData = sourceIssue.getFIn(); if (devIndex.contains("50")) { - harmCode =DetectionCodeEnum.I2_50.getCode(); + harmCode = DetectionCodeEnum.I2_50.getCode(); } if (devIndex.contains("49")) { harmCode = DetectionCodeEnum.SI_1_49.getCode(); @@ -294,7 +295,7 @@ public class DetectionServiceImpl { fData = sourceIssue.getFIn() * sourceIssue.getFUn() * 0.01; } Map>> devHarmMap = devHarmListMap(dev, sourceIssue, dataRule, fundCode, harmCode, num); - if(CollUtil.isNotEmpty(devHarmMap)){ + if (CollUtil.isNotEmpty(devHarmMap)) { AdHarmonicResult harmonicResult = new AdHarmonicResult(); String[] split = dev.get(0).getId().split("_"); String devID = devIdMapComm.get(split[0]); @@ -307,8 +308,8 @@ public class DetectionServiceImpl { } //电压下百分比给百分比直接算 电流是是下百分比给的是幅值要转换算 List integerBooleanA = harmRangeComparison(new ArrayList<>(), type, TYPE_A, sourceIssue, dataRule, devHarmMap.get(TYPE_A), fData, num); - List integerBooleanB = harmRangeComparison(new ArrayList<>(), type, TYPE_B, sourceIssue, dataRule, devHarmMap.get(TYPE_B), fData, num); - List integerBooleanC = harmRangeComparison(new ArrayList<>(), type, TYPE_C, sourceIssue, dataRule, devHarmMap.get(TYPE_C), fData, num); + List integerBooleanB = harmRangeComparison(new ArrayList<>(), type, TYPE_B, sourceIssue, dataRule, devHarmMap.get(TYPE_B), fData, num); + List integerBooleanC = harmRangeComparison(new ArrayList<>(), type, TYPE_C, sourceIssue, dataRule, devHarmMap.get(TYPE_C), fData, num); harmonicResult.setDataType("avg"); reflectHarmonic("a", integerBooleanA, harmonicResult, num); reflectHarmonic("b", integerBooleanB, harmonicResult, num); @@ -454,11 +455,12 @@ public class DetectionServiceImpl { } if (I.equals(type)) { fData = sourceIssue.getFIn(); - fundCode = DetectionCodeEnum.I1.getCode();; + fundCode = DetectionCodeEnum.I1.getCode(); + ; if (num == 1) { harmCode = DetectionCodeEnum.SI_1_49.getCode(); } else { - harmCode =DetectionCodeEnum.I2_50.getCode(); + harmCode = DetectionCodeEnum.I2_50.getCode(); } } if (P.equals(type)) { @@ -466,7 +468,7 @@ public class DetectionServiceImpl { harmCode = DetectionCodeEnum.P2_50.getCode(); } Map>> devMap = devHarmListMap(dev, sourceIssue, dataRule, fundCode, harmCode, num); - if(CollUtil.isNotEmpty(devMap)){ + if (CollUtil.isNotEmpty(devMap)) { AdHarmonicResult harmonicResult = new AdHarmonicResult(); String[] split = dev.get(0).getId().split("_"); String devID = devIdMapComm.get(split[0]); @@ -520,7 +522,7 @@ public class DetectionServiceImpl { .eq(PqScriptCheckData::getScriptId, sourceIssue.getScriptId()) ); Map> map = devListMap(dev, dataRule, code); - if(CollUtil.isNotEmpty(map)){ + if (CollUtil.isNotEmpty(map)) { Double fData = 1.0; if (U.equals(type)) { fData = sourceIssue.getFUn(); @@ -878,7 +880,10 @@ public class DetectionServiceImpl { */ private void setDetection(DictDataEnum dataRule, List harmDataList, PqErrSysDtls errSysDtl, DetectionData data, Double v) { List qualifiedList = harmDataList.stream() - .filter(x -> x > 0 && NumberUtil.isIn(devSubtractChannelData(x, v, errSysDtl.getErrorValueType()), + .filter(x -> v == 0 ? NumberUtil.isIn(devSubtractChannelData(x, v, errSysDtl.getErrorValueType()), + BigDecimal.valueOf(-errSysDtl.getMaxErrorValue()), + BigDecimal.valueOf(errSysDtl.getMaxErrorValue())) : + x > 0 && NumberUtil.isIn(devSubtractChannelData(x, v, errSysDtl.getErrorValueType()), BigDecimal.valueOf(-errSysDtl.getMaxErrorValue()), BigDecimal.valueOf(errSysDtl.getMaxErrorValue()))).collect(Collectors.toList()); isData(dataRule, harmDataList, data, qualifiedList);