修改检测计划态,录波校验调整
This commit is contained in:
@@ -9,6 +9,7 @@ import cn.hutool.core.util.NumberUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.serializer.SerializerFeature;
|
||||
import com.google.common.collect.HashBiMap;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.gather.detection.pojo.dto.WaveCommandDTO;
|
||||
@@ -66,8 +67,6 @@ import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
import java.util.concurrent.ScheduledFuture;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.stream.Collectors;
|
||||
@@ -94,18 +93,9 @@ public class SocketContrastResponseService {
|
||||
private final ICompareWaveService compareWaveService;
|
||||
private final IAdPlanTestConfigService adPlanTestConfigService;
|
||||
|
||||
/**
|
||||
* 定时器
|
||||
*/
|
||||
private ScheduledExecutorService scheduler = null;
|
||||
|
||||
/**
|
||||
* 定时器任务
|
||||
*/
|
||||
private ScheduledFuture<?> scheduledFuture = null;
|
||||
|
||||
/**
|
||||
* 实时数据对齐校验结果
|
||||
* 存放结果
|
||||
*/
|
||||
private boolean checkResult = false;
|
||||
|
||||
@@ -157,32 +147,6 @@ public class SocketContrastResponseService {
|
||||
Map<String, Integer> resultMap = new HashMap<>();
|
||||
for (String devMonitorId : devMonitorIds) {
|
||||
Integer maxNum = 1;
|
||||
// DynamicTableNameHandler.setTableName("ad_non_harmonic_" + code);
|
||||
// List<ContrastNonHarmonicResult> nonHarmonicResultList = contrastNonHarmonicService.lambdaQuery()
|
||||
// .select(ContrastNonHarmonicResult::getNum)
|
||||
// .eq(ContrastNonHarmonicResult::getMonitorId, devMonitorId)
|
||||
// .orderByDesc(ContrastNonHarmonicResult::getNum)
|
||||
// .last("LIMIT 1").list();
|
||||
// if (CollUtil.isNotEmpty(nonHarmonicResultList)) {
|
||||
// if (maxNum <= nonHarmonicResultList.get(0).getNum()) {
|
||||
// maxNum = nonHarmonicResultList.get(0).getNum() + 1;
|
||||
// }
|
||||
// }
|
||||
// DynamicTableNameHandler.remove();
|
||||
//
|
||||
// DynamicTableNameHandler.setTableName("ad_harmonic_" + code);
|
||||
// List<ContrastHarmonicResult> harmonicResultList = contrastHarmonicService.lambdaQuery()
|
||||
// .select(ContrastHarmonicResult::getNum)
|
||||
// .eq(ContrastHarmonicResult::getMonitorId, devMonitorId)
|
||||
// .orderByDesc(ContrastHarmonicResult::getNum)
|
||||
// .last("LIMIT 1").list();
|
||||
// if (CollUtil.isNotEmpty(harmonicResultList)) {
|
||||
// if (maxNum <= harmonicResultList.get(0).getNum()) {
|
||||
// maxNum = harmonicResultList.get(0).getNum() + 1;
|
||||
// }
|
||||
// }
|
||||
// DynamicTableNameHandler.remove();
|
||||
|
||||
List<AdPair> adPairList = adPairService.lambdaQuery().select(AdPair::getNum)
|
||||
.eq(AdPair::getDevMonitorId, devMonitorId)
|
||||
.orderByDesc(AdPair::getNum)
|
||||
@@ -218,6 +182,8 @@ public class SocketContrastResponseService {
|
||||
successPair.clear();
|
||||
FormalTestManager.isRemoveSocket = false;
|
||||
FormalTestManager.waveCheckFlag = false;
|
||||
FormalTestManager.scheduler = null;
|
||||
FormalTestManager.scheduledFuture = null;
|
||||
|
||||
HashBiMap<String, String> hashBiMap = HashBiMap.create(param.getPairs());
|
||||
FormalTestManager.pairsIdMap.clear();
|
||||
@@ -358,7 +324,6 @@ public class SocketContrastResponseService {
|
||||
break;
|
||||
// 启动录波
|
||||
case RECORD_WAVE_STEP1:
|
||||
case RECORD_WAVE_STEP2:
|
||||
this.recordWave(param, socketDataMsg);
|
||||
break;
|
||||
//退出关闭
|
||||
@@ -382,15 +347,15 @@ public class SocketContrastResponseService {
|
||||
if (ObjectUtil.isNotNull(dictDataEnumByCode)) {
|
||||
switch (dictDataEnumByCode) {
|
||||
case SUCCESS:
|
||||
if (SourceOperateCodeEnum.RECORD_WAVE_STEP2.getValue().equals(socketDataMsg.getRequestId())) {
|
||||
if (SourceOperateCodeEnum.RECORD_WAVE_STEP1.getValue().equals(socketDataMsg.getRequestId())) {
|
||||
WaveResultDTO waveResultDTO = JSON.parseObject(socketDataMsg.getData(), WaveResultDTO.class);
|
||||
FormalTestManager.waveResultDTOMap.put(waveResultDTO.getId(), waveResultDTO);
|
||||
successComm.add(waveResultDTO.getId());
|
||||
|
||||
if (successComm.size() == FormalTestManager.monitorMap.size()) {
|
||||
scheduledFuture.cancel(true);
|
||||
scheduler.shutdown();
|
||||
scheduler = null;
|
||||
FormalTestManager.scheduledFuture.cancel(true);
|
||||
FormalTestManager.scheduler.shutdown();
|
||||
FormalTestManager.scheduler = null;
|
||||
|
||||
SocketDataMsg webSend = new SocketDataMsg();
|
||||
webSend.setRequestId(SourceOperateCodeEnum.YJC_SBTXJY.getValue());
|
||||
@@ -401,7 +366,6 @@ public class SocketContrastResponseService {
|
||||
|
||||
successComm.clear();
|
||||
failComm.clear();
|
||||
CnSocketUtil.contrastSendquit(param.getUserPageId(), SourceOperateCodeEnum.QUIT_INIT_03, false);
|
||||
|
||||
//开始模型一致性校验
|
||||
System.out.println("装置通信成功!》》》》》》》》》》》》》》》》》》》》》》》》》》》》》开始模型一致性校验》》》》》》》》》》》》》》》》");
|
||||
@@ -476,14 +440,15 @@ public class SocketContrastResponseService {
|
||||
}
|
||||
break;
|
||||
case UNPROCESSED_BUSINESS:
|
||||
if (SourceOperateCodeEnum.RECORD_WAVE_STEP2.getValue().equals(socketDataMsg.getRequestId())) {
|
||||
if (SourceOperateCodeEnum.RECORD_WAVE_STEP1.getValue().equals(socketDataMsg.getRequestId())) {
|
||||
String data = socketDataMsg.getData();
|
||||
if (StrUtil.isNotBlank(data) && data.equals("waiting")) {
|
||||
if (Objects.isNull(scheduler)) {
|
||||
scheduler = Executors.newScheduledThreadPool(1);
|
||||
scheduledFuture = scheduler.schedule(() -> {
|
||||
if (Objects.isNull(FormalTestManager.scheduler)) {
|
||||
FormalTestManager.scheduler = Executors.newScheduledThreadPool(1);
|
||||
FormalTestManager.scheduledFuture = FormalTestManager.scheduler.schedule(() -> {
|
||||
if (!FormalTestManager.isRemoveSocket) {
|
||||
SocketDataMsg webSend = new SocketDataMsg();
|
||||
webSend.setRequestId(SourceOperateCodeEnum.RECORD_WAVE_STEP2.getValue());
|
||||
webSend.setRequestId(SourceOperateCodeEnum.RECORD_WAVE_STEP1.getValue());
|
||||
webSend.setOperateCode(SourceOperateCodeEnum.DEV_DATA_REQUEST_03.getValue());
|
||||
System.out.println("无效的录波指令!");
|
||||
|
||||
@@ -501,9 +466,9 @@ public class SocketContrastResponseService {
|
||||
webSend.setCode(SourceResponseCodeEnum.ALL_FAIL.getCode());//最终错误推送
|
||||
webSend.setData("无效的录波指令!");
|
||||
WebServiceManager.sendMsg(param.getUserPageId(), JSON.toJSONString(webSend));
|
||||
|
||||
scheduler.shutdown();
|
||||
scheduler = null;
|
||||
}
|
||||
FormalTestManager.scheduler.shutdown();
|
||||
FormalTestManager.scheduler = null;
|
||||
}, 20, TimeUnit.SECONDS);
|
||||
}
|
||||
}
|
||||
@@ -547,7 +512,6 @@ public class SocketContrastResponseService {
|
||||
DevData devData = JSON.parseObject(socketDataMsg.getData(), DevData.class);
|
||||
socketDataMsg.setRequestId(SourceOperateCodeEnum.YJC_MXYZXJY.getValue());
|
||||
|
||||
if (!SourceOperateCodeEnum.QUIT_INIT_03.getValue().equals(socketDataMsg.getOperateCode()) && !SourceOperateCodeEnum.RDRE$01.getValue().equals(socketDataMsg.getOperateCode())) {
|
||||
if (ObjectUtil.isNotNull(dictDataEnumByCode)) {
|
||||
switch (dictDataEnumByCode) {
|
||||
case SUCCESS:
|
||||
@@ -569,9 +533,9 @@ public class SocketContrastResponseService {
|
||||
|
||||
boolean modelCheckResult = this.modelCheck(param, FormalTestManager.devDataMap, FormalTestManager.monitorMap.get(monitorId1), true);
|
||||
modelCheckResult = this.modelCheck(param, FormalTestManager.standardDevDataMap, FormalTestManager.monitorMap.get(monitorId1), false) && modelCheckResult;
|
||||
if (!modelCheckResult) {
|
||||
this.clearData();
|
||||
|
||||
this.clearData();
|
||||
if (!modelCheckResult) {
|
||||
SocketDataMsg webSend = new SocketDataMsg();
|
||||
webSend.setRequestId(SourceOperateCodeEnum.YJC_MXYZXJY.getValue());
|
||||
webSend.setOperateCode(SourceOperateCodeEnum.DEV_DATA_REQUEST_02.getValue());
|
||||
@@ -582,15 +546,18 @@ public class SocketContrastResponseService {
|
||||
CnSocketUtil.contrastSendquit(param.getUserPageId(), SourceOperateCodeEnum.QUIT_INIT_02, false);
|
||||
return;
|
||||
} else {
|
||||
this.clearData();
|
||||
|
||||
SocketDataMsg webSend = new SocketDataMsg();
|
||||
webSend.setRequestId(SourceOperateCodeEnum.YJC_MXYZXJY.getValue());
|
||||
webSend.setOperateCode(SourceOperateCodeEnum.DEV_DATA_REQUEST_02.getValue());
|
||||
webSend.setCode(SourceResponseCodeEnum.ALL_SUCCESS.getCode());//最终成功推送
|
||||
WebServiceManager.sendMsg(param.getUserPageId(), JSON.toJSONString(webSend));
|
||||
|
||||
String[] dataSources = FormalTestManager.currentTestPlan.getDatasourceId().split(",");
|
||||
|
||||
|
||||
if (Arrays.stream(dataSources).anyMatch(DataSourceEnum.REAL_DATA.getValue()::equals)) {
|
||||
System.out.println("模型一致性校验成功!》》》》》》》》》》》》》》》》》》》》》》》》》》》》》开始实时数据对齐校验》》》》》》》》》》》》》》》》");
|
||||
|
||||
socketMsg.setRequestId(SourceOperateCodeEnum.FORMAL_REAL.getValue());
|
||||
socketMsg.setOperateCode(SourceOperateCodeEnum.DEV_DATA_REQUEST_02.getValue());
|
||||
DevPhaseSequenceParam phaseSequenceParam = new DevPhaseSequenceParam();
|
||||
@@ -598,10 +565,20 @@ public class SocketContrastResponseService {
|
||||
phaseSequenceParam.setDataType(Arrays.asList(DetectionCodeEnum.REAL_PREFIX.getCode() + DetectionCodeEnum.VRMS.getCode(), DetectionCodeEnum.REAL_PREFIX.getCode() + DetectionCodeEnum.PVRMS.getCode()));
|
||||
phaseSequenceParam.setReadCount(this.getMaxReadCount(5));
|
||||
phaseSequenceParam.setIgnoreCount(0);
|
||||
phaseSequenceParam.setDataType(Arrays.asList(DetectionCodeEnum.REAL_PREFIX.getCode() + DetectionCodeEnum.VRMS.getCode(), DetectionCodeEnum.REAL_PREFIX.getCode() + DetectionCodeEnum.PVRMS.getCode()));
|
||||
phaseSequenceParam.setReadCount(this.getMaxReadCount(5));
|
||||
phaseSequenceParam.setIgnoreCount(0);
|
||||
socketMsg.setData(JSON.toJSONString(phaseSequenceParam));
|
||||
SocketManager.sendMsg(s, JSON.toJSONString(socketMsg));
|
||||
|
||||
FormalTestManager.currentStep = SourceOperateCodeEnum.YJC_ALIGN;
|
||||
SocketManager.sendMsg(s, JSON.toJSONString(socketMsg));
|
||||
} else {
|
||||
System.out.println("(仅有录波)模型一致性校验成功!》》》》》》》》》》》》》》》》》》》》》》》》》》》开始相序校验》》》》》》》》》》》》》》》》》》》》》》》》》》》");
|
||||
|
||||
this.sendXu(s);
|
||||
FormalTestManager.currentStep = SourceOperateCodeEnum.YJC_XUJY;
|
||||
}
|
||||
|
||||
// 实时数据开始计时
|
||||
SocketManager.contrastClockMap.put(DataSourceEnum.REAL_DATA, 0L);
|
||||
}
|
||||
@@ -634,7 +611,6 @@ public class SocketContrastResponseService {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 实时数据对齐校验
|
||||
@@ -656,9 +632,9 @@ public class SocketContrastResponseService {
|
||||
String monitorId1 = devData.getId();
|
||||
//成功收到数据后重置超时统计时间
|
||||
SocketManager.contrastClockMap.put(DataSourceEnum.REAL_DATA, 0L);
|
||||
if (Objects.isNull(scheduler)) {
|
||||
scheduler = Executors.newScheduledThreadPool(1);
|
||||
scheduledFuture = scheduler.schedule(() -> {
|
||||
if (Objects.isNull(FormalTestManager.scheduler)) {
|
||||
FormalTestManager.scheduler = Executors.newScheduledThreadPool(1);
|
||||
FormalTestManager.scheduledFuture = FormalTestManager.scheduler.schedule(() -> {
|
||||
if (!checkResult) {
|
||||
System.out.println("1minute内实时数据对齐校验失败!");
|
||||
|
||||
@@ -686,8 +662,8 @@ public class SocketContrastResponseService {
|
||||
this.saveAlignData();
|
||||
|
||||
this.clearData();
|
||||
scheduler.shutdown();
|
||||
scheduler = null;
|
||||
FormalTestManager.scheduler.shutdown();
|
||||
FormalTestManager.scheduler = null;
|
||||
}
|
||||
}, 1, TimeUnit.MINUTES);
|
||||
}
|
||||
@@ -734,8 +710,8 @@ public class SocketContrastResponseService {
|
||||
// 若成功的配对项等于总的配对项,则判定为成功
|
||||
if (successPair.keySet().containsAll(FormalTestManager.pairsIpMap.keySet())) {
|
||||
checkResult = true;
|
||||
scheduledFuture.cancel(true);
|
||||
scheduler.shutdown();
|
||||
FormalTestManager.scheduledFuture.cancel(true);
|
||||
FormalTestManager.scheduler.shutdown();
|
||||
|
||||
// 将数据推送给前端
|
||||
this.sendAlignDataToWeb(param.getUserPageId());
|
||||
@@ -750,28 +726,8 @@ public class SocketContrastResponseService {
|
||||
WebServiceManager.sendMsg(param.getUserPageId(), JSON.toJSONString(webSend1));
|
||||
|
||||
System.out.println("实时数据对齐校验成功!》》》》》》》》》》》》》》》》》》》》》》》》》》》》》开始相序校验》》》》》》》》》》》》》》》》");
|
||||
|
||||
socketMsg.setRequestId(SourceOperateCodeEnum.FORMAL_REAL.getValue());
|
||||
socketMsg.setOperateCode(SourceOperateCodeEnum.DEV_DATA_REQUEST_02.getValue());
|
||||
DevPhaseSequenceParam phaseSequenceParam = new DevPhaseSequenceParam();
|
||||
phaseSequenceParam.setMoniterIdList(Arrays.asList(FormalTestManager.monitorMap.keySet().toArray(new String[FormalTestManager.monitorMap.size()])));
|
||||
phaseSequenceParam.setDataType(Arrays.asList(
|
||||
DetectionCodeEnum.REAL_PREFIX.getCode() + DetectionCodeEnum.VRMS.getCode(),
|
||||
DetectionCodeEnum.REAL_PREFIX.getCode() + DetectionCodeEnum.PVRMS.getCode(),
|
||||
DetectionCodeEnum.REAL_PREFIX.getCode() + DetectionCodeEnum.VA.getCode(),
|
||||
DetectionCodeEnum.REAL_PREFIX.getCode() + DetectionCodeEnum.IA.getCode(),
|
||||
DetectionCodeEnum.REAL_PREFIX.getCode() + DetectionCodeEnum.U1A.getCode(),
|
||||
DetectionCodeEnum.REAL_PREFIX.getCode() + DetectionCodeEnum.PU1A.getCode(),
|
||||
DetectionCodeEnum.REAL_PREFIX.getCode() + DetectionCodeEnum.I1A.getCode(),
|
||||
DetectionCodeEnum.REAL_PREFIX.getCode() + DetectionCodeEnum.IRMS.getCode(),
|
||||
DetectionCodeEnum.REAL_PREFIX.getCode() + DetectionCodeEnum.V_UNBAN.getCode(),
|
||||
DetectionCodeEnum.REAL_PREFIX.getCode() + DetectionCodeEnum.I_UNBAN.getCode()));
|
||||
phaseSequenceParam.setReadCount(this.getMaxReadCount(1));
|
||||
phaseSequenceParam.setIgnoreCount(0);
|
||||
socketMsg.setData(JSON.toJSONString(phaseSequenceParam));
|
||||
|
||||
this.sendXu(s);
|
||||
FormalTestManager.currentStep = SourceOperateCodeEnum.YJC_XUJY;
|
||||
SocketManager.sendMsg(s, JSON.toJSONString(socketMsg));
|
||||
// 实时数据开始计时
|
||||
SocketManager.contrastClockMap.put(DataSourceEnum.REAL_DATA, 0L);
|
||||
}
|
||||
@@ -844,17 +800,16 @@ public class SocketContrastResponseService {
|
||||
if (FormalTestManager.devDataMap.get(devMonitorId).size() >= 1 && FormalTestManager.standardDevDataMap.get(standardDevMonitorId).size() >= 1) {
|
||||
successComm.add(standardDevMonitorId);
|
||||
successComm.add(devMonitorId);
|
||||
// successComm.add(monitorId1);
|
||||
List<List<DevData>> singleMonitorAlignData = getSingleMonitorAlignData(FormalTestManager.devDataMap.get(devMonitorId), FormalTestManager.standardDevDataMap.get(standardDevMonitorId), 1);
|
||||
|
||||
if (CollUtil.isNotEmpty(singleMonitorAlignData.get(0)) && CollUtil.isNotEmpty(singleMonitorAlignData.get(1))) {
|
||||
PreDetection.MonitorListDTO monitorListDTO = FormalTestManager.monitorMap.get(devMonitorId);
|
||||
if (this.singleMonitorXuCheck(devMonitorId, standardDevMonitorId, monitorListDTO, singleMonitorAlignData.get(0), singleMonitorAlignData.get(1), FormalTestManager.devNameMapComm, param.getUserPageId())) {
|
||||
successPair.put(devMonitorId, standardDevMonitorId);
|
||||
// 若成功的配对项等于总的配对项,则判定为成功
|
||||
if (successPair.keySet().containsAll(FormalTestManager.pairsIpMap.keySet())) {
|
||||
|
||||
this.clearData();
|
||||
|
||||
SocketDataMsg webSend = new SocketDataMsg();
|
||||
WebSocketVO webSend = new WebSocketVO();
|
||||
webSend.setRequestId(SourceOperateCodeEnum.YJC_XUJY.getValue());
|
||||
webSend.setOperateCode(SourceOperateCodeEnum.DEV_DATA_REQUEST_02.getValue());
|
||||
webSend.setCode(SourceResponseCodeEnum.ALL_SUCCESS.getCode());//最终成功推送
|
||||
@@ -863,6 +818,9 @@ public class SocketContrastResponseService {
|
||||
// 后续做正式检测
|
||||
if (param.getTestItemList().get(2)) {
|
||||
System.out.println("相序校验成功!》》》》》》》》》》》》》》》》》》》》》》》》》》》》》开始正式检测》》》》》》》》》》》》》》》》");
|
||||
String datasourceId = FormalTestManager.currentTestPlan.getDatasourceId();
|
||||
|
||||
if (datasourceId.contains(DataSourceEnum.REAL_DATA.getValue())) {
|
||||
socketMsg.setRequestId(SourceOperateCodeEnum.FORMAL_REAL.getValue());
|
||||
socketMsg.setOperateCode(SourceOperateCodeEnum.DEV_DATA_REQUEST_02.getValue());
|
||||
DevPhaseSequenceParam phaseSequenceParam = new DevPhaseSequenceParam();
|
||||
@@ -877,9 +835,23 @@ public class SocketContrastResponseService {
|
||||
// 实时数据开始计时
|
||||
SocketManager.contrastClockMap.put(DataSourceEnum.REAL_DATA, 0L);
|
||||
checkResult = false;
|
||||
} else {
|
||||
// 断开与设备的连接,但是不要将Socket移除
|
||||
} else if (datasourceId.contains(DataSourceEnum.WAVE_DATA.getValue())) {
|
||||
CnSocketUtil.contrastSendquit(param.getUserPageId(), SourceOperateCodeEnum.QUIT_INIT_02, false);
|
||||
|
||||
// 录波数据
|
||||
successComm.clear();
|
||||
failComm.clear();
|
||||
FormalTestManager.currentStep = SourceOperateCodeEnum.RECORD_WAVE_STEP1;
|
||||
// 发送录波指令
|
||||
this.sendRecordWave(s);
|
||||
} else {
|
||||
// 统计数据
|
||||
CnSocketUtil.contrastSendquit(param.getUserPageId(), SourceOperateCodeEnum.QUIT_INIT_02, false);
|
||||
|
||||
}
|
||||
} else {
|
||||
CnSocketUtil.contrastSendquit(param.getUserPageId(), SourceOperateCodeEnum.QUIT_INIT_02, false);
|
||||
CnSocketUtil.contrastSendquit(param.getUserPageId(), SourceOperateCodeEnum.QUIT_INIT_03, false);
|
||||
}
|
||||
}
|
||||
} else if (successComm.size() == FormalTestManager.monitorMap.size()) {
|
||||
@@ -893,8 +865,21 @@ public class SocketContrastResponseService {
|
||||
WebServiceManager.sendMsg(param.getUserPageId(), JSON.toJSONString(webSend));
|
||||
|
||||
CnSocketUtil.contrastSendquit(param.getUserPageId(), SourceOperateCodeEnum.QUIT_INIT_02, false);
|
||||
CnSocketUtil.contrastSendquit(param.getUserPageId(), SourceOperateCodeEnum.QUIT_INIT_03, false);
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
Integer maxReadCount = getMaxReadCount(1);
|
||||
|
||||
WebSocketVO webSend = new WebSocketVO();
|
||||
webSend.setRequestId(SourceOperateCodeEnum.YJC_XUJY.getValue());
|
||||
webSend.setOperateCode(SourceOperateCodeEnum.DEV_DATA_REQUEST_02.getValue());
|
||||
if (FormalTestManager.devDataMap.get(devMonitorId).size() >= maxReadCount && FormalTestManager.standardDevDataMap.get(standardDevMonitorId).size() >= maxReadCount) {
|
||||
webSend.setCode(SourceResponseCodeEnum.ALL_FAIL.getCode());
|
||||
webSend.setData(MsgUtil.getPairStr(devMonitorId, standardDevMonitorId, FormalTestManager.devNameMapComm) + " 数据对齐失败!");
|
||||
WebServiceManager.sendMsg(param.getUserPageId(), JSON.toJSONString(webSend));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -929,7 +914,7 @@ public class SocketContrastResponseService {
|
||||
String s = param.getUserPageId() + CnSocketUtil.CONTRAST_DEV_TAG;
|
||||
DevData devData = JSON.parseObject(data, DevData.class);
|
||||
SourceResponseCodeEnum dictDataEnumByCode = SourceResponseCodeEnum.getDictDataEnumByCode(socketDataMsg.getCode());
|
||||
|
||||
if (SourceOperateCodeEnum.FORMAL_REAL.getValue().equals(socketDataMsg.getRequestId())) {
|
||||
switch (Objects.requireNonNull(dictDataEnumByCode)) {
|
||||
case SUCCESS:
|
||||
case NORMAL_RESPONSE:
|
||||
@@ -942,9 +927,9 @@ public class SocketContrastResponseService {
|
||||
Integer realTime = FormalTestManager.curretntTestPlanConfig.getRealTime();
|
||||
//成功收到数据后重置超时统计时间
|
||||
SocketManager.contrastClockMap.put(DataSourceEnum.REAL_DATA, 0L);
|
||||
if (Objects.isNull(scheduler)) {
|
||||
scheduler = Executors.newScheduledThreadPool(1);
|
||||
scheduledFuture = scheduler.schedule(() -> {
|
||||
if (Objects.isNull(FormalTestManager.scheduler)) {
|
||||
FormalTestManager.scheduler = Executors.newScheduledThreadPool(1);
|
||||
FormalTestManager.scheduledFuture = FormalTestManager.scheduler.schedule(() -> {
|
||||
if (!checkResult) {
|
||||
System.out.println("正式检测-" + (long) Math.ceil(realTime / 5) + "分钟内收集数据不完整!");
|
||||
|
||||
@@ -966,8 +951,8 @@ public class SocketContrastResponseService {
|
||||
|
||||
return;
|
||||
}
|
||||
scheduler.shutdown();
|
||||
scheduler = null;
|
||||
FormalTestManager.scheduler.shutdown();
|
||||
FormalTestManager.scheduler = null;
|
||||
}, (long) Math.ceil(realTime / 5), TimeUnit.MINUTES);
|
||||
}
|
||||
|
||||
@@ -1009,25 +994,13 @@ public class SocketContrastResponseService {
|
||||
// 断开与设备的连接,但是不要将Socket移除
|
||||
CnSocketUtil.contrastSendquit(param.getUserPageId(), SourceOperateCodeEnum.QUIT_INIT_02, false);
|
||||
checkResult = true;
|
||||
scheduledFuture.cancel(true);
|
||||
scheduler.shutdown();
|
||||
scheduler = null;
|
||||
FormalTestManager.scheduledFuture.cancel(true);
|
||||
FormalTestManager.scheduler.shutdown();
|
||||
FormalTestManager.scheduler = null;
|
||||
|
||||
String errorSysId = FormalTestManager.currentTestPlan.getErrorSysId();
|
||||
String code = String.valueOf(FormalTestManager.currentTestPlan.getCode());
|
||||
|
||||
// 配对关系入库
|
||||
List<AdPair> adPairList = new ArrayList<>();
|
||||
for (String key : FormalTestManager.pairsIdMap.keySet()) {
|
||||
AdPair adPair = new AdPair();
|
||||
adPair.setPlanId(FormalTestManager.currentTestPlan.getId());
|
||||
adPair.setDevMonitorId(key);
|
||||
adPair.setStdDevMonitorId(FormalTestManager.pairsIdMap.get(key));
|
||||
adPair.setNum(FormalTestManager.numMap.get(key));
|
||||
adPairList.add(adPair);
|
||||
}
|
||||
adPairService.saveBatch(adPairList);
|
||||
|
||||
// 原始数据入库
|
||||
List<DevData> devDataList = FormalTestManager.devDataMap.values().stream().flatMap(List::stream).collect(Collectors.toList());
|
||||
List<DevData> standardDevDataList = FormalTestManager.standardDevDataMap.values().stream().flatMap(List::stream).collect(Collectors.toList());
|
||||
@@ -1052,8 +1025,6 @@ public class SocketContrastResponseService {
|
||||
Map<String, Integer> result = detectionDataDealService.devResult(true, FormalTestManager.pairsIdMap.keySet().stream().collect(Collectors.toList()), adTypes, code);
|
||||
// 若有不符合的
|
||||
if (result.values().stream().anyMatch(r -> r.equals(ResultEnum.NOT_QUALIFIED.getValue()))) {
|
||||
// if (true) {
|
||||
|
||||
// 判断是否启用录波
|
||||
String datasourceId = FormalTestManager.currentTestPlan.getDatasourceId();
|
||||
// 最终将检测结果推送到前端
|
||||
@@ -1061,10 +1032,6 @@ public class SocketContrastResponseService {
|
||||
webSend.setCode(SourceResponseCodeEnum.REAL_DATA_CHECK_FAIL.getCode());// 实时数据检测失败,最终错误推送
|
||||
WebServiceManager.sendMsg(param.getUserPageId(), JSON.toJSONString(webSend));
|
||||
System.out.println("实时数据校验失败!》》》》》》》》》》》》》》》》》》》》》》》》》》》》》开始录波》》》》》》》》》》》》》》》》");
|
||||
SocketMsg<String> socketMsg = new SocketMsg<>();
|
||||
socketMsg.setRequestId(SourceOperateCodeEnum.YJC_XYJY.getValue());
|
||||
socketMsg.setOperateCode(SourceOperateCodeEnum.DEV_INIT_GATHER_03.getValue());
|
||||
Map<String, List<PreDetection>> map = new HashMap<>(1);
|
||||
|
||||
Set<String> delSet = new HashSet<>();
|
||||
for (int i = 0; i < FormalTestManager.devList.size(); i++) {
|
||||
@@ -1094,15 +1061,16 @@ public class SocketContrastResponseService {
|
||||
}
|
||||
}
|
||||
|
||||
List<PreDetection> preDetectionList = new ArrayList<>();
|
||||
preDetectionList.addAll(FormalTestManager.devList);
|
||||
preDetectionList.addAll(FormalTestManager.standardDevList);
|
||||
map.put("deviceList", preDetectionList);
|
||||
String jsonString = JSON.toJSONString(map);
|
||||
socketMsg.setData(jsonString);
|
||||
SocketManager.sendMsg(s, JSON.toJSONString(socketMsg));
|
||||
successComm.clear();
|
||||
failComm.clear();
|
||||
FormalTestManager.currentStep = SourceOperateCodeEnum.RECORD_WAVE_STEP1;
|
||||
// 发送录波指令
|
||||
this.sendRecordWave(s);
|
||||
} else {
|
||||
CnSocketUtil.contrastSendquit(param.getUserPageId(), SourceOperateCodeEnum.QUIT_INIT_03, false);
|
||||
// 配对关系入库
|
||||
this.pairDataInsert();
|
||||
|
||||
// 最终将检测结果推送到前端
|
||||
webSend.setCode(SourceResponseCodeEnum.ALL_SUCCESS.getCode());//最终成功推送
|
||||
WebServiceManager.sendMsg(param.getUserPageId(), JSON.toJSONString(webSend));
|
||||
@@ -1113,6 +1081,9 @@ public class SocketContrastResponseService {
|
||||
});
|
||||
}
|
||||
} else {
|
||||
// 配对关系入库
|
||||
this.pairDataInsert();
|
||||
|
||||
// 最终将检测结果推送到前端
|
||||
webSend.setCode(SourceResponseCodeEnum.ALL_SUCCESS.getCode());//最终成功推送
|
||||
WebServiceManager.sendMsg(param.getUserPageId(), JSON.toJSONString(webSend));
|
||||
@@ -1121,6 +1092,8 @@ public class SocketContrastResponseService {
|
||||
pqMonitorService.updateMonitorResult(id1, adTypes, DataSourceEnum.REAL_DATA, FormalTestManager.numMap.get(id1), null, code);
|
||||
pqDevService.updateResult(id1.split(CnSocketUtil.SPLIT_TAG)[0], param.getUserId());
|
||||
});
|
||||
|
||||
CnSocketUtil.contrastSendquit(param.getUserPageId(), SourceOperateCodeEnum.QUIT_INIT_03, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1145,6 +1118,7 @@ public class SocketContrastResponseService {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
@@ -1156,34 +1130,20 @@ public class SocketContrastResponseService {
|
||||
private void recordWave(PreDetectionParam param, SocketDataMsg socketDataMsg) {
|
||||
String s = param.getUserPageId() + CnSocketUtil.CONTRAST_DEV_TAG;
|
||||
SourceResponseCodeEnum dictDataEnumByCode = SourceResponseCodeEnum.getDictDataEnumByCode(socketDataMsg.getCode());
|
||||
if (SourceOperateCodeEnum.RECORD_WAVE_STEP1.getValue().equals(socketDataMsg.getRequestId())) {
|
||||
switch (Objects.requireNonNull(dictDataEnumByCode)) {
|
||||
case SUCCESS:
|
||||
if (FormalTestManager.currentStep == SourceOperateCodeEnum.RECORD_WAVE_STEP1 && socketDataMsg.getRequestId().equals(SourceOperateCodeEnum.YJC_XYJY.getValue())) {
|
||||
String monitorId = socketDataMsg.getData();
|
||||
successComm.add(monitorId);
|
||||
|
||||
System.out.println("暂态协议申请成功测点个数:" + successComm.size() + "=====" + FormalTestManager.monitorMap.size());
|
||||
if (successComm.size() == FormalTestManager.monitorMap.size()) {
|
||||
FormalTestManager.currentStep = SourceOperateCodeEnum.RECORD_WAVE_STEP2;
|
||||
// 发送录波指令
|
||||
this.sendRecordWave(s);
|
||||
|
||||
successComm.clear();
|
||||
failComm.clear();
|
||||
}
|
||||
} else if (FormalTestManager.currentStep == SourceOperateCodeEnum.RECORD_WAVE_STEP2) {
|
||||
WaveResultDTO waveResultDTO = JSON.parseObject(socketDataMsg.getData(), WaveResultDTO.class);
|
||||
FormalTestManager.waveResultDTOMap.put(waveResultDTO.getId(), waveResultDTO);
|
||||
successComm.add(waveResultDTO.getId());
|
||||
|
||||
if (successComm.size() == FormalTestManager.monitorMap.size()) {
|
||||
FormalTestManager.waveNum += 1;
|
||||
scheduledFuture.cancel(true);
|
||||
scheduler.shutdown();
|
||||
scheduler = null;
|
||||
FormalTestManager.scheduledFuture.cancel(true);
|
||||
FormalTestManager.scheduler.shutdown();
|
||||
FormalTestManager.scheduler = null;
|
||||
|
||||
SocketDataMsg webSend = new SocketDataMsg();
|
||||
webSend.setRequestId(SourceOperateCodeEnum.RECORD_WAVE_STEP2.getValue());
|
||||
webSend.setRequestId(SourceOperateCodeEnum.RECORD_WAVE_STEP1.getValue());
|
||||
webSend.setOperateCode(SourceOperateCodeEnum.DEV_DATA_REQUEST_03.getValue());
|
||||
webSend.setCode(SourceResponseCodeEnum.SUCCESS.getCode());
|
||||
webSend.setData("第" + FormalTestManager.waveNum + "次录波完成!");
|
||||
@@ -1201,6 +1161,7 @@ public class SocketContrastResponseService {
|
||||
List<List<DevData>> lists = this.analyzeWaveFile(waveResultDTO1, waveResultDTO2, monitorListDTO, devMonitorId, stdDevMonitorId, FormalTestManager.testItemMap.keySet().stream().collect(Collectors.toList()));
|
||||
|
||||
if (CollUtil.isNotEmpty(lists)) {
|
||||
// if (false) {
|
||||
FormalTestManager.devDataMap.put(devMonitorId, lists.get(0));
|
||||
FormalTestManager.standardDevDataMap.put(stdDevMonitorId, lists.get(1));
|
||||
} else {
|
||||
@@ -1213,6 +1174,7 @@ public class SocketContrastResponseService {
|
||||
});
|
||||
|
||||
if (!flag.get()) {
|
||||
// if (false) {
|
||||
List<DevData> devDataList = FormalTestManager.devDataMap.values().stream().flatMap(List::stream).collect(Collectors.toList());
|
||||
List<DevData> standardDevDataList = FormalTestManager.standardDevDataMap.values().stream().flatMap(List::stream).collect(Collectors.toList());
|
||||
|
||||
@@ -1262,14 +1224,6 @@ public class SocketContrastResponseService {
|
||||
FormalTestManager.preNumTestResultList.add(devLineTestResult);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
webSend.setCode(SourceResponseCodeEnum.ALL_FAIL.getCode());
|
||||
webSend.setData("录波对齐失败!");
|
||||
WebServiceManager.sendMsg(param.getUserPageId(), JSON.toJSONString(webSend));
|
||||
|
||||
// 断开与设备的连接,但是不要将Socket移除
|
||||
CnSocketUtil.contrastSendquit(param.getUserPageId(), SourceOperateCodeEnum.QUIT_INIT_03, false);
|
||||
}
|
||||
|
||||
if (FormalTestManager.waveNum < FormalTestManager.curretntTestPlanConfig.getWaveRecord()) {
|
||||
// 继续录波
|
||||
@@ -1277,23 +1231,26 @@ public class SocketContrastResponseService {
|
||||
failComm.clear();
|
||||
FormalTestManager.waveResultDTOMap.clear();
|
||||
|
||||
if (Objects.isNull(scheduler)) {
|
||||
scheduler = Executors.newScheduledThreadPool(1);
|
||||
scheduledFuture = scheduler.schedule(() -> {
|
||||
if (Objects.isNull(FormalTestManager.scheduler)) {
|
||||
FormalTestManager.scheduler = Executors.newScheduledThreadPool(1);
|
||||
FormalTestManager.scheduledFuture = FormalTestManager.scheduler.schedule(() -> {
|
||||
|
||||
if (!FormalTestManager.isRemoveSocket) {
|
||||
System.out.println("第" + (FormalTestManager.waveNum + 1) + "次录波开始");
|
||||
this.sendRecordWave(s);
|
||||
}
|
||||
|
||||
scheduler.shutdown();
|
||||
scheduler = null;
|
||||
FormalTestManager.scheduler.shutdown();
|
||||
FormalTestManager.scheduler = null;
|
||||
}, 40, TimeUnit.SECONDS);
|
||||
}
|
||||
} else {
|
||||
// 断开与设备的连接,但是不要将Socket移除
|
||||
CnSocketUtil.contrastSendquit(param.getUserPageId(), SourceOperateCodeEnum.QUIT_INIT_03, false);
|
||||
|
||||
// 配对关系入库
|
||||
this.pairDataInsert();
|
||||
|
||||
List<String> adTypes = FormalTestManager.testItemMap.values().stream().collect(Collectors.toList());
|
||||
// 修改检测点状态、设备状态
|
||||
FormalTestManager.pairsIpMap.forEach((ip1, ip2) -> {
|
||||
@@ -1309,19 +1266,29 @@ public class SocketContrastResponseService {
|
||||
webSend.setData(JSON.toJSONString(FormalTestManager.preNumTestResultList));
|
||||
WebServiceManager.sendMsg(param.getUserPageId(), JSON.toJSONString(webSend));
|
||||
}
|
||||
} else {
|
||||
webSend.setCode(SourceResponseCodeEnum.ALL_FAIL.getCode());
|
||||
webSend.setData("录波对齐失败!");
|
||||
WebServiceManager.sendMsg(param.getUserPageId(), JSON.toJSONString(webSend));
|
||||
|
||||
// 断开与设备的连接,但是不要将Socket移除
|
||||
CnSocketUtil.contrastSendquit(param.getUserPageId(), SourceOperateCodeEnum.QUIT_INIT_03, false);
|
||||
}
|
||||
|
||||
successComm.clear();
|
||||
failComm.clear();
|
||||
}
|
||||
}
|
||||
|
||||
case UNPROCESSED_BUSINESS:
|
||||
if (FormalTestManager.currentStep == SourceOperateCodeEnum.RECORD_WAVE_STEP2) {
|
||||
if (FormalTestManager.currentStep == SourceOperateCodeEnum.RECORD_WAVE_STEP1) {
|
||||
String data = socketDataMsg.getData();
|
||||
if (StrUtil.isNotBlank(data) && data.equals("waiting")) {
|
||||
if (Objects.isNull(scheduler)) {
|
||||
scheduler = Executors.newScheduledThreadPool(1);
|
||||
scheduledFuture = scheduler.schedule(() -> {
|
||||
if (Objects.isNull(FormalTestManager.scheduler)) {
|
||||
FormalTestManager.scheduler = Executors.newScheduledThreadPool(1);
|
||||
FormalTestManager.scheduledFuture = FormalTestManager.scheduler.schedule(() -> {
|
||||
if (!FormalTestManager.isRemoveSocket) {
|
||||
SocketDataMsg webSend = new SocketDataMsg();
|
||||
webSend.setRequestId(SourceOperateCodeEnum.RECORD_WAVE_STEP2.getValue());
|
||||
webSend.setRequestId(SourceOperateCodeEnum.RECORD_WAVE_STEP1.getValue());
|
||||
webSend.setOperateCode(SourceOperateCodeEnum.DEV_DATA_REQUEST_03.getValue());
|
||||
System.out.println("无效的录波指令!");
|
||||
|
||||
@@ -1338,9 +1305,10 @@ public class SocketContrastResponseService {
|
||||
webSend.setCode(SourceResponseCodeEnum.ALL_FAIL.getCode());//最终错误推送
|
||||
webSend.setData("无效的录波指令!");
|
||||
WebServiceManager.sendMsg(param.getUserPageId(), JSON.toJSONString(webSend));
|
||||
}
|
||||
|
||||
scheduler.shutdown();
|
||||
scheduler = null;
|
||||
FormalTestManager.scheduler.shutdown();
|
||||
FormalTestManager.scheduler = null;
|
||||
}, 20, TimeUnit.SECONDS);
|
||||
}
|
||||
}
|
||||
@@ -1352,6 +1320,7 @@ public class SocketContrastResponseService {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
@@ -1550,7 +1519,7 @@ public class SocketContrastResponseService {
|
||||
data.add(alignDataVO);
|
||||
});
|
||||
|
||||
webSend.setData(JSON.toJSONString(data));
|
||||
webSend.setData(JSON.toJSONString(data, SerializerFeature.WriteMapNullValue));
|
||||
WebServiceManager.sendMsg(userPageId, JSON.toJSONString(webSend));
|
||||
}
|
||||
|
||||
@@ -1803,10 +1772,8 @@ public class SocketContrastResponseService {
|
||||
* @return
|
||||
*/
|
||||
private boolean singleMonitorXuCheck(String devMonitorId, String standardDevMonitorId, PreDetection.MonitorListDTO monitorListDTO, List<DevData> devData, List<DevData> stdData, Map<String, String> devNameMapComm, String userId) {
|
||||
DecimalFormat df = new DecimalFormat("0.000000");
|
||||
Boolean flag = true;
|
||||
if (devData.size() < 1 || stdData.size() < 1) {
|
||||
return false;
|
||||
} else {
|
||||
String pairStr = MsgUtil.getPairStr(devMonitorId, standardDevMonitorId, devNameMapComm);
|
||||
SocketDataMsg webSend = new SocketDataMsg();
|
||||
webSend.setRequestId(SourceOperateCodeEnum.YJC_XUJY.getValue());
|
||||
@@ -1832,12 +1799,12 @@ public class SocketContrastResponseService {
|
||||
if (CollUtil.isNotEmpty(uDev) && CollUtil.isNotEmpty(uStd)) {
|
||||
DevData.SqlDataDTO.ListDTO uDevList = uDev.get(0).getList();
|
||||
DevData.SqlDataDTO.ListDTO uStdList = uStd.get(0).getList();
|
||||
detail = "被检设备:" + (isDelta ? "Uab" : "Ua") + "=" + uDevList.getA() +
|
||||
", " + (isDelta ? "Ubc" : "Ub") + "=" + uDevList.getB() +
|
||||
", " + (isDelta ? "Uca" : "Uc") + "=" + uDevList.getC() +
|
||||
";标准设备:" + (isDelta ? "Uab" : "Ua") + "=" + uStdList.getA() +
|
||||
", " + (isDelta ? "Ubc" : "Ub") + "=" + uStdList.getB() +
|
||||
", " + (isDelta ? "Uca" : "Uc") + "=" + uStdList.getC();
|
||||
detail = "被检设备:" + (isDelta ? "Uab" : "Ua") + "=" + df.format(uDevList.getA()) +
|
||||
", " + (isDelta ? "Ubc" : "Ub") + "=" + df.format(uDevList.getB()) +
|
||||
", " + (isDelta ? "Uca" : "Uc") + "=" + df.format(uDevList.getC()) +
|
||||
";标准设备:" + (isDelta ? "Uab" : "Ua") + "=" + df.format(uStdList.getA()) +
|
||||
", " + (isDelta ? "Ubc" : "Ub") + "=" + df.format(uStdList.getB()) +
|
||||
", " + (isDelta ? "Uca" : "Uc") + "=" + df.format(uStdList.getC());
|
||||
if (!voltageOrCurrentCheck(uDevList.getA(), uDevList.getB(), uDevList.getC(), uStdList.getA(), uStdList.getB(), uStdList.getC(), true)) {
|
||||
flag = false;
|
||||
// 单个检测点电压校验失败,推送失败消息
|
||||
@@ -1862,7 +1829,7 @@ public class SocketContrastResponseService {
|
||||
if (CollUtil.isNotEmpty(iDev) && CollUtil.isNotEmpty(iStd)) {
|
||||
DevData.SqlDataDTO.ListDTO iDevList = iDev.get(0).getList();
|
||||
DevData.SqlDataDTO.ListDTO iStdList = iStd.get(0).getList();
|
||||
detail = "被检设备:Ia=" + iDevList.getA() + ",Ib=" + iDevList.getB() + ",Ic=" + iDevList.getC() + ";标准设备:Ia=" + iStdList.getA() + ",Ib=" + iStdList.getB() + ",Ic=" + iStdList.getC();
|
||||
detail = "被检设备:Ia=" + df.format(iDevList.getA()) + ",Ib=" + df.format(iDevList.getB()) + ",Ic=" + df.format(iDevList.getC()) + ";标准设备:Ia=" + df.format(iStdList.getA()) + ",Ib=" + df.format(iStdList.getB()) + ",Ic=" + df.format(iStdList.getC());
|
||||
if (!voltageOrCurrentCheck(iDevList.getA(), iDevList.getB(), iDevList.getC(), iStdList.getA(), iStdList.getB(), iStdList.getC(), false)) {
|
||||
// 单个检测点电流校验失败,推送失败消息
|
||||
flag = false;
|
||||
@@ -1886,8 +1853,6 @@ public class SocketContrastResponseService {
|
||||
List<DevData.SqlDataDTO> uUnblanceDev = getSingleMonitorSqlData(devData, DetectionCodeEnum.V_UNBAN.getCode());
|
||||
List<DevData.SqlDataDTO> uUnblanceStd = getSingleMonitorSqlData(stdData, DetectionCodeEnum.V_UNBAN.getCode());
|
||||
|
||||
DecimalFormat df = new DecimalFormat("0.000000");
|
||||
|
||||
if (CollUtil.isNotEmpty(uUnblanceDev) && CollUtil.isNotEmpty(uUnblanceStd)) {
|
||||
DevData.SqlDataDTO.ListDTO uUnblanceDevList = uUnblanceDev.get(0).getList();
|
||||
DevData.SqlDataDTO.ListDTO uUnblanceStdList = uUnblanceStd.get(0).getList();
|
||||
@@ -1999,7 +1964,6 @@ public class SocketContrastResponseService {
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 从单个检测点中,根据检测项code获取SqlDataDTO数据
|
||||
@@ -2273,6 +2237,22 @@ public class SocketContrastResponseService {
|
||||
System.out.println("原始数据插入数据库执行成功=========================================");
|
||||
}
|
||||
|
||||
/**
|
||||
* 配对关系入库
|
||||
*/
|
||||
private void pairDataInsert() {
|
||||
List<AdPair> adPairList = new ArrayList<>();
|
||||
for (String key : FormalTestManager.pairsIdMap.keySet()) {
|
||||
AdPair adPair = new AdPair();
|
||||
adPair.setPlanId(FormalTestManager.currentTestPlan.getId());
|
||||
adPair.setDevMonitorId(key);
|
||||
adPair.setStdDevMonitorId(FormalTestManager.pairsIdMap.get(key));
|
||||
adPair.setNum(FormalTestManager.numMap.get(key));
|
||||
adPairList.add(adPair);
|
||||
}
|
||||
adPairService.saveBatch(adPairList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送录波指令
|
||||
*
|
||||
@@ -2280,7 +2260,7 @@ public class SocketContrastResponseService {
|
||||
*/
|
||||
private void sendRecordWave(String s) {
|
||||
SocketMsg<String> socketMsg = new SocketMsg<>();
|
||||
socketMsg.setRequestId(SourceOperateCodeEnum.RECORD_WAVE_STEP2.getValue());
|
||||
socketMsg.setRequestId(SourceOperateCodeEnum.RECORD_WAVE_STEP1.getValue());
|
||||
socketMsg.setOperateCode(SourceOperateCodeEnum.RDRE$01.getValue());
|
||||
Map<String, List<WaveCommandDTO>> map = new HashMap<>(1);
|
||||
|
||||
@@ -2330,6 +2310,29 @@ public class SocketContrastResponseService {
|
||||
SocketManager.contrastClockMap.put(DataSourceEnum.REAL_DATA, 0L);
|
||||
}
|
||||
|
||||
private void sendXu(String s) {
|
||||
SocketMsg<String> socketMsg = new SocketMsg<>();
|
||||
socketMsg.setRequestId(SourceOperateCodeEnum.FORMAL_REAL.getValue());
|
||||
socketMsg.setOperateCode(SourceOperateCodeEnum.DEV_DATA_REQUEST_02.getValue());
|
||||
DevPhaseSequenceParam phaseSequenceParam = new DevPhaseSequenceParam();
|
||||
phaseSequenceParam.setMoniterIdList(Arrays.asList(FormalTestManager.monitorMap.keySet().toArray(new String[FormalTestManager.monitorMap.size()])));
|
||||
phaseSequenceParam.setDataType(Arrays.asList(
|
||||
DetectionCodeEnum.REAL_PREFIX.getCode() + DetectionCodeEnum.VRMS.getCode(),
|
||||
DetectionCodeEnum.REAL_PREFIX.getCode() + DetectionCodeEnum.PVRMS.getCode(),
|
||||
DetectionCodeEnum.REAL_PREFIX.getCode() + DetectionCodeEnum.VA.getCode(),
|
||||
DetectionCodeEnum.REAL_PREFIX.getCode() + DetectionCodeEnum.IA.getCode(),
|
||||
DetectionCodeEnum.REAL_PREFIX.getCode() + DetectionCodeEnum.U1A.getCode(),
|
||||
DetectionCodeEnum.REAL_PREFIX.getCode() + DetectionCodeEnum.PU1A.getCode(),
|
||||
DetectionCodeEnum.REAL_PREFIX.getCode() + DetectionCodeEnum.I1A.getCode(),
|
||||
DetectionCodeEnum.REAL_PREFIX.getCode() + DetectionCodeEnum.IRMS.getCode(),
|
||||
DetectionCodeEnum.REAL_PREFIX.getCode() + DetectionCodeEnum.V_UNBAN.getCode(),
|
||||
DetectionCodeEnum.REAL_PREFIX.getCode() + DetectionCodeEnum.I_UNBAN.getCode()));
|
||||
phaseSequenceParam.setReadCount(this.getMaxReadCount(1));
|
||||
phaseSequenceParam.setIgnoreCount(0);
|
||||
socketMsg.setData(JSON.toJSONString(phaseSequenceParam));
|
||||
SocketManager.sendMsg(s, JSON.toJSONString(socketMsg));
|
||||
}
|
||||
|
||||
private List<List<DevData>> analyzeWaveFile(WaveResultDTO devWaveResultDTO, WaveResultDTO stdDevWaveResultDTO, PreDetection.MonitorListDTO monitorListDTO, String devMonitorId, String stdDevMonitorId, List<String> adTypeCodeList) {
|
||||
String stdDevCfgPath = stdDevWaveResultDTO.getPath().replaceAll("\\\\", "/").replace(".CFG", ".cfg");
|
||||
String devCfgPath = devWaveResultDTO.getPath().replaceAll("\\\\", "/").replace(".CFG", ".cfg");
|
||||
|
||||
@@ -52,7 +52,7 @@ public enum SourceOperateCodeEnum {
|
||||
YJC_MXYZXJY("yjc_mxyzxjy", "模型一致性校验"),
|
||||
FORMAL_REAL("formal_real","正式检测"),
|
||||
RECORD_WAVE_STEP1("record_wave_step1","启动录波_step1"),
|
||||
RECORD_WAVE_STEP2("record_wave_step2","启动录波_step2"),
|
||||
// RECORD_WAVE_STEP2("record_wave_step2","启动录波_step2"),
|
||||
// SIMULATE_REAL("simulate_real","模拟检测"),
|
||||
Coefficient_Check("Coefficient_Check","系数校验"),
|
||||
QUITE("quit","关闭设备通讯初始化"),
|
||||
|
||||
@@ -1603,13 +1603,13 @@ public class DetectionServiceImpl {
|
||||
|
||||
switch (anEnum) {
|
||||
case FREQ:
|
||||
// if (ObjectUtil.isNull(waveNum)) {
|
||||
// devDataList.stream().forEach(devData -> devData.getSqlData().stream().filter(sqlData -> sqlData.getDesc().equals(DetectionCodeEnum.FREQ.getCode())).findFirst().ifPresent(sqlData -> {
|
||||
// DevData.SqlDataDTO.ListDTO listDTO = sqlData.getList();
|
||||
// listDTO.setT(55.0);
|
||||
// sqlData.setList(listDTO);
|
||||
// }));
|
||||
// }
|
||||
if (ObjectUtil.isNull(waveNum)) {
|
||||
devDataList.stream().forEach(devData -> devData.getSqlData().stream().filter(sqlData -> sqlData.getDesc().equals(DetectionCodeEnum.FREQ.getCode())).findFirst().ifPresent(sqlData -> {
|
||||
DevData.SqlDataDTO.ListDTO listDTO = sqlData.getList();
|
||||
listDTO.setT(55.0);
|
||||
sqlData.setList(listDTO);
|
||||
}));
|
||||
}
|
||||
resultMap.put(PowerIndexEnum.FREQ.getKey(), isQualified(devDataList, standardDevDataList, devIdMapComm, pqErrSysDtls, true, fHz, DetectionCodeEnum.FREQ.getCode(), dataRule, num, code, oneConfig.getScale(), waveNum));
|
||||
break;
|
||||
case VRMS:
|
||||
@@ -1726,6 +1726,9 @@ public class DetectionServiceImpl {
|
||||
if (CollUtil.isNotEmpty(devDataList) && CollUtil.isNotEmpty(standardDevDataList) && CollUtil.isNotEmpty(errSysDtls)) {
|
||||
|
||||
Map<String, List<List<Double>>> map = devListMap(devDataList, standardDevDataList, desc, dataRule);
|
||||
if(ObjectUtil.isNull(map)){
|
||||
return 4;
|
||||
}
|
||||
ContrastNonHarmonicResult result = new ContrastNonHarmonicResult();
|
||||
result.setWaveNum(waveNum);
|
||||
|
||||
@@ -1903,6 +1906,10 @@ public class DetectionServiceImpl {
|
||||
List<DevData.SqlDataDTO.ListDTO> standardDevList = standardDevSqlData.stream().filter(j -> finalDesc.equals(j.getDesc()))
|
||||
.map(DevData.SqlDataDTO::getList).collect(Collectors.toList());
|
||||
|
||||
if(CollUtil.isEmpty(devList) || CollUtil.isEmpty(standardDevList)){
|
||||
return null;
|
||||
}
|
||||
|
||||
aDev.addAll(devList.stream().filter(x -> ObjectUtil.isNotNull(x.getA()))
|
||||
.map(x -> x.getA().doubleValue())
|
||||
.collect(Collectors.toList()));
|
||||
|
||||
@@ -385,6 +385,15 @@ public class PreDetectionServiceImpl implements PreDetectionService {
|
||||
String jsonString = JSON.toJSONString(map);
|
||||
SocketMsg<String> socketMsg = new SocketMsg<>();
|
||||
socketMsg.setRequestId(SourceOperateCodeEnum.YJC_SBTXJY.getValue());
|
||||
// AdPlan currentTestPlan = FormalTestManager.currentTestPlan;
|
||||
// String[] datasource = currentTestPlan.getDatasourceId().split(",");
|
||||
// if (Arrays.stream(datasource).anyMatch(x -> x.equals(DataSourceEnum.REAL_DATA.getValue()))) {
|
||||
// socketMsg.setOperateCode(SourceOperateCodeEnum.DEV_INIT_GATHER_02.getValue());
|
||||
// } else if (Arrays.stream(datasource).anyMatch(x -> x.equals(DataSourceEnum.MINUTE_STATISTICS_AVG.getValue()) || x.equals(DataSourceEnum.MINUTE_STATISTICS_MAX.getValue()) || x.equals(DataSourceEnum.MINUTE_STATISTICS_MIN.getValue()) || x.equals(DataSourceEnum.MINUTE_STATISTICS_CP95.getValue()))) {
|
||||
//
|
||||
// } else if (Arrays.stream(datasource).anyMatch(x -> x.equals(DataSourceEnum.WAVE_DATA.getValue()))) {
|
||||
// socketMsg.setOperateCode(SourceOperateCodeEnum.DEV_INIT_GATHER_03.getValue());
|
||||
// }
|
||||
socketMsg.setOperateCode(SourceOperateCodeEnum.DEV_INIT_GATHER_02.getValue());
|
||||
socketMsg.setData(jsonString);
|
||||
PreDetectionParam preDetectionParam = new PreDetectionParam();
|
||||
|
||||
@@ -58,7 +58,7 @@ public class CnSocketUtil {
|
||||
* 比对式-退出检测
|
||||
*/
|
||||
public static void contrastSendquit(String loginName, SourceOperateCodeEnum operateCode, boolean isRemoveSocket) {
|
||||
System.out.println("比对式-发送关闭备通讯模块指令。。。。。。。。");
|
||||
System.out.println("比对式-发送" + operateCode.getMsg() + "指令。。。。。。。。");
|
||||
SocketMsg<String> socketMsg = new SocketMsg<>();
|
||||
socketMsg.setRequestId(SourceOperateCodeEnum.QUITE.getValue());
|
||||
socketMsg.setOperateCode(operateCode.getValue());
|
||||
|
||||
@@ -16,6 +16,8 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
import java.util.concurrent.ScheduledFuture;
|
||||
|
||||
/**
|
||||
* @Author: cdf
|
||||
@@ -154,4 +156,14 @@ public class FormalTestManager {
|
||||
*/
|
||||
public static List<DevLineTestResult> preNumTestResultList = new ArrayList<>();
|
||||
|
||||
/**
|
||||
* 定时器
|
||||
*/
|
||||
public static ScheduledExecutorService scheduler;
|
||||
|
||||
/**
|
||||
* 定时器任务
|
||||
*/
|
||||
public static ScheduledFuture<?> scheduledFuture;
|
||||
|
||||
}
|
||||
|
||||
@@ -193,7 +193,7 @@ public class HeartbeatHandler extends SimpleChannelInboundHandler<String> {
|
||||
} else if (CnSocketUtil.SOURCE_TAG.equals(handlerType)) {
|
||||
CnSocketUtil.quitSendSource(param);
|
||||
} else {
|
||||
if (FormalTestManager.currentStep == SourceOperateCodeEnum.RECORD_WAVE_STEP1 || FormalTestManager.currentStep == SourceOperateCodeEnum.RECORD_WAVE_STEP2) {
|
||||
if (FormalTestManager.currentStep == SourceOperateCodeEnum.RECORD_WAVE_STEP1) {
|
||||
CnSocketUtil.contrastSendquit(param.getUserPageId(), SourceOperateCodeEnum.QUIT_INIT_03, true);
|
||||
} else {
|
||||
CnSocketUtil.contrastSendquit(param.getUserPageId(), SourceOperateCodeEnum.QUIT_INIT_02, true);
|
||||
|
||||
@@ -60,7 +60,7 @@ public class NettyContrastClientHandler extends SimpleChannelInboundHandler<Stri
|
||||
socketContrastResponseService.deal(param, msg);
|
||||
} catch (Exception e) {
|
||||
log.error("处理服务端消息异常", e);
|
||||
if (FormalTestManager.currentStep == SourceOperateCodeEnum.RECORD_WAVE_STEP1 || FormalTestManager.currentStep == SourceOperateCodeEnum.RECORD_WAVE_STEP2) {
|
||||
if (FormalTestManager.currentStep == SourceOperateCodeEnum.RECORD_WAVE_STEP1) {
|
||||
CnSocketUtil.contrastSendquit(param.getUserPageId(), SourceOperateCodeEnum.QUIT_INIT_03, true);
|
||||
} else {
|
||||
CnSocketUtil.contrastSendquit(param.getUserPageId(), SourceOperateCodeEnum.QUIT_INIT_02, true);
|
||||
|
||||
@@ -372,17 +372,18 @@ public class WebSocketHandler extends SimpleChannelInboundHandler<TextWebSocketF
|
||||
// 使用该用户的检测参数关闭Socket连接
|
||||
log.info("使用用户检测参数关闭Socket连接,userId: {}", userId);
|
||||
if (FormalTestManager.patternEnum.equals(PatternEnum.CONTRAST)) {
|
||||
if (!FormalTestManager.isRemoveSocket) {
|
||||
if (FormalTestManager.currentStep == SourceOperateCodeEnum.RECORD_WAVE_STEP1 || FormalTestManager.currentStep == SourceOperateCodeEnum.RECORD_WAVE_STEP2) {
|
||||
CnSocketUtil.contrastSendquit(preDetectionParam.getUserPageId(), SourceOperateCodeEnum.QUIT_INIT_03, true);
|
||||
} else if (FormalTestManager.currentStep != SourceOperateCodeEnum.QUITE) {
|
||||
CnSocketUtil.contrastSendquit(preDetectionParam.getUserPageId(), SourceOperateCodeEnum.QUIT_INIT_02, true);
|
||||
} else {
|
||||
if (FormalTestManager.isRemoveSocket) {
|
||||
boolean channelActive = SocketManager.isChannelActive(preDetectionParam.getUserPageId() + CnSocketUtil.CONTRAST_DEV_TAG);
|
||||
if (channelActive) {
|
||||
SocketManager.removeUser(preDetectionParam.getUserPageId() + CnSocketUtil.CONTRAST_DEV_TAG);
|
||||
}
|
||||
} else {
|
||||
boolean channelActive = SocketManager.isChannelActive(preDetectionParam.getUserPageId() + CnSocketUtil.CONTRAST_DEV_TAG);
|
||||
if (channelActive) {
|
||||
if (FormalTestManager.currentStep == SourceOperateCodeEnum.RECORD_WAVE_STEP1) {
|
||||
CnSocketUtil.contrastSendquit(preDetectionParam.getUserPageId(), SourceOperateCodeEnum.QUIT_INIT_03, true);
|
||||
} else if (FormalTestManager.currentStep != SourceOperateCodeEnum.QUITE) {
|
||||
CnSocketUtil.contrastSendquit(preDetectionParam.getUserPageId(), SourceOperateCodeEnum.QUIT_INIT_02, false);
|
||||
CnSocketUtil.contrastSendquit(preDetectionParam.getUserPageId(), SourceOperateCodeEnum.QUIT_INIT_03, true);
|
||||
} else {
|
||||
SocketManager.removeUser(preDetectionParam.getUserPageId() + CnSocketUtil.CONTRAST_DEV_TAG);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@ import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.extension.conditions.update.LambdaUpdateChainWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||
@@ -44,6 +45,7 @@ import com.njcn.gather.system.dictionary.service.IDictDataService;
|
||||
import com.njcn.gather.system.dictionary.service.IDictTypeService;
|
||||
import com.njcn.gather.type.pojo.po.DevType;
|
||||
import com.njcn.gather.type.service.IDevTypeService;
|
||||
import com.njcn.gather.user.user.pojo.po.SysUser;
|
||||
import com.njcn.gather.user.user.service.ISysUserService;
|
||||
import com.njcn.web.factory.PageFactory;
|
||||
import com.njcn.web.utils.ExcelUtil;
|
||||
@@ -353,7 +355,10 @@ public class PqDevServiceImpl extends ServiceImpl<PqDevMapper, PqDev> implements
|
||||
pqDevVO.setDevKey(EncryptionUtil.decoderString(1, pqDevVO.getDevKey()));
|
||||
}
|
||||
if (StrUtil.isNotBlank(pqDevVO.getCheckBy())) {
|
||||
pqDevVO.setCheckBy(userService.getById(pqDevVO.getCheckBy()).getName());
|
||||
SysUser user = userService.getById(pqDevVO.getCheckBy());
|
||||
if (ObjectUtil.isNotNull(user)) {
|
||||
pqDevVO.setCheckBy(user.getName());
|
||||
}
|
||||
}
|
||||
|
||||
DevType devType = devTypeService.getById(pqDevVO.getDevType());
|
||||
@@ -515,11 +520,18 @@ public class PqDevServiceImpl extends ServiceImpl<PqDevMapper, PqDev> implements
|
||||
Integer checkState = pqMonitorService.getDevCheckState(devId);
|
||||
Integer checkResult = pqMonitorService.getDevCheckResult(devId);
|
||||
|
||||
pqDevSubService.lambdaUpdate()
|
||||
SysUser user = userService.getById(userId);
|
||||
|
||||
LambdaUpdateChainWrapper<PqDevSub> w = pqDevSubService.lambdaUpdate()
|
||||
.set(PqDevSub::getCheckState, checkState)
|
||||
.set(PqDevSub::getCheckResult, checkResult)
|
||||
.set(StrUtil.isNotBlank(userId), PqDevSub::getCheckBy, userId)
|
||||
.eq(PqDevSub::getDevId, devId).update();
|
||||
.set(PqDevSub::getCheckTime, LocalDateTime.now())
|
||||
.eq(PqDevSub::getDevId, devId);
|
||||
|
||||
if(ObjectUtil.isNotNull(user)){
|
||||
w.set(PqDevSub::getCheckBy, user.getName());
|
||||
}
|
||||
w.update();
|
||||
|
||||
PqDevParam.QueryParam param = new PqDevParam.QueryParam();
|
||||
String planId = dev.getPlanId();
|
||||
@@ -539,6 +551,10 @@ public class PqDevServiceImpl extends ServiceImpl<PqDevMapper, PqDev> implements
|
||||
set = pqDevVOList.stream().map(PqDevVO::getCheckState).collect(Collectors.toSet());
|
||||
if (set.contains(CheckStateEnum.UNCHECKED.getValue())) {
|
||||
this.baseMapper.updatePlanTestState(planId, CheckStateEnum.CHECKING.getValue());
|
||||
} else if (set.contains(CheckStateEnum.CHECKING.getValue())) {
|
||||
this.baseMapper.updatePlanTestState(planId, CheckStateEnum.CHECKING.getValue());
|
||||
} else {
|
||||
this.baseMapper.updatePlanTestState(planId, CheckStateEnum.CHECKED.getValue());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -602,6 +602,12 @@ public class AdPlanServiceImpl extends ServiceImpl<AdPlanMapper, AdPlan> impleme
|
||||
}
|
||||
DictData dictData = dictDataService.getById(patternId);
|
||||
if (PatternEnum.CONTRAST.getValue().equals(dictData.getCode())) {
|
||||
String datasourceId = adPlan.getDatasourceId();
|
||||
if (datasourceId.contains(DataSourceEnum.REAL_DATA.getValue())
|
||||
|| datasourceId.contains(DataSourceEnum.MINUTE_STATISTICS_CP95.getValue())
|
||||
|| datasourceId.contains(DataSourceEnum.MINUTE_STATISTICS_AVG.getValue())
|
||||
|| datasourceId.contains(DataSourceEnum.MINUTE_STATISTICS_MAX.getValue())
|
||||
|| datasourceId.contains(DataSourceEnum.MINUTE_STATISTICS_MIN.getValue())) {
|
||||
String[] split = adPlan.getTestItem().split(StrUtil.COMMA);
|
||||
List<DictTree> dictTreeList = dictTreeService.list(new QueryWrapper<DictTree>().in("id", split).eq("state", DataStateEnum.DELETED.getCode()));
|
||||
|
||||
@@ -612,6 +618,8 @@ public class AdPlanServiceImpl extends ServiceImpl<AdPlanMapper, AdPlan> impleme
|
||||
map.put("scriptName", dictTree.getName());
|
||||
result.add(map);
|
||||
}
|
||||
}
|
||||
|
||||
if (StrUtil.isBlank(scriptType)) {
|
||||
if (adPlan.getDatasourceId().contains(DataSourceEnum.WAVE_DATA.getValue())) {
|
||||
Map<String, String> map = new HashMap<>();
|
||||
|
||||
@@ -29,7 +29,6 @@ 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;
|
||||
@@ -96,6 +95,8 @@ import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import static com.njcn.gather.detection.util.socket.FormalTestManager.waveNum;
|
||||
|
||||
/**
|
||||
* @author caozehui
|
||||
* @data 2024-12-30
|
||||
@@ -1708,38 +1709,84 @@ public class ResultServiceImpl implements IResultService {
|
||||
}
|
||||
AdPlan finalPlan = plan;
|
||||
// 实时数据结果
|
||||
List<ContrastNonHarmonicResult> nonHarmonicResults = contrastNonHarmonicService.listAllResultData(String.valueOf(finalPlan.getCode()), null, null, false, monitorId, null);
|
||||
Map<Integer, List<ContrastNonHarmonicResult>> numMap = nonHarmonicResults.stream()
|
||||
List<ContrastNonHarmonicResult> realNonHarmonicResults = contrastNonHarmonicService.listAllResultData(String.valueOf(finalPlan.getCode()), null, null, false, monitorId, null);
|
||||
Map<Integer, List<ContrastNonHarmonicResult>> numNonHarmonicMap = realNonHarmonicResults.stream()
|
||||
.sorted(Comparator.comparing(ContrastNonHarmonicResult::getNum))
|
||||
.collect(Collectors.groupingBy(ContrastNonHarmonicResult::getNum, LinkedHashMap::new, Collectors.toList()));
|
||||
|
||||
List<ContrastHarmonicResult> realHarmonicResults = contrastHarmonicService.listAllResultData(String.valueOf(finalPlan.getCode()), null, null, false, monitorId, null);
|
||||
Map<Integer, List<ContrastHarmonicResult>> numHarmonicMap = realHarmonicResults.stream()
|
||||
.sorted(Comparator.comparing(ContrastHarmonicResult::getNum))
|
||||
.collect(Collectors.groupingBy(ContrastHarmonicResult::getNum, LinkedHashMap::new, Collectors.toList()));
|
||||
|
||||
numMap.forEach((num, resultList) -> {
|
||||
Map<Integer, List<Integer>> numResutMap = new TreeMap<>();
|
||||
numNonHarmonicMap.forEach((num, resultList) -> {
|
||||
numResutMap.put(num, resultList.stream().map(ContrastNonHarmonicResult::getResultFlag).distinct().collect(Collectors.toList()));
|
||||
});
|
||||
numHarmonicMap.forEach((num, resultList) -> {
|
||||
List<Integer> list = numResutMap.getOrDefault(num, new ArrayList<>());
|
||||
list.addAll(resultList.stream().map(ContrastHarmonicResult::getResultFlag).distinct().collect(Collectors.toList()));
|
||||
numResutMap.put(num, list);
|
||||
});
|
||||
|
||||
numResutMap.forEach((num, resultList) -> {
|
||||
List<DataSourceResultVO> dataSourceResultVOList = new ArrayList<>();
|
||||
|
||||
DataSourceResultVO realDataSourceResultVO = new DataSourceResultVO();
|
||||
realDataSourceResultVO.setDataSourceCode(DataSourceEnum.REAL_DATA.getValue());
|
||||
realDataSourceResultVO.setDataSourceName(DataSourceEnum.REAL_DATA.getMsg());
|
||||
List<Integer> resultFlagList = resultList.stream().map(ContrastNonHarmonicResult::getResultFlag).distinct().collect(Collectors.toList());
|
||||
realDataSourceResultVO.setCheckResult(StorageUtil.getInteger(resultFlagList));
|
||||
realDataSourceResultVO.setCheckResult(StorageUtil.getInteger(resultList));
|
||||
dataSourceResultVOList.add(realDataSourceResultVO);
|
||||
|
||||
result.put(num, dataSourceResultVOList);
|
||||
});
|
||||
|
||||
Map<Integer, Map<Integer, List<Integer>>> waveNumMap = new TreeMap<>();
|
||||
|
||||
// 录波数据结果
|
||||
List<ContrastNonHarmonicResult> waveNonHarmonicResults = contrastNonHarmonicService.listAllResultData(String.valueOf(finalPlan.getCode()), num, null, true, monitorId, null);
|
||||
Map<Integer, List<ContrastNonHarmonicResult>> waveNumMap = waveNonHarmonicResults.stream()
|
||||
List<ContrastNonHarmonicResult> waveNonHarmonicResults = contrastNonHarmonicService.listAllResultData(String.valueOf(finalPlan.getCode()), null, null, true, monitorId, null);
|
||||
Map<Integer, List<ContrastNonHarmonicResult>> waveNumNonHarmonicMap = waveNonHarmonicResults.stream()
|
||||
.sorted(Comparator.comparing(ContrastNonHarmonicResult::getNum))
|
||||
.collect(Collectors.groupingBy(ContrastNonHarmonicResult::getNum, LinkedHashMap::new, Collectors.toList()));
|
||||
List<ContrastHarmonicResult> waveHarmonicResults = contrastHarmonicService.listAllResultData(String.valueOf(finalPlan.getCode()), null, null, true, monitorId, null);
|
||||
Map<Integer, List<ContrastHarmonicResult>> waveNumHarmonicMap = waveHarmonicResults.stream()
|
||||
.sorted(Comparator.comparing(ContrastHarmonicResult::getNum))
|
||||
.collect(Collectors.groupingBy(ContrastHarmonicResult::getNum, LinkedHashMap::new, Collectors.toList()));
|
||||
|
||||
waveNumNonHarmonicMap.forEach((num, resultList) -> {
|
||||
LinkedHashMap<Integer, List<ContrastNonHarmonicResult>> collect = resultList.stream()
|
||||
.sorted(Comparator.comparing(ContrastNonHarmonicResult::getWaveNum))
|
||||
.collect(Collectors.groupingBy(ContrastNonHarmonicResult::getWaveNum, LinkedHashMap::new, Collectors.toList()));
|
||||
|
||||
waveNumMap.forEach((waveNum, resultList1) -> {
|
||||
Map<Integer, List<Integer>> map = new TreeMap<>();
|
||||
collect.forEach((waveNum, resultList1) -> {
|
||||
map.put(waveNum, resultList1.stream().map(ContrastNonHarmonicResult::getResultFlag).distinct().collect(Collectors.toList()));
|
||||
});
|
||||
waveNumMap.put(num, map);
|
||||
});
|
||||
|
||||
waveNumHarmonicMap.forEach((num, resultList) -> {
|
||||
Map<Integer, List<Integer>> map = waveNumMap.getOrDefault(num, new TreeMap<>());
|
||||
|
||||
LinkedHashMap<Integer, List<ContrastHarmonicResult>> collect = resultList.stream().sorted(Comparator.comparing(ContrastHarmonicResult::getWaveNum))
|
||||
.collect(Collectors.groupingBy(ContrastHarmonicResult::getWaveNum, LinkedHashMap::new, Collectors.toList()));
|
||||
collect.forEach((waveNum, resultList1) -> {
|
||||
List<Integer> list = map.getOrDefault(waveNum, new ArrayList<>());
|
||||
list.addAll(resultList1.stream().map(ContrastHarmonicResult::getResultFlag).distinct().collect(Collectors.toList()));
|
||||
map.put(waveNum, list);
|
||||
});
|
||||
waveNumMap.put(num, map);
|
||||
});
|
||||
|
||||
waveNumMap.forEach((num, map) -> {
|
||||
List<DataSourceResultVO> orDefault = result.getOrDefault(num, new ArrayList<>());
|
||||
map.forEach((waveNum, resultList) -> {
|
||||
DataSourceResultVO waveDataSourceResultVO = new DataSourceResultVO();
|
||||
waveDataSourceResultVO.setDataSourceCode(DataSourceEnum.WAVE_DATA.getValue() + CnSocketUtil.SPLIT_TAG + waveNum);
|
||||
waveDataSourceResultVO.setDataSourceName(DataSourceEnum.WAVE_DATA.getMsg() + StrUtil.SPACE + waveNum);
|
||||
List<Integer> tempResultFlagList = resultList1.stream().map(ContrastNonHarmonicResult::getResultFlag).distinct().collect(Collectors.toList());
|
||||
waveDataSourceResultVO.setCheckResult(StorageUtil.getInteger(tempResultFlagList));
|
||||
dataSourceResultVOList.add(waveDataSourceResultVO);
|
||||
waveDataSourceResultVO.setCheckResult(StorageUtil.getInteger(resultList));
|
||||
orDefault.add(waveDataSourceResultVO);
|
||||
});
|
||||
|
||||
result.put(num, dataSourceResultVOList);
|
||||
result.put(num, orDefault);
|
||||
});
|
||||
|
||||
return result;
|
||||
|
||||
@@ -166,9 +166,12 @@ public class DetectionDataServiceImpl extends ReplenishMybatisServiceImpl<Detect
|
||||
DynamicTableNameHandler.setTableName("ad_non_harmonic_result_" + code);
|
||||
LambdaQueryWrapper<ContrastNonHarmonicResult> wrapper1 = new LambdaQueryWrapper<ContrastNonHarmonicResult>()
|
||||
.in(CollUtil.isNotEmpty(adType), ContrastNonHarmonicResult::getAdType, adType);
|
||||
wrapper1.and(w -> {
|
||||
for (String id : ids) {
|
||||
wrapper1.like(ContrastNonHarmonicResult::getDevMonitorId, id);
|
||||
w.or().like(ContrastNonHarmonicResult::getDevMonitorId, id);
|
||||
}
|
||||
});
|
||||
|
||||
List<ContrastNonHarmonicResult> nonHarmonicResultList = contrastNonHarmonicService.list(wrapper1);
|
||||
Map<String, List<ContrastNonHarmonicResult>> chnMap1 = nonHarmonicResultList.stream().collect(Collectors.groupingBy(x -> x.getDevMonitorId().split("_")[1], Collectors.toList()));
|
||||
chnMap1.forEach((chn, vList) -> {
|
||||
@@ -181,9 +184,12 @@ public class DetectionDataServiceImpl extends ReplenishMybatisServiceImpl<Detect
|
||||
DynamicTableNameHandler.setTableName("ad_harmonic_result_" + code);
|
||||
LambdaQueryWrapper<ContrastHarmonicResult> wrapper2 = new LambdaQueryWrapper<ContrastHarmonicResult>()
|
||||
.in(CollUtil.isNotEmpty(adType), ContrastHarmonicResult::getAdType, adType);
|
||||
wrapper2.and(w -> {
|
||||
for (String id : ids) {
|
||||
wrapper2.like(ContrastHarmonicResult::getDevMonitorId, id);
|
||||
w.like(ContrastHarmonicResult::getDevMonitorId, id);
|
||||
}
|
||||
});
|
||||
|
||||
List<ContrastHarmonicResult> harmonicResultList = contrastHarmonicService.list(wrapper2);
|
||||
Map<String, List<ContrastHarmonicResult>> chnMap2 = harmonicResultList.stream().collect(Collectors.groupingBy(x -> x.getDevMonitorId().split("_")[1], Collectors.toList()));
|
||||
chnMap2.forEach((chn, vList) -> {
|
||||
|
||||
Reference in New Issue
Block a user