From 08dff063c974359284dadaf4a49193dac360b112 Mon Sep 17 00:00:00 2001 From: caozehui <2427765068@qq.com> Date: Thu, 7 May 2026 08:52:17 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=E8=84=9A=E6=9C=AC=E6=8D=A2?= =?UTF-8?q?=E8=A1=8C=E3=80=81=E7=89=B9=E6=80=A7=E7=82=B9=E5=85=A5=E5=BA=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../handler/SocketFreqConverterService.java | 22 +++++++++---------- .../config/FreqConverterConfig.java | 1 + .../PqFreqConverterTestResServiceImpl.java | 18 +-------------- entrance/src/main/resources/application.yml | 3 ++- 4 files changed, 15 insertions(+), 29 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 ba5144d2..e7f04dcd 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 @@ -376,18 +376,18 @@ public class SocketFreqConverterService { * @return */ private boolean isNewGroup(TolerantPointVO lastTolerancePoint, TolerantPointVO newTolerantPointVO) { -// // 纵向分租 -// if (newTolerantPointVO.getResidualVoltage() - lastTolerancePoint.getResidualVoltage() >= 2 && newTolerantPointVO.getDurationMs() - lastTolerancePoint.getDurationMs() >= 10) { -// return true; -// } -// // 横向分组 -// if (lastTolerancePoint.getDurationMs() - newTolerantPointVO.getDurationMs() >= 10 && lastTolerancePoint.getResidualVoltage() - newTolerantPointVO.getResidualVoltage() >= 2) { -// return true; -// } - - if (Math.abs(lastTolerancePoint.getDurationMs() - newTolerantPointVO.getDurationMs()) >= 10 && Math.abs(lastTolerancePoint.getResidualVoltage() - newTolerantPointVO.getResidualVoltage()) >= 2) { - return true; + // 横向分组 + if (freqConverterConfig.getDirection() == 0) { + return lastTolerancePoint.getDurationMs() - newTolerantPointVO.getDurationMs() <= -10; } + // 纵向分租 + if (freqConverterConfig.getDirection() == 1) { + return lastTolerancePoint.getResidualVoltage() - newTolerantPointVO.getResidualVoltage() <= -2; + } + +// if (Math.abs(lastTolerancePoint.getDurationMs() - newTolerantPointVO.getDurationMs()) >= 10 && Math.abs(lastTolerancePoint.getResidualVoltage() - newTolerantPointVO.getResidualVoltage()) >= 2) { +// return true; +// } return false; } } diff --git a/detection/src/main/java/com/njcn/gather/freqConverter/config/FreqConverterConfig.java b/detection/src/main/java/com/njcn/gather/freqConverter/config/FreqConverterConfig.java index 0ec36525..728a0fef 100644 --- a/detection/src/main/java/com/njcn/gather/freqConverter/config/FreqConverterConfig.java +++ b/detection/src/main/java/com/njcn/gather/freqConverter/config/FreqConverterConfig.java @@ -15,4 +15,5 @@ public class FreqConverterConfig { private Long schedulePeriod; private Integer tolerant; private Integer dt; + private Integer direction; } 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 17dd0e51..129003ed 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 @@ -27,23 +27,7 @@ public class PqFreqConverterTestResServiceImpl extends ServiceImpl testResList) { DynamicTableNameHandler.setTableName(PqFreqConverterConfigServiceImpl.PQ_FREQ_CONVERTER_TEST_RES_TB_PREFIX + suffix); - - List existedTestResList = new ArrayList<>(); - List newTestResList = new ArrayList<>(); - for (PqFreqConverterTestRes testRes : testResList) { - if (ObjectUtil.isNotNull(testRes.getId())) { - existedTestResList.add(testRes); - } else { - newTestResList.add(testRes); - } - } - if (existedTestResList.size() > 0) { - this.updateBatchById(existedTestResList); - } - if (newTestResList.size() > 0) { - this.saveBatch(newTestResList); - } - + this.saveOrUpdateBatch(testResList); DynamicTableNameHandler.remove(); return true; } diff --git a/entrance/src/main/resources/application.yml b/entrance/src/main/resources/application.yml index ae3f0e59..2f08473d 100644 --- a/entrance/src/main/resources/application.yml +++ b/entrance/src/main/resources/application.yml @@ -130,4 +130,5 @@ activate: freq-converter: schedule-period: 200 #定时器运行间隔 tolerant: 1 #耐受状态 - dt: 200 #延迟时间ms \ No newline at end of file + dt: 200 #延迟时间ms + direction: 1 #0为横向1为纵向 \ No newline at end of file