代码调整

This commit is contained in:
tiger_zhou 2023-12-26 13:51:17 +08:00
parent 3b36e5737a
commit 0a70258a3c
2 changed files with 11 additions and 12 deletions

View File

@ -62,20 +62,19 @@ public class AxleLedInterlockTask implements AlertMonitoringTask {
} }
for (String lineId : lineCollSet) { for (String lineId : lineCollSet) {
InterLockData interLockData = DeviceDataRepository.findDataSouce(lineId, DataTypeEnum.INTER_LOCK); InterLockData interLockData = DeviceDataRepository.findDataSouce(lineId, DataTypeEnum.INTER_LOCK);
List<String> interlockOneList = interLockData.findKeysStart(AlertType.INTERLOCK_LEVEL_ONE.name()); List<String> interlockOneList = interLockData.findKeysStart(AlertType.INTERLOCK_LEVEL_ONE.name())
.stream().filter(d -> StringUtils.endsWith(d, AlertDeviceType.DEVICE_TYPE_TRACK.name())).toList();
for (String lockLevel : interlockOneList) { for (String lockLevel : interlockOneList) {
if (StringUtils.endsWith(lockLevel, AlertDeviceType.DEVICE_TYPE_TRACK.name())) { Map<String, InterLockDetail> detailMap = interLockData.getDetailByInterlockKey(lockLevel);
Map<String, InterLockDetail> detailMap = interLockData.getDetailByInterlockKey(lockLevel); for (Entry<String, InterLockDetail> interLockDetail : detailMap.entrySet()) {
for (Entry<String, InterLockDetail> interLockDetail : detailMap.entrySet()) { String rtuIdJoinStr = interLockDetail.getKey();
String rtuIdJoinStr = interLockDetail.getKey(); InterLockDetail detail = interLockDetail.getValue();
InterLockDetail detail = interLockDetail.getValue(); Optional<AxleInterLockSource> redOpt = this.handle(lineId, detail, AlertType.AXLE_LED_RED, AlertType.AXLE_LED_RED_INTERLOCK_AREA, rtuIdJoinStr);
Optional<AxleInterLockSource> redOpt = this.handle(lineId, detail, AlertType.AXLE_LED_RED, AlertType.AXLE_LED_RED_INTERLOCK_AREA, rtuIdJoinStr); Optional<AxleInterLockSource> orangeOpt = this.handle(lineId, detail, AlertType.AXLE_LED_ORANGE, AlertType.AXLE_LED_ORANGE_INTERLOCK_AREA, rtuIdJoinStr);
Optional<AxleInterLockSource> 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))); redOpt.ifPresent(axleInterLockSource -> this.alertManager.emit(new LedMostEvent(axleInterLockSource)));
orangeOpt.ifPresent(axleInterLockSource -> this.alertManager.emit(new LedMostEvent(axleInterLockSource))); orangeOpt.ifPresent(axleInterLockSource -> this.alertManager.emit(new LedMostEvent(axleInterLockSource)));
}
} }
} }
} }

View File

@ -155,7 +155,7 @@ public class MockOccServer {
} }
private Integer findDeviceRtuId(Integer lineId, DeviceType dt, String deviceName, AlertType alertType) { private Integer findDeviceRtuId(Integer lineId, DeviceType dt, String deviceName, AlertType alertType) {
if (alertType == AlertType.AXLE_LED_RED || alertType == AlertType.AXLE_LED_ORANGE) { if (alertType == AlertType.AXLE_LED_RED || alertType == AlertType.AXLE_LED_ORANGE || alertType == AlertType.TRAIN_EB_ATP) {
MessageOrBuilder t = LineGraphicDataRepository.getDeviceByCodeNotException(lineId, deviceName); MessageOrBuilder t = LineGraphicDataRepository.getDeviceByCodeNotException(lineId, deviceName);
if (t instanceof Turnout) { if (t instanceof Turnout) {