From ead852b95521d68be1ed4743d79c3bd62b3d9c70 Mon Sep 17 00:00:00 2001 From: weizhihong Date: Mon, 17 Jul 2023 14:16:59 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E5=A2=9E=E5=8A=A0=E8=AD=A6=E5=91=8A?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=E6=89=93=E5=8D=B0=EF=BC=8C=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E6=96=B9=E6=B3=95=E5=90=8D=E7=A7=B0=E3=80=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../xiannccda/ats/cache/LineGraphicDataRepository.java | 10 +++++++++- .../collect/convertor/LineNetTrainInitConvertor.java | 2 +- .../collect/convertor/LineNetTrainRecordConvertor.java | 4 +++- .../collect/convertor/LineNetTrainRemoveConvertor.java | 6 ++---- .../collect/convertor/LineNetTrainUpdateConvertor.java | 2 +- xian-ncc-da-message | 2 +- 6 files changed, 17 insertions(+), 9 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 dde9f8d..0ef6379 100644 --- a/src/main/java/club/joylink/xiannccda/ats/cache/LineGraphicDataRepository.java +++ b/src/main/java/club/joylink/xiannccda/ats/cache/LineGraphicDataRepository.java @@ -61,7 +61,7 @@ public class LineGraphicDataRepository { * @param sectionName 区段名称 * @return 公里标 */ - public static List getSectionDefaultKmCodeList(int lineId, String sectionName) { + public static List getKilometerCodeList(int lineId, String sectionName) { Map> lineDataMap = lineGraphMap.get(lineId); if (CollectionUtils.isNotEmpty(lineDataMap)) { Map sectionMap = lineDataMap.get(DeviceType.Section.name()); @@ -71,6 +71,14 @@ public class LineGraphicDataRepository { return builder.getConvertKilometerList(); } } + + Map turnoutMap = lineDataMap.get(DeviceType.Turnout.name()); + for (Builder v : turnoutMap.values()) { + DeviceInfoProto.Turnout.Builder builder = (DeviceInfoProto.Turnout.Builder) v; + if (Objects.equals(builder.getCode(), sectionName)) { + return builder.getConvertKilometerList(); + } + } } return List.of(); } 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 40e59ac..765964e 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 @@ -51,7 +51,7 @@ public class LineNetTrainInitConvertor extends DeviceStatusConvertor { // 获取到当前区段公里标 if (DeviceType.DEVICE_TYPE_TRACK.equals(trainCell.getDevType())) { List kmCodeList = - LineGraphicDataRepository.getSectionDefaultKmCodeList( + LineGraphicDataRepository.getKilometerCodeList( response.getLineId(), trainCell.getDevName()); if (CollectionUtils.isNotEmpty(kmCodeList)) { offset.setShow(true); // 是否显示 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 c3063b0..4873eb4 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 @@ -45,7 +45,7 @@ public class LineNetTrainRecordConvertor extends DeviceStatusConvertor { offset.setShow(false); // 获取到当前区段公里标 List kmCodeList = - LineGraphicDataRepository.getSectionDefaultKmCodeList( + LineGraphicDataRepository.getKilometerCodeList( response.getLineId(), response.getTrackName()); if (CollectionUtils.isNotEmpty(kmCodeList)) { offset.setShow(true); // 如果公里标存在则 @@ -58,6 +58,8 @@ public class LineNetTrainRecordConvertor extends DeviceStatusConvertor { kilometer = kmCodeList.get(0); } offset.setKilometerCode(kilometer); + } else { + log.warn(String.format("设备%s没有公里标信息", response.getTrackName())); } buildList.add(offset); } diff --git a/src/main/java/club/joylink/xiannccda/ats/message/collect/convertor/LineNetTrainRemoveConvertor.java b/src/main/java/club/joylink/xiannccda/ats/message/collect/convertor/LineNetTrainRemoveConvertor.java index 90b308f..c680696 100644 --- a/src/main/java/club/joylink/xiannccda/ats/message/collect/convertor/LineNetTrainRemoveConvertor.java +++ b/src/main/java/club/joylink/xiannccda/ats/message/collect/convertor/LineNetTrainRemoveConvertor.java @@ -17,9 +17,7 @@ import java.util.List; import java.util.Objects; import lombok.extern.slf4j.Slf4j; -/** - * 列车信息移除时,线网信息处理 - */ +/** 列车信息移除时,线网信息处理 */ @Slf4j public class LineNetTrainRemoveConvertor extends DeviceStatusConvertor { @@ -50,7 +48,7 @@ public class LineNetTrainRemoveConvertor extends DeviceStatusConvertor { // 获取到当前区段公里标 if (DeviceType.DEVICE_TYPE_TRACK.equals(response.getDevType())) { List kmCodeList = - LineGraphicDataRepository.getSectionDefaultKmCodeList( + LineGraphicDataRepository.getKilometerCodeList( response.getLineId(), response.getDevName()); if (CollectionUtils.isNotEmpty(kmCodeList)) { offset.setKilometerCode(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 83bc7b3..19c6a7d 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 @@ -48,7 +48,7 @@ public class LineNetTrainUpdateConvertor extends DeviceStatusConvertor { // 获取到当前区段公里标 if (DeviceType.DEVICE_TYPE_TRACK.equals(response.getDevType())) { List kmCodeList = - LineGraphicDataRepository.getSectionDefaultKmCodeList( + LineGraphicDataRepository.getKilometerCodeList( response.getLineId(), response.getDevName()); if (CollectionUtils.isNotEmpty(kmCodeList)) { offset.setShow(true); // 是否显示 diff --git a/xian-ncc-da-message b/xian-ncc-da-message index 874a6fe..e8ac230 160000 --- a/xian-ncc-da-message +++ b/xian-ncc-da-message @@ -1 +1 @@ -Subproject commit 874a6fe4fafcda375e7479e7da0d67d1061ab2f1 +Subproject commit e8ac23070828a1eca3bd68b6f78e4e419123d139