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();