diff --git a/src/main/java/club/joylink/xiannccda/alert/AlertDetail.java b/src/main/java/club/joylink/xiannccda/alert/AlertDetail.java index 6f5c2c9..3d1580c 100644 --- a/src/main/java/club/joylink/xiannccda/alert/AlertDetail.java +++ b/src/main/java/club/joylink/xiannccda/alert/AlertDetail.java @@ -1,5 +1,6 @@ package club.joylink.xiannccda.alert; +import club.joylink.xiannccda.dto.protos.NccAlertInfoMessageProto.NccAlertInfoMessage.AlertType; import java.time.LocalDateTime; public interface AlertDetail { @@ -10,11 +11,11 @@ public interface AlertDetail { Integer getAlertTipId(); - String getInfo(); + Integer getLineId(); + + String getAlertObject(); + + String getLocatorDeviceId(); boolean isMock(); - -// String getDeviceInfo(); -// -// String getReason(); } diff --git a/src/main/java/club/joylink/xiannccda/alert/AlertDetailFactory.java b/src/main/java/club/joylink/xiannccda/alert/AlertDetailFactory.java index d1f3e20..9ae4b6c 100644 --- a/src/main/java/club/joylink/xiannccda/alert/AlertDetailFactory.java +++ b/src/main/java/club/joylink/xiannccda/alert/AlertDetailFactory.java @@ -1,13 +1,16 @@ package club.joylink.xiannccda.alert; import club.joylink.xiannccda.ats.cache.LineGraphicDataRepository; +import club.joylink.xiannccda.dto.protos.LayoutGraphicsProto.CommonInfo; import club.joylink.xiannccda.dto.protos.LayoutGraphicsProto.Platform; import club.joylink.xiannccda.dto.protos.LayoutGraphicsProto.Station; +import club.joylink.xiannccda.dto.protos.NccAlertInfoMessageProto.NccAlertInfoMessage.AlertType; 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.Descriptors.FieldDescriptor; import com.google.protobuf.MessageOrBuilder; import java.time.LocalDateTime; import org.springframework.stereotype.Component; @@ -21,11 +24,11 @@ public class AlertDetailFactory { this.alertTipRepository = alertTipRepository; } - public AlertDetail getAlertDetail(AlertType alertType, short lineId, boolean mock, + public AlertDetail getAlertDetail(AlertType alertType, int lineId, boolean mock, MessageOrBuilder messageOrBuilder) { LocalDateTime now = LocalDateTime.now(); Integer alertTipId; - String info; + String alertObject; switch (alertType) { case BLUE_DISPLAY -> { BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertTrue( @@ -38,13 +41,16 @@ public class AlertDetailFactory { .eq(AlertTip::getLocationType, rtu.getCode()); AlertTip alertTip = alertTipRepository.getOne(queryWrapper); alertTipId = alertTip == null ? null : alertTip.getId(); - String interlockName = getInterlockName(rtu); - info = String.format("[%s号线][%s]蓝显", lineId, interlockName); + alertObject = getInterlockName(rtu); } - case TRAIN_DELAY -> { - throw BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.exception("尚未实现"); + case TRAIN_DELAY_2, TRAIN_DELAY_10 -> { + LambdaQueryWrapper queryWrapper = Wrappers.lambdaQuery(AlertTip.class) + .eq(AlertTip::getAlertType, alertType); + AlertTip alertTip = alertTipRepository.getOne(queryWrapper); + alertTipId = alertTip == null ? null : alertTip.getId(); + alertObject = "列车001"; } - case PLATFORM_DOOR_WITHOUT_LOCKED_SIGNAL -> { + case PLATFORM_DOOR_WITHOUT_LOCKED_SIGNAL, PLATFORM_DOOR_CANNOT_CLOSE, PLATFORM_DOOR_CANNOT_OPEN -> { BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertTrue( messageOrBuilder instanceof Platform); Platform platform = (Platform) messageOrBuilder; @@ -52,37 +58,28 @@ public class AlertDetailFactory { .eq(AlertTip::getAlertType, alertType); AlertTip alertTip = alertTipRepository.getOne(queryWrapper); alertTipId = alertTip == null ? null : alertTip.getId(); - String platformDesc = getPlatformDesc(lineId, platform); - info = String.format("[%s号线]%s站台门无关闭且锁紧信号", lineId, platformDesc); - } - 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(); - String platformDesc = getPlatformDesc(lineId, platform); - info = String.format("[%s号线]%s站台门无法打开", lineId, platformDesc); - } - 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(); - String platformDesc = getPlatformDesc(lineId, platform); - info = String.format("[%s号线]%s站台门无法关闭", lineId, platformDesc); + alertObject = getPlatformDesc(lineId, platform); } default -> throw new IllegalStateException("Unexpected value: " + alertType); } - return new AlertDetailImpl(alertType, now, alertTipId, info, mock); + + String locatorDeviceId; + if (messageOrBuilder != null) { + locatorDeviceId = getId(messageOrBuilder); + } else { + locatorDeviceId = null; + } + + return new AlertDetailImpl(alertType, now, alertTipId, lineId, alertObject, locatorDeviceId, mock); } - private String getPlatformDesc(short lineId, Platform platform) { + private String getId(MessageOrBuilder messageOrBuilder) { + FieldDescriptor commonFD = messageOrBuilder.getDescriptorForType().findFieldByName("common"); + MessageOrBuilder common = (MessageOrBuilder) messageOrBuilder.getField(commonFD); + return (String) common.getField(CommonInfo.getDescriptor().findFieldByName("id")); + } + + private String getPlatformDesc(int lineId, Platform platform) { Station station = LineGraphicDataRepository.getDeviceByCode(lineId, platform.getRefStation(), Station.class); return String.format("[%s][%s行站台]", station.getName(), platform.getUp() ? "上" : "下"); diff --git a/src/main/java/club/joylink/xiannccda/alert/AlertDetailImpl.java b/src/main/java/club/joylink/xiannccda/alert/AlertDetailImpl.java index 1bd599a..88beff3 100644 --- a/src/main/java/club/joylink/xiannccda/alert/AlertDetailImpl.java +++ b/src/main/java/club/joylink/xiannccda/alert/AlertDetailImpl.java @@ -1,5 +1,6 @@ package club.joylink.xiannccda.alert; +import club.joylink.xiannccda.dto.protos.NccAlertInfoMessageProto.NccAlertInfoMessage.AlertType; import java.time.LocalDateTime; import lombok.AccessLevel; import lombok.AllArgsConstructor; @@ -15,10 +16,10 @@ public class AlertDetailImpl implements AlertDetail { private AlertType alertType; private LocalDateTime alertTime; private Integer alertTipId; - private String info; + private Integer lineId; + private String alertObject; + private String locatorDeviceId; private boolean mock; -// private String deviceInfo; -// private String reason; @Override public AlertType getAlertType() { @@ -30,11 +31,6 @@ public class AlertDetailImpl implements AlertDetail { return alertTime; } - @Override - public String getInfo() { - return info; - } - @Override public Integer getAlertTipId() { return alertTipId; @@ -44,16 +40,4 @@ public class AlertDetailImpl implements AlertDetail { 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/AlertType.java b/src/main/java/club/joylink/xiannccda/alert/AlertType.java deleted file mode 100644 index 66bb3ee..0000000 --- a/src/main/java/club/joylink/xiannccda/alert/AlertType.java +++ /dev/null @@ -1,18 +0,0 @@ -package club.joylink.xiannccda.alert; - -public enum AlertType { - /** - * 蓝显 - */ - BLUE_DISPLAY, - /** - * 列车延误 - */ - TRAIN_DELAY, - /** - * 站台门无关闭锁紧信号 - */ - PLATFORM_DOOR_WITHOUT_LOCKED_SIGNAL, - PLATFORM_DOOR_CANNOT_OPEN, - PLATFORM_DOOR_CANNOT_CLOSE, -} diff --git a/src/main/java/club/joylink/xiannccda/alert/BlueDisplayAlertMonitoringTask.java b/src/main/java/club/joylink/xiannccda/alert/BlueDisplayAlertMonitoringTask.java index 060e120..791c3e7 100644 --- a/src/main/java/club/joylink/xiannccda/alert/BlueDisplayAlertMonitoringTask.java +++ b/src/main/java/club/joylink/xiannccda/alert/BlueDisplayAlertMonitoringTask.java @@ -1,6 +1,7 @@ package club.joylink.xiannccda.alert; import club.joylink.xiannccda.alert.core.AlertMonitoringTask; +import club.joylink.xiannccda.dto.protos.NccAlertInfoMessageProto.NccAlertInfoMessage.AlertType; import club.joylink.xiannccda.entity.AlertTip; import club.joylink.xiannccda.repository.IAlertTipRepository; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; diff --git a/src/main/java/club/joylink/xiannccda/alert/NccAlertInfo.java b/src/main/java/club/joylink/xiannccda/alert/NccAlertInfo.java index 0c95935..3a968f7 100644 --- a/src/main/java/club/joylink/xiannccda/alert/NccAlertInfo.java +++ b/src/main/java/club/joylink/xiannccda/alert/NccAlertInfo.java @@ -3,12 +3,14 @@ package club.joylink.xiannccda.alert; import club.joylink.xiannccda.alert.core.AlertInfo; import java.time.LocalDateTime; import lombok.AllArgsConstructor; +import lombok.Getter; @AllArgsConstructor public class NccAlertInfo implements AlertInfo { private String id; private String level; private LocalDateTime alertTime; + @Getter private D detail; @Override @@ -28,22 +30,6 @@ public class NccAlertInfo implements AlertInfo { @Override public String getInfo() { - return detail == null ? "" : detail.getInfo(); + return ""; } - - public Integer getAlertTipId() { - return detail == null ? null : detail.getAlertTipId(); - } - - public boolean isMock() { - return detail == null || detail.isMock(); - } - -// 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/ats/cache/LineGraphicDataRepository.java b/src/main/java/club/joylink/xiannccda/ats/cache/LineGraphicDataRepository.java index a674aba..147a158 100644 --- a/src/main/java/club/joylink/xiannccda/ats/cache/LineGraphicDataRepository.java +++ b/src/main/java/club/joylink/xiannccda/ats/cache/LineGraphicDataRepository.java @@ -47,13 +47,13 @@ public class LineGraphicDataRepository { /** * 线路-设备code-设备 */ - private static final HashBasedTable line_code_table = + private static final HashBasedTable line_code_table = HashBasedTable.create(); /** * 线路-设备id-设备 */ - private static final HashBasedTable line_id_table = HashBasedTable.create(); + private static final HashBasedTable line_id_table = HashBasedTable.create(); /** * 缓存线路数据信息 @@ -121,28 +121,27 @@ public class LineGraphicDataRepository { lineGraphMap.remove(id); } - public static T getDeviceByCode(short lineId, String code, Class cls) { + public static T getDeviceByCode(int lineId, String code, Class cls) { MessageOrBuilder mob = line_code_table.get(lineId, code); BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(mob, String.format("线路[%s]code[%s]", lineId, code)); return (T) mob; } - public static T getDeviceById(short lineId, String id, Class cls) { + public static T getDeviceById(int lineId, String id, Class cls) { MessageOrBuilder mob = line_id_table.get(lineId, id); BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(mob, String.format("线路[%s]id[%s]", lineId, id)); return (T) mob; } - public static Stream getDevices(short lineId, Class cls) { + public static Stream getDevices(int lineId, Class cls) { 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(); FieldDescriptor idField = CommonInfo.getDescriptor().findFieldByName("id"); storage.getAllFields().forEach((fd, value) -> { if (fd.isRepeated()) { @@ -151,7 +150,7 @@ public class LineGraphicDataRepository { FieldDescriptor codeField = builder.getDescriptorForType().findFieldByName("code"); String code = (String) builder.getField(codeField); - line_code_table.put(shortLineId, code, builder); + line_code_table.put(lineId, code, builder); FieldDescriptor commonField = builder.getDescriptorForType().findFieldByName("common"); @@ -160,7 +159,7 @@ public class LineGraphicDataRepository { } MessageOrBuilder common = (MessageOrBuilder)builder.getField(commonField); String id = (String) common.getField(idField); - line_code_table.put(shortLineId, id, builder); + line_code_table.put(lineId, id, builder); } } }); diff --git a/src/main/java/club/joylink/xiannccda/dto/AlertMockDTO.java b/src/main/java/club/joylink/xiannccda/dto/AlertMockDTO.java index 070db6f..e8c061a 100644 --- a/src/main/java/club/joylink/xiannccda/dto/AlertMockDTO.java +++ b/src/main/java/club/joylink/xiannccda/dto/AlertMockDTO.java @@ -1,13 +1,13 @@ package club.joylink.xiannccda.dto; -import club.joylink.xiannccda.alert.AlertType; +import club.joylink.xiannccda.dto.protos.NccAlertInfoMessageProto.NccAlertInfoMessage.AlertType; import jakarta.validation.constraints.NotNull; import lombok.Data; @Data public class AlertMockDTO { @NotNull(message = "线路id不能为null") - private Short lineId; + private Integer lineId; @NotNull(message = "故障类型不能为null") private AlertType alertType; } diff --git a/src/main/java/club/joylink/xiannccda/dto/alertTip/AlertTipQueryDTO.java b/src/main/java/club/joylink/xiannccda/dto/alertTip/AlertTipQueryDTO.java index 47e787f..7dc1277 100644 --- a/src/main/java/club/joylink/xiannccda/dto/alertTip/AlertTipQueryDTO.java +++ b/src/main/java/club/joylink/xiannccda/dto/alertTip/AlertTipQueryDTO.java @@ -2,7 +2,7 @@ package club.joylink.xiannccda.dto.alertTip; import club.joylink.xiannccda.alert.AlertTipLocationType; import club.joylink.xiannccda.alert.AlertTipTimeType; -import club.joylink.xiannccda.alert.AlertType; +import club.joylink.xiannccda.dto.protos.NccAlertInfoMessageProto.NccAlertInfoMessage.AlertType; import club.joylink.xiannccda.entity.AlertTip; import com.baomidou.mybatisplus.extension.plugins.pagination.PageDTO; import lombok.Getter; diff --git a/src/main/java/club/joylink/xiannccda/dto/alertTip/AlertTipSaveDTO.java b/src/main/java/club/joylink/xiannccda/dto/alertTip/AlertTipSaveDTO.java index 63dc02a..b3c6031 100644 --- a/src/main/java/club/joylink/xiannccda/dto/alertTip/AlertTipSaveDTO.java +++ b/src/main/java/club/joylink/xiannccda/dto/alertTip/AlertTipSaveDTO.java @@ -2,7 +2,7 @@ package club.joylink.xiannccda.dto.alertTip; import club.joylink.xiannccda.alert.AlertTipLocationType; import club.joylink.xiannccda.alert.AlertTipTimeType; -import club.joylink.xiannccda.alert.AlertType; +import club.joylink.xiannccda.dto.protos.NccAlertInfoMessageProto.NccAlertInfoMessage.AlertType; import jakarta.validation.constraints.NotNull; import lombok.Data; 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 ca96dd5..9fcaa10 100644 --- a/src/main/java/club/joylink/xiannccda/dto/protos/NccAlertInfoMessageProto.java +++ b/src/main/java/club/joylink/xiannccda/dto/protos/NccAlertInfoMessageProto.java @@ -78,6 +78,207 @@ public final class NccAlertInfoMessageProto { club.joylink.xiannccda.dto.protos.NccAlertInfoMessageProto.NccAlertInfoMessage.class, club.joylink.xiannccda.dto.protos.NccAlertInfoMessageProto.NccAlertInfoMessage.Builder.class); } + /** + * Protobuf enum {@code alert.NccAlertInfoMessage.AlertType} + */ + public enum AlertType + implements com.google.protobuf.ProtocolMessageEnum { + /** + * UNKNOWN = 0; + */ + UNKNOWN(0), + /** + *
+       *蓝显
+       * 
+ * + * BLUE_DISPLAY = 1; + */ + BLUE_DISPLAY(1), + /** + *
+       *列车延误2分钟
+       * 
+ * + * TRAIN_DELAY_2 = 2; + */ + TRAIN_DELAY_2(2), + /** + *
+       *列车延误10分钟
+       * 
+ * + * TRAIN_DELAY_10 = 3; + */ + TRAIN_DELAY_10(3), + /** + *
+       *整侧站台门无关闭锁紧信号
+       * 
+ * + * PLATFORM_DOOR_WITHOUT_LOCKED_SIGNAL = 4; + */ + PLATFORM_DOOR_WITHOUT_LOCKED_SIGNAL(4), + /** + *
+       *整侧站台门无法打开
+       * 
+ * + * PLATFORM_DOOR_CANNOT_OPEN = 5; + */ + PLATFORM_DOOR_CANNOT_OPEN(5), + /** + *
+       *整侧站台门无法关闭
+       * 
+ * + * PLATFORM_DOOR_CANNOT_CLOSE = 6; + */ + PLATFORM_DOOR_CANNOT_CLOSE(6), + UNRECOGNIZED(-1), + ; + + /** + * UNKNOWN = 0; + */ + public static final int UNKNOWN_VALUE = 0; + /** + *
+       *蓝显
+       * 
+ * + * BLUE_DISPLAY = 1; + */ + public static final int BLUE_DISPLAY_VALUE = 1; + /** + *
+       *列车延误2分钟
+       * 
+ * + * TRAIN_DELAY_2 = 2; + */ + public static final int TRAIN_DELAY_2_VALUE = 2; + /** + *
+       *列车延误10分钟
+       * 
+ * + * TRAIN_DELAY_10 = 3; + */ + public static final int TRAIN_DELAY_10_VALUE = 3; + /** + *
+       *整侧站台门无关闭锁紧信号
+       * 
+ * + * PLATFORM_DOOR_WITHOUT_LOCKED_SIGNAL = 4; + */ + public static final int PLATFORM_DOOR_WITHOUT_LOCKED_SIGNAL_VALUE = 4; + /** + *
+       *整侧站台门无法打开
+       * 
+ * + * PLATFORM_DOOR_CANNOT_OPEN = 5; + */ + public static final int PLATFORM_DOOR_CANNOT_OPEN_VALUE = 5; + /** + *
+       *整侧站台门无法关闭
+       * 
+ * + * PLATFORM_DOOR_CANNOT_CLOSE = 6; + */ + public static final int PLATFORM_DOOR_CANNOT_CLOSE_VALUE = 6; + + + public final int getNumber() { + if (this == UNRECOGNIZED) { + throw new java.lang.IllegalArgumentException( + "Can't get the number of an unknown enum value."); + } + return value; + } + + /** + * @param value The numeric wire value of the corresponding enum entry. + * @return The enum associated with the given numeric wire value. + * @deprecated Use {@link #forNumber(int)} instead. + */ + @java.lang.Deprecated + public static AlertType valueOf(int value) { + return forNumber(value); + } + + /** + * @param value The numeric wire value of the corresponding enum entry. + * @return The enum associated with the given numeric wire value. + */ + public static AlertType forNumber(int value) { + switch (value) { + case 0: return UNKNOWN; + case 1: return BLUE_DISPLAY; + case 2: return TRAIN_DELAY_2; + case 3: return TRAIN_DELAY_10; + case 4: return PLATFORM_DOOR_WITHOUT_LOCKED_SIGNAL; + case 5: return PLATFORM_DOOR_CANNOT_OPEN; + case 6: return PLATFORM_DOOR_CANNOT_CLOSE; + default: return null; + } + } + + public static com.google.protobuf.Internal.EnumLiteMap + internalGetValueMap() { + return internalValueMap; + } + private static final com.google.protobuf.Internal.EnumLiteMap< + AlertType> internalValueMap = + new com.google.protobuf.Internal.EnumLiteMap() { + public AlertType findValueByNumber(int number) { + return AlertType.forNumber(number); + } + }; + + public final com.google.protobuf.Descriptors.EnumValueDescriptor + getValueDescriptor() { + if (this == UNRECOGNIZED) { + throw new java.lang.IllegalStateException( + "Can't get the descriptor of an unrecognized enum value."); + } + return getDescriptor().getValues().get(ordinal()); + } + public final com.google.protobuf.Descriptors.EnumDescriptor + getDescriptorForType() { + return getDescriptor(); + } + public static final com.google.protobuf.Descriptors.EnumDescriptor + getDescriptor() { + return club.joylink.xiannccda.dto.protos.NccAlertInfoMessageProto.NccAlertInfoMessage.getDescriptor().getEnumTypes().get(0); + } + + private static final AlertType[] VALUES = values(); + + public static AlertType valueOf( + com.google.protobuf.Descriptors.EnumValueDescriptor desc) { + if (desc.getType() != getDescriptor()) { + throw new java.lang.IllegalArgumentException( + "EnumValueDescriptor is not for this type."); + } + if (desc.getIndex() == -1) { + return UNRECOGNIZED; + } + return VALUES[desc.getIndex()]; + } + + private final int value; + + private AlertType(int value) { + this.value = value; + } + + // @@protoc_insertion_point(enum_scope:alert.NccAlertInfoMessage.AlertType) + } + public interface MessageOrBuilder extends // @@protoc_insertion_point(interface_extends:alert.NccAlertInfoMessage.Message) com.google.protobuf.MessageOrBuilder { @@ -119,25 +320,54 @@ public final class NccAlertInfoMessageProto { getAlertTimeBytes(); /** - * string info = 4; - * @return The info. - */ - java.lang.String getInfo(); - /** - * string info = 4; - * @return The bytes for info. - */ - com.google.protobuf.ByteString - getInfoBytes(); - - /** - * int32 alert_tip_id = 5; + * int32 alert_tip_id = 4; * @return The alertTipId. */ int getAlertTipId(); /** - * bool mock = 6; + * int32 line_id = 5; + * @return The lineId. + */ + int getLineId(); + + /** + * string alert_object = 6; + * @return The alertObject. + */ + java.lang.String getAlertObject(); + /** + * string alert_object = 6; + * @return The bytes for alertObject. + */ + com.google.protobuf.ByteString + getAlertObjectBytes(); + + /** + * .alert.NccAlertInfoMessage.AlertType alert_type = 7; + * @return The enum numeric value on the wire for alertType. + */ + int getAlertTypeValue(); + /** + * .alert.NccAlertInfoMessage.AlertType alert_type = 7; + * @return The alertType. + */ + club.joylink.xiannccda.dto.protos.NccAlertInfoMessageProto.NccAlertInfoMessage.AlertType getAlertType(); + + /** + * string locator_device_id = 8; + * @return The locatorDeviceId. + */ + java.lang.String getLocatorDeviceId(); + /** + * string locator_device_id = 8; + * @return The bytes for locatorDeviceId. + */ + com.google.protobuf.ByteString + getLocatorDeviceIdBytes(); + + /** + * bool mock = 9; * @return The mock. */ boolean getMock(); @@ -158,7 +388,9 @@ public final class NccAlertInfoMessageProto { id_ = ""; level_ = ""; alertTime_ = ""; - info_ = ""; + alertObject_ = ""; + alertType_ = 0; + locatorDeviceId_ = ""; } @java.lang.Override @@ -298,49 +530,10 @@ public final class NccAlertInfoMessageProto { } } - public static final int INFO_FIELD_NUMBER = 4; - @SuppressWarnings("serial") - private volatile java.lang.Object info_ = ""; - /** - * string info = 4; - * @return The info. - */ - @java.lang.Override - public java.lang.String getInfo() { - java.lang.Object ref = info_; - 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(); - info_ = s; - return s; - } - } - /** - * string info = 4; - * @return The bytes for info. - */ - @java.lang.Override - public com.google.protobuf.ByteString - getInfoBytes() { - java.lang.Object ref = info_; - if (ref instanceof java.lang.String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8( - (java.lang.String) ref); - info_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - public static final int ALERT_TIP_ID_FIELD_NUMBER = 5; + public static final int ALERT_TIP_ID_FIELD_NUMBER = 4; private int alertTipId_ = 0; /** - * int32 alert_tip_id = 5; + * int32 alert_tip_id = 4; * @return The alertTipId. */ @java.lang.Override @@ -348,10 +541,117 @@ public final class NccAlertInfoMessageProto { return alertTipId_; } - public static final int MOCK_FIELD_NUMBER = 6; + public static final int LINE_ID_FIELD_NUMBER = 5; + private int lineId_ = 0; + /** + * int32 line_id = 5; + * @return The lineId. + */ + @java.lang.Override + public int getLineId() { + return lineId_; + } + + public static final int ALERT_OBJECT_FIELD_NUMBER = 6; + @SuppressWarnings("serial") + private volatile java.lang.Object alertObject_ = ""; + /** + * string alert_object = 6; + * @return The alertObject. + */ + @java.lang.Override + public java.lang.String getAlertObject() { + java.lang.Object ref = alertObject_; + 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(); + alertObject_ = s; + return s; + } + } + /** + * string alert_object = 6; + * @return The bytes for alertObject. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getAlertObjectBytes() { + java.lang.Object ref = alertObject_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + alertObject_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int ALERT_TYPE_FIELD_NUMBER = 7; + private int alertType_ = 0; + /** + * .alert.NccAlertInfoMessage.AlertType alert_type = 7; + * @return The enum numeric value on the wire for alertType. + */ + @java.lang.Override public int getAlertTypeValue() { + return alertType_; + } + /** + * .alert.NccAlertInfoMessage.AlertType alert_type = 7; + * @return The alertType. + */ + @java.lang.Override public club.joylink.xiannccda.dto.protos.NccAlertInfoMessageProto.NccAlertInfoMessage.AlertType getAlertType() { + club.joylink.xiannccda.dto.protos.NccAlertInfoMessageProto.NccAlertInfoMessage.AlertType result = club.joylink.xiannccda.dto.protos.NccAlertInfoMessageProto.NccAlertInfoMessage.AlertType.forNumber(alertType_); + return result == null ? club.joylink.xiannccda.dto.protos.NccAlertInfoMessageProto.NccAlertInfoMessage.AlertType.UNRECOGNIZED : result; + } + + public static final int LOCATOR_DEVICE_ID_FIELD_NUMBER = 8; + @SuppressWarnings("serial") + private volatile java.lang.Object locatorDeviceId_ = ""; + /** + * string locator_device_id = 8; + * @return The locatorDeviceId. + */ + @java.lang.Override + public java.lang.String getLocatorDeviceId() { + java.lang.Object ref = locatorDeviceId_; + 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(); + locatorDeviceId_ = s; + return s; + } + } + /** + * string locator_device_id = 8; + * @return The bytes for locatorDeviceId. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getLocatorDeviceIdBytes() { + java.lang.Object ref = locatorDeviceId_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + locatorDeviceId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int MOCK_FIELD_NUMBER = 9; private boolean mock_ = false; /** - * bool mock = 6; + * bool mock = 9; * @return The mock. */ @java.lang.Override @@ -382,14 +682,23 @@ public final class NccAlertInfoMessageProto { if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(alertTime_)) { com.google.protobuf.GeneratedMessageV3.writeString(output, 3, alertTime_); } - if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(info_)) { - com.google.protobuf.GeneratedMessageV3.writeString(output, 4, info_); - } if (alertTipId_ != 0) { - output.writeInt32(5, alertTipId_); + output.writeInt32(4, alertTipId_); + } + if (lineId_ != 0) { + output.writeInt32(5, lineId_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(alertObject_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 6, alertObject_); + } + if (alertType_ != club.joylink.xiannccda.dto.protos.NccAlertInfoMessageProto.NccAlertInfoMessage.AlertType.UNKNOWN.getNumber()) { + output.writeEnum(7, alertType_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(locatorDeviceId_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 8, locatorDeviceId_); } if (mock_ != false) { - output.writeBool(6, mock_); + output.writeBool(9, mock_); } getUnknownFields().writeTo(output); } @@ -409,16 +718,27 @@ public final class NccAlertInfoMessageProto { if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(alertTime_)) { size += com.google.protobuf.GeneratedMessageV3.computeStringSize(3, alertTime_); } - if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(info_)) { - size += com.google.protobuf.GeneratedMessageV3.computeStringSize(4, info_); - } if (alertTipId_ != 0) { size += com.google.protobuf.CodedOutputStream - .computeInt32Size(5, alertTipId_); + .computeInt32Size(4, alertTipId_); + } + if (lineId_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(5, lineId_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(alertObject_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(6, alertObject_); + } + if (alertType_ != club.joylink.xiannccda.dto.protos.NccAlertInfoMessageProto.NccAlertInfoMessage.AlertType.UNKNOWN.getNumber()) { + size += com.google.protobuf.CodedOutputStream + .computeEnumSize(7, alertType_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(locatorDeviceId_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(8, locatorDeviceId_); } if (mock_ != false) { size += com.google.protobuf.CodedOutputStream - .computeBoolSize(6, mock_); + .computeBoolSize(9, mock_); } size += getUnknownFields().getSerializedSize(); memoizedSize = size; @@ -441,10 +761,15 @@ public final class NccAlertInfoMessageProto { .equals(other.getLevel())) return false; if (!getAlertTime() .equals(other.getAlertTime())) return false; - if (!getInfo() - .equals(other.getInfo())) return false; if (getAlertTipId() != other.getAlertTipId()) return false; + if (getLineId() + != other.getLineId()) return false; + if (!getAlertObject() + .equals(other.getAlertObject())) return false; + if (alertType_ != other.alertType_) return false; + if (!getLocatorDeviceId() + .equals(other.getLocatorDeviceId())) return false; if (getMock() != other.getMock()) return false; if (!getUnknownFields().equals(other.getUnknownFields())) return false; @@ -464,10 +789,16 @@ public final class NccAlertInfoMessageProto { hash = (53 * hash) + getLevel().hashCode(); hash = (37 * hash) + ALERT_TIME_FIELD_NUMBER; hash = (53 * hash) + getAlertTime().hashCode(); - hash = (37 * hash) + INFO_FIELD_NUMBER; - hash = (53 * hash) + getInfo().hashCode(); hash = (37 * hash) + ALERT_TIP_ID_FIELD_NUMBER; hash = (53 * hash) + getAlertTipId(); + hash = (37 * hash) + LINE_ID_FIELD_NUMBER; + hash = (53 * hash) + getLineId(); + hash = (37 * hash) + ALERT_OBJECT_FIELD_NUMBER; + hash = (53 * hash) + getAlertObject().hashCode(); + hash = (37 * hash) + ALERT_TYPE_FIELD_NUMBER; + hash = (53 * hash) + alertType_; + hash = (37 * hash) + LOCATOR_DEVICE_ID_FIELD_NUMBER; + hash = (53 * hash) + getLocatorDeviceId().hashCode(); hash = (37 * hash) + MOCK_FIELD_NUMBER; hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean( getMock()); @@ -605,8 +936,11 @@ public final class NccAlertInfoMessageProto { id_ = ""; level_ = ""; alertTime_ = ""; - info_ = ""; alertTipId_ = 0; + lineId_ = 0; + alertObject_ = ""; + alertType_ = 0; + locatorDeviceId_ = ""; mock_ = false; return this; } @@ -651,12 +985,21 @@ public final class NccAlertInfoMessageProto { result.alertTime_ = alertTime_; } if (((from_bitField0_ & 0x00000008) != 0)) { - result.info_ = info_; - } - if (((from_bitField0_ & 0x00000010) != 0)) { result.alertTipId_ = alertTipId_; } + if (((from_bitField0_ & 0x00000010) != 0)) { + result.lineId_ = lineId_; + } if (((from_bitField0_ & 0x00000020) != 0)) { + result.alertObject_ = alertObject_; + } + if (((from_bitField0_ & 0x00000040) != 0)) { + result.alertType_ = alertType_; + } + if (((from_bitField0_ & 0x00000080) != 0)) { + result.locatorDeviceId_ = locatorDeviceId_; + } + if (((from_bitField0_ & 0x00000100) != 0)) { result.mock_ = mock_; } } @@ -688,14 +1031,25 @@ public final class NccAlertInfoMessageProto { bitField0_ |= 0x00000004; onChanged(); } - if (!other.getInfo().isEmpty()) { - info_ = other.info_; - bitField0_ |= 0x00000008; - onChanged(); - } if (other.getAlertTipId() != 0) { setAlertTipId(other.getAlertTipId()); } + if (other.getLineId() != 0) { + setLineId(other.getLineId()); + } + if (!other.getAlertObject().isEmpty()) { + alertObject_ = other.alertObject_; + bitField0_ |= 0x00000020; + onChanged(); + } + if (other.alertType_ != 0) { + setAlertTypeValue(other.getAlertTypeValue()); + } + if (!other.getLocatorDeviceId().isEmpty()) { + locatorDeviceId_ = other.locatorDeviceId_; + bitField0_ |= 0x00000080; + onChanged(); + } if (other.getMock() != false) { setMock(other.getMock()); } @@ -740,21 +1094,36 @@ public final class NccAlertInfoMessageProto { bitField0_ |= 0x00000004; break; } // case 26 - case 34: { - info_ = input.readStringRequireUtf8(); + case 32: { + alertTipId_ = input.readInt32(); bitField0_ |= 0x00000008; break; - } // case 34 + } // case 32 case 40: { - alertTipId_ = input.readInt32(); + lineId_ = input.readInt32(); bitField0_ |= 0x00000010; break; } // case 40 - case 48: { - mock_ = input.readBool(); + case 50: { + alertObject_ = input.readStringRequireUtf8(); bitField0_ |= 0x00000020; break; - } // case 48 + } // case 50 + case 56: { + alertType_ = input.readEnum(); + bitField0_ |= 0x00000040; + break; + } // case 56 + case 66: { + locatorDeviceId_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000080; + break; + } // case 66 + case 72: { + mock_ = input.readBool(); + bitField0_ |= 0x00000100; + break; + } // case 72 default: { if (!super.parseUnknownField(input, extensionRegistry, tag)) { done = true; // was an endgroup tag @@ -988,81 +1357,9 @@ public final class NccAlertInfoMessageProto { return this; } - private java.lang.Object info_ = ""; - /** - * string info = 4; - * @return The info. - */ - public java.lang.String getInfo() { - java.lang.Object ref = info_; - if (!(ref instanceof java.lang.String)) { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - info_ = s; - return s; - } else { - return (java.lang.String) ref; - } - } - /** - * string info = 4; - * @return The bytes for info. - */ - public com.google.protobuf.ByteString - getInfoBytes() { - java.lang.Object ref = info_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8( - (java.lang.String) ref); - info_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - /** - * string info = 4; - * @param value The info to set. - * @return This builder for chaining. - */ - public Builder setInfo( - java.lang.String value) { - if (value == null) { throw new NullPointerException(); } - info_ = value; - bitField0_ |= 0x00000008; - onChanged(); - return this; - } - /** - * string info = 4; - * @return This builder for chaining. - */ - public Builder clearInfo() { - info_ = getDefaultInstance().getInfo(); - bitField0_ = (bitField0_ & ~0x00000008); - onChanged(); - return this; - } - /** - * string info = 4; - * @param value The bytes for info to set. - * @return This builder for chaining. - */ - public Builder setInfoBytes( - com.google.protobuf.ByteString value) { - if (value == null) { throw new NullPointerException(); } - checkByteStringIsUtf8(value); - info_ = value; - bitField0_ |= 0x00000008; - onChanged(); - return this; - } - private int alertTipId_ ; /** - * int32 alert_tip_id = 5; + * int32 alert_tip_id = 4; * @return The alertTipId. */ @java.lang.Override @@ -1070,31 +1367,260 @@ public final class NccAlertInfoMessageProto { return alertTipId_; } /** - * int32 alert_tip_id = 5; + * int32 alert_tip_id = 4; * @param value The alertTipId to set. * @return This builder for chaining. */ public Builder setAlertTipId(int value) { alertTipId_ = value; + bitField0_ |= 0x00000008; + onChanged(); + return this; + } + /** + * int32 alert_tip_id = 4; + * @return This builder for chaining. + */ + public Builder clearAlertTipId() { + bitField0_ = (bitField0_ & ~0x00000008); + alertTipId_ = 0; + onChanged(); + return this; + } + + private int lineId_ ; + /** + * int32 line_id = 5; + * @return The lineId. + */ + @java.lang.Override + public int getLineId() { + return lineId_; + } + /** + * int32 line_id = 5; + * @param value The lineId to set. + * @return This builder for chaining. + */ + public Builder setLineId(int value) { + + lineId_ = value; bitField0_ |= 0x00000010; onChanged(); return this; } /** - * int32 alert_tip_id = 5; + * int32 line_id = 5; * @return This builder for chaining. */ - public Builder clearAlertTipId() { + public Builder clearLineId() { bitField0_ = (bitField0_ & ~0x00000010); - alertTipId_ = 0; + lineId_ = 0; + onChanged(); + return this; + } + + private java.lang.Object alertObject_ = ""; + /** + * string alert_object = 6; + * @return The alertObject. + */ + public java.lang.String getAlertObject() { + java.lang.Object ref = alertObject_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + alertObject_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * string alert_object = 6; + * @return The bytes for alertObject. + */ + public com.google.protobuf.ByteString + getAlertObjectBytes() { + java.lang.Object ref = alertObject_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + alertObject_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * string alert_object = 6; + * @param value The alertObject to set. + * @return This builder for chaining. + */ + public Builder setAlertObject( + java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + alertObject_ = value; + bitField0_ |= 0x00000020; + onChanged(); + return this; + } + /** + * string alert_object = 6; + * @return This builder for chaining. + */ + public Builder clearAlertObject() { + alertObject_ = getDefaultInstance().getAlertObject(); + bitField0_ = (bitField0_ & ~0x00000020); + onChanged(); + return this; + } + /** + * string alert_object = 6; + * @param value The bytes for alertObject to set. + * @return This builder for chaining. + */ + public Builder setAlertObjectBytes( + com.google.protobuf.ByteString value) { + if (value == null) { throw new NullPointerException(); } + checkByteStringIsUtf8(value); + alertObject_ = value; + bitField0_ |= 0x00000020; + onChanged(); + return this; + } + + private int alertType_ = 0; + /** + * .alert.NccAlertInfoMessage.AlertType alert_type = 7; + * @return The enum numeric value on the wire for alertType. + */ + @java.lang.Override public int getAlertTypeValue() { + return alertType_; + } + /** + * .alert.NccAlertInfoMessage.AlertType alert_type = 7; + * @param value The enum numeric value on the wire for alertType to set. + * @return This builder for chaining. + */ + public Builder setAlertTypeValue(int value) { + alertType_ = value; + bitField0_ |= 0x00000040; + onChanged(); + return this; + } + /** + * .alert.NccAlertInfoMessage.AlertType alert_type = 7; + * @return The alertType. + */ + @java.lang.Override + public club.joylink.xiannccda.dto.protos.NccAlertInfoMessageProto.NccAlertInfoMessage.AlertType getAlertType() { + club.joylink.xiannccda.dto.protos.NccAlertInfoMessageProto.NccAlertInfoMessage.AlertType result = club.joylink.xiannccda.dto.protos.NccAlertInfoMessageProto.NccAlertInfoMessage.AlertType.forNumber(alertType_); + return result == null ? club.joylink.xiannccda.dto.protos.NccAlertInfoMessageProto.NccAlertInfoMessage.AlertType.UNRECOGNIZED : result; + } + /** + * .alert.NccAlertInfoMessage.AlertType alert_type = 7; + * @param value The alertType to set. + * @return This builder for chaining. + */ + public Builder setAlertType(club.joylink.xiannccda.dto.protos.NccAlertInfoMessageProto.NccAlertInfoMessage.AlertType value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000040; + alertType_ = value.getNumber(); + onChanged(); + return this; + } + /** + * .alert.NccAlertInfoMessage.AlertType alert_type = 7; + * @return This builder for chaining. + */ + public Builder clearAlertType() { + bitField0_ = (bitField0_ & ~0x00000040); + alertType_ = 0; + onChanged(); + return this; + } + + private java.lang.Object locatorDeviceId_ = ""; + /** + * string locator_device_id = 8; + * @return The locatorDeviceId. + */ + public java.lang.String getLocatorDeviceId() { + java.lang.Object ref = locatorDeviceId_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + locatorDeviceId_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * string locator_device_id = 8; + * @return The bytes for locatorDeviceId. + */ + public com.google.protobuf.ByteString + getLocatorDeviceIdBytes() { + java.lang.Object ref = locatorDeviceId_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + locatorDeviceId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * string locator_device_id = 8; + * @param value The locatorDeviceId to set. + * @return This builder for chaining. + */ + public Builder setLocatorDeviceId( + java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + locatorDeviceId_ = value; + bitField0_ |= 0x00000080; + onChanged(); + return this; + } + /** + * string locator_device_id = 8; + * @return This builder for chaining. + */ + public Builder clearLocatorDeviceId() { + locatorDeviceId_ = getDefaultInstance().getLocatorDeviceId(); + bitField0_ = (bitField0_ & ~0x00000080); + onChanged(); + return this; + } + /** + * string locator_device_id = 8; + * @param value The bytes for locatorDeviceId to set. + * @return This builder for chaining. + */ + public Builder setLocatorDeviceIdBytes( + com.google.protobuf.ByteString value) { + if (value == null) { throw new NullPointerException(); } + checkByteStringIsUtf8(value); + locatorDeviceId_ = value; + bitField0_ |= 0x00000080; onChanged(); return this; } private boolean mock_ ; /** - * bool mock = 6; + * bool mock = 9; * @return The mock. */ @java.lang.Override @@ -1102,23 +1628,23 @@ public final class NccAlertInfoMessageProto { return mock_; } /** - * bool mock = 6; + * bool mock = 9; * @param value The mock to set. * @return This builder for chaining. */ public Builder setMock(boolean value) { mock_ = value; - bitField0_ |= 0x00000020; + bitField0_ |= 0x00000100; onChanged(); return this; } /** - * bool mock = 6; + * bool mock = 9; * @return This builder for chaining. */ public Builder clearMock() { - bitField0_ = (bitField0_ & ~0x00000020); + bitField0_ = (bitField0_ & ~0x00000100); mock_ = false; onChanged(); return this; @@ -1892,14 +2418,21 @@ public final class NccAlertInfoMessageProto { descriptor; static { java.lang.String[] descriptorData = { - "\n\017alertInfo.proto\022\005alert\"\267\001\n\023NccAlertInf" + + "\n\017alertInfo.proto\022\005alert\"\342\003\n\023NccAlertInf" + "oMessage\0224\n\010messages\030\001 \003(\0132\".alert.NccAl" + - "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" + "ertInfoMessage.Message\032\330\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\024\n\014alert_tip_id\030\004 \001(\005\022\017\n\007line_id\030\005 \001(\005" + + "\022\024\n\014alert_object\030\006 \001(\t\0228\n\nalert_type\030\007 \001" + + "(\0162$.alert.NccAlertInfoMessage.AlertType" + + "\022\031\n\021locator_device_id\030\010 \001(\t\022\014\n\004mock\030\t \001(" + + "\010\"\271\001\n\tAlertType\022\013\n\007UNKNOWN\020\000\022\020\n\014BLUE_DIS" + + "PLAY\020\001\022\021\n\rTRAIN_DELAY_2\020\002\022\022\n\016TRAIN_DELAY" + + "_10\020\003\022\'\n#PLATFORM_DOOR_WITHOUT_LOCKED_SI" + + "GNAL\020\004\022\035\n\031PLATFORM_DOOR_CANNOT_OPEN\020\005\022\036\n" + + "\032PLATFORM_DOOR_CANNOT_CLOSE\020\006B=\n!club.jo" + + "ylink.xiannccda.dto.protosB\030NccAlertInfo" + + "MessageProtob\006proto3" }; descriptor = com.google.protobuf.Descriptors.FileDescriptor .internalBuildGeneratedFileFrom(descriptorData, @@ -1916,7 +2449,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", "Mock", }); + new java.lang.String[] { "Id", "Level", "AlertTime", "AlertTipId", "LineId", "AlertObject", "AlertType", "LocatorDeviceId", "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 index fe070fc..fb2feb9 100644 --- a/src/main/java/club/joylink/xiannccda/service/AlertMockService.java +++ b/src/main/java/club/joylink/xiannccda/service/AlertMockService.java @@ -2,12 +2,12 @@ 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.dto.protos.NccAlertInfoMessageProto.NccAlertInfoMessage.AlertType; import club.joylink.xiannccda.exception.BusinessExceptionAssertEnum; import club.joylink.xiannccda.ws.NccAlertMessageServer; import com.google.protobuf.MessageOrBuilder; @@ -22,14 +22,14 @@ public class AlertMockService { private AlertDetailFactory alertDetailFactory; public void setAlert(AlertMockDTO alertMockDTO) { - short lineId = alertMockDTO.getLineId(); + int 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) { + private AlertDetail buildAlertDetail(AlertType alertType, int lineId) { MessageOrBuilder messageOrBuilder; switch (alertType) { case BLUE_DISPLAY -> { @@ -39,8 +39,8 @@ public class AlertMockService { .findFirst() .orElseThrow(BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL::exception); } - case TRAIN_DELAY -> { - throw BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.exception("尚未实现"); + case TRAIN_DELAY_2, TRAIN_DELAY_10 -> { + messageOrBuilder = null; } case PLATFORM_DOOR_WITHOUT_LOCKED_SIGNAL, PLATFORM_DOOR_CANNOT_OPEN, PLATFORM_DOOR_CANNOT_CLOSE -> { Stream stream = LineGraphicDataRepository.getDevices(lineId, Platform.class); diff --git a/src/main/java/club/joylink/xiannccda/ws/NccAlertMessageServer.java b/src/main/java/club/joylink/xiannccda/ws/NccAlertMessageServer.java index 700b2b0..238a0b1 100644 --- a/src/main/java/club/joylink/xiannccda/ws/NccAlertMessageServer.java +++ b/src/main/java/club/joylink/xiannccda/ws/NccAlertMessageServer.java @@ -99,14 +99,18 @@ public class NccAlertMessageServer implements IMessageServer { .setId(alertInfo.getId()) .setLevel(alertInfo.getLevel()) .setAlertTime(alertInfo.getAlertTime().toString()) - .setInfo(alertInfo.getInfo()) - .setMock(alertInfo.isMock()); -// .setDeviceInfo(alertInfo.getDeviceInfo()) -// .setReason(alertInfo.getReason()); - Integer alertTipId = alertInfo.getAlertTipId(); + .setLineId(alertInfo.getDetail().getLineId()) + .setAlertObject(alertInfo.getDetail().getAlertObject()) + .setAlertType(alertInfo.getDetail().getAlertType()) + .setMock(alertInfo.getDetail().isMock()); + Integer alertTipId = alertInfo.getDetail().getAlertTipId(); if (alertTipId != null) { builder.setAlertTipId(alertTipId); } + String locatorDeviceId = alertInfo.getDetail().getLocatorDeviceId(); + if (locatorDeviceId != null) { + builder.setLocatorDeviceId(locatorDeviceId); + } return builder.build(); } } diff --git a/src/test/java/club/joylink/xiannccda/WebSocketTest.java b/src/test/java/club/joylink/xiannccda/WebSocketTest.java index 5ea7271..ce97c14 100644 --- a/src/test/java/club/joylink/xiannccda/WebSocketTest.java +++ b/src/test/java/club/joylink/xiannccda/WebSocketTest.java @@ -28,13 +28,13 @@ public class WebSocketTest { String webSocketUrl = "ws://localhost:9081/ws-default"; CountDownLatch latch = new CountDownLatch(1); + String auth = "Bearer eyJhbGciOiJSUzI1NiJ9.eyJpc3MiOiJzZWxmIiwic3ViIjoiMTQiLCJleHAiOjE2OTA0NDUyMjksImlhdCI6MTY5MDE4NjAyOX0.K9WEtP9moxydscOV6O8iTXEM6pDI-qhPOWKSGN9pmvfo3qN6mabWDd6IWqdhnMijnQLVXJ-v9O76UgvdwbYJ_9SMMVKSUuJNTRBrSrAXyug63jFaPQb0GNjPXrMO7SnYYD5539peHmiRZdEakYD5s2mmM4SLg32qhJysDKN5badsYys_WhxHQskWtZpWiRziZw8tz-cTwIRRp4wX6ing9CxtPiTQVCIShh3rlFh5-0V4NqzNfvjNO0CCnfF-adAXKudkHIv9AvkEDBM6Zbr-BR57FAxAHzsi9SK1ThBVBCZ6adkJnQ9FQDCsKAlpvMfAG8sgtIUX2THznUbGdp59dQ"; + WebSocketHttpHeaders headers = new WebSocketHttpHeaders(); - headers.set("Authorization", - "Bearer eyJhbGciOiJSUzI1NiJ9.eyJpc3MiOiJzZWxmIiwic3ViIjoiMTQiLCJleHAiOjE2OTAxMDc0NzAsImlhdCI6MTY4OTg0ODI3MH0.WXwKt6M12AMW-9Fhsop-nGtwxQR4jw7t-EIN2RUKLfRSaMlMgTgHPr_p47GXmQszJndPthUN3IkLBRMfVyEK3y4e9Uq5B2gD2DBgXuFgdM85PlJF8NHThDGyH-eoc7ZbPD1geCSFTiDbzuWuY4b1AcFnP2p4VdoU9s28FHoJzQRKL2cot-ZwexEVhFzVXJkXgF2oKpbdMamVHkTRuGRzmrYFzur2mqWKPI2XMuOdZ79GKK7yFzflXGZEPAY7zw_iwZmAc-grNlHfuwam9kTKz2nPUnsZM0pqkmRvcELsz63tk4uo6FLnsFkN7XHMj5AvHO92sIspQenw1s1vHgoESw"); + headers.set("Authorization", auth); StompHeaders stompHeaders = new StompHeaders(); - stompHeaders.set("Authorization", - "Bearer eyJhbGciOiJSUzI1NiJ9.eyJpc3MiOiJzZWxmIiwic3ViIjoiMTQiLCJleHAiOjE2OTAxMDc0NzAsImlhdCI6MTY4OTg0ODI3MH0.WXwKt6M12AMW-9Fhsop-nGtwxQR4jw7t-EIN2RUKLfRSaMlMgTgHPr_p47GXmQszJndPthUN3IkLBRMfVyEK3y4e9Uq5B2gD2DBgXuFgdM85PlJF8NHThDGyH-eoc7ZbPD1geCSFTiDbzuWuY4b1AcFnP2p4VdoU9s28FHoJzQRKL2cot-ZwexEVhFzVXJkXgF2oKpbdMamVHkTRuGRzmrYFzur2mqWKPI2XMuOdZ79GKK7yFzflXGZEPAY7zw_iwZmAc-grNlHfuwam9kTKz2nPUnsZM0pqkmRvcELsz63tk4uo6FLnsFkN7XHMj5AvHO92sIspQenw1s1vHgoESw"); + stompHeaders.set("Authorization",auth); StompSessionHandlerAdapter sessionHandler = new StompSessionHandlerAdapter() { @Override diff --git a/xian-ncc-da-message b/xian-ncc-da-message index edc9973..e9ebd34 160000 --- a/xian-ncc-da-message +++ b/xian-ncc-da-message @@ -1 +1 @@ -Subproject commit edc9973662bc4f02198f72919de9408fa9ea9043 +Subproject commit e9ebd34921652f48c2d84ac531e392ce32d17bb5