From 2faf256501b5a0e571c4f4c54b7e288a6f3cff66 Mon Sep 17 00:00:00 2001 From: joylink_zhangsai <1021828630@qq.com> Date: Wed, 10 Mar 2021 19:40:35 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B3=B0=E9=9B=B7=E5=85=B9=E6=8E=92=E5=88=97?= =?UTF-8?q?=E8=BF=9B=E8=B7=AF=E5=88=B0=E6=93=8D=E4=BD=9C=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/simulation/SimulationV1Controller.java | 7 +++---- .../services/simulation/SimulationSupportService.java | 10 +++++++--- .../ATS/operation/handler/TrainOperateHandler.java | 5 ++--- .../simulation/cbtc/ATS/service/AtsTrainService.java | 5 ++--- 4 files changed, 14 insertions(+), 13 deletions(-) diff --git a/src/main/java/club/joylink/rtss/controller/simulation/SimulationV1Controller.java b/src/main/java/club/joylink/rtss/controller/simulation/SimulationV1Controller.java index 3a387029d..d1758b8ca 100644 --- a/src/main/java/club/joylink/rtss/controller/simulation/SimulationV1Controller.java +++ b/src/main/java/club/joylink/rtss/controller/simulation/SimulationV1Controller.java @@ -11,7 +11,6 @@ import club.joylink.rtss.simulation.cbtc.Simulation; import club.joylink.rtss.simulation.cbtc.command.CommandInitiateVO; import club.joylink.rtss.simulation.cbtc.communication.vo.fault.DeviceFaultInfo; import club.joylink.rtss.simulation.cbtc.data.status.IbpStatus; -import club.joylink.rtss.simulation.cbtc.data.vo.RoutePathVO; import club.joylink.rtss.simulation.cbtc.data.vo.SimulationVO; import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealityIbp; import club.joylink.rtss.simulation.cbtc.member.SimulationMember; @@ -306,9 +305,9 @@ public class SimulationV1Controller { return groupSimulationService.getLog(group, queryVO); } - @ApiOperation("查询进路路径") - @GetMapping("/{group}/queryRoutePaths") - public List queryRoutePaths(@PathVariable String group, String groupNumber, String standCode, String signalCode) { + @ApiOperation("查询区段路径") + @GetMapping("/{group}/querySectionPaths") + public List> querySectionPaths(@PathVariable String group, String groupNumber, String standCode, String signalCode) { return simulationSupportService.queryRoutePaths(group, groupNumber, standCode, signalCode); } } diff --git a/src/main/java/club/joylink/rtss/services/simulation/SimulationSupportService.java b/src/main/java/club/joylink/rtss/services/simulation/SimulationSupportService.java index 22079e229..a9956d830 100644 --- a/src/main/java/club/joylink/rtss/services/simulation/SimulationSupportService.java +++ b/src/main/java/club/joylink/rtss/services/simulation/SimulationSupportService.java @@ -4,17 +4,18 @@ import club.joylink.rtss.exception.BusinessExceptionAssertEnum; import club.joylink.rtss.simulation.cbtc.GroupSimulationService; import club.joylink.rtss.simulation.cbtc.Simulation; import club.joylink.rtss.simulation.cbtc.data.CalculateService; +import club.joylink.rtss.simulation.cbtc.data.map.MapElement; import club.joylink.rtss.simulation.cbtc.data.map.Section; import club.joylink.rtss.simulation.cbtc.data.map.Signal; import club.joylink.rtss.simulation.cbtc.data.map.Stand; import club.joylink.rtss.simulation.cbtc.data.support.RoutePath; -import club.joylink.rtss.simulation.cbtc.data.vo.RoutePathVO; import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealityTrain; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.util.StringUtils; import java.util.List; +import java.util.stream.Collectors; /** * 仿真运行支持 @@ -24,7 +25,7 @@ public class SimulationSupportService { @Autowired private GroupSimulationService groupSimulationService; - public List queryRoutePaths(String group, String groupNumber, String standCode, String signalCode) { + public List> queryRoutePaths(String group, String groupNumber, String standCode, String signalCode) { Simulation simulation = groupSimulationService.getSimulationByGroup(group); Section destination; if (StringUtils.hasText(standCode)) { @@ -40,6 +41,9 @@ public class SimulationSupportService { Section startSection = train.getHeadPosition().getSection(); List routePaths = CalculateService.queryRoutePathsOnDirection(startSection, destination, train.isRight()); - return RoutePathVO.convert(routePaths); + return routePaths.stream() + .map(routePath -> CalculateService.selectUniqueRoutes(routePath, false) + .stream().map(MapElement::getCode).collect(Collectors.toList())) + .collect(Collectors.toList()); } } diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/operation/handler/TrainOperateHandler.java b/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/operation/handler/TrainOperateHandler.java index 64b710df2..8edd6be1b 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/operation/handler/TrainOperateHandler.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/operation/handler/TrainOperateHandler.java @@ -13,7 +13,6 @@ import club.joylink.rtss.simulation.cbtc.data.plan.TripPlan; import club.joylink.rtss.simulation.cbtc.data.support.RoutePath; import club.joylink.rtss.simulation.cbtc.data.support.SectionPosition; import club.joylink.rtss.simulation.cbtc.data.support.TrainLoadParam2; -import club.joylink.rtss.simulation.cbtc.data.vo.RoutePathVO; import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealityTrain; import club.joylink.rtss.simulation.cbtc.exception.SimulationException; import club.joylink.rtss.simulation.cbtc.exception.SimulationExceptionType; @@ -322,8 +321,8 @@ public class TrainOperateHandler { * 排列进路到(站台/信号机)【泰雷兹】 */ @OperateHandlerMapping(type = Operation.Type.Train_Set_Route) - public void setRouteTo(Simulation simulation, RoutePathVO routePath) { - atsTrainService.setRouteTo(simulation, routePath); + public void setRouteTo(Simulation simulation, List routes) { + atsTrainService.setRouteTo(simulation, routes); } /** diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/service/AtsTrainService.java b/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/service/AtsTrainService.java index 2dbf1012c..e7e7614c0 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/service/AtsTrainService.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/service/AtsTrainService.java @@ -13,7 +13,6 @@ import club.joylink.rtss.simulation.cbtc.data.plan.TripPlan; import club.joylink.rtss.simulation.cbtc.data.support.RoutePath; import club.joylink.rtss.simulation.cbtc.data.support.SectionPosition; import club.joylink.rtss.simulation.cbtc.data.support.StationTurnBackStrategyOption; -import club.joylink.rtss.simulation.cbtc.data.vo.RoutePathVO; import club.joylink.rtss.simulation.cbtc.data.vo.TrainInfo; import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealityTrain; import club.joylink.rtss.simulation.cbtc.exception.SimulationException; @@ -894,8 +893,8 @@ public class AtsTrainService { /** * 排列进路到(站台/信号机) */ - public void setRouteTo(Simulation simulation, RoutePathVO routePath) { - routePath.getRouteList().forEach(routeCode -> ciApiService.settingRoute(simulation, routeCode)); + public void setRouteTo(Simulation simulation, List routes) { + routes.forEach(code -> ciApiService.settingRoute(simulation, code)); } /**