diff --git a/detection/src/main/java/com/njcn/gather/detection/handler/SocketDevResponseService.java b/detection/src/main/java/com/njcn/gather/detection/handler/SocketDevResponseService.java index 0fbd3e2e..d93969f3 100644 --- a/detection/src/main/java/com/njcn/gather/detection/handler/SocketDevResponseService.java +++ b/detection/src/main/java/com/njcn/gather/detection/handler/SocketDevResponseService.java @@ -1967,9 +1967,6 @@ public class SocketDevResponseService { if (nonHarmonicList.contains(sourceIssue.getType())) { for (DevData.SqlDataDTO sqlDataDTO : data.getSqlData()) { - if (sqlDataDTO.getDesc().equals("PF")) { - continue; - } DevData.SqlDataDTO.ListDTO listDTO = sqlDataDTO.getList(); SimAndDigNonHarmonicResult adNonHarmonicResult = new SimAndDigNonHarmonicResult(); adNonHarmonicResult.setTimeId(localDateTime); diff --git a/detection/src/main/java/com/njcn/gather/detection/handler/SocketSourceResponseService.java b/detection/src/main/java/com/njcn/gather/detection/handler/SocketSourceResponseService.java index 14560d7b..a4bb3aa7 100644 --- a/detection/src/main/java/com/njcn/gather/detection/handler/SocketSourceResponseService.java +++ b/detection/src/main/java/com/njcn/gather/detection/handler/SocketSourceResponseService.java @@ -575,9 +575,6 @@ public class SocketSourceResponseService { DevPhaseSequenceParam phaseSequenceParam = new DevPhaseSequenceParam(); // 设置监测点ID列表 phaseSequenceParam.setMoniterIdList(monitorIdList); - if (socketDataMsg.getRequestId().equals(SourceOperateCodeEnum.FORMAL_REAL.getValue() + CnSocketUtil.STEP_TAG + "P")) { - comm.add("real$PF"); - } // 设置数据类型列表 phaseSequenceParam.setDataType(comm); // 设置读取次数 diff --git a/detection/src/main/java/com/njcn/gather/detection/pojo/enums/DetectionCodeEnum.java b/detection/src/main/java/com/njcn/gather/detection/pojo/enums/DetectionCodeEnum.java index 48a75e67..6ac1bc40 100644 --- a/detection/src/main/java/com/njcn/gather/detection/pojo/enums/DetectionCodeEnum.java +++ b/detection/src/main/java/com/njcn/gather/detection/pojo/enums/DetectionCodeEnum.java @@ -40,7 +40,7 @@ public enum DetectionCodeEnum { W("W", "有功功率"), VARW("VARW", "无功功率"), VAW("VAW", "视在功率"), -// PF("PF", "功率因数"), + PF("PF", "功率因数"), // P_FUND("P_FUND", "基波有功功率"), // P_HVAR("P_HVAR", "基波无功功率"), // P_HVA("P_HVA", "基波视在功率"), 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 2098f87c..e8911227 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 @@ -28,6 +28,7 @@ import com.njcn.gather.monitor.service.IPqMonitorService; import com.njcn.gather.plan.pojo.enums.DataSourceEnum; import com.njcn.gather.report.pojo.enums.PowerIndexEnum; import com.njcn.gather.result.pojo.enums.ResultUnitEnum; +import com.njcn.gather.script.mapper.PqScriptMapper; import com.njcn.gather.script.pojo.po.PqScriptCheckData; import com.njcn.gather.script.pojo.po.SourceIssue; import com.njcn.gather.script.service.IPqScriptCheckDataService; @@ -72,6 +73,7 @@ public class DetectionServiceImpl { private final IPqMonitorService pqMonitorService; private final IPqDevService pqDevService; private final IPqStandardDevGainRecordService pqStandardDevGainRecordService; + private final PqScriptMapper pqScriptMapper; public static final String TYPE_A = "A"; public static final String TYPE_B = "B"; @@ -414,14 +416,12 @@ public class DetectionServiceImpl { List info = new ArrayList<>(); List devValueTypeList = sourceIssue.getDevValueTypeList(); for (String s : devValueTypeList) { - if ((DetectionCodeEnum.REAL_PREFIX.getCode() + "PF").equals(s)) { - continue; - } + String[] splitArr = s.split("\\$"); // 根据数据处理规则取值。key为相别,value为值列表 - Map> map = devListMap(dev, dataRule, s.split("\\$")[1]); + Map> map = devListMap(dev, dataRule, splitArr[1]); List dtlsCheckData = null; if (CollUtil.isNotEmpty(errDtlsCheckData)) { - dtlsCheckData = errDtlsCheckData.stream().filter(x -> x.getValueTypeCode().equals(s.split("\\$")[1])).collect(Collectors.toList()); + dtlsCheckData = errDtlsCheckData.stream().filter(x -> x.getValueTypeCode().equals(splitArr[1])).collect(Collectors.toList()); } Double fData = 1.0; if (U.equals(type)) { @@ -434,9 +434,14 @@ public class DetectionServiceImpl { fData = sourceIssue.getFFreq(); } if (P.equals(type)) { - fData = sourceIssue.getFUn() * sourceIssue.getFIn() * 0.01; - Double finalFData = fData; - dtlsCheckData.stream().forEach(x -> x.setValue(x.getValue() * finalFData)); + if (!DetectionCodeEnum.PF.getCode().equals(splitArr[1])) { + Boolean valueType = pqScriptMapper.selectScriptIsValueType(sourceIssue.getScriptId()); + if (valueType) { + fData = sourceIssue.getFUn() * sourceIssue.getFIn() / 100; + } + Double finalFData = fData; + dtlsCheckData.stream().forEach(x -> x.setValue(x.getValue() * finalFData)); + } } SimAndDigNonHarmonicResult result = new SimAndDigNonHarmonicResult(); String[] split = dev.get(0).getId().split("_"); diff --git a/detection/src/main/java/com/njcn/gather/detection/util/socket/cilent/NettyDevClientHandler.java b/detection/src/main/java/com/njcn/gather/detection/util/socket/cilent/NettyDevClientHandler.java index be1958d6..8539204e 100644 --- a/detection/src/main/java/com/njcn/gather/detection/util/socket/cilent/NettyDevClientHandler.java +++ b/detection/src/main/java/com/njcn/gather/detection/util/socket/cilent/NettyDevClientHandler.java @@ -67,7 +67,7 @@ public class NettyDevClientHandler extends SimpleChannelInboundHandler { /** * 实时数据检测超时时间:1分钟(60秒) */ - private static final long REALTIME_TIMEOUT = 60L; + private static final long REALTIME_TIMEOUT = 60 * 3L; /** * 暂停操作超时时间:10分钟(600秒) diff --git a/detection/src/main/java/com/njcn/gather/script/service/impl/PqScriptDtlsServiceImpl.java b/detection/src/main/java/com/njcn/gather/script/service/impl/PqScriptDtlsServiceImpl.java index 7ce95046..e499998f 100644 --- a/detection/src/main/java/com/njcn/gather/script/service/impl/PqScriptDtlsServiceImpl.java +++ b/detection/src/main/java/com/njcn/gather/script/service/impl/PqScriptDtlsServiceImpl.java @@ -421,7 +421,11 @@ public class PqScriptDtlsServiceImpl extends ServiceImpl scriptDtlsCheckDataList(PqScriptDtlsParam sourceIssue) { -// Boolean valueType = pqScriptMapper.selectScriptIsValueType(sourceIssue.getScriptId()); + Boolean valueType = pqScriptMapper.selectScriptIsValueType(sourceIssue.getScriptId()); + double radio = 1; + if (valueType) { + radio = 100; + } List info = new ArrayList<>(); //获取所有下拉值情况 @@ -637,10 +641,12 @@ public class PqScriptDtlsServiceImpl extends ServiceImpl x.getChannelType().contains("U")).collect(Collectors.toList()); + if (CollUtil.isNotEmpty(channelU)) { + for (PqScriptDtlsParam.ChannelListDTO listDTO : channelU) { + //获取电流通道 + channelI = channelList.stream() +// .filter(PqScriptDtlsParam.ChannelListDTO::getHarmFlag) + .filter(x -> x.getChannelType().contains("I" + listDTO.getChannelType().substring(1, 2))) + .collect(Collectors.toList()); + if (CollUtil.isNotEmpty(channelI)) { + checkData = new PqScriptDtlsParam.CheckData(); + checkData.setErrorFlag(channelListDTO.getErrorFlag()); + checkData.setEnable(channelListDTO.getEnable()); + //cos(电压角度-电流角度) + double v = listDTO.getFPhase() - channelI.get(0).getFPhase(); + if (v == 90 || v == -90 || v == 270 || v == -270) { + checkData.setValue(0.0); + } else { + checkData.setValue(Math.cos(v * Math.PI / 180)); + } setCheck(info, checkData, channelListDTO, checkArchive, listDTO); } } diff --git a/storage/src/main/java/com/njcn/gather/storage/service/impl/SimAndDigNonHarmonicServiceImpl.java b/storage/src/main/java/com/njcn/gather/storage/service/impl/SimAndDigNonHarmonicServiceImpl.java index fb42521e..f65791ab 100644 --- a/storage/src/main/java/com/njcn/gather/storage/service/impl/SimAndDigNonHarmonicServiceImpl.java +++ b/storage/src/main/java/com/njcn/gather/storage/service/impl/SimAndDigNonHarmonicServiceImpl.java @@ -104,7 +104,6 @@ public class SimAndDigNonHarmonicServiceImpl extends ServiceImpl> info = new LinkedHashMap<>(2); Map adTypeMap = SimAndDigHarmonicResults.stream() - .sorted(Comparator.comparing(SimAndDigNonHarmonicResult::getResultFlag)) .collect(Collectors.toMap(SimAndDigNonHarmonicResult::getAdType, Function.identity(), (a, b) -> a, LinkedHashMap::new)); List dictTreeById = dictTreeService.getDictTreeById(new ArrayList<>(adTypeMap.keySet())); Map dictTreeByName = dictTreeById.stream().collect(Collectors.toMap(DictTree::getId, Function.identity())); diff --git a/storage/src/main/java/com/njcn/gather/util/StorageUtil.java b/storage/src/main/java/com/njcn/gather/util/StorageUtil.java index 9951c985..b7d1e37c 100644 --- a/storage/src/main/java/com/njcn/gather/util/StorageUtil.java +++ b/storage/src/main/java/com/njcn/gather/util/StorageUtil.java @@ -90,10 +90,14 @@ public class StorageUtil { */ case "P": case "W": - case "VARW": - case "VAW": unit = "W"; break; + case "VARW": + unit = "Var"; + break; + case "VAW": + unit = "VA"; + break; /** * 闪变 */