root 2 år sedan
förälder
incheckning
64c21260c6

+ 6 - 0
simulation-resource-server/src/main/java/com/css/simulation/resource/algorithm/mapper/AlgorithmMapper.java

@@ -30,6 +30,12 @@ public interface AlgorithmMapper {
             "        where a.id = #{algorithmId,jdbcType=VARCHAR}")
     String selectIsDeletedById(@Param("algorithmId") String algorithmId);
 
+    @Select("select a.algorithm_name \n" +
+            "from `algorithm` a \n" +
+            "where is_deleted = '1'\n" +
+            " and a.id = #{algorithmId,jdbcType=VARCHAR}")
+    String selectDeletedById(@Param("algorithmId") String algorithmId);
+
     List<AlgorithmPO> selectAlgorithmName(AlgorithmParameter param);
 
     List<AlgorithmPO> selectSharedAlgorithmName(@Param("algorithmName") String algorithmName);

+ 3 - 2
simulation-resource-server/src/main/java/com/css/simulation/resource/project/ctrl/SimulationProjectCtrl.java

@@ -5,6 +5,7 @@ import api.common.pojo.param.project.DictParam;
 import api.common.pojo.param.project.SimulationManualProjectParam;
 import api.common.pojo.vo.project.DropDownTypeVo;
 import api.common.pojo.vo.project.ProjectTaskDetailsVo;
+import api.common.pojo.vo.project.SimulationManualProjectSingleVo;
 import api.common.pojo.vo.project.SimulationManualProjectVo;
 import api.common.util.StringUtil;
 import com.css.simulation.resource.project.service.SimulationProjectService;
