Bläddra i källkod

传感器配置、动力学配置、车辆配置公有删除接口

root 2 år sedan
förälder
incheckning
5c226ba9c9

+ 20 - 21
simulation-resource-server/src/main/java/com/css/simulation/resource/algorithm/ctrl/AlgorithmCtrl.java → simulation-resource-server/src/main/java/com/css/simulation/resource/algorithm/controller/AlgorithmController.java

@@ -1,4 +1,4 @@
-package com.css.simulation.resource.algorithm.ctrl;
+package com.css.simulation.resource.algorithm.controller;
 
 
 import api.common.pojo.common.ResponseBodyVO;
@@ -19,10 +19,18 @@ import java.util.Map;
  */
 @Controller
 @RequestMapping(value = "/algorithm",name = LogConstants.MODULE_ALGORITH)
-public class AlgorithmCtrl {
+public class AlgorithmController {
 
     @Resource
-    private AlgorithmService service;
+    private AlgorithmService algorithmService;
+
+    //* -------------------------------- Comm删除算法ent --------------------------------
+    @RequestMapping("deleteByid")
+    @ResponseBody
+    public ResponseBodyVO<String> deleteById(@RequestBody AlgorithmParameter param){
+        return algorithmService.deleteById(param);
+    }
+    //* -------------------------------- Comment --------------------------------
 
 
     /**
@@ -31,7 +39,7 @@ public class AlgorithmCtrl {
     @RequestMapping("addOrUpdate")
     @ResponseBody
     public ResponseBodyVO addOrUpdate(@RequestBody AlgorithmParameter param) throws IOException {
-        return service.addOrUpdate(param);
+        return algorithmService.addOrUpdate(param);
     }
 
 
@@ -43,7 +51,7 @@ public class AlgorithmCtrl {
     @RequestMapping("selectAlgorithmList")
     @ResponseBody
     public ResponseBodyVO selectAlgorithmList(@RequestBody AlgorithmParameter param){
-        return service.selectAlgorithmList(param);
+        return algorithmService.selectAlgorithmList(param);
     }
 
     /**
@@ -54,7 +62,7 @@ public class AlgorithmCtrl {
     @RequestMapping("selectAlgoPlatformList")
     @ResponseBody
     public ResponseBodyVO selectAlgoPlatformList(@RequestBody AlgorithmParameter param){
-        return service.selectAlgoPlatformList(param);
+        return algorithmService.selectAlgoPlatformList(param);
     }
 
 
@@ -66,18 +74,9 @@ public class AlgorithmCtrl {
     @RequestMapping("selectSharedAlgorithmList")
     @ResponseBody
     public ResponseBodyVO selectSharedAlgorithmList(@RequestBody AlgorithmParameter param){
-        return service.selectSharedAlgorithmList(param);
+        return algorithmService.selectSharedAlgorithmList(param);
     }
 
-     /**
-     * 删除算法
-     * @return
-     */
-    @RequestMapping("deleteByid")
-    @ResponseBody
-    public ResponseBodyVO<String> deleteById(@RequestBody AlgorithmParameter param){
-        return service.deleteById(param);
-    }
 
     /**
      * 删除算法前校验
@@ -85,7 +84,7 @@ public class AlgorithmCtrl {
     @RequestMapping("deleteCheck")
     @ResponseBody
     public ResponseBodyVO<Map<String,String>> deleteCheck(@RequestBody AlgorithmParameter param){
-        return service.deleteCheck(param);
+        return algorithmService.deleteCheck(param);
     }
 
 
@@ -96,7 +95,7 @@ public class AlgorithmCtrl {
     @RequestMapping("shareAlgorithm")
     @ResponseBody
     public ResponseBodyVO shareAlgorithm(@RequestBody AlgorithmParameter param){
-        return service.shareAlgorithm(param);
+        return algorithmService.shareAlgorithm(param);
     }
 
 
@@ -109,7 +108,7 @@ public class AlgorithmCtrl {
     @ResponseBody
     public ResponseBodyVO selectDetailsById(@RequestBody AlgorithmParameter param){
         String algorithmId = param.getId();
-        return service.selectDetailsById(algorithmId);
+        return algorithmService.selectDetailsById(algorithmId);
     }
 
     /**
@@ -118,7 +117,7 @@ public class AlgorithmCtrl {
     @RequestMapping("testConnection")
     @ResponseBody
     public ResponseBodyVO<String> testConnection(@RequestBody AlgorithmParameter param){
-        return service.testConnection(param);
+        return algorithmService.testConnection(param);
     }
 
     /**
@@ -128,7 +127,7 @@ public class AlgorithmCtrl {
     @ResponseBody
     public ResponseBodyVO<String> getGitVersion(@RequestBody AlgorithmParameter param) {
         String id = param.getId();
-        String gitVersion = service.getGitVersion(id);
+        String gitVersion = algorithmService.getGitVersion(id);
         return new ResponseBodyVO<>(ResponseBodyVO.Response.SUCCESS,"请求成功。", gitVersion);
     }
 

+ 7 - 5
simulation-resource-server/src/main/java/com/css/simulation/resource/algorithm/serviceImpl/AlgorithmServiceImpl.java → simulation-resource-server/src/main/java/com/css/simulation/resource/algorithm/service/impl/AlgorithmServiceImpl.java

@@ -1,4 +1,4 @@
-package com.css.simulation.resource.algorithm.serviceImpl;
+package com.css.simulation.resource.algorithm.service.impl;
 
 import api.common.pojo.common.ResponseBodyVO;
 import api.common.pojo.constants.DictConstants;
@@ -22,6 +22,7 @@ import com.css.simulation.resource.feign.SchedulerService;
 import com.css.simulation.resource.project.service.SimulationProjectService;
 import com.css.simulation.resource.system.service.DictService;
 import com.github.pagehelper.PageInfo;
+import lombok.SneakyThrows;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Qualifier;
 import org.springframework.stereotype.Service;
@@ -64,26 +65,27 @@ public class AlgorithmServiceImpl implements AlgorithmService {
 
 
     @Override
-    public ResponseBodyVO addOrUpdate(AlgorithmParameter param) {
+    @SneakyThrows
+    public ResponseBodyVO<String> addOrUpdate(AlgorithmParameter param) {
 
         String currentUserId = AuthUtil.getCurrentUserId();
         param.setCreateUserId(currentUserId);
         List<AlgorithmPO> algorithmPOS = algorithmMapper.selectAlgorithmName(param);
         if (algorithmPOS != null && algorithmPOS.size() > 0) {
-            return new ResponseBodyVO(ResponseBodyVO.Response.SERVER_FAILURE, "该算法名称已存在!");
+            return new ResponseBodyVO<>(ResponseBodyVO.Response.SERVER_FAILURE, "该算法名称已存在!");
         } else {
             String uploadMode = param.getUploadMode();
             if (DictConstants.FILE.equals(uploadMode)) {
                 String minioPath = param.getMinioPath();
                 ResponseBodyVO<String> checkRes = schedulerService.check(minioPath);
                 if (ObjectUtil.isNull(checkRes)) {
-                    return new ResponseBodyVO(ResponseBodyVO.Response.SERVER_FAILURE, "算法校验服务异常,请联系管理人员!");
+                    return new ResponseBodyVO<>(ResponseBodyVO.Response.SERVER_FAILURE, "算法校验服务异常,请联系管理人员!");
                 }
                 if (!checkRes.isStatus()) {//校验失败
                     MinioParameter minioParameter = new MinioParameter();
                     minioParameter.setObjectName(minioPath);
                     fileDownService.remove(minioParameter);
-                    return new ResponseBodyVO(ResponseBodyVO.Response.SERVER_FAILURE, "该算法经校验不可用,无法保存!");
+                    return new ResponseBodyVO<>(ResponseBodyVO.Response.SERVER_FAILURE, "该算法经校验不可用,无法保存!");
                 }
             }
             return doAddOrUpdate(param);

+ 1 - 5
simulation-resource-server/src/main/java/com/css/simulation/resource/model/controller/ModelConfigController.java

@@ -144,10 +144,6 @@ public class ModelConfigController {
     @RequestMapping("/delConfigById")
     public ResponseBodyVO<String> delConfigById(@RequestBody ConfigVO configVO) {
         int i = configService.delConfigById(configVO);
-        if (i > 0) {
-            return new ResponseBodyVO<>(ResponseBodyVO.Response.SUCCESS);
-        } else {
-            return new ResponseBodyVO<>(false, 500, "删除失败!", null);
-        }
+        return new ResponseBodyVO<>(ResponseBodyVO.Response.SUCCESS);
     }
 }

+ 1 - 0
simulation-resource-server/src/main/java/com/css/simulation/resource/model/controller/VehicleController.java

@@ -32,6 +32,7 @@ public class VehicleController {
         vehicleService.delVehicleById(vehiclePO);
         return new ResponseBodyVO<>(ResponseBodyVO.Response.SUCCESS);
     }
+    //* -------------------------------- Comment --------------------------------
 
     /**
      * 获取列表

+ 9 - 12
simulation-resource-server/src/main/java/com/css/simulation/resource/scene/ctrl/SceneNaturalController.java

@@ -8,7 +8,6 @@ import api.common.pojo.param.scene.SceneNaturalParam;
 import api.common.pojo.po.scene.SceneNaturalPO;
 import api.common.pojo.po.system.SceneImportPO;
 import api.common.pojo.vo.scene.SceneNaturalVO;
-import api.common.util.ObjectUtil;
 import com.css.simulation.resource.common.utils.PageUtil;
 import com.css.simulation.resource.scene.service.SceneNaturalService;
 import com.css.simulation.resource.system.service.SceneImportService;
@@ -33,6 +32,14 @@ public class SceneNaturalController {
     @Resource
     private SceneImportService sceneImportService;
 
+    //* -------------------------------- 删除自然驾驶 --------------------------------
+    @PostMapping("/deleteSceneNatural")
+    public ResponseBodyVO<String> deleteSceneNatural(@RequestBody SceneNaturalPO params) {
+        sceneNaturalService.deleteSceneNatural(params);
+        return new ResponseBodyVO<>(ResponseBodyVO.Response.SUCCESS);
+    }
+    //* -------------------------------- Comment --------------------------------
+
 
 
     /**
@@ -68,17 +75,7 @@ public class SceneNaturalController {
         return new ResponseBodyVO<>(ResponseBodyVO.Response.SUCCESS);
     }
 
-    /**
-     * 删除
-     */
-    @PostMapping("/deleteSceneNatural")
-    public ResponseBodyVO<String> deleteSceneNatural(@RequestBody SceneNaturalPO params) {
-        if (ObjectUtil.isNull(params.getNaturalId())) {
-            return new ResponseBodyVO<>(ResponseBodyVO.Response.CLIENT_FAILURE, "参数场景Id不能为空,请检查");
-        }
-        sceneNaturalService.deleteSceneNatural(params);
-        return new ResponseBodyVO<>(ResponseBodyVO.Response.SUCCESS);
-    }
+
 
     /**
      * 解析已经上传好的数据