将传输信号机联锁数据校验逻辑与其它信号机区分,添加传输信号机的构建逻辑
This commit is contained in:
parent
bad7cca595
commit
52986aa9a2
@ -230,13 +230,13 @@ public class MapDeviceBuilder {
|
||||
}
|
||||
}
|
||||
}
|
||||
if(Objects.equals(BusinessConsts.Section.SectionType.Type01, sectionVO.getType())){
|
||||
if (Objects.equals(BusinessConsts.Section.SectionType.Type01, sectionVO.getType())) {
|
||||
Section parent = (Section) elementMap.get(sectionVO.getParentCode());//所属岔心
|
||||
if (Objects.nonNull(parent)) {
|
||||
if(!parent.isCross()){
|
||||
if (!parent.isCross()) {
|
||||
errMsgList.add(String.format("物理区段[%s(%s)]关联父区段[%s(%s)]不是岔心",
|
||||
section.getName(), section.getCode(),parent.getName(),parent.getCode()));
|
||||
}else{
|
||||
section.getName(), section.getCode(), parent.getName(), parent.getCode()));
|
||||
} else {
|
||||
parent.addLogicSection(section);
|
||||
section.setParent(parent);
|
||||
}
|
||||
@ -560,91 +560,9 @@ public class MapDeviceBuilder {
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// 信号机
|
||||
List<MapSignalNewVO> signalList = graphData.getSignalList();
|
||||
signalList.forEach(signalVO -> {
|
||||
Signal signal = new Signal(signalVO.getCode(), signalVO.getUniqueName());
|
||||
if (Objects.nonNull(elementMap.get(signal.getCode()))) {
|
||||
errMsgList.add(String.format("编码为[%s]的信号机不唯一", signal.getCode()));
|
||||
}
|
||||
elementMap.put(signal.getCode(), signal);
|
||||
signal.setShowName(signalVO.getName());
|
||||
signal.setRight(signalVO.isRight());
|
||||
signal.setVirtual(signalVO.isVirtual());
|
||||
signal.setNoOverlap(signalVO.isNoOverlap());
|
||||
// 所属设备集中站
|
||||
Station deviceStation = (Station) elementMap.get(signalVO.getStationCode());
|
||||
if (Objects.isNull(deviceStation)) {
|
||||
errMsgList.add(String.format("信号机[%s(%s)]未设置所属设备集中站或所属设备集中站不存在", signal.getName(), signal.getCode()));
|
||||
} else {
|
||||
signal.setDeviceStation(deviceStation);
|
||||
}
|
||||
// 所属联锁站
|
||||
Station interlockStation = ((Station) elementMap.get(signalVO.getInterlockStationCode()));
|
||||
if (Objects.isNull(interlockStation)) {
|
||||
errMsgList.add(String.format("信号机[%s(%s)]未设置所属联锁站或所属联锁站不存在", signal.getName(), signal.getCode()));
|
||||
} else {
|
||||
if (!interlockStation.isInterlock()) {
|
||||
errMsgList.add(String.format("信号机[%s(%s)]关联的所属联锁车站[%s(%s)]不是联锁站",
|
||||
signal.getName(), signal.getCode(),
|
||||
interlockStation.getName(), interlockStation.getCode()));
|
||||
}
|
||||
signal.setInterlockStation(interlockStation);
|
||||
}
|
||||
// 信号机类型
|
||||
if (Objects.isNull(signalVO.getType())) {
|
||||
errMsgList.add(String.format("信号机[%s(%s)]类型未设置", signal.getName(), signal.getCode()));
|
||||
} else {
|
||||
signal.setType(signalVO.getType());
|
||||
}
|
||||
signal.setRouteEnd(signalVO.isRouteEnd());
|
||||
signal.setIgnoreRouteEnd(signalVO.getIgnoreRouteEnd());
|
||||
signal.setCtc(signalVO.isCtc());
|
||||
signal.setCallOn(signalVO.isCallOn());
|
||||
signal.setTurnBack(signalVO.isTurnBack());
|
||||
// 关联区段及偏移量
|
||||
Section section = (Section) elementMap.get(signalVO.getSectionCode());
|
||||
if (Objects.isNull(section)) {
|
||||
errMsgList.add(String.format("信号机[%s(%s)]未关联区段或关联区段不存在", signal.getName(), signal.getCode()));
|
||||
} else {
|
||||
signal.setSection(section);
|
||||
if (signal.isRight()) { // 右向信号机
|
||||
if (Objects.nonNull(section.getSignalToRight())) {
|
||||
errMsgList.add(String.format("区段[%s(%s)]关联了多个右向信号机[%s(%s),%s(%s)]",
|
||||
section.getName(), section.getCode(),
|
||||
section.getSignalToRight().getName(), section.getSignalToRight().getCode(),
|
||||
signal.getName(), signal.getCode()));
|
||||
} else {
|
||||
section.setSignalToRight(signal);
|
||||
}
|
||||
} else {
|
||||
if (Objects.nonNull(section.getSignalToLeft())) {
|
||||
errMsgList.add(String.format("区段[%s(%s)]关联了多个左向信号机[%s(%s),%s(%s)]",
|
||||
section.getName(), section.getCode(),
|
||||
section.getSignalToLeft().getName(), section.getSignalToLeft().getCode(),
|
||||
signal.getName(), signal.getCode()));
|
||||
} else {
|
||||
section.setSignalToLeft(signal);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (Objects.isNull(signalVO.getSectionOffset()) ||
|
||||
(Objects.nonNull(section) && Objects.nonNull(section.getLen()) &&
|
||||
(signalVO.getSectionOffset() < 0 || signalVO.getSectionOffset() > section.getLen()))) {
|
||||
errMsgList.add(String.format("信号机[%s(%s)]的区段偏移量未设置或数据异常[%s]",
|
||||
signal.getName(), signal.getCode(), signalVO.getSectionOffset()));
|
||||
} else {
|
||||
signal.setOffset(signalVO.getSectionOffset());
|
||||
}
|
||||
buildSignal(graphData, elementMap, deviceMap, errMsgList);
|
||||
|
||||
// 创建虚拟真实信号机
|
||||
if (!signal.isVirtual()) { // 是真实存在的虚拟机才创建
|
||||
VirtualRealitySignal virtualRealitySignal = new VirtualRealitySignal(signal.getCode(), signal.getName());
|
||||
signal.setVirtualSignal(virtualRealitySignal);
|
||||
deviceMap.put(virtualRealitySignal.getCode(), virtualRealitySignal);
|
||||
}
|
||||
});
|
||||
// 折返区段左右信号机存在校验
|
||||
for (Section section : physicalSectionList) {
|
||||
if (section.isTurnBackTrack()) {
|
||||
@ -928,7 +846,127 @@ public class MapDeviceBuilder {
|
||||
buildResponderDataRef(graphData, elementMap, errMsgList);
|
||||
}
|
||||
|
||||
/**应答器数据验证及关系构建*/
|
||||
private static void buildSignal(MapGraphDataNewVO graphData, Map<String, MapElement> elementMap, Map<String, VirtualRealityDevice> deviceMap, List<String> errMsgList) {
|
||||
List<MapSignalNewVO> signalList = graphData.getSignalList();
|
||||
signalList.stream().filter(signalVO -> !Signal.SignalType.TRANSMISSION.equals(signalVO.getType())).forEach(signalVO -> { //非传输信号机
|
||||
Signal signal = new Signal(signalVO.getCode(), signalVO.getUniqueName());
|
||||
if (Objects.nonNull(elementMap.get(signal.getCode()))) {
|
||||
errMsgList.add(String.format("编码为[%s]的信号机不唯一", signal.getCode()));
|
||||
}
|
||||
elementMap.put(signal.getCode(), signal);
|
||||
signal.setShowName(signalVO.getName());
|
||||
signal.setRight(signalVO.isRight());
|
||||
signal.setVirtual(signalVO.isVirtual());
|
||||
signal.setNoOverlap(signalVO.isNoOverlap());
|
||||
// 所属设备集中站
|
||||
Station deviceStation = (Station) elementMap.get(signalVO.getStationCode());
|
||||
if (Objects.isNull(deviceStation)) {
|
||||
errMsgList.add(String.format("信号机[%s(%s)]未设置所属设备集中站或所属设备集中站不存在", signal.getName(), signal.getCode()));
|
||||
} else {
|
||||
signal.setDeviceStation(deviceStation);
|
||||
}
|
||||
// 所属联锁站
|
||||
Station interlockStation = ((Station) elementMap.get(signalVO.getInterlockStationCode()));
|
||||
if (Objects.isNull(interlockStation)) {
|
||||
errMsgList.add(String.format("信号机[%s(%s)]未设置所属联锁站或所属联锁站不存在", signal.getName(), signal.getCode()));
|
||||
} else {
|
||||
if (!interlockStation.isInterlock()) {
|
||||
errMsgList.add(String.format("信号机[%s(%s)]关联的所属联锁车站[%s(%s)]不是联锁站",
|
||||
signal.getName(), signal.getCode(),
|
||||
interlockStation.getName(), interlockStation.getCode()));
|
||||
}
|
||||
signal.setInterlockStation(interlockStation);
|
||||
}
|
||||
// 信号机类型
|
||||
if (Objects.isNull(signalVO.getType())) {
|
||||
errMsgList.add(String.format("信号机[%s(%s)]类型未设置", signal.getName(), signal.getCode()));
|
||||
} else {
|
||||
signal.setType(signalVO.getType());
|
||||
}
|
||||
signal.setRouteEnd(signalVO.isRouteEnd());
|
||||
signal.setIgnoreRouteEnd(signalVO.getIgnoreRouteEnd());
|
||||
signal.setCtc(signalVO.isCtc());
|
||||
signal.setCallOn(signalVO.isCallOn());
|
||||
signal.setTurnBack(signalVO.isTurnBack());
|
||||
// 关联区段及偏移量
|
||||
Section section = (Section) elementMap.get(signalVO.getSectionCode());
|
||||
if (Objects.isNull(section)) {
|
||||
errMsgList.add(String.format("信号机[%s(%s)]未关联区段或关联区段不存在", signal.getName(), signal.getCode()));
|
||||
} else {
|
||||
signal.setSection(section);
|
||||
if (signal.isRight()) { // 右向信号机
|
||||
if (Objects.nonNull(section.getSignalToRight())) {
|
||||
errMsgList.add(String.format("区段[%s(%s)]关联了多个右向信号机[%s(%s),%s(%s)]",
|
||||
section.getName(), section.getCode(),
|
||||
section.getSignalToRight().getName(), section.getSignalToRight().getCode(),
|
||||
signal.getName(), signal.getCode()));
|
||||
} else {
|
||||
section.setSignalToRight(signal);
|
||||
}
|
||||
} else {
|
||||
if (Objects.nonNull(section.getSignalToLeft())) {
|
||||
errMsgList.add(String.format("区段[%s(%s)]关联了多个左向信号机[%s(%s),%s(%s)]",
|
||||
section.getName(), section.getCode(),
|
||||
section.getSignalToLeft().getName(), section.getSignalToLeft().getCode(),
|
||||
signal.getName(), signal.getCode()));
|
||||
} else {
|
||||
section.setSignalToLeft(signal);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (Objects.isNull(signalVO.getSectionOffset()) ||
|
||||
(Objects.nonNull(section) && Objects.nonNull(section.getLen()) &&
|
||||
(signalVO.getSectionOffset() < 0 || signalVO.getSectionOffset() > section.getLen()))) {
|
||||
errMsgList.add(String.format("信号机[%s(%s)]的区段偏移量未设置或数据异常[%s]",
|
||||
signal.getName(), signal.getCode(), signalVO.getSectionOffset()));
|
||||
} else {
|
||||
signal.setOffset(signalVO.getSectionOffset());
|
||||
}
|
||||
|
||||
// 创建虚拟真实信号机
|
||||
if (!signal.isVirtual()) { // 是真实存在的虚拟机才创建
|
||||
VirtualRealitySignal virtualRealitySignal = new VirtualRealitySignal(signal.getCode(), signal.getName());
|
||||
signal.setVirtualSignal(virtualRealitySignal);
|
||||
deviceMap.put(virtualRealitySignal.getCode(), virtualRealitySignal);
|
||||
}
|
||||
});
|
||||
signalList.stream().filter(signalVO -> Signal.SignalType.TRANSMISSION.equals(signalVO.getType())).forEach(signalVO->{
|
||||
Signal signal = new Signal(signalVO.getCode(), signalVO.getUniqueName());
|
||||
if (Objects.nonNull(elementMap.get(signal.getCode()))) {
|
||||
errMsgList.add(String.format("编码为[%s]的信号机不唯一", signal.getCode()));
|
||||
}
|
||||
elementMap.put(signal.getCode(), signal);
|
||||
// 检查关联信号机
|
||||
if (signalVO.getLinkSignalCode() == null) {
|
||||
errMsgList.add(String.format("传输信号机[%s(%s)]未关联信号机", signal.getName(), signal.getCode()));
|
||||
} else {
|
||||
Signal linkSignal = (Signal) elementMap.get(signalVO.getLinkSignalCode());
|
||||
if (linkSignal == null) {
|
||||
errMsgList.add(String.format("传输信号机[%s(%s)]关联的信号机不存在", signal.getName(), signal.getCode()));
|
||||
} else {
|
||||
signal.setLinkSignal(linkSignal);
|
||||
}
|
||||
}
|
||||
// 检查关联区段及偏移量
|
||||
Section section = (Section) elementMap.get(signalVO.getSectionCode());
|
||||
if (Objects.isNull(section)) {
|
||||
errMsgList.add(String.format("信号机[%s(%s)]未关联区段或关联区段不存在", signal.getName(), signal.getCode()));
|
||||
} else {
|
||||
if (Objects.isNull(signalVO.getSectionOffset()) ||
|
||||
(Objects.nonNull(section) && Objects.nonNull(section.getLen()) &&
|
||||
(signalVO.getSectionOffset() < 0 || signalVO.getSectionOffset() > section.getLen()))) {
|
||||
errMsgList.add(String.format("信号机[%s(%s)]的区段偏移量未设置或数据异常[%s]",
|
||||
signal.getName(), signal.getCode(), signalVO.getSectionOffset()));
|
||||
} else {
|
||||
signal.setOffset(signalVO.getSectionOffset());
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 应答器数据验证及关系构建
|
||||
*/
|
||||
private static void buildResponderDataRef(MapGraphDataNewVO graphData, Map<String, MapElement> elementMap, List<String> errMsgList) {
|
||||
List<MapResponderVO> responderList = graphData.getResponderList();
|
||||
responderList.forEach(responderVO -> {
|
||||
@ -942,14 +980,14 @@ public class MapDeviceBuilder {
|
||||
errMsgList.add(String.format("应答器[%s(%s)]类型未设置", responderVO.getName(), responderVO.getCode()));
|
||||
} else {
|
||||
responder.setType(responderVO.getType());
|
||||
if (responder.isVB()){
|
||||
if(StringUtils.isEmpty(responderVO.getSignalCode())){
|
||||
if (responder.isVB()) {
|
||||
if (StringUtils.isEmpty(responderVO.getSignalCode())) {
|
||||
errMsgList.add(String.format("可变应答器[%s(%s)]未设置关联信号机", responderVO.getName(), responderVO.getCode()));
|
||||
}else{
|
||||
} else {
|
||||
Signal signal = (Signal) elementMap.get(responderVO.getSignalCode());
|
||||
if(Objects.isNull(signal)){
|
||||
errMsgList.add(String.format("可变应答器[%s(%s)]关联信号机[%s]不存在", responderVO.getName(), responderVO.getCode(),responderVO.getSignalCode()));
|
||||
}else{
|
||||
if (Objects.isNull(signal)) {
|
||||
errMsgList.add(String.format("可变应答器[%s(%s)]关联信号机[%s]不存在", responderVO.getName(), responderVO.getCode(), responderVO.getSignalCode()));
|
||||
} else {
|
||||
responder.setSignal(signal);
|
||||
}
|
||||
}
|
||||
|
@ -382,7 +382,7 @@ public class Switch extends MayOutOfOrderDevice {
|
||||
|
||||
public enum SwitchFault implements DeviceFault {
|
||||
/**
|
||||
* 道岔挤岔
|
||||
* 道岔失表
|
||||
*/
|
||||
SPLIT {
|
||||
@Override
|
||||
|
Loading…
Reference in New Issue
Block a user