1、手动检测根据检测内容不同动态决定是否进行初始化操作
2、检测结果原始数据时间展示毫秒值
This commit is contained in:
@@ -17,6 +17,7 @@ import com.njcn.gather.detection.pojo.po.SourceCompareDev;
|
||||
import com.njcn.gather.detection.pojo.vo.*;
|
||||
import com.njcn.gather.detection.service.impl.DetectionServiceImpl;
|
||||
import com.njcn.gather.detection.util.socket.*;
|
||||
import com.njcn.gather.device.pojo.enums.CommonEnum;
|
||||
import com.njcn.gather.device.pojo.po.PqDev;
|
||||
import com.njcn.gather.device.pojo.vo.PreDetection;
|
||||
import com.njcn.gather.device.service.IPqDevService;
|
||||
@@ -408,32 +409,29 @@ public class SocketDevResponseService {
|
||||
sendWebSocket(param.getUserPageId(), SourceOperateCodeEnum.Coefficient_Check.getValue(), SourceOperateCodeEnum.small_comp_end.getValue(), XiNumberManager.devParameterList.get(1));
|
||||
System.out.println("-------------------------已经全部结束----------------------");
|
||||
|
||||
//如果是系数校验则终止
|
||||
if (param.getOperateType().equals(SourceOperateCodeEnum.COEFFICIENT_TEST.getValue())) {
|
||||
CnSocketUtil.quitSend(param);
|
||||
//修改设备表Factor_Check_Result字段
|
||||
XiNumberManager.devXiNumDataMap.forEach((key, val) -> {
|
||||
DevXiNumData small = XiNumberManager.smallDevXiNumDataMap.get(key);
|
||||
LambdaUpdateWrapper<PqDev> updateWrapper = new LambdaUpdateWrapper<>();
|
||||
updateWrapper.eq(PqDev::getId, FormalTestManager.devIdMapComm.get(key));
|
||||
if (val.getResultFlag() == 0 || small.getResultFlag() == 0) {
|
||||
updateWrapper.set(PqDev::getFactorCheckResult, 0);
|
||||
} else {
|
||||
updateWrapper.set(PqDev::getFactorCheckResult, 1);
|
||||
}
|
||||
iPqDevService.update(updateWrapper);
|
||||
updateWrapper.clear();
|
||||
});
|
||||
} else if (param.getOperateType().equals(SourceOperateCodeEnum.FAST_TEST.getValue())) {
|
||||
//如果是一键检测,执行完系数校验后继续进行正式检测
|
||||
//开始下源控制脚本
|
||||
if (param.getTestItemList().get(2)) {
|
||||
//如果后续做正式检测
|
||||
PqScriptIssueParam issueParam = new PqScriptIssueParam();
|
||||
issueParam.setPlanId(param.getPlanId());
|
||||
issueParam.setSourceId(param.getSourceId());
|
||||
issueParam.setDevIds(param.getDevIds());
|
||||
issueParam.setScriptId(param.getScriptId());
|
||||
issueParam.setIsPhaseSequence(SourceOperateCodeEnum.FORMAL_TEST.getValue());
|
||||
|
||||
if (param.getOperateType().equals(SourceOperateCodeEnum.RE_ERROR_TEST.getValue())) {
|
||||
//不合格项复检
|
||||
Set<Integer> indexes = new HashSet<>();
|
||||
StorageParam storageParam = new StorageParam();
|
||||
storageParam.setCode(param.getCode());
|
||||
storageParam.setScriptId(param.getScriptId());
|
||||
param.getDevIds().forEach(devId -> {
|
||||
storageParam.setDevId(devId);
|
||||
indexes.addAll(adHarmonicService.getIndex(storageParam));
|
||||
});
|
||||
issueParam.setIndexList(indexes.stream().collect(Collectors.toList()));
|
||||
issueParam.setIsPhaseSequence(SourceOperateCodeEnum.RE_ERROR_TEST.getValue());
|
||||
} else {
|
||||
issueParam.setIsPhaseSequence(CommonEnum.FORMAL_TEST.getValue());
|
||||
}
|
||||
|
||||
SocketMsg<String> socketMsg = new SocketMsg<>();
|
||||
socketMsg.setOperateCode(SourceOperateCodeEnum.OPER_GATHER.getValue());
|
||||
@@ -469,8 +467,23 @@ public class SocketDevResponseService {
|
||||
webSocketVO.setRequestId(sourceIssues.get(0).getType() + stepBegin);
|
||||
webSocketVO.setDesc(null);
|
||||
WebServiceManager.sendMsg(param.getUserPageId(), JSON.toJSONString(webSocketVO));
|
||||
} else {
|
||||
//后续什么都不做
|
||||
CnSocketUtil.quitSend(param);
|
||||
//修改设备表Factor_Check_Result字段
|
||||
XiNumberManager.devXiNumDataMap.forEach((key, val) -> {
|
||||
DevXiNumData small = XiNumberManager.smallDevXiNumDataMap.get(key);
|
||||
LambdaUpdateWrapper<PqDev> updateWrapper = new LambdaUpdateWrapper<>();
|
||||
updateWrapper.eq(PqDev::getId, FormalTestManager.devIdMapComm.get(key));
|
||||
if (val.getResultFlag() == 0 || small.getResultFlag() == 0) {
|
||||
updateWrapper.set(PqDev::getFactorCheckResult, 0);
|
||||
} else {
|
||||
updateWrapper.set(PqDev::getFactorCheckResult, 1);
|
||||
}
|
||||
iPqDevService.update(updateWrapper);
|
||||
updateWrapper.clear();
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -884,8 +897,15 @@ public class SocketDevResponseService {
|
||||
|
||||
socketMsg.setOperateCode(SourceOperateCodeEnum.OPER_GATHER.getValue());
|
||||
List<SourceIssue> sourceIssues;
|
||||
if (SourceOperateCodeEnum.FORMAL_TEST.getValue().equals(param.getOperateType()) || SourceOperateCodeEnum.RE_ERROR_TEST.getValue().equals(param.getOperateType())) {
|
||||
|
||||
// 做预检测、后续做系数校准
|
||||
if (param.getTestItemList().get(0) || param.getTestItemList().get(1)) {
|
||||
issueParam.setIsPhaseSequence(CommonEnum.PHASE_TEST.getValue());
|
||||
sourceIssues = pqScriptDtlsService.listSourceIssue(issueParam);
|
||||
socketMsg.setRequestId(SourceOperateCodeEnum.YJC_XUJY.getValue());
|
||||
socketMsg.setData(JSON.toJSONString(sourceIssues.get(0)));
|
||||
SocketManager.sendMsg(param.getUserPageId() + handlerSourceStr, JSON.toJSONString(socketMsg));
|
||||
} else if (param.getTestItemList().get(2)) {
|
||||
// 后续做正式检测
|
||||
if (param.getOperateType().equals(SourceOperateCodeEnum.RE_ERROR_TEST.getValue())) {
|
||||
//不合格项复检
|
||||
Set<Integer> indexes = new HashSet<>();
|
||||
@@ -899,7 +919,7 @@ public class SocketDevResponseService {
|
||||
issueParam.setIndexList(indexes.stream().collect(Collectors.toList()));
|
||||
issueParam.setIsPhaseSequence(SourceOperateCodeEnum.RE_ERROR_TEST.getValue());
|
||||
} else {
|
||||
issueParam.setIsPhaseSequence(SourceOperateCodeEnum.FORMAL_TEST.getValue());
|
||||
issueParam.setIsPhaseSequence(CommonEnum.FORMAL_TEST.getValue());
|
||||
}
|
||||
//正式检测
|
||||
sourceIssues = pqScriptDtlsService.listSourceIssue(issueParam);
|
||||
@@ -931,28 +951,20 @@ public class SocketDevResponseService {
|
||||
webSocketVO.setRequestId(sourceIssues.get(0).getType() + stepBegin);
|
||||
webSocketVO.setDesc(null);
|
||||
WebServiceManager.sendMsg(param.getUserPageId(), JSON.toJSONString(webSocketVO));
|
||||
|
||||
|
||||
} else if (SourceOperateCodeEnum.PRE_TEST.getValue().equals(param.getOperateType()) || SourceOperateCodeEnum.COEFFICIENT_TEST.getValue().equals(param.getOperateType()) || SourceOperateCodeEnum.FAST_TEST.getValue().equals(param.getOperateType())) {
|
||||
//预检测的相序检测 以及系数校验、一键检测 都需要进行相序检测
|
||||
issueParam.setIsPhaseSequence(SourceOperateCodeEnum.PHASE_TEST.getValue());
|
||||
sourceIssues = pqScriptDtlsService.listSourceIssue(issueParam);
|
||||
socketMsg.setRequestId(SourceOperateCodeEnum.YJC_XUJY.getValue());
|
||||
socketMsg.setData(JSON.toJSONString(sourceIssues.get(0)));
|
||||
SocketManager.sendMsg(param.getUserPageId() + handlerSourceStr, JSON.toJSONString(socketMsg));
|
||||
} else if (SourceOperateCodeEnum.TEST_TEM_START.getValue().equals(param.getOperateType())) {
|
||||
//暂停检测后的继续检测
|
||||
System.out.println("进入暂停后的继续检测》》》》》》》》》》》》》》》》》》》》》》》》》》》" + "剩余检测小项" + SocketManager.getSourceList().size());
|
||||
if (CollUtil.isNotEmpty(SocketManager.getSourceList())) {
|
||||
SourceIssue sourceIssue = SocketManager.getSourceList().get(0);
|
||||
socketMsg.setRequestId(SourceOperateCodeEnum.FORMAL_REAL.getValue() + stepTag + sourceIssue.getType());
|
||||
socketMsg.setOperateCode(SourceOperateCodeEnum.OPER_GATHER.getValue());
|
||||
socketMsg.setData(JSON.toJSONString(sourceIssue));
|
||||
SocketManager.sendMsg(param.getUserPageId() + handlerSourceStr, JSON.toJSONString(socketMsg));
|
||||
}
|
||||
} else {
|
||||
|
||||
}
|
||||
// if (SourceOperateCodeEnum.TEST_TEM_START.getValue().equals(param.getOperateType())) {
|
||||
// //暂停检测后的继续检测
|
||||
// System.out.println("进入暂停后的继续检测》》》》》》》》》》》》》》》》》》》》》》》》》》》" + "剩余检测小项" + SocketManager.getSourceList().size());
|
||||
// if (CollUtil.isNotEmpty(SocketManager.getSourceList())) {
|
||||
// SourceIssue sourceIssue = SocketManager.getSourceList().get(0);
|
||||
// socketMsg.setRequestId(SourceOperateCodeEnum.FORMAL_REAL.getValue() + stepTag + sourceIssue.getType());
|
||||
// socketMsg.setOperateCode(SourceOperateCodeEnum.OPER_GATHER.getValue());
|
||||
// socketMsg.setData(JSON.toJSONString(sourceIssue));
|
||||
// SocketManager.sendMsg(param.getUserPageId() + handlerSourceStr, JSON.toJSONString(socketMsg));
|
||||
// }
|
||||
// } else {
|
||||
//
|
||||
// }
|
||||
} else {
|
||||
// 发送下一个脚本与icd校验
|
||||
String icdType = icdTypeList.stream().filter(it -> !icdCheckDataMap.containsKey(it)).findFirst().orElse(null);
|
||||
@@ -1048,7 +1060,7 @@ public class SocketDevResponseService {
|
||||
PqScriptIssueParam sourceParam = new PqScriptIssueParam();
|
||||
sourceParam.setPlanId(param.getPlanId());
|
||||
sourceParam.setDevIds(param.getDevIds());
|
||||
sourceParam.setIsPhaseSequence(SourceOperateCodeEnum.PHASE_TEST.getValue());
|
||||
sourceParam.setIsPhaseSequence(CommonEnum.PHASE_TEST.getValue());
|
||||
sourceParam.setScriptId(param.getScriptId());
|
||||
sourceParam.setSourceId(param.getSourceId());
|
||||
List<SourceIssue> sourceIssues = scriptDtlsService.listSourceIssue(sourceParam);
|
||||
@@ -1091,12 +1103,8 @@ public class SocketDevResponseService {
|
||||
successComm.clear();
|
||||
}
|
||||
|
||||
|
||||
if (param.getOperateType().equals(SourceOperateCodeEnum.PRE_TEST.getValue())) {
|
||||
System.out.println("预检测流程结束-----------------关闭源");
|
||||
//同时关闭设备三个步骤
|
||||
CnSocketUtil.quitSend(param);
|
||||
} else if (param.getOperateType().equals(SourceOperateCodeEnum.COEFFICIENT_TEST.getValue()) || param.getOperateType().equals(SourceOperateCodeEnum.FAST_TEST.getValue())) {
|
||||
// 后续做系数校准
|
||||
if (param.getTestItemList().get(1)) {
|
||||
WebSocketVO<Object> webSocketVO = new WebSocketVO<>();
|
||||
webSocketVO.setRequestId(SourceOperateCodeEnum.Coefficient_Check.getValue());
|
||||
webSocketVO.setOperateCode(SourceOperateCodeEnum.big_start.getValue());
|
||||
@@ -1120,8 +1128,66 @@ public class SocketDevResponseService {
|
||||
XiNumberManager.smallDevXiNumDataMap.clear();
|
||||
|
||||
System.out.println("开始系数校准》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》");
|
||||
}
|
||||
} else if (param.getTestItemList().get(2)) {
|
||||
// 后续做正式检测
|
||||
PqScriptIssueParam issueParam = new PqScriptIssueParam();
|
||||
issueParam.setPlanId(param.getPlanId());
|
||||
issueParam.setSourceId(param.getSourceId());
|
||||
issueParam.setDevIds(param.getDevIds());
|
||||
issueParam.setScriptId(param.getScriptId());
|
||||
|
||||
if (param.getOperateType().equals(SourceOperateCodeEnum.RE_ERROR_TEST.getValue())) {
|
||||
//不合格项复检
|
||||
Set<Integer> indexes = new HashSet<>();
|
||||
StorageParam storageParam = new StorageParam();
|
||||
storageParam.setCode(param.getCode());
|
||||
storageParam.setScriptId(param.getScriptId());
|
||||
param.getDevIds().forEach(devId -> {
|
||||
storageParam.setDevId(devId);
|
||||
indexes.addAll(adHarmonicService.getIndex(storageParam));
|
||||
});
|
||||
issueParam.setIndexList(indexes.stream().collect(Collectors.toList()));
|
||||
issueParam.setIsPhaseSequence(SourceOperateCodeEnum.RE_ERROR_TEST.getValue());
|
||||
} else {
|
||||
issueParam.setIsPhaseSequence(CommonEnum.FORMAL_TEST.getValue());
|
||||
}
|
||||
//正式检测
|
||||
sourceIssues = pqScriptDtlsService.listSourceIssue(issueParam);
|
||||
sourceIssues = sourceIssues.stream().sorted(Comparator.comparing(SourceIssue::getIndex)).collect(Collectors.toList());
|
||||
// 使用 LinkedHashMap 保持分组顺序
|
||||
Map<String, List<SourceIssue>> groupedIssues = sourceIssues.stream()
|
||||
.collect(Collectors.groupingBy(
|
||||
SourceIssue::getType,
|
||||
LinkedHashMap::new,
|
||||
Collectors.toList()
|
||||
));
|
||||
|
||||
// 将分组后的元素合并成一个新的集合,保持原有顺序
|
||||
sourceIssues = groupedIssues.values().stream()
|
||||
.flatMap(List::stream)
|
||||
.collect(Collectors.toList());
|
||||
// 存放所有检测小项
|
||||
SocketManager.addSourceList(sourceIssues);
|
||||
// 按照大项分组。key为大项code,value为小项个数
|
||||
Map<String, Long> sourceIssueMap = sourceIssues.stream().collect(Collectors.groupingBy(SourceIssue::getType, Collectors.counting()));
|
||||
SocketManager.initMap(sourceIssueMap);
|
||||
|
||||
socketMsg.setData(JSON.toJSONString(sourceIssues.get(0)));
|
||||
socketMsg.setRequestId(SourceOperateCodeEnum.FORMAL_REAL.getValue() + stepTag + sourceIssues.get(0).getType());
|
||||
socketMsg.setOperateCode(SourceOperateCodeEnum.OPER_GATHER.getValue());
|
||||
SocketManager.sendMsg(param.getUserPageId() + handlerSourceStr, JSON.toJSONString(socketMsg));
|
||||
|
||||
//告诉前端当前项开始了
|
||||
WebSocketVO<Object> webSocketVO = new WebSocketVO<>();
|
||||
webSocketVO.setRequestId(sourceIssues.get(0).getType() + stepBegin);
|
||||
webSocketVO.setDesc(null);
|
||||
WebServiceManager.sendMsg(param.getUserPageId(), JSON.toJSONString(webSocketVO));
|
||||
} else {
|
||||
//后续什么都不做
|
||||
System.out.println("预检测流程结束-----------------关闭源");
|
||||
//同时关闭设备三个步骤
|
||||
CnSocketUtil.quitSend(param);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
System.out.println("相序校验被抛除的数据:" + data);
|
||||
@@ -1679,7 +1745,7 @@ public class SocketDevResponseService {
|
||||
//字典树
|
||||
SocketManager.valueTypeMap = iPqScriptCheckDataService.getValueTypeMap(param.getScriptId());
|
||||
|
||||
if (param.getOperateType().equals(SourceOperateCodeEnum.COEFFICIENT_TEST.getValue()) || param.getOperateType().equals(SourceOperateCodeEnum.FAST_TEST.getValue())) {
|
||||
if (param.getTestItemList().get(1)) {
|
||||
initXiManager(param);
|
||||
}
|
||||
|
||||
@@ -1710,7 +1776,7 @@ public class SocketDevResponseService {
|
||||
issueParam.setSourceId(param.getSourceId());
|
||||
issueParam.setDevIds(param.getDevIds());
|
||||
issueParam.setScriptId(param.getScriptId());
|
||||
issueParam.setIsPhaseSequence(SourceOperateCodeEnum.COEFFICIENT_TEST.getValue());
|
||||
issueParam.setIsPhaseSequence(CommonEnum.COEFFICIENT_TEST.getValue());
|
||||
issueParam.setIndexList(Stream.of(-2, -3).collect(Collectors.toList()));
|
||||
List<SourceIssue> sourceIssues = pqScriptDtlsService.listSourceIssue(issueParam);
|
||||
for (int j = 0; j < sourceIssues.size(); j++) {
|
||||
|
||||
@@ -70,17 +70,18 @@ public enum SourceOperateCodeEnum {
|
||||
/**
|
||||
*
|
||||
*/
|
||||
COEFFICIENT_TEST("0","系数校验"),
|
||||
PRE_TEST("1","预检测"),
|
||||
FORMAL_TEST("2","正式检测"),
|
||||
TIME_TEST("3","守时检测"),
|
||||
PHASE_TEST("4","相序检测"),
|
||||
TEST_TEM_STOP("5","临时停止"),
|
||||
TEST_TEM_START("6","继续检测"),
|
||||
TEST_STOP("7","停止检测"),
|
||||
RE_ERROR_TEST("8","不合格项复检"),
|
||||
SIMULATE_TEST("9","模拟检测"),
|
||||
FAST_TEST("10","一键检测"),
|
||||
// COEFFICIENT_TEST("0","系数校验"),
|
||||
// PRE_TEST("1","预检测"),
|
||||
// FORMAL_TEST("2","正式检测"),
|
||||
// TIME_TEST("3","守时检测"),
|
||||
// PHASE_TEST("4","相序检测"),
|
||||
// TEST_TEM_STOP("5","临时停止"),
|
||||
ALL_TEST("1","全部检测"),
|
||||
RE_ERROR_TEST("2","不合格项复检"),
|
||||
TEST_TEM_START("3","继续检测"),
|
||||
SIMULATE_TEST("4","模拟检测"),
|
||||
//TEST_STOP("7","停止检测"),
|
||||
//FAST_TEST("10","一键检测"),
|
||||
|
||||
/**
|
||||
* 系数校验步骤
|
||||
|
||||
@@ -14,10 +14,7 @@ import java.util.List;
|
||||
@Data
|
||||
public class PreDetectionParam {
|
||||
|
||||
/**
|
||||
* 操作类型 0.预检测 1.正式检测 2.系数校验
|
||||
*/
|
||||
private String operateType = "0";
|
||||
private String operateType;
|
||||
|
||||
/**
|
||||
* 检测计划id
|
||||
@@ -75,4 +72,9 @@ public class PreDetectionParam {
|
||||
* 相对湿度
|
||||
*/
|
||||
private Float humidity;
|
||||
|
||||
/**
|
||||
* 检测项列表。第一个元素为预检测、第二个元素为系数校准、第三个元素为正式检测
|
||||
*/
|
||||
private List<Boolean> testItemList;
|
||||
}
|
||||
|
||||
@@ -14,11 +14,11 @@ import com.njcn.common.pojo.enums.common.DataStateEnum;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.common.utils.PubUtils;
|
||||
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.detection.pojo.po.DevData;
|
||||
import com.njcn.gather.detection.pojo.vo.DetectionData;
|
||||
import com.njcn.gather.detection.service.impl.DetectionServiceImpl;
|
||||
import com.njcn.gather.device.pojo.enums.CommonEnum;
|
||||
import com.njcn.gather.device.service.IPqDevService;
|
||||
import com.njcn.gather.plan.pojo.po.AdPlan;
|
||||
import com.njcn.gather.plan.service.IAdPlanService;
|
||||
@@ -54,7 +54,6 @@ import com.njcn.gather.storage.pojo.po.AdNonHarmonicResult;
|
||||
import com.njcn.gather.storage.pojo.vo.RawDataVO;
|
||||
import com.njcn.gather.storage.service.AdHarmonicService;
|
||||
import com.njcn.gather.storage.service.AdNonHarmonicService;
|
||||
import com.njcn.gather.system.cfg.service.ISysTestConfigService;
|
||||
import com.njcn.gather.system.dictionary.pojo.enums.DictDataEnum;
|
||||
import com.njcn.gather.system.dictionary.pojo.po.DictData;
|
||||
import com.njcn.gather.system.dictionary.pojo.po.DictTree;
|
||||
@@ -1612,7 +1611,7 @@ public class ResultServiceImpl implements IResultService {
|
||||
|
||||
issueParam.setDevIds(Arrays.asList(devId));
|
||||
issueParam.setScriptId(scriptId);
|
||||
issueParam.setIsPhaseSequence(SourceOperateCodeEnum.FORMAL_TEST.getValue());
|
||||
issueParam.setIsPhaseSequence(CommonEnum.FORMAL_TEST.getValue());
|
||||
List<SourceIssue> sourceIssues = pqScriptDtlsService.listSourceIssue(issueParam);
|
||||
|
||||
sourceIssues.forEach(sourceIssue -> {
|
||||
|
||||
@@ -706,7 +706,7 @@ public class PqScriptDtlsServiceImpl extends ServiceImpl<PqScriptDtlsMapper, PqS
|
||||
issueParam.setSourceId(param.getSourceId());
|
||||
issueParam.setDevIds(param.getDevIds());
|
||||
issueParam.setScriptId(param.getScriptId());
|
||||
issueParam.setIsPhaseSequence(SourceOperateCodeEnum.FORMAL_TEST.getValue());
|
||||
issueParam.setIsPhaseSequence(CommonEnum.FORMAL_TEST.getValue());
|
||||
List<SourceIssue> sourceIssues = this.listSourceIssue(issueParam);
|
||||
|
||||
Set<String> dataTypeSet = new HashSet<>();
|
||||
|
||||
Reference in New Issue
Block a user