diff --git a/src/main/java/club/joylink/rtss/vo/training2/rule/MapDeviceRule.java b/src/main/java/club/joylink/rtss/vo/training2/rule/MapDeviceRule.java index 752d59278..a9ad4b638 100644 --- a/src/main/java/club/joylink/rtss/vo/training2/rule/MapDeviceRule.java +++ b/src/main/java/club/joylink/rtss/vo/training2/rule/MapDeviceRule.java @@ -2,6 +2,7 @@ package club.joylink.rtss.vo.training2.rule; import club.joylink.rtss.constants.BusinessConsts; import club.joylink.rtss.exception.BusinessExceptionAssertEnum; +import club.joylink.rtss.simulation.cbtc.CI.data.StationDirection; import club.joylink.rtss.simulation.cbtc.Simulation; import club.joylink.rtss.simulation.cbtc.data.map.*; import club.joylink.rtss.simulation.cbtc.exception.SimulationException; @@ -583,7 +584,20 @@ public enum MapDeviceRule { ROUTE_DEPARTURE_LIST("发车进路列表") { @Override public List filterMapDeviceList(Simulation simulation) { - return generateRandomElement(queryNormalRouteList(simulation, route -> Objects.equals(Route.Type.DEPARTURE, route.getType())), NUMBER); + List routeList = new ArrayList<>(); + simulation.getRepository().getStationList().forEach(station -> { + station.getStationDirectionMap().forEach((k, v) -> { + if (StationDirection.DirectionRunModel.A.equals(v.getRunModel())) { + if (StationDirection.ReceiveAndDeliverModel.D.equals(v.getDefaultRunStatus())) { + List list = v.getDeliverRouteList().stream() + .filter(route -> !CollectionUtils.isEmpty(route.getSectionList())) + .collect(Collectors.toList()); + routeList.addAll(list); + } + } + }); + }); + return generateRandomElement(routeList, NUMBER); } }, ROUTE_FIRST_STATION_LIST("获取第一个站进路列表") { diff --git a/src/main/java/club/joylink/rtss/vo/training2/rule/MapElementRule.java b/src/main/java/club/joylink/rtss/vo/training2/rule/MapElementRule.java index ce25fc10a..3dd3d6c9d 100644 --- a/src/main/java/club/joylink/rtss/vo/training2/rule/MapElementRule.java +++ b/src/main/java/club/joylink/rtss/vo/training2/rule/MapElementRule.java @@ -33,7 +33,12 @@ public abstract class MapElementRule { } else if (mapElement instanceof Switch) { return ((Switch) mapElement).getDeviceStation(); } else if (mapElement instanceof Route) { - return ((Route) mapElement).getInterlockStation(); + Route route = ((Route) mapElement); + if (route.getInterlockStation() != null) { + return route.getInterlockStation(); + } else { + return route.getStart().getStation() != null ? route.getStart().getStation() : route.getStart().getDeviceStation(); + } } throw new SimulationException(SimulationExceptionType.Simulation_Map_Data_Error); } diff --git a/src/main/java/club/joylink/rtss/vo/training2/rule/PropertyValueRule.java b/src/main/java/club/joylink/rtss/vo/training2/rule/PropertyValueRule.java index 81bdf7343..ce4520360 100644 --- a/src/main/java/club/joylink/rtss/vo/training2/rule/PropertyValueRule.java +++ b/src/main/java/club/joylink/rtss/vo/training2/rule/PropertyValueRule.java @@ -124,6 +124,25 @@ public enum PropertyValueRule { return ((Route) mapElement).getDestinationButtonSignal().getShowName(); } }, + ROUTE_END_BUTTON_SIGNAL_CODE("进路终端按钮信号机编码") { + @Override + public Object resolve(Simulation simulation, Object mapElement) { + return ((Route) mapElement).getDestinationButtonSignal().getCode(); + } + }, + ROUTE_END_PICK_BUTTON_CODE("进路终端接车按钮编码") { + @Override + public String resolve(Simulation simulation, Object mapElement) { + Route route = (Route) mapElement; + List signalButtonList = simulation.getBuildParams().getMap().getGraphDataNew().getSignalButtonList(); + MapSignalButtonVO buttonVO = signalButtonList.stream().filter(button -> MapSignalButtonVO.Type.PICK.equals(button.getType()) + && Objects.equals(button.getSignalCode(), route.getDestination().getCode())).findFirst().orElse(null); + if (buttonVO == null) { + throw new SimulationException(SimulationExceptionType.Data_Not_Exist, "错误数据"); + } + return buttonVO.getCode(); + } + }, SIGNAL_BUTTON_CODE("信号机按钮编码") { @Override public String resolve(Simulation simulation, Object mapElement) {