@@ -269,7 +270,7 @@ public class SimulationProjectCtrl {
      */
     @RequestMapping("updateAutomaticRunState")
     @ResponseBody
-    public ResponseBodyVO updateAutomaticRunState(@RequestBody SimulationManualProjectParam param) {
+    public ResponseBodyVO<String> updateAutomaticRunState(@RequestBody SimulationManualProjectParam param) {
         return service.updateAutomaticRunState(param);
     }
 
@@ -331,7 +332,7 @@ public class SimulationProjectCtrl {
      */
     @RequestMapping("selectAutomaticProjectById")
     @ResponseBody
-    public ResponseBodyVO selectAutomaticProjectById(@RequestBody SimulationManualProjectParam param) {
+    public ResponseBodyVO<SimulationManualProjectSingleVo> selectAutomaticProjectById(@RequestBody SimulationManualProjectParam param) {
         return service.selectAutomaticProjectById(param);
     }
 

+ 32 - 29
simulation-resource-server/src/main/java/com/css/simulation/resource/project/impl/SimulationProjectServiceImpl.java

@@ -557,7 +557,7 @@ public class SimulationProjectServiceImpl implements SimulationProjectService {
         if (vehicleBaseInfoVo != null) {
             projectDetailsVo.setVehicleName(vehicleBaseInfoVo.getVehicleName());
             projectDetailsVo.setVehicleDescribe(vehicleBaseInfoVo.getDescription());
-            projectDetailsVo.setVehicleTopView(vehicleBaseInfoVo.getVehicleTopView());
+            projectDetailsVo.setVehicleTopView(vehicleBaseInfoVo.getVehicleFrontView());
 
         }
         projectDetailsVo.setSensorCameraList(sensorCameraList);
@@ -3698,7 +3698,7 @@ public class SimulationProjectServiceImpl implements SimulationProjectService {
     }
 
     @Override
-    public ResponseBodyVO updateAutomaticRunState(SimulationManualProjectParam param) {
+    public ResponseBodyVO<String> updateAutomaticRunState(SimulationManualProjectParam param) {
         String id = param.getId();
         String automaticRunState = param.getAutomaticRunState();
         Optional.ofNullable(id).orElseThrow(() -> new RuntimeException("id 不能为空。"));
@@ -3712,31 +3712,30 @@ public class SimulationProjectServiceImpl implements SimulationProjectService {
             //1 判断算法是否已经被删除
             String isDeleted = algorithmMapper.selectIsDeletedById(algorithmId);
             if (DictConstants.IS_DELETED.equals(isDeleted)) {
-                return new ResponseBodyVO(ResponseBodyVO.Response.SERVER_FAILURE, "算法已被删除,无法启动项目。", null);
+                return new ResponseBodyVO<>(ResponseBodyVO.Response.SERVER_FAILURE, "算法已被删除,无法启动项目。", null);
             }
-            //检查算法版本
-            //获取数据库中的算法版本
-            AlgorithmPO aPo = algorithmMapper.selectDetailsById(algorithmId);
-            String gitVersion = aPo.getGitVersion();
-            //获取当前算法版本
+//            //获取数据库中的算法版本
+//            AlgorithmPO aPo = algorithmMapper.selectDetailsById(algorithmId);
+//            String gitVersion = aPo.getGitVersion();
+//            //获取当前算法版本
             String currentGitVersion = algorithmService.getGitVersion(algorithmId);
-            boolean isRun = false; //判断是否启动运行
-            //首次获取版本
-            if (StringUtil.isEmpty(gitVersion)) {
-                isRun = true;
-            } else {
-                //非首次,比对版本,校验是否执行任务
-                if (!gitVersion.equals(currentGitVersion)) {
-                    isRun = true;
-                }
-            }
-            if (isRun) { //启动运行
-                simulationAutomaticProjectMapper.updateAutomaticRunState(param);
-                AlgorithmParameter algorithmParam = new AlgorithmParameter();
-                algorithmParam.setId(algorithmId);
-                algorithmParam.setGitVersion(currentGitVersion);
-                runProject(algorithmParam, param, po);
-            }
+//            boolean isRun = false; //判断是否启动运行
+//            //首次获取版本
+//            if (StringUtil.isEmpty(gitVersion)) {
+//                isRun = true;
+//            } else {
+//                //非首次,比对版本,校验是否执行任务
+//                if (!gitVersion.equals(currentGitVersion)) {
+//                    isRun = true;
+//                }
+//            }
+//            if (isRun) { //启动运行
+            simulationAutomaticProjectMapper.updateAutomaticRunState(param);
+            AlgorithmParameter algorithmParam = new AlgorithmParameter();
+            algorithmParam.setId(algorithmId);
+            algorithmParam.setGitVersion(currentGitVersion);
+            runProject(algorithmParam, param, po);
+//            }
         } else if ("1".equals(param.getAutomaticRunState())) {  // 停止
             simulationAutomaticProjectMapper.updateAutomaticRunState(param);
             //推送定时请求
@@ -3984,18 +3983,22 @@ public class SimulationProjectServiceImpl implements SimulationProjectService {
     }
 
     @Override
-    public ResponseBodyVO selectAutomaticProjectById(SimulationManualProjectParam param) {
+    public ResponseBodyVO<SimulationManualProjectSingleVo> selectAutomaticProjectById(SimulationManualProjectParam param) {
 
         if (isEmpty(param.getId())) {
-            return new ResponseBodyVO(ResponseBodyVO.Response.CLIENT_FAILURE, "id不能为空");
+            return new ResponseBodyVO<>(ResponseBodyVO.Response.CLIENT_FAILURE, "id不能为空");
         }
         SimulationAutomaticProjectPo po = simulationAutomaticProjectMapper.selectById(param.getId());
         if (po == null) {
-            return new ResponseBodyVO(ResponseBodyVO.Response.SERVER_FAILURE, "没有获取到数据");
+            return new ResponseBodyVO<>(ResponseBodyVO.Response.SERVER_FAILURE, "没有获取到数据");
+        }
+        String deletedName = algorithmMapper.selectDeletedById(po.getAlgorithm());
+        if(StringUtil.isNotEmpty(deletedName)){
+            po.setAlgorithm(deletedName+"(已删除)");
         }
         SimulationManualProjectSingleVo vo = new SimulationManualProjectSingleVo();
         convertPoToVo(po, vo);
-        return new ResponseBodyVO(ResponseBodyVO.Response.SUCCESS, vo);
+        return new ResponseBodyVO<>(ResponseBodyVO.Response.SUCCESS, vo);
 
     }
 

+ 3 - 6
simulation-resource-server/src/main/java/com/css/simulation/resource/project/service/SimulationProjectService.java

@@ -2,10 +2,7 @@ package com.css.simulation.resource.project.service;
 
 import api.common.pojo.common.ResponseBodyVO;
 import api.common.pojo.param.project.SimulationManualProjectParam;
-import api.common.pojo.vo.project.DropDownTypeVo;
-import api.common.pojo.vo.project.ProjectReportVo;
-import api.common.pojo.vo.project.ProjectTaskDetailsVo;
-import api.common.pojo.vo.project.SimulationManualProjectVo;
+import api.common.pojo.vo.project.*;
 import com.github.pagehelper.PageInfo;
 
 import java.util.List;
@@ -64,7 +61,7 @@ public interface SimulationProjectService {
 
     ResponseBodyVO deleteAutomaticProjectByids(SimulationManualProjectParam param);
 
-    ResponseBodyVO updateAutomaticRunState(SimulationManualProjectParam param);
+    ResponseBodyVO<String> updateAutomaticRunState(SimulationManualProjectParam param);
 
     ResponseBodyVO<PageInfo<SimulationManualProjectVo>> selectAutomaticProject(SimulationManualProjectParam param);
 
@@ -76,7 +73,7 @@ public interface SimulationProjectService {
 
     ResponseBodyVO<PageInfo<SimulationManualProjectVo>> selectSubProjectList(SimulationManualProjectParam param);
 
-    ResponseBodyVO selectAutomaticProjectById(SimulationManualProjectParam param);
+    ResponseBodyVO<SimulationManualProjectSingleVo> selectAutomaticProjectById(SimulationManualProjectParam param);
 
     ResponseBodyVO updateAutoProjectNowRunState(SimulationManualProjectParam param);
 

+ 1 - 1
simulation-resource-server/src/main/resources/mapper/project/SimulationProjectMapper.xml

@@ -294,7 +294,7 @@
 
     <!--获取车辆基本信息-->
     <select id="selectVehicleBaseInfoById" parameterType="string" resultType="api.common.pojo.po.model.VehiclePO">
-        select a.id, a.vehicle_name, a.description, a.vehicle_top_view
+        select a.id, a.vehicle_name, a.description, a.vehicle_top_view,a.vehicle_front_view
         from model_vehicle a
         where is_deleted = '0'
         <if test="id != null and id != ''">