This commit is contained in:
caozehui
2026-05-08 10:39:27 +08:00
parent 8dca7bf537
commit 924c2e8f45

View File

@@ -328,27 +328,48 @@ public class SocketFreqConverterService {
WebServiceManager.sendMsg(this.userId, JSON.toJSONString(socketDataMsg)); WebServiceManager.sendMsg(this.userId, JSON.toJSONString(socketDataMsg));
if (ObjectUtil.isNotNull(this.lastTolerancePoint)) { if (ObjectUtil.isNotNull(this.lastTolerancePoint)) {
boolean isNewGroup = this.isNewGroup(this.lastTolerancePoint, newTolerantPointVO); // boolean isNewGroup = this.isNewGroup(this.lastTolerancePoint, newTolerantPointVO);
if (isNewGroup) { // if (isNewGroup) {
// 纵向分组 // // 纵向分组
if (freqConverterConfig.getDirection() == 1) { // if (freqConverterConfig.getDirection() == 1) {
if (this.lastTolerancePoint.getTolerant() == 1 && testRes.getTolerant() == 1) { // if (this.lastTolerancePoint.getTolerant() == 1 && testRes.getTolerant() == 1) {
TolerantPointVO featurePointVO = new TolerantPointVO(); // TolerantPointVO featurePointVO = new TolerantPointVO();
featurePointVO.setResidualVoltage(this.lastTolerancePoint.getResidualVoltage()); // featurePointVO.setResidualVoltage(this.lastTolerancePoint.getResidualVoltage());
featurePointVO.setDurationMs(this.lastTolerancePoint.getDurationMs()); // featurePointVO.setDurationMs(this.lastTolerancePoint.getDurationMs());
featurePointVO.setTolerant(2); // featurePointVO.setTolerant(2);
socketDataMsg.setData(JSON.toJSONString(featurePointVO)); // socketDataMsg.setData(JSON.toJSONString(featurePointVO));
WebServiceManager.sendMsg(this.userId, JSON.toJSONString(socketDataMsg)); // WebServiceManager.sendMsg(this.userId, JSON.toJSONString(socketDataMsg));
testRes.setTolerant(2); // testRes.setTolerant(2);
} // }
// }
// } else {
if (testRes.getTolerant() == 0) {
if (this.lastTolerancePoint.getTolerant() == 1) {
TolerantPointVO featurePointVO = new TolerantPointVO();
featurePointVO.setResidualVoltage((task.getPqDipData().getResidualVoltage() + this.lastTolerancePoint.getResidualVoltage()) / 2D);
featurePointVO.setDurationMs(Integer.valueOf((task.getPqDipData().getDurationMs().intValue() + this.lastTolerancePoint.getDurationMs().intValue()) / 2));
featurePointVO.setTolerant(2);
socketDataMsg.setData(JSON.toJSONString(featurePointVO));
WebServiceManager.sendMsg(this.userId, JSON.toJSONString(socketDataMsg));
PqFreqConverterTestRes featureTestRes = new PqFreqConverterTestRes();
featureTestRes.setId(IdUtil.fastSimpleUUID());
featureTestRes.setDurationMs(featurePointVO.getDurationMs());
featureTestRes.setResidualVoltage(featurePointVO.getResidualVoltage());
featureTestRes.setTolerant(2);
featureTestRes.setTime(LocalDateTime.now());
saveTestResList.add(featureTestRes);
} }
} else {
if (testRes.getTolerant() == 0) { // 从数据库按照列查询距离该暂降点最近的一个暂降点
if (this.lastTolerancePoint.getTolerant() == 1) { if (freqConverterConfig.getDirection() == 0) {
PqFreqConverterTestRes lastByDuration = pqFreqConverterTestResService.getLastByDuration(suffix, key, task.getPqDipData().getDurationMs());
if (ObjectUtil.isNotNull(lastByDuration) && lastByDuration.getTolerant() == 1) {
TolerantPointVO featurePointVO = new TolerantPointVO(); TolerantPointVO featurePointVO = new TolerantPointVO();
featurePointVO.setResidualVoltage((task.getPqDipData().getResidualVoltage() + this.lastTolerancePoint.getResidualVoltage()) / 2D); featurePointVO.setResidualVoltage((task.getPqDipData().getResidualVoltage() + lastByDuration.getResidualVoltage()) / 2D);
featurePointVO.setDurationMs(Integer.valueOf((task.getPqDipData().getDurationMs().intValue() + this.lastTolerancePoint.getDurationMs().intValue()) / 2)); featurePointVO.setDurationMs(Integer.valueOf((task.getPqDipData().getDurationMs().intValue() + lastByDuration.getDurationMs().intValue()) / 2));
featurePointVO.setTolerant(2); featurePointVO.setTolerant(2);
socketDataMsg.setData(JSON.toJSONString(featurePointVO)); socketDataMsg.setData(JSON.toJSONString(featurePointVO));
WebServiceManager.sendMsg(this.userId, JSON.toJSONString(socketDataMsg)); WebServiceManager.sendMsg(this.userId, JSON.toJSONString(socketDataMsg));
@@ -361,52 +382,31 @@ public class SocketFreqConverterService {
featureTestRes.setTime(LocalDateTime.now()); featureTestRes.setTime(LocalDateTime.now());
saveTestResList.add(featureTestRes); saveTestResList.add(featureTestRes);
} }
}
// 从数据库按照行查询距离该暂降点最近的一个暂降点
if (freqConverterConfig.getDirection() == 1) {
PqFreqConverterTestRes lastByResidualVoltage = pqFreqConverterTestResService.getLastByResidualVoltage(suffix, key, task.getPqDipData().getResidualVoltage());
if (ObjectUtil.isNotNull(lastByResidualVoltage) && lastByResidualVoltage.getTolerant() == 1) {
TolerantPointVO featurePointVO = new TolerantPointVO();
// 从数据库按照列查询距离该暂降点最近的一个暂降点 featurePointVO.setResidualVoltage((task.getPqDipData().getResidualVoltage() + lastByResidualVoltage.getResidualVoltage()) / 2D);
if (freqConverterConfig.getDirection() == 0) { featurePointVO.setDurationMs(Integer.valueOf((task.getPqDipData().getDurationMs().intValue() + lastByResidualVoltage.getDurationMs().intValue()) / 2));
PqFreqConverterTestRes lastByDuration = pqFreqConverterTestResService.getLastByDuration(suffix, key, task.getPqDipData().getDurationMs()); featurePointVO.setTolerant(2);
if (ObjectUtil.isNotNull(lastByDuration) && lastByDuration.getTolerant() == 1) { socketDataMsg.setData(JSON.toJSONString(featurePointVO));
TolerantPointVO featurePointVO = new TolerantPointVO(); WebServiceManager.sendMsg(this.userId, JSON.toJSONString(socketDataMsg));
featurePointVO.setResidualVoltage((task.getPqDipData().getResidualVoltage() + lastByDuration.getResidualVoltage()) / 2D); PqFreqConverterTestRes featureTestRes = new PqFreqConverterTestRes();
featurePointVO.setDurationMs(Integer.valueOf((task.getPqDipData().getDurationMs().intValue() + lastByDuration.getDurationMs().intValue()) / 2)); featureTestRes.setId(IdUtil.fastSimpleUUID());
featurePointVO.setTolerant(2); featureTestRes.setDurationMs(featurePointVO.getDurationMs());
socketDataMsg.setData(JSON.toJSONString(featurePointVO)); featureTestRes.setResidualVoltage(featurePointVO.getResidualVoltage());
WebServiceManager.sendMsg(this.userId, JSON.toJSONString(socketDataMsg)); featureTestRes.setTolerant(2);
featureTestRes.setTime(LocalDateTime.now());
PqFreqConverterTestRes featureTestRes = new PqFreqConverterTestRes(); saveTestResList.add(featureTestRes);
featureTestRes.setId(IdUtil.fastSimpleUUID());
featureTestRes.setDurationMs(featurePointVO.getDurationMs());
featureTestRes.setResidualVoltage(featurePointVO.getResidualVoltage());
featureTestRes.setTolerant(2);
featureTestRes.setTime(LocalDateTime.now());
saveTestResList.add(featureTestRes);
}
}
// 从数据库按照行查询距离该暂降点最近的一个暂降点
if (freqConverterConfig.getDirection() == 1) {
PqFreqConverterTestRes lastByResidualVoltage = pqFreqConverterTestResService.getLastByResidualVoltage(suffix, key, task.getPqDipData().getResidualVoltage());
if (ObjectUtil.isNotNull(lastByResidualVoltage) && lastByResidualVoltage.getTolerant() == 1) {
TolerantPointVO featurePointVO = new TolerantPointVO();
featurePointVO.setResidualVoltage((task.getPqDipData().getResidualVoltage() + lastByResidualVoltage.getResidualVoltage()) / 2D);
featurePointVO.setDurationMs(Integer.valueOf((task.getPqDipData().getDurationMs().intValue() + lastByResidualVoltage.getDurationMs().intValue()) / 2));
featurePointVO.setTolerant(2);
socketDataMsg.setData(JSON.toJSONString(featurePointVO));
WebServiceManager.sendMsg(this.userId, JSON.toJSONString(socketDataMsg));
PqFreqConverterTestRes featureTestRes = new PqFreqConverterTestRes();
featureTestRes.setId(IdUtil.fastSimpleUUID());
featureTestRes.setDurationMs(featurePointVO.getDurationMs());
featureTestRes.setResidualVoltage(featurePointVO.getResidualVoltage());
featureTestRes.setTolerant(2);
featureTestRes.setTime(LocalDateTime.now());
saveTestResList.add(featureTestRes);
}
} }
} }
} }
} }
// }
this.lastTolerancePoint = newTolerantPointVO; this.lastTolerancePoint = newTolerantPointVO;
updateTestResList.add(testRes); updateTestResList.add(testRes);
} }