【改方BUG修复,空指针判断】

Signed-off-by: weizhihong <weizhihong@joylink.club>
This commit is contained in:
weizhihong 2022-04-24 16:49:27 +08:00
parent 67ac1683c4
commit 53cb44174c

View File

@ -100,9 +100,10 @@ public class AssistService {
Indicator deliverIndicator = getStationIndicatorByType(curStation, labelEnum, IndicatorTypeEnum.DELIVER); Indicator deliverIndicator = getStationIndicatorByType(curStation, labelEnum, IndicatorTypeEnum.DELIVER);
// 如果都没有亮 // 如果都没有亮
if (deliverIndicator != null && receiveIndicator != null && !deliverIndicator.isOn() && !receiveIndicator.isOn()) { if (deliverIndicator != null && receiveIndicator != null && !deliverIndicator.isOn() && !receiveIndicator.isOn()) {
// XS方向为接车方向默认亮起
if (DirectionLabelEnum.X.equals(labelEnum) || DirectionLabelEnum.S.equals(labelEnum)) { if (DirectionLabelEnum.X.equals(labelEnum) || DirectionLabelEnum.S.equals(labelEnum)) {
receiveIndicator.setOn(true); receiveIndicator.setOn(true);
} else { } else { // 其他方向默认发车灯亮起
deliverIndicator.setOn(true); deliverIndicator.setOn(true);
} }
} }
@ -116,7 +117,6 @@ public class AssistService {
} }
} }
/** /**
* 改方按钮按下校验 * 改方按钮按下校验
*/ */
@ -124,6 +124,9 @@ public class AssistService {
if (button == null) { if (button == null) {
throw new SimulationException(SimulationExceptionType.Operation_Cannot_handed, "操作异常:按钮不存在"); throw new SimulationException(SimulationExceptionType.Operation_Cannot_handed, "操作异常:按钮不存在");
} }
if (button.getStand() == null) {
throw new SimulationException(SimulationExceptionType.Operation_Cannot_handed, "操作异常:按钮未绑定站台");
}
// 由数据控制不做逻辑判断 // 由数据控制不做逻辑判断
// List<Station> stationList = simulation.getRepository().getStationList(); // List<Station> stationList = simulation.getRepository().getStationList();
// // 当前站位置 // // 当前站位置
@ -135,12 +138,12 @@ public class AssistService {
// 获取区间指示灯 // 获取区间指示灯
Indicator sectionIndicator = getStationIndicatorByType(button.getStation(), button.getLabel(), IndicatorTypeEnum.SECTION); Indicator sectionIndicator = getStationIndicatorByType(button.getStation(), button.getLabel(), IndicatorTypeEnum.SECTION);
// 获取区间路径,判断本站台与相邻站台是否空闲 // 获取区间路径,判断本站台与相邻站台是否空闲
if (IndicatorStatusEnum.R.equals(sectionIndicator.getAspect())) { if (sectionIndicator != null && IndicatorStatusEnum.R.equals(sectionIndicator.getAspect())) {
throw new SimulationException(SimulationExceptionType.Operation_Cannot_handed, "操作异常:区段非空闲"); throw new SimulationException(SimulationExceptionType.Operation_Cannot_handed, "操作异常:区段非空闲");
} }
// 判断接车灯进路是否办理 // 判断接车灯进路是否办理
Indicator receiveIndicator = getStationIndicatorByType(button.getStation(), button.getLabel(), IndicatorTypeEnum.RECEIVE); Indicator receiveIndicator = getStationIndicatorByType(button.getStation(), button.getLabel(), IndicatorTypeEnum.RECEIVE);
if (receiveIndicator.getRoute().isLock()) { if (receiveIndicator != null && receiveIndicator.getRoute() != null && receiveIndicator.getRoute().isLock()) {
throw new SimulationException(SimulationExceptionType.Operation_Cannot_handed, "操作异常:进路冲突"); throw new SimulationException(SimulationExceptionType.Operation_Cannot_handed, "操作异常:进路冲突");
} }
// 获取靠停列车 // 获取靠停列车