数据校验添加区段是否站台轨、转换轨校验逻辑

This commit is contained in:
walker-sheng 2021-03-22 16:47:42 +08:00
parent 3ce3360226
commit 7681690896

View File

@ -458,6 +458,8 @@ public class MapDeviceBuilder {
} }
} }
}); });
// 区段是否站台轨转换轨检查
checkSectionFunctionType(elementMap, errMsgList);
// 信号机 // 信号机
buildSignal(graphData, elementMap, deviceMap, errMsgList); buildSignal(graphData, elementMap, deviceMap, errMsgList);
@ -744,6 +746,21 @@ public class MapDeviceBuilder {
buildResponderDataRef(graphData, elementMap, errMsgList, mapDataBuildResult.getSectionRespondersMap()); buildResponderDataRef(graphData, elementMap, errMsgList, mapDataBuildResult.getSectionRespondersMap());
} }
private static void checkSectionFunctionType(Map<String, MapElement> deviceMap, List<String> errMsgList) {
List<Section> sectionList = deviceMap.values().stream()
.filter(mapElement -> mapElement.getDeviceType().equals(MapElement.DeviceType.SECTION))
.map(mapElement -> ((Section) mapElement))
.collect(Collectors.toList());
for (Section section : sectionList) {
if (section.isStandTrack() && !section.isNormalStandTrack()) {
errMsgList.add(String.format("区段[%s]不是正常站台的站台轨,却设置了站台轨属性", section.debugStr()));
}
if (section.isTransferTrack() && (section.getStation() == null || !section.getStation().isDepot())) {
errMsgList.add(String.format("区段[%s]所属车站不是车辆段/停车场车站,却设置了转换轨属性", section.debugStr()));
}
}
}
/** /**
* 构建区段数据 * 构建区段数据
*/ */