设备、计划状态修改

This commit is contained in:
caozehui
2025-10-16 15:40:20 +08:00
parent 15e93b6734
commit 66786200bd
5 changed files with 71 additions and 64 deletions

View File

@@ -5,9 +5,7 @@ import com.njcn.gather.detection.pojo.enums.SourceOperateCodeEnum;
import com.njcn.gather.detection.pojo.param.PreDetectionParam;
import com.njcn.gather.detection.util.socket.CnSocketUtil;
import com.njcn.gather.detection.util.socket.FormalTestManager;
import com.njcn.gather.detection.util.socket.SocketManager;
import com.njcn.gather.device.pojo.enums.PatternEnum;
import com.njcn.gather.plan.pojo.enums.DataSourceEnum;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.SimpleChannelInboundHandler;
import io.netty.handler.codec.CorruptedFrameException;
@@ -373,40 +371,43 @@ public class WebSocketHandler extends SimpleChannelInboundHandler<TextWebSocketF
// 使用该用户的检测参数关闭Socket连接
log.info("使用用户检测参数关闭Socket连接userId: {}", userId);
if (FormalTestManager.patternEnum.equals(PatternEnum.CONTRAST)) {
if (FormalTestManager.isRemoveSocket) {
boolean channelActive = SocketManager.isChannelActive(preDetectionParam.getUserPageId() + CnSocketUtil.CONTRAST_DEV_TAG);
if (channelActive) {
SocketManager.removeUser(preDetectionParam.getUserPageId() + CnSocketUtil.CONTRAST_DEV_TAG);
}
} else {
if (FormalTestManager.currentStep == SourceOperateCodeEnum.RECORD_WAVE_STEP1) {
CnSocketUtil.contrastSendquit(preDetectionParam.getUserPageId(), SourceOperateCodeEnum.QUIT_INIT_03, false);
} else if (FormalTestManager.currentStep != SourceOperateCodeEnum.QUITE) {
if (ObjectUtil.isNotNull(FormalTestManager.nonWaveDataSourceEnum)) {
if (FormalTestManager.nonWaveDataSourceEnum == DataSourceEnum.REAL_DATA) {
CnSocketUtil.contrastSendquit(preDetectionParam.getUserPageId(), SourceOperateCodeEnum.QUIT_INIT_02, false);
if (FormalTestManager.statisticsProtocol) {
CnSocketUtil.contrastSendquit(preDetectionParam.getUserPageId(), SourceOperateCodeEnum.QUIT_INIT_01, false);
}
} else {
CnSocketUtil.contrastSendquit(preDetectionParam.getUserPageId(), SourceOperateCodeEnum.QUIT_INIT_01, false);
}
if (FormalTestManager.isWaveCheck) {
CnSocketUtil.contrastSendquit(preDetectionParam.getUserPageId(), SourceOperateCodeEnum.QUIT_INIT_03, false);
}
} else {
if (FormalTestManager.statisticsProtocol) {
CnSocketUtil.contrastSendquit(preDetectionParam.getUserPageId(), SourceOperateCodeEnum.QUIT_INIT_01, false);
}
if (FormalTestManager.isWaveCheck) {
CnSocketUtil.contrastSendquit(preDetectionParam.getUserPageId(), SourceOperateCodeEnum.QUIT_INIT_02, false);
CnSocketUtil.contrastSendquit(preDetectionParam.getUserPageId(), SourceOperateCodeEnum.QUIT_INIT_03, false);
}
}
} else {
SocketManager.removeUser(preDetectionParam.getUserPageId() + CnSocketUtil.CONTRAST_DEV_TAG);
}
}
// if (FormalTestManager.isRemoveSocket) {
// boolean channelActive = SocketManager.isChannelActive(preDetectionParam.getUserPageId() + CnSocketUtil.CONTRAST_DEV_TAG);
// if (channelActive) {
// SocketManager.removeUser(preDetectionParam.getUserPageId() + CnSocketUtil.CONTRAST_DEV_TAG);
// }
// } else {
// if (FormalTestManager.currentStep == SourceOperateCodeEnum.RECORD_WAVE_STEP1) {
// CnSocketUtil.contrastSendquit(preDetectionParam.getUserPageId(), SourceOperateCodeEnum.QUIT_INIT_03, false);
// } else if (FormalTestManager.currentStep != SourceOperateCodeEnum.QUITE) {
// if (ObjectUtil.isNotNull(FormalTestManager.nonWaveDataSourceEnum)) {
// if (FormalTestManager.nonWaveDataSourceEnum == DataSourceEnum.REAL_DATA) {
// CnSocketUtil.contrastSendquit(preDetectionParam.getUserPageId(), SourceOperateCodeEnum.QUIT_INIT_02, false);
// if (FormalTestManager.statisticsProtocol) {
// CnSocketUtil.contrastSendquit(preDetectionParam.getUserPageId(), SourceOperateCodeEnum.QUIT_INIT_01, false);
// }
// } else {
// CnSocketUtil.contrastSendquit(preDetectionParam.getUserPageId(), SourceOperateCodeEnum.QUIT_INIT_01, false);
// }
// if (FormalTestManager.isWaveCheck) {
// CnSocketUtil.contrastSendquit(preDetectionParam.getUserPageId(), SourceOperateCodeEnum.QUIT_INIT_03, false);
// }
// } else {
// if (FormalTestManager.statisticsProtocol) {
// CnSocketUtil.contrastSendquit(preDetectionParam.getUserPageId(), SourceOperateCodeEnum.QUIT_INIT_01, false);
// }
// if (FormalTestManager.isWaveCheck) {
// CnSocketUtil.contrastSendquit(preDetectionParam.getUserPageId(), SourceOperateCodeEnum.QUIT_INIT_02, false);
// CnSocketUtil.contrastSendquit(preDetectionParam.getUserPageId(), SourceOperateCodeEnum.QUIT_INIT_03, false);
// }
// }
// } else {
// SocketManager.removeUser(preDetectionParam.getUserPageId() + CnSocketUtil.CONTRAST_DEV_TAG);
// }
// }
} else {
CnSocketUtil.quitSendSource(preDetectionParam);
CnSocketUtil.quitSend(preDetectionParam);

View File

@@ -35,6 +35,7 @@ import com.njcn.gather.monitor.pojo.po.PqMonitor;
import com.njcn.gather.monitor.pojo.vo.PqMonitorExcel;
import com.njcn.gather.monitor.service.IPqMonitorService;
import com.njcn.gather.pojo.enums.DetectionResponseEnum;
import com.njcn.gather.report.pojo.enums.ReportResponseEnum;
import com.njcn.gather.storage.service.DetectionDataDealService;
import com.njcn.gather.system.cfg.pojo.enums.SceneEnum;
import com.njcn.gather.system.cfg.pojo.po.SysTestConfig;
@@ -535,6 +536,7 @@ public class PqDevServiceImpl extends ServiceImpl<PqDevMapper, PqDev> implements
LambdaUpdateChainWrapper<PqDevSub> w = pqDevSubService.lambdaUpdate()
.set(PqDevSub::getCheckState, checkState)
.set(PqDevSub::getCheckResult, checkResult)
.set(PqDevSub::getReportState, DevReportStateEnum.NOT_GENERATED.getValue())
.set(PqDevSub::getCheckTime, LocalDateTime.now())
.eq(PqDevSub::getDevId, devId);
@@ -552,7 +554,13 @@ public class PqDevServiceImpl extends ServiceImpl<PqDevMapper, PqDev> implements
List<PqDevVO> pqDevVOList = this.baseMapper.selectByQueryParam(param);
if (CollUtil.isNotEmpty(pqDevVOList)) {
Set<Integer> set = pqDevVOList.stream().map(PqDevVO::getCheckResult).collect(Collectors.toSet());
Set<Integer> set = pqDevVOList.stream().filter(obj -> CheckStateEnum.CHECKED.getValue().equals(obj.getCheckState()) || CheckStateEnum.DOCUMENTED.getValue().equals(obj.getCheckState())).map(PqDevVO::getCheckResult).collect(Collectors.toSet());
if (checkState == CheckStateEnum.CHECKED.getValue()) {
set.add(checkResult);
}
if (CollUtil.isEmpty(set)) {
this.baseMapper.updatePlanCheckResult(planId, CheckResultEnum.UNCHECKED.getValue());
} else {
if (set.contains(CheckResultEnum.NOT_ACCORD.getValue())) {
this.baseMapper.updatePlanCheckResult(planId, CheckResultEnum.NOT_ACCORD.getValue());
} else if (set.contains(CheckResultEnum.UNCHECKED.getValue())) {
@@ -560,6 +568,8 @@ public class PqDevServiceImpl extends ServiceImpl<PqDevMapper, PqDev> implements
} else {
this.baseMapper.updatePlanCheckResult(planId, CheckResultEnum.ACCORD.getValue());
}
}
set = pqDevVOList.stream().map(PqDevVO::getCheckState).collect(Collectors.toSet());
if (set.contains(CheckStateEnum.UNCHECKED.getValue())) {

View File

@@ -207,7 +207,7 @@ public class AdPlanServiceImpl extends ServiceImpl<AdPlanMapper, AdPlan> impleme
}
List<PqDevVO> pqDevVOList = pqDevMapper.selectByQueryParam(queryParam1);
if (CollUtil.isNotEmpty(pqDevVOList)) {
long count = pqDevVOList.stream().filter(pqDev -> CheckStateEnum.CHECKED.getValue().equals(pqDev.getCheckState())).count();
long count = pqDevVOList.stream().filter(pqDev -> CheckStateEnum.CHECKED.getValue().equals(pqDev.getCheckState()) || CheckStateEnum.DOCUMENTED.getValue().equals(pqDev.getCheckState())).count();
adPlanVO.setProgress((float) count / pqDevVOList.size());
} else {
adPlanVO.setProgress(0.0f);
@@ -531,7 +531,7 @@ public class AdPlanServiceImpl extends ServiceImpl<AdPlanMapper, AdPlan> impleme
@Override
public List<Map<String, Object>> listByPattern(String pattern) {
List<AdPlan> adPlanList = this.lambdaQuery().eq(AdPlan::getPattern, pattern).eq(AdPlan::getState, DataStateEnum.ENABLE.getCode()).list();
List<AdPlan> adPlanList = this.lambdaQuery().eq(AdPlan::getPattern, pattern).eq(AdPlan::getState, DataStateEnum.ENABLE.getCode()).orderByDesc(AdPlan::getCreateTime).list();
Map<Integer, List<AdPlan>> map1 = adPlanList.stream().collect(Collectors.groupingBy(AdPlan::getTestState));
List<Map<String, Object>> result = new ArrayList<>();

View File

@@ -89,7 +89,6 @@ import org.docx4j.jaxb.Context;
import org.docx4j.openpackaging.packages.WordprocessingMLPackage;
import org.docx4j.openpackaging.parts.WordprocessingML.MainDocumentPart;
import org.docx4j.wml.*;
import org.docx4j.wml.Color;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.io.ClassPathResource;
@@ -571,7 +570,6 @@ public class PqReportServiceImpl extends ServiceImpl<PqReportMapper, PqReport> i
/**
*
* 根据设备类型生成报告
* 注:该方法目前仅支持楼下出厂检测场景,属于模板占位符替换方式,后期可能会有调整
*
@@ -1065,7 +1063,6 @@ public class PqReportServiceImpl extends ServiceImpl<PqReportMapper, PqReport> i
* 实时数据3秒数据150周波数据
* 录波:录波数据
* 分钟统计数据:分钟统计数据-最大值、分钟统计数据-最小值、分钟统计数据-平均值、分钟统计数据-CP95值
*
*/
private String getDataTypeFromParam(AdPlan adPlan) {
String dataSource = adPlan.getDatasourceId();
@@ -1879,12 +1876,12 @@ public class PqReportServiceImpl extends ServiceImpl<PqReportMapper, PqReport> i
for (int i = 0; i < pqDevVOList.size(); i++) {
pqDevVO = pqDevVOList.get(i);
tempPqDevVO = pqDevVO;
if (!pqDevVO.getCheckState().equals(CheckStateEnum.CHECKED.getValue())) {
throw new BusinessException(DetectionResponseEnum.DEV_UN_CHECKED);
}
if (!pqDevVO.getReportState().equals(DevReportStateEnum.GENERATED.getValue())) {
devIds.add(pqDevVO.getId());
tempPqDevVO = pqDevVO;
}
}
@@ -1986,7 +1983,6 @@ public class PqReportServiceImpl extends ServiceImpl<PqReportMapper, PqReport> i
}
/**
*
* 比对模式下需要获取的数据
* 处理基础模版中的信息,非数据页报告
* 因为Docx4j工具包替换时会默认增加${}