From ec9a0ca236cc19e084bf1d11eaf75509a117f6b1 Mon Sep 17 00:00:00 2001 From: caozehui <2427765068@qq.com> Date: Thu, 7 May 2026 16:27:49 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BE=AE=E8=B0=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../detection/handler/SocketFreqConverterService.java | 6 +++--- .../service/IPqFreqConverterTestResService.java | 10 +++++----- .../impl/PqFreqConverterTestResServiceImpl.java | 6 ++++-- entrance/src/main/resources/application.yml | 2 +- 4 files changed, 13 insertions(+), 11 deletions(-) diff --git a/detection/src/main/java/com/njcn/gather/detection/handler/SocketFreqConverterService.java b/detection/src/main/java/com/njcn/gather/detection/handler/SocketFreqConverterService.java index fd3c691d..0caab4af 100644 --- a/detection/src/main/java/com/njcn/gather/detection/handler/SocketFreqConverterService.java +++ b/detection/src/main/java/com/njcn/gather/detection/handler/SocketFreqConverterService.java @@ -362,7 +362,7 @@ public class SocketFreqConverterService { // 从数据库按照列查询距离该暂降点最近的一个暂降点 if (freqConverterConfig.getDirection() == 0) { - PqFreqConverterTestRes lastByDuration = pqFreqConverterTestResService.getLastByDuration(suffix, task.getPqDipData().getDurationMs()); + PqFreqConverterTestRes lastByDuration = pqFreqConverterTestResService.getLastByDuration(suffix, key, task.getPqDipData().getDurationMs()); if (ObjectUtil.isNotNull(lastByDuration) && lastByDuration.getTolerant() == 1) { TolerantPointVO featurePointVO = new TolerantPointVO(); @@ -381,8 +381,8 @@ public class SocketFreqConverterService { } } // 从数据库按照行查询距离该暂降点最近的一个暂降点 - if (freqConverterConfig.getDirection() == 0) { - PqFreqConverterTestRes lastByResidualVoltage = pqFreqConverterTestResService.getLastByResidualVoltage(suffix, task.getPqDipData().getResidualVoltage()); + if (freqConverterConfig.getDirection() == 1) { + PqFreqConverterTestRes lastByResidualVoltage = pqFreqConverterTestResService.getLastByResidualVoltage(suffix, key, task.getPqDipData().getResidualVoltage()); if (ObjectUtil.isNotNull(lastByResidualVoltage) && lastByResidualVoltage.getTolerant() == 1) { TolerantPointVO featurePointVO = new TolerantPointVO(); diff --git a/detection/src/main/java/com/njcn/gather/freqConverter/service/IPqFreqConverterTestResService.java b/detection/src/main/java/com/njcn/gather/freqConverter/service/IPqFreqConverterTestResService.java index 4eddb85b..4e7a622e 100644 --- a/detection/src/main/java/com/njcn/gather/freqConverter/service/IPqFreqConverterTestResService.java +++ b/detection/src/main/java/com/njcn/gather/freqConverter/service/IPqFreqConverterTestResService.java @@ -21,7 +21,7 @@ public interface IPqFreqConverterTestResService extends IService listTestRes(Integer suffix); - PqFreqConverterTestRes getLastByDuration(Integer suffix, Integer durationMs); + PqFreqConverterTestRes getLastByDuration(Integer suffix, String id, Integer durationMs); - PqFreqConverterTestRes getLastByResidualVoltage(Integer suffix, Double residualVoltage); + PqFreqConverterTestRes getLastByResidualVoltage(Integer suffix, String id, Double residualVoltage); } diff --git a/detection/src/main/java/com/njcn/gather/freqConverter/service/impl/PqFreqConverterTestResServiceImpl.java b/detection/src/main/java/com/njcn/gather/freqConverter/service/impl/PqFreqConverterTestResServiceImpl.java index 04bb2aea..e878d06c 100644 --- a/detection/src/main/java/com/njcn/gather/freqConverter/service/impl/PqFreqConverterTestResServiceImpl.java +++ b/detection/src/main/java/com/njcn/gather/freqConverter/service/impl/PqFreqConverterTestResServiceImpl.java @@ -58,10 +58,11 @@ public class PqFreqConverterTestResServiceImpl extends ServiceImpl queryWrapper = new LambdaQueryWrapper<>(); queryWrapper.between(PqFreqConverterTestRes::getDurationMs, durationMs - freqConverterConfig.getAllowErrorDuration(), durationMs + freqConverterConfig.getAllowErrorDuration()) + .ne(PqFreqConverterTestRes::getId, id) .orderByAsc(PqFreqConverterTestRes::getResidualVoltage) .last("limit 1"); PqFreqConverterTestRes result = this.getOne(queryWrapper); @@ -70,10 +71,11 @@ public class PqFreqConverterTestResServiceImpl extends ServiceImpl queryWrapper = new LambdaQueryWrapper<>(); queryWrapper.between(PqFreqConverterTestRes::getResidualVoltage, residualVoltage - freqConverterConfig.getAllowErrorResidualVoltage(), residualVoltage + freqConverterConfig.getAllowErrorDuration()) + .ne(PqFreqConverterTestRes::getId, id) .orderByDesc(PqFreqConverterTestRes::getDurationMs) .last("limit 1"); PqFreqConverterTestRes result = this.getOne(queryWrapper); diff --git a/entrance/src/main/resources/application.yml b/entrance/src/main/resources/application.yml index bc2fb607..5266ad6d 100644 --- a/entrance/src/main/resources/application.yml +++ b/entrance/src/main/resources/application.yml @@ -131,6 +131,6 @@ freq-converter: schedule-period: 200 #定时器运行间隔 tolerant: 1 #耐受状态 dt: 200 #延迟时间ms - direction: 1 #0为横向1为纵向 + direction: 0 #0为横向1为纵向 allow-error-duration: 6 #暂态持续时间允许最大误差ms allow-error-vesidual-voltage: 2.0 #暂态幅值允许最多误差% \ No newline at end of file