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