From 329a36ef48e927122cf50dc173edfbb70d622f9b Mon Sep 17 00:00:00 2001 From: joylink_zhangsai <1021828630@qq.com> Date: Wed, 2 Nov 2022 13:44:43 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E9=80=9A=E8=BF=87=E5=9C=B0?= =?UTF-8?q?=E5=9B=BE=E5=8A=9F=E8=83=BDid=E5=88=9B=E5=BB=BA=E4=BB=BF?= =?UTF-8?q?=E7=9C=9F=E7=9A=84=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../simulation/SimulationV1Controller.java | 8 ++++++++ .../services/mapFunction/RtsMapFunctionService.java | 2 ++ .../mapFunction/RtsMapFunctionServiceImpl.java | 6 ++++++ .../rtss/simulation/cbtc/SimulationService.java | 2 ++ .../rtss/simulation/cbtc/SimulationServiceImpl.java | 12 ++++++++++++ 5 files changed, 30 insertions(+) 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 3e1c9ddda..aa716b303 100644 --- a/src/main/java/club/joylink/rtss/controller/simulation/SimulationV1Controller.java +++ b/src/main/java/club/joylink/rtss/controller/simulation/SimulationV1Controller.java @@ -490,6 +490,14 @@ public class SimulationV1Controller { return simulationService.createSimulation(mapId, paramVO, loginUserInfoVO); } + /** + * 根据地图功能id创建仿真 + */ + @PostMapping("/new/mapFunction/{mapFunctionId}") + public String createSimulationByMapFunction(@PathVariable long mapFunctionId, @RequestAttribute LoginUserInfoVO loginInfo) { + return simulationService.createSimulation(mapFunctionId, loginInfo); + } + /** * 按计划行车(新) */ diff --git a/src/main/java/club/joylink/rtss/services/mapFunction/RtsMapFunctionService.java b/src/main/java/club/joylink/rtss/services/mapFunction/RtsMapFunctionService.java index e271431ef..7d03d2a60 100644 --- a/src/main/java/club/joylink/rtss/services/mapFunction/RtsMapFunctionService.java +++ b/src/main/java/club/joylink/rtss/services/mapFunction/RtsMapFunctionService.java @@ -12,6 +12,8 @@ public interface RtsMapFunctionService { void update(long id, RtsMapFunctionUpdateVO updateVO, long updaterId); + RtsMapFunctionVO get(long id); + /** * 列表查询地图子系统 */ diff --git a/src/main/java/club/joylink/rtss/services/mapFunction/RtsMapFunctionServiceImpl.java b/src/main/java/club/joylink/rtss/services/mapFunction/RtsMapFunctionServiceImpl.java index 6f791cfaf..61996bbb7 100644 --- a/src/main/java/club/joylink/rtss/services/mapFunction/RtsMapFunctionServiceImpl.java +++ b/src/main/java/club/joylink/rtss/services/mapFunction/RtsMapFunctionServiceImpl.java @@ -56,6 +56,12 @@ public class RtsMapFunctionServiceImpl implements RtsMapFunctionService { rtsMapFunctionDAO.updateByPrimaryKeyWithBLOBs(entity); } + @Override + public RtsMapFunctionVO get(long id) { + RtsMapFunction entity = getEntity(id); + return new RtsMapFunctionVO(entity); + } + @Override public List listQuery(RtsMapFunctionQueryVO queryVO) { RtsMapFunctionExample example = new RtsMapFunctionExample(); diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/SimulationService.java b/src/main/java/club/joylink/rtss/simulation/cbtc/SimulationService.java index 2dbe55dca..74f55ef14 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/SimulationService.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/SimulationService.java @@ -14,6 +14,8 @@ public interface SimulationService { */ String createSimulation(long mapId, SimulationWorkParamVO workParamVO, @NonNull LoginUserInfoVO loginUserInfoVO); + String createSimulation(long mapFunctionId, LoginUserInfoVO loginInfo); + /** * 给仿真添加功能 */ diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/SimulationServiceImpl.java b/src/main/java/club/joylink/rtss/simulation/cbtc/SimulationServiceImpl.java index 67f286dae..deedec6e5 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/SimulationServiceImpl.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/SimulationServiceImpl.java @@ -1,6 +1,7 @@ package club.joylink.rtss.simulation.cbtc; import club.joylink.rtss.exception.BusinessExceptionAssertEnum; +import club.joylink.rtss.services.mapFunction.RtsMapFunctionService; import club.joylink.rtss.simulation.SimulationManager; import club.joylink.rtss.simulation.cbtc.event.SimulationCreateSuccessEvent; import club.joylink.rtss.simulation.cbtc.vo.SimulationWorkParamVO; @@ -8,6 +9,7 @@ import club.joylink.rtss.simulation.cbtc.work.SimulationWorkService; import club.joylink.rtss.simulation.cbtc.work.SimulationWorkServiceManager; import club.joylink.rtss.simulation.messaging.websocket.DefaultMessageSender; import club.joylink.rtss.vo.LoginUserInfoVO; +import club.joylink.rtss.vo.client.mapFunction.RtsMapFunctionVO; import club.joylink.rtss.vo.client.simulationv1.RunAsPlanParam; import lombok.NonNull; import org.springframework.beans.factory.annotation.Autowired; @@ -32,6 +34,8 @@ public class SimulationServiceImpl implements SimulationService { private ApplicationContext applicationContext; @Autowired private DefaultMessageSender defaultMessageSender; + @Autowired + private RtsMapFunctionService rtsMapFunctionService; @Override public String createSimulation(long mapId, SimulationWorkParamVO workParamVO, @NonNull LoginUserInfoVO loginUserInfoVO) { @@ -68,6 +72,14 @@ public class SimulationServiceImpl implements SimulationService { return simulation.getId(); } + @Override + public String createSimulation(long mapFunctionId, LoginUserInfoVO loginInfo) { + RtsMapFunctionVO rtsMapFunctionVO = rtsMapFunctionService.get(mapFunctionId); + Long mapId = rtsMapFunctionVO.getMapId(); + SimulationWorkParamVO workParamVO = rtsMapFunctionVO.getParamVO(); + return createSimulation(mapId, workParamVO, loginInfo); + } + @Override public void addItems(@NonNull String simulationId, Map functionInfoMap, LoginUserInfoVO loginInfo) { if (!CollectionUtils.isEmpty(functionInfoMap)) {