diff --git a/src/main/java/club/joylink/xiannccda/ats/message/collect/convertor/TrainRecordConvertor.java b/src/main/java/club/joylink/xiannccda/ats/message/collect/convertor/TrainRecordConvertor.java index 54ae3e6..70e2a50 100644 --- a/src/main/java/club/joylink/xiannccda/ats/message/collect/convertor/TrainRecordConvertor.java +++ b/src/main/java/club/joylink/xiannccda/ats/message/collect/convertor/TrainRecordConvertor.java @@ -4,6 +4,7 @@ import club.joylink.xiannccda.alert.core.AlertManager; import club.joylink.xiannccda.ats.message.MessageId; import club.joylink.xiannccda.ats.message.collect.DeviceDataRepository.DataTypeEnum; +import club.joylink.xiannccda.ats.message.line3.rep.TrainRecordResponse.TrainTypeEnum; import club.joylink.xiannccda.ats.warn.TrainReacrdAlertListener.TrainRecordAlertEvent; import club.joylink.xiannccda.dto.protos.TrainProto.TrainRecord; import com.google.protobuf.GeneratedMessageV3.Builder; @@ -28,7 +29,7 @@ public class TrainRecordConvertor extends DefaultConvertor { @Override protected void eventHandle(List builders) { for (Builder builder : builders) { - if ((builder instanceof TrainRecord.Builder trainRecord) && trainRecord.getRecordType()) { + if ((builder instanceof TrainRecord.Builder trainRecord) && trainRecord.getTrainType() == TrainTypeEnum.PlannedTrain.getType()) { alertManager.emit(new TrainRecordAlertEvent(trainRecord)); } } diff --git a/src/main/java/club/joylink/xiannccda/ats/message/line3/rep/TrainRecordResponse.java b/src/main/java/club/joylink/xiannccda/ats/message/line3/rep/TrainRecordResponse.java index f6a6522..2b83300 100644 --- a/src/main/java/club/joylink/xiannccda/ats/message/line3/rep/TrainRecordResponse.java +++ b/src/main/java/club/joylink/xiannccda/ats/message/line3/rep/TrainRecordResponse.java @@ -175,7 +175,11 @@ public class TrainRecordResponse extends MessageResponse { /** - * 运行方向(1) 0x01:下行
0x02:上行
0x00:无方向
+ * 运行方向(1) 0x01:下行 + * + *
0x02:上行 + * + *
0x00:无方向
*

* 但是根据实际接受参数发现1 = 上 0 = 下 */ diff --git a/src/main/java/club/joylink/xiannccda/ats/warn/PlatformAlertMonitoringTask.java b/src/main/java/club/joylink/xiannccda/ats/warn/PlatformAlertMonitoringTask.java index a2eda06..adb0ef4 100644 --- a/src/main/java/club/joylink/xiannccda/ats/warn/PlatformAlertMonitoringTask.java +++ b/src/main/java/club/joylink/xiannccda/ats/warn/PlatformAlertMonitoringTask.java @@ -155,8 +155,21 @@ public class PlatformAlertMonitoringTask implements AlertMonitoringTask { int lineId = record.getLineId(); if (Objects.isNull(platformBuild)) { this.removeTrainRecord(record); - break; + continue; } + + InUsedScheduleData scheduleData = DeviceDataRepository.findDataSouce(String.valueOf(record.getLineId()), DataTypeEnum.TRAIN_PLAN); + Optional planBuildOpt = scheduleData.findPlan(record.getTrainId(), record.getGlobalId(), record.getStationId(), isUpWay); + if (planBuildOpt.isEmpty()) { + if (log.isDebugEnabled()) { + log.info("未找到对应的行车计划,线路[{}] 列车表号[{}] 列车车次号[{}] 车站id[{}] 站台门id[{}] 上下行[{}] 解析屏蔽门code[{}]" + , record.getLineId(), record.getTrainId(), record.getGlobalId(), record.getStationId(), record.getSideId(), isUpWay, platformBuild.getId()); + } + this.removeTrainRecord(record); + continue; + } + Plan.Builder planBuild = planBuildOpt.get(); + boolean isOpen = alertManager.deviceIsExist(lineId, PLATFORM_IS_OPEN, platformBuild.getId()); boolean isClose = alertManager.deviceIsExist(lineId, PLATFORM_IS_CLOSE, platformBuild.getId()); if (isOpen && isClose && Objects.equals(false, platformBuild.getTrainberth())) { @@ -178,17 +191,7 @@ public class PlatformAlertMonitoringTask implements AlertMonitoringTask { this.removeTrainRecord(record); continue; } - InUsedScheduleData scheduleData = DeviceDataRepository.findDataSouce(String.valueOf(record.getLineId()), DataTypeEnum.TRAIN_PLAN); - Optional planBuildOpt = scheduleData.findPlan(record.getTrainId(), record.getGlobalId(), record.getStationId(), isUpWay); - if (planBuildOpt.isEmpty()) { - if (log.isDebugEnabled()) { - log.info("未找到对应的行车计划,线路[{}] 列车表号[{}] 列车车次号[{}] 车站id[{}] 站台门id[{}] 上下行[{}] 解析屏蔽门code[{}]" - , record.getLineId(), record.getTrainId(), record.getGlobalId(), record.getStationId(), record.getSideId(), isUpWay, platformBuild.getId()); - } - this.removeTrainRecord(record); - continue; - } - Plan.Builder planBuild = planBuildOpt.get(); + this.handle(record, isUpWay, platformBuild, isOpen, isClose, planBuild); } } diff --git a/src/main/java/club/joylink/xiannccda/ats/warn/TrainReacrdAlertListener.java b/src/main/java/club/joylink/xiannccda/ats/warn/TrainReacrdAlertListener.java index 4dddb93..0ad5430 100644 --- a/src/main/java/club/joylink/xiannccda/ats/warn/TrainReacrdAlertListener.java +++ b/src/main/java/club/joylink/xiannccda/ats/warn/TrainReacrdAlertListener.java @@ -24,19 +24,17 @@ public class TrainReacrdAlertListener implements AlertSourceEventListener {