屏蔽门逻辑更改,别的代码调整
This commit is contained in:
parent
039a6162d3
commit
d72eedf7b7
@ -4,8 +4,6 @@ import club.joylink.xiannccda.alert.core.AlertManager;
|
|||||||
import club.joylink.xiannccda.ats.warn.AxleSwitchTrackLedAlertListener;
|
import club.joylink.xiannccda.ats.warn.AxleSwitchTrackLedAlertListener;
|
||||||
import club.joylink.xiannccda.ats.warn.BlueAlertListener;
|
import club.joylink.xiannccda.ats.warn.BlueAlertListener;
|
||||||
import club.joylink.xiannccda.ats.warn.BlueDisplayAlertEvent;
|
import club.joylink.xiannccda.ats.warn.BlueDisplayAlertEvent;
|
||||||
import club.joylink.xiannccda.ats.warn.PlatformAlertEvent;
|
|
||||||
import club.joylink.xiannccda.ats.warn.PlatformAlertListener;
|
|
||||||
import club.joylink.xiannccda.ats.warn.PlatformAlertMonitoringTask;
|
import club.joylink.xiannccda.ats.warn.PlatformAlertMonitoringTask;
|
||||||
import club.joylink.xiannccda.ats.warn.SwitchAndTrackLedAlertEvent;
|
import club.joylink.xiannccda.ats.warn.SwitchAndTrackLedAlertEvent;
|
||||||
import club.joylink.xiannccda.ats.warn.SwitchLostAlertEvent;
|
import club.joylink.xiannccda.ats.warn.SwitchLostAlertEvent;
|
||||||
@ -14,6 +12,8 @@ import club.joylink.xiannccda.ats.warn.SwitchLostAlertMonitoringTask;
|
|||||||
import club.joylink.xiannccda.ats.warn.TrainAlertEvent;
|
import club.joylink.xiannccda.ats.warn.TrainAlertEvent;
|
||||||
import club.joylink.xiannccda.ats.warn.TrainAtpCutAlertMonitoringTask;
|
import club.joylink.xiannccda.ats.warn.TrainAtpCutAlertMonitoringTask;
|
||||||
import club.joylink.xiannccda.ats.warn.TrainModeAlertListener;
|
import club.joylink.xiannccda.ats.warn.TrainModeAlertListener;
|
||||||
|
import club.joylink.xiannccda.ats.warn.TrainReacrdAlertListener;
|
||||||
|
import club.joylink.xiannccda.ats.warn.TrainRecordAlertEvent;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.boot.ApplicationArguments;
|
import org.springframework.boot.ApplicationArguments;
|
||||||
import org.springframework.boot.ApplicationRunner;
|
import org.springframework.boot.ApplicationRunner;
|
||||||
@ -35,28 +35,33 @@ public class AlertEmitJob implements ApplicationRunner {
|
|||||||
private SwitchLostAlertListener switchLostAlertListener;
|
private SwitchLostAlertListener switchLostAlertListener;
|
||||||
@Autowired
|
@Autowired
|
||||||
private PlatformAlertMonitoringTask platformAlertMonitoringTask;
|
private PlatformAlertMonitoringTask platformAlertMonitoringTask;
|
||||||
@Autowired
|
|
||||||
private PlatformAlertListener platformAlertListener;
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private TrainModeAlertListener trainModeAlertListener;
|
private TrainModeAlertListener trainModeAlertListener;
|
||||||
@Autowired
|
@Autowired
|
||||||
private TrainAtpCutAlertMonitoringTask trainAtpCutAlertMonitoringTask;
|
private TrainAtpCutAlertMonitoringTask trainAtpCutAlertMonitoringTask;
|
||||||
|
@Autowired
|
||||||
|
private TrainReacrdAlertListener trainReacrdAlertListener;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run(ApplicationArguments args) throws Exception {
|
public void run(ApplicationArguments args) throws Exception {
|
||||||
AlertManager alertManager = AlertManager.getDefault();
|
AlertManager alertManager = AlertManager.getDefault();
|
||||||
//报警源
|
//道岔失表任务
|
||||||
// alertManager.addTask(this.switchAlertMonitoringTask);
|
|
||||||
// alertManager.on(this.blueAlertListener, DeviceAlertEvent.class);
|
|
||||||
// alertManager.on(this.axleSwitchTrackAlertListener2, DeviceAlertEvent.class);
|
|
||||||
alertManager.addTask(this.lostAlertMonitoringTask2);
|
alertManager.addTask(this.lostAlertMonitoringTask2);
|
||||||
|
//站台屏蔽门任务
|
||||||
alertManager.addTask(this.platformAlertMonitoringTask);
|
alertManager.addTask(this.platformAlertMonitoringTask);
|
||||||
|
//列车atp切除任务
|
||||||
alertManager.addTask(this.trainAtpCutAlertMonitoringTask);
|
alertManager.addTask(this.trainAtpCutAlertMonitoringTask);
|
||||||
|
//光带检查监听
|
||||||
alertManager.on(this.axleSwitchTrackLedAlertListener2, SwitchAndTrackLedAlertEvent.class);
|
alertManager.on(this.axleSwitchTrackLedAlertListener2, SwitchAndTrackLedAlertEvent.class);
|
||||||
|
//蓝显检测
|
||||||
alertManager.on(this.blueAlertListener2, BlueDisplayAlertEvent.class);
|
alertManager.on(this.blueAlertListener2, BlueDisplayAlertEvent.class);
|
||||||
|
// 道岔失表监听
|
||||||
alertManager.on(this.switchLostAlertListener, SwitchLostAlertEvent.class);
|
alertManager.on(this.switchLostAlertListener, SwitchLostAlertEvent.class);
|
||||||
alertManager.on(this.platformAlertListener, PlatformAlertEvent.class);
|
// 列车制动监听
|
||||||
alertManager.on(this.trainModeAlertListener, TrainAlertEvent.class);
|
alertManager.on(this.trainModeAlertListener, TrainAlertEvent.class);
|
||||||
|
//列车报点监听
|
||||||
|
alertManager.on(this.trainReacrdAlertListener, TrainRecordAlertEvent.class);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7,6 +7,7 @@ import club.joylink.xiannccda.ats.message.collect.convertor.LineNetTrainInitConv
|
|||||||
import club.joylink.xiannccda.ats.message.collect.convertor.LineNetTrainRecordConvertor;
|
import club.joylink.xiannccda.ats.message.collect.convertor.LineNetTrainRecordConvertor;
|
||||||
import club.joylink.xiannccda.ats.message.collect.convertor.LineNetTrainRemoveConvertor;
|
import club.joylink.xiannccda.ats.message.collect.convertor.LineNetTrainRemoveConvertor;
|
||||||
import club.joylink.xiannccda.ats.message.collect.convertor.LineNetTrainUpdateConvertor;
|
import club.joylink.xiannccda.ats.message.collect.convertor.LineNetTrainUpdateConvertor;
|
||||||
|
import club.joylink.xiannccda.ats.message.collect.convertor.PlanScheduleConvertor;
|
||||||
import club.joylink.xiannccda.ats.message.collect.convertor.TrainInitConvertor;
|
import club.joylink.xiannccda.ats.message.collect.convertor.TrainInitConvertor;
|
||||||
import club.joylink.xiannccda.ats.message.collect.convertor.TrainRecordConvertor;
|
import club.joylink.xiannccda.ats.message.collect.convertor.TrainRecordConvertor;
|
||||||
import club.joylink.xiannccda.ats.message.collect.convertor.TrainRemoveConvertor;
|
import club.joylink.xiannccda.ats.message.collect.convertor.TrainRemoveConvertor;
|
||||||
@ -38,6 +39,7 @@ public class OccMessageHandler extends SimpleChannelInboundHandler<List<MessageD
|
|||||||
DeviceStatusConvertorManager.addStatusConvertor(new TrainRemoveConvertor());
|
DeviceStatusConvertorManager.addStatusConvertor(new TrainRemoveConvertor());
|
||||||
DeviceStatusConvertorManager.addStatusConvertor(new TrainRecordConvertor());
|
DeviceStatusConvertorManager.addStatusConvertor(new TrainRecordConvertor());
|
||||||
DeviceStatusConvertorManager.addStatusConvertor(new TrainUpdateConvertor());
|
DeviceStatusConvertorManager.addStatusConvertor(new TrainUpdateConvertor());
|
||||||
|
DeviceStatusConvertorManager.addStatusConvertor(new PlanScheduleConvertor());
|
||||||
|
|
||||||
// 添加初始化转换方法
|
// 添加初始化转换方法
|
||||||
DeviceStatusConvertorManager.addStatusConvertor(new LineNetTrainInitConvertor());
|
DeviceStatusConvertorManager.addStatusConvertor(new LineNetTrainInitConvertor());
|
||||||
|
@ -2,14 +2,13 @@ package club.joylink.xiannccda.ats.message.collect;
|
|||||||
|
|
||||||
import club.joylink.xiannccda.ats.message.collect.datasource.AbstractData;
|
import club.joylink.xiannccda.ats.message.collect.datasource.AbstractData;
|
||||||
import club.joylink.xiannccda.ats.message.collect.datasource.DeviceStatusData;
|
import club.joylink.xiannccda.ats.message.collect.datasource.DeviceStatusData;
|
||||||
|
import club.joylink.xiannccda.ats.message.collect.datasource.InUsedScheduleData;
|
||||||
import club.joylink.xiannccda.ats.message.collect.datasource.TrainDataSource;
|
import club.joylink.xiannccda.ats.message.collect.datasource.TrainDataSource;
|
||||||
import com.google.common.collect.HashBasedTable;
|
import com.google.common.collect.HashBasedTable;
|
||||||
import com.google.common.collect.Maps;
|
|
||||||
import com.google.common.collect.Table;
|
import com.google.common.collect.Table;
|
||||||
import com.google.common.collect.Tables;
|
import com.google.common.collect.Tables;
|
||||||
import com.google.protobuf.GeneratedMessageV3.Builder;
|
import com.google.protobuf.GeneratedMessageV3.Builder;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
|
||||||
@ -50,7 +49,6 @@ public class DeviceDataRepository {
|
|||||||
|
|
||||||
public static void add(String lineId, List<Builder> data, DataTypeEnum dataTypeEnum) {
|
public static void add(String lineId, List<Builder> data, DataTypeEnum dataTypeEnum) {
|
||||||
AbstractData ad = find(lineId, dataTypeEnum);
|
AbstractData ad = find(lineId, dataTypeEnum);
|
||||||
|
|
||||||
ad.addDevice(data);
|
ad.addDevice(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -60,7 +58,7 @@ public class DeviceDataRepository {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public enum DataTypeEnum {
|
public enum DataTypeEnum {
|
||||||
DEVICE(DeviceStatusData.class), TRAIN(TrainDataSource.class),
|
DEVICE(DeviceStatusData.class), TRAIN(TrainDataSource.class), TRAIN_PLAN(InUsedScheduleData.class),
|
||||||
;
|
;
|
||||||
|
|
||||||
Class<? extends AbstractData> clazz;
|
Class<? extends AbstractData> clazz;
|
||||||
|
@ -4,11 +4,8 @@ import club.joylink.xiannccda.alert.core.AlertManager;
|
|||||||
import club.joylink.xiannccda.ats.message.MessageId;
|
import club.joylink.xiannccda.ats.message.MessageId;
|
||||||
import club.joylink.xiannccda.ats.message.collect.DeviceDataRepository.DataTypeEnum;
|
import club.joylink.xiannccda.ats.message.collect.DeviceDataRepository.DataTypeEnum;
|
||||||
import club.joylink.xiannccda.ats.warn.BlueDisplayAlertEvent;
|
import club.joylink.xiannccda.ats.warn.BlueDisplayAlertEvent;
|
||||||
import club.joylink.xiannccda.ats.warn.DeviceAlertEvent;
|
|
||||||
import club.joylink.xiannccda.ats.warn.PlatformAlertEvent;
|
|
||||||
import club.joylink.xiannccda.ats.warn.SwitchAndTrackLedAlertEvent;
|
import club.joylink.xiannccda.ats.warn.SwitchAndTrackLedAlertEvent;
|
||||||
import club.joylink.xiannccda.ats.warn.SwitchLostAlertEvent;
|
import club.joylink.xiannccda.ats.warn.SwitchLostAlertEvent;
|
||||||
import club.joylink.xiannccda.dto.protos.DeviceStatusProto.Platform;
|
|
||||||
import club.joylink.xiannccda.dto.protos.DeviceStatusProto.Rtu;
|
import club.joylink.xiannccda.dto.protos.DeviceStatusProto.Rtu;
|
||||||
import club.joylink.xiannccda.dto.protos.DeviceStatusProto.Switch;
|
import club.joylink.xiannccda.dto.protos.DeviceStatusProto.Switch;
|
||||||
import club.joylink.xiannccda.dto.protos.DeviceStatusProto.Track;
|
import club.joylink.xiannccda.dto.protos.DeviceStatusProto.Track;
|
||||||
@ -40,9 +37,9 @@ public class DeviceChangeStatusConvertor extends DefaultConvertor {
|
|||||||
} else if (builder instanceof Switch.Builder switchBuild) {
|
} else if (builder instanceof Switch.Builder switchBuild) {
|
||||||
alertManager.emit(new SwitchLostAlertEvent(switchBuild));
|
alertManager.emit(new SwitchLostAlertEvent(switchBuild));
|
||||||
alertManager.emit(new SwitchAndTrackLedAlertEvent(switchBuild));
|
alertManager.emit(new SwitchAndTrackLedAlertEvent(switchBuild));
|
||||||
} else if (builder instanceof Platform.Builder platformBuild) {
|
} /*else if (builder instanceof Platform.Builder platformBuild) {
|
||||||
alertManager.emit(new PlatformAlertEvent(platformBuild));
|
alertManager.emit(new PlatformAlertEvent(platformBuild));
|
||||||
}
|
}*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,15 +1,11 @@
|
|||||||
package club.joylink.xiannccda.ats.message.collect.convertor;
|
package club.joylink.xiannccda.ats.message.collect.convertor;
|
||||||
|
|
||||||
import club.joylink.xiannccda.alert.core.AlertManager;
|
import club.joylink.xiannccda.alert.core.AlertManager;
|
||||||
import club.joylink.xiannccda.ats.message.MessageData;
|
|
||||||
import club.joylink.xiannccda.ats.message.MessageId;
|
import club.joylink.xiannccda.ats.message.MessageId;
|
||||||
import club.joylink.xiannccda.ats.message.collect.DeviceDataRepository.DataTypeEnum;
|
import club.joylink.xiannccda.ats.message.collect.DeviceDataRepository.DataTypeEnum;
|
||||||
import club.joylink.xiannccda.ats.warn.BlueDisplayAlertEvent;
|
import club.joylink.xiannccda.ats.warn.BlueDisplayAlertEvent;
|
||||||
import club.joylink.xiannccda.ats.warn.DeviceAlertEvent;
|
|
||||||
import club.joylink.xiannccda.ats.warn.PlatformAlertEvent;
|
|
||||||
import club.joylink.xiannccda.ats.warn.SwitchAndTrackLedAlertEvent;
|
import club.joylink.xiannccda.ats.warn.SwitchAndTrackLedAlertEvent;
|
||||||
import club.joylink.xiannccda.ats.warn.SwitchLostAlertEvent;
|
import club.joylink.xiannccda.ats.warn.SwitchLostAlertEvent;
|
||||||
import club.joylink.xiannccda.dto.protos.DeviceStatusProto.Platform;
|
|
||||||
import club.joylink.xiannccda.dto.protos.DeviceStatusProto.Rtu;
|
import club.joylink.xiannccda.dto.protos.DeviceStatusProto.Rtu;
|
||||||
import club.joylink.xiannccda.dto.protos.DeviceStatusProto.Switch;
|
import club.joylink.xiannccda.dto.protos.DeviceStatusProto.Switch;
|
||||||
import club.joylink.xiannccda.dto.protos.DeviceStatusProto.Track;
|
import club.joylink.xiannccda.dto.protos.DeviceStatusProto.Track;
|
||||||
@ -41,9 +37,9 @@ public class DeviceInitConvertor extends DefaultConvertor {
|
|||||||
} else if (builder instanceof Switch.Builder switchBuild) {
|
} else if (builder instanceof Switch.Builder switchBuild) {
|
||||||
alertManager.emit(new SwitchAndTrackLedAlertEvent(switchBuild));
|
alertManager.emit(new SwitchAndTrackLedAlertEvent(switchBuild));
|
||||||
alertManager.emit(new SwitchLostAlertEvent(switchBuild));
|
alertManager.emit(new SwitchLostAlertEvent(switchBuild));
|
||||||
} else if (builder instanceof Platform.Builder platformBuild) {
|
}/* else if (builder instanceof Platform.Builder platformBuild) {
|
||||||
alertManager.emit(new PlatformAlertEvent(platformBuild));
|
alertManager.emit(new PlatformAlertEvent(platformBuild));
|
||||||
}
|
}*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,37 @@
|
|||||||
|
package club.joylink.xiannccda.ats.message.collect.convertor;
|
||||||
|
|
||||||
|
import club.joylink.xiannccda.ats.message.MessageId;
|
||||||
|
import club.joylink.xiannccda.ats.message.collect.DeviceDataRepository;
|
||||||
|
import club.joylink.xiannccda.ats.message.collect.DeviceDataRepository.DataTypeEnum;
|
||||||
|
import club.joylink.xiannccda.ats.message.collect.datasource.InUsedScheduleData;
|
||||||
|
import club.joylink.xiannccda.ats.message.line3.device.ScheduleSubIdType;
|
||||||
|
import club.joylink.xiannccda.dto.protos.TrainShedule.Plan;
|
||||||
|
import com.google.protobuf.GeneratedMessageV3.Builder;
|
||||||
|
import java.util.List;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
public class PlanScheduleConvertor extends DefaultConvertor {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public MessageId getMessageId() {
|
||||||
|
return MessageId.INUSED_SCHEDULE;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public DataTypeEnum dataType() {
|
||||||
|
return DataTypeEnum.TRAIN_PLAN;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void eventHandle(List<Builder> builders) {
|
||||||
|
for (Builder builder : builders) {
|
||||||
|
if ((builder instanceof Plan.Builder plan) && (plan.getActionId() == ScheduleSubIdType.HISTORY_BEGIN.val())) {
|
||||||
|
InUsedScheduleData inUsedScheduleData = DeviceDataRepository.findDataSouce(String.valueOf(plan.getLineId()), DataTypeEnum.TRAIN_PLAN);
|
||||||
|
inUsedScheduleData.clear();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -1,7 +1,13 @@
|
|||||||
package club.joylink.xiannccda.ats.message.collect.convertor;
|
package club.joylink.xiannccda.ats.message.collect.convertor;
|
||||||
|
|
||||||
|
import club.joylink.xiannccda.alert.core.AlertManager;
|
||||||
import club.joylink.xiannccda.ats.message.MessageId;
|
import club.joylink.xiannccda.ats.message.MessageId;
|
||||||
import club.joylink.xiannccda.ats.message.collect.DeviceDataRepository.DataTypeEnum;
|
import club.joylink.xiannccda.ats.message.collect.DeviceDataRepository.DataTypeEnum;
|
||||||
|
import club.joylink.xiannccda.ats.message.line3.rep.TrainRecordResponse;
|
||||||
|
import club.joylink.xiannccda.ats.warn.TrainRecordAlertEvent;
|
||||||
|
import club.joylink.xiannccda.dto.protos.TrainProto.TrainRecord;
|
||||||
|
import com.google.protobuf.GeneratedMessageV3.Builder;
|
||||||
|
import java.util.List;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@ -17,5 +23,14 @@ public class TrainRecordConvertor extends DefaultConvertor {
|
|||||||
return DataTypeEnum.TRAIN;
|
return DataTypeEnum.TRAIN;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private AlertManager alertManager = AlertManager.getDefault();
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void eventHandle(List<Builder> builders) {
|
||||||
|
for (Builder builder : builders) {
|
||||||
|
if ((builder instanceof TrainRecord.Builder trainRecord) && trainRecord.getRecordType()) {
|
||||||
|
alertManager.emit(new TrainRecordAlertEvent(trainRecord));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,55 @@
|
|||||||
|
package club.joylink.xiannccda.ats.message.collect.datasource;
|
||||||
|
|
||||||
|
import club.joylink.xiannccda.dto.protos.TrainShedule.Plan;
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
||||||
|
import com.google.common.collect.HashBasedTable;
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
|
import com.google.common.collect.Table;
|
||||||
|
import com.google.common.collect.Tables;
|
||||||
|
import com.google.protobuf.GeneratedMessageV3.Builder;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
|
public class InUsedScheduleData extends AbstractData {
|
||||||
|
|
||||||
|
public InUsedScheduleData(String lineId) {
|
||||||
|
super(lineId);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* k1 = 列车标号 ,trainId
|
||||||
|
* <p>
|
||||||
|
* k2 = 车次号
|
||||||
|
* <p>
|
||||||
|
* val = 列车的计划
|
||||||
|
*/
|
||||||
|
private final static Table<String, String, List<Plan.Builder>> trainSchedule = Tables.synchronizedTable(HashBasedTable.create());
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addDevice(List<Builder> dataList) {
|
||||||
|
for (Builder builder : dataList) {
|
||||||
|
if (builder instanceof Plan.Builder planBuilder) {
|
||||||
|
List<Plan.Builder> bList = trainSchedule.get(planBuilder.getTrainId(), planBuilder.getGlobalId());
|
||||||
|
if (Objects.isNull(bList)) {
|
||||||
|
bList = Lists.newArrayList();
|
||||||
|
trainSchedule.put(planBuilder.getTrainId(), planBuilder.getGlobalId(), bList);
|
||||||
|
}
|
||||||
|
bList.add(planBuilder);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public Optional<Plan.Builder> findPlan(String trainId, String globalId, Integer stationId, boolean upDownWay) {
|
||||||
|
List<Plan.Builder> plans = trainSchedule.get(trainId, globalId);
|
||||||
|
if (CollectionUtils.isEmpty(plans)) {
|
||||||
|
return Optional.empty();
|
||||||
|
}
|
||||||
|
return plans.stream().filter(d -> d.getStationId() == stationId && d.getUpWay() == upDownWay).findAny();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void clear() {
|
||||||
|
trainSchedule.clear();
|
||||||
|
}
|
||||||
|
}
|
@ -3,6 +3,7 @@ package club.joylink.xiannccda.ats.message.collect.datasource;
|
|||||||
import club.joylink.xiannccda.ats.message.collect.DeviceStatusDataOperate;
|
import club.joylink.xiannccda.ats.message.collect.DeviceStatusDataOperate;
|
||||||
import club.joylink.xiannccda.dto.protos.TrainProto.TrainInfo;
|
import club.joylink.xiannccda.dto.protos.TrainProto.TrainInfo;
|
||||||
import club.joylink.xiannccda.dto.protos.TrainProto.TrainInfo.Builder;
|
import club.joylink.xiannccda.dto.protos.TrainProto.TrainInfo.Builder;
|
||||||
|
import club.joylink.xiannccda.mock.message.Status.Train;
|
||||||
import com.google.common.collect.BiMap;
|
import com.google.common.collect.BiMap;
|
||||||
import com.google.common.collect.HashBasedTable;
|
import com.google.common.collect.HashBasedTable;
|
||||||
import com.google.common.collect.HashBiMap;
|
import com.google.common.collect.HashBiMap;
|
||||||
@ -132,6 +133,10 @@ public class TrainDataSource extends AbstractData {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public TrainInfo.Builder getTrainInfo(String groupId) {
|
||||||
|
return this.allTrainInfoMaper.get(groupId);
|
||||||
|
}
|
||||||
|
|
||||||
public Collection<Builder> getAllTrain() {
|
public Collection<Builder> getAllTrain() {
|
||||||
return this.allTrainInfoMaper.values();
|
return this.allTrainInfoMaper.values();
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,9 @@ package club.joylink.xiannccda.ats.message.line3;
|
|||||||
import io.netty.buffer.ByteBuf;
|
import io.netty.buffer.ByteBuf;
|
||||||
import io.netty.buffer.Unpooled;
|
import io.netty.buffer.Unpooled;
|
||||||
|
|
||||||
|
import java.time.Instant;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.ZoneOffset;
|
||||||
import java.time.format.DateTimeFormatter;
|
import java.time.format.DateTimeFormatter;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
@ -82,4 +84,9 @@ public class DateTimeUtil {
|
|||||||
final int second = from[6];
|
final int second = from[6];
|
||||||
return LocalDateTime.of(year, month, day, hour, minute, second);
|
return LocalDateTime.of(year, month, day, hour, minute, second);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Long epochSecond(LocalDateTime localDateTime) {
|
||||||
|
Instant instant = localDateTime.toInstant(ZoneOffset.UTC); // Convert LocalDateTime to Instant
|
||||||
|
return instant.getEpochSecond();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,13 +2,31 @@ package club.joylink.xiannccda.ats.message.line3.device;
|
|||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 0x0001: 计划列车运行信息消息开始标记
|
||||||
|
* <p>
|
||||||
|
* 0x0002: 计划列车运行信息消息数据标记
|
||||||
|
* <p>
|
||||||
|
* 0x0003:计划列车运行信息消息结束标记
|
||||||
|
* <p>
|
||||||
|
* 实际数据 发送 0 = 开始,1=传输中,2=结束
|
||||||
|
*/
|
||||||
public enum ScheduleSubIdType {
|
public enum ScheduleSubIdType {
|
||||||
BEGIN(0X0001),
|
BEGIN(0X0001),
|
||||||
RUNING(0X0002),
|
RUNING(0X0002),
|
||||||
STOP(0X0003);
|
STOP(0X0003),
|
||||||
|
HISTORY_BEGIN(0),
|
||||||
|
HISTORY_RUN(1),
|
||||||
|
HISTORY_STOP(2),
|
||||||
|
|
||||||
|
;
|
||||||
|
|
||||||
int val;
|
int val;
|
||||||
|
|
||||||
|
public int val() {
|
||||||
|
return this.val;
|
||||||
|
}
|
||||||
|
|
||||||
ScheduleSubIdType(int d) {
|
ScheduleSubIdType(int d) {
|
||||||
this.val = d;
|
this.val = d;
|
||||||
}
|
}
|
||||||
|
@ -4,11 +4,21 @@ import club.joylink.xiannccda.ats.message.MessageResponse;
|
|||||||
import club.joylink.xiannccda.ats.message.line3.DateTimeUtil;
|
import club.joylink.xiannccda.ats.message.line3.DateTimeUtil;
|
||||||
import club.joylink.xiannccda.ats.message.line3.device.ScheduleSubIdType;
|
import club.joylink.xiannccda.ats.message.line3.device.ScheduleSubIdType;
|
||||||
import club.joylink.xiannccda.ats.message.line3.rep.EntityParseUtil.ReadData;
|
import club.joylink.xiannccda.ats.message.line3.rep.EntityParseUtil.ReadData;
|
||||||
|
import club.joylink.xiannccda.dto.protos.TrainShedule.Plan;
|
||||||
import com.alibaba.fastjson2.annotation.JSONField;
|
import com.alibaba.fastjson2.annotation.JSONField;
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
||||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||||
|
import com.google.common.base.Strings;
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
|
import com.google.protobuf.GeneratedMessageV3;
|
||||||
|
import com.google.protobuf.GeneratedMessageV3.Builder;
|
||||||
import io.netty.buffer.ByteBuf;
|
import io.netty.buffer.ByteBuf;
|
||||||
|
import java.time.Instant;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.ZoneId;
|
||||||
|
import java.time.ZoneOffset;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
|
|
||||||
@ -45,6 +55,8 @@ public class InusedScheduleResponse extends MessageResponse {
|
|||||||
* 0x0002: 计划列车运行信息消息数据标记
|
* 0x0002: 计划列车运行信息消息数据标记
|
||||||
* <p>
|
* <p>
|
||||||
* 0x0003:计划列车运行信息消息结束标记
|
* 0x0003:计划列车运行信息消息结束标记
|
||||||
|
* <p>
|
||||||
|
* 实际数据 发送 0 = 开始,1=传输中,2=结束
|
||||||
*/
|
*/
|
||||||
private ScheduleSubIdType subId;
|
private ScheduleSubIdType subId;
|
||||||
/**
|
/**
|
||||||
@ -70,6 +82,39 @@ public class InusedScheduleResponse extends MessageResponse {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<GeneratedMessageV3.Builder> generateProto() {
|
||||||
|
List<GeneratedMessageV3.Builder> planBuilds = Lists.newArrayList();
|
||||||
|
if (CollectionUtils.isEmpty(this.entityList)) {
|
||||||
|
return planBuilds;
|
||||||
|
}
|
||||||
|
for (InusedScheduleEntity entity : this.entityList) {
|
||||||
|
if (CollectionUtils.isNotEmpty(entity.getRecordList())) {
|
||||||
|
for (EntityRecord record : entity.getRecordList()) {
|
||||||
|
Plan.Builder planBuild = Plan.newBuilder();
|
||||||
|
planBuild.setLineId(this.lineId);
|
||||||
|
planBuild.setDate(DateTimeUtil.epochSecond(this.date));
|
||||||
|
planBuild.setActionId(this.subId.val());
|
||||||
|
planBuild.setTrainId(this.trainId);
|
||||||
|
planBuild.setGlobalId(entity.globalId);
|
||||||
|
// String stationCode = Strings.padStart(record.stationId.toString(), 2, '0');
|
||||||
|
|
||||||
|
planBuild.setStationId(record.stationId);
|
||||||
|
planBuild.setPlatformId(record.platformId);
|
||||||
|
planBuild.setATime(DateTimeUtil.epochSecond(record.aTime));
|
||||||
|
planBuild.setDTime(DateTimeUtil.epochSecond(record.dTime));
|
||||||
|
planBuild.setUpWay(record.upDir);
|
||||||
|
planBuild.setTimestamp(this.getTime());
|
||||||
|
planBuild.setReceiveTime(System.currentTimeMillis());
|
||||||
|
if (planBuild.getDTime() > planBuild.getATime()) {
|
||||||
|
planBuilds.add(planBuild);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return planBuilds;
|
||||||
|
}
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
@Setter
|
@Setter
|
||||||
public static class InusedScheduleEntity implements ReadData<InusedScheduleEntity> {
|
public static class InusedScheduleEntity implements ReadData<InusedScheduleEntity> {
|
||||||
@ -136,20 +181,9 @@ public class InusedScheduleResponse extends MessageResponse {
|
|||||||
* 为0表示上行。(首位为第0位)(2)
|
* 为0表示上行。(首位为第0位)(2)
|
||||||
*/
|
*/
|
||||||
private Short flag;
|
private Short flag;
|
||||||
@JSONField(serialize = false, deserialize = false)
|
|
||||||
private byte[] flagBit;
|
|
||||||
|
|
||||||
public boolean Outing() {
|
|
||||||
return this.flagBit[3] == 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean Ining() {
|
private boolean upDir;
|
||||||
return this.flagBit[4] == 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean up() {
|
|
||||||
return this.flagBit[5] == 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 局部序列号(4)
|
* 局部序列号(4)
|
||||||
@ -166,12 +200,11 @@ public class InusedScheduleResponse extends MessageResponse {
|
|||||||
record.aTime = DateTimeUtil.convert(buf);
|
record.aTime = DateTimeUtil.convert(buf);
|
||||||
record.dTime = DateTimeUtil.convert(buf);
|
record.dTime = DateTimeUtil.convert(buf);
|
||||||
record.flag = buf.readShort();
|
record.flag = buf.readShort();
|
||||||
|
|
||||||
record.LocalSubId = buf.readInt();
|
record.LocalSubId = buf.readInt();
|
||||||
|
int bitPosition = 6;
|
||||||
String binaryResultStr = String.format("%8s", Integer.toBinaryString(record.flag))
|
short shiftedValue = (short) (this.flag >> bitPosition);
|
||||||
.replace(" ", "0");
|
short sixthBit = (short) (shiftedValue & 1);
|
||||||
record.flagBit = binaryResultStr.getBytes();
|
this.upDir = sixthBit == 0;
|
||||||
return record;
|
return record;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -173,14 +173,20 @@ public class TrainRecordResponse extends MessageResponse {
|
|||||||
return Lists.newArrayList(builder);
|
return Lists.newArrayList(builder);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 运行方向(1) 0x01:下行 <br> 0x02:上行<br> 0x00:无方向<br>
|
* 运行方向(1) 0x01:下行 <br> 0x02:上行<br> 0x00:无方向<br>
|
||||||
|
* <p>
|
||||||
|
* 但是根据实际接受参数发现1 = 上 0 = 下
|
||||||
*/
|
*/
|
||||||
@Getter
|
@Getter
|
||||||
public static enum DirectionEnum {
|
public static enum DirectionEnum {
|
||||||
Down(0x01),
|
Down(0x01),
|
||||||
Up(0x02),
|
Up(0x02),
|
||||||
Unknown(0x00),
|
Unknown(0x00),
|
||||||
|
//实际属性
|
||||||
|
HISTORY_UP(0x01),
|
||||||
|
HISTORY_DOWN(0x00),
|
||||||
;
|
;
|
||||||
private int value;
|
private int value;
|
||||||
|
|
||||||
@ -201,7 +207,7 @@ public class TrainRecordResponse extends MessageResponse {
|
|||||||
/**
|
/**
|
||||||
* 列车类型(2) 0x01:计划车<br> 0x02:头码车<br> 0x03:M0车<br> 0x04:MM车<br>
|
* 列车类型(2) 0x01:计划车<br> 0x02:头码车<br> 0x03:M0车<br> 0x04:MM车<br>
|
||||||
*/
|
*/
|
||||||
public static enum TrainTypeEnum {
|
public enum TrainTypeEnum {
|
||||||
PlannedTrain(0x01),
|
PlannedTrain(0x01),
|
||||||
HeadTrain(0x02),
|
HeadTrain(0x02),
|
||||||
M0Train(0x03),
|
M0Train(0x03),
|
||||||
@ -209,6 +215,10 @@ public class TrainRecordResponse extends MessageResponse {
|
|||||||
;
|
;
|
||||||
private int type;
|
private int type;
|
||||||
|
|
||||||
|
public int getType() {
|
||||||
|
return this.type;
|
||||||
|
}
|
||||||
|
|
||||||
private TrainTypeEnum(final int type) {
|
private TrainTypeEnum(final int type) {
|
||||||
this.type = type;
|
this.type = type;
|
||||||
}
|
}
|
||||||
|
@ -19,6 +19,7 @@ import club.joylink.xiannccda.dto.protos.LayoutGraphicsProto.Section.SectionType
|
|||||||
import club.joylink.xiannccda.entity.DeviceAreaConfig;
|
import club.joylink.xiannccda.entity.DeviceAreaConfig;
|
||||||
import club.joylink.xiannccda.service.AlertInfoService;
|
import club.joylink.xiannccda.service.AlertInfoService;
|
||||||
import club.joylink.xiannccda.service.config.DeviceGuardConfigService;
|
import club.joylink.xiannccda.service.config.DeviceGuardConfigService;
|
||||||
|
import com.baomidou.mybatisplus.extension.ddl.history.OracleDdlGenerator;
|
||||||
import com.google.protobuf.GeneratedMessageV3;
|
import com.google.protobuf.GeneratedMessageV3;
|
||||||
import com.google.protobuf.GeneratedMessageV3.Builder;
|
import com.google.protobuf.GeneratedMessageV3.Builder;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@ -72,6 +73,7 @@ public class AxleSwitchTrackLedAlertListener implements AlertSourceEventListener
|
|||||||
private void switchHandle(Switch.Builder switchBuilder, String trainGroupId, Section section) {
|
private void switchHandle(Switch.Builder switchBuilder, String trainGroupId, Section section) {
|
||||||
boolean ledRed = switchBuilder.getIpSingleSwitchStusCiOccupied() && !switchBuilder.getIpSingleSwitchStusCbtcOccupied() && Objects.isNull(trainGroupId);
|
boolean ledRed = switchBuilder.getIpSingleSwitchStusCiOccupied() && !switchBuilder.getIpSingleSwitchStusCbtcOccupied() && Objects.isNull(trainGroupId);
|
||||||
boolean orange = switchBuilder.getIpSingleSwitchStusAtcInvalid();
|
boolean orange = switchBuilder.getIpSingleSwitchStusAtcInvalid();
|
||||||
|
log.info("区段光带 道轨区段 线路[{}] 区段[{}] 红光带占用[{}] 橙光带占用[{}]", switchBuilder.getLineId(), section.getCode(), ledRed, orange);
|
||||||
this.emit(ledRed, switchBuilder, section, AlertType.AXLE_LED_RED);
|
this.emit(ledRed, switchBuilder, section, AlertType.AXLE_LED_RED);
|
||||||
this.emit(orange, switchBuilder, section, AlertType.AXLE_LED_ORANGE);
|
this.emit(orange, switchBuilder, section, AlertType.AXLE_LED_ORANGE);
|
||||||
}
|
}
|
||||||
@ -79,6 +81,7 @@ public class AxleSwitchTrackLedAlertListener implements AlertSourceEventListener
|
|||||||
private void trackHandle(Track.Builder trackBuild, String trainGroupId, Section section) {
|
private void trackHandle(Track.Builder trackBuild, String trainGroupId, Section section) {
|
||||||
boolean ledRed = trackBuild.getCiOccupied() && !trackBuild.getCbtcOccupied() && Objects.isNull(trainGroupId);
|
boolean ledRed = trackBuild.getCiOccupied() && !trackBuild.getCbtcOccupied() && Objects.isNull(trainGroupId);
|
||||||
boolean orange = trackBuild.getAtcInvalid();
|
boolean orange = trackBuild.getAtcInvalid();
|
||||||
|
log.info("区段光带 区段 线路[{}] 区段[{}] 红光带占用[{}] 橙光带占用[{}]", trackBuild.getLineId(), section.getCode(), ledRed, orange);
|
||||||
this.emit(ledRed, trackBuild, section, AlertType.AXLE_LED_RED);
|
this.emit(ledRed, trackBuild, section, AlertType.AXLE_LED_RED);
|
||||||
this.emit(orange, trackBuild, section, AlertType.AXLE_LED_ORANGE);
|
this.emit(orange, trackBuild, section, AlertType.AXLE_LED_ORANGE);
|
||||||
}
|
}
|
||||||
|
@ -1,12 +0,0 @@
|
|||||||
package club.joylink.xiannccda.ats.warn;
|
|
||||||
|
|
||||||
import club.joylink.xiannccda.dto.protos.DeviceStatusProto.Platform;
|
|
||||||
import club.joylink.xiannccda.dto.protos.DeviceStatusProto.Platform.Builder;
|
|
||||||
import com.google.protobuf.GeneratedMessageV3;
|
|
||||||
|
|
||||||
public class PlatformAlertEvent extends DeviceAlertEvent<Platform.Builder> {
|
|
||||||
|
|
||||||
public PlatformAlertEvent(Builder source) {
|
|
||||||
super(source);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,29 +0,0 @@
|
|||||||
package club.joylink.xiannccda.ats.warn;
|
|
||||||
|
|
||||||
import club.joylink.xiannccda.alert.core.AlertSourceEventListener;
|
|
||||||
import club.joylink.xiannccda.dto.protos.DeviceStatusProto.Platform;
|
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
|
|
||||||
|
|
||||||
@Component
|
|
||||||
public class PlatformAlertListener implements AlertSourceEventListener<PlatformAlertEvent> {
|
|
||||||
|
|
||||||
private PlatformAlertMonitoringTask platformAlertMonitoringTask;
|
|
||||||
|
|
||||||
public PlatformAlertListener(PlatformAlertMonitoringTask platformAlertMonitoringTask) {
|
|
||||||
this.platformAlertMonitoringTask = platformAlertMonitoringTask;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void accept(PlatformAlertEvent event) {
|
|
||||||
Platform.Builder platformBuild = event.getSource();
|
|
||||||
if (platformBuild.getTrainberth()) {
|
|
||||||
this.platformAlertMonitoringTask.putSwitchIfNotExist(platformBuild);
|
|
||||||
} else {
|
|
||||||
this.platformAlertMonitoringTask.removeSwitch(platformBuild);
|
|
||||||
}
|
|
||||||
//车辆停靠30秒没有开门
|
|
||||||
// 车辆停站开门后60秒
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
@ -5,13 +5,25 @@ import club.joylink.xiannccda.alert.core.AlertDeviceType;
|
|||||||
import club.joylink.xiannccda.alert.core.AlertManager;
|
import club.joylink.xiannccda.alert.core.AlertManager;
|
||||||
import club.joylink.xiannccda.alert.core.AlertMonitoringTask;
|
import club.joylink.xiannccda.alert.core.AlertMonitoringTask;
|
||||||
import club.joylink.xiannccda.ats.cache.LineGraphicDataRepository;
|
import club.joylink.xiannccda.ats.cache.LineGraphicDataRepository;
|
||||||
|
import club.joylink.xiannccda.ats.message.collect.DeviceDataRepository;
|
||||||
|
import club.joylink.xiannccda.ats.message.collect.DeviceDataRepository.DataTypeEnum;
|
||||||
|
import club.joylink.xiannccda.ats.message.collect.datasource.DeviceStatusData;
|
||||||
|
import club.joylink.xiannccda.ats.message.collect.datasource.InUsedScheduleData;
|
||||||
|
import club.joylink.xiannccda.ats.message.line3.rep.TrainRecordResponse.DirectionEnum;
|
||||||
import club.joylink.xiannccda.dto.protos.AlertConstProto.AlertType;
|
import club.joylink.xiannccda.dto.protos.AlertConstProto.AlertType;
|
||||||
|
import club.joylink.xiannccda.dto.protos.DeviceStatusProto;
|
||||||
import club.joylink.xiannccda.dto.protos.DeviceStatusProto.Platform;
|
import club.joylink.xiannccda.dto.protos.DeviceStatusProto.Platform;
|
||||||
import club.joylink.xiannccda.dto.protos.GuardConfigProto.GuardConfig;
|
import club.joylink.xiannccda.dto.protos.GuardConfigProto.GuardConfig;
|
||||||
import club.joylink.xiannccda.dto.protos.LayoutGraphicsProto;
|
import club.joylink.xiannccda.dto.protos.LayoutGraphicsProto;
|
||||||
import club.joylink.xiannccda.dto.protos.LayoutGraphicsProto.Station;
|
import club.joylink.xiannccda.dto.protos.LayoutGraphicsProto.Station;
|
||||||
|
import club.joylink.xiannccda.dto.protos.TrainProto.TrainRecord;
|
||||||
|
import club.joylink.xiannccda.dto.protos.TrainProto.TrainRecord.Builder;
|
||||||
|
import club.joylink.xiannccda.dto.protos.TrainShedule.Plan;
|
||||||
import club.joylink.xiannccda.service.AlertInfoService;
|
import club.joylink.xiannccda.service.AlertInfoService;
|
||||||
import club.joylink.xiannccda.service.config.DeviceGuardConfigService;
|
import club.joylink.xiannccda.service.config.DeviceGuardConfigService;
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
||||||
|
import com.google.common.base.Strings;
|
||||||
|
import com.google.protobuf.GeneratedMessageV3;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
@ -35,37 +47,25 @@ public class PlatformAlertMonitoringTask implements AlertMonitoringTask {
|
|||||||
|
|
||||||
private final AlertManager alertManager = AlertManager.getDefault();
|
private final AlertManager alertManager = AlertManager.getDefault();
|
||||||
|
|
||||||
private Map<String, Platform.Builder> platformMap = new ConcurrentHashMap<>();
|
private Map<String, TrainRecord.Builder> trainRecordMap = new ConcurrentHashMap<>();
|
||||||
private final static String CUSTOM_NAME = AlertDeviceType.DEVICE_TYPE_PLATFORM.name();
|
|
||||||
|
|
||||||
public void putSwitchIfNotExist(Platform.Builder platformBuild) {
|
private final static String PLATFORM_IS_OPEN = "isopen";
|
||||||
|
private final static String PLATFORM_IS_CLOSE = "isclose";
|
||||||
|
|
||||||
Platform.Builder saveBuilder = this.platformMap.get(platformBuild.getId());
|
public void putTrainRecord(TrainRecord.Builder trainRecord) {
|
||||||
|
this.trainRecordMap.put(trainRecord.getTrainId(), trainRecord);
|
||||||
if (Objects.isNull(saveBuilder)) {
|
|
||||||
platformMap.put(platformBuild.getId(), platformBuild);
|
|
||||||
} else {
|
|
||||||
saveBuilder.setPsdOpen(platformBuild.getPsdOpen());
|
|
||||||
//重新计算时间
|
|
||||||
if (platformBuild.getPsdOpen()) {
|
|
||||||
saveBuilder.setTimestamp(platformBuild.getTimestamp());
|
|
||||||
}
|
|
||||||
platformMap.put(platformBuild.getId(), platformBuild);
|
|
||||||
}
|
|
||||||
AlertType alertType = AlertType.PLATFORM_DOOR_CANNOT_CLOSE;
|
|
||||||
if (platformBuild.getPsdOpen()) {
|
|
||||||
alertType = AlertType.PLATFORM_DOOR_CANNOT_OPEN;
|
|
||||||
}
|
|
||||||
alertManager.removeAlterDevice(platformBuild.getLineId(), alertType.name(), platformBuild.getId());
|
|
||||||
log.info("线路[{}] 站台门[{}] 是否打开[{}] ,添加到监控中...", platformBuild.getLineId(), platformBuild.getId(), platformBuild.getPsdOpen());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void removeSwitch(Platform.Builder platformBuild) {
|
public void remoceTrainRecord(TrainRecord.Builder trainRecord) {
|
||||||
log.info("线路[{}] 站台门[{}] 是否打开[{}] ,从监控中移除...", platformBuild.getLineId(), platformBuild.getId(), platformBuild.getPsdOpen());
|
|
||||||
platformMap.remove(platformBuild.getId());
|
|
||||||
alertManager.removeAlterDevice(platformBuild.getLineId(), AlertType.PLATFORM_DOOR_CANNOT_OPEN.name(), platformBuild.getId());
|
|
||||||
alertManager.removeAlterDevice(platformBuild.getLineId(), AlertType.PLATFORM_DOOR_CANNOT_CLOSE.name(), platformBuild.getId());
|
|
||||||
|
|
||||||
|
this.trainRecordMap.remove(trainRecord.getTrainId());
|
||||||
|
boolean isUpWay = trainRecord.getDir() == DirectionEnum.HISTORY_UP.getValue();
|
||||||
|
Platform.Builder platformBuild = this.parsePlatform(trainRecord, isUpWay);
|
||||||
|
if (Objects.nonNull(platformBuild)) {
|
||||||
|
int lineId = trainRecord.getLineId();
|
||||||
|
alertManager.removeAlterDevice(lineId, PLATFORM_IS_OPEN, platformBuild.getId());
|
||||||
|
alertManager.removeAlterDevice(lineId, PLATFORM_IS_CLOSE, platformBuild.getId());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -79,32 +79,76 @@ public class PlatformAlertMonitoringTask implements AlertMonitoringTask {
|
|||||||
return stationOptional.map(Station::getName).orElse(null);
|
return stationOptional.map(Station::getName).orElse(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
private Platform.Builder parsePlatform(TrainRecord.Builder record, boolean isUpWay) {
|
||||||
public void run() {
|
Integer stationId = record.getStationId();
|
||||||
for (Platform.Builder build : platformMap.values()) {
|
String stationCode = Strings.padStart(stationId.toString(), 2, '0');
|
||||||
GuardConfig guardConfig = configService.getGuardConfig(build.getLineId());
|
String platformCode = String.format("PF%s3%s", stationCode, isUpWay ? "02" : "01");
|
||||||
AlertType alertType = AlertType.PLATFORM_DOOR_CANNOT_OPEN;
|
DeviceStatusData deviceStatusData = DeviceDataRepository.findDataSouce(String.valueOf(record.getLineId()), DataTypeEnum.DEVICE);
|
||||||
int timeOut = guardConfig.getCanNotOpenTimes();
|
Map<String, GeneratedMessageV3.Builder> builderMap = deviceStatusData.getAllDeviceMap().get(DeviceStatusProto.Platform.getDescriptor().getName());
|
||||||
if (build.getPsdOpen()) {
|
if (CollectionUtils.isNotEmpty(builderMap)) {
|
||||||
alertType = AlertType.PLATFORM_DOOR_CANNOT_CLOSE;
|
GeneratedMessageV3.Builder builder = builderMap.get(platformCode);
|
||||||
timeOut = guardConfig.getCanNotCloseTimes();
|
if (Objects.nonNull(builder)) {
|
||||||
|
return (Platform.Builder) builder;
|
||||||
}
|
}
|
||||||
LayoutGraphicsProto.Platform platform = LineGraphicDataRepository.getDeviceByCode(build.getLineId(), build.getId(), LayoutGraphicsProto.Platform.class);
|
log.info("车站报点未找到对应的屏蔽门信息,线路[{}] 列车车次号[{}] 车站id[{}] 站台门id[{}] 上下行[{}] 解析屏蔽门code[{}]"
|
||||||
if (this.timeOver(build.getReceiveTime(), timeOut)
|
, record.getLineId(), record.getGlobalId(), record.getStationId(), record.getSideId(), isUpWay, platformCode);
|
||||||
&& alertManager.putAlterDevice(build.getLineId(), alertType.name(), build.getId())) {
|
return null;
|
||||||
String openClose = alertType == AlertType.PLATFORM_DOOR_CANNOT_OPEN ? "打开" : "关闭";
|
}
|
||||||
String wayType = platform.getUp() ? "上行" : "下行";
|
log.info("没有屏蔽门设备状态的数据,线路[{}] 列车车次号[{}] 车站id[{}] 站台门id[{}] 上下行[{}] 解析屏蔽门code[{}]"
|
||||||
String stationName = this.findRefStationName(build.getLineId(), platform.getRefStation());
|
, record.getLineId(), record.getGlobalId(), record.getStationId(), record.getSideId(), isUpWay, platformCode);
|
||||||
String alertMsg = String.format("%s-%s-屏蔽门无法%s", stationName, wayType, openClose);
|
return null;
|
||||||
log.info("屏蔽门[{}] 线路[{}] 触发告警[{}] 车站[{}] 方向[{}]", build.getId(), build.getLineId(), alertType.name(), stationName, wayType);
|
}
|
||||||
NccAlertInfo alertInfo = this.alertInfoService.createAlert(alertType, AlertDeviceType.DEVICE_TYPE_PLATFORM, platform.getCommon().getId(), build, alertMsg, false);
|
|
||||||
alertManager.emit(alertInfo);
|
private void handle(TrainRecord.Builder record, boolean isUpWay) {
|
||||||
platformMap.remove(build.getId());
|
Platform.Builder platformBuild = this.parsePlatform(record, isUpWay);
|
||||||
} else if (this.timeOver(build.getReceiveTime(), timeOut) && alertManager.deviceIsExist(build.getLineId(), alertType.name(), build.getId())) {
|
if (Objects.isNull(platformBuild)) {
|
||||||
platformMap.remove(build.getId());
|
return;
|
||||||
|
}
|
||||||
|
InUsedScheduleData scheduleData = DeviceDataRepository.findDataSouce(String.valueOf(record.getLineId()), DataTypeEnum.TRAIN_PLAN);
|
||||||
|
Optional<Plan.Builder> planBuildOpt = scheduleData.findPlan(record.getTrainId(), record.getGlobalId(), record.getStationId(), isUpWay);
|
||||||
|
Plan.Builder planBuild = planBuildOpt.orElse(null);
|
||||||
|
if (Objects.isNull(planBuild)) {
|
||||||
|
log.info("未找到对应的行车计划,线路[{}] 列车车次号[{}] 车站id[{}] 站台门id[{}] 上下行[{}] 解析屏蔽门code[{}]"
|
||||||
|
, record.getLineId(), record.getGlobalId(), record.getStationId(), record.getSideId(), isUpWay, platformBuild.getId());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
int lineId = platformBuild.getLineId();
|
||||||
|
GuardConfig guardConfig = configService.getGuardConfig(lineId);
|
||||||
|
long stayTimeSecond = planBuild.getDTime() - planBuild.getATime();
|
||||||
|
LayoutGraphicsProto.Platform platform = LineGraphicDataRepository.getDeviceByCode(lineId, platformBuild.getId(), LayoutGraphicsProto.Platform.class);
|
||||||
|
if (platformBuild.getTrainberth()) {
|
||||||
|
boolean isOpen = alertManager.deviceIsExist(lineId, PLATFORM_IS_OPEN, platformBuild.getId());
|
||||||
|
boolean isClose = alertManager.deviceIsExist(lineId, PLATFORM_IS_CLOSE, platformBuild.getId());
|
||||||
|
if (!isOpen && !isClose && this.timeOver(platformBuild.getReceiveTime(), guardConfig.getCanNotOpenTimes())) {
|
||||||
|
this.alert(platform, platformBuild, AlertType.PLATFORM_DOOR_CANNOT_OPEN, PLATFORM_IS_OPEN, isUpWay);
|
||||||
|
} else if (isOpen && this.timeOver(platformBuild.getReceiveTime(), (int) stayTimeSecond + guardConfig.getCanNotCloseTimes())) {
|
||||||
|
this.alert(platform, platformBuild, AlertType.PLATFORM_DOOR_CANNOT_CLOSE, PLATFORM_IS_CLOSE, isUpWay);
|
||||||
|
} else if (platformBuild.getPsdOpen()) {
|
||||||
|
alertManager.putAlterDevice(platformBuild.getLineId(), PLATFORM_IS_OPEN, platformBuild.getId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void alert(LayoutGraphicsProto.Platform platform, Platform.Builder platformBuild, AlertType alertType, String customName, boolean isUpWay) {
|
||||||
|
int lineId = platformBuild.getLineId();
|
||||||
|
if (alertManager.putAlterDevice(lineId, customName, platformBuild.getId())) {
|
||||||
|
String openClose = alertType == AlertType.PLATFORM_DOOR_CANNOT_CLOSE ? "关闭" : "打开";
|
||||||
|
String wayType = isUpWay ? "上行" : "下行";
|
||||||
|
String stationName = this.findRefStationName(lineId, platform.getRefStation());
|
||||||
|
String alertMsg = String.format("%s-%s-屏蔽门无法%s", stationName, wayType, openClose);
|
||||||
|
log.info("屏蔽门[{}] 线路[{}] 触发告警[{}] 车站[{}] 方向[{}]", platformBuild.getId(), lineId, customName, stationName, wayType);
|
||||||
|
NccAlertInfo alertInfo = this.alertInfoService.createAlert(alertType, AlertDeviceType.DEVICE_TYPE_PLATFORM, platform.getCommon().getId(), platformBuild, alertMsg,
|
||||||
|
false);
|
||||||
|
alertManager.emit(alertInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
for (Builder record : this.trainRecordMap.values()) {
|
||||||
|
boolean isUpWay = record.getDir() == DirectionEnum.HISTORY_UP.getValue();
|
||||||
|
this.handle(record, isUpWay);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,22 +5,20 @@ import club.joylink.xiannccda.alert.core.AlertDeviceType;
|
|||||||
import club.joylink.xiannccda.alert.core.AlertManager;
|
import club.joylink.xiannccda.alert.core.AlertManager;
|
||||||
import club.joylink.xiannccda.alert.core.AlertMonitoringTask;
|
import club.joylink.xiannccda.alert.core.AlertMonitoringTask;
|
||||||
import club.joylink.xiannccda.ats.cache.LineGraphicDataRepository;
|
import club.joylink.xiannccda.ats.cache.LineGraphicDataRepository;
|
||||||
|
import club.joylink.xiannccda.ats.message.collect.DeviceDataRepository;
|
||||||
|
import club.joylink.xiannccda.ats.message.collect.DeviceDataRepository.DataTypeEnum;
|
||||||
|
import club.joylink.xiannccda.ats.message.collect.datasource.TrainDataSource;
|
||||||
import club.joylink.xiannccda.dto.protos.AlertConstProto.AlertType;
|
import club.joylink.xiannccda.dto.protos.AlertConstProto.AlertType;
|
||||||
import club.joylink.xiannccda.dto.protos.DeviceStatusProto.Platform;
|
|
||||||
import club.joylink.xiannccda.dto.protos.DeviceStatusProto.TrainMode;
|
import club.joylink.xiannccda.dto.protos.DeviceStatusProto.TrainMode;
|
||||||
import club.joylink.xiannccda.dto.protos.GuardConfigProto.GuardConfig;
|
import club.joylink.xiannccda.dto.protos.GuardConfigProto.GuardConfig;
|
||||||
import club.joylink.xiannccda.dto.protos.LayoutGraphicsProto;
|
|
||||||
import club.joylink.xiannccda.dto.protos.LayoutGraphicsProto.Section;
|
import club.joylink.xiannccda.dto.protos.LayoutGraphicsProto.Section;
|
||||||
import club.joylink.xiannccda.dto.protos.LayoutGraphicsProto.Station;
|
|
||||||
import club.joylink.xiannccda.dto.protos.TrainProto.TrainInfo;
|
import club.joylink.xiannccda.dto.protos.TrainProto.TrainInfo;
|
||||||
import club.joylink.xiannccda.dto.protos.TrainProto.TrainInfo.Builder;
|
|
||||||
import club.joylink.xiannccda.service.AlertInfoService;
|
import club.joylink.xiannccda.service.AlertInfoService;
|
||||||
import club.joylink.xiannccda.service.config.DeviceGuardConfigService;
|
import club.joylink.xiannccda.service.config.DeviceGuardConfigService;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Map.Entry;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.Optional;
|
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.stream.Stream;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
@ -39,17 +37,15 @@ public class TrainAtpCutAlertMonitoringTask implements AlertMonitoringTask {
|
|||||||
|
|
||||||
private final AlertManager alertManager = AlertManager.getDefault();
|
private final AlertManager alertManager = AlertManager.getDefault();
|
||||||
|
|
||||||
private Map<String, TrainInfo.Builder> trainInfoMap = new ConcurrentHashMap<>();
|
private Map<String, Integer> lineTrainGroupMap = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
|
|
||||||
public void putTrainInfoMonitor(TrainInfo.Builder train) {
|
public void putTrainInfoMonitor(TrainInfo.Builder train) {
|
||||||
log.info("线路[{}] 车组号[{}] 列车状态[{}] 加入ATP检测中...", train.getLineId(), train.getGroupId(), train.getMode());
|
log.info("线路[{}] 车组号[{}] 列车状态[{}] 加入ATP检测中...", train.getLineId(), train.getGroupId(), train.getMode());
|
||||||
this.trainInfoMap.put(train.getGroupId(), train);
|
// this.trainInfoMap.put(train.getGroupId(), train);
|
||||||
|
this.lineTrainGroupMap.put(train.getGroupId(), train.getLineId());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void removeTrainInfo(TrainInfo.Builder train) {
|
|
||||||
this.trainInfoMap.remove(train.getGroupId());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getName() {
|
public String getName() {
|
||||||
@ -65,18 +61,22 @@ public class TrainAtpCutAlertMonitoringTask implements AlertMonitoringTask {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Section section = LineGraphicDataRepository.getDeviceByCode(trainInfo.getLineId(), sectionCode, Section.class);
|
Section section = LineGraphicDataRepository.getDeviceByCode(trainInfo.getLineId(), sectionCode, Section.class);
|
||||||
if (alertManager.putAlterDevice(trainInfo.getLineId(), CUSTOM_NAME, trainInfo.getGroupId())) {
|
// if (alertManager.putAlterDevice(trainInfo.getLineId(), CUSTOM_NAME, trainInfo.getGroupId())) {
|
||||||
log.info("列车紧制ATP检测告警 线路[{}] 列车车组号[{}] 所在设备[{}]", trainInfo.getLineId(), trainInfo.getGroupId(), trainInfo.getDevName());
|
log.info("列车紧制ATP检测告警 线路[{}] 列车车组号[{}] 所在设备[{}]", trainInfo.getLineId(), trainInfo.getGroupId(), trainInfo.getDevName());
|
||||||
String alertMsg = String.format("列车[%s] 紧制导致ATP切除所在区段[%s]", trainInfo.getGroupId(), section.getCode());
|
String alertMsg = String.format("列车[%s] 紧制导致ATP切除所在区段[%s]", trainInfo.getGroupId(), section.getCode());
|
||||||
NccAlertInfo alertInfo = this.alertInfoService.createAlert(AlertType.TRAIN_EB_ATP, AlertDeviceType.DEVICE_TYPE_TRAIN, section.getCommon().getId(), trainInfo, alertMsg, false);
|
NccAlertInfo alertInfo = this.alertInfoService.createAlert(AlertType.TRAIN_EB_ATP, AlertDeviceType.DEVICE_TYPE_TRAIN, section.getCommon().getId(), trainInfo, alertMsg, false);
|
||||||
alertManager.emit(alertInfo);
|
alertManager.emit(alertInfo);
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
for (TrainInfo.Builder trainInfo : this.trainInfoMap.values()) {
|
|
||||||
Integer lineId = trainInfo.getLineId();
|
for (Entry<String, Integer> lineGroupEntry : this.lineTrainGroupMap.entrySet()) {
|
||||||
|
Integer lineId = lineGroupEntry.getValue();
|
||||||
|
String groupId = lineGroupEntry.getKey();
|
||||||
|
TrainDataSource trainDataSource = DeviceDataRepository.findDataSouce(lineId.toString(), DataTypeEnum.TRAIN);
|
||||||
|
TrainInfo.Builder trainInfo = trainDataSource.getTrainInfo(groupId);
|
||||||
GuardConfig guardConfig = configService.getGuardConfig(lineId);
|
GuardConfig guardConfig = configService.getGuardConfig(lineId);
|
||||||
TrainMode trainMode = trainInfo.getMode();
|
TrainMode trainMode = trainInfo.getMode();
|
||||||
boolean timeOver = this.timeOver(trainInfo.getReceiveTime(), guardConfig.getTrainAtpCutTimes());
|
boolean timeOver = this.timeOver(trainInfo.getReceiveTime(), guardConfig.getTrainAtpCutTimes());
|
||||||
@ -84,7 +84,7 @@ public class TrainAtpCutAlertMonitoringTask implements AlertMonitoringTask {
|
|||||||
//列车时间ATP切除且时间没有到告警
|
//列车时间ATP切除且时间没有到告警
|
||||||
this.trainAlert(trainInfo);
|
this.trainAlert(trainInfo);
|
||||||
} else if (timeOver) {
|
} else if (timeOver) {
|
||||||
this.removeTrainInfo(trainInfo);
|
this.lineTrainGroupMap.remove(groupId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -30,15 +30,12 @@ public class TrainModeAlertListener implements AlertSourceEventListener<TrainAle
|
|||||||
public void accept(TrainAlertEvent event) {
|
public void accept(TrainAlertEvent event) {
|
||||||
TrainInfo.Builder trainInfo = event.getSource();
|
TrainInfo.Builder trainInfo = event.getSource();
|
||||||
TrainMode trainMode = trainInfo.getMode();
|
TrainMode trainMode = trainInfo.getMode();
|
||||||
log.info("列车紧制ATP检测 线路[{}] 列车车组号[{}] 所在设备[{}] 是否ATP切除[{}] 是否紧制[{}]", trainInfo.getLineId(), trainInfo.getGroupId(), trainInfo.getDevName(),
|
|
||||||
trainMode.getIpModeTrainAtpCut(),
|
|
||||||
trainMode.getIpModeTrainEbAlarm());
|
|
||||||
if (trainMode.getIpModeTrainEbAlarm()) {
|
if (trainMode.getIpModeTrainEbAlarm()) {
|
||||||
//列车紧急制动
|
//列车紧急制动
|
||||||
|
log.info("列车紧制ATP检测 线路[{}] 列车车组号[{}] 所在设备[{}] 是否ATP切除[{}] 是否紧制[{}]", trainInfo.getLineId(), trainInfo.getGroupId(), trainInfo.getDevName(),
|
||||||
|
trainMode.getIpModeTrainAtpCut(),
|
||||||
|
trainMode.getIpModeTrainEbAlarm());
|
||||||
this.atpCutAlertMonitoringTask.putTrainInfoMonitor(trainInfo);
|
this.atpCutAlertMonitoringTask.putTrainInfoMonitor(trainInfo);
|
||||||
} else {
|
|
||||||
//列车回复
|
|
||||||
this.atpCutAlertMonitoringTask.removeTrainInfo(trainInfo);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -0,0 +1,27 @@
|
|||||||
|
package club.joylink.xiannccda.ats.warn;
|
||||||
|
|
||||||
|
import club.joylink.xiannccda.alert.core.AlertSourceEventListener;
|
||||||
|
import club.joylink.xiannccda.ats.message.line3.rep.TrainRecordResponse.TrainTypeEnum;
|
||||||
|
import club.joylink.xiannccda.dto.protos.TrainProto.TrainRecord;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
|
||||||
|
@Component
|
||||||
|
public class TrainReacrdAlertListener implements AlertSourceEventListener<TrainRecordAlertEvent> {
|
||||||
|
|
||||||
|
private PlatformAlertMonitoringTask platformAlertMonitoringTask;
|
||||||
|
|
||||||
|
public TrainReacrdAlertListener(PlatformAlertMonitoringTask platformAlertMonitoringTask) {
|
||||||
|
this.platformAlertMonitoringTask = platformAlertMonitoringTask;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void accept(TrainRecordAlertEvent event) {
|
||||||
|
TrainRecord.Builder trainRecord = event.getSource();
|
||||||
|
if (trainRecord.getTrainType() == TrainTypeEnum.PlannedTrain.getType()) {
|
||||||
|
this.platformAlertMonitoringTask.putTrainRecord(trainRecord);
|
||||||
|
} else {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,11 @@
|
|||||||
|
package club.joylink.xiannccda.ats.warn;
|
||||||
|
|
||||||
|
|
||||||
|
import club.joylink.xiannccda.dto.protos.TrainProto.TrainRecord;
|
||||||
|
|
||||||
|
public class TrainRecordAlertEvent extends DeviceAlertEvent<TrainRecord.Builder> {
|
||||||
|
|
||||||
|
public TrainRecordAlertEvent(TrainRecord.Builder source) {
|
||||||
|
super(source);
|
||||||
|
}
|
||||||
|
}
|
@ -80,7 +80,7 @@ public final class GuardConfigProto {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* <pre>
|
* <pre>
|
||||||
*列车制动 到 atp 切除的延时时间
|
*列车制动后导致atp切除的超时时间
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
* <code>int32 trainAtpCutTimes = 7;</code>
|
* <code>int32 trainAtpCutTimes = 7;</code>
|
||||||
@ -217,7 +217,7 @@ public final class GuardConfigProto {
|
|||||||
private int trainAtpCutTimes_ = 0;
|
private int trainAtpCutTimes_ = 0;
|
||||||
/**
|
/**
|
||||||
* <pre>
|
* <pre>
|
||||||
*列车制动 到 atp 切除的延时时间
|
*列车制动后导致atp切除的超时时间
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
* <code>int32 trainAtpCutTimes = 7;</code>
|
* <code>int32 trainAtpCutTimes = 7;</code>
|
||||||
@ -926,7 +926,7 @@ public final class GuardConfigProto {
|
|||||||
private int trainAtpCutTimes_ ;
|
private int trainAtpCutTimes_ ;
|
||||||
/**
|
/**
|
||||||
* <pre>
|
* <pre>
|
||||||
*列车制动 到 atp 切除的延时时间
|
*列车制动后导致atp切除的超时时间
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
* <code>int32 trainAtpCutTimes = 7;</code>
|
* <code>int32 trainAtpCutTimes = 7;</code>
|
||||||
@ -938,7 +938,7 @@ public final class GuardConfigProto {
|
|||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* <pre>
|
* <pre>
|
||||||
*列车制动 到 atp 切除的延时时间
|
*列车制动后导致atp切除的超时时间
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
* <code>int32 trainAtpCutTimes = 7;</code>
|
* <code>int32 trainAtpCutTimes = 7;</code>
|
||||||
@ -954,7 +954,7 @@ public final class GuardConfigProto {
|
|||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* <pre>
|
* <pre>
|
||||||
*列车制动 到 atp 切除的延时时间
|
*列车制动后导致atp切除的超时时间
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
* <code>int32 trainAtpCutTimes = 7;</code>
|
* <code>int32 trainAtpCutTimes = 7;</code>
|
||||||
|
1467
src/main/java/club/joylink/xiannccda/dto/protos/TrainShedule.java
Normal file
1467
src/main/java/club/joylink/xiannccda/dto/protos/TrainShedule.java
Normal file
File diff suppressed because it is too large
Load Diff
@ -78,9 +78,7 @@ public class NccMockDataService {
|
|||||||
lam.gt(NccMockData::getId, LAST_ID);
|
lam.gt(NccMockData::getId, LAST_ID);
|
||||||
}
|
}
|
||||||
List<NccMockData> nccMockData = this.nccMockDataRepository.list(wrapp);
|
List<NccMockData> nccMockData = this.nccMockDataRepository.list(wrapp);
|
||||||
// if (nccMockData.stream().anyMatch(d -> d.getId() == 59231)) {
|
|
||||||
// System.out.println("aaaaaaaaaaaaaaaaaaaaa");
|
|
||||||
// }
|
|
||||||
List<MessageData> list = this.parse(nccMockData);
|
List<MessageData> list = this.parse(nccMockData);
|
||||||
if (CollectionUtils.isEmpty(nccMockData)) {
|
if (CollectionUtils.isEmpty(nccMockData)) {
|
||||||
FINISH = true;
|
FINISH = true;
|
||||||
@ -88,6 +86,7 @@ public class NccMockDataService {
|
|||||||
return Collections.emptyList();
|
return Collections.emptyList();
|
||||||
} else {
|
} else {
|
||||||
LAST_ID = nccMockData.get(nccMockData.size() - 1).getId();
|
LAST_ID = nccMockData.get(nccMockData.size() - 1).getId();
|
||||||
|
System.out.println("aaaaaaaaaaaaaa" + LAST_ID);
|
||||||
return list.stream().map(d -> (MessageResponse) d).toList();
|
return list.stream().map(d -> (MessageResponse) d).toList();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,10 +8,13 @@ import club.joylink.xiannccda.dto.protos.DeviceStatusProto.Platform;
|
|||||||
import club.joylink.xiannccda.dto.protos.TrainProto.TrainInfo;
|
import club.joylink.xiannccda.dto.protos.TrainProto.TrainInfo;
|
||||||
import com.google.common.collect.BiMap;
|
import com.google.common.collect.BiMap;
|
||||||
import com.google.common.collect.HashBiMap;
|
import com.google.common.collect.HashBiMap;
|
||||||
|
import com.mysql.cj.x.protobuf.MysqlxDatatypes;
|
||||||
import java.io.BufferedReader;
|
import java.io.BufferedReader;
|
||||||
import java.io.FileReader;
|
import java.io.FileReader;
|
||||||
|
import java.io.UnsupportedEncodingException;
|
||||||
import java.sql.SQLOutput;
|
import java.sql.SQLOutput;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Base64;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@ -61,8 +64,19 @@ public class DeviceStatusCheckTest {
|
|||||||
public void trainTest() {
|
public void trainTest() {
|
||||||
System.out.println(TRAIN_MODE.IP_MODE_TRAIN_ATP_CUT.getValue() | TRAIN_MODE.IP_MODE_TRAIN_EB_ALARM.getValue());
|
System.out.println(TRAIN_MODE.IP_MODE_TRAIN_ATP_CUT.getValue() | TRAIN_MODE.IP_MODE_TRAIN_EB_ALARM.getValue());
|
||||||
DeviceStatusProto.TrainMode.Builder trainMode =
|
DeviceStatusProto.TrainMode.Builder trainMode =
|
||||||
DeviceStatusConvertor.convert(DeviceStatus.TRAIN_MODE.class, 1);
|
DeviceStatusConvertor.convert(DeviceStatus.TRAIN_MODE.class, TRAIN_MODE.IP_MODE_TRAIN_ATP_CUT.getValue() | TRAIN_MODE.IP_MODE_TRAIN_EB_ALARM.getValue());
|
||||||
System.out.println(trainMode);
|
System.out.println(trainMode);
|
||||||
|
System.out.println("--------------------------------");
|
||||||
|
System.out.println(TRAIN_MODE.IP_MODE_TRAIN_EB_ALARM.getValue());
|
||||||
|
DeviceStatusProto.TrainMode.Builder ebAlarm =
|
||||||
|
DeviceStatusConvertor.convert(DeviceStatus.TRAIN_MODE.class, TRAIN_MODE.IP_MODE_TRAIN_EB_ALARM.getValue());
|
||||||
|
System.out.println(ebAlarm);
|
||||||
|
System.out.println("--------------------------------");
|
||||||
|
System.out.println(TRAIN_MODE.IP_MODE_TRAIN_ATP_CUT.getValue());
|
||||||
|
|
||||||
|
DeviceStatusProto.TrainMode.Builder atpCut =
|
||||||
|
DeviceStatusConvertor.convert(DeviceStatus.TRAIN_MODE.class, TRAIN_MODE.IP_MODE_TRAIN_ATP_CUT.getValue());
|
||||||
|
System.out.println(atpCut);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -124,4 +138,11 @@ public class DeviceStatusCheckTest {
|
|||||||
System.out.println(upperToLower); //{A=x, B=b, D=c}
|
System.out.println(upperToLower); //{A=x, B=b, D=c}
|
||||||
System.out.println(lowerToUpper); //{x=A, b=B, c=D}
|
System.out.println(lowerToUpper); //{x=A, b=B, c=D}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void dd() throws UnsupportedEncodingException {
|
||||||
|
java.lang.String dd = "Q/ohUOUluX5c+sKN62xNrEdSGpixEb//Uv2/AORejJwwQbl6/zF5MjJSpyF6OBLqjInQ24u0DKYMy51/U1As5Pj+YnbD3n7A0nCcqQ1fkhJpt2wdjnaqbYunYamwKctCfLBwoBEjK62TA1ZcON0KH/rb9TWsfBWLJVIlV5PYMXYJXnYbt7KKY8XxOgIT7bZbXeZS/1InIdLYJVzmyCGtnFFg8THLp2MQJzXhiTqerzig7HWR++TypL778+mPaXuDHefKC0cTxz7Zz9LefkvsEB6h3eYBcDj4EcnZzI91VTIPyzfw2JhJ67otWIxDBNS0hfo9m27N3irpIr+eyu6hD/W3KkNJPamzvYOecHgCQKs7vDq8wF/XZm0jWwqQF6XDacf1K+tcL77KsDpPW+HhnUQ/347orSpFGoPpkIUXT27NBzg0V9OZOjbUsdnMXVZgKF4pEBR6FrlDhpjVCgIgn6I3a8ZG6naPZgQd5HIGzVEuYqRHehz8L3e53lpT0mXeEYcdYd/K9D7VJ7CaUZ6KAO1R29+fRNiuj4PPI2+f5UaaeXg85Cq3q5Yi1q4bkd94KkIfEwV1SbtRMRFC/ZVtBeIozq/fPj/j6E2cDenLqlzZFzapDzAz/3mnWe+hcNn4CVbl40ELGZKduXJxUN0ftY59annoMtKwNbDS58VPtXBZ4GsA4gQLgoJKs04L3cml8oEk4j0cuNYPi/KH58rObnlKAtfsFwsOuIOG2k5i5CdnUEvTEmHgvvghJpCOdY2kngmHHvtw+hbCsa1RceeIxdZYLMwFyQLNn+VkrToI6/msEgj1b6F/garriuocN9gN7ZvjC2Mi8ZnvTGaRr5qGb21y13JNWEAhmp0H7IH2LuTL73SPgBB58DmQcRPB7YmwC/HoZB6VUyuIGCYSwGbCNnW6s8/wDGw/KSluO69DtasgX9HGhBtm6qaqEiToJWglM46cPv0zoofFkCyXgbyTerSApcOvi4Onm4CWvnarEvclDdNbGoNvQstYJ8ol/H/hjmVk/Lb87y2ynD58vR4QrA==";
|
||||||
|
byte[] bgb = Base64.getDecoder().decode(dd);
|
||||||
|
System.out.println(new String(bgb, "UTF-8"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -17,6 +17,9 @@ import club.joylink.xiannccda.ats.message.line3.rep.DeviceStatusBitmapResponse.D
|
|||||||
import club.joylink.xiannccda.ats.message.line3.rep.DeviceStatusChangeResponse;
|
import club.joylink.xiannccda.ats.message.line3.rep.DeviceStatusChangeResponse;
|
||||||
import club.joylink.xiannccda.ats.message.line3.rep.TrainIndicationUpdateResponse;
|
import club.joylink.xiannccda.ats.message.line3.rep.TrainIndicationUpdateResponse;
|
||||||
import club.joylink.xiannccda.dto.protos.DeviceStatusProto;
|
import club.joylink.xiannccda.dto.protos.DeviceStatusProto;
|
||||||
|
import club.joylink.xiannccda.dto.protos.DeviceStatusProto.TrainMode;
|
||||||
|
import club.joylink.xiannccda.dto.protos.TrainProto.TrainInfo;
|
||||||
|
import club.joylink.xiannccda.dto.protos.TrainProto.TrainInfo.Builder;
|
||||||
import club.joylink.xiannccda.mock.message.MockAppContext;
|
import club.joylink.xiannccda.mock.message.MockAppContext;
|
||||||
import club.joylink.xiannccda.mock.message.NccMockData;
|
import club.joylink.xiannccda.mock.message.NccMockData;
|
||||||
import club.joylink.xiannccda.mock.message.NccMockData.ActionTypeEnum;
|
import club.joylink.xiannccda.mock.message.NccMockData.ActionTypeEnum;
|
||||||
@ -207,4 +210,5 @@ public class TrainDataTest {
|
|||||||
System.out.println(messageDatum.generateProto());
|
System.out.println(messageDatum.generateProto());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1 +1 @@
|
|||||||
Subproject commit 7aebba13bf04bf2c59df3595c5650a96e616bef4
|
Subproject commit d82140370ef78529ad745356e41bad635a333457
|
Loading…
Reference in New Issue
Block a user