【去除车站判断逻辑】

Signed-off-by: weizhihong <weizhihong@joylink.club>
This commit is contained in:
weizhihong 2022-04-24 14:23:28 +08:00
parent 3d59d32db7
commit 4f697b19fc

View File

@ -19,7 +19,6 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import java.util.List;
import java.util.Optional; import java.util.Optional;
@ -125,13 +124,14 @@ public class AssistService {
if (button == null) { if (button == null) {
throw new SimulationException(SimulationExceptionType.Operation_Cannot_handed, "操作异常:按钮不存在"); throw new SimulationException(SimulationExceptionType.Operation_Cannot_handed, "操作异常:按钮不存在");
} }
List<Station> stationList = simulation.getRepository().getStationList(); // 由数据控制不做逻辑判断
// 当前站位置 // List<Station> stationList = simulation.getRepository().getStationList();
int index = stationList.indexOf(button.getStation()); // // 当前站位置
// 检查是否是首站 // int index = stationList.indexOf(button.getStation());
if (index == 0 || index == stationList.size() - 1) { // // 检查是否是首站
throw new SimulationException(SimulationExceptionType.Operation_Cannot_handed, "操作异常:首站不可改方"); // if (index == 0 || index == stationList.size() - 1) {
} // throw new SimulationException(SimulationExceptionType.Operation_Cannot_handed, "操作异常:首站不可改方");
// }
// 获取区间指示灯 // 获取区间指示灯
Indicator sectionIndicator = getStationIndicatorByType(button.getStation(), button.getLabel(), IndicatorTypeEnum.SECTION); Indicator sectionIndicator = getStationIndicatorByType(button.getStation(), button.getLabel(), IndicatorTypeEnum.SECTION);
// 获取区间路径,判断本站台与相邻站台是否空闲 // 获取区间路径,判断本站台与相邻站台是否空闲