【大铁实训进路筛选】
This commit is contained in:
parent
7cac4046f3
commit
0d4d91d9b8
@ -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<Route> filterMapDeviceList(Simulation simulation) {
|
||||
return generateRandomElement(queryNormalRouteList(simulation, route -> Objects.equals(Route.Type.DEPARTURE, route.getType())), NUMBER);
|
||||
List<Route> 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<Route> list = v.getDeliverRouteList().stream()
|
||||
.filter(route -> !CollectionUtils.isEmpty(route.getSectionList()))
|
||||
.collect(Collectors.toList());
|
||||
routeList.addAll(list);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
return generateRandomElement(routeList, NUMBER);
|
||||
}
|
||||
},
|
||||
ROUTE_FIRST_STATION_LIST("获取第一个站进路列表") {
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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<MapSignalButtonVO> 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) {
|
||||
|
Loading…
Reference in New Issue
Block a user