检测计划相关功能代码

This commit is contained in:
caozehui
2025-07-22 09:11:21 +08:00
parent 95d5396759
commit a67c5de69d
9 changed files with 151 additions and 105 deletions

View File

@@ -10,7 +10,6 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.yulichang.wrapper.MPJLambdaWrapper;
import com.njcn.common.pojo.enums.common.DataStateEnum;
import com.njcn.gather.detection.pojo.enums.DetectionCodeEnum;
import com.njcn.gather.detection.pojo.enums.SourceOperateCodeEnum;
import com.njcn.gather.detection.pojo.param.PreDetectionParam;
import com.njcn.gather.device.pojo.enums.CommonEnum;
import com.njcn.gather.device.pojo.po.PqDev;
@@ -437,7 +436,8 @@ public class PqScriptDtlsServiceImpl extends ServiceImpl<PqScriptDtlsMapper, PqS
channelListDTO.setPid(dictTree.getPid());
DetectionCodeEnum codeEnum = DetectionCodeEnum.getDetectionCodeByCode(dictTree.getCode());
List<PqScriptDtlsParam.ChannelListDTO> channelList = sourceIssue.getChannelList();
List<PqScriptDtlsParam.ChannelListDTO> list;
List<PqScriptDtlsParam.ChannelListDTO> channelU;
List<PqScriptDtlsParam.ChannelListDTO> channelI;
List<PqScriptCheckData> checkArchive;
if (checkDataOldMap.containsKey(codeEnum.getCode())) {
checkArchive = checkDataOldMap.get(codeEnum.getCode());
@@ -462,20 +462,20 @@ public class PqScriptDtlsServiceImpl extends ServiceImpl<PqScriptDtlsMapper, PqS
case U1:
case VRMS:
if (CollUtil.isNotEmpty(channelList)) {
list = channelList.stream().filter(x -> x.getChannelType().contains("U")).collect(Collectors.toList());
rmsCheck(info, channelListDTO, list, checkArchive, false);
channelU = channelList.stream().filter(x -> x.getChannelType().contains("U")).collect(Collectors.toList());
rmsCheck(info, channelListDTO, channelU, checkArchive, false);
}
break;
case DELTA_V:
if (CollUtil.isNotEmpty(channelList)) {
list = channelList.stream().filter(x -> x.getChannelType().contains("U")).collect(Collectors.toList());
rmsCheck(info, channelListDTO, list, checkArchive, true);
channelU = channelList.stream().filter(x -> x.getChannelType().contains("U")).collect(Collectors.toList());
rmsCheck(info, channelListDTO, channelU, checkArchive, true);
}
break;
case VA:
if (CollUtil.isNotEmpty(channelList)) {
list = channelList.stream().filter(x -> x.getChannelType().contains("U")).collect(Collectors.toList());
for (PqScriptDtlsParam.ChannelListDTO listDTO : list) {
channelU = channelList.stream().filter(x -> x.getChannelType().contains("U")).collect(Collectors.toList());
for (PqScriptDtlsParam.ChannelListDTO listDTO : channelU) {
if (listDTO.getChannelFlag()) {
checkData = new PqScriptDtlsParam.CheckData();
checkData.setErrorFlag(channelListDTO.getErrorFlag());
@@ -491,23 +491,23 @@ public class PqScriptDtlsServiceImpl extends ServiceImpl<PqScriptDtlsMapper, PqS
break;
case V2_50:
if (CollUtil.isNotEmpty(channelList)) {
list = channelList.stream().filter(x -> x.getChannelType().contains("U")).collect(Collectors.toList());
harmCheck(info, channelListDTO, list, checkArchive);
channelU = channelList.stream().filter(x -> x.getChannelType().contains("U")).collect(Collectors.toList());
harmCheck(info, channelListDTO, channelU, checkArchive);
}
break;
case I2_50:
if (CollUtil.isNotEmpty(channelList)) {
list = channelList.stream().filter(x -> x.getChannelType().contains("I")).collect(Collectors.toList());
harmCheck(info, channelListDTO, list, checkArchive);
channelI = channelList.stream().filter(x -> x.getChannelType().contains("I")).collect(Collectors.toList());
harmCheck(info, channelListDTO, channelI, checkArchive);
}
break;
case P2_50:
List<PqScriptDtlsParam.ChannelListDTO> channelU = channelList.stream().filter(x -> x.getChannelType().contains("U")).collect(Collectors.toList());
channelU = channelList.stream().filter(x -> x.getChannelType().contains("U")).collect(Collectors.toList());
if (CollUtil.isNotEmpty(channelU)) {
for (PqScriptDtlsParam.ChannelListDTO listDTO : channelU) {
if (listDTO.getHarmFlag()) {
//获取电流通道
List<PqScriptDtlsParam.ChannelListDTO> channelI = channelList.stream()
channelI = channelList.stream()
.filter(PqScriptDtlsParam.ChannelListDTO::getHarmFlag)
.filter(x -> x.getChannelType().contains("I" + listDTO.getChannelType().substring(1, 2)))
.collect(Collectors.toList());
@@ -538,19 +538,19 @@ public class PqScriptDtlsServiceImpl extends ServiceImpl<PqScriptDtlsMapper, PqS
break;
case SV_1_49:
if (CollUtil.isNotEmpty(channelList)) {
list = channelList.stream().filter(x -> x.getChannelType().contains("U")).collect(Collectors.toList());
inHarmCheck(info, channelListDTO, list, checkArchive);
channelU = channelList.stream().filter(x -> x.getChannelType().contains("U")).collect(Collectors.toList());
inHarmCheck(info, channelListDTO, channelU, checkArchive);
}
break;
case SI_1_49:
if (CollUtil.isNotEmpty(channelList)) {
list = channelList.stream().filter(x -> x.getChannelType().contains("I")).collect(Collectors.toList());
inHarmCheck(info, channelListDTO, list, checkArchive);
channelI = channelList.stream().filter(x -> x.getChannelType().contains("I")).collect(Collectors.toList());
inHarmCheck(info, channelListDTO, channelI, checkArchive);
}
break;
case MAG:
list = channelList.stream().filter(x -> x.getChannelType().contains("U")).collect(Collectors.toList());
for (PqScriptDtlsParam.ChannelListDTO listDTO : list) {
channelU = channelList.stream().filter(x -> x.getChannelType().contains("U")).collect(Collectors.toList());
for (PqScriptDtlsParam.ChannelListDTO listDTO : channelU) {
if (listDTO.getDipFlag()) {
checkData = new PqScriptDtlsParam.CheckData();
checkData.setErrorFlag(channelListDTO.getErrorFlag());
@@ -561,8 +561,8 @@ public class PqScriptDtlsServiceImpl extends ServiceImpl<PqScriptDtlsMapper, PqS
}
break;
case DUR:
list = channelList.stream().filter(x -> x.getChannelType().contains("U")).collect(Collectors.toList());
for (PqScriptDtlsParam.ChannelListDTO listDTO : list) {
channelU = channelList.stream().filter(x -> x.getChannelType().contains("U")).collect(Collectors.toList());
for (PqScriptDtlsParam.ChannelListDTO listDTO : channelU) {
if (listDTO.getDipFlag()) {
checkData = new PqScriptDtlsParam.CheckData();
checkData.setErrorFlag(channelListDTO.getErrorFlag());
@@ -575,22 +575,22 @@ public class PqScriptDtlsServiceImpl extends ServiceImpl<PqScriptDtlsMapper, PqS
case IRMS:
case IA:
if (CollUtil.isNotEmpty(channelList)) {
list = channelList.stream().filter(x -> x.getChannelType().contains("I")).collect(Collectors.toList());
rmsCheck(info, channelListDTO, list, checkArchive, false);
channelI = channelList.stream().filter(x -> x.getChannelType().contains("I")).collect(Collectors.toList());
rmsCheck(info, channelListDTO, channelI, checkArchive, false);
}
break;
case V_UNBAN:
list = channelList.stream().filter(x -> x.getChannelType().contains("U")).collect(Collectors.toList());
unbanCheck(info, channelListDTO, list, checkArchive);
channelU = channelList.stream().filter(x -> x.getChannelType().contains("U")).collect(Collectors.toList());
unbanCheck(info, channelListDTO, channelU, checkArchive);
break;
case I_UNBAN:
list = channelList.stream().filter(x -> x.getChannelType().contains("I")).collect(Collectors.toList());
unbanCheck(info, channelListDTO, list, checkArchive);
channelI = channelList.stream().filter(x -> x.getChannelType().contains("I")).collect(Collectors.toList());
unbanCheck(info, channelListDTO, channelI, checkArchive);
break;
case PST:
if (CollUtil.isNotEmpty(channelList)) {
list = channelList.stream().filter(x -> x.getChannelType().contains("U")).collect(Collectors.toList());
for (PqScriptDtlsParam.ChannelListDTO listDTO : list) {
channelU = channelList.stream().filter(x -> x.getChannelType().contains("U")).collect(Collectors.toList());
for (PqScriptDtlsParam.ChannelListDTO listDTO : channelU) {
if (listDTO.getFlickerFlag()) {
checkData = new PqScriptDtlsParam.CheckData();
checkData.setErrorFlag(channelListDTO.getErrorFlag());
@@ -605,6 +605,26 @@ public class PqScriptDtlsServiceImpl extends ServiceImpl<PqScriptDtlsMapper, PqS
break;
case I1:
break;
case P_FUND:
channelU = channelList.stream().filter(x -> 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电压角度-电流角度)
checkData.setValue(channelI.get(0).getFAmp() * listDTO.getFAmp() * Math.cos(listDTO.getFPhase() - channelI.get(0).getFPhase()));
setCheck(info, checkData, channelListDTO, checkArchive, listDTO);
}
}
}
break;
case UNKNOWN_ERROR:
break;
default: