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 2e7dacf..77ed407 100644 --- a/src/main/java/club/joylink/xiannccda/ats/cache/LineGraphicDataRepository.java +++ b/src/main/java/club/joylink/xiannccda/ats/cache/LineGraphicDataRepository.java @@ -118,7 +118,7 @@ public class LineGraphicDataRepository { : DeviceInfoProto.Section.newBuilder().setId(sid); sectionBuilder.setCode(section.getCode()); if (section.getChildrenCount() > 0) { - sectionBuilder.getChildrenIdList().addAll(section.getChildrenList()); + sectionBuilder.addAllChildrenId(section.getChildrenList()); // 初始化逻辑区段信息,建立逻辑区段与物理区段之间的关系 section .getChildrenList() @@ -270,6 +270,7 @@ public class LineGraphicDataRepository { DeviceType.Turnout.equals(ref.getDeviceType()) && turnoutMap.containsKey(ref.getId())) .map(ref -> (DeviceInfoProto.Turnout.Builder) turnoutMap.get(ref.getId())) + .filter(t -> t.getKilometerSystemCount() > 0) .map(t -> t.getKilometerSystemList().get(0)) .toList(); // 如果关联多个道岔 @@ -354,6 +355,9 @@ public class LineGraphicDataRepository { if (sectionMap.containsKey(sid)) { DeviceInfoProto.Section.Builder sectionBuilder = (DeviceInfoProto.Section.Builder) sectionMap.get(sid); + if (sectionBuilder.getPhysicalSectionId().equals("118")) { + log.info(""); + } sectionBuilder.setCode(section.getCode()); // 获取到物理区段信息 DeviceInfoProto.Section.Builder physicalSection = @@ -367,9 +371,9 @@ public class LineGraphicDataRepository { long avgDistance = (max - min) / physicalSection.getChildrenIdCount(); int index = physicalSection.getChildrenIdList().indexOf(sid); // 最小公里标 - sectionBuilder.getConvertKilometerList().add(min + index * avgDistance); + sectionBuilder.addConvertKilometer(min + index * avgDistance); // 最大公里标 - sectionBuilder.getConvertKilometerList().add(min + (index + 1) * avgDistance); + sectionBuilder.addConvertKilometer(min + (index + 1) * avgDistance); } } });