【修改线路构建信息】
This commit is contained in:
parent
0dae9b7021
commit
fc3cc1d383
29
src/main/java/club/joylink/xiannccda/ats/cache/LineGraphicDataManage.java
vendored
Normal file
29
src/main/java/club/joylink/xiannccda/ats/cache/LineGraphicDataManage.java
vendored
Normal file
@ -0,0 +1,29 @@
|
||||
package club.joylink.xiannccda.ats.cache;
|
||||
|
||||
import club.joylink.xiannccda.dto.PublishedGIDTO.LineType;
|
||||
import club.joylink.xiannccda.dto.PublishedGIQueryDTO;
|
||||
import club.joylink.xiannccda.entity.PublishedGi;
|
||||
import club.joylink.xiannccda.repository.IPublishedGiRepository;
|
||||
import java.util.List;
|
||||
import org.springframework.boot.ApplicationArguments;
|
||||
import org.springframework.boot.ApplicationRunner;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/** 线路发布数据内存管理 */
|
||||
@Component
|
||||
public class LineGraphicDataManage implements ApplicationRunner {
|
||||
|
||||
final IPublishedGiRepository iPublishedGiRepository;
|
||||
|
||||
public LineGraphicDataManage(IPublishedGiRepository iPublishedGiRepository) {
|
||||
this.iPublishedGiRepository = iPublishedGiRepository;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run(ApplicationArguments args) throws Exception {
|
||||
PublishedGIQueryDTO query = new PublishedGIQueryDTO();
|
||||
query.setType(LineType.Line.name());
|
||||
List<PublishedGi> list = iPublishedGiRepository.listWithProto(query);
|
||||
list.forEach(LineGraphicDataRepository::putLineGraph);
|
||||
}
|
||||
}
|
150
src/main/java/club/joylink/xiannccda/ats/cache/LineGraphicDataRepository.java
vendored
Normal file
150
src/main/java/club/joylink/xiannccda/ats/cache/LineGraphicDataRepository.java
vendored
Normal file
@ -0,0 +1,150 @@
|
||||
package club.joylink.xiannccda.ats.cache;
|
||||
|
||||
import club.joylink.xiannccda.dto.protos.DeviceInfoProto;
|
||||
import club.joylink.xiannccda.dto.protos.LayoutGraphicsProto;
|
||||
import club.joylink.xiannccda.dto.protos.LayoutGraphicsProto.RelatedRef.DeviceType;
|
||||
import club.joylink.xiannccda.dto.protos.LayoutGraphicsProto.Section;
|
||||
import club.joylink.xiannccda.entity.PublishedGi;
|
||||
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
||||
import com.google.protobuf.GeneratedMessageV3.Builder;
|
||||
import com.google.protobuf.InvalidProtocolBufferException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.stream.Collectors;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
/** 发布时缓存在内存中的线路数据 */
|
||||
@Slf4j
|
||||
public class LineGraphicDataRepository {
|
||||
|
||||
/** 线路数据信息 */
|
||||
private static final Map<Integer, Map<String, Map<String, ? extends Builder>>> lineGraphMap =
|
||||
new ConcurrentHashMap<>();
|
||||
|
||||
/**
|
||||
* 线路信息是否存在
|
||||
*
|
||||
* @param lineCode 线路信息
|
||||
* @return 是否存在
|
||||
*/
|
||||
public static boolean lineDataExists(Integer lineCode) {
|
||||
return lineGraphMap.containsKey(lineCode);
|
||||
}
|
||||
|
||||
/**
|
||||
* 缓存线路数据信息
|
||||
*
|
||||
* @param lineCode 线路编号
|
||||
* @param data 线路地图信息
|
||||
*/
|
||||
public static void putLineGraph(PublishedGi publishGi) {
|
||||
try {
|
||||
LayoutGraphicsProto.RtssGraphicStorage storage =
|
||||
LayoutGraphicsProto.RtssGraphicStorage.parseFrom(publishGi.getProto());
|
||||
Map<String, Map<String, ? extends Builder>> lineDataMap = new HashMap<>();
|
||||
// 构建区段
|
||||
sectionInitLineGraph(lineDataMap, storage);
|
||||
// 构建道岔
|
||||
switchInitLineGraph(lineDataMap, storage);
|
||||
// 设置公里标
|
||||
setUpKilometerCode(lineDataMap, storage);
|
||||
lineGraphMap.put(publishGi.getLineId(), lineDataMap);
|
||||
} catch (InvalidProtocolBufferException e) {
|
||||
log.error("反序列化信息失败", e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 构建程序中的区段信息
|
||||
*
|
||||
* @param dataMap 缓存数据
|
||||
* @param storage 地图构建数据
|
||||
*/
|
||||
private static void sectionInitLineGraph(
|
||||
Map<String, Map<String, ? extends Builder>> dataMap,
|
||||
LayoutGraphicsProto.RtssGraphicStorage storage) {
|
||||
// 地图
|
||||
List<Section> sectionList = storage.getSectionList();
|
||||
// 存储的地图数据
|
||||
Map<String, DeviceInfoProto.Section.Builder> cacheSectionMap =
|
||||
new HashMap<>(sectionList.size());
|
||||
sectionList.forEach(
|
||||
section -> {
|
||||
String sid = section.getCommon().getId();
|
||||
DeviceInfoProto.Section.Builder sectionBuilder =
|
||||
cacheSectionMap.getOrDefault(sid, DeviceInfoProto.Section.newBuilder().setId(sid));
|
||||
sectionBuilder.setCode(section.getCode());
|
||||
sectionBuilder.setType(section.getSectionType());
|
||||
List<String> childList = section.getChildrenList();
|
||||
if (CollectionUtils.isNotEmpty(childList)) {
|
||||
childList.forEach(
|
||||
id -> {
|
||||
DeviceInfoProto.Section.Builder cb =
|
||||
cacheSectionMap.getOrDefault(
|
||||
id, DeviceInfoProto.Section.newBuilder().setId(id));
|
||||
sectionBuilder.addChildren(cb);
|
||||
cacheSectionMap.put(id, cb);
|
||||
});
|
||||
}
|
||||
cacheSectionMap.put(sid, sectionBuilder);
|
||||
});
|
||||
dataMap.put(DeviceType.Section.name(), cacheSectionMap);
|
||||
}
|
||||
|
||||
/**
|
||||
* 构建道岔信息
|
||||
*
|
||||
* @param dataMap 缓存数据
|
||||
* @param storage 地图构建数据
|
||||
*/
|
||||
private static void switchInitLineGraph(
|
||||
Map<String, Map<String, ? extends Builder>> dataMap,
|
||||
LayoutGraphicsProto.RtssGraphicStorage storage) {
|
||||
Map<String, DeviceInfoProto.Switch.Builder> cacheSwitchMap =
|
||||
storage.getTurnoutsList().stream()
|
||||
.collect(
|
||||
Collectors.toMap(
|
||||
t -> t.getCommon().getId(),
|
||||
t -> {
|
||||
DeviceInfoProto.Switch.Builder switchBuilder =
|
||||
DeviceInfoProto.Switch.newBuilder();
|
||||
switchBuilder.setId(t.getCommon().getId());
|
||||
switchBuilder.setCode(t.getCode());
|
||||
return switchBuilder;
|
||||
}));
|
||||
|
||||
dataMap.put(DeviceType.Turnout.name(), cacheSwitchMap);
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置公里标
|
||||
*
|
||||
* @param dataMap 缓存数据
|
||||
* @param storage 地图构建数据
|
||||
*/
|
||||
private static void setUpKilometerCode(
|
||||
Map<String, Map<String, ? extends Builder>> dataMap,
|
||||
LayoutGraphicsProto.RtssGraphicStorage storage) {
|
||||
Map<String, ? extends Builder> sectionMap = dataMap.get(DeviceType.Section.name());
|
||||
if (sectionMap != null) {
|
||||
return;
|
||||
}
|
||||
storage
|
||||
.getAxleCountingsList()
|
||||
.forEach(
|
||||
ac -> {
|
||||
ac.getSectionIdList().stream()
|
||||
.filter(sid -> sectionMap.containsKey(sid))
|
||||
.forEach(
|
||||
sid -> {
|
||||
DeviceInfoProto.Section.Builder sectionBuilder =
|
||||
(DeviceInfoProto.Section.Builder) sectionMap.get(sid);
|
||||
sectionBuilder.addKilometerCode(ac.getKilometerCode());
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
@ -18,7 +18,7 @@ public abstract class DeviceStatusDataOperate {
|
||||
|
||||
/** 设备主键名称映射 */
|
||||
private static final Map<String, String> DEVICE_ID_NAME_MAP =
|
||||
Map.of("LineNetTrainOffsetDiagram", "groupId", "Train", "trainIndex");
|
||||
Map.of("LineNetTrainOffsetDiagram", "groupId", "TrainInfo", "groupId");
|
||||
|
||||
/**
|
||||
* 批量放入设备状态
|
||||
@ -94,8 +94,13 @@ public abstract class DeviceStatusDataOperate {
|
||||
*/
|
||||
private static String getIdVal(Builder protoBuilder) {
|
||||
String idName = DEVICE_ID_NAME_MAP.getOrDefault(findType(protoBuilder), DEFAULT_ID_NAME);
|
||||
return String.valueOf(
|
||||
protoBuilder.getField(protoBuilder.getDescriptorForType().findFieldByName(idName)));
|
||||
try {
|
||||
return String.valueOf(
|
||||
protoBuilder.getField(protoBuilder.getDescriptorForType().findFieldByName(idName)));
|
||||
} catch (Exception e) {
|
||||
System.err.println(protoBuilder.getDescriptorForType().getName());
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -4,15 +4,21 @@ import club.joylink.xiannccda.ats.message.MessageResponse;
|
||||
import club.joylink.xiannccda.ats.message.convertor.DeviceStatusConvertor;
|
||||
import club.joylink.xiannccda.ats.message.line3.DateTimeUtil;
|
||||
import club.joylink.xiannccda.ats.message.line3.MessageCons;
|
||||
import club.joylink.xiannccda.ats.message.line3.device.DeviceStatus;
|
||||
import club.joylink.xiannccda.ats.message.line3.device.DeviceStatus.TRAIN_MODE;
|
||||
import club.joylink.xiannccda.ats.message.line3.device.DeviceType;
|
||||
import club.joylink.xiannccda.ats.message.line3.rep.DeviceStatusBitmapResponse.DeviceTypeEntity;
|
||||
import club.joylink.xiannccda.dto.protos.DeviceStatusProto;
|
||||
import club.joylink.xiannccda.dto.protos.DeviceStatusProto.TrainMode;
|
||||
import club.joylink.xiannccda.dto.protos.TrainProto.NccWindow;
|
||||
import club.joylink.xiannccda.dto.protos.TrainProto.TrainInfo;
|
||||
import com.google.common.base.CaseFormat;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.protobuf.GeneratedMessageV3;
|
||||
import com.google.protobuf.GeneratedMessageV3.Builder;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import java.util.Arrays;
|
||||
import java.util.Optional;
|
||||
import lombok.Getter;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
@ -20,24 +26,16 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import lombok.Setter;
|
||||
|
||||
/**
|
||||
* 2.7.9列车信息全体消息
|
||||
*/
|
||||
/** 2.7.9列车信息全体消息 */
|
||||
@Getter
|
||||
@Setter
|
||||
public class TrainIndicationInitResponse extends MessageResponse {
|
||||
|
||||
/**
|
||||
* 线路号(2)
|
||||
*/
|
||||
/** 线路号(2) */
|
||||
private Short lineId;
|
||||
/**
|
||||
* 列车数量(2)
|
||||
*/
|
||||
/** 列车数量(2) */
|
||||
private Short trainCnt;
|
||||
/**
|
||||
* 列车列表
|
||||
*/
|
||||
/** 列车列表 */
|
||||
private List<TrainCell> trains;
|
||||
|
||||
@Override
|
||||
@ -52,29 +50,29 @@ public class TrainIndicationInitResponse extends MessageResponse {
|
||||
|
||||
@Override
|
||||
public List<Builder> generateProto() throws Exception {
|
||||
List<GeneratedMessageV3.Builder> msgBuildList = Lists.newArrayList();
|
||||
List<Builder> msgBuildList = Lists.newArrayList();
|
||||
for (TrainCell trainCell : this.trains) {
|
||||
TrainInfo.Builder builder = TrainInfo.newBuilder();
|
||||
builder.setLineId(lineId);
|
||||
if (trainCell.getRtuId() != null) {
|
||||
builder.setRtuId(trainCell.getRtuId());
|
||||
}
|
||||
builder.setTrainIndex(trainCell.getTrainIndex());
|
||||
builder.setTrainId(trainCell.getTrainId());
|
||||
builder.setGroupId(trainCell.getGroupId());
|
||||
|
||||
if (trainCell.getNccWindow() != null) {
|
||||
NccWindow.Builder window = NccWindow.newBuilder();
|
||||
window.setNccWindow(trainCell.getNccWindow());
|
||||
window.setNccWinOffset(trainCell.getNccWindowOffset());
|
||||
builder.setWindow(window);
|
||||
|
||||
}
|
||||
|
||||
if (trainCell.getDevType() != null) {
|
||||
builder.setDevType(DeviceStatusProto.DeviceType.forNumber(trainCell.getDevType().getVal()));
|
||||
}
|
||||
builder.setDevName(trainCell.getDevName());
|
||||
builder.setTrainIndex(trainCell.getTrainIndex());
|
||||
builder.setGroupId(trainCell.getGroupId());
|
||||
builder.setTrainId(trainCell.getTrainId());
|
||||
if (trainCell.getGlobalId() != null) {
|
||||
builder.setGlobalId(trainCell.getGlobalId());
|
||||
}
|
||||
if (trainCell.getDestinationId() != null) {
|
||||
builder.setDestinationId(trainCell.getDestinationId());
|
||||
}
|
||||
@ -86,7 +84,17 @@ public class TrainIndicationInitResponse extends MessageResponse {
|
||||
builder.setOtpTime(trainCell.getOtpTime());
|
||||
}
|
||||
if (trainCell.getMode() != null) {
|
||||
builder.setMode(trainCell.getMode());
|
||||
Optional<TRAIN_MODE> modeAttr =
|
||||
Arrays.stream(TRAIN_MODE.values()).filter(t -> t.is(trainCell.getMode())).findFirst();
|
||||
if (modeAttr.isPresent()) {
|
||||
String fieldName =
|
||||
CaseFormat.UPPER_UNDERSCORE.to(
|
||||
CaseFormat.LOWER_CAMEL, modeAttr.get().name().toLowerCase());
|
||||
TrainMode.Builder trainModeBuilder = TrainMode.newBuilder();
|
||||
trainModeBuilder.setField(
|
||||
trainModeBuilder.getDescriptorForType().findFieldByName(fieldName), true);
|
||||
builder.setMode(trainModeBuilder);
|
||||
}
|
||||
}
|
||||
if (trainCell.getArriveTime() != null) {
|
||||
builder.setArriveTime(trainCell.getArriveTime().getNano());
|
||||
@ -107,81 +115,43 @@ public class TrainIndicationInitResponse extends MessageResponse {
|
||||
@Setter
|
||||
public static class TrainCell {
|
||||
|
||||
/**
|
||||
* 集中站站号(2)
|
||||
*/
|
||||
/** 集中站站号(2) */
|
||||
private Short rtuId;
|
||||
/**
|
||||
* NCC车次窗编号(2)
|
||||
*/
|
||||
/** NCC车次窗编号(2) */
|
||||
private Short nccWindow;
|
||||
/**
|
||||
* 列车在车次窗中的位置(1)
|
||||
*/
|
||||
/** 列车在车次窗中的位置(1) */
|
||||
private Byte nccWindowOffset;
|
||||
/**
|
||||
* 列车所在的设备的类型(2)
|
||||
*/
|
||||
/** 列车所在的设备的类型(2) */
|
||||
private DeviceType devType;
|
||||
/**
|
||||
* 列车所在的设备的名称(24)
|
||||
*/
|
||||
/** 列车所在的设备的名称(24) */
|
||||
private String devName;
|
||||
/**
|
||||
* 列车标示号,全线唯一(若无法提供,缺省值为0)(10)
|
||||
*/
|
||||
/** 列车标示号,全线唯一(若无法提供,缺省值为0)(10) */
|
||||
private String trainIndex;
|
||||
/**
|
||||
* 列车编组号(9)
|
||||
*/
|
||||
/** 列车编组号(9) */
|
||||
private String groupId;
|
||||
/**
|
||||
* 表号(9)
|
||||
*/
|
||||
/** 表号(9) */
|
||||
private String trainId;
|
||||
/**
|
||||
* 车次号(12)
|
||||
*/
|
||||
/** 车次号(12) */
|
||||
private String globalId;
|
||||
/**
|
||||
* 目的地号(4)
|
||||
*/
|
||||
/** 目的地号(4) */
|
||||
private Integer destinationId;
|
||||
/**
|
||||
* 编组数量(1)
|
||||
*/
|
||||
/** 编组数量(1) */
|
||||
private byte rollingStock;
|
||||
/**
|
||||
* 司机号(13)
|
||||
*/
|
||||
/** 司机号(13) */
|
||||
private String driverId;
|
||||
/**
|
||||
* 根据实际报点和计划的偏离时间(单位:秒,-215- +215 ,正数表示列车晚点秒数,负数表示列车早点秒数)(4)
|
||||
*/
|
||||
/** 根据实际报点和计划的偏离时间(单位:秒,-215- +215 ,正数表示列车晚点秒数,负数表示列车早点秒数)(4) */
|
||||
private Integer otpTime;
|
||||
/**
|
||||
* 列车状态,见附录6.3.14列车状态定义(4)
|
||||
*/
|
||||
/** 列车状态,见附录6.3.14列车状态定义(4) */
|
||||
private Integer mode;
|
||||
/**
|
||||
* 列车到点(7)
|
||||
*/
|
||||
/** 列车到点(7) */
|
||||
private LocalDateTime arriveTime;
|
||||
/**
|
||||
* 列车发点(7)
|
||||
*/
|
||||
/** 列车发点(7) */
|
||||
private LocalDateTime departTime;
|
||||
/**
|
||||
* 满载率(百分比,例如50,表示满载率为50%)(4)
|
||||
*/
|
||||
/** 满载率(百分比,例如50,表示满载率为50%)(4) */
|
||||
private Integer rate;
|
||||
/**
|
||||
* 速度(KM/H)(1)
|
||||
*/
|
||||
/** 速度(KM/H)(1) */
|
||||
private byte speed;
|
||||
/**
|
||||
* 预留(2)
|
||||
*/
|
||||
/** 预留(2) */
|
||||
private byte[] reserve = new byte[2];
|
||||
|
||||
private TrainCell decode(final ByteBuf buf) {
|
||||
|
@ -4,121 +4,80 @@ import club.joylink.xiannccda.ats.message.MessageResponse;
|
||||
import club.joylink.xiannccda.ats.message.line3.DateTimeUtil;
|
||||
import club.joylink.xiannccda.ats.message.line3.MessageCons;
|
||||
import club.joylink.xiannccda.ats.message.line3.device.DeviceStatus;
|
||||
import club.joylink.xiannccda.ats.message.line3.device.DeviceStatus.TRAIN_MODE;
|
||||
import club.joylink.xiannccda.ats.message.line3.device.DeviceType;
|
||||
import club.joylink.xiannccda.dto.protos.DeviceStatusProto;
|
||||
import club.joylink.xiannccda.dto.protos.DeviceStatusProto.TrainMode;
|
||||
import club.joylink.xiannccda.dto.protos.TrainProto;
|
||||
import club.joylink.xiannccda.dto.protos.TrainProto.NccWindow;
|
||||
import club.joylink.xiannccda.dto.protos.TrainProto.TrainInfo;
|
||||
import com.google.common.base.CaseFormat;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.protobuf.GeneratedMessageV3.Builder;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.ZoneOffset;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
/**
|
||||
* 2.7.10 列车信息更新消息[增加/更新]
|
||||
*/
|
||||
/** 2.7.10 列车信息更新消息[增加/更新] */
|
||||
@Getter
|
||||
@Setter
|
||||
public class TrainIndicationUpdateResponse extends MessageResponse {
|
||||
|
||||
/**
|
||||
* 线路号(2)
|
||||
*/
|
||||
/** 线路号(2) */
|
||||
private Short lineId;
|
||||
/**
|
||||
* 车次号变化状态(2) 0x01:增加<br> 0x02:更新
|
||||
* <br>
|
||||
* 车次号变化状态(2) 0x01:增加<br>
|
||||
* 0x02:更新 <br>
|
||||
* true-更新,false-增加
|
||||
*/
|
||||
private Boolean type;
|
||||
/**
|
||||
* 集中站站号(2)
|
||||
*/
|
||||
/** 集中站站号(2) */
|
||||
private Short rtuId;
|
||||
/**
|
||||
* NCC车次窗编号(2)
|
||||
*/
|
||||
/** NCC车次窗编号(2) */
|
||||
private Short nccWindow;
|
||||
/**
|
||||
* 列车在车次窗中的位置(1)
|
||||
*/
|
||||
/** 列车在车次窗中的位置(1) */
|
||||
private Byte nccWindowOffset;
|
||||
/**
|
||||
* 列车所在的设备的类型(2)
|
||||
*/
|
||||
/** 列车所在的设备的类型(2) */
|
||||
private DeviceType devType;
|
||||
/**
|
||||
* 列车所在的设备的名称(24)
|
||||
*/
|
||||
/** 列车所在的设备的名称(24) */
|
||||
private String devName;
|
||||
/**
|
||||
* 列车标示号,全线唯一(若无法提供,缺省值为0)(10)
|
||||
*/
|
||||
/** 列车标示号,全线唯一(若无法提供,缺省值为0)(10) */
|
||||
private String trainIndex;
|
||||
/**
|
||||
* 列车编组号(9)
|
||||
*/
|
||||
/** 列车编组号(9) */
|
||||
private String groupId;
|
||||
/**
|
||||
* 表号(9)
|
||||
*/
|
||||
/** 表号(9) */
|
||||
private String trainId;
|
||||
/**
|
||||
* 车次号(12)
|
||||
*/
|
||||
/** 车次号(12) */
|
||||
private String globalId;
|
||||
/**
|
||||
* 目的地号(4)
|
||||
*/
|
||||
/** 目的地号(4) */
|
||||
private Integer destinationId;
|
||||
/**
|
||||
* 编组数量(1)
|
||||
*/
|
||||
/** 编组数量(1) */
|
||||
private byte rollingStock;
|
||||
/**
|
||||
* 司机号(13)
|
||||
*/
|
||||
/** 司机号(13) */
|
||||
private String driverId;
|
||||
/**
|
||||
* 运行路径号(若无法提供,缺省值为0)(2)
|
||||
*/
|
||||
/** 运行路径号(若无法提供,缺省值为0)(2) */
|
||||
private Short routeId;
|
||||
/**
|
||||
* 计划偏离时间(4)
|
||||
*/
|
||||
/** 计划偏离时间(4) */
|
||||
private Integer optTime;
|
||||
/**
|
||||
* 列车状态,见附录6.3.14列车状态定义(4)
|
||||
*/
|
||||
/** 列车状态,见附录6.3.14列车状态定义(4) */
|
||||
private Integer mode;
|
||||
/**
|
||||
* 列车到点(7)
|
||||
*/
|
||||
/** 列车到点(7) */
|
||||
private LocalDateTime arriveTime;
|
||||
/**
|
||||
* 列车发点(7)
|
||||
*/
|
||||
/** 列车发点(7) */
|
||||
private LocalDateTime departTime;
|
||||
/**
|
||||
* 满载率(百分比,例如50,表示满载率为50%)(4)
|
||||
*/
|
||||
/** 满载率(百分比,例如50,表示满载率为50%)(4) */
|
||||
private Integer rate;
|
||||
/**
|
||||
* 速度(KM/H)(1)
|
||||
*/
|
||||
/** 速度(KM/H)(1) */
|
||||
private byte speed;
|
||||
/**
|
||||
* 预留(2)
|
||||
*/
|
||||
/** 预留(2) */
|
||||
private byte[] reserve = new byte[2];
|
||||
|
||||
/**
|
||||
* 列车是否有 trainMode对应的状态
|
||||
*/
|
||||
/** 列车是否有 trainMode对应的状态 */
|
||||
public boolean havingState(final DeviceStatus.TRAIN_MODE trainMode) {
|
||||
return trainMode.is(mode);
|
||||
}
|
||||
@ -143,7 +102,19 @@ public class TrainIndicationUpdateResponse extends MessageResponse {
|
||||
train.setOtpTime(this.optTime);
|
||||
train.setArriveTime(this.arriveTime.toEpochSecond(ZoneOffset.ofHours(8)) * 1000);
|
||||
train.setDepartTime(this.departTime.toEpochSecond(ZoneOffset.ofHours(8)) * 1000);
|
||||
train.setMode(this.mode);
|
||||
if (this.mode != null) {
|
||||
Optional<TRAIN_MODE> modeAttr =
|
||||
Arrays.stream(TRAIN_MODE.values()).filter(t -> t.is(this.mode)).findFirst();
|
||||
if (modeAttr.isPresent()) {
|
||||
String fieldName =
|
||||
CaseFormat.UPPER_UNDERSCORE.to(
|
||||
CaseFormat.LOWER_CAMEL, modeAttr.get().name().toLowerCase());
|
||||
TrainMode.Builder trainModeBuilder = TrainMode.newBuilder();
|
||||
trainModeBuilder.setField(
|
||||
trainModeBuilder.getDescriptorForType().findFieldByName(fieldName), true);
|
||||
train.setMode(trainModeBuilder);
|
||||
}
|
||||
}
|
||||
train.setSpeed(this.speed);
|
||||
train.setRate(this.rate);
|
||||
train.setRouteId(this.routeId);
|
||||
@ -152,11 +123,9 @@ public class TrainIndicationUpdateResponse extends MessageResponse {
|
||||
train.setGroupId(this.groupId);
|
||||
train.setGlobalId(this.globalId);
|
||||
train.setTrainId(this.trainId);
|
||||
|
||||
return Lists.newArrayList(train);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void decode2(ByteBuf buf) throws Exception {
|
||||
short devType;
|
||||
@ -203,8 +172,7 @@ public class TrainIndicationUpdateResponse extends MessageResponse {
|
||||
this.arriveTime = DateTimeUtil.convert(arriveTime);
|
||||
this.departTime = DateTimeUtil.convert(departTime);
|
||||
/**
|
||||
* 车次号变化状态(2)
|
||||
* 0x01:增加<br>
|
||||
* 车次号变化状态(2) 0x01:增加<br>
|
||||
* 0x02:更新<br>
|
||||
* true-更新,false-增加
|
||||
*/
|
||||
|
@ -17,68 +17,52 @@ import lombok.Getter;
|
||||
import java.time.LocalDateTime;
|
||||
import lombok.Setter;
|
||||
|
||||
/**
|
||||
* 2.7.8列车报点消息
|
||||
*/
|
||||
/** 2.7.8列车报点消息 */
|
||||
@Getter
|
||||
@Setter
|
||||
public class TrainRecordResponse extends MessageResponse {
|
||||
|
||||
/**
|
||||
* 线路号(2)
|
||||
*/
|
||||
/** 线路号(2) */
|
||||
private Short lineId;
|
||||
/**
|
||||
* 表号(9)
|
||||
*/
|
||||
/** 表号(9) */
|
||||
private String trainId;
|
||||
/**
|
||||
* 车次号(12)
|
||||
*/
|
||||
/** 车次号(12) */
|
||||
private String globalId;
|
||||
/**
|
||||
* 局部序列号(4)
|
||||
*/
|
||||
/** 局部序列号(4) */
|
||||
private Integer localSubId;
|
||||
/**
|
||||
* 车组号(9)
|
||||
*/
|
||||
/** 车组号(9) */
|
||||
private String groupId;
|
||||
/**
|
||||
* 目的地(4)
|
||||
*/
|
||||
/** 目的地(4) */
|
||||
private Integer destinationId;
|
||||
/**
|
||||
* 列车类型(2) 0x01:计划车<br> 0x02:头码车<br> 0x03:M0车<br> 0x04:MM车<br>
|
||||
* 列车类型(2) 0x01:计划车<br>
|
||||
* 0x02:头码车<br>
|
||||
* 0x03:M0车<br>
|
||||
* 0x04:MM车<br>
|
||||
*/
|
||||
private TrainTypeEnum trainType;
|
||||
/**
|
||||
* 运行方向(1) 0x01:下行 <br> 0x02:上行<br> 0x00:无方向<br>
|
||||
* 运行方向(1) 0x01:下行 <br>
|
||||
* 0x02:上行<br>
|
||||
* 0x00:无方向<br>
|
||||
*/
|
||||
private DirectionEnum direction;
|
||||
/**
|
||||
* 站号(2)
|
||||
*/
|
||||
/** 站号(2) */
|
||||
private Short stationId;
|
||||
/**
|
||||
* 站台编号(2)
|
||||
*/
|
||||
/** 站台编号(2) */
|
||||
private Short sideId;
|
||||
/**
|
||||
* 轨道名称(小区段名称)(20)
|
||||
*/
|
||||
/** 轨道名称(小区段名称)(20) */
|
||||
private String trackName;
|
||||
/**
|
||||
* 到发点类型(2)<br> 0x01H:到达<br> 0x02H:出发<br> true-到达,false-出发
|
||||
* 到发点类型(2)<br>
|
||||
* 0x01H:到达<br>
|
||||
* 0x02H:出发<br>
|
||||
* true-到达,false-出发
|
||||
*/
|
||||
private Boolean recordType;
|
||||
/**
|
||||
* 到发时间(7)
|
||||
*/
|
||||
/** 到发时间(7) */
|
||||
private LocalDateTime recordTime;
|
||||
/**
|
||||
* 预留(4)
|
||||
*/
|
||||
/** 预留(4) */
|
||||
private byte[] reserve = new byte[4];
|
||||
|
||||
@Override
|
||||
@ -128,12 +112,15 @@ public class TrainRecordResponse extends MessageResponse {
|
||||
|
||||
@Override
|
||||
public List<Builder> generateProto() throws Exception {
|
||||
List<GeneratedMessageV3.Builder> msgBuildList = Lists.newArrayList();
|
||||
TrainRecord.Builder builder = TrainRecord.newBuilder();
|
||||
builder.setLineId(this.getLineId());
|
||||
builder.setTrainId(this.getTrainId());
|
||||
builder.setGlobalId(this.getGlobalId());
|
||||
builder.setLocalSubId(this.getLocalSubId());
|
||||
builder.setGroupId(this.getGroupId());
|
||||
if (this.getDestinationId() != null) {
|
||||
builder.setDestinationId(this.getDestinationId());
|
||||
}
|
||||
if (this.getTrainType() != null) {
|
||||
builder.setTrainType(this.getTrainType().type);
|
||||
}
|
||||
@ -153,12 +140,13 @@ public class TrainRecordResponse extends MessageResponse {
|
||||
if (this.getRecordTime() != null) {
|
||||
builder.setRecordTime(this.getRecordTime().getNano());
|
||||
}
|
||||
msgBuildList.add(builder);
|
||||
return msgBuildList;
|
||||
return Lists.newArrayList(builder);
|
||||
}
|
||||
|
||||
/**
|
||||
* 运行方向(1) 0x01:下行 <br> 0x02:上行<br> 0x00:无方向<br>
|
||||
* 运行方向(1) 0x01:下行 <br>
|
||||
* 0x02:上行<br>
|
||||
* 0x00:无方向<br>
|
||||
*/
|
||||
public static enum DirectionEnum {
|
||||
Down(0x01),
|
||||
@ -182,7 +170,10 @@ public class TrainRecordResponse extends MessageResponse {
|
||||
}
|
||||
|
||||
/**
|
||||
* 列车类型(2) 0x01:计划车<br> 0x02:头码车<br> 0x03:M0车<br> 0x04:MM车<br>
|
||||
* 列车类型(2) 0x01:计划车<br>
|
||||
* 0x02:头码车<br>
|
||||
* 0x03:M0车<br>
|
||||
* 0x04:MM车<br>
|
||||
*/
|
||||
public static enum TrainTypeEnum {
|
||||
PlannedTrain(0x01),
|
||||
|
2958
src/main/java/club/joylink/xiannccda/dto/protos/DeviceInfoProto.java
Normal file
2958
src/main/java/club/joylink/xiannccda/dto/protos/DeviceInfoProto.java
Normal file
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
2072
src/main/java/club/joylink/xiannccda/dto/protos/SectionProto.java
Normal file
2072
src/main/java/club/joylink/xiannccda/dto/protos/SectionProto.java
Normal file
File diff suppressed because it is too large
Load Diff
@ -225,12 +225,32 @@ public final class TrainProto {
|
||||
/**
|
||||
* <pre>
|
||||
* 列车状态
|
||||
* int32 mode = 14;
|
||||
* </pre>
|
||||
*
|
||||
* <code>int32 mode = 14;</code>
|
||||
* <code>.state.TrainMode mode = 14;</code>
|
||||
* @return Whether the mode field is set.
|
||||
*/
|
||||
boolean hasMode();
|
||||
/**
|
||||
* <pre>
|
||||
* 列车状态
|
||||
* int32 mode = 14;
|
||||
* </pre>
|
||||
*
|
||||
* <code>.state.TrainMode mode = 14;</code>
|
||||
* @return The mode.
|
||||
*/
|
||||
int getMode();
|
||||
club.joylink.xiannccda.dto.protos.DeviceStatusProto.TrainMode getMode();
|
||||
/**
|
||||
* <pre>
|
||||
* 列车状态
|
||||
* int32 mode = 14;
|
||||
* </pre>
|
||||
*
|
||||
* <code>.state.TrainMode mode = 14;</code>
|
||||
*/
|
||||
club.joylink.xiannccda.dto.protos.DeviceStatusProto.TrainModeOrBuilder getModeOrBuilder();
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
@ -758,18 +778,44 @@ public final class TrainProto {
|
||||
}
|
||||
|
||||
public static final int MODE_FIELD_NUMBER = 14;
|
||||
private int mode_ = 0;
|
||||
private club.joylink.xiannccda.dto.protos.DeviceStatusProto.TrainMode mode_;
|
||||
/**
|
||||
* <pre>
|
||||
* 列车状态
|
||||
* int32 mode = 14;
|
||||
* </pre>
|
||||
*
|
||||
* <code>int32 mode = 14;</code>
|
||||
* <code>.state.TrainMode mode = 14;</code>
|
||||
* @return Whether the mode field is set.
|
||||
*/
|
||||
@java.lang.Override
|
||||
public boolean hasMode() {
|
||||
return mode_ != null;
|
||||
}
|
||||
/**
|
||||
* <pre>
|
||||
* 列车状态
|
||||
* int32 mode = 14;
|
||||
* </pre>
|
||||
*
|
||||
* <code>.state.TrainMode mode = 14;</code>
|
||||
* @return The mode.
|
||||
*/
|
||||
@java.lang.Override
|
||||
public int getMode() {
|
||||
return mode_;
|
||||
public club.joylink.xiannccda.dto.protos.DeviceStatusProto.TrainMode getMode() {
|
||||
return mode_ == null ? club.joylink.xiannccda.dto.protos.DeviceStatusProto.TrainMode.getDefaultInstance() : mode_;
|
||||
}
|
||||
/**
|
||||
* <pre>
|
||||
* 列车状态
|
||||
* int32 mode = 14;
|
||||
* </pre>
|
||||
*
|
||||
* <code>.state.TrainMode mode = 14;</code>
|
||||
*/
|
||||
@java.lang.Override
|
||||
public club.joylink.xiannccda.dto.protos.DeviceStatusProto.TrainModeOrBuilder getModeOrBuilder() {
|
||||
return mode_ == null ? club.joylink.xiannccda.dto.protos.DeviceStatusProto.TrainMode.getDefaultInstance() : mode_;
|
||||
}
|
||||
|
||||
public static final int ARRIVETIME_FIELD_NUMBER = 15;
|
||||
@ -930,8 +976,8 @@ public final class TrainProto {
|
||||
if (otpTime_ != 0) {
|
||||
output.writeInt32(13, otpTime_);
|
||||
}
|
||||
if (mode_ != 0) {
|
||||
output.writeInt32(14, mode_);
|
||||
if (mode_ != null) {
|
||||
output.writeMessage(14, getMode());
|
||||
}
|
||||
if (arriveTime_ != 0L) {
|
||||
output.writeInt64(15, arriveTime_);
|
||||
@ -1009,9 +1055,9 @@ public final class TrainProto {
|
||||
size += com.google.protobuf.CodedOutputStream
|
||||
.computeInt32Size(13, otpTime_);
|
||||
}
|
||||
if (mode_ != 0) {
|
||||
if (mode_ != null) {
|
||||
size += com.google.protobuf.CodedOutputStream
|
||||
.computeInt32Size(14, mode_);
|
||||
.computeMessageSize(14, getMode());
|
||||
}
|
||||
if (arriveTime_ != 0L) {
|
||||
size += com.google.protobuf.CodedOutputStream
|
||||
@ -1084,8 +1130,11 @@ public final class TrainProto {
|
||||
.equals(other.getDriverId())) return false;
|
||||
if (getOtpTime()
|
||||
!= other.getOtpTime()) return false;
|
||||
if (getMode()
|
||||
!= other.getMode()) return false;
|
||||
if (hasMode() != other.hasMode()) return false;
|
||||
if (hasMode()) {
|
||||
if (!getMode()
|
||||
.equals(other.getMode())) return false;
|
||||
}
|
||||
if (getArriveTime()
|
||||
!= other.getArriveTime()) return false;
|
||||
if (getDepartTime()
|
||||
@ -1140,8 +1189,10 @@ public final class TrainProto {
|
||||
hash = (53 * hash) + getDriverId().hashCode();
|
||||
hash = (37 * hash) + OTPTIME_FIELD_NUMBER;
|
||||
hash = (53 * hash) + getOtpTime();
|
||||
hash = (37 * hash) + MODE_FIELD_NUMBER;
|
||||
hash = (53 * hash) + getMode();
|
||||
if (hasMode()) {
|
||||
hash = (37 * hash) + MODE_FIELD_NUMBER;
|
||||
hash = (53 * hash) + getMode().hashCode();
|
||||
}
|
||||
hash = (37 * hash) + ARRIVETIME_FIELD_NUMBER;
|
||||
hash = (53 * hash) + com.google.protobuf.Internal.hashLong(
|
||||
getArriveTime());
|
||||
@ -1313,7 +1364,11 @@ public final class TrainProto {
|
||||
rollingStock_ = 0;
|
||||
driverId_ = "";
|
||||
otpTime_ = 0;
|
||||
mode_ = 0;
|
||||
mode_ = null;
|
||||
if (modeBuilder_ != null) {
|
||||
modeBuilder_.dispose();
|
||||
modeBuilder_ = null;
|
||||
}
|
||||
arriveTime_ = 0L;
|
||||
departTime_ = 0L;
|
||||
speed_ = 0F;
|
||||
@ -1396,7 +1451,9 @@ public final class TrainProto {
|
||||
result.otpTime_ = otpTime_;
|
||||
}
|
||||
if (((from_bitField0_ & 0x00002000) != 0)) {
|
||||
result.mode_ = mode_;
|
||||
result.mode_ = modeBuilder_ == null
|
||||
? mode_
|
||||
: modeBuilder_.build();
|
||||
}
|
||||
if (((from_bitField0_ & 0x00004000) != 0)) {
|
||||
result.arriveTime_ = arriveTime_;
|
||||
@ -1484,8 +1541,8 @@ public final class TrainProto {
|
||||
if (other.getOtpTime() != 0) {
|
||||
setOtpTime(other.getOtpTime());
|
||||
}
|
||||
if (other.getMode() != 0) {
|
||||
setMode(other.getMode());
|
||||
if (other.hasMode()) {
|
||||
mergeMode(other.getMode());
|
||||
}
|
||||
if (other.getArriveTime() != 0L) {
|
||||
setArriveTime(other.getArriveTime());
|
||||
@ -1601,11 +1658,13 @@ public final class TrainProto {
|
||||
bitField0_ |= 0x00001000;
|
||||
break;
|
||||
} // case 104
|
||||
case 112: {
|
||||
mode_ = input.readInt32();
|
||||
case 114: {
|
||||
input.readMessage(
|
||||
getModeFieldBuilder().getBuilder(),
|
||||
extensionRegistry);
|
||||
bitField0_ |= 0x00002000;
|
||||
break;
|
||||
} // case 112
|
||||
} // case 114
|
||||
case 120: {
|
||||
arriveTime_ = input.readInt64();
|
||||
bitField0_ |= 0x00004000;
|
||||
@ -2622,31 +2681,54 @@ public final class TrainProto {
|
||||
return this;
|
||||
}
|
||||
|
||||
private int mode_ ;
|
||||
private club.joylink.xiannccda.dto.protos.DeviceStatusProto.TrainMode mode_;
|
||||
private com.google.protobuf.SingleFieldBuilderV3<
|
||||
club.joylink.xiannccda.dto.protos.DeviceStatusProto.TrainMode, club.joylink.xiannccda.dto.protos.DeviceStatusProto.TrainMode.Builder, club.joylink.xiannccda.dto.protos.DeviceStatusProto.TrainModeOrBuilder> modeBuilder_;
|
||||
/**
|
||||
* <pre>
|
||||
* 列车状态
|
||||
* int32 mode = 14;
|
||||
* </pre>
|
||||
*
|
||||
* <code>int32 mode = 14;</code>
|
||||
* @return The mode.
|
||||
* <code>.state.TrainMode mode = 14;</code>
|
||||
* @return Whether the mode field is set.
|
||||
*/
|
||||
@java.lang.Override
|
||||
public int getMode() {
|
||||
return mode_;
|
||||
public boolean hasMode() {
|
||||
return ((bitField0_ & 0x00002000) != 0);
|
||||
}
|
||||
/**
|
||||
* <pre>
|
||||
* 列车状态
|
||||
* int32 mode = 14;
|
||||
* </pre>
|
||||
*
|
||||
* <code>int32 mode = 14;</code>
|
||||
* @param value The mode to set.
|
||||
* @return This builder for chaining.
|
||||
* <code>.state.TrainMode mode = 14;</code>
|
||||
* @return The mode.
|
||||
*/
|
||||
public Builder setMode(int value) {
|
||||
|
||||
mode_ = value;
|
||||
public club.joylink.xiannccda.dto.protos.DeviceStatusProto.TrainMode getMode() {
|
||||
if (modeBuilder_ == null) {
|
||||
return mode_ == null ? club.joylink.xiannccda.dto.protos.DeviceStatusProto.TrainMode.getDefaultInstance() : mode_;
|
||||
} else {
|
||||
return modeBuilder_.getMessage();
|
||||
}
|
||||
}
|
||||
/**
|
||||
* <pre>
|
||||
* 列车状态
|
||||
* int32 mode = 14;
|
||||
* </pre>
|
||||
*
|
||||
* <code>.state.TrainMode mode = 14;</code>
|
||||
*/
|
||||
public Builder setMode(club.joylink.xiannccda.dto.protos.DeviceStatusProto.TrainMode value) {
|
||||
if (modeBuilder_ == null) {
|
||||
if (value == null) {
|
||||
throw new NullPointerException();
|
||||
}
|
||||
mode_ = value;
|
||||
} else {
|
||||
modeBuilder_.setMessage(value);
|
||||
}
|
||||
bitField0_ |= 0x00002000;
|
||||
onChanged();
|
||||
return this;
|
||||
@ -2654,17 +2736,114 @@ public final class TrainProto {
|
||||
/**
|
||||
* <pre>
|
||||
* 列车状态
|
||||
* int32 mode = 14;
|
||||
* </pre>
|
||||
*
|
||||
* <code>int32 mode = 14;</code>
|
||||
* @return This builder for chaining.
|
||||
* <code>.state.TrainMode mode = 14;</code>
|
||||
*/
|
||||
public Builder setMode(
|
||||
club.joylink.xiannccda.dto.protos.DeviceStatusProto.TrainMode.Builder builderForValue) {
|
||||
if (modeBuilder_ == null) {
|
||||
mode_ = builderForValue.build();
|
||||
} else {
|
||||
modeBuilder_.setMessage(builderForValue.build());
|
||||
}
|
||||
bitField0_ |= 0x00002000;
|
||||
onChanged();
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* <pre>
|
||||
* 列车状态
|
||||
* int32 mode = 14;
|
||||
* </pre>
|
||||
*
|
||||
* <code>.state.TrainMode mode = 14;</code>
|
||||
*/
|
||||
public Builder mergeMode(club.joylink.xiannccda.dto.protos.DeviceStatusProto.TrainMode value) {
|
||||
if (modeBuilder_ == null) {
|
||||
if (((bitField0_ & 0x00002000) != 0) &&
|
||||
mode_ != null &&
|
||||
mode_ != club.joylink.xiannccda.dto.protos.DeviceStatusProto.TrainMode.getDefaultInstance()) {
|
||||
getModeBuilder().mergeFrom(value);
|
||||
} else {
|
||||
mode_ = value;
|
||||
}
|
||||
} else {
|
||||
modeBuilder_.mergeFrom(value);
|
||||
}
|
||||
bitField0_ |= 0x00002000;
|
||||
onChanged();
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* <pre>
|
||||
* 列车状态
|
||||
* int32 mode = 14;
|
||||
* </pre>
|
||||
*
|
||||
* <code>.state.TrainMode mode = 14;</code>
|
||||
*/
|
||||
public Builder clearMode() {
|
||||
bitField0_ = (bitField0_ & ~0x00002000);
|
||||
mode_ = 0;
|
||||
mode_ = null;
|
||||
if (modeBuilder_ != null) {
|
||||
modeBuilder_.dispose();
|
||||
modeBuilder_ = null;
|
||||
}
|
||||
onChanged();
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* <pre>
|
||||
* 列车状态
|
||||
* int32 mode = 14;
|
||||
* </pre>
|
||||
*
|
||||
* <code>.state.TrainMode mode = 14;</code>
|
||||
*/
|
||||
public club.joylink.xiannccda.dto.protos.DeviceStatusProto.TrainMode.Builder getModeBuilder() {
|
||||
bitField0_ |= 0x00002000;
|
||||
onChanged();
|
||||
return getModeFieldBuilder().getBuilder();
|
||||
}
|
||||
/**
|
||||
* <pre>
|
||||
* 列车状态
|
||||
* int32 mode = 14;
|
||||
* </pre>
|
||||
*
|
||||
* <code>.state.TrainMode mode = 14;</code>
|
||||
*/
|
||||
public club.joylink.xiannccda.dto.protos.DeviceStatusProto.TrainModeOrBuilder getModeOrBuilder() {
|
||||
if (modeBuilder_ != null) {
|
||||
return modeBuilder_.getMessageOrBuilder();
|
||||
} else {
|
||||
return mode_ == null ?
|
||||
club.joylink.xiannccda.dto.protos.DeviceStatusProto.TrainMode.getDefaultInstance() : mode_;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* <pre>
|
||||
* 列车状态
|
||||
* int32 mode = 14;
|
||||
* </pre>
|
||||
*
|
||||
* <code>.state.TrainMode mode = 14;</code>
|
||||
*/
|
||||
private com.google.protobuf.SingleFieldBuilderV3<
|
||||
club.joylink.xiannccda.dto.protos.DeviceStatusProto.TrainMode, club.joylink.xiannccda.dto.protos.DeviceStatusProto.TrainMode.Builder, club.joylink.xiannccda.dto.protos.DeviceStatusProto.TrainModeOrBuilder>
|
||||
getModeFieldBuilder() {
|
||||
if (modeBuilder_ == null) {
|
||||
modeBuilder_ = new com.google.protobuf.SingleFieldBuilderV3<
|
||||
club.joylink.xiannccda.dto.protos.DeviceStatusProto.TrainMode, club.joylink.xiannccda.dto.protos.DeviceStatusProto.TrainMode.Builder, club.joylink.xiannccda.dto.protos.DeviceStatusProto.TrainModeOrBuilder>(
|
||||
getMode(),
|
||||
getParentForChildren(),
|
||||
isClean());
|
||||
mode_ = null;
|
||||
}
|
||||
return modeBuilder_;
|
||||
}
|
||||
|
||||
private long arriveTime_ ;
|
||||
/**
|
||||
@ -3639,10 +3818,20 @@ public final class TrainProto {
|
||||
* 列车标示号,全线唯一(若无法提供,缺省值为0)
|
||||
* </pre>
|
||||
*
|
||||
* <code>int32 trainIndex = 6;</code>
|
||||
* <code>string trainIndex = 6;</code>
|
||||
* @return The trainIndex.
|
||||
*/
|
||||
int getTrainIndex();
|
||||
java.lang.String getTrainIndex();
|
||||
/**
|
||||
* <pre>
|
||||
* 列车标示号,全线唯一(若无法提供,缺省值为0)
|
||||
* </pre>
|
||||
*
|
||||
* <code>string trainIndex = 6;</code>
|
||||
* @return The bytes for trainIndex.
|
||||
*/
|
||||
com.google.protobuf.ByteString
|
||||
getTrainIndexBytes();
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
@ -3683,6 +3872,7 @@ public final class TrainProto {
|
||||
private TrainRemove() {
|
||||
deviceType_ = 0;
|
||||
devName_ = "";
|
||||
trainIndex_ = "";
|
||||
groupId_ = "";
|
||||
}
|
||||
|
||||
@ -3839,18 +4029,50 @@ public final class TrainProto {
|
||||
}
|
||||
|
||||
public static final int TRAININDEX_FIELD_NUMBER = 6;
|
||||
private int trainIndex_ = 0;
|
||||
@SuppressWarnings("serial")
|
||||
private volatile java.lang.Object trainIndex_ = "";
|
||||
/**
|
||||
* <pre>
|
||||
* 列车标示号,全线唯一(若无法提供,缺省值为0)
|
||||
* </pre>
|
||||
*
|
||||
* <code>int32 trainIndex = 6;</code>
|
||||
* <code>string trainIndex = 6;</code>
|
||||
* @return The trainIndex.
|
||||
*/
|
||||
@java.lang.Override
|
||||
public int getTrainIndex() {
|
||||
return trainIndex_;
|
||||
public java.lang.String getTrainIndex() {
|
||||
java.lang.Object ref = trainIndex_;
|
||||
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();
|
||||
trainIndex_ = s;
|
||||
return s;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* <pre>
|
||||
* 列车标示号,全线唯一(若无法提供,缺省值为0)
|
||||
* </pre>
|
||||
*
|
||||
* <code>string trainIndex = 6;</code>
|
||||
* @return The bytes for trainIndex.
|
||||
*/
|
||||
@java.lang.Override
|
||||
public com.google.protobuf.ByteString
|
||||
getTrainIndexBytes() {
|
||||
java.lang.Object ref = trainIndex_;
|
||||
if (ref instanceof java.lang.String) {
|
||||
com.google.protobuf.ByteString b =
|
||||
com.google.protobuf.ByteString.copyFromUtf8(
|
||||
(java.lang.String) ref);
|
||||
trainIndex_ = b;
|
||||
return b;
|
||||
} else {
|
||||
return (com.google.protobuf.ByteString) ref;
|
||||
}
|
||||
}
|
||||
|
||||
public static final int GROUPID_FIELD_NUMBER = 7;
|
||||
@ -3929,8 +4151,8 @@ public final class TrainProto {
|
||||
if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(devName_)) {
|
||||
com.google.protobuf.GeneratedMessageV3.writeString(output, 5, devName_);
|
||||
}
|
||||
if (trainIndex_ != 0) {
|
||||
output.writeInt32(6, trainIndex_);
|
||||
if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(trainIndex_)) {
|
||||
com.google.protobuf.GeneratedMessageV3.writeString(output, 6, trainIndex_);
|
||||
}
|
||||
if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(groupId_)) {
|
||||
com.google.protobuf.GeneratedMessageV3.writeString(output, 7, groupId_);
|
||||
@ -3963,9 +4185,8 @@ public final class TrainProto {
|
||||
if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(devName_)) {
|
||||
size += com.google.protobuf.GeneratedMessageV3.computeStringSize(5, devName_);
|
||||
}
|
||||
if (trainIndex_ != 0) {
|
||||
size += com.google.protobuf.CodedOutputStream
|
||||
.computeInt32Size(6, trainIndex_);
|
||||
if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(trainIndex_)) {
|
||||
size += com.google.protobuf.GeneratedMessageV3.computeStringSize(6, trainIndex_);
|
||||
}
|
||||
if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(groupId_)) {
|
||||
size += com.google.protobuf.GeneratedMessageV3.computeStringSize(7, groupId_);
|
||||
@ -3997,8 +4218,8 @@ public final class TrainProto {
|
||||
if (deviceType_ != other.deviceType_) return false;
|
||||
if (!getDevName()
|
||||
.equals(other.getDevName())) return false;
|
||||
if (getTrainIndex()
|
||||
!= other.getTrainIndex()) return false;
|
||||
if (!getTrainIndex()
|
||||
.equals(other.getTrainIndex())) return false;
|
||||
if (!getGroupId()
|
||||
.equals(other.getGroupId())) return false;
|
||||
if (!getUnknownFields().equals(other.getUnknownFields())) return false;
|
||||
@ -4025,7 +4246,7 @@ public final class TrainProto {
|
||||
hash = (37 * hash) + DEVNAME_FIELD_NUMBER;
|
||||
hash = (53 * hash) + getDevName().hashCode();
|
||||
hash = (37 * hash) + TRAININDEX_FIELD_NUMBER;
|
||||
hash = (53 * hash) + getTrainIndex();
|
||||
hash = (53 * hash) + getTrainIndex().hashCode();
|
||||
hash = (37 * hash) + GROUPID_FIELD_NUMBER;
|
||||
hash = (53 * hash) + getGroupId().hashCode();
|
||||
hash = (29 * hash) + getUnknownFields().hashCode();
|
||||
@ -4172,7 +4393,7 @@ public final class TrainProto {
|
||||
}
|
||||
deviceType_ = 0;
|
||||
devName_ = "";
|
||||
trainIndex_ = 0;
|
||||
trainIndex_ = "";
|
||||
groupId_ = "";
|
||||
return this;
|
||||
}
|
||||
@ -4261,8 +4482,10 @@ public final class TrainProto {
|
||||
bitField0_ |= 0x00000010;
|
||||
onChanged();
|
||||
}
|
||||
if (other.getTrainIndex() != 0) {
|
||||
setTrainIndex(other.getTrainIndex());
|
||||
if (!other.getTrainIndex().isEmpty()) {
|
||||
trainIndex_ = other.trainIndex_;
|
||||
bitField0_ |= 0x00000020;
|
||||
onChanged();
|
||||
}
|
||||
if (!other.getGroupId().isEmpty()) {
|
||||
groupId_ = other.groupId_;
|
||||
@ -4322,11 +4545,11 @@ public final class TrainProto {
|
||||
bitField0_ |= 0x00000010;
|
||||
break;
|
||||
} // case 42
|
||||
case 48: {
|
||||
trainIndex_ = input.readInt32();
|
||||
case 50: {
|
||||
trainIndex_ = input.readStringRequireUtf8();
|
||||
bitField0_ |= 0x00000020;
|
||||
break;
|
||||
} // case 48
|
||||
} // case 50
|
||||
case 58: {
|
||||
groupId_ = input.readStringRequireUtf8();
|
||||
bitField0_ |= 0x00000040;
|
||||
@ -4734,30 +4957,60 @@ public final class TrainProto {
|
||||
return this;
|
||||
}
|
||||
|
||||
private int trainIndex_ ;
|
||||
private java.lang.Object trainIndex_ = "";
|
||||
/**
|
||||
* <pre>
|
||||
* 列车标示号,全线唯一(若无法提供,缺省值为0)
|
||||
* </pre>
|
||||
*
|
||||
* <code>int32 trainIndex = 6;</code>
|
||||
* <code>string trainIndex = 6;</code>
|
||||
* @return The trainIndex.
|
||||
*/
|
||||
@java.lang.Override
|
||||
public int getTrainIndex() {
|
||||
return trainIndex_;
|
||||
public java.lang.String getTrainIndex() {
|
||||
java.lang.Object ref = trainIndex_;
|
||||
if (!(ref instanceof java.lang.String)) {
|
||||
com.google.protobuf.ByteString bs =
|
||||
(com.google.protobuf.ByteString) ref;
|
||||
java.lang.String s = bs.toStringUtf8();
|
||||
trainIndex_ = s;
|
||||
return s;
|
||||
} else {
|
||||
return (java.lang.String) ref;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* <pre>
|
||||
* 列车标示号,全线唯一(若无法提供,缺省值为0)
|
||||
* </pre>
|
||||
*
|
||||
* <code>int32 trainIndex = 6;</code>
|
||||
* <code>string trainIndex = 6;</code>
|
||||
* @return The bytes for trainIndex.
|
||||
*/
|
||||
public com.google.protobuf.ByteString
|
||||
getTrainIndexBytes() {
|
||||
java.lang.Object ref = trainIndex_;
|
||||
if (ref instanceof String) {
|
||||
com.google.protobuf.ByteString b =
|
||||
com.google.protobuf.ByteString.copyFromUtf8(
|
||||
(java.lang.String) ref);
|
||||
trainIndex_ = b;
|
||||
return b;
|
||||
} else {
|
||||
return (com.google.protobuf.ByteString) ref;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* <pre>
|
||||
* 列车标示号,全线唯一(若无法提供,缺省值为0)
|
||||
* </pre>
|
||||
*
|
||||
* <code>string trainIndex = 6;</code>
|
||||
* @param value The trainIndex to set.
|
||||
* @return This builder for chaining.
|
||||
*/
|
||||
public Builder setTrainIndex(int value) {
|
||||
|
||||
public Builder setTrainIndex(
|
||||
java.lang.String value) {
|
||||
if (value == null) { throw new NullPointerException(); }
|
||||
trainIndex_ = value;
|
||||
bitField0_ |= 0x00000020;
|
||||
onChanged();
|
||||
@ -4768,12 +5021,30 @@ public final class TrainProto {
|
||||
* 列车标示号,全线唯一(若无法提供,缺省值为0)
|
||||
* </pre>
|
||||
*
|
||||
* <code>int32 trainIndex = 6;</code>
|
||||
* <code>string trainIndex = 6;</code>
|
||||
* @return This builder for chaining.
|
||||
*/
|
||||
public Builder clearTrainIndex() {
|
||||
trainIndex_ = getDefaultInstance().getTrainIndex();
|
||||
bitField0_ = (bitField0_ & ~0x00000020);
|
||||
trainIndex_ = 0;
|
||||
onChanged();
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* <pre>
|
||||
* 列车标示号,全线唯一(若无法提供,缺省值为0)
|
||||
* </pre>
|
||||
*
|
||||
* <code>string trainIndex = 6;</code>
|
||||
* @param value The bytes for trainIndex to set.
|
||||
* @return This builder for chaining.
|
||||
*/
|
||||
public Builder setTrainIndexBytes(
|
||||
com.google.protobuf.ByteString value) {
|
||||
if (value == null) { throw new NullPointerException(); }
|
||||
checkByteStringIsUtf8(value);
|
||||
trainIndex_ = value;
|
||||
bitField0_ |= 0x00000020;
|
||||
onChanged();
|
||||
return this;
|
||||
}
|
||||
@ -8607,36 +8878,36 @@ public final class TrainProto {
|
||||
static {
|
||||
java.lang.String[] descriptorData = {
|
||||
"\n\013train.proto\022\005train\032\023device_status.prot" +
|
||||
"o\"\231\003\n\tTrainInfo\022\016\n\006lineId\030\001 \001(\005\022\r\n\005rtuId" +
|
||||
"o\"\253\003\n\tTrainInfo\022\016\n\006lineId\030\001 \001(\005\022\r\n\005rtuId" +
|
||||
"\030\002 \001(\005\022 \n\006window\030\003 \001(\0132\020.train.NccWindow" +
|
||||
"\022\"\n\007devType\030\004 \001(\0162\021.state.DeviceType\022\017\n\007" +
|
||||
"devName\030\005 \001(\t\022\022\n\ntrainIndex\030\006 \001(\t\022\017\n\007gro" +
|
||||
"upId\030\007 \001(\t\022\017\n\007trainId\030\010 \001(\t\022\020\n\010globalId\030" +
|
||||
"\t \001(\t\022\025\n\rdestinationId\030\n \001(\005\022\024\n\014rollingS" +
|
||||
"tock\030\013 \001(\005\022\020\n\010driverId\030\014 \001(\t\022\017\n\007otpTime\030" +
|
||||
"\r \001(\005\022\014\n\004mode\030\016 \001(\005\022\022\n\narriveTime\030\017 \001(\003\022" +
|
||||
"\022\n\ndepartTime\030\020 \001(\003\022\r\n\005speed\030\021 \001(\002\022\014\n\004sh" +
|
||||
"ow\030\022 \001(\010\022\014\n\004type\030\023 \001(\010\022\017\n\007routeId\030\024 \001(\005\022" +
|
||||
"\014\n\004rate\030\025 \001(\005\"4\n\tNccWindow\022\021\n\tnccWindow\030" +
|
||||
"\001 \001(\005\022\024\n\014nccWinOffset\030\002 \001(\005\"\253\001\n\013TrainRem" +
|
||||
"ove\022\016\n\006lineId\030\001 \001(\005\022\r\n\005rtuId\030\002 \001(\005\022 \n\006wi" +
|
||||
"ndow\030\003 \001(\0132\020.train.NccWindow\022%\n\ndeviceTy" +
|
||||
"pe\030\004 \001(\0162\021.state.DeviceType\022\017\n\007devName\030\005" +
|
||||
" \001(\t\022\022\n\ntrainIndex\030\006 \001(\005\022\017\n\007groupId\030\007 \001(" +
|
||||
"\t\"\343\001\n\nTrainBlock\022\016\n\006lineId\030\001 \001(\005\022\017\n\007grou" +
|
||||
"pId\030\002 \001(\t\022\017\n\007trainId\030\003 \001(\t\022\021\n\tdirection\030" +
|
||||
"\004 \001(\005\022\031\n\021stationIDInUpSide\030\005 \001(\005\022\033\n\023stat" +
|
||||
"ionIDInDownSide\030\006 \001(\005\022\r\n\005rtuId\030\007 \001(\005\022%\n\n" +
|
||||
"deviceType\030\010 \001(\0162\021.state.DeviceType\022\017\n\007D" +
|
||||
"evName\030\t \001(\t\022\021\n\tblockFlag\030\n \001(\005\"\372\001\n\013Trai" +
|
||||
"nRecord\022\016\n\006lineId\030\001 \001(\005\022\017\n\007trainId\030\002 \001(\t" +
|
||||
"\022\020\n\010globalId\030\003 \001(\t\022\022\n\nlocalSubId\030\004 \001(\005\022\017" +
|
||||
"\n\007groupId\030\005 \001(\t\022\025\n\rdestinationId\030\006 \001(\005\022\021" +
|
||||
"\n\ttrainType\030\007 \001(\005\022\013\n\003dir\030\010 \001(\005\022\021\n\tstatio" +
|
||||
"nId\030\t \001(\005\022\016\n\006sideId\030\n \001(\005\022\021\n\ttrackName\030\013" +
|
||||
" \001(\t\022\022\n\nrecordType\030\014 \001(\010\022\022\n\nrecordTime\030\r" +
|
||||
" \001(\003B/\n!club.joylink.xiannccda.dto.proto" +
|
||||
"sB\nTrainProtob\006proto3"
|
||||
"\r \001(\005\022\036\n\004mode\030\016 \001(\0132\020.state.TrainMode\022\022\n" +
|
||||
"\narriveTime\030\017 \001(\003\022\022\n\ndepartTime\030\020 \001(\003\022\r\n" +
|
||||
"\005speed\030\021 \001(\002\022\014\n\004show\030\022 \001(\010\022\014\n\004type\030\023 \001(\010" +
|
||||
"\022\017\n\007routeId\030\024 \001(\005\022\014\n\004rate\030\025 \001(\005\"4\n\tNccWi" +
|
||||
"ndow\022\021\n\tnccWindow\030\001 \001(\005\022\024\n\014nccWinOffset\030" +
|
||||
"\002 \001(\005\"\253\001\n\013TrainRemove\022\016\n\006lineId\030\001 \001(\005\022\r\n" +
|
||||
"\005rtuId\030\002 \001(\005\022 \n\006window\030\003 \001(\0132\020.train.Ncc" +
|
||||
"Window\022%\n\ndeviceType\030\004 \001(\0162\021.state.Devic" +
|
||||
"eType\022\017\n\007devName\030\005 \001(\t\022\022\n\ntrainIndex\030\006 \001" +
|
||||
"(\t\022\017\n\007groupId\030\007 \001(\t\"\343\001\n\nTrainBlock\022\016\n\006li" +
|
||||
"neId\030\001 \001(\005\022\017\n\007groupId\030\002 \001(\t\022\017\n\007trainId\030\003" +
|
||||
" \001(\t\022\021\n\tdirection\030\004 \001(\005\022\031\n\021stationIDInUp" +
|
||||
"Side\030\005 \001(\005\022\033\n\023stationIDInDownSide\030\006 \001(\005\022" +
|
||||
"\r\n\005rtuId\030\007 \001(\005\022%\n\ndeviceType\030\010 \001(\0162\021.sta" +
|
||||
"te.DeviceType\022\017\n\007DevName\030\t \001(\t\022\021\n\tblockF" +
|
||||
"lag\030\n \001(\005\"\372\001\n\013TrainRecord\022\016\n\006lineId\030\001 \001(" +
|
||||
"\005\022\017\n\007trainId\030\002 \001(\t\022\020\n\010globalId\030\003 \001(\t\022\022\n\n" +
|
||||
"localSubId\030\004 \001(\005\022\017\n\007groupId\030\005 \001(\t\022\025\n\rdes" +
|
||||
"tinationId\030\006 \001(\005\022\021\n\ttrainType\030\007 \001(\005\022\013\n\003d" +
|
||||
"ir\030\010 \001(\005\022\021\n\tstationId\030\t \001(\005\022\016\n\006sideId\030\n " +
|
||||
"\001(\005\022\021\n\ttrackName\030\013 \001(\t\022\022\n\nrecordType\030\014 \001" +
|
||||
"(\010\022\022\n\nrecordTime\030\r \001(\003B/\n!club.joylink.x" +
|
||||
"iannccda.dto.protosB\nTrainProtob\006proto3"
|
||||
};
|
||||
descriptor = com.google.protobuf.Descriptors.FileDescriptor
|
||||
.internalBuildGeneratedFileFrom(descriptorData,
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -20,4 +20,6 @@ public interface IPublishedGiRepository extends IService<PublishedGi> {
|
||||
List<PublishedGi> list(PublishedGIQueryDTO query);
|
||||
|
||||
PublishedGi queryByDto(PublishedGIQueryDTO query);
|
||||
|
||||
List<PublishedGi> listWithProto(PublishedGIQueryDTO query);
|
||||
}
|
||||
|
@ -1,6 +1,5 @@
|
||||
package club.joylink.xiannccda.repository.impl;
|
||||
|
||||
import club.joylink.xiannccda.dto.PublishedGIDTO.LineType;
|
||||
import club.joylink.xiannccda.dto.PublishedGIQueryDTO;
|
||||
import club.joylink.xiannccda.entity.PublishedGi;
|
||||
import club.joylink.xiannccda.mapper.PublishedGiMapper;
|
||||
@ -44,6 +43,12 @@ public class PublishedGiRepository extends ServiceImpl<PublishedGiMapper, Publis
|
||||
return getOne(wrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PublishedGi> listWithProto(PublishedGIQueryDTO query) {
|
||||
LambdaQueryWrapper<PublishedGi> wrapper = getQueryWrapper(query);
|
||||
return list(wrapper);
|
||||
}
|
||||
|
||||
private static LambdaQueryWrapper<PublishedGi> getQueryWrapper(PublishedGIQueryDTO query) {
|
||||
LambdaQueryWrapper<PublishedGi> wrapper = Wrappers.lambdaQuery();
|
||||
if (StringUtils.isNotEmpty(query.getName())) {
|
||||
|
@ -1,5 +1,6 @@
|
||||
package club.joylink.xiannccda.service;
|
||||
|
||||
import club.joylink.xiannccda.ats.cache.LineGraphicDataRepository;
|
||||
import club.joylink.xiannccda.dto.PublishedGIDTO;
|
||||
import club.joylink.xiannccda.dto.PublishedGIDTO.LineType;
|
||||
import club.joylink.xiannccda.entity.Drafting;
|
||||
@ -85,6 +86,7 @@ public class PublishedGiService {
|
||||
publishedGi.setUserId(Integer.valueOf(user.getName()));
|
||||
publishedGi.setPublishAt(LocalDateTime.now());
|
||||
publishedGiRepository.save(publishedGi);
|
||||
LineGraphicDataRepository.putLineGraph(publishedGi); // 发布后更新内存里的数据
|
||||
return publishedGi;
|
||||
}
|
||||
}
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit 911d1999d0df58db7fefb59471487bd5c524269f
|
||||
Subproject commit 39c150153d2bfa730d4ef6843f7bf87e5002b530
|
Loading…
Reference in New Issue
Block a user