From 7323a6fedeead558c8ea65cd4f5897e038574d68 Mon Sep 17 00:00:00 2001 From: tiger_zhou Date: Tue, 26 Dec 2023 13:00:43 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ats/warn/axle/AxleLedInterlockTask.java | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/src/main/java/club/joylink/xiannccda/ats/warn/axle/AxleLedInterlockTask.java b/src/main/java/club/joylink/xiannccda/ats/warn/axle/AxleLedInterlockTask.java index 1f6571d..497f176 100644 --- a/src/main/java/club/joylink/xiannccda/ats/warn/axle/AxleLedInterlockTask.java +++ b/src/main/java/club/joylink/xiannccda/ats/warn/axle/AxleLedInterlockTask.java @@ -69,8 +69,9 @@ public class AxleLedInterlockTask implements AlertMonitoringTask { for (Entry interLockDetail : detailMap.entrySet()) { String rtuIdJoinStr = interLockDetail.getKey(); InterLockDetail detail = interLockDetail.getValue(); - Optional redOpt = this.handle(lineId, detail, AlertType.AXLE_LED_RED, rtuIdJoinStr); - Optional orangeOpt = this.handle(lineId, detail, AlertType.AXLE_LED_ORANGE, rtuIdJoinStr); + + Optional redOpt = this.handle(lineId, detail, AlertType.AXLE_LED_RED, AlertType.AXLE_LED_RED_INTERLOCK_AREA, rtuIdJoinStr); + Optional orangeOpt = this.handle(lineId, detail, AlertType.AXLE_LED_ORANGE, AlertType.AXLE_LED_ORANGE_INTERLOCK_AREA, rtuIdJoinStr); redOpt.ifPresent(axleInterLockSource -> this.alertManager.emit(new LedMostEvent(axleInterLockSource))); orangeOpt.ifPresent(axleInterLockSource -> this.alertManager.emit(new LedMostEvent(axleInterLockSource))); @@ -81,27 +82,27 @@ public class AxleLedInterlockTask implements AlertMonitoringTask { } } - private Optional handle(String lineId, InterLockDetail detail, AlertType alertType, String rtuIdJoinStr) { + private Optional handle(String lineId, InterLockDetail detail, AlertType findWarnAlertType, AlertType warnAlertType, String rtuIdJoinStr) { int deviceCount = detail.getDevices().size(); Integer lineIdInt = Integer.parseInt(lineId); //收集联锁下的所有所有区段设备 - List resultList = this.collectorLedWarDevices(alertType, lineId, detail.getDevices()); + List resultList = this.collectorLedWarDevices(findWarnAlertType, lineId, detail.getDevices()); int occupidedSzie = (int) resultList.stream().filter(d -> d.occupied).count(); - String customName = String.format("%s-%s", alertType.name(), detail.getAreaConfigId()); + String customName = String.format("%s-%s", findWarnAlertType.name(), detail.getAreaConfigId()); if (occupidedSzie >= deviceCount) { //联锁报警 - if (alertDataSource.putAlterDevice(lineIdInt, customName, alertType.name())) { - NccAlertInfo alertInfoMost = this.alertInfoService.createAlert2(detail.getAreaConfigId(), alertType, lineIdInt, LocalDateTime.now(), detail.getAreaConfigName(), null, + if (alertDataSource.putAlterDevice(lineIdInt, customName, warnAlertType.name())) { + NccAlertInfo alertInfoMost = this.alertInfoService.createAlert2(detail.getAreaConfigId(), warnAlertType, lineIdInt, LocalDateTime.now(), detail.getAreaConfigName(), null, AlertDeviceType.DEVICE_TYPE_TRACK, false); alertManager.emit(alertInfoMost); } return Optional.empty(); } - alertDataSource.removeAlterDevice(lineIdInt, customName, alertType.name()); + alertDataSource.removeAlterDevice(lineIdInt, customName, warnAlertType.name()); if (CollectionUtils.isNotEmpty(resultList)) { //大面积或单个告警 - AxleInterLockSource source = new AxleInterLockSource(lineId, rtuIdJoinStr, resultList, alertType); + AxleInterLockSource source = new AxleInterLockSource(lineId, rtuIdJoinStr, resultList, findWarnAlertType); return Optional.of(source); } return Optional.empty();