From d72eedf7b741df6ed42c9fef2dc73d2b6d17d178 Mon Sep 17 00:00:00 2001 From: tiger_zhou Date: Mon, 4 Sep 2023 11:13:11 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B1=8F=E8=94=BD=E9=97=A8=E9=80=BB=E8=BE=91?= =?UTF-8?q?=E6=9B=B4=E6=94=B9=EF=BC=8C=E5=88=AB=E7=9A=84=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../joylink/xiannccda/alert/AlertEmitJob.java | 23 +- .../ats/message/OccMessageHandler.java | 2 + .../message/collect/DeviceDataRepository.java | 6 +- .../DeviceChangeStatusConvertor.java | 7 +- .../convertor/DeviceInitConvertor.java | 8 +- .../convertor/PlanScheduleConvertor.java | 37 + .../convertor/TrainRecordConvertor.java | 15 + .../datasource/InUsedScheduleData.java | 55 + .../collect/datasource/TrainDataSource.java | 5 + .../ats/message/line3/DateTimeUtil.java | 7 + .../line3/device/ScheduleSubIdType.java | 20 +- .../line3/rep/InusedScheduleResponse.java | 67 +- .../line3/rep/TrainRecordResponse.java | 12 +- .../warn/AxleSwitchTrackLedAlertListener.java | 3 + .../ats/warn/PlatformAlertEvent.java | 12 - .../ats/warn/PlatformAlertListener.java | 29 - .../ats/warn/PlatformAlertMonitoringTask.java | 140 +- .../warn/TrainAtpCutAlertMonitoringTask.java | 40 +- .../ats/warn/TrainModeAlertListener.java | 9 +- .../ats/warn/TrainReacrdAlertListener.java | 27 + .../ats/warn/TrainRecordAlertEvent.java | 11 + .../dto/protos/GuardConfigProto.java | 10 +- .../xiannccda/dto/protos/TrainShedule.java | 1467 +++++++++++++++++ .../mock/message/NccMockDataService.java | 5 +- .../device/DeviceStatusCheckTest.java | 23 +- .../xiannccda/device/TrainDataTest.java | 4 + xian-ncc-da-message | 2 +- 27 files changed, 1878 insertions(+), 168 deletions(-) create mode 100644 src/main/java/club/joylink/xiannccda/ats/message/collect/convertor/PlanScheduleConvertor.java create mode 100644 src/main/java/club/joylink/xiannccda/ats/message/collect/datasource/InUsedScheduleData.java delete mode 100644 src/main/java/club/joylink/xiannccda/ats/warn/PlatformAlertEvent.java delete mode 100644 src/main/java/club/joylink/xiannccda/ats/warn/PlatformAlertListener.java create mode 100644 src/main/java/club/joylink/xiannccda/ats/warn/TrainReacrdAlertListener.java create mode 100644 src/main/java/club/joylink/xiannccda/ats/warn/TrainRecordAlertEvent.java create mode 100644 src/main/java/club/joylink/xiannccda/dto/protos/TrainShedule.java diff --git a/src/main/java/club/joylink/xiannccda/alert/AlertEmitJob.java b/src/main/java/club/joylink/xiannccda/alert/AlertEmitJob.java index a96e9bd..a86882b 100644 --- a/src/main/java/club/joylink/xiannccda/alert/AlertEmitJob.java +++ b/src/main/java/club/joylink/xiannccda/alert/AlertEmitJob.java @@ -4,8 +4,6 @@ import club.joylink.xiannccda.alert.core.AlertManager; import club.joylink.xiannccda.ats.warn.AxleSwitchTrackLedAlertListener; import club.joylink.xiannccda.ats.warn.BlueAlertListener; 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.SwitchAndTrackLedAlertEvent; 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.TrainAtpCutAlertMonitoringTask; 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.boot.ApplicationArguments; import org.springframework.boot.ApplicationRunner; @@ -35,28 +35,33 @@ public class AlertEmitJob implements ApplicationRunner { private SwitchLostAlertListener switchLostAlertListener; @Autowired private PlatformAlertMonitoringTask platformAlertMonitoringTask; - @Autowired - private PlatformAlertListener platformAlertListener; + @Autowired private TrainModeAlertListener trainModeAlertListener; @Autowired private TrainAtpCutAlertMonitoringTask trainAtpCutAlertMonitoringTask; + @Autowired + private TrainReacrdAlertListener trainReacrdAlertListener; @Override public void run(ApplicationArguments args) throws Exception { 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.platformAlertMonitoringTask); + //列车atp切除任务 alertManager.addTask(this.trainAtpCutAlertMonitoringTask); + //光带检查监听 alertManager.on(this.axleSwitchTrackLedAlertListener2, SwitchAndTrackLedAlertEvent.class); + //蓝显检测 alertManager.on(this.blueAlertListener2, BlueDisplayAlertEvent.class); + // 道岔失表监听 alertManager.on(this.switchLostAlertListener, SwitchLostAlertEvent.class); - alertManager.on(this.platformAlertListener, PlatformAlertEvent.class); + // 列车制动监听 alertManager.on(this.trainModeAlertListener, TrainAlertEvent.class); + //列车报点监听 + alertManager.on(this.trainReacrdAlertListener, TrainRecordAlertEvent.class); } } diff --git a/src/main/java/club/joylink/xiannccda/ats/message/OccMessageHandler.java b/src/main/java/club/joylink/xiannccda/ats/message/OccMessageHandler.java index 0c15913..5436802 100644 --- a/src/main/java/club/joylink/xiannccda/ats/message/OccMessageHandler.java +++ b/src/main/java/club/joylink/xiannccda/ats/message/OccMessageHandler.java @@ -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.LineNetTrainRemoveConvertor; 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.TrainRecordConvertor; import club.joylink.xiannccda.ats.message.collect.convertor.TrainRemoveConvertor; @@ -38,6 +39,7 @@ public class OccMessageHandler extends SimpleChannelInboundHandler data, DataTypeEnum dataTypeEnum) { AbstractData ad = find(lineId, dataTypeEnum); - ad.addDevice(data); } @@ -60,7 +58,7 @@ public class DeviceDataRepository { } public enum DataTypeEnum { - DEVICE(DeviceStatusData.class), TRAIN(TrainDataSource.class), + DEVICE(DeviceStatusData.class), TRAIN(TrainDataSource.class), TRAIN_PLAN(InUsedScheduleData.class), ; Class clazz; diff --git a/src/main/java/club/joylink/xiannccda/ats/message/collect/convertor/DeviceChangeStatusConvertor.java b/src/main/java/club/joylink/xiannccda/ats/message/collect/convertor/DeviceChangeStatusConvertor.java index cf2e613..3564781 100644 --- a/src/main/java/club/joylink/xiannccda/ats/message/collect/convertor/DeviceChangeStatusConvertor.java +++ b/src/main/java/club/joylink/xiannccda/ats/message/collect/convertor/DeviceChangeStatusConvertor.java @@ -4,11 +4,8 @@ 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.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.SwitchLostAlertEvent; -import club.joylink.xiannccda.dto.protos.DeviceStatusProto.Platform; import club.joylink.xiannccda.dto.protos.DeviceStatusProto.Rtu; import club.joylink.xiannccda.dto.protos.DeviceStatusProto.Switch; import club.joylink.xiannccda.dto.protos.DeviceStatusProto.Track; @@ -40,9 +37,9 @@ public class DeviceChangeStatusConvertor extends DefaultConvertor { } else if (builder instanceof Switch.Builder switchBuild) { alertManager.emit(new SwitchLostAlertEvent(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)); - } + }*/ } } } diff --git a/src/main/java/club/joylink/xiannccda/ats/message/collect/convertor/DeviceInitConvertor.java b/src/main/java/club/joylink/xiannccda/ats/message/collect/convertor/DeviceInitConvertor.java index 3e4d1b2..cadea4e 100644 --- a/src/main/java/club/joylink/xiannccda/ats/message/collect/convertor/DeviceInitConvertor.java +++ b/src/main/java/club/joylink/xiannccda/ats/message/collect/convertor/DeviceInitConvertor.java @@ -1,15 +1,11 @@ package club.joylink.xiannccda.ats.message.collect.convertor; 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.collect.DeviceDataRepository.DataTypeEnum; 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.SwitchLostAlertEvent; -import club.joylink.xiannccda.dto.protos.DeviceStatusProto.Platform; import club.joylink.xiannccda.dto.protos.DeviceStatusProto.Rtu; import club.joylink.xiannccda.dto.protos.DeviceStatusProto.Switch; import club.joylink.xiannccda.dto.protos.DeviceStatusProto.Track; @@ -41,9 +37,9 @@ public class DeviceInitConvertor extends DefaultConvertor { } else if (builder instanceof Switch.Builder switchBuild) { alertManager.emit(new SwitchAndTrackLedAlertEvent(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)); - } + }*/ } } } diff --git a/src/main/java/club/joylink/xiannccda/ats/message/collect/convertor/PlanScheduleConvertor.java b/src/main/java/club/joylink/xiannccda/ats/message/collect/convertor/PlanScheduleConvertor.java new file mode 100644 index 0000000..919b5b8 --- /dev/null +++ b/src/main/java/club/joylink/xiannccda/ats/message/collect/convertor/PlanScheduleConvertor.java @@ -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 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(); + } + } + } + +} 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 19822cd..b51f512 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 @@ -1,7 +1,13 @@ 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.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; @Slf4j @@ -17,5 +23,14 @@ public class TrainRecordConvertor extends DefaultConvertor { return DataTypeEnum.TRAIN; } + private AlertManager alertManager = AlertManager.getDefault(); + @Override + protected void eventHandle(List builders) { + for (Builder builder : builders) { + if ((builder instanceof TrainRecord.Builder trainRecord) && trainRecord.getRecordType()) { + alertManager.emit(new TrainRecordAlertEvent(trainRecord)); + } + } + } } diff --git a/src/main/java/club/joylink/xiannccda/ats/message/collect/datasource/InUsedScheduleData.java b/src/main/java/club/joylink/xiannccda/ats/message/collect/datasource/InUsedScheduleData.java new file mode 100644 index 0000000..d3134e6 --- /dev/null +++ b/src/main/java/club/joylink/xiannccda/ats/message/collect/datasource/InUsedScheduleData.java @@ -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 + *

+ * k2 = 车次号 + *

+ * val = 列车的计划 + */ + private final static Table> trainSchedule = Tables.synchronizedTable(HashBasedTable.create()); + + @Override + public void addDevice(List dataList) { + for (Builder builder : dataList) { + if (builder instanceof Plan.Builder planBuilder) { + List 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 findPlan(String trainId, String globalId, Integer stationId, boolean upDownWay) { + List 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(); + } +} diff --git a/src/main/java/club/joylink/xiannccda/ats/message/collect/datasource/TrainDataSource.java b/src/main/java/club/joylink/xiannccda/ats/message/collect/datasource/TrainDataSource.java index c90c781..6231dd5 100644 --- a/src/main/java/club/joylink/xiannccda/ats/message/collect/datasource/TrainDataSource.java +++ b/src/main/java/club/joylink/xiannccda/ats/message/collect/datasource/TrainDataSource.java @@ -3,6 +3,7 @@ package club.joylink.xiannccda.ats.message.collect.datasource; import club.joylink.xiannccda.ats.message.collect.DeviceStatusDataOperate; import club.joylink.xiannccda.dto.protos.TrainProto.TrainInfo; 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.HashBasedTable; 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 getAllTrain() { return this.allTrainInfoMaper.values(); } diff --git a/src/main/java/club/joylink/xiannccda/ats/message/line3/DateTimeUtil.java b/src/main/java/club/joylink/xiannccda/ats/message/line3/DateTimeUtil.java index 80f2d74..436e42f 100644 --- a/src/main/java/club/joylink/xiannccda/ats/message/line3/DateTimeUtil.java +++ b/src/main/java/club/joylink/xiannccda/ats/message/line3/DateTimeUtil.java @@ -3,7 +3,9 @@ package club.joylink.xiannccda.ats.message.line3; import io.netty.buffer.ByteBuf; import io.netty.buffer.Unpooled; +import java.time.Instant; import java.time.LocalDateTime; +import java.time.ZoneOffset; import java.time.format.DateTimeFormatter; import org.apache.commons.lang3.StringUtils; @@ -82,4 +84,9 @@ public class DateTimeUtil { final int second = from[6]; 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(); + } } diff --git a/src/main/java/club/joylink/xiannccda/ats/message/line3/device/ScheduleSubIdType.java b/src/main/java/club/joylink/xiannccda/ats/message/line3/device/ScheduleSubIdType.java index 69f90fd..4d49044 100644 --- a/src/main/java/club/joylink/xiannccda/ats/message/line3/device/ScheduleSubIdType.java +++ b/src/main/java/club/joylink/xiannccda/ats/message/line3/device/ScheduleSubIdType.java @@ -2,13 +2,31 @@ package club.joylink.xiannccda.ats.message.line3.device; import java.util.Arrays; +/** + * 0x0001: 计划列车运行信息消息开始标记 + *

+ * 0x0002: 计划列车运行信息消息数据标记 + *

+ * 0x0003:计划列车运行信息消息结束标记 + *

+ * 实际数据 发送 0 = 开始,1=传输中,2=结束 + */ public enum ScheduleSubIdType { BEGIN(0X0001), RUNING(0X0002), - STOP(0X0003); + STOP(0X0003), + HISTORY_BEGIN(0), + HISTORY_RUN(1), + HISTORY_STOP(2), + + ; int val; + public int val() { + return this.val; + } + ScheduleSubIdType(int d) { this.val = d; } diff --git a/src/main/java/club/joylink/xiannccda/ats/message/line3/rep/InusedScheduleResponse.java b/src/main/java/club/joylink/xiannccda/ats/message/line3/rep/InusedScheduleResponse.java index 232265d..460bd83 100644 --- a/src/main/java/club/joylink/xiannccda/ats/message/line3/rep/InusedScheduleResponse.java +++ b/src/main/java/club/joylink/xiannccda/ats/message/line3/rep/InusedScheduleResponse.java @@ -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.device.ScheduleSubIdType; 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.baomidou.mybatisplus.core.toolkit.CollectionUtils; 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 java.time.Instant; import java.time.LocalDateTime; +import java.time.ZoneId; +import java.time.ZoneOffset; import java.util.List; +import java.util.concurrent.TimeUnit; import lombok.Getter; import lombok.Setter; @@ -45,6 +55,8 @@ public class InusedScheduleResponse extends MessageResponse { * 0x0002: 计划列车运行信息消息数据标记 *

* 0x0003:计划列车运行信息消息结束标记 + *

+ * 实际数据 发送 0 = 开始,1=传输中,2=结束 */ private ScheduleSubIdType subId; /** @@ -70,6 +82,39 @@ public class InusedScheduleResponse extends MessageResponse { } } + @Override + public List generateProto() { + List 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 @Setter public static class InusedScheduleEntity implements ReadData { @@ -136,20 +181,9 @@ public class InusedScheduleResponse extends MessageResponse { * 为0表示上行。(首位为第0位)(2) */ private Short flag; - @JSONField(serialize = false, deserialize = false) - private byte[] flagBit; - public boolean Outing() { - return this.flagBit[3] == 1; - } - public boolean Ining() { - return this.flagBit[4] == 1; - } - - public boolean up() { - return this.flagBit[5] == 1; - } + private boolean upDir; /** * 局部序列号(4) @@ -166,12 +200,11 @@ public class InusedScheduleResponse extends MessageResponse { record.aTime = DateTimeUtil.convert(buf); record.dTime = DateTimeUtil.convert(buf); record.flag = buf.readShort(); - record.LocalSubId = buf.readInt(); - - String binaryResultStr = String.format("%8s", Integer.toBinaryString(record.flag)) - .replace(" ", "0"); - record.flagBit = binaryResultStr.getBytes(); + int bitPosition = 6; + short shiftedValue = (short) (this.flag >> bitPosition); + short sixthBit = (short) (shiftedValue & 1); + this.upDir = sixthBit == 0; return record; } } 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 4681b2c..aa8669a 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 @@ -173,14 +173,20 @@ public class TrainRecordResponse extends MessageResponse { return Lists.newArrayList(builder); } + /** * 运行方向(1) 0x01:下行
0x02:上行
0x00:无方向
+ *

+ * 但是根据实际接受参数发现1 = 上 0 = 下 */ @Getter public static enum DirectionEnum { Down(0x01), Up(0x02), Unknown(0x00), + //实际属性 + HISTORY_UP(0x01), + HISTORY_DOWN(0x00), ; private int value; @@ -201,7 +207,7 @@ public class TrainRecordResponse extends MessageResponse { /** * 列车类型(2) 0x01:计划车
0x02:头码车
0x03:M0车
0x04:MM车
*/ - public static enum TrainTypeEnum { + public enum TrainTypeEnum { PlannedTrain(0x01), HeadTrain(0x02), M0Train(0x03), @@ -209,6 +215,10 @@ public class TrainRecordResponse extends MessageResponse { ; private int type; + public int getType() { + return this.type; + } + private TrainTypeEnum(final int type) { this.type = type; } diff --git a/src/main/java/club/joylink/xiannccda/ats/warn/AxleSwitchTrackLedAlertListener.java b/src/main/java/club/joylink/xiannccda/ats/warn/AxleSwitchTrackLedAlertListener.java index 2f33f04..f2bb2bd 100644 --- a/src/main/java/club/joylink/xiannccda/ats/warn/AxleSwitchTrackLedAlertListener.java +++ b/src/main/java/club/joylink/xiannccda/ats/warn/AxleSwitchTrackLedAlertListener.java @@ -19,6 +19,7 @@ import club.joylink.xiannccda.dto.protos.LayoutGraphicsProto.Section.SectionType import club.joylink.xiannccda.entity.DeviceAreaConfig; import club.joylink.xiannccda.service.AlertInfoService; 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.Builder; import java.util.Map; @@ -72,6 +73,7 @@ public class AxleSwitchTrackLedAlertListener implements AlertSourceEventListener private void switchHandle(Switch.Builder switchBuilder, String trainGroupId, Section section) { boolean ledRed = switchBuilder.getIpSingleSwitchStusCiOccupied() && !switchBuilder.getIpSingleSwitchStusCbtcOccupied() && Objects.isNull(trainGroupId); boolean orange = switchBuilder.getIpSingleSwitchStusAtcInvalid(); + log.info("区段光带 道轨区段 线路[{}] 区段[{}] 红光带占用[{}] 橙光带占用[{}]", switchBuilder.getLineId(), section.getCode(), ledRed, orange); this.emit(ledRed, switchBuilder, section, AlertType.AXLE_LED_RED); 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) { boolean ledRed = trackBuild.getCiOccupied() && !trackBuild.getCbtcOccupied() && Objects.isNull(trainGroupId); boolean orange = trackBuild.getAtcInvalid(); + log.info("区段光带 区段 线路[{}] 区段[{}] 红光带占用[{}] 橙光带占用[{}]", trackBuild.getLineId(), section.getCode(), ledRed, orange); this.emit(ledRed, trackBuild, section, AlertType.AXLE_LED_RED); this.emit(orange, trackBuild, section, AlertType.AXLE_LED_ORANGE); } diff --git a/src/main/java/club/joylink/xiannccda/ats/warn/PlatformAlertEvent.java b/src/main/java/club/joylink/xiannccda/ats/warn/PlatformAlertEvent.java deleted file mode 100644 index 1d9f44e..0000000 --- a/src/main/java/club/joylink/xiannccda/ats/warn/PlatformAlertEvent.java +++ /dev/null @@ -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 { - - public PlatformAlertEvent(Builder source) { - super(source); - } -} diff --git a/src/main/java/club/joylink/xiannccda/ats/warn/PlatformAlertListener.java b/src/main/java/club/joylink/xiannccda/ats/warn/PlatformAlertListener.java deleted file mode 100644 index d98b2ab..0000000 --- a/src/main/java/club/joylink/xiannccda/ats/warn/PlatformAlertListener.java +++ /dev/null @@ -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 { - - 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秒 - - } -} 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 2c8a985..6c18624 100644 --- a/src/main/java/club/joylink/xiannccda/ats/warn/PlatformAlertMonitoringTask.java +++ b/src/main/java/club/joylink/xiannccda/ats/warn/PlatformAlertMonitoringTask.java @@ -5,13 +5,25 @@ import club.joylink.xiannccda.alert.core.AlertDeviceType; import club.joylink.xiannccda.alert.core.AlertManager; import club.joylink.xiannccda.alert.core.AlertMonitoringTask; 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.DeviceStatusProto; import club.joylink.xiannccda.dto.protos.DeviceStatusProto.Platform; import club.joylink.xiannccda.dto.protos.GuardConfigProto.GuardConfig; import club.joylink.xiannccda.dto.protos.LayoutGraphicsProto; 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.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.Objects; import java.util.Optional; @@ -35,37 +47,25 @@ public class PlatformAlertMonitoringTask implements AlertMonitoringTask { private final AlertManager alertManager = AlertManager.getDefault(); - private Map platformMap = new ConcurrentHashMap<>(); - private final static String CUSTOM_NAME = AlertDeviceType.DEVICE_TYPE_PLATFORM.name(); + private Map trainRecordMap = new ConcurrentHashMap<>(); - 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()); - - 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 putTrainRecord(TrainRecord.Builder trainRecord) { + this.trainRecordMap.put(trainRecord.getTrainId(), trainRecord); } - public void removeSwitch(Platform.Builder platformBuild) { - 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()); + public void remoceTrainRecord(TrainRecord.Builder trainRecord) { + 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 @@ -79,32 +79,76 @@ public class PlatformAlertMonitoringTask implements AlertMonitoringTask { return stationOptional.map(Station::getName).orElse(null); } - @Override - public void run() { - for (Platform.Builder build : platformMap.values()) { - GuardConfig guardConfig = configService.getGuardConfig(build.getLineId()); - AlertType alertType = AlertType.PLATFORM_DOOR_CANNOT_OPEN; - int timeOut = guardConfig.getCanNotOpenTimes(); - if (build.getPsdOpen()) { - alertType = AlertType.PLATFORM_DOOR_CANNOT_CLOSE; - timeOut = guardConfig.getCanNotCloseTimes(); + private Platform.Builder parsePlatform(TrainRecord.Builder record, boolean isUpWay) { + Integer stationId = record.getStationId(); + String stationCode = Strings.padStart(stationId.toString(), 2, '0'); + String platformCode = String.format("PF%s3%s", stationCode, isUpWay ? "02" : "01"); + DeviceStatusData deviceStatusData = DeviceDataRepository.findDataSouce(String.valueOf(record.getLineId()), DataTypeEnum.DEVICE); + Map builderMap = deviceStatusData.getAllDeviceMap().get(DeviceStatusProto.Platform.getDescriptor().getName()); + if (CollectionUtils.isNotEmpty(builderMap)) { + GeneratedMessageV3.Builder builder = builderMap.get(platformCode); + if (Objects.nonNull(builder)) { + return (Platform.Builder) builder; } - LayoutGraphicsProto.Platform platform = LineGraphicDataRepository.getDeviceByCode(build.getLineId(), build.getId(), LayoutGraphicsProto.Platform.class); - if (this.timeOver(build.getReceiveTime(), timeOut) - && alertManager.putAlterDevice(build.getLineId(), alertType.name(), build.getId())) { - String openClose = alertType == AlertType.PLATFORM_DOOR_CANNOT_OPEN ? "打开" : "关闭"; - String wayType = platform.getUp() ? "上行" : "下行"; - String stationName = this.findRefStationName(build.getLineId(), platform.getRefStation()); - String alertMsg = String.format("%s-%s-屏蔽门无法%s", stationName, wayType, openClose); - 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); - platformMap.remove(build.getId()); - } else if (this.timeOver(build.getReceiveTime(), timeOut) && alertManager.deviceIsExist(build.getLineId(), alertType.name(), build.getId())) { - platformMap.remove(build.getId()); + log.info("车站报点未找到对应的屏蔽门信息,线路[{}] 列车车次号[{}] 车站id[{}] 站台门id[{}] 上下行[{}] 解析屏蔽门code[{}]" + , record.getLineId(), record.getGlobalId(), record.getStationId(), record.getSideId(), isUpWay, platformCode); + return null; + } + log.info("没有屏蔽门设备状态的数据,线路[{}] 列车车次号[{}] 车站id[{}] 站台门id[{}] 上下行[{}] 解析屏蔽门code[{}]" + , record.getLineId(), record.getGlobalId(), record.getStationId(), record.getSideId(), isUpWay, platformCode); + return null; + } + + private void handle(TrainRecord.Builder record, boolean isUpWay) { + Platform.Builder platformBuild = this.parsePlatform(record, isUpWay); + if (Objects.isNull(platformBuild)) { + return; + } + InUsedScheduleData scheduleData = DeviceDataRepository.findDataSouce(String.valueOf(record.getLineId()), DataTypeEnum.TRAIN_PLAN); + Optional 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); + } + } } diff --git a/src/main/java/club/joylink/xiannccda/ats/warn/TrainAtpCutAlertMonitoringTask.java b/src/main/java/club/joylink/xiannccda/ats/warn/TrainAtpCutAlertMonitoringTask.java index 58882d4..17edc0f 100644 --- a/src/main/java/club/joylink/xiannccda/ats/warn/TrainAtpCutAlertMonitoringTask.java +++ b/src/main/java/club/joylink/xiannccda/ats/warn/TrainAtpCutAlertMonitoringTask.java @@ -5,22 +5,20 @@ import club.joylink.xiannccda.alert.core.AlertDeviceType; import club.joylink.xiannccda.alert.core.AlertManager; import club.joylink.xiannccda.alert.core.AlertMonitoringTask; 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.DeviceStatusProto.Platform; import club.joylink.xiannccda.dto.protos.DeviceStatusProto.TrainMode; 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.Station; 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.config.DeviceGuardConfigService; import java.util.Map; +import java.util.Map.Entry; import java.util.Objects; -import java.util.Optional; import java.util.concurrent.ConcurrentHashMap; -import java.util.stream.Stream; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Component; @@ -39,17 +37,15 @@ public class TrainAtpCutAlertMonitoringTask implements AlertMonitoringTask { private final AlertManager alertManager = AlertManager.getDefault(); - private Map trainInfoMap = new ConcurrentHashMap<>(); + private Map lineTrainGroupMap = new ConcurrentHashMap<>(); public void putTrainInfoMonitor(TrainInfo.Builder train) { 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 public String getName() { @@ -65,18 +61,22 @@ public class TrainAtpCutAlertMonitoringTask implements AlertMonitoringTask { return; } Section section = LineGraphicDataRepository.getDeviceByCode(trainInfo.getLineId(), sectionCode, Section.class); - if (alertManager.putAlterDevice(trainInfo.getLineId(), CUSTOM_NAME, trainInfo.getGroupId())) { - log.info("列车紧制ATP检测告警 线路[{}] 列车车组号[{}] 所在设备[{}]", trainInfo.getLineId(), trainInfo.getGroupId(), trainInfo.getDevName()); - 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); - alertManager.emit(alertInfo); - } +// if (alertManager.putAlterDevice(trainInfo.getLineId(), CUSTOM_NAME, trainInfo.getGroupId())) { + log.info("列车紧制ATP检测告警 线路[{}] 列车车组号[{}] 所在设备[{}]", trainInfo.getLineId(), trainInfo.getGroupId(), trainInfo.getDevName()); + 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); + alertManager.emit(alertInfo); +// } } @Override public void run() { - for (TrainInfo.Builder trainInfo : this.trainInfoMap.values()) { - Integer lineId = trainInfo.getLineId(); + + for (Entry 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); TrainMode trainMode = trainInfo.getMode(); boolean timeOver = this.timeOver(trainInfo.getReceiveTime(), guardConfig.getTrainAtpCutTimes()); @@ -84,7 +84,7 @@ public class TrainAtpCutAlertMonitoringTask implements AlertMonitoringTask { //列车时间ATP切除且时间没有到告警 this.trainAlert(trainInfo); } else if (timeOver) { - this.removeTrainInfo(trainInfo); + this.lineTrainGroupMap.remove(groupId); } } } diff --git a/src/main/java/club/joylink/xiannccda/ats/warn/TrainModeAlertListener.java b/src/main/java/club/joylink/xiannccda/ats/warn/TrainModeAlertListener.java index b3d9b4b..ed51ab4 100644 --- a/src/main/java/club/joylink/xiannccda/ats/warn/TrainModeAlertListener.java +++ b/src/main/java/club/joylink/xiannccda/ats/warn/TrainModeAlertListener.java @@ -30,15 +30,12 @@ public class TrainModeAlertListener implements AlertSourceEventListener { + + 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 { + + } + } +} diff --git a/src/main/java/club/joylink/xiannccda/ats/warn/TrainRecordAlertEvent.java b/src/main/java/club/joylink/xiannccda/ats/warn/TrainRecordAlertEvent.java new file mode 100644 index 0000000..d5f44b9 --- /dev/null +++ b/src/main/java/club/joylink/xiannccda/ats/warn/TrainRecordAlertEvent.java @@ -0,0 +1,11 @@ +package club.joylink.xiannccda.ats.warn; + + +import club.joylink.xiannccda.dto.protos.TrainProto.TrainRecord; + +public class TrainRecordAlertEvent extends DeviceAlertEvent { + + public TrainRecordAlertEvent(TrainRecord.Builder source) { + super(source); + } +} diff --git a/src/main/java/club/joylink/xiannccda/dto/protos/GuardConfigProto.java b/src/main/java/club/joylink/xiannccda/dto/protos/GuardConfigProto.java index 2fa294f..ab2a652 100644 --- a/src/main/java/club/joylink/xiannccda/dto/protos/GuardConfigProto.java +++ b/src/main/java/club/joylink/xiannccda/dto/protos/GuardConfigProto.java @@ -80,7 +80,7 @@ public final class GuardConfigProto { /** *

-     *列车制动 到 atp 切除的延时时间
+     *列车制动后导致atp切除的超时时间
      * 
* * int32 trainAtpCutTimes = 7; @@ -217,7 +217,7 @@ public final class GuardConfigProto { private int trainAtpCutTimes_ = 0; /** *
-     *列车制动 到 atp 切除的延时时间
+     *列车制动后导致atp切除的超时时间
      * 
* * int32 trainAtpCutTimes = 7; @@ -926,7 +926,7 @@ public final class GuardConfigProto { private int trainAtpCutTimes_ ; /** *
-       *列车制动 到 atp 切除的延时时间
+       *列车制动后导致atp切除的超时时间
        * 
* * int32 trainAtpCutTimes = 7; @@ -938,7 +938,7 @@ public final class GuardConfigProto { } /** *
-       *列车制动 到 atp 切除的延时时间
+       *列车制动后导致atp切除的超时时间
        * 
* * int32 trainAtpCutTimes = 7; @@ -954,7 +954,7 @@ public final class GuardConfigProto { } /** *
-       *列车制动 到 atp 切除的延时时间
+       *列车制动后导致atp切除的超时时间
        * 
* * int32 trainAtpCutTimes = 7; diff --git a/src/main/java/club/joylink/xiannccda/dto/protos/TrainShedule.java b/src/main/java/club/joylink/xiannccda/dto/protos/TrainShedule.java new file mode 100644 index 0000000..6038a96 --- /dev/null +++ b/src/main/java/club/joylink/xiannccda/dto/protos/TrainShedule.java @@ -0,0 +1,1467 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: trainShedule.proto + +package club.joylink.xiannccda.dto.protos; + +public final class TrainShedule { + private TrainShedule() {} + public static void registerAllExtensions( + com.google.protobuf.ExtensionRegistryLite registry) { + } + + public static void registerAllExtensions( + com.google.protobuf.ExtensionRegistry registry) { + registerAllExtensions( + (com.google.protobuf.ExtensionRegistryLite) registry); + } + public interface PlanOrBuilder extends + // @@protoc_insertion_point(interface_extends:alert.Plan) + com.google.protobuf.MessageOrBuilder { + + /** + * int32 lineId = 1; + * @return The lineId. + */ + int getLineId(); + + /** + * int64 date = 2; + * @return The date. + */ + long getDate(); + + /** + * int32 actionId = 3; + * @return The actionId. + */ + int getActionId(); + + /** + * string trainId = 4; + * @return The trainId. + */ + java.lang.String getTrainId(); + /** + * string trainId = 4; + * @return The bytes for trainId. + */ + com.google.protobuf.ByteString + getTrainIdBytes(); + + /** + * string globalId = 5; + * @return The globalId. + */ + java.lang.String getGlobalId(); + /** + * string globalId = 5; + * @return The bytes for globalId. + */ + com.google.protobuf.ByteString + getGlobalIdBytes(); + + /** + * int32 stationId = 6; + * @return The stationId. + */ + int getStationId(); + + /** + * int32 platformId = 7; + * @return The platformId. + */ + int getPlatformId(); + + /** + * int64 aTime = 8; + * @return The aTime. + */ + long getATime(); + + /** + * int64 dTime = 9; + * @return The dTime. + */ + long getDTime(); + + /** + * bool upWay = 10; + * @return The upWay. + */ + boolean getUpWay(); + + /** + * int64 timestamp = 11; + * @return The timestamp. + */ + long getTimestamp(); + + /** + *
+     *接受时间
+     * 
+ * + * int64 receiveTime = 12; + * @return The receiveTime. + */ + long getReceiveTime(); + } + /** + * Protobuf type {@code alert.Plan} + */ + public static final class Plan extends + com.google.protobuf.GeneratedMessageV3 implements + // @@protoc_insertion_point(message_implements:alert.Plan) + PlanOrBuilder { + private static final long serialVersionUID = 0L; + // Use Plan.newBuilder() to construct. + private Plan(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + private Plan() { + trainId_ = ""; + globalId_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance( + UnusedPrivateParameter unused) { + return new Plan(); + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return club.joylink.xiannccda.dto.protos.TrainShedule.internal_static_alert_Plan_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return club.joylink.xiannccda.dto.protos.TrainShedule.internal_static_alert_Plan_fieldAccessorTable + .ensureFieldAccessorsInitialized( + club.joylink.xiannccda.dto.protos.TrainShedule.Plan.class, club.joylink.xiannccda.dto.protos.TrainShedule.Plan.Builder.class); + } + + public static final int LINEID_FIELD_NUMBER = 1; + private int lineId_ = 0; + /** + * int32 lineId = 1; + * @return The lineId. + */ + @java.lang.Override + public int getLineId() { + return lineId_; + } + + public static final int DATE_FIELD_NUMBER = 2; + private long date_ = 0L; + /** + * int64 date = 2; + * @return The date. + */ + @java.lang.Override + public long getDate() { + return date_; + } + + public static final int ACTIONID_FIELD_NUMBER = 3; + private int actionId_ = 0; + /** + * int32 actionId = 3; + * @return The actionId. + */ + @java.lang.Override + public int getActionId() { + return actionId_; + } + + public static final int TRAINID_FIELD_NUMBER = 4; + @SuppressWarnings("serial") + private volatile java.lang.Object trainId_ = ""; + /** + * string trainId = 4; + * @return The trainId. + */ + @java.lang.Override + public java.lang.String getTrainId() { + java.lang.Object ref = trainId_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + trainId_ = s; + return s; + } + } + /** + * string trainId = 4; + * @return The bytes for trainId. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getTrainIdBytes() { + java.lang.Object ref = trainId_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + trainId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int GLOBALID_FIELD_NUMBER = 5; + @SuppressWarnings("serial") + private volatile java.lang.Object globalId_ = ""; + /** + * string globalId = 5; + * @return The globalId. + */ + @java.lang.Override + public java.lang.String getGlobalId() { + java.lang.Object ref = globalId_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + globalId_ = s; + return s; + } + } + /** + * string globalId = 5; + * @return The bytes for globalId. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getGlobalIdBytes() { + java.lang.Object ref = globalId_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + globalId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int STATIONID_FIELD_NUMBER = 6; + private int stationId_ = 0; + /** + * int32 stationId = 6; + * @return The stationId. + */ + @java.lang.Override + public int getStationId() { + return stationId_; + } + + public static final int PLATFORMID_FIELD_NUMBER = 7; + private int platformId_ = 0; + /** + * int32 platformId = 7; + * @return The platformId. + */ + @java.lang.Override + public int getPlatformId() { + return platformId_; + } + + public static final int ATIME_FIELD_NUMBER = 8; + private long aTime_ = 0L; + /** + * int64 aTime = 8; + * @return The aTime. + */ + @java.lang.Override + public long getATime() { + return aTime_; + } + + public static final int DTIME_FIELD_NUMBER = 9; + private long dTime_ = 0L; + /** + * int64 dTime = 9; + * @return The dTime. + */ + @java.lang.Override + public long getDTime() { + return dTime_; + } + + public static final int UPWAY_FIELD_NUMBER = 10; + private boolean upWay_ = false; + /** + * bool upWay = 10; + * @return The upWay. + */ + @java.lang.Override + public boolean getUpWay() { + return upWay_; + } + + public static final int TIMESTAMP_FIELD_NUMBER = 11; + private long timestamp_ = 0L; + /** + * int64 timestamp = 11; + * @return The timestamp. + */ + @java.lang.Override + public long getTimestamp() { + return timestamp_; + } + + public static final int RECEIVETIME_FIELD_NUMBER = 12; + private long receiveTime_ = 0L; + /** + *
+     *接受时间
+     * 
+ * + * int64 receiveTime = 12; + * @return The receiveTime. + */ + @java.lang.Override + public long getReceiveTime() { + return receiveTime_; + } + + private byte memoizedIsInitialized = -1; + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (lineId_ != 0) { + output.writeInt32(1, lineId_); + } + if (date_ != 0L) { + output.writeInt64(2, date_); + } + if (actionId_ != 0) { + output.writeInt32(3, actionId_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(trainId_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 4, trainId_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(globalId_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 5, globalId_); + } + if (stationId_ != 0) { + output.writeInt32(6, stationId_); + } + if (platformId_ != 0) { + output.writeInt32(7, platformId_); + } + if (aTime_ != 0L) { + output.writeInt64(8, aTime_); + } + if (dTime_ != 0L) { + output.writeInt64(9, dTime_); + } + if (upWay_ != false) { + output.writeBool(10, upWay_); + } + if (timestamp_ != 0L) { + output.writeInt64(11, timestamp_); + } + if (receiveTime_ != 0L) { + output.writeInt64(12, receiveTime_); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (lineId_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(1, lineId_); + } + if (date_ != 0L) { + size += com.google.protobuf.CodedOutputStream + .computeInt64Size(2, date_); + } + if (actionId_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(3, actionId_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(trainId_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(4, trainId_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(globalId_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(5, globalId_); + } + if (stationId_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(6, stationId_); + } + if (platformId_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(7, platformId_); + } + if (aTime_ != 0L) { + size += com.google.protobuf.CodedOutputStream + .computeInt64Size(8, aTime_); + } + if (dTime_ != 0L) { + size += com.google.protobuf.CodedOutputStream + .computeInt64Size(9, dTime_); + } + if (upWay_ != false) { + size += com.google.protobuf.CodedOutputStream + .computeBoolSize(10, upWay_); + } + if (timestamp_ != 0L) { + size += com.google.protobuf.CodedOutputStream + .computeInt64Size(11, timestamp_); + } + if (receiveTime_ != 0L) { + size += com.google.protobuf.CodedOutputStream + .computeInt64Size(12, receiveTime_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof club.joylink.xiannccda.dto.protos.TrainShedule.Plan)) { + return super.equals(obj); + } + club.joylink.xiannccda.dto.protos.TrainShedule.Plan other = (club.joylink.xiannccda.dto.protos.TrainShedule.Plan) obj; + + if (getLineId() + != other.getLineId()) return false; + if (getDate() + != other.getDate()) return false; + if (getActionId() + != other.getActionId()) return false; + if (!getTrainId() + .equals(other.getTrainId())) return false; + if (!getGlobalId() + .equals(other.getGlobalId())) return false; + if (getStationId() + != other.getStationId()) return false; + if (getPlatformId() + != other.getPlatformId()) return false; + if (getATime() + != other.getATime()) return false; + if (getDTime() + != other.getDTime()) return false; + if (getUpWay() + != other.getUpWay()) return false; + if (getTimestamp() + != other.getTimestamp()) return false; + if (getReceiveTime() + != other.getReceiveTime()) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + LINEID_FIELD_NUMBER; + hash = (53 * hash) + getLineId(); + hash = (37 * hash) + DATE_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashLong( + getDate()); + hash = (37 * hash) + ACTIONID_FIELD_NUMBER; + hash = (53 * hash) + getActionId(); + hash = (37 * hash) + TRAINID_FIELD_NUMBER; + hash = (53 * hash) + getTrainId().hashCode(); + hash = (37 * hash) + GLOBALID_FIELD_NUMBER; + hash = (53 * hash) + getGlobalId().hashCode(); + hash = (37 * hash) + STATIONID_FIELD_NUMBER; + hash = (53 * hash) + getStationId(); + hash = (37 * hash) + PLATFORMID_FIELD_NUMBER; + hash = (53 * hash) + getPlatformId(); + hash = (37 * hash) + ATIME_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashLong( + getATime()); + hash = (37 * hash) + DTIME_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashLong( + getDTime()); + hash = (37 * hash) + UPWAY_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean( + getUpWay()); + hash = (37 * hash) + TIMESTAMP_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashLong( + getTimestamp()); + hash = (37 * hash) + RECEIVETIME_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashLong( + getReceiveTime()); + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static club.joylink.xiannccda.dto.protos.TrainShedule.Plan parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static club.joylink.xiannccda.dto.protos.TrainShedule.Plan parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static club.joylink.xiannccda.dto.protos.TrainShedule.Plan parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static club.joylink.xiannccda.dto.protos.TrainShedule.Plan parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static club.joylink.xiannccda.dto.protos.TrainShedule.Plan parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static club.joylink.xiannccda.dto.protos.TrainShedule.Plan parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static club.joylink.xiannccda.dto.protos.TrainShedule.Plan parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static club.joylink.xiannccda.dto.protos.TrainShedule.Plan parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + + public static club.joylink.xiannccda.dto.protos.TrainShedule.Plan parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input); + } + + public static club.joylink.xiannccda.dto.protos.TrainShedule.Plan parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static club.joylink.xiannccda.dto.protos.TrainShedule.Plan parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static club.joylink.xiannccda.dto.protos.TrainShedule.Plan parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(club.joylink.xiannccda.dto.protos.TrainShedule.Plan prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * Protobuf type {@code alert.Plan} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessageV3.Builder implements + // @@protoc_insertion_point(builder_implements:alert.Plan) + club.joylink.xiannccda.dto.protos.TrainShedule.PlanOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return club.joylink.xiannccda.dto.protos.TrainShedule.internal_static_alert_Plan_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return club.joylink.xiannccda.dto.protos.TrainShedule.internal_static_alert_Plan_fieldAccessorTable + .ensureFieldAccessorsInitialized( + club.joylink.xiannccda.dto.protos.TrainShedule.Plan.class, club.joylink.xiannccda.dto.protos.TrainShedule.Plan.Builder.class); + } + + // Construct using club.joylink.xiannccda.dto.protos.TrainShedule.Plan.newBuilder() + private Builder() { + + } + + private Builder( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + + } + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + lineId_ = 0; + date_ = 0L; + actionId_ = 0; + trainId_ = ""; + globalId_ = ""; + stationId_ = 0; + platformId_ = 0; + aTime_ = 0L; + dTime_ = 0L; + upWay_ = false; + timestamp_ = 0L; + receiveTime_ = 0L; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return club.joylink.xiannccda.dto.protos.TrainShedule.internal_static_alert_Plan_descriptor; + } + + @java.lang.Override + public club.joylink.xiannccda.dto.protos.TrainShedule.Plan getDefaultInstanceForType() { + return club.joylink.xiannccda.dto.protos.TrainShedule.Plan.getDefaultInstance(); + } + + @java.lang.Override + public club.joylink.xiannccda.dto.protos.TrainShedule.Plan build() { + club.joylink.xiannccda.dto.protos.TrainShedule.Plan result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public club.joylink.xiannccda.dto.protos.TrainShedule.Plan buildPartial() { + club.joylink.xiannccda.dto.protos.TrainShedule.Plan result = new club.joylink.xiannccda.dto.protos.TrainShedule.Plan(this); + if (bitField0_ != 0) { buildPartial0(result); } + onBuilt(); + return result; + } + + private void buildPartial0(club.joylink.xiannccda.dto.protos.TrainShedule.Plan result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.lineId_ = lineId_; + } + if (((from_bitField0_ & 0x00000002) != 0)) { + result.date_ = date_; + } + if (((from_bitField0_ & 0x00000004) != 0)) { + result.actionId_ = actionId_; + } + if (((from_bitField0_ & 0x00000008) != 0)) { + result.trainId_ = trainId_; + } + if (((from_bitField0_ & 0x00000010) != 0)) { + result.globalId_ = globalId_; + } + if (((from_bitField0_ & 0x00000020) != 0)) { + result.stationId_ = stationId_; + } + if (((from_bitField0_ & 0x00000040) != 0)) { + result.platformId_ = platformId_; + } + if (((from_bitField0_ & 0x00000080) != 0)) { + result.aTime_ = aTime_; + } + if (((from_bitField0_ & 0x00000100) != 0)) { + result.dTime_ = dTime_; + } + if (((from_bitField0_ & 0x00000200) != 0)) { + result.upWay_ = upWay_; + } + if (((from_bitField0_ & 0x00000400) != 0)) { + result.timestamp_ = timestamp_; + } + if (((from_bitField0_ & 0x00000800) != 0)) { + result.receiveTime_ = receiveTime_; + } + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof club.joylink.xiannccda.dto.protos.TrainShedule.Plan) { + return mergeFrom((club.joylink.xiannccda.dto.protos.TrainShedule.Plan)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(club.joylink.xiannccda.dto.protos.TrainShedule.Plan other) { + if (other == club.joylink.xiannccda.dto.protos.TrainShedule.Plan.getDefaultInstance()) return this; + if (other.getLineId() != 0) { + setLineId(other.getLineId()); + } + if (other.getDate() != 0L) { + setDate(other.getDate()); + } + if (other.getActionId() != 0) { + setActionId(other.getActionId()); + } + if (!other.getTrainId().isEmpty()) { + trainId_ = other.trainId_; + bitField0_ |= 0x00000008; + onChanged(); + } + if (!other.getGlobalId().isEmpty()) { + globalId_ = other.globalId_; + bitField0_ |= 0x00000010; + onChanged(); + } + if (other.getStationId() != 0) { + setStationId(other.getStationId()); + } + if (other.getPlatformId() != 0) { + setPlatformId(other.getPlatformId()); + } + if (other.getATime() != 0L) { + setATime(other.getATime()); + } + if (other.getDTime() != 0L) { + setDTime(other.getDTime()); + } + if (other.getUpWay() != false) { + setUpWay(other.getUpWay()); + } + if (other.getTimestamp() != 0L) { + setTimestamp(other.getTimestamp()); + } + if (other.getReceiveTime() != 0L) { + setReceiveTime(other.getReceiveTime()); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 8: { + lineId_ = input.readInt32(); + bitField0_ |= 0x00000001; + break; + } // case 8 + case 16: { + date_ = input.readInt64(); + bitField0_ |= 0x00000002; + break; + } // case 16 + case 24: { + actionId_ = input.readInt32(); + bitField0_ |= 0x00000004; + break; + } // case 24 + case 34: { + trainId_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000008; + break; + } // case 34 + case 42: { + globalId_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000010; + break; + } // case 42 + case 48: { + stationId_ = input.readInt32(); + bitField0_ |= 0x00000020; + break; + } // case 48 + case 56: { + platformId_ = input.readInt32(); + bitField0_ |= 0x00000040; + break; + } // case 56 + case 64: { + aTime_ = input.readInt64(); + bitField0_ |= 0x00000080; + break; + } // case 64 + case 72: { + dTime_ = input.readInt64(); + bitField0_ |= 0x00000100; + break; + } // case 72 + case 80: { + upWay_ = input.readBool(); + bitField0_ |= 0x00000200; + break; + } // case 80 + case 88: { + timestamp_ = input.readInt64(); + bitField0_ |= 0x00000400; + break; + } // case 88 + case 96: { + receiveTime_ = input.readInt64(); + bitField0_ |= 0x00000800; + break; + } // case 96 + default: { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + private int bitField0_; + + private int lineId_ ; + /** + * int32 lineId = 1; + * @return The lineId. + */ + @java.lang.Override + public int getLineId() { + return lineId_; + } + /** + * int32 lineId = 1; + * @param value The lineId to set. + * @return This builder for chaining. + */ + public Builder setLineId(int value) { + + lineId_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + * int32 lineId = 1; + * @return This builder for chaining. + */ + public Builder clearLineId() { + bitField0_ = (bitField0_ & ~0x00000001); + lineId_ = 0; + onChanged(); + return this; + } + + private long date_ ; + /** + * int64 date = 2; + * @return The date. + */ + @java.lang.Override + public long getDate() { + return date_; + } + /** + * int64 date = 2; + * @param value The date to set. + * @return This builder for chaining. + */ + public Builder setDate(long value) { + + date_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + * int64 date = 2; + * @return This builder for chaining. + */ + public Builder clearDate() { + bitField0_ = (bitField0_ & ~0x00000002); + date_ = 0L; + onChanged(); + return this; + } + + private int actionId_ ; + /** + * int32 actionId = 3; + * @return The actionId. + */ + @java.lang.Override + public int getActionId() { + return actionId_; + } + /** + * int32 actionId = 3; + * @param value The actionId to set. + * @return This builder for chaining. + */ + public Builder setActionId(int value) { + + actionId_ = value; + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + /** + * int32 actionId = 3; + * @return This builder for chaining. + */ + public Builder clearActionId() { + bitField0_ = (bitField0_ & ~0x00000004); + actionId_ = 0; + onChanged(); + return this; + } + + private java.lang.Object trainId_ = ""; + /** + * string trainId = 4; + * @return The trainId. + */ + public java.lang.String getTrainId() { + java.lang.Object ref = trainId_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + trainId_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * string trainId = 4; + * @return The bytes for trainId. + */ + public com.google.protobuf.ByteString + getTrainIdBytes() { + java.lang.Object ref = trainId_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + trainId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * string trainId = 4; + * @param value The trainId to set. + * @return This builder for chaining. + */ + public Builder setTrainId( + java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + trainId_ = value; + bitField0_ |= 0x00000008; + onChanged(); + return this; + } + /** + * string trainId = 4; + * @return This builder for chaining. + */ + public Builder clearTrainId() { + trainId_ = getDefaultInstance().getTrainId(); + bitField0_ = (bitField0_ & ~0x00000008); + onChanged(); + return this; + } + /** + * string trainId = 4; + * @param value The bytes for trainId to set. + * @return This builder for chaining. + */ + public Builder setTrainIdBytes( + com.google.protobuf.ByteString value) { + if (value == null) { throw new NullPointerException(); } + checkByteStringIsUtf8(value); + trainId_ = value; + bitField0_ |= 0x00000008; + onChanged(); + return this; + } + + private java.lang.Object globalId_ = ""; + /** + * string globalId = 5; + * @return The globalId. + */ + public java.lang.String getGlobalId() { + java.lang.Object ref = globalId_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + globalId_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * string globalId = 5; + * @return The bytes for globalId. + */ + public com.google.protobuf.ByteString + getGlobalIdBytes() { + java.lang.Object ref = globalId_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + globalId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * string globalId = 5; + * @param value The globalId to set. + * @return This builder for chaining. + */ + public Builder setGlobalId( + java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + globalId_ = value; + bitField0_ |= 0x00000010; + onChanged(); + return this; + } + /** + * string globalId = 5; + * @return This builder for chaining. + */ + public Builder clearGlobalId() { + globalId_ = getDefaultInstance().getGlobalId(); + bitField0_ = (bitField0_ & ~0x00000010); + onChanged(); + return this; + } + /** + * string globalId = 5; + * @param value The bytes for globalId to set. + * @return This builder for chaining. + */ + public Builder setGlobalIdBytes( + com.google.protobuf.ByteString value) { + if (value == null) { throw new NullPointerException(); } + checkByteStringIsUtf8(value); + globalId_ = value; + bitField0_ |= 0x00000010; + onChanged(); + return this; + } + + private int stationId_ ; + /** + * int32 stationId = 6; + * @return The stationId. + */ + @java.lang.Override + public int getStationId() { + return stationId_; + } + /** + * int32 stationId = 6; + * @param value The stationId to set. + * @return This builder for chaining. + */ + public Builder setStationId(int value) { + + stationId_ = value; + bitField0_ |= 0x00000020; + onChanged(); + return this; + } + /** + * int32 stationId = 6; + * @return This builder for chaining. + */ + public Builder clearStationId() { + bitField0_ = (bitField0_ & ~0x00000020); + stationId_ = 0; + onChanged(); + return this; + } + + private int platformId_ ; + /** + * int32 platformId = 7; + * @return The platformId. + */ + @java.lang.Override + public int getPlatformId() { + return platformId_; + } + /** + * int32 platformId = 7; + * @param value The platformId to set. + * @return This builder for chaining. + */ + public Builder setPlatformId(int value) { + + platformId_ = value; + bitField0_ |= 0x00000040; + onChanged(); + return this; + } + /** + * int32 platformId = 7; + * @return This builder for chaining. + */ + public Builder clearPlatformId() { + bitField0_ = (bitField0_ & ~0x00000040); + platformId_ = 0; + onChanged(); + return this; + } + + private long aTime_ ; + /** + * int64 aTime = 8; + * @return The aTime. + */ + @java.lang.Override + public long getATime() { + return aTime_; + } + /** + * int64 aTime = 8; + * @param value The aTime to set. + * @return This builder for chaining. + */ + public Builder setATime(long value) { + + aTime_ = value; + bitField0_ |= 0x00000080; + onChanged(); + return this; + } + /** + * int64 aTime = 8; + * @return This builder for chaining. + */ + public Builder clearATime() { + bitField0_ = (bitField0_ & ~0x00000080); + aTime_ = 0L; + onChanged(); + return this; + } + + private long dTime_ ; + /** + * int64 dTime = 9; + * @return The dTime. + */ + @java.lang.Override + public long getDTime() { + return dTime_; + } + /** + * int64 dTime = 9; + * @param value The dTime to set. + * @return This builder for chaining. + */ + public Builder setDTime(long value) { + + dTime_ = value; + bitField0_ |= 0x00000100; + onChanged(); + return this; + } + /** + * int64 dTime = 9; + * @return This builder for chaining. + */ + public Builder clearDTime() { + bitField0_ = (bitField0_ & ~0x00000100); + dTime_ = 0L; + onChanged(); + return this; + } + + private boolean upWay_ ; + /** + * bool upWay = 10; + * @return The upWay. + */ + @java.lang.Override + public boolean getUpWay() { + return upWay_; + } + /** + * bool upWay = 10; + * @param value The upWay to set. + * @return This builder for chaining. + */ + public Builder setUpWay(boolean value) { + + upWay_ = value; + bitField0_ |= 0x00000200; + onChanged(); + return this; + } + /** + * bool upWay = 10; + * @return This builder for chaining. + */ + public Builder clearUpWay() { + bitField0_ = (bitField0_ & ~0x00000200); + upWay_ = false; + onChanged(); + return this; + } + + private long timestamp_ ; + /** + * int64 timestamp = 11; + * @return The timestamp. + */ + @java.lang.Override + public long getTimestamp() { + return timestamp_; + } + /** + * int64 timestamp = 11; + * @param value The timestamp to set. + * @return This builder for chaining. + */ + public Builder setTimestamp(long value) { + + timestamp_ = value; + bitField0_ |= 0x00000400; + onChanged(); + return this; + } + /** + * int64 timestamp = 11; + * @return This builder for chaining. + */ + public Builder clearTimestamp() { + bitField0_ = (bitField0_ & ~0x00000400); + timestamp_ = 0L; + onChanged(); + return this; + } + + private long receiveTime_ ; + /** + *
+       *接受时间
+       * 
+ * + * int64 receiveTime = 12; + * @return The receiveTime. + */ + @java.lang.Override + public long getReceiveTime() { + return receiveTime_; + } + /** + *
+       *接受时间
+       * 
+ * + * int64 receiveTime = 12; + * @param value The receiveTime to set. + * @return This builder for chaining. + */ + public Builder setReceiveTime(long value) { + + receiveTime_ = value; + bitField0_ |= 0x00000800; + onChanged(); + return this; + } + /** + *
+       *接受时间
+       * 
+ * + * int64 receiveTime = 12; + * @return This builder for chaining. + */ + public Builder clearReceiveTime() { + bitField0_ = (bitField0_ & ~0x00000800); + receiveTime_ = 0L; + onChanged(); + return this; + } + @java.lang.Override + public final Builder setUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + + // @@protoc_insertion_point(builder_scope:alert.Plan) + } + + // @@protoc_insertion_point(class_scope:alert.Plan) + private static final club.joylink.xiannccda.dto.protos.TrainShedule.Plan DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new club.joylink.xiannccda.dto.protos.TrainShedule.Plan(); + } + + public static club.joylink.xiannccda.dto.protos.TrainShedule.Plan getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public Plan parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public club.joylink.xiannccda.dto.protos.TrainShedule.Plan getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + + } + + private static final com.google.protobuf.Descriptors.Descriptor + internal_static_alert_Plan_descriptor; + private static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_alert_Plan_fieldAccessorTable; + + public static com.google.protobuf.Descriptors.FileDescriptor + getDescriptor() { + return descriptor; + } + private static com.google.protobuf.Descriptors.FileDescriptor + descriptor; + static { + java.lang.String[] descriptorData = { + "\n\022trainShedule.proto\022\005alert\"\325\001\n\004Plan\022\016\n\006" + + "lineId\030\001 \001(\005\022\014\n\004date\030\002 \001(\003\022\020\n\010actionId\030\003" + + " \001(\005\022\017\n\007trainId\030\004 \001(\t\022\020\n\010globalId\030\005 \001(\t\022" + + "\021\n\tstationId\030\006 \001(\005\022\022\n\nplatformId\030\007 \001(\005\022\r" + + "\n\005aTime\030\010 \001(\003\022\r\n\005dTime\030\t \001(\003\022\r\n\005upWay\030\n " + + "\001(\010\022\021\n\ttimestamp\030\013 \001(\003\022\023\n\013receiveTime\030\014 " + + "\001(\003B1\n!club.joylink.xiannccda.dto.protos" + + "B\014TrainSheduleb\006proto3" + }; + descriptor = com.google.protobuf.Descriptors.FileDescriptor + .internalBuildGeneratedFileFrom(descriptorData, + new com.google.protobuf.Descriptors.FileDescriptor[] { + }); + internal_static_alert_Plan_descriptor = + getDescriptor().getMessageTypes().get(0); + internal_static_alert_Plan_fieldAccessorTable = new + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_alert_Plan_descriptor, + new java.lang.String[] { "LineId", "Date", "ActionId", "TrainId", "GlobalId", "StationId", "PlatformId", "ATime", "DTime", "UpWay", "Timestamp", "ReceiveTime", }); + } + + // @@protoc_insertion_point(outer_class_scope) +} diff --git a/src/main/java/club/joylink/xiannccda/mock/message/NccMockDataService.java b/src/main/java/club/joylink/xiannccda/mock/message/NccMockDataService.java index fe6e834..abc0b34 100644 --- a/src/main/java/club/joylink/xiannccda/mock/message/NccMockDataService.java +++ b/src/main/java/club/joylink/xiannccda/mock/message/NccMockDataService.java @@ -78,9 +78,7 @@ public class NccMockDataService { lam.gt(NccMockData::getId, LAST_ID); } List nccMockData = this.nccMockDataRepository.list(wrapp); -// if (nccMockData.stream().anyMatch(d -> d.getId() == 59231)) { -// System.out.println("aaaaaaaaaaaaaaaaaaaaa"); -// } + List list = this.parse(nccMockData); if (CollectionUtils.isEmpty(nccMockData)) { FINISH = true; @@ -88,6 +86,7 @@ public class NccMockDataService { return Collections.emptyList(); } else { LAST_ID = nccMockData.get(nccMockData.size() - 1).getId(); + System.out.println("aaaaaaaaaaaaaa" + LAST_ID); return list.stream().map(d -> (MessageResponse) d).toList(); } } diff --git a/src/test/java/club/joylink/xiannccda/device/DeviceStatusCheckTest.java b/src/test/java/club/joylink/xiannccda/device/DeviceStatusCheckTest.java index 1717cae..0f05c2e 100644 --- a/src/test/java/club/joylink/xiannccda/device/DeviceStatusCheckTest.java +++ b/src/test/java/club/joylink/xiannccda/device/DeviceStatusCheckTest.java @@ -8,10 +8,13 @@ import club.joylink.xiannccda.dto.protos.DeviceStatusProto.Platform; import club.joylink.xiannccda.dto.protos.TrainProto.TrainInfo; import com.google.common.collect.BiMap; import com.google.common.collect.HashBiMap; +import com.mysql.cj.x.protobuf.MysqlxDatatypes; import java.io.BufferedReader; import java.io.FileReader; +import java.io.UnsupportedEncodingException; import java.sql.SQLOutput; import java.util.ArrayList; +import java.util.Base64; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -61,8 +64,19 @@ public class DeviceStatusCheckTest { public void trainTest() { System.out.println(TRAIN_MODE.IP_MODE_TRAIN_ATP_CUT.getValue() | TRAIN_MODE.IP_MODE_TRAIN_EB_ALARM.getValue()); 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("--------------------------------"); + 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(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")); + } } diff --git a/src/test/java/club/joylink/xiannccda/device/TrainDataTest.java b/src/test/java/club/joylink/xiannccda/device/TrainDataTest.java index a0919dc..6c0236d 100644 --- a/src/test/java/club/joylink/xiannccda/device/TrainDataTest.java +++ b/src/test/java/club/joylink/xiannccda/device/TrainDataTest.java @@ -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.TrainIndicationUpdateResponse; 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.NccMockData; import club.joylink.xiannccda.mock.message.NccMockData.ActionTypeEnum; @@ -207,4 +210,5 @@ public class TrainDataTest { System.out.println(messageDatum.generateProto()); } } + } diff --git a/xian-ncc-da-message b/xian-ncc-da-message index 7aebba1..d821403 160000 --- a/xian-ncc-da-message +++ b/xian-ncc-da-message @@ -1 +1 @@ -Subproject commit 7aebba13bf04bf2c59df3595c5650a96e616bef4 +Subproject commit d82140370ef78529ad745356e41bad635a333457