From 78f7fe20247c563800327ab24735ed081c9e268f Mon Sep 17 00:00:00 2001 From: weizhihong Date: Thu, 20 Jul 2023 17:01:38 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E5=8C=BA=E6=AE=B5=E4=BF=A1=E6=81=AF?= =?UTF-8?q?=E8=A7=A3=E6=9E=90BUG=E4=BF=AE=E5=A4=8D=E3=80=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../xiannccda/ats/cache/LineGraphicDataRepository.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 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 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); } } });