|
@@ -0,0 +1,116 @@
|
|
|
|
+package com.css.simulation.resource.server.app.impl;
|
|
|
|
+
|
|
|
|
+import api.common.pojo.common.PageVO;
|
|
|
|
+import api.common.pojo.common.ResponseBodyVO;
|
|
|
|
+import api.common.pojo.enums.MultiSimulationStatusEnum;
|
|
|
|
+import api.common.pojo.param.map.SimulationMapParam;
|
|
|
|
+import api.common.pojo.param.project.MultiSimulationProjectParam;
|
|
|
|
+import api.common.pojo.param.project.MultiSimulationSceneCarParam;
|
|
|
|
+import api.common.pojo.param.project.MultiSimulationSceneParam;
|
|
|
|
+import api.common.pojo.po.algorithm.AlgorithmPO;
|
|
|
|
+import api.common.pojo.po.model.ConfigPO;
|
|
|
|
+import api.common.pojo.po.project.MultiSimulationProjectPO;
|
|
|
|
+import api.common.pojo.po.project.MultiSimulationScenePO;
|
|
|
|
+import api.common.pojo.vo.map.SimulationMapVO;
|
|
|
|
+import api.common.pojo.vo.project.MultiSimulationProjectDetailVO;
|
|
|
|
+import api.common.pojo.vo.project.MultiSimulationProjectVO;
|
|
|
|
+import api.common.pojo.vo.project.MultiSimulationSceneCarVO;
|
|
|
|
+import api.common.pojo.vo.project.MultiSimulationSceneVO;
|
|
|
|
+import api.common.util.StringUtil;
|
|
|
|
+import com.alibaba.cloud.commons.lang.StringUtils;
|
|
|
|
+import com.css.simulation.resource.server.app.service.job_manage.MultiSimulationProjectService;
|
|
|
|
+import com.css.simulation.resource.server.app.service.job_manage.SimulationMapService;
|
|
|
|
+import com.css.simulation.resource.server.infra.db.mysql.mapper.*;
|
|
|
|
+import com.css.simulation.resource.server.infra.util.PageUtil;
|
|
|
|
+import com.github.pagehelper.PageInfo;
|
|
|
|
+import lombok.SneakyThrows;
|
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
|
+import org.springframework.util.CollectionUtils;
|
|
|
|
+
|
|
|
|
+import javax.annotation.Resource;
|
|
|
|
+import java.util.List;
|
|
|
|
+import java.util.Objects;
|
|
|
|
+
|
|
|
|
+@Service
|
|
|
|
+@Slf4j
|
|
|
|
+public class SimulationMapServiceImpl implements SimulationMapService {
|
|
|
|
+
|
|
|
|
+ @Resource
|
|
|
|
+ private SimulationMapMapper mapMapper;
|
|
|
|
+ @Override
|
|
|
|
+ @SneakyThrows
|
|
|
|
+ public ResponseBodyVO<PageInfo<SimulationMapVO>> selectMultiSimulationMap(SimulationMapParam param){
|
|
|
|
+ if (Objects.isNull(param.getPageNum())){
|
|
|
|
+ param.setPageNum(1);
|
|
|
|
+ }
|
|
|
|
+ if (Objects.isNull(param.getPageSize())){
|
|
|
|
+ param.setPageSize(10);
|
|
|
|
+ }
|
|
|
|
+ if (StringUtils.isBlank(param.getMapName())){
|
|
|
|
+ param.setMapName(null);
|
|
|
|
+ }
|
|
|
|
+ if (StringUtils.isBlank(param.getMapDescription())){
|
|
|
|
+ param.setMapDescription(null);
|
|
|
|
+ }
|
|
|
|
+ setPage(param.getPageNum(), param.getPageSize());
|
|
|
|
+ List<SimulationMapVO> simulationMapVOS = mapMapper.selectSimulationMapList(param);
|
|
|
|
+ PageInfo<SimulationMapVO> pageInfo = new PageInfo<>(simulationMapVOS);
|
|
|
|
+ return new ResponseBodyVO<>(ResponseBodyVO.Response.SUCCESS, pageInfo);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ @SneakyThrows
|
|
|
|
+ public ResponseBodyVO<List<SimulationMapVO>> selectAllSimulationMapList(SimulationMapParam param){
|
|
|
|
+ List<SimulationMapVO> simulationMapVOS = mapMapper.selectSimulationMapList(param);
|
|
|
|
+ return new ResponseBodyVO<>(ResponseBodyVO.Response.SUCCESS, simulationMapVOS);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ @SneakyThrows
|
|
|
|
+ public ResponseBodyVO<SimulationMapVO> getSimulationMap(SimulationMapParam param){
|
|
|
|
+ if (StringUtils.isBlank(param.getMapId())){
|
|
|
|
+ return new ResponseBodyVO<>(ResponseBodyVO.Response.CLIENT_FAILURE, "地图id为空");
|
|
|
|
+ }
|
|
|
|
+ SimulationMapVO simulationMapVO = mapMapper.selectMapByMapId(param.getMapId());
|
|
|
|
+ if (Objects.isNull(simulationMapVO)){
|
|
|
|
+ return new ResponseBodyVO<>(ResponseBodyVO.Response.CLIENT_FAILURE, "未找到有效的id");
|
|
|
|
+ }
|
|
|
|
+ return new ResponseBodyVO<>(ResponseBodyVO.Response.SUCCESS, simulationMapVO);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ public ResponseBodyVO updateSimulationMap(SimulationMapParam param){
|
|
|
|
+ if (StringUtils.isBlank(param.getMapId())){
|
|
|
|
+ return new ResponseBodyVO<>(ResponseBodyVO.Response.CLIENT_FAILURE, "地图id为空");
|
|
|
|
+ }
|
|
|
|
+ if (Objects.isNull(param.getPathNum())){
|
|
|
|
+ param.setPathNum(0);
|
|
|
|
+ }
|
|
|
|
+ if (StringUtils.isBlank(param.getMapDescription())){
|
|
|
|
+ param.setMapDescription("");
|
|
|
|
+ }
|
|
|
|
+ int i = mapMapper.updateMultiSimulationScene(param);
|
|
|
|
+ if (i > 0){
|
|
|
|
+ return new ResponseBodyVO<>(ResponseBodyVO.Response.SUCCESS);
|
|
|
|
+ }
|
|
|
|
+ return new ResponseBodyVO<>(ResponseBodyVO.Response.CLIENT_FAILURE);
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ public ResponseBodyVO deleteSimulationMap(SimulationMapParam param){
|
|
|
|
+ if (StringUtils.isBlank(param.getMapId())){
|
|
|
|
+ return new ResponseBodyVO<>(ResponseBodyVO.Response.CLIENT_FAILURE, "地图id为空");
|
|
|
|
+ }
|
|
|
|
+ int i = mapMapper.deleteMultiSimulationScene(param);
|
|
|
|
+ if (i > 0){
|
|
|
|
+ return new ResponseBodyVO<>(ResponseBodyVO.Response.SUCCESS);
|
|
|
|
+ }
|
|
|
|
+ return new ResponseBodyVO<>(ResponseBodyVO.Response.CLIENT_FAILURE);
|
|
|
|
+ }
|
|
|
|
+ private void setPage(Integer pageNum, Integer pageSize) {
|
|
|
|
+ PageVO pageVO = new PageVO();
|
|
|
|
+ pageVO.setCurrentPage(pageNum);
|
|
|
|
+ pageVO.setPageSize(pageSize);
|
|
|
|
+ PageUtil.setPageInfo(pageVO);
|
|
|
|
+ }
|
|
|
|
+}
|