【区段信息解析BUG修复】

This commit is contained in:
weizhihong 2023-07-20 17:01:38 +08:00
parent c5cbe04ab8
commit 78f7fe2024

View File

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