diff --git a/src/main/java/club/joylink/xiannccda/alert/AlertDetailFactory.java b/src/main/java/club/joylink/xiannccda/alert/AlertDetailFactory.java new file mode 100644 index 0000000..b8d96db --- /dev/null +++ b/src/main/java/club/joylink/xiannccda/alert/AlertDetailFactory.java @@ -0,0 +1,79 @@ +package club.joylink.xiannccda.alert; + +import club.joylink.xiannccda.dto.protos.LayoutGraphicsProto.Platform; +import club.joylink.xiannccda.dto.protos.LayoutGraphicsProto.Station; +import club.joylink.xiannccda.entity.AlertTip; +import club.joylink.xiannccda.exception.BusinessExceptionAssertEnum; +import club.joylink.xiannccda.repository.IAlertTipRepository; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.google.protobuf.MessageOrBuilder; +import java.time.LocalDateTime; +import org.springframework.stereotype.Component; + +@Component +public class AlertDetailFactory { + + private IAlertTipRepository alertTipRepository; + + public AlertDetailFactory(IAlertTipRepository alertTipRepository) { + this.alertTipRepository = alertTipRepository; + } + + public AlertDetail getAlertDetail(AlertType alertType, short lineId, boolean mock, + MessageOrBuilder messageOrBuilder) { + LocalDateTime now = LocalDateTime.now(); + Integer alertTipId; + String info; + switch (alertType) { + case BLUE_DISPLAY -> { + BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertTrue( + messageOrBuilder instanceof Station); + Station rtu = (Station) messageOrBuilder; + AlertTipLocationType locationType = AlertTipLocationType.getByLineIdAndRtuId(lineId, + Short.parseShort(rtu.getCode())); + LambdaQueryWrapper queryWrapper = Wrappers.lambdaQuery(AlertTip.class) + .eq(AlertTip::getAlertType, alertType) + .eq(AlertTip::getLocationType, locationType); + AlertTip alertTip = alertTipRepository.getOne(queryWrapper); + alertTipId = alertTip == null ? null : alertTip.getId(); + info = String.format("[%s号线]%s蓝显", lineId, locationType.getDesc()); + } + case TRAIN_DELAY -> { + return null; + } + case PLATFORM_DOOR_WITHOUT_LOCKED_SIGNAL -> { + BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertTrue( + messageOrBuilder instanceof Platform); + Platform platform = (Platform) messageOrBuilder; + LambdaQueryWrapper queryWrapper = Wrappers.lambdaQuery(AlertTip.class) + .eq(AlertTip::getAlertType, alertType); + AlertTip alertTip = alertTipRepository.getOne(queryWrapper); + alertTipId = alertTip == null ? null : alertTip.getId(); + info = String.format("[%s号线]%s站台门无关闭且锁紧信号", lineId, platform.getCode()); + } + case PLATFORM_DOOR_CANNOT_OPEN -> { + BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertTrue( + messageOrBuilder instanceof Platform); + Platform platform = (Platform) messageOrBuilder; + LambdaQueryWrapper queryWrapper = Wrappers.lambdaQuery(AlertTip.class) + .eq(AlertTip::getAlertType, alertType); + AlertTip alertTip = alertTipRepository.getOne(queryWrapper); + alertTipId = alertTip == null ? null : alertTip.getId(); + info = String.format("[%s号线]%s站台门无法打开", lineId, platform.getCode()); + } + case PLATFORM_DOOR_CANNOT_CLOSE -> { + BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertTrue( + messageOrBuilder instanceof Platform); + Platform platform = (Platform) messageOrBuilder; + LambdaQueryWrapper queryWrapper = Wrappers.lambdaQuery(AlertTip.class) + .eq(AlertTip::getAlertType, alertType); + AlertTip alertTip = alertTipRepository.getOne(queryWrapper); + alertTipId = alertTip == null ? null : alertTip.getId(); + info = String.format("[%s号线]%s站台门无法关闭", lineId, platform.getCode()); + } + default -> throw new IllegalStateException("Unexpected value: " + alertType); + } + return new AlertDetailImpl(alertType, now, alertTipId, info, mock); + } +} diff --git a/src/main/java/club/joylink/xiannccda/alert/AlertDetailImpl.java b/src/main/java/club/joylink/xiannccda/alert/AlertDetailImpl.java index b56dad1..1bd599a 100644 --- a/src/main/java/club/joylink/xiannccda/alert/AlertDetailImpl.java +++ b/src/main/java/club/joylink/xiannccda/alert/AlertDetailImpl.java @@ -1,6 +1,7 @@ package club.joylink.xiannccda.alert; import java.time.LocalDateTime; +import lombok.AccessLevel; import lombok.AllArgsConstructor; import lombok.Data; @@ -8,15 +9,16 @@ import lombok.Data; * 西安三号线报警 */ @Data -@AllArgsConstructor +@AllArgsConstructor(access = AccessLevel.PACKAGE) public class AlertDetailImpl implements AlertDetail { private AlertType alertType; private LocalDateTime alertTime; private Integer alertTipId; private String info; - private String deviceInfo; - private String reason; + private boolean mock; +// private String deviceInfo; +// private String reason; @Override public AlertType getAlertType() { @@ -33,18 +35,25 @@ public class AlertDetailImpl implements AlertDetail { return info; } - @Override - public String getDeviceInfo() { - return deviceInfo; - } - - @Override - public String getReason() { - return reason; - } - @Override public Integer getAlertTipId() { return alertTipId; } + + @Override + public boolean isMock() { + return mock; + } + +// @Override +// public String getDeviceInfo() { +// return deviceInfo; +// } +// +// @Override +// public String getReason() { +// return reason; +// } + + } diff --git a/src/main/java/club/joylink/xiannccda/alert/AlertEmitJob.java b/src/main/java/club/joylink/xiannccda/alert/AlertEmitJob.java index 0dd7a62..7db29c5 100644 --- a/src/main/java/club/joylink/xiannccda/alert/AlertEmitJob.java +++ b/src/main/java/club/joylink/xiannccda/alert/AlertEmitJob.java @@ -26,7 +26,7 @@ public class AlertEmitJob implements ApplicationRunner { @Override public void run(ApplicationArguments args) throws Exception { - AlertManager alertManager = AlertManager.getInstance(); + AlertManager alertManager = AlertManager.getDefault(); //报警源 alertManager.addTask(trainDelayAlertMonitoringTask); alertManager.addTask(blueDisplayAlertMonitoringTask); diff --git a/src/main/java/club/joylink/xiannccda/alert/AlertListenerJob.java b/src/main/java/club/joylink/xiannccda/alert/AlertListenerJob.java index d479c7d..c462a38 100644 --- a/src/main/java/club/joylink/xiannccda/alert/AlertListenerJob.java +++ b/src/main/java/club/joylink/xiannccda/alert/AlertListenerJob.java @@ -29,18 +29,18 @@ public class AlertListenerJob implements ApplicationRunner { //注册西安NCC的报警ws消息发送服务 wsMessageServerManager.registerMessageServer(NccAlertMessageServer.getDefault()); //启动报警源事件监测任务 - AlertManager.getInstance().taskStart(); + AlertManager.getDefault().taskStart(); } public void addAlertDetailListeners() { - AlertManager alertManager = AlertManager.getInstance(); + AlertManager alertManager = AlertManager.getDefault(); //报警监听 alertManager.on(new Listener() { private final AtomicInteger idGenerator = new AtomicInteger(1); @Override public void accept(AlertDetail event) { String id = String.valueOf(idGenerator.getAndIncrement()); - String level = "YELLOW"; + String level = "III"; LocalDateTime alertTime = event.getAlertTime(); NccAlertInfo nccAlertInfo = new NccAlertInfo<>(id, level, alertTime, event); alertManager.emit(nccAlertInfo); @@ -50,7 +50,7 @@ public class AlertListenerJob implements ApplicationRunner { private void addAlertListeners() { NccAlertMessageServer nccAlertMessageServer = NccAlertMessageServer.getDefault(); - AlertManager alertManager = AlertManager.getInstance(); + AlertManager alertManager = AlertManager.getDefault(); //添加消息 alertManager.on(new Listener() { @Override diff --git a/src/main/java/club/joylink/xiannccda/alert/AlertTipLocationType.java b/src/main/java/club/joylink/xiannccda/alert/AlertTipLocationType.java index dea8828..d88921f 100644 --- a/src/main/java/club/joylink/xiannccda/alert/AlertTipLocationType.java +++ b/src/main/java/club/joylink/xiannccda/alert/AlertTipLocationType.java @@ -1,12 +1,38 @@ package club.joylink.xiannccda.alert; +import club.joylink.xiannccda.exception.BusinessExceptionAssertEnum; +import java.util.Arrays; +import lombok.Getter; + +@Getter public enum AlertTipLocationType { /** * 全线 */ - QX, + QX(0, 0, "全线"), /** * 鱼化寨联锁区 */ - YHZ_LSQ, + YHZ_LSQ(3, 1, "鱼化寨联锁区"), + ; + + private short lineId; + + private short rtuId; + + private String desc; + + AlertTipLocationType(int lineId, int rtuId, String desc) { + this.lineId = (short) lineId; + this.rtuId = (short) rtuId; + this.desc = desc; + } + + public static AlertTipLocationType getByLineIdAndRtuId(short lineId, short rtuId) { + return Arrays.stream(AlertTipLocationType.values()) + .filter(type -> lineId == type.lineId && rtuId == type.rtuId) + .findFirst() + .orElseThrow(() -> BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.exception( + String.format("[%s:%s]未定义联锁区", lineId, rtuId))); + } } diff --git a/src/main/java/club/joylink/xiannccda/alert/BlueDisplayAlertMonitoringTask.java b/src/main/java/club/joylink/xiannccda/alert/BlueDisplayAlertMonitoringTask.java index da9e861..060e120 100644 --- a/src/main/java/club/joylink/xiannccda/alert/BlueDisplayAlertMonitoringTask.java +++ b/src/main/java/club/joylink/xiannccda/alert/BlueDisplayAlertMonitoringTask.java @@ -1,19 +1,16 @@ package club.joylink.xiannccda.alert; -import club.joylink.xiannccda.alert.core.AlertManager; import club.joylink.xiannccda.alert.core.AlertMonitoringTask; import club.joylink.xiannccda.entity.AlertTip; import club.joylink.xiannccda.repository.IAlertTipRepository; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import java.time.LocalDateTime; import org.springframework.stereotype.Component; @Component public class BlueDisplayAlertMonitoringTask implements AlertMonitoringTask { private IAlertTipRepository alertTipRepository; - private boolean alertTriggered; public BlueDisplayAlertMonitoringTask(IAlertTipRepository alertTipRepository) { this.alertTipRepository = alertTipRepository; @@ -26,26 +23,41 @@ public class BlueDisplayAlertMonitoringTask implements AlertMonitoringTask { @Override public void run() { - LocalDateTime now = LocalDateTime.now(); - if (alertTriggered) { - if (now.getSecond() % 30 != 0) { - alertTriggered = false; - } - } else { - if (now.getSecond() % 30 == 0) { - AlertType alertType = AlertType.BLUE_DISPLAY; - LambdaQueryWrapper queryWrapper = Wrappers.lambdaQuery(AlertTip.class); - queryWrapper.eq(AlertTip::getAlertType, alertType) - .eq(AlertTip::getLocationType, AlertTipLocationType.QX); - AlertTip alertTip = alertTipRepository.getOne(queryWrapper); - Integer alertTipId = alertTip == null ? null : alertTip.getId(); +// short lineId = 3; +// Map id_rtu_map = new HashMap<>(); +// if (CollectionUtils.isEmpty(id_rtu_map)) { +// return; +// } +// +// AlertManager alertManager = AlertManager.getDefault(); +// LocalDateTime now = LocalDateTime.now(); +// AlertType alertType = AlertType.BLUE_DISPLAY; +// if (id_rtu_map.values().stream().allMatch(RtuOrBuilder::getIpRtuStusDown)) { +// AlertTipLocationType locationType = AlertTipLocationType.QX; +// Integer alertTipId = getAlertTipId(alertType, locationType); +// +// AlertDetailImpl alert = new AlertDetailImpl(alertType, now, alertTipId, +// String.format("[%s号线]%s蓝显", lineId, locationType.getDesc())); +// alertManager.emit(alert); +// } else { +// id_rtu_map.entrySet().stream() +// .filter(entry -> entry.getValue().getIpRtuStusDown()) +// .forEach(entry -> { +// AlertTipLocationType locationType +// = AlertTipLocationType.getByLineIdAndRtuId(lineId, entry.getKey()); +// Integer alertTipId = getAlertTipId(alertType, locationType); +// AlertDetailImpl alert = new AlertDetailImpl(alertType, now, alertTipId, +// String.format("[%s号线]%s蓝显", lineId, locationType.getDesc())); +// alertManager.emit(alert); +// }); +// } + } - AlertManager alertManager = AlertManager.getInstance(); - AlertDetailImpl alert = new AlertDetailImpl(alertType, now, alertTipId, "[3号线]全线蓝显", - "轨旁设备", "轨旁设备故障"); - alertManager.emit(alert); - alertTriggered = true; - } - } + private Integer getAlertTipId(AlertType alertType, AlertTipLocationType locationType) { + LambdaQueryWrapper queryWrapper = Wrappers.lambdaQuery(AlertTip.class); + queryWrapper.eq(AlertTip::getAlertType, alertType) + .eq(AlertTip::getLocationType, locationType); + AlertTip alertTip = alertTipRepository.getOne(queryWrapper); + return alertTip == null ? null : alertTip.getId(); } } diff --git a/src/main/java/club/joylink/xiannccda/alert/NccAlertInfo.java b/src/main/java/club/joylink/xiannccda/alert/NccAlertInfo.java index 6d34870..0c95935 100644 --- a/src/main/java/club/joylink/xiannccda/alert/NccAlertInfo.java +++ b/src/main/java/club/joylink/xiannccda/alert/NccAlertInfo.java @@ -35,11 +35,15 @@ public class NccAlertInfo implements AlertInfo { return detail == null ? null : detail.getAlertTipId(); } - public String getDeviceInfo() { - return detail == null ? "" : detail.getDeviceInfo(); + public boolean isMock() { + return detail == null || detail.isMock(); } - public String getReason() { - return detail == null ? "" : detail.getReason(); - } +// public String getDeviceInfo() { +// return detail == null ? "" : detail.getDeviceInfo(); +// } +// +// public String getReason() { +// return detail == null ? "" : detail.getReason(); +// } } diff --git a/src/main/java/club/joylink/xiannccda/alert/PlatformDoorAlertMonitoringTask.java b/src/main/java/club/joylink/xiannccda/alert/PlatformDoorAlertMonitoringTask.java index 0214107..59a1cf9 100644 --- a/src/main/java/club/joylink/xiannccda/alert/PlatformDoorAlertMonitoringTask.java +++ b/src/main/java/club/joylink/xiannccda/alert/PlatformDoorAlertMonitoringTask.java @@ -1,12 +1,7 @@ package club.joylink.xiannccda.alert; -import club.joylink.xiannccda.alert.core.AlertManager; import club.joylink.xiannccda.alert.core.AlertMonitoringTask; -import club.joylink.xiannccda.entity.AlertTip; import club.joylink.xiannccda.repository.IAlertTipRepository; -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import java.time.LocalDateTime; import org.springframework.stereotype.Component; @Component @@ -26,60 +21,60 @@ public class PlatformDoorAlertMonitoringTask implements AlertMonitoringTask { @Override public void run() { - LocalDateTime now = LocalDateTime.now(); - if (alertTriggered) { - if (now.getSecond() % 30 != 0) { - alertTriggered = false; - } - } else { - if (now.getSecond() % 30 == 0) { - emitPlatformDoorWithoutLockedSignalAlert(now, alertTipRepository); - emitPlatformDoorCannotOpenAlert(now, alertTipRepository); - emitPlatformDoorCannotCloseAlert(now, alertTipRepository); - alertTriggered = true; - } - } +// LocalDateTime now = LocalDateTime.now(); +// if (alertTriggered) { +// if (now.getSecond() % 30 != 0) { +// alertTriggered = false; +// } +// } else { +// if (now.getSecond() % 30 == 0) { +// emitPlatformDoorWithoutLockedSignalAlert(now, alertTipRepository); +// emitPlatformDoorCannotOpenAlert(now, alertTipRepository); +// emitPlatformDoorCannotCloseAlert(now, alertTipRepository); +// alertTriggered = true; +// } +// } } - public void emitPlatformDoorWithoutLockedSignalAlert(LocalDateTime now, - IAlertTipRepository alertTipRepository) { - AlertType alertType = AlertType.PLATFORM_DOOR_WITHOUT_LOCKED_SIGNAL; - LambdaQueryWrapper queryWrapper = Wrappers.lambdaQuery(AlertTip.class); - queryWrapper.eq(AlertTip::getAlertType, alertType); - AlertTip alertTip = alertTipRepository.getOne(queryWrapper); - Integer alertTipId = alertTip == null ? null : alertTip.getId(); - - AlertManager alertManager = AlertManager.getInstance(); - AlertDetailImpl alert = new AlertDetailImpl(alertType, now, alertTipId, - "[3号线]站台门无关闭锁紧信号", "鱼化寨下行站台", "鱼化寨下行站台无关闭锁紧信号"); - alertManager.emit(alert); - } - - public void emitPlatformDoorCannotOpenAlert(LocalDateTime now, - IAlertTipRepository alertTipRepository) { - AlertType alertType = AlertType.PLATFORM_DOOR_CANNOT_OPEN; - LambdaQueryWrapper queryWrapper = Wrappers.lambdaQuery(AlertTip.class); - queryWrapper.eq(AlertTip::getAlertType, alertType); - AlertTip alertTip = alertTipRepository.getOne(queryWrapper); - Integer alertTipId = alertTip == null ? null : alertTip.getId(); - - AlertManager alertManager = AlertManager.getInstance(); - AlertDetailImpl alert = new AlertDetailImpl(alertType, now, alertTipId, - "[3号线]站台门整侧站台门无法打开", "鱼化寨下行站台", "鱼化寨下行站台整侧站台门无法打开"); - alertManager.emit(alert); - } - - public void emitPlatformDoorCannotCloseAlert(LocalDateTime now, - IAlertTipRepository alertTipRepository) { - AlertType alertType = AlertType.PLATFORM_DOOR_CANNOT_CLOSE; - LambdaQueryWrapper queryWrapper = Wrappers.lambdaQuery(AlertTip.class); - queryWrapper.eq(AlertTip::getAlertType, alertType); - AlertTip alertTip = alertTipRepository.getOne(queryWrapper); - Integer alertTipId = alertTip == null ? null : alertTip.getId(); - - AlertManager alertManager = AlertManager.getInstance(); - AlertDetailImpl alert = new AlertDetailImpl(alertType, now, alertTipId, - "[3号线]站台门整侧站台门无法关闭", "鱼化寨下行站台", "鱼化寨下行站台整侧站台门无法关闭"); - alertManager.emit(alert); - } +// public void emitPlatformDoorWithoutLockedSignalAlert(LocalDateTime now, +// IAlertTipRepository alertTipRepository) { +// AlertType alertType = AlertType.PLATFORM_DOOR_WITHOUT_LOCKED_SIGNAL; +// LambdaQueryWrapper queryWrapper = Wrappers.lambdaQuery(AlertTip.class); +// queryWrapper.eq(AlertTip::getAlertType, alertType); +// AlertTip alertTip = alertTipRepository.getOne(queryWrapper); +// Integer alertTipId = alertTip == null ? null : alertTip.getId(); +// +// AlertManager alertManager = AlertManager.getDefault(); +// AlertDetailImpl alert = new AlertDetailImpl(alertType, now, alertTipId, +// "[3号线]站台门无关闭锁紧信号"); +// alertManager.emit(alert); +// } +// +// public void emitPlatformDoorCannotOpenAlert(LocalDateTime now, +// IAlertTipRepository alertTipRepository) { +// AlertType alertType = AlertType.PLATFORM_DOOR_CANNOT_OPEN; +// LambdaQueryWrapper queryWrapper = Wrappers.lambdaQuery(AlertTip.class); +// queryWrapper.eq(AlertTip::getAlertType, alertType); +// AlertTip alertTip = alertTipRepository.getOne(queryWrapper); +// Integer alertTipId = alertTip == null ? null : alertTip.getId(); +// +// AlertManager alertManager = AlertManager.getDefault(); +// AlertDetailImpl alert = new AlertDetailImpl(alertType, now, alertTipId, +// "[3号线]站台门整侧站台门无法打开"); +// alertManager.emit(alert); +// } +// +// public void emitPlatformDoorCannotCloseAlert(LocalDateTime now, +// IAlertTipRepository alertTipRepository) { +// AlertType alertType = AlertType.PLATFORM_DOOR_CANNOT_CLOSE; +// LambdaQueryWrapper queryWrapper = Wrappers.lambdaQuery(AlertTip.class); +// queryWrapper.eq(AlertTip::getAlertType, alertType); +// AlertTip alertTip = alertTipRepository.getOne(queryWrapper); +// Integer alertTipId = alertTip == null ? null : alertTip.getId(); +// +// AlertManager alertManager = AlertManager.getDefault(); +// AlertDetailImpl alert = new AlertDetailImpl(alertType, now, alertTipId, +// "[3号线]站台门整侧站台门无法关闭"); +// alertManager.emit(alert); +// } } diff --git a/src/main/java/club/joylink/xiannccda/alert/TrainDelayAlertMonitoringTask.java b/src/main/java/club/joylink/xiannccda/alert/TrainDelayAlertMonitoringTask.java index 19a898e..0368e53 100644 --- a/src/main/java/club/joylink/xiannccda/alert/TrainDelayAlertMonitoringTask.java +++ b/src/main/java/club/joylink/xiannccda/alert/TrainDelayAlertMonitoringTask.java @@ -1,12 +1,7 @@ package club.joylink.xiannccda.alert; -import club.joylink.xiannccda.alert.core.AlertManager; import club.joylink.xiannccda.alert.core.AlertMonitoringTask; -import club.joylink.xiannccda.entity.AlertTip; import club.joylink.xiannccda.repository.IAlertTipRepository; -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import java.time.LocalDateTime; import org.springframework.stereotype.Component; @Component @@ -26,27 +21,27 @@ public class TrainDelayAlertMonitoringTask implements AlertMonitoringTask { @Override public void run() { - LocalDateTime now = LocalDateTime.now(); - if (alertTriggered) { - if (now.getSecond() % 30 != 0) { - alertTriggered = false; - } - } else { - if (now.getSecond() % 30 == 0) { - AlertType alertType = AlertType.PLATFORM_DOOR_CANNOT_OPEN; - LambdaQueryWrapper queryWrapper = Wrappers.lambdaQuery(AlertTip.class); - queryWrapper.eq(AlertTip::getAlertType, alertType) - .eq(AlertTip::getTimeType, AlertTipTimeType.CLOCK_7_9_AND_19_21); - AlertTip alertTip = alertTipRepository.getOne(queryWrapper); - Integer alertTipId = alertTip == null ? null : alertTip.getId(); - - AlertManager alertManager = AlertManager.getInstance(); - AlertDetailImpl alert = new AlertDetailImpl(alertType, now, alertTipId, - String.format("[3号线]列车[01-1001]按计划应于%s抵达[%s],现因[%s]晚点%s分钟", - now.minusMinutes(2), "鱼化寨", "道岔P0110失表", "2"), "道岔[P0110]", "道岔[P0110]失表"); - alertManager.emit(alert); - alertTriggered = true; - } - } +// LocalDateTime now = LocalDateTime.now(); +// if (alertTriggered) { +// if (now.getSecond() % 30 != 0) { +// alertTriggered = false; +// } +// } else { +// if (now.getSecond() % 30 == 0) { +// AlertType alertType = AlertType.PLATFORM_DOOR_CANNOT_OPEN; +// LambdaQueryWrapper queryWrapper = Wrappers.lambdaQuery(AlertTip.class); +// queryWrapper.eq(AlertTip::getAlertType, alertType) +// .eq(AlertTip::getTimeType, AlertTipTimeType.CLOCK_7_9_AND_19_21); +// AlertTip alertTip = alertTipRepository.getOne(queryWrapper); +// Integer alertTipId = alertTip == null ? null : alertTip.getId(); +// +// AlertManager alertManager = AlertManager.getDefault(); +// AlertDetailImpl alert = new AlertDetailImpl(alertType, now, alertTipId, +// String.format("[3号线]列车[01-1001]按计划应于%s抵达[%s],现因[%s]晚点%s分钟", +// now.minusMinutes(2), "鱼化寨", "道岔P0110失表", "2")); +// alertManager.emit(alert); +// alertTriggered = true; +// } +// } } } diff --git a/src/main/java/club/joylink/xiannccda/alert/core/AlertManager.java b/src/main/java/club/joylink/xiannccda/alert/core/AlertManager.java index bd62724..ff335b9 100644 --- a/src/main/java/club/joylink/xiannccda/alert/core/AlertManager.java +++ b/src/main/java/club/joylink/xiannccda/alert/core/AlertManager.java @@ -31,7 +31,7 @@ public class AlertManager extends EventEmitter { super(id); } - public static AlertManager getInstance() { + public static AlertManager getDefault() { return getInstance("default"); } diff --git a/src/main/java/club/joylink/xiannccda/ats/cache/LineGraphicDataRepository.java b/src/main/java/club/joylink/xiannccda/ats/cache/LineGraphicDataRepository.java index 77ed407..ef70163 100644 --- a/src/main/java/club/joylink/xiannccda/ats/cache/LineGraphicDataRepository.java +++ b/src/main/java/club/joylink/xiannccda/ats/cache/LineGraphicDataRepository.java @@ -4,17 +4,22 @@ import club.joylink.xiannccda.dto.protos.DeviceInfoProto; import club.joylink.xiannccda.dto.protos.LayoutGraphicsProto; import club.joylink.xiannccda.dto.protos.LayoutGraphicsProto.KilometerSystem; import club.joylink.xiannccda.dto.protos.LayoutGraphicsProto.RelatedRef.DeviceType; +import club.joylink.xiannccda.dto.protos.LayoutGraphicsProto.RtssGraphicStorage; import club.joylink.xiannccda.dto.protos.LayoutGraphicsProto.Section; import club.joylink.xiannccda.dto.protos.LayoutGraphicsProto.Section.SectionType; import club.joylink.xiannccda.entity.PublishedGi; import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; +import com.google.common.collect.HashBasedTable; import com.google.protobuf.GeneratedMessageV3.Builder; import com.google.protobuf.InvalidProtocolBufferException; +import com.google.protobuf.MessageOrBuilder; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Objects; import java.util.concurrent.ConcurrentHashMap; +import java.util.stream.Collectors; +import java.util.stream.Stream; import lombok.Getter; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; @@ -31,6 +36,15 @@ public class LineGraphicDataRepository { private static final Map> lineCoordinateMain = new HashMap<>(); + /** + * 线路-设备code-设备 + */ + private static final HashBasedTable line_code_table = HashBasedTable.create(); + /** + * 线路-设备。由于现在许多设备code都是"",使用line_code_table会覆盖,临时加此map,后续删除 + */ + private static final HashMap> line_map = new HashMap<>(); + /** * 缓存线路数据信息 * @@ -52,6 +66,9 @@ public class LineGraphicDataRepository { // 设置公里标后,开始构建逻辑区段的编码、公里标信息 setUpLogicSectionInfo(lineDataMap, storage); lineGraphMap.put(publishGi.getLineId(), lineDataMap); + + // 填充line_code_table + fillLineCodeTable(publishGi.getLineId(), storage); } } catch (InvalidProtocolBufferException e) { log.error("反序列化信息失败", e); @@ -92,6 +109,38 @@ public class LineGraphicDataRepository { lineGraphMap.remove(id); } + public static T getDevice(short lineId, String code, Class cls) { + return (T) line_code_table.get(lineId, code); + } + + public static Stream getDevices(short lineId, Class cls) { + return line_map.get(lineId).stream() + .filter(builder -> cls.isAssignableFrom(builder.getClass())) + .map(builder -> (T) builder); +// return line_code_table.row(lineId).values().stream() +// .filter(builder -> cls.isAssignableFrom(builder.getClass())) +// .map(builder -> (T) builder); + } + + private static void fillLineCodeTable(Integer lineId, RtssGraphicStorage storage) { + Short shortLineId = lineId.shortValue(); + List list = storage.getAllFields().entrySet().stream() + .filter(entry -> entry.getKey().isRepeated()) + .flatMap(entry -> ((List) entry.getValue()).stream()) + .collect(Collectors.toList()); + line_map.put(shortLineId, list); +// storage.getAllFields().forEach((fd, value) -> { +// if (fd.isRepeated()) { +// List list = (List) value; +// for (MessageOrBuilder builder : list) { +// FieldDescriptor fieldDescriptor = builder.getDescriptorForType().findFieldByName("code"); +// String code = (String) builder.getField(fieldDescriptor); +// line_code_table.put(shortLineId, code, builder); +// } +// } +// }); + } + /** * 构建程序中的区段信息 * diff --git a/src/main/java/club/joylink/xiannccda/controller/AlertMockController.java b/src/main/java/club/joylink/xiannccda/controller/AlertMockController.java new file mode 100644 index 0000000..fd8ee16 --- /dev/null +++ b/src/main/java/club/joylink/xiannccda/controller/AlertMockController.java @@ -0,0 +1,41 @@ +package club.joylink.xiannccda.controller; + +import club.joylink.xiannccda.dto.AlertMockDTO; +import club.joylink.xiannccda.service.AlertMockService; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.responses.ApiResponse; +import io.swagger.v3.oas.annotations.security.SecurityRequirement; +import io.swagger.v3.oas.annotations.tags.Tag; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +@RestController +@RequestMapping("/api/alert/mock") +@Tag(name = "模拟故障接口") +public class AlertMockController { + + private AlertMockService alertMockService; + + public AlertMockController(AlertMockService alertMockService) { + this.alertMockService = alertMockService; + } + + @SecurityRequirement(name = "jwt") + @Operation(summary = "设置模拟故障") + @ApiResponse(description = "设置模拟故障") + @PostMapping("/set") + public void setAlert(@RequestBody @Validated AlertMockDTO alertMockDTO) { + alertMockService.setAlert(alertMockDTO); + } + + @SecurityRequirement(name = "jwt") + @Operation(summary = "清除模拟故障") + @ApiResponse(description = "清除模拟故障") + @PostMapping("/clear") + public void clearMockAlert() { + alertMockService.clearMockAlert(); + } +} diff --git a/src/main/java/club/joylink/xiannccda/dto/AlertMockDTO.java b/src/main/java/club/joylink/xiannccda/dto/AlertMockDTO.java new file mode 100644 index 0000000..070db6f --- /dev/null +++ b/src/main/java/club/joylink/xiannccda/dto/AlertMockDTO.java @@ -0,0 +1,13 @@ +package club.joylink.xiannccda.dto; + +import club.joylink.xiannccda.alert.AlertType; +import jakarta.validation.constraints.NotNull; +import lombok.Data; + +@Data +public class AlertMockDTO { + @NotNull(message = "线路id不能为null") + private Short lineId; + @NotNull(message = "故障类型不能为null") + private AlertType alertType; +} diff --git a/src/main/java/club/joylink/xiannccda/dto/protos/DeviceInfoProto.java b/src/main/java/club/joylink/xiannccda/dto/protos/DeviceInfoProto.java index 564bb04..8c9b6b9 100644 --- a/src/main/java/club/joylink/xiannccda/dto/protos/DeviceInfoProto.java +++ b/src/main/java/club/joylink/xiannccda/dto/protos/DeviceInfoProto.java @@ -183,6 +183,26 @@ public final class DeviceInfoProto { */ com.google.protobuf.ByteString getPhysicalSectionIdBytes(); + + /** + *
+     * 目的地码
+     * 
+ * + * string destinationCode = 7; + * @return The destinationCode. + */ + java.lang.String getDestinationCode(); + /** + *
+     * 目的地码
+     * 
+ * + * string destinationCode = 7; + * @return The bytes for destinationCode. + */ + com.google.protobuf.ByteString + getDestinationCodeBytes(); } /** *
@@ -208,6 +228,7 @@ public final class DeviceInfoProto {
       kilometerSystem_ = java.util.Collections.emptyList();
       convertKilometer_ = emptyLongList();
       physicalSectionId_ = "";
+      destinationCode_ = "";
     }
 
     @java.lang.Override
@@ -518,6 +539,53 @@ public final class DeviceInfoProto {
       }
     }
 
+    public static final int DESTINATIONCODE_FIELD_NUMBER = 7;
+    @SuppressWarnings("serial")
+    private volatile java.lang.Object destinationCode_ = "";
+    /**
+     * 
+     * 目的地码
+     * 
+ * + * string destinationCode = 7; + * @return The destinationCode. + */ + @java.lang.Override + public java.lang.String getDestinationCode() { + java.lang.Object ref = destinationCode_; + 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(); + destinationCode_ = s; + return s; + } + } + /** + *
+     * 目的地码
+     * 
+ * + * string destinationCode = 7; + * @return The bytes for destinationCode. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getDestinationCodeBytes() { + java.lang.Object ref = destinationCode_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + destinationCode_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + private byte memoizedIsInitialized = -1; @java.lang.Override public final boolean isInitialized() { @@ -555,6 +623,9 @@ public final class DeviceInfoProto { if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(physicalSectionId_)) { com.google.protobuf.GeneratedMessageV3.writeString(output, 6, physicalSectionId_); } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(destinationCode_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 7, destinationCode_); + } getUnknownFields().writeTo(output); } @@ -599,6 +670,9 @@ public final class DeviceInfoProto { if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(physicalSectionId_)) { size += com.google.protobuf.GeneratedMessageV3.computeStringSize(6, physicalSectionId_); } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(destinationCode_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(7, destinationCode_); + } size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -626,6 +700,8 @@ public final class DeviceInfoProto { .equals(other.getConvertKilometerList())) return false; if (!getPhysicalSectionId() .equals(other.getPhysicalSectionId())) return false; + if (!getDestinationCode() + .equals(other.getDestinationCode())) return false; if (!getUnknownFields().equals(other.getUnknownFields())) return false; return true; } @@ -655,6 +731,8 @@ public final class DeviceInfoProto { } hash = (37 * hash) + PHYSICALSECTIONID_FIELD_NUMBER; hash = (53 * hash) + getPhysicalSectionId().hashCode(); + hash = (37 * hash) + DESTINATIONCODE_FIELD_NUMBER; + hash = (53 * hash) + getDestinationCode().hashCode(); hash = (29 * hash) + getUnknownFields().hashCode(); memoizedHashCode = hash; return hash; @@ -803,6 +881,7 @@ public final class DeviceInfoProto { bitField0_ = (bitField0_ & ~0x00000008); convertKilometer_ = emptyLongList(); physicalSectionId_ = ""; + destinationCode_ = ""; return this; } @@ -867,6 +946,9 @@ public final class DeviceInfoProto { if (((from_bitField0_ & 0x00000020) != 0)) { result.physicalSectionId_ = physicalSectionId_; } + if (((from_bitField0_ & 0x00000040) != 0)) { + result.destinationCode_ = destinationCode_; + } } @java.lang.Override @@ -942,6 +1024,11 @@ public final class DeviceInfoProto { bitField0_ |= 0x00000020; onChanged(); } + if (!other.getDestinationCode().isEmpty()) { + destinationCode_ = other.destinationCode_; + bitField0_ |= 0x00000040; + onChanged(); + } this.mergeUnknownFields(other.getUnknownFields()); onChanged(); return this; @@ -1018,6 +1105,11 @@ public final class DeviceInfoProto { bitField0_ |= 0x00000020; break; } // case 50 + case 58: { + destinationCode_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000040; + break; + } // case 58 default: { if (!super.parseUnknownField(input, extensionRegistry, tag)) { done = true; // was an endgroup tag @@ -1858,6 +1950,98 @@ public final class DeviceInfoProto { onChanged(); return this; } + + private java.lang.Object destinationCode_ = ""; + /** + *
+       * 目的地码
+       * 
+ * + * string destinationCode = 7; + * @return The destinationCode. + */ + public java.lang.String getDestinationCode() { + java.lang.Object ref = destinationCode_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + destinationCode_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + *
+       * 目的地码
+       * 
+ * + * string destinationCode = 7; + * @return The bytes for destinationCode. + */ + public com.google.protobuf.ByteString + getDestinationCodeBytes() { + java.lang.Object ref = destinationCode_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + destinationCode_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + *
+       * 目的地码
+       * 
+ * + * string destinationCode = 7; + * @param value The destinationCode to set. + * @return This builder for chaining. + */ + public Builder setDestinationCode( + java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + destinationCode_ = value; + bitField0_ |= 0x00000040; + onChanged(); + return this; + } + /** + *
+       * 目的地码
+       * 
+ * + * string destinationCode = 7; + * @return This builder for chaining. + */ + public Builder clearDestinationCode() { + destinationCode_ = getDefaultInstance().getDestinationCode(); + bitField0_ = (bitField0_ & ~0x00000040); + onChanged(); + return this; + } + /** + *
+       * 目的地码
+       * 
+ * + * string destinationCode = 7; + * @param value The bytes for destinationCode to set. + * @return This builder for chaining. + */ + public Builder setDestinationCodeBytes( + com.google.protobuf.ByteString value) { + if (value == null) { throw new NullPointerException(); } + checkByteStringIsUtf8(value); + destinationCode_ = value; + bitField0_ |= 0x00000040; + onChanged(); + return this; + } @java.lang.Override public final Builder setUnknownFields( final com.google.protobuf.UnknownFieldSet unknownFields) { @@ -3348,16 +3532,16 @@ public final class DeviceInfoProto { static { java.lang.String[] descriptorData = { "\n\021device_info.proto\022\005state\032\033stationLayou" + - "tGraphics.proto\"\243\001\n\007Section\022\n\n\002id\030\001 \001(\t\022" + + "tGraphics.proto\"\274\001\n\007Section\022\n\n\002id\030\001 \001(\t\022" + "\014\n\004code\030\002 \001(\t\022\022\n\nchildrenId\030\003 \003(\t\0225\n\017kil" + "ometerSystem\030\004 \003(\0132\034.graphicData.Kilomet" + "erSystem\022\030\n\020convertKilometer\030\005 \003(\003\022\031\n\021ph" + - "ysicalSectionId\030\006 \001(\t\"t\n\007Turnout\022\n\n\002id\030\001" + - " \001(\t\022\014\n\004code\030\002 \001(\t\0225\n\017kilometerSystem\030\003 " + - "\003(\0132\034.graphicData.KilometerSystem\022\030\n\020con" + - "vertKilometer\030\004 \003(\003B4\n!club.joylink.xian" + - "nccda.dto.protosB\017DeviceInfoProtob\006proto" + - "3" + "ysicalSectionId\030\006 \001(\t\022\027\n\017destinationCode" + + "\030\007 \001(\t\"t\n\007Turnout\022\n\n\002id\030\001 \001(\t\022\014\n\004code\030\002 " + + "\001(\t\0225\n\017kilometerSystem\030\003 \003(\0132\034.graphicDa" + + "ta.KilometerSystem\022\030\n\020convertKilometer\030\004" + + " \003(\003B4\n!club.joylink.xiannccda.dto.proto" + + "sB\017DeviceInfoProtob\006proto3" }; descriptor = com.google.protobuf.Descriptors.FileDescriptor .internalBuildGeneratedFileFrom(descriptorData, @@ -3369,7 +3553,7 @@ public final class DeviceInfoProto { internal_static_state_Section_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_state_Section_descriptor, - new java.lang.String[] { "Id", "Code", "ChildrenId", "KilometerSystem", "ConvertKilometer", "PhysicalSectionId", }); + new java.lang.String[] { "Id", "Code", "ChildrenId", "KilometerSystem", "ConvertKilometer", "PhysicalSectionId", "DestinationCode", }); internal_static_state_Turnout_descriptor = getDescriptor().getMessageTypes().get(1); internal_static_state_Turnout_fieldAccessorTable = new diff --git a/src/main/java/club/joylink/xiannccda/dto/protos/LayoutGraphicsProto.java b/src/main/java/club/joylink/xiannccda/dto/protos/LayoutGraphicsProto.java index de9e470..68367d3 100644 --- a/src/main/java/club/joylink/xiannccda/dto/protos/LayoutGraphicsProto.java +++ b/src/main/java/club/joylink/xiannccda/dto/protos/LayoutGraphicsProto.java @@ -16923,6 +16923,46 @@ public final class LayoutGraphicsProto { */ com.google.protobuf.ByteString getDirectionBytes(); + + /** + *
+     *上下行--upLink表示上行,downLink表示下行
+     * 
+ * + * string upAndDown = 5; + * @return The upAndDown. + */ + java.lang.String getUpAndDown(); + /** + *
+     *上下行--upLink表示上行,downLink表示下行
+     * 
+ * + * string upAndDown = 5; + * @return The bytes for upAndDown. + */ + com.google.protobuf.ByteString + getUpAndDownBytes(); + + /** + *
+     *关联的车站
+     * 
+ * + * string refStation = 6; + * @return The refStation. + */ + java.lang.String getRefStation(); + /** + *
+     *关联的车站
+     * 
+ * + * string refStation = 6; + * @return The bytes for refStation. + */ + com.google.protobuf.ByteString + getRefStationBytes(); } /** * Protobuf type {@code graphicData.Platform} @@ -16939,6 +16979,8 @@ public final class LayoutGraphicsProto { private Platform() { code_ = ""; direction_ = ""; + upAndDown_ = ""; + refStation_ = ""; } @java.lang.Override @@ -17088,6 +17130,100 @@ public final class LayoutGraphicsProto { } } + public static final int UPANDDOWN_FIELD_NUMBER = 5; + @SuppressWarnings("serial") + private volatile java.lang.Object upAndDown_ = ""; + /** + *
+     *上下行--upLink表示上行,downLink表示下行
+     * 
+ * + * string upAndDown = 5; + * @return The upAndDown. + */ + @java.lang.Override + public java.lang.String getUpAndDown() { + java.lang.Object ref = upAndDown_; + 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(); + upAndDown_ = s; + return s; + } + } + /** + *
+     *上下行--upLink表示上行,downLink表示下行
+     * 
+ * + * string upAndDown = 5; + * @return The bytes for upAndDown. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getUpAndDownBytes() { + java.lang.Object ref = upAndDown_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + upAndDown_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int REFSTATION_FIELD_NUMBER = 6; + @SuppressWarnings("serial") + private volatile java.lang.Object refStation_ = ""; + /** + *
+     *关联的车站
+     * 
+ * + * string refStation = 6; + * @return The refStation. + */ + @java.lang.Override + public java.lang.String getRefStation() { + java.lang.Object ref = refStation_; + 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(); + refStation_ = s; + return s; + } + } + /** + *
+     *关联的车站
+     * 
+ * + * string refStation = 6; + * @return The bytes for refStation. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getRefStationBytes() { + java.lang.Object ref = refStation_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + refStation_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + private byte memoizedIsInitialized = -1; @java.lang.Override public final boolean isInitialized() { @@ -17114,6 +17250,12 @@ public final class LayoutGraphicsProto { if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(direction_)) { com.google.protobuf.GeneratedMessageV3.writeString(output, 4, direction_); } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(upAndDown_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 5, upAndDown_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(refStation_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 6, refStation_); + } getUnknownFields().writeTo(output); } @@ -17137,6 +17279,12 @@ public final class LayoutGraphicsProto { if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(direction_)) { size += com.google.protobuf.GeneratedMessageV3.computeStringSize(4, direction_); } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(upAndDown_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(5, upAndDown_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(refStation_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(6, refStation_); + } size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -17163,6 +17311,10 @@ public final class LayoutGraphicsProto { != other.getHasdoor()) return false; if (!getDirection() .equals(other.getDirection())) return false; + if (!getUpAndDown() + .equals(other.getUpAndDown())) return false; + if (!getRefStation() + .equals(other.getRefStation())) return false; if (!getUnknownFields().equals(other.getUnknownFields())) return false; return true; } @@ -17185,6 +17337,10 @@ public final class LayoutGraphicsProto { getHasdoor()); hash = (37 * hash) + DIRECTION_FIELD_NUMBER; hash = (53 * hash) + getDirection().hashCode(); + hash = (37 * hash) + UPANDDOWN_FIELD_NUMBER; + hash = (53 * hash) + getUpAndDown().hashCode(); + hash = (37 * hash) + REFSTATION_FIELD_NUMBER; + hash = (53 * hash) + getRefStation().hashCode(); hash = (29 * hash) + getUnknownFields().hashCode(); memoizedHashCode = hash; return hash; @@ -17324,6 +17480,8 @@ public final class LayoutGraphicsProto { code_ = ""; hasdoor_ = false; direction_ = ""; + upAndDown_ = ""; + refStation_ = ""; return this; } @@ -17371,6 +17529,12 @@ public final class LayoutGraphicsProto { if (((from_bitField0_ & 0x00000008) != 0)) { result.direction_ = direction_; } + if (((from_bitField0_ & 0x00000010) != 0)) { + result.upAndDown_ = upAndDown_; + } + if (((from_bitField0_ & 0x00000020) != 0)) { + result.refStation_ = refStation_; + } } @java.lang.Override @@ -17401,6 +17565,16 @@ public final class LayoutGraphicsProto { bitField0_ |= 0x00000008; onChanged(); } + if (!other.getUpAndDown().isEmpty()) { + upAndDown_ = other.upAndDown_; + bitField0_ |= 0x00000010; + onChanged(); + } + if (!other.getRefStation().isEmpty()) { + refStation_ = other.refStation_; + bitField0_ |= 0x00000020; + onChanged(); + } this.mergeUnknownFields(other.getUnknownFields()); onChanged(); return this; @@ -17449,6 +17623,16 @@ public final class LayoutGraphicsProto { bitField0_ |= 0x00000008; break; } // case 34 + case 42: { + upAndDown_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000010; + break; + } // case 42 + case 50: { + refStation_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000020; + break; + } // case 50 default: { if (!super.parseUnknownField(input, extensionRegistry, tag)) { done = true; // was an endgroup tag @@ -17792,6 +17976,190 @@ public final class LayoutGraphicsProto { onChanged(); return this; } + + private java.lang.Object upAndDown_ = ""; + /** + *
+       *上下行--upLink表示上行,downLink表示下行
+       * 
+ * + * string upAndDown = 5; + * @return The upAndDown. + */ + public java.lang.String getUpAndDown() { + java.lang.Object ref = upAndDown_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + upAndDown_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + *
+       *上下行--upLink表示上行,downLink表示下行
+       * 
+ * + * string upAndDown = 5; + * @return The bytes for upAndDown. + */ + public com.google.protobuf.ByteString + getUpAndDownBytes() { + java.lang.Object ref = upAndDown_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + upAndDown_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + *
+       *上下行--upLink表示上行,downLink表示下行
+       * 
+ * + * string upAndDown = 5; + * @param value The upAndDown to set. + * @return This builder for chaining. + */ + public Builder setUpAndDown( + java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + upAndDown_ = value; + bitField0_ |= 0x00000010; + onChanged(); + return this; + } + /** + *
+       *上下行--upLink表示上行,downLink表示下行
+       * 
+ * + * string upAndDown = 5; + * @return This builder for chaining. + */ + public Builder clearUpAndDown() { + upAndDown_ = getDefaultInstance().getUpAndDown(); + bitField0_ = (bitField0_ & ~0x00000010); + onChanged(); + return this; + } + /** + *
+       *上下行--upLink表示上行,downLink表示下行
+       * 
+ * + * string upAndDown = 5; + * @param value The bytes for upAndDown to set. + * @return This builder for chaining. + */ + public Builder setUpAndDownBytes( + com.google.protobuf.ByteString value) { + if (value == null) { throw new NullPointerException(); } + checkByteStringIsUtf8(value); + upAndDown_ = value; + bitField0_ |= 0x00000010; + onChanged(); + return this; + } + + private java.lang.Object refStation_ = ""; + /** + *
+       *关联的车站
+       * 
+ * + * string refStation = 6; + * @return The refStation. + */ + public java.lang.String getRefStation() { + java.lang.Object ref = refStation_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + refStation_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + *
+       *关联的车站
+       * 
+ * + * string refStation = 6; + * @return The bytes for refStation. + */ + public com.google.protobuf.ByteString + getRefStationBytes() { + java.lang.Object ref = refStation_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + refStation_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + *
+       *关联的车站
+       * 
+ * + * string refStation = 6; + * @param value The refStation to set. + * @return This builder for chaining. + */ + public Builder setRefStation( + java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + refStation_ = value; + bitField0_ |= 0x00000020; + onChanged(); + return this; + } + /** + *
+       *关联的车站
+       * 
+ * + * string refStation = 6; + * @return This builder for chaining. + */ + public Builder clearRefStation() { + refStation_ = getDefaultInstance().getRefStation(); + bitField0_ = (bitField0_ & ~0x00000020); + onChanged(); + return this; + } + /** + *
+       *关联的车站
+       * 
+ * + * string refStation = 6; + * @param value The bytes for refStation to set. + * @return This builder for chaining. + */ + public Builder setRefStationBytes( + com.google.protobuf.ByteString value) { + if (value == null) { throw new NullPointerException(); } + checkByteStringIsUtf8(value); + refStation_ = value; + bitField0_ |= 0x00000020; + onChanged(); + return this; + } @java.lang.Override public final Builder setUnknownFields( final com.google.protobuf.UnknownFieldSet unknownFields) { @@ -17933,6 +18301,18 @@ public final class LayoutGraphicsProto { * .graphicData.KilometerSystem kilometerSystem = 6; */ club.joylink.xiannccda.dto.protos.LayoutGraphicsProto.KilometerSystemOrBuilder getKilometerSystemOrBuilder(); + + /** + * string name = 7; + * @return The name. + */ + java.lang.String getName(); + /** + * string name = 7; + * @return The bytes for name. + */ + com.google.protobuf.ByteString + getNameBytes(); } /** * Protobuf type {@code graphicData.Station} @@ -17948,6 +18328,7 @@ public final class LayoutGraphicsProto { } private Station() { code_ = ""; + name_ = ""; } @java.lang.Override @@ -18103,6 +18484,45 @@ public final class LayoutGraphicsProto { return kilometerSystem_ == null ? club.joylink.xiannccda.dto.protos.LayoutGraphicsProto.KilometerSystem.getDefaultInstance() : kilometerSystem_; } + public static final int NAME_FIELD_NUMBER = 7; + @SuppressWarnings("serial") + private volatile java.lang.Object name_ = ""; + /** + * string name = 7; + * @return The name. + */ + @java.lang.Override + public java.lang.String getName() { + java.lang.Object ref = name_; + 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(); + name_ = s; + return s; + } + } + /** + * string name = 7; + * @return The bytes for name. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + private byte memoizedIsInitialized = -1; @java.lang.Override public final boolean isInitialized() { @@ -18132,6 +18552,9 @@ public final class LayoutGraphicsProto { if (kilometerSystem_ != null) { output.writeMessage(6, getKilometerSystem()); } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 7, name_); + } getUnknownFields().writeTo(output); } @@ -18160,6 +18583,9 @@ public final class LayoutGraphicsProto { size += com.google.protobuf.CodedOutputStream .computeMessageSize(6, getKilometerSystem()); } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(7, name_); + } size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -18191,6 +18617,8 @@ public final class LayoutGraphicsProto { if (!getKilometerSystem() .equals(other.getKilometerSystem())) return false; } + if (!getName() + .equals(other.getName())) return false; if (!getUnknownFields().equals(other.getUnknownFields())) return false; return true; } @@ -18218,6 +18646,8 @@ public final class LayoutGraphicsProto { hash = (37 * hash) + KILOMETERSYSTEM_FIELD_NUMBER; hash = (53 * hash) + getKilometerSystem().hashCode(); } + hash = (37 * hash) + NAME_FIELD_NUMBER; + hash = (53 * hash) + getName().hashCode(); hash = (29 * hash) + getUnknownFields().hashCode(); memoizedHashCode = hash; return hash; @@ -18362,6 +18792,7 @@ public final class LayoutGraphicsProto { kilometerSystemBuilder_.dispose(); kilometerSystemBuilder_ = null; } + name_ = ""; return this; } @@ -18414,6 +18845,9 @@ public final class LayoutGraphicsProto { ? kilometerSystem_ : kilometerSystemBuilder_.build(); } + if (((from_bitField0_ & 0x00000020) != 0)) { + result.name_ = name_; + } } @java.lang.Override @@ -18445,6 +18879,11 @@ public final class LayoutGraphicsProto { if (other.hasKilometerSystem()) { mergeKilometerSystem(other.getKilometerSystem()); } + if (!other.getName().isEmpty()) { + name_ = other.name_; + bitField0_ |= 0x00000020; + onChanged(); + } this.mergeUnknownFields(other.getUnknownFields()); onChanged(); return this; @@ -18500,6 +18939,11 @@ public final class LayoutGraphicsProto { bitField0_ |= 0x00000010; break; } // case 50 + case 58: { + name_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000020; + break; + } // case 58 default: { if (!super.parseUnknownField(input, extensionRegistry, tag)) { done = true; // was an endgroup tag @@ -18950,6 +19394,78 @@ public final class LayoutGraphicsProto { } return kilometerSystemBuilder_; } + + private java.lang.Object name_ = ""; + /** + * string name = 7; + * @return The name. + */ + public java.lang.String getName() { + java.lang.Object ref = name_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * string name = 7; + * @return The bytes for name. + */ + public com.google.protobuf.ByteString + getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * string name = 7; + * @param value The name to set. + * @return This builder for chaining. + */ + public Builder setName( + java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + name_ = value; + bitField0_ |= 0x00000020; + onChanged(); + return this; + } + /** + * string name = 7; + * @return This builder for chaining. + */ + public Builder clearName() { + name_ = getDefaultInstance().getName(); + bitField0_ = (bitField0_ & ~0x00000020); + onChanged(); + return this; + } + /** + * string name = 7; + * @param value The bytes for name to set. + * @return This builder for chaining. + */ + public Builder setNameBytes( + com.google.protobuf.ByteString value) { + if (value == null) { throw new NullPointerException(); } + checkByteStringIsUtf8(value); + name_ = value; + bitField0_ |= 0x00000020; + onChanged(); + return this; + } @java.lang.Override public final Builder setUnknownFields( final com.google.protobuf.UnknownFieldSet unknownFields) { @@ -29749,6 +30265,35 @@ public final class LayoutGraphicsProto { */ com.google.protobuf.ByteString getLineIdBytes(); + + /** + *
+     * 虚线段点序号
+     * 
+ * + * repeated int32 dashPointIndexs = 11; + * @return A list containing the dashPointIndexs. + */ + java.util.List getDashPointIndexsList(); + /** + *
+     * 虚线段点序号
+     * 
+ * + * repeated int32 dashPointIndexs = 11; + * @return The count of dashPointIndexs. + */ + int getDashPointIndexsCount(); + /** + *
+     * 虚线段点序号
+     * 
+ * + * repeated int32 dashPointIndexs = 11; + * @param index The index of the element to return. + * @return The dashPointIndexs at the given index. + */ + int getDashPointIndexs(int index); } /** * Protobuf type {@code graphicData.RunLine} @@ -29772,6 +30317,7 @@ public final class LayoutGraphicsProto { linkPathLines_ = com.google.protobuf.LazyStringArrayList.emptyList(); lineId_ = ""; + dashPointIndexs_ = emptyIntList(); } @java.lang.Override @@ -30111,6 +30657,47 @@ public final class LayoutGraphicsProto { } } + public static final int DASHPOINTINDEXS_FIELD_NUMBER = 11; + @SuppressWarnings("serial") + private com.google.protobuf.Internal.IntList dashPointIndexs_; + /** + *
+     * 虚线段点序号
+     * 
+ * + * repeated int32 dashPointIndexs = 11; + * @return A list containing the dashPointIndexs. + */ + @java.lang.Override + public java.util.List + getDashPointIndexsList() { + return dashPointIndexs_; + } + /** + *
+     * 虚线段点序号
+     * 
+ * + * repeated int32 dashPointIndexs = 11; + * @return The count of dashPointIndexs. + */ + public int getDashPointIndexsCount() { + return dashPointIndexs_.size(); + } + /** + *
+     * 虚线段点序号
+     * 
+ * + * repeated int32 dashPointIndexs = 11; + * @param index The index of the element to return. + * @return The dashPointIndexs at the given index. + */ + public int getDashPointIndexs(int index) { + return dashPointIndexs_.getInt(index); + } + private int dashPointIndexsMemoizedSerializedSize = -1; + private byte memoizedIsInitialized = -1; @java.lang.Override public final boolean isInitialized() { @@ -30125,6 +30712,7 @@ public final class LayoutGraphicsProto { @java.lang.Override public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + getSerializedSize(); if (common_ != null) { output.writeMessage(1, getCommon()); } @@ -30149,6 +30737,13 @@ public final class LayoutGraphicsProto { if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(lineId_)) { com.google.protobuf.GeneratedMessageV3.writeString(output, 10, lineId_); } + if (getDashPointIndexsList().size() > 0) { + output.writeUInt32NoTag(90); + output.writeUInt32NoTag(dashPointIndexsMemoizedSerializedSize); + } + for (int i = 0; i < dashPointIndexs_.size(); i++) { + output.writeInt32NoTag(dashPointIndexs_.getInt(i)); + } getUnknownFields().writeTo(output); } @@ -30194,6 +30789,20 @@ public final class LayoutGraphicsProto { if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(lineId_)) { size += com.google.protobuf.GeneratedMessageV3.computeStringSize(10, lineId_); } + { + int dataSize = 0; + for (int i = 0; i < dashPointIndexs_.size(); i++) { + dataSize += com.google.protobuf.CodedOutputStream + .computeInt32SizeNoTag(dashPointIndexs_.getInt(i)); + } + size += dataSize; + if (!getDashPointIndexsList().isEmpty()) { + size += 1; + size += com.google.protobuf.CodedOutputStream + .computeInt32SizeNoTag(dataSize); + } + dashPointIndexsMemoizedSerializedSize = dataSize; + } size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -30228,6 +30837,8 @@ public final class LayoutGraphicsProto { .equals(other.getLinkPathLinesList())) return false; if (!getLineId() .equals(other.getLineId())) return false; + if (!getDashPointIndexsList() + .equals(other.getDashPointIndexsList())) return false; if (!getUnknownFields().equals(other.getUnknownFields())) return false; return true; } @@ -30263,6 +30874,10 @@ public final class LayoutGraphicsProto { } hash = (37 * hash) + LINEID_FIELD_NUMBER; hash = (53 * hash) + getLineId().hashCode(); + if (getDashPointIndexsCount() > 0) { + hash = (37 * hash) + DASHPOINTINDEXS_FIELD_NUMBER; + hash = (53 * hash) + getDashPointIndexsList().hashCode(); + } hash = (29 * hash) + getUnknownFields().hashCode(); memoizedHashCode = hash; return hash; @@ -30414,6 +31029,7 @@ public final class LayoutGraphicsProto { linkPathLines_ = com.google.protobuf.LazyStringArrayList.emptyList(); lineId_ = ""; + dashPointIndexs_ = emptyIntList(); return this; } @@ -30456,6 +31072,11 @@ public final class LayoutGraphicsProto { } else { result.points_ = pointsBuilder_.build(); } + if (((bitField0_ & 0x00000100) != 0)) { + dashPointIndexs_.makeImmutable(); + bitField0_ = (bitField0_ & ~0x00000100); + } + result.dashPointIndexs_ = dashPointIndexs_; } private void buildPartial0(club.joylink.xiannccda.dto.protos.LayoutGraphicsProto.RunLine result) { @@ -30568,6 +31189,16 @@ public final class LayoutGraphicsProto { bitField0_ |= 0x00000080; onChanged(); } + if (!other.dashPointIndexs_.isEmpty()) { + if (dashPointIndexs_.isEmpty()) { + dashPointIndexs_ = other.dashPointIndexs_; + bitField0_ = (bitField0_ & ~0x00000100); + } else { + ensureDashPointIndexsIsMutable(); + dashPointIndexs_.addAll(other.dashPointIndexs_); + } + onChanged(); + } this.mergeUnknownFields(other.getUnknownFields()); onChanged(); return this; @@ -30646,6 +31277,22 @@ public final class LayoutGraphicsProto { bitField0_ |= 0x00000080; break; } // case 82 + case 88: { + int v = input.readInt32(); + ensureDashPointIndexsIsMutable(); + dashPointIndexs_.addInt(v); + break; + } // case 88 + case 90: { + int length = input.readRawVarint32(); + int limit = input.pushLimit(length); + ensureDashPointIndexsIsMutable(); + while (input.getBytesUntilLimit() > 0) { + dashPointIndexs_.addInt(input.readInt32()); + } + input.popLimit(limit); + break; + } // case 90 default: { if (!super.parseUnknownField(input, extensionRegistry, tag)) { done = true; // was an endgroup tag @@ -31576,6 +32223,115 @@ public final class LayoutGraphicsProto { onChanged(); return this; } + + private com.google.protobuf.Internal.IntList dashPointIndexs_ = emptyIntList(); + private void ensureDashPointIndexsIsMutable() { + if (!((bitField0_ & 0x00000100) != 0)) { + dashPointIndexs_ = mutableCopy(dashPointIndexs_); + bitField0_ |= 0x00000100; + } + } + /** + *
+       * 虚线段点序号
+       * 
+ * + * repeated int32 dashPointIndexs = 11; + * @return A list containing the dashPointIndexs. + */ + public java.util.List + getDashPointIndexsList() { + return ((bitField0_ & 0x00000100) != 0) ? + java.util.Collections.unmodifiableList(dashPointIndexs_) : dashPointIndexs_; + } + /** + *
+       * 虚线段点序号
+       * 
+ * + * repeated int32 dashPointIndexs = 11; + * @return The count of dashPointIndexs. + */ + public int getDashPointIndexsCount() { + return dashPointIndexs_.size(); + } + /** + *
+       * 虚线段点序号
+       * 
+ * + * repeated int32 dashPointIndexs = 11; + * @param index The index of the element to return. + * @return The dashPointIndexs at the given index. + */ + public int getDashPointIndexs(int index) { + return dashPointIndexs_.getInt(index); + } + /** + *
+       * 虚线段点序号
+       * 
+ * + * repeated int32 dashPointIndexs = 11; + * @param index The index to set the value at. + * @param value The dashPointIndexs to set. + * @return This builder for chaining. + */ + public Builder setDashPointIndexs( + int index, int value) { + + ensureDashPointIndexsIsMutable(); + dashPointIndexs_.setInt(index, value); + onChanged(); + return this; + } + /** + *
+       * 虚线段点序号
+       * 
+ * + * repeated int32 dashPointIndexs = 11; + * @param value The dashPointIndexs to add. + * @return This builder for chaining. + */ + public Builder addDashPointIndexs(int value) { + + ensureDashPointIndexsIsMutable(); + dashPointIndexs_.addInt(value); + onChanged(); + return this; + } + /** + *
+       * 虚线段点序号
+       * 
+ * + * repeated int32 dashPointIndexs = 11; + * @param values The dashPointIndexs to add. + * @return This builder for chaining. + */ + public Builder addAllDashPointIndexs( + java.lang.Iterable values) { + ensureDashPointIndexsIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll( + values, dashPointIndexs_); + onChanged(); + return this; + } + /** + *
+       * 虚线段点序号
+       * 
+ * + * repeated int32 dashPointIndexs = 11; + * @return This builder for chaining. + */ + public Builder clearDashPointIndexs() { + dashPointIndexs_ = emptyIntList(); + bitField0_ = (bitField0_ & ~0x00000100); + onChanged(); + return this; + } @java.lang.Override public final Builder setUnknownFields( final com.google.protobuf.UnknownFieldSet unknownFields) { @@ -40075,76 +40831,78 @@ public final class LayoutGraphicsProto { "\n\007Polygon\022\'\n\006common\030\001 \001(\0132\027.graphicData." + "CommonInfo\022\014\n\004code\030\002 \001(\t\022\021\n\tlineWidth\030\003 " + "\001(\005\022\021\n\tlineColor\030\004 \001(\t\022\"\n\006points\030\005 \003(\0132\022" + - ".graphicData.Point\"e\n\010Platform\022\'\n\006common" + - "\030\001 \001(\0132\027.graphicData.CommonInfo\022\014\n\004code\030" + - "\002 \001(\t\022\017\n\007hasdoor\030\003 \001(\010\022\021\n\tdirection\030\004 \001(" + - "\t\"\252\001\n\007Station\022\'\n\006common\030\001 \001(\0132\027.graphicD" + + ".graphicData.Point\"\214\001\n\010Platform\022\'\n\006commo" + + "n\030\001 \001(\0132\027.graphicData.CommonInfo\022\014\n\004code" + + "\030\002 \001(\t\022\017\n\007hasdoor\030\003 \001(\010\022\021\n\tdirection\030\004 \001" + + "(\t\022\021\n\tupAndDown\030\005 \001(\t\022\022\n\nrefStation\030\006 \001(" + + "\t\"\270\001\n\007Station\022\'\n\006common\030\001 \001(\0132\027.graphicD" + "ata.CommonInfo\022\014\n\004code\030\002 \001(\t\022\022\n\nhasContr" + "ol\030\003 \001(\010\022\035\n\025concentrationStations\030\004 \001(\010\022" + "5\n\017kilometerSystem\030\006 \001(\0132\034.graphicData.K" + - "ilometerSystem\"k\n\013StationLine\022\'\n\006common\030" + - "\001 \001(\0132\027.graphicData.CommonInfo\022\014\n\004code\030\002" + - " \001(\t\022\023\n\013hasTransfer\030\003 \001(\010\022\020\n\010hideName\030\004 " + - "\001(\010\"Y\n\013TrainWindow\022\'\n\006common\030\001 \001(\0132\027.gra" + - "phicData.CommonInfo\022\014\n\004code\030\002 \001(\t\022\023\n\013ref" + - "DeviceId\030\003 \003(\t\"\256\001\n\014AxleCounting\022\'\n\006commo" + - "n\030\001 \001(\0132\027.graphicData.CommonInfo\022\014\n\004code" + - "\030\002 \001(\t\0225\n\017kilometerSystem\030\003 \001(\0132\034.graphi" + - "cData.KilometerSystem\0220\n\017axleCountingRef" + - "\030\004 \003(\0132\027.graphicData.RelatedRef\">\n\005Train" + - "\022\'\n\006common\030\001 \001(\0132\027.graphicData.CommonInf" + - "o\022\014\n\004code\030\002 \001(\t\"B\n\tTrainLine\022\'\n\006common\030\001" + + "ilometerSystem\022\014\n\004name\030\007 \001(\t\"k\n\013StationL" + + "ine\022\'\n\006common\030\001 \001(\0132\027.graphicData.Common" + + "Info\022\014\n\004code\030\002 \001(\t\022\023\n\013hasTransfer\030\003 \001(\010\022" + + "\020\n\010hideName\030\004 \001(\010\"Y\n\013TrainWindow\022\'\n\006comm" + + "on\030\001 \001(\0132\027.graphicData.CommonInfo\022\014\n\004cod" + + "e\030\002 \001(\t\022\023\n\013refDeviceId\030\003 \003(\t\"\256\001\n\014AxleCou" + + "nting\022\'\n\006common\030\001 \001(\0132\027.graphicData.Comm" + + "onInfo\022\014\n\004code\030\002 \001(\t\0225\n\017kilometerSystem\030" + + "\003 \001(\0132\034.graphicData.KilometerSystem\0220\n\017a" + + "xleCountingRef\030\004 \003(\0132\027.graphicData.Relat" + + "edRef\">\n\005Train\022\'\n\006common\030\001 \001(\0132\027.graphic" + + "Data.CommonInfo\022\014\n\004code\030\002 \001(\t\"B\n\tTrainLi" + + "ne\022\'\n\006common\030\001 \001(\0132\027.graphicData.CommonI" + + "nfo\022\014\n\004code\030\002 \001(\t\"@\n\007IscsFan\022\'\n\006common\030\001" + " \001(\0132\027.graphicData.CommonInfo\022\014\n\004code\030\002 " + - "\001(\t\"@\n\007IscsFan\022\'\n\006common\030\001 \001(\0132\027.graphic" + - "Data.CommonInfo\022\014\n\004code\030\002 \001(\t\"\333\002\n\007Turnou" + - "t\022\'\n\006common\030\001 \001(\0132\027.graphicData.CommonIn" + - "fo\022\014\n\004code\030\002 \001(\t\022\"\n\006pointA\030\006 \003(\0132\022.graph" + - "icData.Point\022\"\n\006pointB\030\007 \003(\0132\022.graphicDa" + - "ta.Point\022\"\n\006pointC\030\010 \003(\0132\022.graphicData.P" + - "oint\022&\n\005paRef\030\t \001(\0132\027.graphicData.Relate" + - "dRef\022&\n\005pbRef\030\n \001(\0132\027.graphicData.Relate" + - "dRef\022&\n\005pcRef\030\013 \001(\0132\027.graphicData.Relate" + - "dRef\0225\n\017kilometerSystem\030\r \003(\0132\034.graphicD" + - "ata.KilometerSystem\">\n\017KilometerSystem\022\021" + - "\n\tkilometer\030\001 \001(\003\022\030\n\020coordinateSystem\030\002 " + - "\001(\t\"\206\001\n\006Signal\022\'\n\006common\030\001 \001(\0132\027.graphic" + - "Data.CommonInfo\022\014\n\004code\030\002 \001(\t\022\016\n\006mirror\030" + - "\003 \001(\010\0225\n\017kilometerSystem\030\006 \001(\0132\034.graphic" + - "Data.KilometerSystem\"\307\001\n\007RunLine\022\'\n\006comm" + - "on\030\001 \001(\0132\027.graphicData.CommonInfo\022\014\n\004cod" + - "e\030\002 \001(\t\022\"\n\006points\030\003 \003(\0132\022.graphicData.Po" + - "int\022\021\n\tnameColor\030\004 \001(\t\022\023\n\013nameBgColor\030\005 " + - "\001(\t\022\022\n\ncontainSta\030\010 \003(\t\022\025\n\rlinkPathLines" + - "\030\t \003(\t\022\016\n\006lineId\030\n \001(\t\"\337\002\n\007Section\022\'\n\006co" + - "mmon\030\001 \001(\0132\027.graphicData.CommonInfo\022\014\n\004c" + - "ode\030\002 \001(\t\022\"\n\006points\030\003 \003(\0132\022.graphicData." + - "Point\022&\n\005paRef\030\004 \001(\0132\027.graphicData.Relat" + - "edRef\022&\n\005pbRef\030\005 \001(\0132\027.graphicData.Relat" + - "edRef\0225\n\013sectionType\030\006 \001(\0162 .graphicData" + - ".Section.SectionType\022\025\n\raxleCountings\030\007 " + - "\003(\t\022\020\n\010children\030\010 \003(\t\022\027\n\017destinationCode" + - "\030\t \001(\t\"0\n\013SectionType\022\014\n\010Physical\020\000\022\023\n\017T" + - "urnoutPhysical\020\002\"i\n\014LogicSection\022\'\n\006comm" + - "on\030\001 \001(\0132\027.graphicData.CommonInfo\022\014\n\004cod" + - "e\030\002 \001(\t\022\"\n\006points\030\003 \003(\0132\022.graphicData.Po" + - "int\"V\n\016KilometerPoint\022!\n\005point\030\001 \001(\0132\022.g" + - "raphicData.Point\022\021\n\tkilometer\030\002 \001(\003\022\016\n\006s" + - "tName\030\003 \001(\t\"\277\001\n\010PathLine\022\'\n\006common\030\001 \001(\013" + - "2\027.graphicData.CommonInfo\022\014\n\004code\030\002 \001(\t\022" + - "\"\n\006points\030\003 \003(\0132\022.graphicData.Point\022\014\n\004i" + - "sUp\030\004 \001(\010\0224\n\017kilometerPoints\030\005 \003(\0132\033.gra" + - "phicData.KilometerPoint\022\024\n\014isKmIncrease\030" + - "\006 \001(\010\"\366\001\n\nRelatedRef\0226\n\ndeviceType\030\001 \001(\016" + - "2\".graphicData.RelatedRef.DeviceType\022\n\n\002" + - "id\030\002 \001(\t\0226\n\ndevicePort\030\003 \001(\0162\".graphicDa" + - "ta.RelatedRef.DevicePort\"I\n\nDeviceType\022\013" + - "\n\007Section\020\000\022\013\n\007Turnout\020\001\022\017\n\013TrainWindow\020" + - "\002\022\020\n\014AxleCounting\020\003\"!\n\nDevicePort\022\005\n\001A\020\000" + - "\022\005\n\001B\020\001\022\005\n\001C\020\002\"Y\n\tSeparator\022\'\n\006common\030\001 " + - "\001(\0132\027.graphicData.CommonInfo\022\014\n\004code\030\002 \001" + - "(\t\022\025\n\rseparatorType\030\003 \001(\tB8\n!club.joylin" + - "k.xiannccda.dto.protosB\023LayoutGraphicsPr" + - "otob\006proto3" + "\001(\t\"\333\002\n\007Turnout\022\'\n\006common\030\001 \001(\0132\027.graphi" + + "cData.CommonInfo\022\014\n\004code\030\002 \001(\t\022\"\n\006pointA" + + "\030\006 \003(\0132\022.graphicData.Point\022\"\n\006pointB\030\007 \003" + + "(\0132\022.graphicData.Point\022\"\n\006pointC\030\010 \003(\0132\022" + + ".graphicData.Point\022&\n\005paRef\030\t \001(\0132\027.grap" + + "hicData.RelatedRef\022&\n\005pbRef\030\n \001(\0132\027.grap" + + "hicData.RelatedRef\022&\n\005pcRef\030\013 \001(\0132\027.grap" + + "hicData.RelatedRef\0225\n\017kilometerSystem\030\r " + + "\003(\0132\034.graphicData.KilometerSystem\">\n\017Kil" + + "ometerSystem\022\021\n\tkilometer\030\001 \001(\003\022\030\n\020coord" + + "inateSystem\030\002 \001(\t\"\206\001\n\006Signal\022\'\n\006common\030\001" + + " \001(\0132\027.graphicData.CommonInfo\022\014\n\004code\030\002 " + + "\001(\t\022\016\n\006mirror\030\003 \001(\010\0225\n\017kilometerSystem\030\006" + + " \001(\0132\034.graphicData.KilometerSystem\"\340\001\n\007R" + + "unLine\022\'\n\006common\030\001 \001(\0132\027.graphicData.Com" + + "monInfo\022\014\n\004code\030\002 \001(\t\022\"\n\006points\030\003 \003(\0132\022." + + "graphicData.Point\022\021\n\tnameColor\030\004 \001(\t\022\023\n\013" + + "nameBgColor\030\005 \001(\t\022\022\n\ncontainSta\030\010 \003(\t\022\025\n" + + "\rlinkPathLines\030\t \003(\t\022\016\n\006lineId\030\n \001(\t\022\027\n\017" + + "dashPointIndexs\030\013 \003(\005\"\337\002\n\007Section\022\'\n\006com" + + "mon\030\001 \001(\0132\027.graphicData.CommonInfo\022\014\n\004co" + + "de\030\002 \001(\t\022\"\n\006points\030\003 \003(\0132\022.graphicData.P" + + "oint\022&\n\005paRef\030\004 \001(\0132\027.graphicData.Relate" + + "dRef\022&\n\005pbRef\030\005 \001(\0132\027.graphicData.Relate" + + "dRef\0225\n\013sectionType\030\006 \001(\0162 .graphicData." + + "Section.SectionType\022\025\n\raxleCountings\030\007 \003" + + "(\t\022\020\n\010children\030\010 \003(\t\022\027\n\017destinationCode\030" + + "\t \001(\t\"0\n\013SectionType\022\014\n\010Physical\020\000\022\023\n\017Tu" + + "rnoutPhysical\020\002\"i\n\014LogicSection\022\'\n\006commo" + + "n\030\001 \001(\0132\027.graphicData.CommonInfo\022\014\n\004code" + + "\030\002 \001(\t\022\"\n\006points\030\003 \003(\0132\022.graphicData.Poi" + + "nt\"V\n\016KilometerPoint\022!\n\005point\030\001 \001(\0132\022.gr" + + "aphicData.Point\022\021\n\tkilometer\030\002 \001(\003\022\016\n\006st" + + "Name\030\003 \001(\t\"\277\001\n\010PathLine\022\'\n\006common\030\001 \001(\0132" + + "\027.graphicData.CommonInfo\022\014\n\004code\030\002 \001(\t\022\"" + + "\n\006points\030\003 \003(\0132\022.graphicData.Point\022\014\n\004is" + + "Up\030\004 \001(\010\0224\n\017kilometerPoints\030\005 \003(\0132\033.grap" + + "hicData.KilometerPoint\022\024\n\014isKmIncrease\030\006" + + " \001(\010\"\366\001\n\nRelatedRef\0226\n\ndeviceType\030\001 \001(\0162" + + "\".graphicData.RelatedRef.DeviceType\022\n\n\002i" + + "d\030\002 \001(\t\0226\n\ndevicePort\030\003 \001(\0162\".graphicDat" + + "a.RelatedRef.DevicePort\"I\n\nDeviceType\022\013\n" + + "\007Section\020\000\022\013\n\007Turnout\020\001\022\017\n\013TrainWindow\020\002" + + "\022\020\n\014AxleCounting\020\003\"!\n\nDevicePort\022\005\n\001A\020\000\022" + + "\005\n\001B\020\001\022\005\n\001C\020\002\"Y\n\tSeparator\022\'\n\006common\030\001 \001" + + "(\0132\027.graphicData.CommonInfo\022\014\n\004code\030\002 \001(" + + "\t\022\025\n\rseparatorType\030\003 \001(\tB8\n!club.joylink" + + ".xiannccda.dto.protosB\023LayoutGraphicsPro" + + "tob\006proto3" }; descriptor = com.google.protobuf.Descriptors.FileDescriptor .internalBuildGeneratedFileFrom(descriptorData, @@ -40209,13 +40967,13 @@ public final class LayoutGraphicsProto { internal_static_graphicData_Platform_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_graphicData_Platform_descriptor, - new java.lang.String[] { "Common", "Code", "Hasdoor", "Direction", }); + new java.lang.String[] { "Common", "Code", "Hasdoor", "Direction", "UpAndDown", "RefStation", }); internal_static_graphicData_Station_descriptor = getDescriptor().getMessageTypes().get(10); internal_static_graphicData_Station_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_graphicData_Station_descriptor, - new java.lang.String[] { "Common", "Code", "HasControl", "ConcentrationStations", "KilometerSystem", }); + new java.lang.String[] { "Common", "Code", "HasControl", "ConcentrationStations", "KilometerSystem", "Name", }); internal_static_graphicData_StationLine_descriptor = getDescriptor().getMessageTypes().get(11); internal_static_graphicData_StationLine_fieldAccessorTable = new @@ -40275,7 +41033,7 @@ public final class LayoutGraphicsProto { internal_static_graphicData_RunLine_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_graphicData_RunLine_descriptor, - new java.lang.String[] { "Common", "Code", "Points", "NameColor", "NameBgColor", "ContainSta", "LinkPathLines", "LineId", }); + new java.lang.String[] { "Common", "Code", "Points", "NameColor", "NameBgColor", "ContainSta", "LinkPathLines", "LineId", "DashPointIndexs", }); internal_static_graphicData_Section_descriptor = getDescriptor().getMessageTypes().get(21); internal_static_graphicData_Section_fieldAccessorTable = new diff --git a/src/main/java/club/joylink/xiannccda/dto/protos/NccAlertInfoMessageProto.java b/src/main/java/club/joylink/xiannccda/dto/protos/NccAlertInfoMessageProto.java index 4326253..ca96dd5 100644 --- a/src/main/java/club/joylink/xiannccda/dto/protos/NccAlertInfoMessageProto.java +++ b/src/main/java/club/joylink/xiannccda/dto/protos/NccAlertInfoMessageProto.java @@ -137,44 +137,10 @@ public final class NccAlertInfoMessageProto { int getAlertTipId(); /** - *
-       *故障设备信息
-       * 
- * - * string device_info = 6; - * @return The deviceInfo. + * bool mock = 6; + * @return The mock. */ - java.lang.String getDeviceInfo(); - /** - *
-       *故障设备信息
-       * 
- * - * string device_info = 6; - * @return The bytes for deviceInfo. - */ - com.google.protobuf.ByteString - getDeviceInfoBytes(); - - /** - *
-       *导致报警的原因
-       * 
- * - * string reason = 7; - * @return The reason. - */ - java.lang.String getReason(); - /** - *
-       *导致报警的原因
-       * 
- * - * string reason = 7; - * @return The bytes for reason. - */ - com.google.protobuf.ByteString - getReasonBytes(); + boolean getMock(); } /** * Protobuf type {@code alert.NccAlertInfoMessage.Message} @@ -193,8 +159,6 @@ public final class NccAlertInfoMessageProto { level_ = ""; alertTime_ = ""; info_ = ""; - deviceInfo_ = ""; - reason_ = ""; } @java.lang.Override @@ -384,98 +348,15 @@ public final class NccAlertInfoMessageProto { return alertTipId_; } - public static final int DEVICE_INFO_FIELD_NUMBER = 6; - @SuppressWarnings("serial") - private volatile java.lang.Object deviceInfo_ = ""; + public static final int MOCK_FIELD_NUMBER = 6; + private boolean mock_ = false; /** - *
-       *故障设备信息
-       * 
- * - * string device_info = 6; - * @return The deviceInfo. + * bool mock = 6; + * @return The mock. */ @java.lang.Override - public java.lang.String getDeviceInfo() { - java.lang.Object ref = deviceInfo_; - 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(); - deviceInfo_ = s; - return s; - } - } - /** - *
-       *故障设备信息
-       * 
- * - * string device_info = 6; - * @return The bytes for deviceInfo. - */ - @java.lang.Override - public com.google.protobuf.ByteString - getDeviceInfoBytes() { - java.lang.Object ref = deviceInfo_; - if (ref instanceof java.lang.String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8( - (java.lang.String) ref); - deviceInfo_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - public static final int REASON_FIELD_NUMBER = 7; - @SuppressWarnings("serial") - private volatile java.lang.Object reason_ = ""; - /** - *
-       *导致报警的原因
-       * 
- * - * string reason = 7; - * @return The reason. - */ - @java.lang.Override - public java.lang.String getReason() { - java.lang.Object ref = reason_; - 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(); - reason_ = s; - return s; - } - } - /** - *
-       *导致报警的原因
-       * 
- * - * string reason = 7; - * @return The bytes for reason. - */ - @java.lang.Override - public com.google.protobuf.ByteString - getReasonBytes() { - java.lang.Object ref = reason_; - if (ref instanceof java.lang.String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8( - (java.lang.String) ref); - reason_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } + public boolean getMock() { + return mock_; } private byte memoizedIsInitialized = -1; @@ -507,11 +388,8 @@ public final class NccAlertInfoMessageProto { if (alertTipId_ != 0) { output.writeInt32(5, alertTipId_); } - if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(deviceInfo_)) { - com.google.protobuf.GeneratedMessageV3.writeString(output, 6, deviceInfo_); - } - if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(reason_)) { - com.google.protobuf.GeneratedMessageV3.writeString(output, 7, reason_); + if (mock_ != false) { + output.writeBool(6, mock_); } getUnknownFields().writeTo(output); } @@ -538,11 +416,9 @@ public final class NccAlertInfoMessageProto { size += com.google.protobuf.CodedOutputStream .computeInt32Size(5, alertTipId_); } - if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(deviceInfo_)) { - size += com.google.protobuf.GeneratedMessageV3.computeStringSize(6, deviceInfo_); - } - if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(reason_)) { - size += com.google.protobuf.GeneratedMessageV3.computeStringSize(7, reason_); + if (mock_ != false) { + size += com.google.protobuf.CodedOutputStream + .computeBoolSize(6, mock_); } size += getUnknownFields().getSerializedSize(); memoizedSize = size; @@ -569,10 +445,8 @@ public final class NccAlertInfoMessageProto { .equals(other.getInfo())) return false; if (getAlertTipId() != other.getAlertTipId()) return false; - if (!getDeviceInfo() - .equals(other.getDeviceInfo())) return false; - if (!getReason() - .equals(other.getReason())) return false; + if (getMock() + != other.getMock()) return false; if (!getUnknownFields().equals(other.getUnknownFields())) return false; return true; } @@ -594,10 +468,9 @@ public final class NccAlertInfoMessageProto { hash = (53 * hash) + getInfo().hashCode(); hash = (37 * hash) + ALERT_TIP_ID_FIELD_NUMBER; hash = (53 * hash) + getAlertTipId(); - hash = (37 * hash) + DEVICE_INFO_FIELD_NUMBER; - hash = (53 * hash) + getDeviceInfo().hashCode(); - hash = (37 * hash) + REASON_FIELD_NUMBER; - hash = (53 * hash) + getReason().hashCode(); + hash = (37 * hash) + MOCK_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean( + getMock()); hash = (29 * hash) + getUnknownFields().hashCode(); memoizedHashCode = hash; return hash; @@ -734,8 +607,7 @@ public final class NccAlertInfoMessageProto { alertTime_ = ""; info_ = ""; alertTipId_ = 0; - deviceInfo_ = ""; - reason_ = ""; + mock_ = false; return this; } @@ -785,10 +657,7 @@ public final class NccAlertInfoMessageProto { result.alertTipId_ = alertTipId_; } if (((from_bitField0_ & 0x00000020) != 0)) { - result.deviceInfo_ = deviceInfo_; - } - if (((from_bitField0_ & 0x00000040) != 0)) { - result.reason_ = reason_; + result.mock_ = mock_; } } @@ -827,15 +696,8 @@ public final class NccAlertInfoMessageProto { if (other.getAlertTipId() != 0) { setAlertTipId(other.getAlertTipId()); } - if (!other.getDeviceInfo().isEmpty()) { - deviceInfo_ = other.deviceInfo_; - bitField0_ |= 0x00000020; - onChanged(); - } - if (!other.getReason().isEmpty()) { - reason_ = other.reason_; - bitField0_ |= 0x00000040; - onChanged(); + if (other.getMock() != false) { + setMock(other.getMock()); } this.mergeUnknownFields(other.getUnknownFields()); onChanged(); @@ -888,16 +750,11 @@ public final class NccAlertInfoMessageProto { bitField0_ |= 0x00000010; break; } // case 40 - case 50: { - deviceInfo_ = input.readStringRequireUtf8(); + case 48: { + mock_ = input.readBool(); bitField0_ |= 0x00000020; break; - } // case 50 - case 58: { - reason_ = input.readStringRequireUtf8(); - bitField0_ |= 0x00000040; - break; - } // case 58 + } // case 48 default: { if (!super.parseUnknownField(input, extensionRegistry, tag)) { done = true; // was an endgroup tag @@ -1235,186 +1092,34 @@ public final class NccAlertInfoMessageProto { return this; } - private java.lang.Object deviceInfo_ = ""; + private boolean mock_ ; /** - *
-         *故障设备信息
-         * 
- * - * string device_info = 6; - * @return The deviceInfo. + * bool mock = 6; + * @return The mock. */ - public java.lang.String getDeviceInfo() { - java.lang.Object ref = deviceInfo_; - if (!(ref instanceof java.lang.String)) { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - deviceInfo_ = s; - return s; - } else { - return (java.lang.String) ref; - } + @java.lang.Override + public boolean getMock() { + return mock_; } /** - *
-         *故障设备信息
-         * 
- * - * string device_info = 6; - * @return The bytes for deviceInfo. - */ - public com.google.protobuf.ByteString - getDeviceInfoBytes() { - java.lang.Object ref = deviceInfo_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8( - (java.lang.String) ref); - deviceInfo_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - /** - *
-         *故障设备信息
-         * 
- * - * string device_info = 6; - * @param value The deviceInfo to set. + * bool mock = 6; + * @param value The mock to set. * @return This builder for chaining. */ - public Builder setDeviceInfo( - java.lang.String value) { - if (value == null) { throw new NullPointerException(); } - deviceInfo_ = value; - bitField0_ |= 0x00000020; - onChanged(); - return this; - } - /** - *
-         *故障设备信息
-         * 
- * - * string device_info = 6; - * @return This builder for chaining. - */ - public Builder clearDeviceInfo() { - deviceInfo_ = getDefaultInstance().getDeviceInfo(); - bitField0_ = (bitField0_ & ~0x00000020); - onChanged(); - return this; - } - /** - *
-         *故障设备信息
-         * 
- * - * string device_info = 6; - * @param value The bytes for deviceInfo to set. - * @return This builder for chaining. - */ - public Builder setDeviceInfoBytes( - com.google.protobuf.ByteString value) { - if (value == null) { throw new NullPointerException(); } - checkByteStringIsUtf8(value); - deviceInfo_ = value; - bitField0_ |= 0x00000020; - onChanged(); - return this; - } + public Builder setMock(boolean value) { - private java.lang.Object reason_ = ""; - /** - *
-         *导致报警的原因
-         * 
- * - * string reason = 7; - * @return The reason. - */ - public java.lang.String getReason() { - java.lang.Object ref = reason_; - if (!(ref instanceof java.lang.String)) { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - reason_ = s; - return s; - } else { - return (java.lang.String) ref; - } - } - /** - *
-         *导致报警的原因
-         * 
- * - * string reason = 7; - * @return The bytes for reason. - */ - public com.google.protobuf.ByteString - getReasonBytes() { - java.lang.Object ref = reason_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8( - (java.lang.String) ref); - reason_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - /** - *
-         *导致报警的原因
-         * 
- * - * string reason = 7; - * @param value The reason to set. - * @return This builder for chaining. - */ - public Builder setReason( - java.lang.String value) { - if (value == null) { throw new NullPointerException(); } - reason_ = value; - bitField0_ |= 0x00000040; + mock_ = value; + bitField0_ |= 0x00000020; onChanged(); return this; } /** - *
-         *导致报警的原因
-         * 
- * - * string reason = 7; + * bool mock = 6; * @return This builder for chaining. */ - public Builder clearReason() { - reason_ = getDefaultInstance().getReason(); - bitField0_ = (bitField0_ & ~0x00000040); - onChanged(); - return this; - } - /** - *
-         *导致报警的原因
-         * 
- * - * string reason = 7; - * @param value The bytes for reason to set. - * @return This builder for chaining. - */ - public Builder setReasonBytes( - com.google.protobuf.ByteString value) { - if (value == null) { throw new NullPointerException(); } - checkByteStringIsUtf8(value); - reason_ = value; - bitField0_ |= 0x00000040; + public Builder clearMock() { + bitField0_ = (bitField0_ & ~0x00000020); + mock_ = false; onChanged(); return this; } @@ -2187,14 +1892,14 @@ public final class NccAlertInfoMessageProto { descriptor; static { java.lang.String[] descriptorData = { - "\n\017alertInfo.proto\022\005alert\"\317\001\n\023NccAlertInf" + + "\n\017alertInfo.proto\022\005alert\"\267\001\n\023NccAlertInf" + "oMessage\0224\n\010messages\030\001 \003(\0132\".alert.NccAl" + - "ertInfoMessage.Message\032\201\001\n\007Message\022\n\n\002id" + - "\030\001 \001(\t\022\r\n\005level\030\002 \001(\t\022\022\n\nalert_time\030\003 \001(" + - "\t\022\014\n\004info\030\004 \001(\t\022\024\n\014alert_tip_id\030\005 \001(\005\022\023\n" + - "\013device_info\030\006 \001(\t\022\016\n\006reason\030\007 \001(\tB=\n!cl" + - "ub.joylink.xiannccda.dto.protosB\030NccAler" + - "tInfoMessageProtob\006proto3" + "ertInfoMessage.Message\032j\n\007Message\022\n\n\002id\030" + + "\001 \001(\t\022\r\n\005level\030\002 \001(\t\022\022\n\nalert_time\030\003 \001(\t" + + "\022\014\n\004info\030\004 \001(\t\022\024\n\014alert_tip_id\030\005 \001(\005\022\014\n\004" + + "mock\030\006 \001(\010B=\n!club.joylink.xiannccda.dto" + + ".protosB\030NccAlertInfoMessageProtob\006proto" + + "3" }; descriptor = com.google.protobuf.Descriptors.FileDescriptor .internalBuildGeneratedFileFrom(descriptorData, @@ -2211,7 +1916,7 @@ public final class NccAlertInfoMessageProto { internal_static_alert_NccAlertInfoMessage_Message_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_alert_NccAlertInfoMessage_Message_descriptor, - new java.lang.String[] { "Id", "Level", "AlertTime", "Info", "AlertTipId", "DeviceInfo", "Reason", }); + new java.lang.String[] { "Id", "Level", "AlertTime", "Info", "AlertTipId", "Mock", }); } // @@protoc_insertion_point(outer_class_scope) diff --git a/src/main/java/club/joylink/xiannccda/service/AlertMockService.java b/src/main/java/club/joylink/xiannccda/service/AlertMockService.java new file mode 100644 index 0000000..38fa659 --- /dev/null +++ b/src/main/java/club/joylink/xiannccda/service/AlertMockService.java @@ -0,0 +1,56 @@ +package club.joylink.xiannccda.service; + +import club.joylink.xiannccda.alert.AlertDetail; +import club.joylink.xiannccda.alert.AlertDetailFactory; +import club.joylink.xiannccda.alert.AlertType; +import club.joylink.xiannccda.alert.core.AlertManager; +import club.joylink.xiannccda.ats.cache.LineGraphicDataRepository; +import club.joylink.xiannccda.dto.AlertMockDTO; +import club.joylink.xiannccda.dto.protos.LayoutGraphicsProto.Platform; +import club.joylink.xiannccda.dto.protos.LayoutGraphicsProto.Station; +import club.joylink.xiannccda.exception.BusinessExceptionAssertEnum; +import club.joylink.xiannccda.ws.NccAlertMessageServer; +import com.google.protobuf.MessageOrBuilder; +import java.util.stream.Stream; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +@Service +public class AlertMockService { + + @Autowired + private AlertDetailFactory alertDetailFactory; + + public void setAlert(AlertMockDTO alertMockDTO) { + short lineId = alertMockDTO.getLineId(); + AlertType alertType = alertMockDTO.getAlertType(); + AlertDetail alertDetail = buildAlertDetail(alertType, lineId); + AlertManager alertManager = AlertManager.getDefault(); + alertManager.emit(alertDetail); + } + + private AlertDetail buildAlertDetail(AlertType alertType, short lineId) { + MessageOrBuilder messageOrBuilder; + switch (alertType) { + case BLUE_DISPLAY -> { + Stream stream = LineGraphicDataRepository.getDevices(lineId, Station.class); + messageOrBuilder = stream.findFirst() + .orElseThrow(BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL::exception); + } + case TRAIN_DELAY -> { + throw BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.exception(); + } + case PLATFORM_DOOR_WITHOUT_LOCKED_SIGNAL, PLATFORM_DOOR_CANNOT_OPEN, PLATFORM_DOOR_CANNOT_CLOSE -> { + Stream stream = LineGraphicDataRepository.getDevices(lineId, Platform.class); + messageOrBuilder = stream.findFirst() + .orElseThrow(BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL::exception); + } + default -> throw new IllegalStateException("Unexpected value: " + alertType); + } + return alertDetailFactory.getAlertDetail(alertType, lineId, true, messageOrBuilder); + } + + public void clearMockAlert() { + NccAlertMessageServer.getDefault().clearMockAlert(); + } +} diff --git a/src/main/java/club/joylink/xiannccda/ws/NccAlertMessageServer.java b/src/main/java/club/joylink/xiannccda/ws/NccAlertMessageServer.java index 62954b3..700b2b0 100644 --- a/src/main/java/club/joylink/xiannccda/ws/NccAlertMessageServer.java +++ b/src/main/java/club/joylink/xiannccda/ws/NccAlertMessageServer.java @@ -5,9 +5,11 @@ import club.joylink.xiannccda.dto.protos.NccAlertInfoMessageProto.NccAlertInfoMe import club.joylink.xiannccda.dto.protos.NccAlertInfoMessageProto.NccAlertInfoMessage.Builder; import club.joylink.xiannccda.dto.protos.NccAlertInfoMessageProto.NccAlertInfoMessage.Message; import java.util.ArrayList; +import java.util.Iterator; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; +import java.util.Map.Entry; import java.util.Queue; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentLinkedQueue; @@ -82,14 +84,25 @@ public class NccAlertMessageServer implements IMessageServer { pendingMsgQueue.add(alertInfo); } + public void clearMockAlert() { + Iterator> iterator = allMsg.entrySet().iterator(); + for (int i = 0; iterator.hasNext() && i < 10000; i++) { + Entry next = iterator.next(); + if (next.getValue().getMock()) { + iterator.remove(); + } + } + } + private NccAlertInfoMessage.Message convertToMessage(NccAlertInfo alertInfo) { Message.Builder builder = Message.newBuilder() .setId(alertInfo.getId()) .setLevel(alertInfo.getLevel()) .setAlertTime(alertInfo.getAlertTime().toString()) .setInfo(alertInfo.getInfo()) - .setDeviceInfo(alertInfo.getDeviceInfo()) - .setReason(alertInfo.getReason()); + .setMock(alertInfo.isMock()); +// .setDeviceInfo(alertInfo.getDeviceInfo()) +// .setReason(alertInfo.getReason()); Integer alertTipId = alertInfo.getAlertTipId(); if (alertTipId != null) { builder.setAlertTipId(alertTipId); diff --git a/src/test/java/club/joylink/xiannccda/GenertateProtoBufUtil.java b/src/test/java/club/joylink/xiannccda/GenerateProtoBufUtil.java similarity index 96% rename from src/test/java/club/joylink/xiannccda/GenertateProtoBufUtil.java rename to src/test/java/club/joylink/xiannccda/GenerateProtoBufUtil.java index 57376b5..5aa4e16 100644 --- a/src/test/java/club/joylink/xiannccda/GenertateProtoBufUtil.java +++ b/src/test/java/club/joylink/xiannccda/GenerateProtoBufUtil.java @@ -8,7 +8,7 @@ import java.util.Arrays; import java.util.List; import org.assertj.core.util.Lists; -public class GenertateProtoBufUtil { +public class GenerateProtoBufUtil { private final static String EXE_BIN_FILE = String.join(File.separator, System.getProperty("user.dir"), "xian-ncc-da-message", @@ -19,7 +19,7 @@ public class GenertateProtoBufUtil { private boolean pullMessage; // private String gitPullPath; - public GenertateProtoBufUtil(String rootPath, boolean pullMessage) { + public GenerateProtoBufUtil(String rootPath, boolean pullMessage) { this.pullMessage = pullMessage; String sourcePath = String.join(File.separator, rootPath, "xian-ncc-da-message", "protos"); diff --git a/src/test/java/club/joylink/xiannccda/WebSocketTest.java b/src/test/java/club/joylink/xiannccda/WebSocketTest.java index e5220d5..5ea7271 100644 --- a/src/test/java/club/joylink/xiannccda/WebSocketTest.java +++ b/src/test/java/club/joylink/xiannccda/WebSocketTest.java @@ -30,11 +30,11 @@ public class WebSocketTest { WebSocketHttpHeaders headers = new WebSocketHttpHeaders(); headers.set("Authorization", - "Bearer eyJhbGciOiJSUzI1NiJ9.eyJpc3MiOiJzZWxmIiwic3ViIjoiMTQiLCJleHAiOjE2ODgzNDY3ODgsImlhdCI6MTY4ODA4NzU4OH0.CCAHMqzzVXDYlvIBYhOBT92_MaYTSUDMmPwkzFDMRXR_LSidyVkm3o5SmqaiORjTgx_B0kxgwgpDGdXs3A_tmDrHolIUCvSaiez-hK3v30Z3Z4DhxtE8073tAqGdM-uU1eXTGC7zm20tM5riDe_Qy5PF5lf9qe9ty0Y06s62FNRNcyCBw-DuhkQcSkWfcMiUHKYVge2weO5Mzm1nD-1yViI359-smYU5eYJInVBdOaBvOECQ4OF8GJQ9rfgktPJAUsrXT0bf8cHp-fUUSvuNv5QUVmg2j-tZDIjhlN3OkXpHDiXuMPnx_lHVS95CO0metFozU2OT7uYukV5Z6RN4JA"); + "Bearer eyJhbGciOiJSUzI1NiJ9.eyJpc3MiOiJzZWxmIiwic3ViIjoiMTQiLCJleHAiOjE2OTAxMDc0NzAsImlhdCI6MTY4OTg0ODI3MH0.WXwKt6M12AMW-9Fhsop-nGtwxQR4jw7t-EIN2RUKLfRSaMlMgTgHPr_p47GXmQszJndPthUN3IkLBRMfVyEK3y4e9Uq5B2gD2DBgXuFgdM85PlJF8NHThDGyH-eoc7ZbPD1geCSFTiDbzuWuY4b1AcFnP2p4VdoU9s28FHoJzQRKL2cot-ZwexEVhFzVXJkXgF2oKpbdMamVHkTRuGRzmrYFzur2mqWKPI2XMuOdZ79GKK7yFzflXGZEPAY7zw_iwZmAc-grNlHfuwam9kTKz2nPUnsZM0pqkmRvcELsz63tk4uo6FLnsFkN7XHMj5AvHO92sIspQenw1s1vHgoESw"); StompHeaders stompHeaders = new StompHeaders(); stompHeaders.set("Authorization", - "Bearer eyJhbGciOiJSUzI1NiJ9.eyJpc3MiOiJzZWxmIiwic3ViIjoiMTQiLCJleHAiOjE2ODgzNDY3ODgsImlhdCI6MTY4ODA4NzU4OH0.CCAHMqzzVXDYlvIBYhOBT92_MaYTSUDMmPwkzFDMRXR_LSidyVkm3o5SmqaiORjTgx_B0kxgwgpDGdXs3A_tmDrHolIUCvSaiez-hK3v30Z3Z4DhxtE8073tAqGdM-uU1eXTGC7zm20tM5riDe_Qy5PF5lf9qe9ty0Y06s62FNRNcyCBw-DuhkQcSkWfcMiUHKYVge2weO5Mzm1nD-1yViI359-smYU5eYJInVBdOaBvOECQ4OF8GJQ9rfgktPJAUsrXT0bf8cHp-fUUSvuNv5QUVmg2j-tZDIjhlN3OkXpHDiXuMPnx_lHVS95CO0metFozU2OT7uYukV5Z6RN4JA"); + "Bearer eyJhbGciOiJSUzI1NiJ9.eyJpc3MiOiJzZWxmIiwic3ViIjoiMTQiLCJleHAiOjE2OTAxMDc0NzAsImlhdCI6MTY4OTg0ODI3MH0.WXwKt6M12AMW-9Fhsop-nGtwxQR4jw7t-EIN2RUKLfRSaMlMgTgHPr_p47GXmQszJndPthUN3IkLBRMfVyEK3y4e9Uq5B2gD2DBgXuFgdM85PlJF8NHThDGyH-eoc7ZbPD1geCSFTiDbzuWuY4b1AcFnP2p4VdoU9s28FHoJzQRKL2cot-ZwexEVhFzVXJkXgF2oKpbdMamVHkTRuGRzmrYFzur2mqWKPI2XMuOdZ79GKK7yFzflXGZEPAY7zw_iwZmAc-grNlHfuwam9kTKz2nPUnsZM0pqkmRvcELsz63tk4uo6FLnsFkN7XHMj5AvHO92sIspQenw1s1vHgoESw"); StompSessionHandlerAdapter sessionHandler = new StompSessionHandlerAdapter() { @Override diff --git a/xian-ncc-da-message b/xian-ncc-da-message index 90b6f46..e521fa9 160000 --- a/xian-ncc-da-message +++ b/xian-ncc-da-message @@ -1 +1 @@ -Subproject commit 90b6f4600e531c496d849163653acb80c6e933ea +Subproject commit e521fa9d3372987b45a4d9bdb63544cf4e1f088f