向前端推送暂降点
This commit is contained in:
@@ -54,6 +54,8 @@ public class SocketFreqConverterDevService {
|
|||||||
private String monitorId;
|
private String monitorId;
|
||||||
private String userId;
|
private String userId;
|
||||||
|
|
||||||
|
public static final String DIP_DATA_SUFFIX = "&&VOLTAGE";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 连接设备Socket
|
* 连接设备Socket
|
||||||
*
|
*
|
||||||
@@ -224,7 +226,7 @@ public class SocketFreqConverterDevService {
|
|||||||
|
|
||||||
private void sendGetDipDataMsg(String devTag) {
|
private void sendGetDipDataMsg(String devTag) {
|
||||||
SocketMsg<String> socketMsg = new SocketMsg<>();
|
SocketMsg<String> socketMsg = new SocketMsg<>();
|
||||||
socketMsg.setRequestId(SourceOperateCodeEnum.FORMAL_REAL.getValue() + "&&VOLTAGE");
|
socketMsg.setRequestId(SourceOperateCodeEnum.FORMAL_REAL.getValue() + DIP_DATA_SUFFIX);
|
||||||
socketMsg.setOperateCode(SourceOperateCodeEnum.OPER_GATHER.getValue());
|
socketMsg.setOperateCode(SourceOperateCodeEnum.OPER_GATHER.getValue());
|
||||||
|
|
||||||
DevPhaseSequenceParam phaseSequenceParam = new DevPhaseSequenceParam();
|
DevPhaseSequenceParam phaseSequenceParam = new DevPhaseSequenceParam();
|
||||||
@@ -309,8 +311,7 @@ public class SocketFreqConverterDevService {
|
|||||||
testRes.setStartTime(lastStatusData.getTimestamp());
|
testRes.setStartTime(lastStatusData.getTimestamp());
|
||||||
|
|
||||||
FormalTestManager.pendingDipTaskMap.put(pqDipData.getId(), new FormalTestManager.PendingDipTask(
|
FormalTestManager.pendingDipTaskMap.put(pqDipData.getId(), new FormalTestManager.PendingDipTask(
|
||||||
pqDipData.getId(),
|
pqDipData,
|
||||||
pqDipData.getStartTime(),
|
|
||||||
targetEndTime,
|
targetEndTime,
|
||||||
originalTolerant
|
originalTolerant
|
||||||
));
|
));
|
||||||
|
|||||||
@@ -7,16 +7,19 @@ import cn.hutool.json.JSONUtil;
|
|||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.njcn.gather.detection.pojo.dto.FreqConverterRespDTO;
|
import com.njcn.gather.detection.pojo.dto.FreqConverterRespDTO;
|
||||||
import com.njcn.gather.detection.pojo.enums.SourceOperateCodeEnum;
|
import com.njcn.gather.detection.pojo.enums.SourceOperateCodeEnum;
|
||||||
|
import com.njcn.gather.detection.pojo.vo.SocketDataMsg;
|
||||||
import com.njcn.gather.detection.pojo.vo.SocketMsg;
|
import com.njcn.gather.detection.pojo.vo.SocketMsg;
|
||||||
import com.njcn.gather.detection.util.socket.FormalTestManager;
|
import com.njcn.gather.detection.util.socket.FormalTestManager;
|
||||||
import com.njcn.gather.detection.util.socket.SocketManager;
|
import com.njcn.gather.detection.util.socket.SocketManager;
|
||||||
import com.njcn.gather.detection.util.socket.cilent.NettyClient;
|
import com.njcn.gather.detection.util.socket.cilent.NettyClient;
|
||||||
import com.njcn.gather.detection.util.socket.cilent.NettyFreqConverterClientHandler;
|
import com.njcn.gather.detection.util.socket.cilent.NettyFreqConverterClientHandler;
|
||||||
import com.njcn.gather.detection.util.socket.config.SocketConnectionConfig;
|
import com.njcn.gather.detection.util.socket.config.SocketConnectionConfig;
|
||||||
|
import com.njcn.gather.detection.util.socket.websocket.WebServiceManager;
|
||||||
import com.njcn.gather.freqConverter.config.FreqConverterConfig;
|
import com.njcn.gather.freqConverter.config.FreqConverterConfig;
|
||||||
import com.njcn.gather.freqConverter.pojo.po.FreqConverterStatus;
|
import com.njcn.gather.freqConverter.pojo.po.FreqConverterStatus;
|
||||||
import com.njcn.gather.freqConverter.pojo.po.PqFreqConverterConfig;
|
import com.njcn.gather.freqConverter.pojo.po.PqFreqConverterConfig;
|
||||||
import com.njcn.gather.freqConverter.pojo.po.PqFreqConverterTestRes;
|
import com.njcn.gather.freqConverter.pojo.po.PqFreqConverterTestRes;
|
||||||
|
import com.njcn.gather.freqConverter.pojo.vo.TolerantPointVO;
|
||||||
import com.njcn.gather.freqConverter.service.IFreqConverterService;
|
import com.njcn.gather.freqConverter.service.IFreqConverterService;
|
||||||
import com.njcn.gather.freqConverter.service.IPqFreqConverterConfigService;
|
import com.njcn.gather.freqConverter.service.IPqFreqConverterConfigService;
|
||||||
import com.njcn.gather.freqConverter.service.IPqFreqConverterTestResService;
|
import com.njcn.gather.freqConverter.service.IPqFreqConverterTestResService;
|
||||||
@@ -257,9 +260,9 @@ public class SocketFreqConverterService {
|
|||||||
List<String> finishedDipIdList = new ArrayList<>();
|
List<String> finishedDipIdList = new ArrayList<>();
|
||||||
List<PqFreqConverterTestRes> testResList = new ArrayList<>();
|
List<PqFreqConverterTestRes> testResList = new ArrayList<>();
|
||||||
for (FormalTestManager.PendingDipTask task : FormalTestManager.pendingDipTaskMap.values()) {
|
for (FormalTestManager.PendingDipTask task : FormalTestManager.pendingDipTaskMap.values()) {
|
||||||
PqFreqConverterTestRes testRes = pqFreqConverterTestResService.getByDipId(suffix, task.getDipId());
|
PqFreqConverterTestRes testRes = pqFreqConverterTestResService.getByDipId(suffix, task.getPqDipData().getId());
|
||||||
if (Objects.isNull(testRes)) {
|
if (Objects.isNull(testRes)) {
|
||||||
finishedDipIdList.add(task.getDipId());
|
finishedDipIdList.add(task.getPqDipData().getId());
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -270,9 +273,20 @@ public class SocketFreqConverterService {
|
|||||||
testResList.add(testRes);
|
testResList.add(testRes);
|
||||||
|
|
||||||
if (freqConverterStatus.getTimestamp().isAfter(task.getTargetEndTime())) {
|
if (freqConverterStatus.getTimestamp().isAfter(task.getTargetEndTime())) {
|
||||||
finishedDipIdList.add(task.getDipId());
|
finishedDipIdList.add(task.getPqDipData().getId());
|
||||||
|
|
||||||
|
SocketDataMsg socketDataMsg = new SocketDataMsg();
|
||||||
|
socketDataMsg.setRequestId(SourceOperateCodeEnum.FORMAL_REAL + SocketFreqConverterDevService.DIP_DATA_SUFFIX);
|
||||||
|
|
||||||
|
TolerantPointVO tolerantPointVO = new TolerantPointVO();
|
||||||
|
tolerantPointVO.setResidualVoltage(task.getPqDipData().getResidualVoltage());
|
||||||
|
tolerantPointVO.setDurationMs(task.getPqDipData().getDurationMs());
|
||||||
|
tolerantPointVO.setTolerant(testRes.getTolerant());
|
||||||
|
socketDataMsg.setData(JSON.toJSONString(tolerantPointVO));
|
||||||
|
WebServiceManager.sendMsg(this.userId, JSON.toJSONString(socketDataMsg));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pqFreqConverterTestResService.saveOrUpdateTestRes(suffix, testResList);
|
pqFreqConverterTestResService.saveOrUpdateTestRes(suffix, testResList);
|
||||||
|
|
||||||
for (String dipId : finishedDipIdList) {
|
for (String dipId : finishedDipIdList) {
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import com.njcn.gather.detection.pojo.po.DevData;
|
|||||||
import com.njcn.gather.detection.pojo.vo.DevLineTestResult;
|
import com.njcn.gather.detection.pojo.vo.DevLineTestResult;
|
||||||
import com.njcn.gather.device.pojo.enums.PatternEnum;
|
import com.njcn.gather.device.pojo.enums.PatternEnum;
|
||||||
import com.njcn.gather.device.pojo.vo.PreDetection;
|
import com.njcn.gather.device.pojo.vo.PreDetection;
|
||||||
|
import com.njcn.gather.dip.pojo.po.PqDipData;
|
||||||
import com.njcn.gather.plan.pojo.enums.DataSourceEnum;
|
import com.njcn.gather.plan.pojo.enums.DataSourceEnum;
|
||||||
import com.njcn.gather.plan.pojo.po.AdPlan;
|
import com.njcn.gather.plan.pojo.po.AdPlan;
|
||||||
import com.njcn.gather.plan.pojo.po.AdPlanTestConfig;
|
import com.njcn.gather.plan.pojo.po.AdPlanTestConfig;
|
||||||
@@ -227,14 +228,13 @@ public class FormalTestManager {
|
|||||||
|
|
||||||
@Data
|
@Data
|
||||||
public static class PendingDipTask {
|
public static class PendingDipTask {
|
||||||
private final String dipId;
|
private PqDipData pqDipData;
|
||||||
private LocalDateTime startTime;
|
|
||||||
private LocalDateTime targetEndTime;
|
private LocalDateTime targetEndTime;
|
||||||
private Boolean originalTolerant;
|
private Boolean originalTolerant;
|
||||||
|
|
||||||
public PendingDipTask(String dipId, LocalDateTime startTime, LocalDateTime targetEndTime, Boolean originalTolerant) {
|
public PendingDipTask(PqDipData pqDipData, LocalDateTime targetEndTime, Boolean originalTolerant) {
|
||||||
this.dipId = dipId;
|
this.pqDipData = pqDipData;
|
||||||
this.startTime = startTime;
|
|
||||||
this.targetEndTime = targetEndTime;
|
this.targetEndTime = targetEndTime;
|
||||||
this.originalTolerant = originalTolerant;
|
this.originalTolerant = originalTolerant;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user