【注释部分代码,数据正确后再处理】

This commit is contained in:
weizhihong 2023-07-18 16:12:13 +08:00
parent a81568ebfb
commit 0eec98f251
5 changed files with 2371 additions and 282 deletions

View File

@ -19,21 +19,15 @@ import lombok.Getter;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
/** /** 发布时缓存在内存中的线路数据 */
* 发布时缓存在内存中的线路数据
*/
@Slf4j @Slf4j
public class LineGraphicDataRepository { public class LineGraphicDataRepository {
/** /** 线路数据信息 */
* 线路数据信息
*/
private static final Map<Integer, Map<String, Map<String, Builder>>> lineGraphMap = private static final Map<Integer, Map<String, Map<String, Builder>>> lineGraphMap =
new ConcurrentHashMap<>(); new ConcurrentHashMap<>();
/** /** 线路各坐标系转换关系 */
* 线路各坐标系转换关系
*/
private static final Map<Integer, Map<String, CoordinateConvertor>> lineCoordinateMain = private static final Map<Integer, Map<String, CoordinateConvertor>> lineCoordinateMain =
new HashMap<>(); new HashMap<>();
@ -65,7 +59,7 @@ public class LineGraphicDataRepository {
/** /**
* 获取线路上区段名为sectionName的公里标 * 获取线路上区段名为sectionName的公里标
* *
* @param lineId 线路ID * @param lineId 线路ID
* @param sectionName 区段名称 * @param sectionName 区段名称
* @return 公里标 * @return 公里标
*/ */
@ -91,9 +85,7 @@ public class LineGraphicDataRepository {
return List.of(); return List.of();
} }
/** /** 删除线路绘图数据 */
* 删除线路绘图数据
*/
public static void removeLineGraph(Integer id) { public static void removeLineGraph(Integer id) {
lineGraphMap.remove(id); lineGraphMap.remove(id);
} }
@ -101,7 +93,7 @@ public class LineGraphicDataRepository {
/** /**
* 构建程序中的区段信息 * 构建程序中的区段信息
* *
* @param lineId 线路ID * @param lineId 线路ID
* @param dataMap 缓存数据 * @param dataMap 缓存数据
* @param storage 地图构建数据 * @param storage 地图构建数据
*/ */
@ -121,7 +113,8 @@ public class LineGraphicDataRepository {
? (DeviceInfoProto.Section.Builder) cacheSectionMap.get(sid) ? (DeviceInfoProto.Section.Builder) cacheSectionMap.get(sid)
: DeviceInfoProto.Section.newBuilder().setId(sid); : DeviceInfoProto.Section.newBuilder().setId(sid);
sectionBuilder.setCode(section.getCode()); sectionBuilder.setCode(section.getCode());
sectionBuilder.setType(section.getSectionType()); // 暂时先注释等数据正确后再做处理
// sectionBuilder.setType(section.getSectionType());
cacheSectionMap.put(sid, sectionBuilder); cacheSectionMap.put(sid, sectionBuilder);
}); });
dataMap.put(DeviceType.Section.name(), cacheSectionMap); dataMap.put(DeviceType.Section.name(), cacheSectionMap);
@ -130,7 +123,7 @@ public class LineGraphicDataRepository {
/** /**
* 构建道岔信息 * 构建道岔信息
* *
* @param lineId 线路ID * @param lineId 线路ID
* @param dataMap 缓存数据 * @param dataMap 缓存数据
* @param storage 地图构建数据 * @param storage 地图构建数据
*/ */
@ -181,7 +174,7 @@ public class LineGraphicDataRepository {
/** /**
* 设置公里标 * 设置公里标
* *
* @param lineId 线路ID * @param lineId 线路ID
* @param dataMap 缓存数据 * @param dataMap 缓存数据
* @param storage 地图构建数据 * @param storage 地图构建数据
*/ */
@ -232,7 +225,7 @@ public class LineGraphicDataRepository {
/** /**
* 初始化坐标转换对象 * 初始化坐标转换对象
* *
* @param lineId 线路ID * @param lineId 线路ID
* @param dataMap 设备集合 * @param dataMap 设备集合
* @param storage 地图信息 * @param storage 地图信息
*/ */
@ -324,9 +317,7 @@ public class LineGraphicDataRepository {
return convertorMap.get(convertorKey).convertorKilometer(kilometer, CoordinateEnum.MAIN_LINE); return convertorMap.get(convertorKey).convertorKilometer(kilometer, CoordinateEnum.MAIN_LINE);
} }
/** /** 坐标系枚举 */
* 坐标系枚举
*/
@Getter @Getter
private enum CoordinateEnum { private enum CoordinateEnum {
MAIN_LINE("MAIN_LINE", List.of("YDK", "ZDK", "XDK", "SDK")), MAIN_LINE("MAIN_LINE", List.of("YDK", "ZDK", "XDK", "SDK")),
@ -371,9 +362,7 @@ public class LineGraphicDataRepository {
} }
} }
/** /** 坐标转换对象 */
* 坐标转换对象
*/
@Getter @Getter
private static class CoordinateConvertor { private static class CoordinateConvertor {
@ -388,8 +377,8 @@ public class LineGraphicDataRepository {
/** /**
* 生成坐标转换对象 * 生成坐标转换对象
* *
* @param configSystem 原配置坐标系信息 * @param configSystem 原配置坐标系信息
* @param convertorSystem 转换坐标系类型 * @param convertorSystem 转换坐标系类型
* @param convertorCoordinate 转换坐标 * @param convertorCoordinate 转换坐标
* @return 转换对象 * @return 转换对象
*/ */
@ -441,7 +430,7 @@ public class LineGraphicDataRepository {
* 将出入库公里标转换为正线标 * 将出入库公里标转换为正线标
* *
* @param basisKilometer 出入库基准公里标 * @param basisKilometer 出入库基准公里标
* @param targetType 目标坐标系 * @param targetType 目标坐标系
* @return 正线公里标数字 * @return 正线公里标数字
*/ */
public long convertorKilometer(KilometerSystem basisKilometer, CoordinateEnum targetType) { public long convertorKilometer(KilometerSystem basisKilometer, CoordinateEnum targetType) {

View File

@ -1,6 +1,5 @@
package club.joylink.xiannccda.controller; package club.joylink.xiannccda.controller;
import club.joylink.xiannccda.ats.cache.LineGraphicDataRepository;
import club.joylink.xiannccda.dto.PublishedGIDTO; import club.joylink.xiannccda.dto.PublishedGIDTO;
import club.joylink.xiannccda.dto.PublishedGIDTO.LineType; import club.joylink.xiannccda.dto.PublishedGIDTO.LineType;
import club.joylink.xiannccda.dto.PublishedGIQueryDTO; import club.joylink.xiannccda.dto.PublishedGIQueryDTO;

View File

@ -4,8 +4,6 @@ import club.joylink.xiannccda.ats.message.MessageData;
import club.joylink.xiannccda.ats.message.MessageId; import club.joylink.xiannccda.ats.message.MessageId;
import club.joylink.xiannccda.ats.message.collect.DeviceStatusConvertorManager; import club.joylink.xiannccda.ats.message.collect.DeviceStatusConvertorManager;
import club.joylink.xiannccda.ats.message.collect.DeviceDataRepository;
import club.joylink.xiannccda.ats.message.collect.DeviceStatusDataRepository;
import club.joylink.xiannccda.ats.message.collect.convertor.DeviceChangeStatusConvertor; import club.joylink.xiannccda.ats.message.collect.convertor.DeviceChangeStatusConvertor;
import club.joylink.xiannccda.ats.message.collect.convertor.DeviceInitConvertor; import club.joylink.xiannccda.ats.message.collect.convertor.DeviceInitConvertor;
import club.joylink.xiannccda.ats.message.collect.convertor.LineNetTrainInitConvertor; import club.joylink.xiannccda.ats.message.collect.convertor.LineNetTrainInitConvertor;
@ -16,9 +14,7 @@ import club.joylink.xiannccda.ats.message.collect.convertor.TrainInitConvertor;
import club.joylink.xiannccda.ats.message.collect.convertor.TrainRecordConvertor; import club.joylink.xiannccda.ats.message.collect.convertor.TrainRecordConvertor;
import club.joylink.xiannccda.ats.message.collect.convertor.TrainRemoveConvertor; import club.joylink.xiannccda.ats.message.collect.convertor.TrainRemoveConvertor;
import club.joylink.xiannccda.ats.message.collect.convertor.TrainUpdateConvertor; import club.joylink.xiannccda.ats.message.collect.convertor.TrainUpdateConvertor;
import club.joylink.xiannccda.ats.message.collect.datasource.DeviceStatusData;
import club.joylink.xiannccda.mock.message.NccMockDataService; import club.joylink.xiannccda.mock.message.NccMockDataService;
import club.joylink.xiannccda.ws.IMessageServer;
import club.joylink.xiannccda.ws.LineDeviceMessageServer; import club.joylink.xiannccda.ws.LineDeviceMessageServer;
import club.joylink.xiannccda.ws.LineNetMessageServer; import club.joylink.xiannccda.ws.LineNetMessageServer;
import club.joylink.xiannccda.ws.LineTrainMessageServer; import club.joylink.xiannccda.ws.LineTrainMessageServer;
@ -36,8 +32,6 @@ import org.springframework.stereotype.Service;
@Service @Service
public class LineDeviceStatusService { public class LineDeviceStatusService {
public static final String DATA_KEY = "lineNet";
private final WsMessageServerManager wsMessageServerManager; private final WsMessageServerManager wsMessageServerManager;
private final NccMockDataService nccMockDataService; private final NccMockDataService nccMockDataService;

@ -1 +1 @@
Subproject commit e8ac23070828a1eca3bd68b6f78e4e419123d139 Subproject commit f1dfb5e4bdcce8df58c34c0c2cbce545db559a68