| | |
| | | // throw new CoolException("未找到该路径"); |
| | | return new ArrayList<>(); |
| | | } |
| | | Map<Integer, StationProtocol> statusMap = loadStationStatusMap(); |
| | | allList = filterNonAutoStationPaths(allList, statusMap); |
| | | if (allList.isEmpty()) { |
| | | News.info("[WCS Debug] 站点路径候选全部被过滤,存在非自动站点,startStationId={},endStationId={}", startStationId, endStationId); |
| | | return new ArrayList<>(); |
| | | } |
| | | News.info("[WCS Debug] 站点路径计算完成,耗时:{}ms", System.currentTimeMillis() - startTime); |
| | | |
| | | startTime = System.currentTimeMillis(); |
| | |
| | | return stationIdList; |
| | | } |
| | | |
| | | private List<List<NavigateNode>> filterNonAutoStationPaths(List<List<NavigateNode>> allList, |
| | | Map<Integer, StationProtocol> statusMap) { |
| | | if (allList == null || allList.isEmpty() || statusMap == null || statusMap.isEmpty()) { |
| | | return allList; |
| | | } |
| | | |
| | | List<List<NavigateNode>> result = new ArrayList<>(); |
| | | for (List<NavigateNode> path : allList) { |
| | | if (path == null || path.isEmpty()) { |
| | | continue; |
| | | } |
| | | if (containsNonAutoStation(path, statusMap)) { |
| | | continue; |
| | | } |
| | | result.add(path); |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | private boolean containsNonAutoStation(List<NavigateNode> path, Map<Integer, StationProtocol> statusMap) { |
| | | for (Integer stationId : extractStationIdList(path)) { |
| | | StationProtocol protocol = statusMap.get(stationId); |
| | | if (protocol != null && !protocol.isAutoing()) { |
| | | return true; |
| | | } |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | private Map<Integer, StationProtocol> loadStationStatusMap() { |
| | | Map<Integer, StationProtocol> statusMap = new HashMap<>(); |
| | | try { |