正式检测检测增加回退状态,推送消息优化
This commit is contained in:
@@ -3,6 +3,7 @@ package com.njcn.gather.detection.handler;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
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.njcn.gather.detection.pojo.dto.DevXiNumData;
|
||||
import com.njcn.gather.detection.pojo.enums.SourceOperateCodeEnum;
|
||||
@@ -774,6 +775,7 @@ public class SocketDevResponseService {
|
||||
sourceParam.setPlanId(param.getPlanId());
|
||||
sourceParam.setDevIds(param.getDevIds());
|
||||
sourceParam.setIsPhaseSequence(SourceOperateCodeEnum.PHASE_TEST.getValue());
|
||||
sourceParam.setScriptId(param.getScriptId());
|
||||
sourceParam.setSourceId(param.getSourceId());
|
||||
List<SourceIssue> sourceIssues = scriptDtlsService.listSourceIssue(sourceParam);
|
||||
List<SourceCompareDev> info = new ArrayList<>();
|
||||
@@ -883,23 +885,15 @@ public class SocketDevResponseService {
|
||||
//TODO 理论上遇到返回code10200的数量与监测点数量一致则认为数据返回结束,但是会存在缺失数据情况,例如有部分装置是没有暂降功能的
|
||||
System.out.println(sourceIssue.getType() + splitTag + sourceIssue.getIndex() + "当前测试小项读取数据已经全部结束。。。。。。。。。");
|
||||
//修改装置为监测中
|
||||
iPqDevService.updateCheckState(param.getDevIds());
|
||||
adPlanService.updateTestState(param.getPlanId());
|
||||
adPlanService.updateTestState(param.getPlanId(), param.getDevIds());
|
||||
//开启线程进行入库原始数据操作
|
||||
baseDataInsert(realDataXiList, sourceIssue, param, SocketManager.valueTypeMap);
|
||||
|
||||
//调用判断方法
|
||||
Map<String, Integer> textResult = detectionServiceImpl.processing(realDataXiList, param, FormalTestManager.devIdMapComm, sourceIssue, dataRule);
|
||||
|
||||
long tem = SocketManager.getSourceTarget(sourceIssue.getType()) - 1;
|
||||
SocketManager.addTargetMap(sourceIssue.getType(), tem);
|
||||
System.out.println("该大项还有" + tem + "个小项没有进行检测!!!!!!!!");
|
||||
|
||||
if (tem == 0) {
|
||||
System.out.println(sourceIssue.getType() + sourceIssue.getIndex() + "当前测试大项已经全部结束》》》》》》》》");
|
||||
//当val为0则认为大项中的小项已经全部跑完,开始组装信息推送给前端
|
||||
WebSocketVO<List<DevLineTestResult>> webSocketVO = new WebSocketVO<>();
|
||||
webSocketVO.setRequestId(socketDataMsg.getRequestId().split(stepTag)[1] + stepEnd);
|
||||
webSocketVO.setDesc(sourceIssue.getDesc());
|
||||
//组装实体推送给前台
|
||||
List<DevLineTestResult> devListRes = new ArrayList<>();
|
||||
FormalTestManager.devList.forEach(dev -> {
|
||||
@@ -918,6 +912,19 @@ public class SocketDevResponseService {
|
||||
});
|
||||
webSocketVO.setData(devListRes);
|
||||
webSocketHandler.sendMsgToUser(param.getUserPageId(), JSON.toJSONString(webSocketVO));
|
||||
|
||||
|
||||
|
||||
long tem = SocketManager.getSourceTarget(sourceIssue.getType()) - 1;
|
||||
SocketManager.addTargetMap(sourceIssue.getType(), tem);
|
||||
System.out.println("该大项还有" + tem + "个小项没有进行检测!!!!!!!!");
|
||||
|
||||
if (tem == 0) {
|
||||
System.out.println(sourceIssue.getType() + sourceIssue.getIndex() + "当前测试大项已经全部结束》》》》》》》》");
|
||||
//当val为0则认为大项中的小项已经全部跑完,开始组装信息推送给前端
|
||||
webSocketVO = new WebSocketVO<>();
|
||||
webSocketVO.setRequestId(socketDataMsg.getRequestId().split(stepTag)[1] + stepEnd);
|
||||
webSocketHandler.sendMsgToUser(param.getUserPageId(), JSON.toJSONString(webSocketVO));
|
||||
}
|
||||
System.out.println("当前小项结束进行删除============" + sourceIssue.getType() + splitTag + sourceIssue.getIndex());
|
||||
|
||||
@@ -1345,11 +1352,11 @@ public class SocketDevResponseService {
|
||||
|
||||
if (CollUtil.isNotEmpty(adNonHarmonicResultList)) {
|
||||
Map<String, List<AdNonHarmonicResult>> map = adNonHarmonicResultList.stream().collect(Collectors.groupingBy(x -> x.getMonitorId() + x.getTimeId() + x.getScriptId() + x.getSort() + x.getAdType() + x.getDataType()));
|
||||
List<AdNonHarmonicResult> info=new ArrayList<>();
|
||||
map.forEach((key,value)->{
|
||||
if(value.size()>1){
|
||||
System.err.println("重复时间戳->"+key+value);
|
||||
}else{
|
||||
List<AdNonHarmonicResult> info = new ArrayList<>();
|
||||
map.forEach((key, value) -> {
|
||||
if (value.size() > 1) {
|
||||
System.err.println("重复时间戳->" + key + value);
|
||||
} else {
|
||||
info.addAll(value);
|
||||
}
|
||||
});
|
||||
@@ -1358,11 +1365,11 @@ public class SocketDevResponseService {
|
||||
}
|
||||
if (CollUtil.isNotEmpty(adHarmonicResultList)) {
|
||||
Map<String, List<AdHarmonicResult>> map = adHarmonicResultList.stream().collect(Collectors.groupingBy(x -> x.getMonitorId() + x.getTimeId() + x.getScriptId() + x.getSort() + x.getAdType() + x.getDataType()));
|
||||
List<AdHarmonicResult> info=new ArrayList<>();
|
||||
map.forEach((key,value)->{
|
||||
if(value.size()>1){
|
||||
System.err.println("重复时间戳->"+key+value);
|
||||
}else{
|
||||
List<AdHarmonicResult> info = new ArrayList<>();
|
||||
map.forEach((key, value) -> {
|
||||
if (value.size() > 1) {
|
||||
System.err.println("重复时间戳->" + key + value);
|
||||
} else {
|
||||
info.addAll(value);
|
||||
}
|
||||
});
|
||||
@@ -1404,5 +1411,10 @@ public class SocketDevResponseService {
|
||||
webSocketHandler.sendMsgToUser(userId, JSON.toJSONString(webSocketVO));
|
||||
}
|
||||
|
||||
public void backCheckState(PreDetectionParam param) {
|
||||
if (CollUtil.isNotEmpty(param.getDevIds()) && StrUtil.isNotBlank(param.getPlanId())) {
|
||||
adPlanService.updateBackTestState(param.getPlanId(),param.getDevIds());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -34,9 +34,8 @@ public class CnSocketUtil {
|
||||
socketMsg.setRequestId(SourceOperateCodeEnum.QUITE_SOURCE.getValue());
|
||||
socketMsg.setOperateCode(SourceOperateCodeEnum.CLOSE_GATHER.getValue());
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("sourceId",param.getSourceId());
|
||||
jsonObject.put("sourceId", param.getSourceId());
|
||||
socketMsg.setData(jsonObject.toJSONString());
|
||||
SocketManager.sendMsg(param.getUserPageId() + sourceTag, JSON.toJSONString(socketMsg));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -96,9 +96,18 @@ public interface IAdPlanService extends IService<AdPlan> {
|
||||
/**
|
||||
* 修改计划状态
|
||||
* @param planId
|
||||
* @param devIds
|
||||
* @return
|
||||
*/
|
||||
boolean updateTestState(String planId);
|
||||
boolean updateTestState(String planId,List<String> devIds);
|
||||
|
||||
/**
|
||||
* 数据状态回退
|
||||
* @param planId
|
||||
* @param devIds
|
||||
* @return
|
||||
*/
|
||||
boolean updateBackTestState(String planId,List<String> devIds);
|
||||
|
||||
void finishPlan(String planId);
|
||||
}
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
package com.njcn.gather.plan.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
@@ -331,10 +333,31 @@ public class AdPlanServiceImpl extends ServiceImpl<AdPlanMapper, AdPlan> impleme
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean updateTestState(String planId) {
|
||||
public boolean updateTestState(String planId, List<String> devIds) {
|
||||
if (CollUtil.isNotEmpty(devIds)) {
|
||||
pqDevService.update(new LambdaUpdateWrapper<PqDev>()
|
||||
.set(PqDev::getCheckState, CheckStateEnum.CHECKING.getValue())
|
||||
.in(PqDev::getId, devIds));
|
||||
}
|
||||
return this.update(new LambdaUpdateWrapper<AdPlan>()
|
||||
.set(AdPlan::getTestState,CheckStateEnum.CHECKING.getValue())
|
||||
.eq(AdPlan::getId,planId));
|
||||
.set(AdPlan::getTestState, CheckStateEnum.CHECKING.getValue())
|
||||
.eq(AdPlan::getId, planId));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean updateBackTestState(String planId, List<String> devIds) {
|
||||
pqDevService.update(new LambdaUpdateWrapper<PqDev>()
|
||||
.set(PqDev::getCheckState, CheckStateEnum.UNCHECKED.getValue())
|
||||
.in(PqDev::getId, devIds));
|
||||
|
||||
List<PqDev> list = pqDevService.list(new LambdaQueryWrapper<PqDev>().in(PqDev::getPlanId, planId));
|
||||
List<PqDev> collect = list.stream().filter(x -> !x.getCheckState().equals(CheckStateEnum.UNCHECKED.getValue())).collect(Collectors.toList());
|
||||
if (CollUtil.isEmpty(collect)) {
|
||||
return this.update(new LambdaUpdateWrapper<AdPlan>()
|
||||
.set(AdPlan::getTestState, CheckStateEnum.UNCHECKED.getValue())
|
||||
.eq(AdPlan::getId, planId));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -9,12 +9,12 @@ import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateDeserializer;
|
||||
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateSerializer;
|
||||
import com.njcn.db.mybatisplus.bo.BaseEntity;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* @author caozehui
|
||||
@@ -206,6 +206,7 @@ public class PqDev extends BaseEntity implements Serializable {
|
||||
|
||||
private String icdId;
|
||||
|
||||
// private String power;
|
||||
@TableField("Check_Time")
|
||||
private LocalDateTime checkTime;
|
||||
}
|
||||
|
||||
|
||||
@@ -172,12 +172,6 @@ public interface IPqDevService extends IService<PqDev> {
|
||||
*/
|
||||
boolean documented(List<String> id);
|
||||
|
||||
/**
|
||||
* 修改监测状态
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
boolean updateCheckState(List<String> ids);
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -39,6 +39,7 @@ import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@@ -435,7 +436,7 @@ public class PqDevServiceImpl extends ServiceImpl<PqDevMapper, PqDev> implements
|
||||
monitorListDTO.setLineId(preDetection.getDevIP() + "_" + i);
|
||||
monitorListDTO.setLine(i);
|
||||
monitorListDTO.setPt(1);
|
||||
monitorListDTO.setPt(1);
|
||||
monitorListDTO.setCt(1);
|
||||
monitorList.add(monitorListDTO);
|
||||
}
|
||||
preDetection.setMonitorList(monitorList);
|
||||
@@ -483,16 +484,6 @@ public class PqDevServiceImpl extends ServiceImpl<PqDevMapper, PqDev> implements
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean updateCheckState(List<String> ids) {
|
||||
if (CollUtil.isNotEmpty(ids)) {
|
||||
return this.update(new LambdaUpdateWrapper<PqDev>()
|
||||
.set(PqDev::getCheckState, CheckStateEnum.CHECKING.getValue())
|
||||
.in(PqDev::getId, ids));
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean updateResult(List<String> ids, String code) {
|
||||
@@ -505,6 +496,7 @@ public class PqDevServiceImpl extends ServiceImpl<PqDevMapper, PqDev> implements
|
||||
.set(PqDev::getReCheckNum, pqDev.getReCheckNum() + 1)
|
||||
.set(PqDev::getCheckState, CheckStateEnum.CHECKED.getValue())
|
||||
.set(PqDev::getCheckResult, result.get(pqDev.getId()))
|
||||
.set(PqDev::getCheckTime, LocalDateTime.now())
|
||||
.set(PqDev::getReportState, DevReportStateEnum.NOT_GENERATED.getValue())
|
||||
.eq(PqDev::getId, pqDev.getId()));
|
||||
}
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
package com.njcn.gather.storage.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||
import com.njcn.db.mybatisplus.handler.DynamicTableNameHandler;
|
||||
import com.njcn.db.mybatisplus.service.impl.ReplenishMybatisServiceImpl;
|
||||
import com.njcn.gather.storage.mapper.DetectionDataDealMapper;
|
||||
@@ -133,6 +131,7 @@ public class DetectionDataServiceImpl extends ReplenishMybatisServiceImpl<Detect
|
||||
|
||||
private static Integer isResultFlag(List<Integer> resultFlags) {
|
||||
// 检测结果(0:不符合 1:符合 2:/[未检测无结果])
|
||||
//脚本结果是 1.符合 2.不符合 4.未检测无结果
|
||||
resultFlags = resultFlags.stream().filter(x->4!=x).distinct().collect(Collectors.toList());
|
||||
if (CollUtil.isNotEmpty(resultFlags)) {
|
||||
if (resultFlags.contains(2)) {
|
||||
|
||||
Reference in New Issue
Block a user