From a5c2b0a2023a35430701a597a60013ede4194938 Mon Sep 17 00:00:00 2001 From: weizhihong Date: Tue, 4 Jul 2023 14:27:46 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E5=88=97=E8=BD=A6=E8=8E=B7=E5=8F=96?= =?UTF-8?q?=E5=85=AC=E9=87=8C=E6=A0=87=E6=9D=A1=E4=BB=B6=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E3=80=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ats/cache/LineGraphicDataRepository.java | 21 ------------------- .../convertor/LineNetTrainInitConvertor.java | 5 ++--- .../LineNetTrainRecordConvertor.java | 7 ++++--- .../LineNetTrainUpdateConvertor.java | 6 ++---- 4 files changed, 8 insertions(+), 31 deletions(-) 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 8f56e50..d6ec87a 100644 --- a/src/main/java/club/joylink/xiannccda/ats/cache/LineGraphicDataRepository.java +++ b/src/main/java/club/joylink/xiannccda/ats/cache/LineGraphicDataRepository.java @@ -1,7 +1,6 @@ package club.joylink.xiannccda.ats.cache; import club.joylink.xiannccda.dto.protos.DeviceInfoProto; -import club.joylink.xiannccda.dto.protos.DeviceInfoProto.Turnout; import club.joylink.xiannccda.dto.protos.LayoutGraphicsProto; import club.joylink.xiannccda.dto.protos.LayoutGraphicsProto.KilometerSystem; import club.joylink.xiannccda.dto.protos.LayoutGraphicsProto.RelatedRef.DeviceType; @@ -10,7 +9,6 @@ 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 io.swagger.v3.oas.models.security.SecurityScheme.In; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -33,16 +31,6 @@ public class LineGraphicDataRepository { private static final Map> lineCoordinateMain = new HashMap<>(); - /** - * 线路信息是否存在 - * - * @param lineCode 线路信息 - * @return 是否存在 - */ - public static boolean lineDataExists(Integer lineCode) { - return lineGraphMap.containsKey(lineCode); - } - /** * 缓存线路数据信息 * @@ -434,15 +422,6 @@ public class LineGraphicDataRepository { } } - /** - * 转换类型,这里根据两个坐标系来定 - * - * @return 类型字符串 - */ - private String getConvertorKey() { - return generateConvertorKey(configType, convertorType); - } - /** * 生成转换Key * diff --git a/src/main/java/club/joylink/xiannccda/ats/message/collect/convertor/LineNetTrainInitConvertor.java b/src/main/java/club/joylink/xiannccda/ats/message/collect/convertor/LineNetTrainInitConvertor.java index 6ccf629..40e59ac 100644 --- a/src/main/java/club/joylink/xiannccda/ats/message/collect/convertor/LineNetTrainInitConvertor.java +++ b/src/main/java/club/joylink/xiannccda/ats/message/collect/convertor/LineNetTrainInitConvertor.java @@ -18,9 +18,7 @@ import java.util.List; import java.util.Objects; import lombok.extern.slf4j.Slf4j; -/** - * 接收列车初始化消息,就收转换线网的列车数据 - */ +/** 接收列车初始化消息,就收转换线网的列车数据 */ @Slf4j public class LineNetTrainInitConvertor extends DeviceStatusConvertor { @@ -56,6 +54,7 @@ public class LineNetTrainInitConvertor extends DeviceStatusConvertor { LineGraphicDataRepository.getSectionDefaultKmCodeList( response.getLineId(), trainCell.getDevName()); if (CollectionUtils.isNotEmpty(kmCodeList)) { + offset.setShow(true); // 是否显示 offset.setKilometerCode(kmCodeList.get(0)); } } diff --git a/src/main/java/club/joylink/xiannccda/ats/message/collect/convertor/LineNetTrainRecordConvertor.java b/src/main/java/club/joylink/xiannccda/ats/message/collect/convertor/LineNetTrainRecordConvertor.java index 3050e36..c3063b0 100644 --- a/src/main/java/club/joylink/xiannccda/ats/message/collect/convertor/LineNetTrainRecordConvertor.java +++ b/src/main/java/club/joylink/xiannccda/ats/message/collect/convertor/LineNetTrainRecordConvertor.java @@ -42,17 +42,18 @@ public class LineNetTrainRecordConvertor extends DeviceStatusConvertor { offset.setLineId(response.getLineId()); // 线路id offset.setGroupId(response.getGroupId()); // 车组号 offset.setDir(response.getDirection().getValue()); // 初始设置无运行方向 - offset.setShow(true); // 显示 + offset.setShow(false); // 获取到当前区段公里标 List kmCodeList = LineGraphicDataRepository.getSectionDefaultKmCodeList( response.getLineId(), response.getTrackName()); if (CollectionUtils.isNotEmpty(kmCodeList)) { + offset.setShow(true); // 如果公里标存在则 long kilometer; if (offset.getDir() == 1) { // 下行取大值 - kilometer = kmCodeList.stream().max(Long::compareTo).get(); - } else if (offset.getDir() == 2) { // 上行取小值 kilometer = kmCodeList.stream().min(Long::compareTo).get(); + } else if (offset.getDir() == 2) { // 上行取小值 + kilometer = kmCodeList.stream().max(Long::compareTo).get(); } else { // 无方向获取第一个 kilometer = kmCodeList.get(0); } diff --git a/src/main/java/club/joylink/xiannccda/ats/message/collect/convertor/LineNetTrainUpdateConvertor.java b/src/main/java/club/joylink/xiannccda/ats/message/collect/convertor/LineNetTrainUpdateConvertor.java index 271e84a..83bc7b3 100644 --- a/src/main/java/club/joylink/xiannccda/ats/message/collect/convertor/LineNetTrainUpdateConvertor.java +++ b/src/main/java/club/joylink/xiannccda/ats/message/collect/convertor/LineNetTrainUpdateConvertor.java @@ -18,9 +18,7 @@ import java.util.List; import java.util.Objects; import lombok.extern.slf4j.Slf4j; -/** - * 列车信息更新时,信息转换 - */ +/** 列车信息更新时,信息转换 */ @Slf4j public class LineNetTrainUpdateConvertor extends DeviceStatusConvertor { @@ -47,13 +45,13 @@ public class LineNetTrainUpdateConvertor extends DeviceStatusConvertor { offset.setLineId(response.getLineId()); // 线路id offset.setTrainIndex(response.getTrainIndex()); // 列车标示号,全线唯一 offset.setGroupId(response.getGroupId()); // 车组号 - offset.setShow(true); // 是否显示 // 获取到当前区段公里标 if (DeviceType.DEVICE_TYPE_TRACK.equals(response.getDevType())) { List kmCodeList = LineGraphicDataRepository.getSectionDefaultKmCodeList( response.getLineId(), response.getDevName()); if (CollectionUtils.isNotEmpty(kmCodeList)) { + offset.setShow(true); // 是否显示 offset.setKilometerCode(kmCodeList.get(0)); } }