增加通过地图功能id创建仿真的接口

This commit is contained in:
joylink_zhangsai 2022-11-02 13:44:43 +08:00
parent 5a197b5e90
commit 329a36ef48
5 changed files with 30 additions and 0 deletions

View File

@ -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);
}
/**
* 按计划行车
*/

View File

@ -12,6 +12,8 @@ public interface RtsMapFunctionService {
void update(long id, RtsMapFunctionUpdateVO updateVO, long updaterId);
RtsMapFunctionVO get(long id);
/**
* 列表查询地图子系统
*/

View File

@ -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<RtsMapFunctionVO> listQuery(RtsMapFunctionQueryVO queryVO) {
RtsMapFunctionExample example = new RtsMapFunctionExample();

View File

@ -14,6 +14,8 @@ public interface SimulationService {
*/
String createSimulation(long mapId, SimulationWorkParamVO workParamVO, @NonNull LoginUserInfoVO loginUserInfoVO);
String createSimulation(long mapFunctionId, LoginUserInfoVO loginInfo);
/**
* 给仿真添加功能
*/

View File

@ -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<SimulationWorkParamVO.Item, String> functionInfoMap, LoginUserInfoVO loginInfo) {
if (!CollectionUtils.isEmpty(functionInfoMap)) {