列车报点调整
This commit is contained in:
parent
19dc3b31bc
commit
ce81921022
@ -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<Builder> 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));
|
||||
}
|
||||
}
|
||||
|
@ -175,7 +175,11 @@ public class TrainRecordResponse extends MessageResponse {
|
||||
|
||||
|
||||
/**
|
||||
* 运行方向(1) 0x01:下行 <br> 0x02:上行<br> 0x00:无方向<br>
|
||||
* 运行方向(1) 0x01:下行
|
||||
*
|
||||
* <br> 0x02:上行
|
||||
*
|
||||
* <br> 0x00:无方向<br>
|
||||
* <p>
|
||||
* 但是根据实际接受参数发现1 = 上 0 = 下
|
||||
*/
|
||||
|
@ -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<Plan.Builder> 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<Plan.Builder> 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);
|
||||
}
|
||||
}
|
||||
|
@ -24,19 +24,17 @@ public class TrainReacrdAlertListener implements AlertSourceEventListener<TrainR
|
||||
public void accept(TrainRecordAlertEvent event) {
|
||||
TrainRecord.Builder trainRecord = event.getSource();
|
||||
|
||||
if (trainRecord.getTrainType() == TrainTypeEnum.PlannedTrain.getType() && trainRecord.getRecordType()) {
|
||||
if (trainRecord.getRecordType()) {
|
||||
log.info("列车报点,线路[{}] 列车表号[{}] 列车车次号[{}] 车站[{}] 上行[{}] 列车类型[{}] 是否进站[{}]",
|
||||
trainRecord.getLineId(), trainRecord.getTrainId(), trainRecord.getGlobalId(), trainRecord.getStationId(), (trainRecord.getDir() == DirectionEnum.Up.getValue()), trainRecord.getTrainType(),
|
||||
trainRecord.getRecordType());
|
||||
this.platformAlertMonitoringTask.putTrainRecord(trainRecord);
|
||||
} /*
|
||||
西安3号线正线报点只有到站信息,没有离站信息
|
||||
else if (Objects.equals(false, trainRecord.getRecordType())) {
|
||||
} else {
|
||||
log.info("列车报点驶离,线路[{}] 列车表号[{}] 列车车次号[{}] 车站[{}] 上行[{}] 列车类型[{}] 是否进站[{}]",
|
||||
trainRecord.getLineId(), trainRecord.getTrainId(), trainRecord.getGlobalId(), trainRecord.getStationId(), (trainRecord.getDir() == DirectionEnum.Up.getValue()), trainRecord.getTrainType(),
|
||||
trainRecord.getRecordType());
|
||||
this.platformAlertMonitoringTask.removeTrainRecord(trainRecord);
|
||||
}*/
|
||||
}
|
||||
}
|
||||
|
||||
public static class TrainRecordAlertEvent extends DeviceAlertEvent<TrainRecord.Builder> {
|
||||
|
Loading…
Reference in New Issue
Block a user