Selaa lähdekoodia

Merge remote-tracking branch 'origin/master'

martin 3 vuotta sitten
vanhempi
commit
60e8b9799d
57 muutettua tiedostoa jossa 1332 lisäystä ja 899 poistoa
  1. 3 0
      api-common/src/main/java/api/common/pojo/constants/DictConstants.java
  2. 2 2
      api-common/src/main/java/api/common/pojo/param/algorithm/AlgorithmParameter.java
  3. 1 1
      api-common/src/main/java/api/common/pojo/param/scene/SceneAccidentParam.java
  4. 1 0
      api-common/src/main/java/api/common/pojo/param/scene/SceneNaturalNewParam.java
  5. 1 0
      api-common/src/main/java/api/common/pojo/param/scene/SceneNaturalParam.java
  6. 1 1
      api-common/src/main/java/api/common/pojo/param/scene/ScenePackageSublistParam.java
  7. 1 1
      api-common/src/main/java/api/common/pojo/param/scene/StandardsRegulationsParam.java
  8. 0 3
      api-common/src/main/java/api/common/pojo/po/algorithm/AlgorithmPO.java
  9. 1 1
      api-common/src/main/java/api/common/pojo/po/scene/ScenePackageSublistPO.java
  10. 0 15
      api-common/src/main/java/api/common/pojo/vo/algorithm/PageInfoVo.java
  11. 2 3
      api-common/src/main/java/api/common/pojo/vo/scene/ScenePackageSublistVO.java
  12. 4 0
      api-common/src/main/java/api/common/pojo/vo/scene/ScenePackageVO.java
  13. 1 1
      api-common/src/main/java/api/common/pojo/vo/system/DictVO.java
  14. 24 0
      api-common/src/main/java/api/common/pojo/vo/system/MenuVO.java
  15. 38 0
      api-common/src/main/java/api/common/util/ObjectUtil.java
  16. 12 0
      api-common/src/main/java/api/common/util/TimeUtil.java
  17. 2 0
      simulation-resource-server/src/main/java/com/css/simulation/resource/Application.java
  18. 5 4
      simulation-resource-server/src/main/java/com/css/simulation/resource/algorithm/ctrl/AlgorithmCtrl.java
  19. 4 0
      simulation-resource-server/src/main/java/com/css/simulation/resource/algorithm/mapper/AlgorithmMapper.java
  20. 1 0
      simulation-resource-server/src/main/java/com/css/simulation/resource/algorithm/service/AlgorithmService.java
  21. 69 122
      simulation-resource-server/src/main/java/com/css/simulation/resource/algorithm/serviceImpl/AlgorithmServiceImpl.java
  22. 3 3
      simulation-resource-server/src/main/java/com/css/simulation/resource/common/config/OAuth2Config.java
  23. 85 0
      simulation-resource-server/src/main/java/com/css/simulation/resource/common/config/TransactionConfig.java
  24. 11 0
      simulation-resource-server/src/main/java/com/css/simulation/resource/project/ctrl/SimulationProjectCtrl.java
  25. 47 24
      simulation-resource-server/src/main/java/com/css/simulation/resource/project/impl/SimulationProjectServiceImpl.java
  26. 3 1
      simulation-resource-server/src/main/java/com/css/simulation/resource/project/service/SimulationProjectService.java
  27. 38 57
      simulation-resource-server/src/main/java/com/css/simulation/resource/scene/ctrl/FileController.java
  28. 16 21
      simulation-resource-server/src/main/java/com/css/simulation/resource/scene/ctrl/SceneAccidentController.java
  29. 19 25
      simulation-resource-server/src/main/java/com/css/simulation/resource/scene/ctrl/SceneNaturalController.java
  30. 34 27
      simulation-resource-server/src/main/java/com/css/simulation/resource/scene/ctrl/ScenePackageController.java
  31. 45 59
      simulation-resource-server/src/main/java/com/css/simulation/resource/scene/ctrl/ScoringRulesController.java
  32. 15 26
      simulation-resource-server/src/main/java/com/css/simulation/resource/scene/ctrl/StandardsRegulationsController.java
  33. 6 5
      simulation-resource-server/src/main/java/com/css/simulation/resource/scene/mapper/SceneAccidentMapper.java
  34. 6 5
      simulation-resource-server/src/main/java/com/css/simulation/resource/scene/mapper/SceneNaturalMapper.java
  35. 13 13
      simulation-resource-server/src/main/java/com/css/simulation/resource/scene/mapper/ScenePackageMapper.java
  36. 8 10
      simulation-resource-server/src/main/java/com/css/simulation/resource/scene/mapper/ScenePackageSublistMapper.java
  37. 10 8
      simulation-resource-server/src/main/java/com/css/simulation/resource/scene/mapper/ScoringRulesMapper.java
  38. 7 3
      simulation-resource-server/src/main/java/com/css/simulation/resource/scene/mapper/StandardsRegulationsMapper.java
  39. 78 78
      simulation-resource-server/src/main/java/com/css/simulation/resource/scene/service/SceneAccidentService.java
  40. 133 121
      simulation-resource-server/src/main/java/com/css/simulation/resource/scene/service/SceneNaturalService.java
  41. 150 84
      simulation-resource-server/src/main/java/com/css/simulation/resource/scene/service/ScenePackageService.java
  42. 14 12
      simulation-resource-server/src/main/java/com/css/simulation/resource/scene/service/ScoringRulesService.java
  43. 56 45
      simulation-resource-server/src/main/java/com/css/simulation/resource/scene/service/StandardsRegulationsService.java
  44. 34 0
      simulation-resource-server/src/main/java/com/css/simulation/resource/system/ctrl/MenuCtrl.java
  45. 16 0
      simulation-resource-server/src/main/java/com/css/simulation/resource/system/mapper/MenuMapper.java
  46. 24 0
      simulation-resource-server/src/main/java/com/css/simulation/resource/system/service/MenuService.java
  47. 27 4
      simulation-resource-server/src/main/resources/mapper/algorithm/AlgorithmMapper.xml
  48. 8 6
      simulation-resource-server/src/main/resources/mapper/model/ConfigMapper.xml
  49. 1 0
      simulation-resource-server/src/main/resources/mapper/model/VehicleMapper.xml
  50. 2 2
      simulation-resource-server/src/main/resources/mapper/project/SimulationProjectMapper.xml
  51. 49 12
      simulation-resource-server/src/main/resources/mapper/scene/SceneAccidentMapper.xml
  52. 75 38
      simulation-resource-server/src/main/resources/mapper/scene/SceneNaturalMapper.xml
  53. 23 16
      simulation-resource-server/src/main/resources/mapper/scene/ScenePackageMapper.xml
  54. 24 21
      simulation-resource-server/src/main/resources/mapper/scene/ScenePackageSublistMapper.xml
  55. 14 11
      simulation-resource-server/src/main/resources/mapper/scene/ScoringRulesMapper.xml
  56. 44 8
      simulation-resource-server/src/main/resources/mapper/scene/StandardsRegulationsMapper.xml
  57. 21 0
      simulation-resource-server/src/main/resources/mapper/system/MenuMapper.xml

+ 3 - 0
api-common/src/main/java/api/common/pojo/constants/DictConstants.java

@@ -21,6 +21,9 @@ public class DictConstants {
     public static final String CONFLICT_TYPE = "conflictType"; // 冲突类型
     public static final String EVALUATION_LEVEL = "evaluationLevel";//项目评测等级
     public static final String PROJECT_RUN_STATE = "projectRunState";//项目运行状态
+    public static final String VALIDATION_STATUS = "validationStatus";//项目运行状态
+
+    public static final String ALGORITHM_FILE = "algorithmFile";//算法文件上传type
 
 
 

+ 2 - 2
api-common/src/main/java/api/common/pojo/param/algorithm/AlgorithmParameter.java

@@ -28,8 +28,8 @@ public class AlgorithmParameter extends PageParameter {
     //代码仓库访问令牌
     private String gitToken;
 
-    //算法文件
-    private MultipartFile file;
+    //算法文件在 minio 上的位置
+    private String minioPath;
 
     //是否删除
     private String isDeleted;

+ 1 - 1
api-common/src/main/java/api/common/pojo/param/scene/SceneAccidentParam.java

@@ -22,7 +22,7 @@ public class SceneAccidentParam extends PageVO implements Serializable {
     private String[] selfReaction ; //自车反应行为
     private String[] conflictBehavior ; //冲突行为
     private String[] conflictType ; //冲突类型
-
+    private String[] ids ; //回显数组
     private String videoAddress ; //视频地址
     private String osgbAddress  ;//
     private String xmlAddress ; //

+ 1 - 0
api-common/src/main/java/api/common/pojo/param/scene/SceneNaturalNewParam.java

@@ -24,4 +24,5 @@ public class SceneNaturalNewParam extends PageVO implements Serializable {
     private String[][] trafficCondition ; //交通状况
     private String[][] selfBehavior  ;//自车行为
     private String[][] targetBehavior ; //目标行为
+    private String[] ids ; //回显数组
 }

+ 1 - 0
api-common/src/main/java/api/common/pojo/param/scene/SceneNaturalParam.java

@@ -62,5 +62,6 @@ public class SceneNaturalParam extends PageVO implements Serializable {
     private String xoscAddress ; //
     private String jsonAddress ; //
     private String videoPreview;//视频预览地址
+    private String[] ids ; //回显数组
 
 }

+ 1 - 1
api-common/src/main/java/api/common/pojo/param/scene/ScenePackageSublistParam.java

@@ -16,7 +16,7 @@ import java.util.List;
 @AllArgsConstructor
 public class ScenePackageSublistParam implements Serializable {
 
-    private String sublistId  ;//主键Id
+    private String id  ;//主键Id
     private String sublistName ; //指标名称
     private String weight;//权重
     private String ruleName ; //规则名称

+ 1 - 1
api-common/src/main/java/api/common/pojo/param/scene/StandardsRegulationsParam.java

@@ -27,6 +27,6 @@ public class StandardsRegulationsParam extends PageVO implements Serializable {
     private String xodrAddress ; //
     private String jsonAddress ; //
     private String videoPreview;//视频预览地址
-
+    private String[] ids ; //回显数组
 
 }

+ 0 - 3
api-common/src/main/java/api/common/pojo/po/algorithm/AlgorithmPO.java

@@ -34,9 +34,6 @@ public class AlgorithmPO extends BasePo {
     //算法文件在 minio 上的位置
     private String minioPath;
 
-    //算法文件的 linux 备份路径
-    private String linuxPath;
-
     //是否公有
     private String share;
 

+ 1 - 1
api-common/src/main/java/api/common/pojo/po/scene/ScenePackageSublistPO.java

@@ -15,7 +15,7 @@ import java.sql.Timestamp;
 @AllArgsConstructor
 public class ScenePackageSublistPO implements Serializable {
 
-    private String sublistId  ;//主键Id
+    private String id  ;//主键Id
     private String sublistName ; //指标名称
     private String weight;//权重
     private String ruleName ; //规则名称

+ 0 - 15
api-common/src/main/java/api/common/pojo/vo/algorithm/PageInfoVo.java

@@ -1,15 +0,0 @@
-package api.common.pojo.vo.algorithm;
-
-import lombok.Getter;
-import lombok.Setter;
-
-import java.util.List;
-
-@Getter
-@Setter
-public class PageInfoVo<T> {
-
-    private List<T> info;
-
-    private Long total;
-}

+ 2 - 3
api-common/src/main/java/api/common/pojo/vo/scene/ScenePackageSublistVO.java

@@ -15,7 +15,7 @@ import java.util.List;
 @AllArgsConstructor
 public class ScenePackageSublistVO implements Serializable {
 
-    private String sublistId  ;//主键Id
+    private String id  ;//主键Id
     private String sublistName ; //指标名称
     private String weight;//权重
     private String ruleName;//打分规则名称
@@ -30,6 +30,5 @@ public class ScenePackageSublistVO implements Serializable {
     private int packageLevel;//级别
     private String remarks;//备注
     private int seq;//在当前层级下的顺序,由小到大
-    private boolean hasChildren;
-    private List<ScenePackageSublistVO>  list;
+    private List<ScenePackageSublistVO>  children;
 }

+ 4 - 0
api-common/src/main/java/api/common/pojo/vo/scene/ScenePackageVO.java

@@ -25,5 +25,9 @@ public class ScenePackageVO extends PageVO implements Serializable {
      * 记录创建时间
      */
     public Timestamp createTime;
+    /**
+     * 修改时间
+     */
+    public Timestamp modifyTime;
 
 }

+ 1 - 1
api-common/src/main/java/api/common/pojo/vo/system/DictVO.java

@@ -18,7 +18,7 @@ public class DictVO {
     //编码
     private String dictCode;
     //序号
-    private String dictOrder;
+    private int dictOrder;
     //子对象
     private List<DictVO> children;
 }

+ 24 - 0
api-common/src/main/java/api/common/pojo/vo/system/MenuVO.java

@@ -0,0 +1,24 @@
+package api.common.pojo.vo.system;
+
+import lombok.Data;
+
+import java.util.List;
+
+@Data
+public class MenuVO {
+
+    //主键
+    private String id;
+    //菜单名称
+    private String name;
+    //菜单路由
+    private String router;
+    //菜单排序
+    private int sort;
+    //父id
+    private String parentId;
+    //是否可见
+    private String visible;
+
+    private List<MenuVO> children;
+}

+ 38 - 0
api-common/src/main/java/api/common/util/ObjectUtil.java

@@ -6,6 +6,8 @@ import org.springframework.beans.BeanUtils;
 
 import java.security.PublicKey;
 import java.util.*;
+import java.util.function.BiConsumer;
+import java.util.function.Function;
 
 public class ObjectUtil {
 
@@ -108,4 +110,40 @@ public class ObjectUtil {
     public static void voToPo(Object source, Object target){
         BeanUtils.copyProperties(source,target);
     }
+
+    /**
+     * list转tree结构,
+     * @param list List<T>类型数据源
+     * @param rootId tree的根节点id
+     * @param getId <T>类型获取id的方法
+     * @param getPid <T>类型获取父id的方法
+     * @param getChildren <T>类型获取子对象的方法
+     * @param setChildren <T>类型设置子对象的方法
+     * @param <T> 该对象满足父子关系的相关字段:id 和 父id
+     * @param <String> id的数据类型为String
+     * @return 树形结构的List<T>,多根型
+     */
+    public static <T,String> List<T> listToTree(List<T> list, String rootId, Function<T, String> getId , Function<T, String> getPid, Function<T, List<T>> getChildren, BiConsumer<T,List<T>> setChildren) {
+        List<T> treeList = new ArrayList<T>();
+        for (T node : list) {
+            if (rootId.equals(getPid.apply(node))) {
+                treeList.add(findChildren(node, list,getId,getPid,getChildren,setChildren));
+            }
+        }
+        return treeList;
+    }
+
+    /**
+     * list转tree递归调用
+     */
+    private static <T,String> T findChildren(T parent, List<T> list, Function<T, String> getId, Function<T, String> getPid, Function<T, List<T>> getChildren , BiConsumer<T,List<T>> setChildren) {
+        for (T node : list)
+            if (getId.apply(parent).equals(getPid.apply(node))) {
+                if (getChildren.apply(parent) == null || getChildren.apply(parent).size() == 0) {
+                    setChildren.accept(parent, new ArrayList<T>());
+                }
+                getChildren.apply(parent).add(findChildren(node, list, getId, getPid, getChildren,setChildren));
+            }
+        return parent;
+    }
 }

+ 12 - 0
api-common/src/main/java/api/common/util/TimeUtil.java

@@ -1,10 +1,13 @@
 package api.common.util;
 
 import java.sql.Timestamp;
+import java.text.SimpleDateFormat;
+import java.util.Date;
 import java.util.TimeZone;
 
 public class TimeUtil {
 
+    private static String[] dateFmtArr= new String[]{"yyyyMMdd", "yyyy-MM-dd HH:mm:ss","yyyy-MM-dd","HHmmssSS"};
 
     public static long getNow() {
         return System.currentTimeMillis();
@@ -16,5 +19,14 @@ public class TimeUtil {
 
     public static long zeroOfToday() {
         return System.currentTimeMillis() / (1000 * 3600 * 24) * (1000 * 3600 * 24) - TimeZone.getDefault().getRawOffset();
+    }
+        //获取时间类型格式转化
+    public static Integer getRq(Date date, int index){
+        SimpleDateFormat sdf = new SimpleDateFormat(dateFmtArr[index]);
+        if(date == null){
+            date = new Date();
+        }
+        return Integer.valueOf(sdf.format(date));
+
     }
 }

+ 2 - 0
simulation-resource-server/src/main/java/com/css/simulation/resource/Application.java

@@ -4,11 +4,13 @@ import org.springframework.boot.SpringApplication;
 import org.springframework.boot.autoconfigure.SpringBootApplication;
 import org.springframework.cloud.openfeign.EnableFeignClients;
 import org.springframework.security.oauth2.config.annotation.web.configuration.EnableResourceServer;
+import org.springframework.transaction.annotation.EnableTransactionManagement;
 
 
 @SpringBootApplication
 @EnableFeignClients
 @EnableResourceServer
+@EnableTransactionManagement
 public class Application {
 
     public static void main(String[] args) {

+ 5 - 4
simulation-resource-server/src/main/java/com/css/simulation/resource/algorithm/ctrl/AlgorithmCtrl.java

@@ -5,10 +5,10 @@ import api.common.pojo.common.ResponseBodyVO;
 import api.common.pojo.param.algorithm.AlgorithmParameter;
 import com.css.simulation.resource.algorithm.service.AlgorithmService;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.MediaType;
 import org.springframework.stereotype.Controller;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.ResponseBody;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
 
 import java.io.IOException;
 
@@ -30,10 +30,11 @@ public class AlgorithmCtrl {
      */
     @RequestMapping("addOrUpdate")
     @ResponseBody
-    public ResponseBodyVO addOrUpdate(AlgorithmParameter param) throws IOException {
+    public ResponseBodyVO addOrUpdate(@RequestBody AlgorithmParameter param) throws IOException {
         return service.addOrUpdate(param);
     }
 
+
     /**
      * 查询算法列表-私有导入和私有仓库页面
      * @param param

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

@@ -24,6 +24,10 @@ public interface AlgorithmMapper {
 
     AlgorithmPO selectDetailsById(AlgorithmParameter param);
 
+    List<AlgorithmPO> selectAlgorithmName(AlgorithmParameter param);
+
+    List<AlgorithmPO> selectSharedAlgorithmName(@Param("algorithmName") String algorithmName);
+
     List<RunningProjectVO> selectRunningProject(@Param("id") String id);
 
     List<AlgorithmVO> selectSharedAlgorithmList(AlgorithmParameter param);

+ 1 - 0
simulation-resource-server/src/main/java/com/css/simulation/resource/algorithm/service/AlgorithmService.java

@@ -2,6 +2,7 @@ package com.css.simulation.resource.algorithm.service;
 
 import api.common.pojo.common.ResponseBodyVO;
 import api.common.pojo.param.algorithm.AlgorithmParameter;
+import org.springframework.web.multipart.MultipartFile;
 
 import java.io.IOException;
 

+ 69 - 122
simulation-resource-server/src/main/java/com/css/simulation/resource/algorithm/serviceImpl/AlgorithmServiceImpl.java

@@ -1,96 +1,62 @@
 package com.css.simulation.resource.algorithm.serviceImpl;
-import api.common.pojo.common.PageVO;
 import api.common.pojo.common.ResponseBodyVO;
 import api.common.pojo.param.algorithm.AlgorithmParameter;
+import api.common.pojo.param.system.DictParam;
 import api.common.pojo.po.algorithm.AlgorithmPO;
-import api.common.pojo.vo.algorithm.PageInfoVo;
 import api.common.pojo.constants.DictConstants;
 import api.common.util.StringUtil;
 import api.common.util.FileUtil;
 import api.common.pojo.vo.algorithm.AlgorithmVO;
 import api.common.pojo.vo.algorithm.RunningProjectVO;
+import api.common.util.TimeUtil;
 import com.css.simulation.resource.common.utils.AuthUtil;
 import com.css.simulation.resource.common.utils.PageUtil;
 import com.css.simulation.resource.algorithm.mapper.AlgorithmMapper;
 import com.css.simulation.resource.algorithm.service.AlgorithmService;
 import com.css.simulation.resource.feign.FileDownService;
+import com.css.simulation.resource.system.service.DictService;
 import com.github.pagehelper.PageInfo;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
-import org.springframework.web.multipart.MultipartFile;
-
 import java.io.IOException;
-import java.io.InputStream;
-import java.util.Date;
 import java.util.List;
+import java.util.Map;
 
 @Service
 public class AlgorithmServiceImpl implements AlgorithmService {
 
     @Autowired
     private AlgorithmMapper algorithmMapper;
+
+    @Autowired
+    DictService dictService;
     
     @Autowired
     FileDownService fileDownService;
     
     @Override
-    public ResponseBodyVO addOrUpdate(AlgorithmParameter param) throws IOException {
-        if(isEmpty(param.getId())){
-            //添加
-            String algorithmId = StringUtil.getRandomUUID();
-            String uploadMode = param.getUploadMode();
-            if("1".equals(uploadMode)){
-                MultipartFile file = param.getFile();
-                String fileName = file.getOriginalFilename();
-                String linuxPath = "/opt/simulation-cloud/algorithm/" + algorithmId + "/" + fileName;
-                String minioPath = "algorithm/" + algorithmId + "/" + fileName;
-                boolean uploadSuccess = uploadFile(file, linuxPath, minioPath);
-                if(uploadSuccess) {
-                    param.setId(algorithmId);
-                    AlgorithmPO po = setPo(param, fileName, linuxPath, minioPath, false);
-                    int add = algorithmMapper.add(po);
-                    if(add > 0){
-                        return new ResponseBodyVO(ResponseBodyVO.Response.SUCCESS);
-                    }else {
-                        return new ResponseBodyVO(ResponseBodyVO.Response.SERVER_FAILURE,"添加失败");
-                    }
-                }else {
-                    return new ResponseBodyVO(ResponseBodyVO.Response.SERVER_FAILURE,"添加失败");
-                }
-            }else {
+    public ResponseBodyVO 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,"该算法名称已存在!");
+        }else {
+            if(isEmpty(param.getId())){
+                //添加
+                String algorithmId = StringUtil.getRandomUUID();
                 param.setId(algorithmId);
-                AlgorithmPO po = setPo(param, "", "", "", false);
+                AlgorithmPO po = setPo(param, false);
                 int add = algorithmMapper.add(po);
                 if(add > 0){
                     return new ResponseBodyVO(ResponseBodyVO.Response.SUCCESS);
                 }else {
                     return new ResponseBodyVO(ResponseBodyVO.Response.SERVER_FAILURE,"添加失败");
                 }
-            }
-        }else {
-            //编辑
-            String uploadMode = param.getUploadMode();
-            String algorithmId = param.getId();
-            if("1".equals(uploadMode)) {
-                MultipartFile file = param.getFile();
-                String fileName = file.getOriginalFilename();
-                String linuxPath = "/opt/simulation-cloud/algorithm/" + algorithmId + "/" + fileName;
-                String minioPath = "algorithm/" + algorithmId + "/" + fileName;
-
-                boolean uploadSuccess = uploadFile(file, linuxPath, minioPath);
-                if (uploadSuccess) {
-                    AlgorithmPO po = setPo(param, fileName, linuxPath, minioPath, true);
-                    int add = algorithmMapper.update(po);
-                    if (add > 0) {
-                        return new ResponseBodyVO(ResponseBodyVO.Response.SUCCESS);
-                    }else {
-                        return new ResponseBodyVO(ResponseBodyVO.Response.SERVER_FAILURE, "编辑失败");
-                    }
-                } else {
-                    return new ResponseBodyVO(ResponseBodyVO.Response.SERVER_FAILURE, "编辑失败");
-                }
             }else {
-                AlgorithmPO po = setPo(param, "", "", "", true);
+                //编辑
+                AlgorithmPO po = setPo(param, true);
                 int add = algorithmMapper.update(po);
                 if (add > 0) {
                     return new ResponseBodyVO(ResponseBodyVO.Response.SUCCESS);
@@ -99,37 +65,29 @@ public class AlgorithmServiceImpl implements AlgorithmService {
                 }
             }
         }
-
     }
 
     @Override
     public ResponseBodyVO selectAlgorithmList(AlgorithmParameter param) {
         param.setIsDeleted("0");
         param.setCreateUserId(AuthUtil.getCurrentUserId());
-        setPage(param.getPageNum()==null?1:param.getPageNum(), param.getPageSize()==null?10:param.getPageSize());
+        PageUtil.setPageInfo(param);
         List<AlgorithmVO> vos = algorithmMapper.selectAlgorithmList(param);
-        PageInfo<AlgorithmVO> pageInfo = new PageInfo<>(vos);
-        PageInfoVo<AlgorithmVO> result = new PageInfoVo<>();
-
-        result.setInfo(vos);
-        result.setTotal(pageInfo.getTotal());
-
-        return new ResponseBodyVO<>(ResponseBodyVO.Response.SUCCESS,result);
+        for (AlgorithmVO vo:vos){
+            vo.setValidationStatus(getDictName(DictConstants.VALIDATION_STATUS, vo.getValidationStatus()));
+        }
+        return new ResponseBodyVO<>(ResponseBodyVO.Response.SUCCESS,new PageInfo<>(vos));
     }
 
     @Override
     public ResponseBodyVO selectSharedAlgorithmList(AlgorithmParameter param) {
-        param.setIsDeleted("0");
         param.setShare("1");
-        setPage(param.getPageNum()==null?1:param.getPageNum(), param.getPageSize()==null?10:param.getPageSize());
+        PageUtil.setPageInfo(param);
         List<AlgorithmVO> vos = algorithmMapper.selectSharedAlgorithmList(param);
-        PageInfo<AlgorithmVO> pageInfo = new PageInfo<>(vos);
-        PageInfoVo<AlgorithmVO> result = new PageInfoVo<>();
-
-        result.setInfo(vos);
-        result.setTotal(pageInfo.getTotal());
-
-        return new ResponseBodyVO<>(ResponseBodyVO.Response.SUCCESS,result);
+        for (AlgorithmVO vo:vos){
+            vo.setValidationStatus(getDictName(DictConstants.VALIDATION_STATUS, vo.getValidationStatus()));
+        }
+        return new ResponseBodyVO<>(ResponseBodyVO.Response.SUCCESS,new PageInfo<>(vos));
     }
 
     @Override
@@ -138,13 +96,19 @@ public class AlgorithmServiceImpl implements AlgorithmService {
             return new ResponseBodyVO(ResponseBodyVO.Response.CLIENT_FAILURE);
         }else {
             AlgorithmPO po = algorithmMapper.selectDetailsById(param);
-            po.setShare("1");
-            po.setId(StringUtil.getRandomUUID());
-            int add = algorithmMapper.add(po);
-            if(add > 0){
-                return new ResponseBodyVO(ResponseBodyVO.Response.SUCCESS);
+            List<AlgorithmPO> algorithmPOS = algorithmMapper.selectSharedAlgorithmName(po.getAlgorithmName());
+            if(algorithmPOS != null && algorithmPOS.size() > 0){
+                return new ResponseBodyVO(ResponseBodyVO.Response.SERVER_FAILURE,"该算法名称已存在, 无法分享!");
+            }else {
+                po.setShare("1");
+                po.setId(StringUtil.getRandomUUID());
+                int add = algorithmMapper.add(po);
+                if(add > 0){
+                    return new ResponseBodyVO(ResponseBodyVO.Response.SUCCESS,"分享成功");
+                }
+                return new ResponseBodyVO(ResponseBodyVO.Response.SERVER_FAILURE,"分享失败");
+
             }
-            return new ResponseBodyVO(ResponseBodyVO.Response.SERVER_FAILURE,"分享失败");
         }
     }
 
@@ -196,6 +160,7 @@ public class AlgorithmServiceImpl implements AlgorithmService {
             return new ResponseBodyVO(ResponseBodyVO.Response.CLIENT_FAILURE);
         }else {
             AlgorithmPO po = algorithmMapper.selectDetailsById(param);
+            po.setValidationStatus(getDictName(DictConstants.VALIDATION_STATUS, po.getValidationStatus()));
             return new ResponseBodyVO<>(ResponseBodyVO.Response.SUCCESS,po);
         }
 
@@ -213,69 +178,51 @@ public class AlgorithmServiceImpl implements AlgorithmService {
         return false;
     }
 
-    private void setPage(Integer pageNum, Integer pageSize){
-        PageVO pageVO = new PageVO();
-        pageVO.setCurrentPage(pageNum);
-        pageVO.setPageSize(pageSize);
-        PageUtil.setPageInfo(pageVO);
-    }
 
+    private AlgorithmPO setPo(AlgorithmParameter param,  Boolean isEdit) {
 
-    public boolean uploadFile(MultipartFile file, String linuxPath, String minioPath){
-
-        boolean uploadSuccess = false;
-        try {
-            //linux备份
-            InputStream inputStream = file.getInputStream();
-            FileUtil.writeInputStreamToLocalFile(inputStream, linuxPath);
-            uploadSuccess = true;
-            //minio保存
-            ResponseBodyVO<String> upload = fileDownService.upload(file, minioPath);
-            if(upload.getCode() != 200){
-                uploadSuccess = false;
-            }
-        } catch (IOException e) {
-            e.printStackTrace();
-        }
-        return uploadSuccess;
-
-    }
-
-
-    private AlgorithmPO setPo(AlgorithmParameter param, String fileName, String linuxPath, String minioPath, Boolean isEdit) throws IOException {
-
-        String algorithmId = param.getId();
         AlgorithmPO po = new AlgorithmPO();
         //设置po信息
-        String gitUrl = "";
-        String gitToken = "";
         if("2".equals(param.getUploadMode())){ //使用仓库地址上传
-            gitUrl = param.getGitUrl();
-            gitToken = param.getGitToken();
+            String gitUrl = param.getGitUrl();
+            String gitToken = param.getGitToken();
+            po.setGitUrl(gitUrl);
+            po.setGitToken(gitToken);
+        }else {
+            String minioPath = param.getMinioPath();
+            String[] splits = minioPath.split("/");
+            String fileName = splits[splits.length-1];
+            po.setMinioPath(param.getMinioPath());
+            po.setFileName(fileName);
         }
         po.setAlgorithmName(param.getAlgorithmName());
         po.setDescription(param.getDescription());
         po.setUploadMode(param.getUploadMode());
-        po.setGitUrl(gitUrl);
-        po.setGitToken(gitToken);
-        po.setFileName(fileName);
         po.setValidationStatus(DictConstants.SUCCESS);
         po.setShare("0");
-        po.setLinuxPath(linuxPath);
-        po.setMinioPath(minioPath);
-        po.setId(algorithmId);
+        po.setId(param.getId());
 
-        Date date = new Date();
         if(isEdit){
-            po.setModifyTime(date);
+            po.setModifyTime(TimeUtil.getNowForMysql());
             po.setCreateUserId(AuthUtil.getCurrentUserId());
         }else {
             po.setIsDeleted("0");
-            po.setCreateTime(date);
+            po.setCreateTime(TimeUtil.getNowForMysql());
             po.setCreateUserId(AuthUtil.getCurrentUserId());
         }
         return po;
 
     }
 
+    private String getDictName(String type, String code) {
+        DictParam dictParam = new DictParam();
+        dictParam.setDictTypes(type);
+        Map<String, Map<String, String>> dictMapsByTypes = dictService.getDictMapsByTypes(dictParam);
+        Map<String, String> stringStringMap = dictMapsByTypes.get(type);
+        if(stringStringMap != null && stringStringMap.size() > 0){
+            return stringStringMap.get(code);
+        }
+        return "";
+    }
+
 }

+ 3 - 3
simulation-resource-server/src/main/java/com/css/simulation/resource/common/config/OAuth2Config.java

@@ -32,7 +32,6 @@ public class OAuth2Config extends ResourceServerConfigurerAdapter {
         DefaultAccessTokenConverter defaultAccessTokenConverter = new DefaultAccessTokenConverter();
         defaultAccessTokenConverter.setUserTokenConverter(myUserAuthenticationConverter);
         services.setAccessTokenConverter(defaultAccessTokenConverter);
-
         resources.resourceId(oauthParameter.getResourceId())      // 资源 id
                 .tokenServices(services)    // 使用远程服务验证令牌的服务
                 .stateless(true);   // 无状态模式,即无需用户登录,无 session
@@ -46,8 +45,9 @@ public class OAuth2Config extends ResourceServerConfigurerAdapter {
         http.csrf().disable()   // 禁用 csrf
                 .sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS)// 无状态验证
                 .and()
-                .authorizeRequests().anyRequest()
-                .access("#oauth2.hasScope('all')") // 拦截所有请求判断 scope
+                .authorizeRequests()
+                .antMatchers("/druid/**").permitAll()
+                .anyRequest().access("#oauth2.hasScope('all')") // 拦截所有请求判断 scope
         ;
     }
 }

+ 85 - 0
simulation-resource-server/src/main/java/com/css/simulation/resource/common/config/TransactionConfig.java

@@ -0,0 +1,85 @@
+package com.css.simulation.resource.common.config;
+
+import org.springframework.aop.framework.autoproxy.BeanNameAutoProxyCreator;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.jdbc.datasource.DataSourceTransactionManager;
+import org.springframework.transaction.TransactionDefinition;
+import org.springframework.transaction.TransactionManager;
+import org.springframework.transaction.interceptor.*;
+
+import javax.sql.DataSource;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * 声明式事务配置
+ */
+@Configuration
+public class TransactionConfig {
+
+    @Autowired
+    DataSource dataSource;
+
+    @Bean(name = "masterTransactionManager")
+    public DataSourceTransactionManager masterTransactionManager(DataSource dataSource) {
+        return new DataSourceTransactionManager(dataSource);
+    }
+
+    @Autowired
+    @Qualifier(value = "masterTransactionManager")
+    private TransactionManager transactionManager;
+
+    @Bean
+    public TransactionInterceptor txAdvice() {
+
+        /*只读事务,不做更新操作*/
+        RuleBasedTransactionAttribute readOnlyTx = new RuleBasedTransactionAttribute();
+        readOnlyTx.setReadOnly(true);
+        readOnlyTx.setPropagationBehavior(TransactionDefinition.PROPAGATION_NOT_SUPPORTED);
+
+        /*当前存在事务就使用当前事务,当前不存在事务就创建一个新的事务*/
+        RuleBasedTransactionAttribute requiredTx = new RuleBasedTransactionAttribute();
+        requiredTx.setRollbackRules(Collections.singletonList(new RollbackRuleAttribute(Exception.class)));
+        requiredTx.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRED);
+        requiredTx.setTimeout(5000);
+
+
+        Map<String, TransactionAttribute> txMap = new HashMap<>();
+        txMap.put("save*", requiredTx);
+        txMap.put("insert*", requiredTx);
+        txMap.put("update*", requiredTx);
+        txMap.put("remove*", requiredTx);
+        txMap.put("add*", requiredTx);
+        txMap.put("share*", requiredTx);
+        txMap.put("fx*", requiredTx);
+        txMap.put("del*", requiredTx);
+        /*select,count开头的方法,开启只读,提高数据库访问性能*/
+        txMap.put("select*", readOnlyTx);
+        txMap.put("query*", readOnlyTx);
+        txMap.put("get*", readOnlyTx);
+        txMap.put("list*", readOnlyTx);
+        txMap.put("find*", readOnlyTx);
+        txMap.put("count*", readOnlyTx);
+        txMap.put("*", requiredTx);
+
+        NameMatchTransactionAttributeSource source = new NameMatchTransactionAttributeSource();
+        source.setNameMap(txMap);
+
+        TransactionInterceptor txAdvice = new TransactionInterceptor(transactionManager, source);
+        return txAdvice;
+    }
+
+    @Bean
+    public BeanNameAutoProxyCreator txProxy() {
+        final BeanNameAutoProxyCreator creator = new BeanNameAutoProxyCreator();
+        creator.setInterceptorNames("txAdvice");
+        creator.setBeanNames("*Service");
+        creator.setProxyTargetClass(true);
+        return creator;
+    }
+
+}

+ 11 - 0
simulation-resource-server/src/main/java/com/css/simulation/resource/project/ctrl/SimulationProjectCtrl.java

@@ -141,5 +141,16 @@ public class SimulationProjectCtrl {
     }
 
 
+    /**
+     * 解析车辆坐标文件
+     * @return
+     */
+    @RequestMapping("analysisVehicleCoord")
+    @ResponseBody
+    public ResponseBodyVO analysisVehicleCoord() throws Exception {
+        return service.analysisVehicleCoord();
+    }
+
+
 
 }

+ 47 - 24
simulation-resource-server/src/main/java/com/css/simulation/resource/project/impl/SimulationProjectServiceImpl.java

@@ -12,6 +12,7 @@ import api.common.pojo.param.system.DictParam;
 import api.common.pojo.po.project.*;
 import api.common.pojo.vo.project.*;
 import api.common.util.JsonUtil;
+import api.common.util.TimeUtil;
 import com.css.simulation.resource.common.utils.AuthUtil;
 import com.css.simulation.resource.common.utils.PageUtil;
 import com.css.simulation.resource.project.constants.ProjectConstants;
@@ -26,6 +27,8 @@ import com.github.pagehelper.PageInfo;
 import lombok.SneakyThrows;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
+
+import java.io.*;
 import java.math.BigDecimal;
 import java.math.RoundingMode;
 import java.text.ParseException;
@@ -98,7 +101,7 @@ public class SimulationProjectServiceImpl implements SimulationProjectService {
 
         if(!isEmpty(param.getCreateStartDate())){
             String createStartDate = param.getCreateStartDate();
-            Date startDate = getDate(createStartDate + " 00:00:00",1);
+            Date startDate = getDate(createStartDate + " 00:00:00",1);
             if(startDate == null){
                 return new ResponseBodyVO(ResponseBodyVO.Response.CLIENT_FAILURE);
             }
@@ -106,7 +109,7 @@ public class SimulationProjectServiceImpl implements SimulationProjectService {
         }
         if(!isEmpty(param.getCreateEndDate())){
             String createEndDate = param.getCreateEndDate();
-            Date endDate = getDate(createEndDate + " 11:59:59",1);
+            Date endDate = getDate(createEndDate + " 11:59:59",1);
             if(endDate == null){
                 return new ResponseBodyVO(ResponseBodyVO.Response.CLIENT_FAILURE);
             }
@@ -115,7 +118,7 @@ public class SimulationProjectServiceImpl implements SimulationProjectService {
 
         if(!isEmpty(param.getFinishDateStart())){
             String finishDateStart = param.getFinishDateStart();
-            Date startDate = getDate(finishDateStart + " 00:00:00",1);
+            Date startDate = getDate(finishDateStart + " 00:00:00",1);
             if(startDate == null){
                 return new ResponseBodyVO(ResponseBodyVO.Response.CLIENT_FAILURE);
             }
@@ -124,7 +127,7 @@ public class SimulationProjectServiceImpl implements SimulationProjectService {
         }
         if(!isEmpty(param.getFinishDateEnd())){
             String finishDateEnd = param.getFinishDateEnd();
-            Date enddate = getDate(finishDateEnd + " 11:59:59",1);
+            Date enddate = getDate(finishDateEnd + " 11:59:59",1);
             if(enddate == null){
                 return new ResponseBodyVO(ResponseBodyVO.Response.CLIENT_FAILURE);
             }
@@ -582,28 +585,53 @@ public class SimulationProjectServiceImpl implements SimulationProjectService {
         return "";
     }
 
+    @Override
+    public ResponseBodyVO analysisVehicleCoord() throws Exception {
+
+        analysisCsvFile("E:\\仿真云平台\\三维还原视频说明\\360ogt.csv",new int[]{6,7,9});
+
+        return new ResponseBodyVO(ResponseBodyVO.Response.SUCCESS,null);
+
+    }
+
+    private void analysisCsvFile(String filePath, int[] analysisFields) throws Exception {
+
+        File file = new File(filePath);
+        InputStream fileInputStream = new FileInputStream(file);
+        InputStreamReader inputStreamReader = new InputStreamReader(fileInputStream,"utf-8");
+        BufferedReader bufferedReader = new BufferedReader(inputStreamReader);
+        String line;
+        while((line = bufferedReader.readLine()) != null){
+            String[] split = line.split(",");
+            for(int fs : analysisFields){
+                System.out.println(split[fs]);
+            }
+
+        }
+    }
+
     /**
      * 根据场景id和场景类型获取场景名
      * @return
      */
     private SceneBaseInfoVo getsceneNameAndOther(String sceneId, String sceneType){
         SceneBaseInfoVo resultVo = new SceneBaseInfoVo();
-        if("1".equals(sceneType)){
+        if(DictConstants.SCENE_NATURAL.equals(sceneType)){
             SceneBaseInfoVo sceneBaseInfoVo = simulationProjectMapper.selectSceneNatural(sceneId);
             if(sceneBaseInfoVo != null){
                 resultVo.setCommonSceneName(sceneBaseInfoVo.getNaturalName());
             }
-        }else if("2".equals(sceneType)){
+        }else if(DictConstants.SCENE_STANDARD.equals(sceneType)){
             SceneBaseInfoVo sceneBaseInfoVo = simulationProjectMapper.selectSceneStandardsRegulations(sceneId);
             if(sceneBaseInfoVo != null){
                 resultVo.setCommonSceneName(sceneBaseInfoVo.getSceneName());
             }
-        }else if("3".equals(sceneType)){
+        }else if(DictConstants.SCENE_ACCIDENT.equals(sceneType)){
             SceneBaseInfoVo sceneBaseInfoVo = simulationProjectMapper.selectSceneAccidentById(sceneId);
             if(sceneBaseInfoVo != null){
                 resultVo.setCommonSceneName(sceneBaseInfoVo.getSceneName());
             }
-        }else if("4".equals(sceneType)){
+        }else if(DictConstants.SCENE_GENERAL.equals(sceneType)){
             ///TODO 泛化场景暂不支持
 
         }
@@ -732,12 +760,7 @@ public class SimulationProjectServiceImpl implements SimulationProjectService {
     }
 
     private Integer getRq(Date date, int index){
-        SimpleDateFormat sdf = new SimpleDateFormat(dateFmtArr[index]);
-        if(date == null){
-            date = new Date();
-        }
-        return Integer.valueOf(sdf.format(date));
-
+        return  TimeUtil.getRq(date,index);
     }
 
     private String getRqStr(Date date, int index){
@@ -796,25 +819,25 @@ public class SimulationProjectServiceImpl implements SimulationProjectService {
         String sceneType = vo.getSceneType();
         String sceneId = vo.getSceneId();
         SceneBaseInfoVo sceneBaseInfoVo;
-        if("1".equals(sceneType)){
+        if(DictConstants.SCENE_NATURAL.equals(sceneType)){
             //自然驾驶
             sceneBaseInfoVo = simulationProjectMapper.selectSceneNatural(sceneId);
             if(sceneBaseInfoVo != null){
                 vo.setSceneName(sceneBaseInfoVo.getNaturalName());
             }
-        }else if("2".equals(sceneType)){
+        }else if(DictConstants.SCENE_STANDARD.equals(sceneType)){
             //标准法规
             sceneBaseInfoVo = simulationProjectMapper.selectSceneStandardsRegulations(sceneId);
             if(sceneBaseInfoVo != null){
                 vo.setSceneName(sceneBaseInfoVo.getSceneName());
             }
-        }else if("3".equals(sceneType)){
+        }else if(DictConstants.SCENE_ACCIDENT.equals(sceneType)){
             //交通事故
             sceneBaseInfoVo = simulationProjectMapper.selectSceneAccidentById(sceneId);
             if(sceneBaseInfoVo != null){
                 vo.setSceneName(sceneBaseInfoVo.getSceneName());
             }
-        }else if("4".equals(sceneType)){
+        }else if(DictConstants.SCENE_GENERAL.equals(sceneType)){
             /// TODO 泛化场景暂不支持
 
         }
@@ -860,7 +883,7 @@ public class SimulationProjectServiceImpl implements SimulationProjectService {
                     SimulationMptSceneScorePo simulationMptSceneScorePo = new SimulationMptSceneScorePo();
                     simulationMptSceneScorePo.setPId(id);
                     simulationMptSceneScorePo.setSceneId(s);
-                    simulationMptSceneScorePo.setSceneType("1");
+                    simulationMptSceneScorePo.setSceneType(DictConstants.SCENE_NATURAL);
                     simulationMptSceneScorePo.createPo(AuthUtil.getCurrentUserId());
                     simulationProjectMapper.insertSimulationMptSceneScorePo(simulationMptSceneScorePo);
                 }
@@ -873,7 +896,7 @@ public class SimulationProjectServiceImpl implements SimulationProjectService {
                     SimulationMptSceneScorePo simulationMptSceneScorePo = new SimulationMptSceneScorePo();
                     simulationMptSceneScorePo.setPId(id);
                     simulationMptSceneScorePo.setSceneId(s);
-                    simulationMptSceneScorePo.setSceneType("3");
+                    simulationMptSceneScorePo.setSceneType(DictConstants.SCENE_ACCIDENT);
                     simulationMptSceneScorePo.createPo(AuthUtil.getCurrentUserId());
                     simulationProjectMapper.insertSimulationMptSceneScorePo(simulationMptSceneScorePo);
                 }
@@ -885,7 +908,7 @@ public class SimulationProjectServiceImpl implements SimulationProjectService {
                     SimulationMptSceneScorePo simulationMptSceneScorePo = new SimulationMptSceneScorePo();
                     simulationMptSceneScorePo.setPId(id);
                     simulationMptSceneScorePo.setSceneId(s);
-                    simulationMptSceneScorePo.setSceneType("2");
+                    simulationMptSceneScorePo.setSceneType(DictConstants.SCENE_STANDARD);
                     simulationMptSceneScorePo.createPo(AuthUtil.getCurrentUserId());
                     simulationProjectMapper.insertSimulationMptSceneScorePo(simulationMptSceneScorePo);
                 }
@@ -961,9 +984,9 @@ public class SimulationProjectServiceImpl implements SimulationProjectService {
         String sceneTrafficIds = vo.getSceneTrafficIds();
         String sceneStatueIds = vo.getSceneStatueIds();
         List<SceneScoreVo> sceneScoreVos = new ArrayList<>();
-        List<SceneScoreVo> NaturalSceneScoreVos = setSceneScore(vo, sceneNaturalIds, "1", pId);
-        List<SceneScoreVo> StatueSceneScoreVos = setSceneScore(vo, sceneStatueIds, "2", pId);
-        List<SceneScoreVo> TrafficSceneScoreVos = setSceneScore(vo, sceneTrafficIds, "3", pId);
+        List<SceneScoreVo> NaturalSceneScoreVos = setSceneScore(vo, sceneNaturalIds, DictConstants.SCENE_NATURAL, pId);
+        List<SceneScoreVo> StatueSceneScoreVos = setSceneScore(vo, sceneStatueIds, DictConstants.SCENE_STANDARD, pId);
+        List<SceneScoreVo> TrafficSceneScoreVos = setSceneScore(vo, sceneTrafficIds, DictConstants.SCENE_ACCIDENT, pId);
         ///TODO 暂不支持泛化场景
 
         //合成一个list

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

@@ -2,7 +2,7 @@ package com.css.simulation.resource.project.service;
 
 import api.common.pojo.common.ResponseBodyVO;
 import api.common.pojo.param.project.SimulationManualProjectParam;
-import com.fasterxml.jackson.core.JsonProcessingException;
+
 
 public interface SimulationProjectService {
 
@@ -28,4 +28,6 @@ public interface SimulationProjectService {
 
     String getDictName(String type, String code);
 
+    ResponseBodyVO analysisVehicleCoord() throws Exception;
+
 }

+ 38 - 57
simulation-resource-server/src/main/java/com/css/simulation/resource/scene/ctrl/FileController.java

@@ -3,7 +3,7 @@ package com.css.simulation.resource.scene.ctrl;
 import api.common.pojo.common.ResponseBodyVO;
 import api.common.pojo.constants.DictConstants;
 import api.common.pojo.param.MinioParameter;
-import api.common.util.FileUtil;
+import api.common.util.TimeUtil;
 import com.css.simulation.resource.feign.FileDownService;
 import feign.Response;
 import lombok.extern.slf4j.Slf4j;
@@ -13,10 +13,12 @@ import org.springframework.web.bind.annotation.*;
 import org.springframework.web.multipart.MultipartFile;
 
 import javax.annotation.Resource;
+import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
+import java.util.Date;
 import java.util.HashMap;
 import java.util.Map;
 
@@ -29,76 +31,54 @@ public class FileController {
     @Resource
     private FileDownService fileDownService;
 
-    @PostMapping(value = "/upload", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
-    public ResponseBodyVO<Map> upload(@RequestPart("file") MultipartFile file,
-                      @RequestParam("type") String type,@RequestParam("objectPath") String objectPath) {
-        String fileName="";
-        if(type.equals(DictConstants.SCENE_NATURAL)){
-            fileName="自然驾驶/"+objectPath+"/"+file.getOriginalFilename();
-        }else if(type.equals(DictConstants.SCENE_STANDARD)){
-            fileName="标准法规/"+objectPath+"/"+file.getOriginalFilename();
-        }else if(type.equals(DictConstants.SCENE_ACCIDENT)){
-            fileName="交通事故/"+objectPath+"/"+file.getOriginalFilename();
-        }else if(type.equals(DictConstants.SCENE_GENERAL)){
-            fileName="泛化场景/"+objectPath+"/"+file.getOriginalFilename();
-        }else{
-            fileName=file.getOriginalFilename();
+    @PostMapping(value = "/uploadWj", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
+    public ResponseBodyVO<Map> uploadWj(@RequestParam("file") MultipartFile multipartFile, HttpServletRequest request) {
+        //获取文件类型
+        String type = request.getParameter("type");
+        String objectPath = request.getParameter("objectPath");
+        if (multipartFile != null) {
+            String fileName = "";
+            Integer nowTime = TimeUtil.getRq(new Date(), 0);
+            if (type.equals(DictConstants.SCENE_NATURAL)) {
+                fileName = "自然驾驶场景/" + nowTime + "/" + objectPath + "/" + multipartFile.getOriginalFilename();
+            } else if (type.equals(DictConstants.SCENE_STANDARD)) {
+                fileName = "标准法规场景/" + nowTime + "/" + objectPath + "/" + multipartFile.getOriginalFilename();
+            } else if (type.equals(DictConstants.SCENE_ACCIDENT)) {
+                fileName = "交通事故场景/" + nowTime + "/" + objectPath + "/" + multipartFile.getOriginalFilename();
+            } else if (type.equals(DictConstants.SCENE_GENERAL)) {
+                fileName = "泛化场景/" + nowTime + "/" + objectPath + "/" + multipartFile.getOriginalFilename();
+            } else if (type.equals(DictConstants.ALGORITHM_FILE)) {
+                fileName = "algorithm/" + nowTime + "/" + multipartFile.getOriginalFilename();
+            } else {
+                fileName = multipartFile.getOriginalFilename();
+            }
+            ResponseBodyVO<String> respon = fileDownService.upload(multipartFile, fileName);
+            String videoPreview = respon.getMessage();
+            Map map = new HashMap();
+            map.put("videoPreview", videoPreview);
+            map.put("fileName", fileName);
+
+            return new ResponseBodyVO(ResponseBodyVO.Response.SUCCESS, map);
         }
-       log.info("上传文件名称--------"+file.getOriginalFilename());
-
-        ResponseBodyVO<String> respon=fileDownService.upload(file,fileName);
-          String videoPreview=  respon.getMessage();
-             Map map=new HashMap();
-             map.put("videoPreview",videoPreview);
-              map.put("fileName",fileName);
-
-        return new ResponseBodyVO(ResponseBodyVO.Response.SUCCESS,map);
-    }
-
-
-    @PostMapping(value = "/uploadNew", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
-    public ResponseBodyVO<Map> upload(@RequestPart("file") MultipartFile file) {
-        log.info("上传文件名称--------"+file.getOriginalFilename());
-        String fileName=file.getOriginalFilename();
-        ResponseBodyVO<String> respon=fileDownService.upload(file,fileName);
-        String videoPreview=  respon.getMessage();
-        Map map=new HashMap();
-        map.put("videoPreview",videoPreview);
-        map.put("fileName",fileName);
-
-        return new ResponseBodyVO(ResponseBodyVO.Response.SUCCESS,map);
+        return new ResponseBodyVO(ResponseBodyVO.Response.CLIENT_FAILURE, "文件流file为空,请检查!");
     }
 
-
     @PostMapping(value = "/download")
     public void download(
-            HttpServletResponse response,@RequestBody @Validated MinioParameter parms
+            HttpServletResponse response, @RequestBody @Validated MinioParameter parms
     ) throws IOException {
         Response download = fileDownService.download(parms);
         Response.Body body = download.body();
         InputStream inputStream = body.asInputStream();
-       downloadForHttp(parms.getObjectName(), inputStream, response, 1024);
-    }
-
-    @GetMapping(value = "/download1")
-    public void download1(
-            HttpServletResponse response
-    ) throws IOException {
-        MinioParameter parms =new MinioParameter();
-        parms.setObjectName("simulation.mp4");
-        Response download = fileDownService.download(parms);
-        Response.Body body = download.body();
-        InputStream inputStream = body.asInputStream();
         downloadForHttp(parms.getObjectName(), inputStream, response, 1024);
     }
 
 
+    public void downloadForHttp(String fileName, InputStream in, HttpServletResponse response, int bufferSize) throws IOException {
+        int idx = fileName.lastIndexOf("/");
+        fileName = fileName.substring(idx + 1, fileName.length());
 
-    public  void downloadForHttp(String fileName, InputStream in, HttpServletResponse response, int bufferSize) throws IOException {
-        int idx=fileName.lastIndexOf("/");
-        fileName=fileName.substring(idx+1,fileName.length());
-
-        log.info("下载----"+fileName);
+        log.info("下载----" + fileName);
         response.setContentType("application/octet-stream;charset=utf-8");
         response.setHeader("Content-Disposition", "attachment;filename=\"" + fileName + "\"");
         copyBytes(in, response.getOutputStream(), bufferSize);
@@ -111,4 +91,5 @@ public class FileController {
         }
     }
 
+
 }

+ 16 - 21
simulation-resource-server/src/main/java/com/css/simulation/resource/scene/ctrl/SceneAccidentController.java

@@ -25,22 +25,22 @@ public class SceneAccidentController {
     @Resource
     SceneAccidentService sceneAccidentService;
 
-//查询列表
+    //查询列表
     @PostMapping("/querySceneAccidentList")
     @ResponseBody
     public ResponseBodyVO<List<SceneAccidentVO>> querySceneAccidentList(@RequestBody SceneAccidentParam parms) {
         PageUtil.setPageInfo(parms);
-        List<SceneAccidentPO> list=sceneAccidentService.querySceneAccidentList(parms);
+        List<SceneAccidentPO> list = sceneAccidentService.querySceneAccidentList(parms);
         PageInfo<SceneAccidentPO> objectPageInfo = new PageInfo<>(list);
-        List<SceneAccidentVO> list1=new ArrayList<>();
-        for (SceneAccidentPO po: list) {
-            SceneAccidentVO vo=new SceneAccidentVO();
-            BeanUtils.copyProperties(po,vo);
+        List<SceneAccidentVO> list1 = new ArrayList<>();
+        for (SceneAccidentPO po : list) {
+            SceneAccidentVO vo = new SceneAccidentVO();
+            BeanUtils.copyProperties(po, vo);
             list1.add(vo);
         }
-        PageInfo pageInfo=new PageInfo<>(list1);
+        PageInfo pageInfo = new PageInfo<>(list1);
         pageInfo.setTotal(objectPageInfo.getTotal());
-        return new ResponseBodyVO(ResponseBodyVO.Response.SUCCESS,pageInfo);
+        return new ResponseBodyVO(ResponseBodyVO.Response.SUCCESS, pageInfo);
     }
 
 
@@ -48,21 +48,16 @@ public class SceneAccidentController {
     @PostMapping("/saveSceneAccident")
     @ResponseBody
     public ResponseBodyVO<String> saveSceneAccident(@RequestBody SceneAccidentParam parms) {
-        sceneAccidentService.importJtSg(parms);
-        return new ResponseBodyVO(ResponseBodyVO.Response.SUCCESS);
-    }
-
-    @Resource
-    private FileDownService fileDownService;
+        return sceneAccidentService.importJtSg(parms);
 
-    @PostMapping(value = "/upload", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
-    public ResponseBodyVO<String> upload(@RequestPart("file") MultipartFile file,
-                                         @RequestParam("objectName") String objectName) {
-
-        objectName=objectName+"/"+file.getOriginalFilename();
-        System.out.println("上传文件名称--------"+objectName);
-        return fileDownService.upload(file,objectName);
     }
 
+    //删除交通事故
+    @PostMapping("/deleteSceneAccident")
+    @ResponseBody
+    public ResponseBodyVO<String> deleteSceneAccident(@RequestBody SceneAccidentPO parms) {
+        sceneAccidentService.deleteSceneAccidentList(parms);
+        return new ResponseBodyVO(ResponseBodyVO.Response.SUCCESS);
+    }
 
 }

+ 19 - 25
simulation-resource-server/src/main/java/com/css/simulation/resource/scene/ctrl/SceneNaturalController.java

@@ -6,13 +6,10 @@ import api.common.pojo.param.scene.SceneNaturalParam;
 import api.common.pojo.po.scene.SceneNaturalPO;
 import api.common.pojo.vo.scene.SceneNaturalVO;
 import com.css.simulation.resource.common.utils.PageUtil;
-import com.css.simulation.resource.feign.FileDownService;
 import com.css.simulation.resource.scene.service.SceneNaturalService;
 import com.github.pagehelper.PageInfo;
 import org.springframework.beans.BeanUtils;
-import org.springframework.http.MediaType;
 import org.springframework.web.bind.annotation.*;
-import org.springframework.web.multipart.MultipartFile;
 
 import javax.annotation.Resource;
 import java.util.ArrayList;
@@ -26,42 +23,39 @@ public class SceneNaturalController {
     @Resource
     SceneNaturalService sceneNaturalService;
 
-//查询列表
+    //查询列表
     @PostMapping("/querySceneNaturalList")
     @ResponseBody
     public ResponseBodyVO<List<SceneNaturalVO>> querySceneNaturalList(@RequestBody SceneNaturalNewParam parms) {
         PageUtil.setPageInfo(parms);
-        List<SceneNaturalPO> list=sceneNaturalService.querySceneNaturalList(parms);
+        List<SceneNaturalPO> list = sceneNaturalService.querySceneNaturalList(parms);
         PageInfo<SceneNaturalPO> objectPageInfo = new PageInfo<>(list);
-        List<SceneNaturalVO> list1=new ArrayList<>();
-        for (SceneNaturalPO po: list) {
-            SceneNaturalVO vo=new SceneNaturalVO();
-            BeanUtils.copyProperties(po,vo);
+        List<SceneNaturalVO> list1 = new ArrayList<>();
+        for (SceneNaturalPO po : list) {
+            SceneNaturalVO vo = new SceneNaturalVO();
+            BeanUtils.copyProperties(po, vo);
             list1.add(vo);
         }
-        PageInfo pageInfo=new PageInfo<>(list1);
+        PageInfo pageInfo = new PageInfo<>(list1);
         pageInfo.setTotal(objectPageInfo.getTotal());
-        return new ResponseBodyVO(ResponseBodyVO.Response.SUCCESS,pageInfo);
+        return new ResponseBodyVO(ResponseBodyVO.Response.SUCCESS, pageInfo);
     }
 
 
-    //新增标准法规
-    @PostMapping("/saveSceneAccident")
+    //新增自然场景
+    @PostMapping("/saveSceneNatural")
     @ResponseBody
-    public ResponseBodyVO<String> saveSceneAccident(@RequestBody SceneNaturalParam parms) {
-        sceneNaturalService.importZrjsSceneCicv(parms);
-        return new ResponseBodyVO(ResponseBodyVO.Response.SUCCESS);
-    }
-
-    @Resource
-    private FileDownService fileDownService;
+    public ResponseBodyVO<String> saveSceneNatural(@RequestBody SceneNaturalParam parms) {
 
-    @PostMapping(value = "/upload", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
-    public ResponseBodyVO<String> upload(@RequestPart("file") MultipartFile file,
-                                         @RequestParam("objectName") String objectName) {
-        System.out.println("上传文件名称--------"+file.getOriginalFilename());
-        return fileDownService.upload(file,file.getOriginalFilename());
+        return sceneNaturalService.importZrjsSceneCicv(parms);
     }
 
+    //删除
+    @PostMapping("/deleteSceneNatural")
+    @ResponseBody
+    public ResponseBodyVO<String> deleteSceneNatural(@RequestBody SceneNaturalPO parms) {
+        sceneNaturalService.deleteSceneNatural(parms);
+        return new ResponseBodyVO(ResponseBodyVO.Response.SUCCESS);
+    }
 
 }

+ 34 - 27
simulation-resource-server/src/main/java/com/css/simulation/resource/scene/ctrl/ScenePackageController.java

@@ -1,11 +1,9 @@
 package com.css.simulation.resource.scene.ctrl;
 
 import api.common.pojo.common.ResponseBodyVO;
-import api.common.pojo.param.scene.ScenePackageNewParam;
 import api.common.pojo.param.scene.ScenePackageParam;
 import api.common.pojo.po.scene.ScenePackagePO;
-import api.common.pojo.po.scene.ScenePackageSublistPO;
-import api.common.pojo.vo.scene.ScenePackageNewVO;
+import api.common.pojo.vo.scene.ScenePackageSublistVO;
 import api.common.pojo.vo.scene.ScenePackageVO;
 import api.common.util.ObjectUtil;
 import com.css.simulation.resource.common.utils.PageUtil;
@@ -13,10 +11,10 @@ import com.css.simulation.resource.scene.service.ScenePackageService;
 import com.github.pagehelper.PageInfo;
 import org.springframework.beans.BeanUtils;
 import org.springframework.web.bind.annotation.*;
-
 import javax.annotation.Resource;
 import java.util.ArrayList;
 import java.util.List;
+import java.util.Map;
 
 //测试包
 @RestController
@@ -26,51 +24,59 @@ public class ScenePackageController {
     @Resource
     ScenePackageService scenePackageService;
 
-//查询主表列表
+    //查询主表列表
     @PostMapping("/queryScenePackageList")
     @ResponseBody
     public ResponseBodyVO<List<ScenePackageVO>> queryScenePackageList(@RequestBody ScenePackageParam parms) {
         PageUtil.setPageInfo(parms);
-        List<ScenePackagePO> list=scenePackageService.queryScenePackageList(parms);
+        List<ScenePackagePO> list = scenePackageService.queryScenePackageList(parms);
         PageInfo<ScenePackagePO> objectPageInfo = new PageInfo<>(list);
-        List<ScenePackageVO> list1=new ArrayList<>();
-        for (ScenePackagePO po: list) {
-            ScenePackageVO vo=new ScenePackageVO();
-            BeanUtils.copyProperties(po,vo);
+        List<ScenePackageVO> list1 = new ArrayList<>();
+        for (ScenePackagePO po : list) {
+            ScenePackageVO vo = new ScenePackageVO();
+            BeanUtils.copyProperties(po, vo);
             list1.add(vo);
         }
-        PageInfo pageInfo=new PageInfo<>(list1);
+        PageInfo pageInfo = new PageInfo<>(list1);
         pageInfo.setTotal(objectPageInfo.getTotal());
-        return new ResponseBodyVO(ResponseBodyVO.Response.SUCCESS,pageInfo);
+        return new ResponseBodyVO(ResponseBodyVO.Response.SUCCESS, pageInfo);
     }
 
 
-    //新增打分规则
+    //新增测试包
     @PostMapping("/saveScenePackage")
     @ResponseBody
-    public ResponseBodyVO<String> saveScoringRules(@RequestBody ScenePackageNewParam parms) {
+    public ResponseBodyVO<String> saveScoringRules(@RequestBody Map<String, List<ScenePackageSublistVO>> map) {
 
-        return scenePackageService.saveScenePackage(parms);
+        List<ScenePackageSublistVO> params = map.get("params");
+        if (params == null || params.size() < 1) {
+            return new ResponseBodyVO(ResponseBodyVO.Response.CLIENT_FAILURE, "参数不能为空,请检查");
+        } else if (params.get(0).getId() == null || params.get(0).getPackageLevel() == 1) {
+            params.get(0).setId("");
+            return scenePackageService.saveScenePackage(params);
+        } else {
+            return scenePackageService.updateScenePackage(params);
+        }
     }
 
     //修改
     @PostMapping("/updateScenePackage")
     @ResponseBody
-    public ResponseBodyVO<String> updateScenePackage(@RequestBody ScenePackageNewParam params)  {
-        scenePackageService.updateScenePackage(params);
-        return new ResponseBodyVO<>(ResponseBodyVO.Response.SUCCESS);
+    public ResponseBodyVO<String> updateScenePackage(@RequestBody Map<String, List<ScenePackageSublistVO>> map) {
+        List<ScenePackageSublistVO> params = map.get("params");
+        return scenePackageService.updateScenePackage(params);
     }
 
     //查询一个测试包列表
     @PostMapping("/queryScenePackageSublistList")
     @ResponseBody
-    public ResponseBodyVO<ScenePackageNewVO> queryScenePackageSublistList(@RequestBody ScenePackageParam parms) {
-        if(ObjectUtil.isNull(parms.getPackageId())){
-            return new ResponseBodyVO(ResponseBodyVO.Response.CLIENT_FAILURE,"参数PackageId不能为空,请检查");
+    public ResponseBodyVO<List<ScenePackageSublistVO>> queryScenePackageSublistList(@RequestBody ScenePackageParam parms) {
+        if (ObjectUtil.isNull(parms.getPackageId())) {
+            return new ResponseBodyVO(ResponseBodyVO.Response.CLIENT_FAILURE, "参数PackageId不能为空,请检查");
         }
-        ScenePackageNewVO po=  scenePackageService.queryScenePackageSublistList(parms);
+        List<ScenePackageSublistVO> list = scenePackageService.queryScenePackageSublistList(parms);
 
-        return new ResponseBodyVO(ResponseBodyVO.Response.SUCCESS,po);
+        return new ResponseBodyVO(ResponseBodyVO.Response.SUCCESS, list);
     }
 
 
@@ -78,18 +84,19 @@ public class ScenePackageController {
     @PostMapping("/instShareList")
     @ResponseBody
     public ResponseBodyVO<String> instShareList(@RequestBody ScenePackageParam parms) {
-        if(ObjectUtil.isNull(parms.getPackageId())){
-            return new ResponseBodyVO(ResponseBodyVO.Response.CLIENT_FAILURE,"参数PackageId不能为空,请检查");
+        if (ObjectUtil.isNull(parms.getPackageId())) {
+            return new ResponseBodyVO(ResponseBodyVO.Response.CLIENT_FAILURE, "参数PackageId不能为空,请检查");
         }
 
         return scenePackageService.instShareList(parms);
     }
+
     //测试包删除
     @PostMapping("/deleteList")
     @ResponseBody
     public ResponseBodyVO<String> deleteList(@RequestBody ScenePackageParam parms) {
-        if(ObjectUtil.isNull(parms.getPackageId())){
-            return new ResponseBodyVO(ResponseBodyVO.Response.CLIENT_FAILURE,"参数PackageId不能为空,请检查");
+        if (ObjectUtil.isNull(parms.getPackageId())) {
+            return new ResponseBodyVO(ResponseBodyVO.Response.CLIENT_FAILURE, "参数PackageId不能为空,请检查");
         }
         scenePackageService.deleteList(parms);
         return new ResponseBodyVO<>(ResponseBodyVO.Response.SUCCESS);

+ 45 - 59
simulation-resource-server/src/main/java/com/css/simulation/resource/scene/ctrl/ScoringRulesController.java

@@ -11,6 +11,7 @@ import com.css.simulation.resource.scene.service.ScoringRulesService;
 import com.github.pagehelper.PageInfo;
 import org.springframework.beans.BeanUtils;
 import org.springframework.web.bind.annotation.*;
+
 import javax.annotation.Resource;
 import java.util.ArrayList;
 import java.util.List;
@@ -23,82 +24,82 @@ public class ScoringRulesController {
     @Resource
     ScoringRulesService scoringRulesService;
 
-//查询列表
+    //查询列表
     @PostMapping("/queryScoringRulesList")
     @ResponseBody
     public ResponseBodyVO<List<ScoringRulesVO>> queryScoringRulesList(@RequestBody ScoringRulesParam parms) {
         PageUtil.setPageInfo(parms);
-        List<ScoringRulesPO> list=scoringRulesService.queryScoringRulesList(parms);
+        List<ScoringRulesPO> list = scoringRulesService.queryScoringRulesList(parms);
         PageInfo<ScoringRulesPO> scoringRulesPOPageInfo = new PageInfo<>(list);
-        List<ScoringRulesVO> list1=new ArrayList<>();
-        for (ScoringRulesPO po: list) {
-            ScoringRulesVO vo=new ScoringRulesVO();
-            BeanUtils.copyProperties(po,vo);
+        List<ScoringRulesVO> list1 = new ArrayList<>();
+        //po转vo
+        for (ScoringRulesPO po : list) {
+            ScoringRulesVO vo = new ScoringRulesVO();
+            BeanUtils.copyProperties(po, vo);
             list1.add(vo);
         }
         PageInfo pageInfo = new PageInfo(list1);
         pageInfo.setTotal(scoringRulesPOPageInfo.getTotal());
 
-        return new ResponseBodyVO(ResponseBodyVO.Response.SUCCESS,pageInfo);
+        return new ResponseBodyVO(ResponseBodyVO.Response.SUCCESS, pageInfo);
     }
 
-     //查询详情
+    //查询详情
     @PostMapping("/queryScoringRules")
     @ResponseBody
-    public ResponseBodyVO<List<ScoringRulesPO>> queryScoringRules(@RequestBody ScoringRulesParam parms)  {
-        if(ObjectUtil.isNull(parms.getRulesId())){
-            return new ResponseBodyVO(ResponseBodyVO.Response.CLIENT_FAILURE,"参数RulesId不能为空,请检查");
+    public ResponseBodyVO<List<ScoringRulesPO>> queryScoringRules(@RequestBody ScoringRulesParam parms) {
+        if (ObjectUtil.isNull(parms.getRulesId())) {
+            return new ResponseBodyVO(ResponseBodyVO.Response.CLIENT_FAILURE, "参数RulesId不能为空,请检查");
         }
-        ScoringRulesPO po=scoringRulesService.queryScoringRules(parms);
-        return new ResponseBodyVO(ResponseBodyVO.Response.SUCCESS,po);
+        ScoringRulesPO po = scoringRulesService.queryScoringRules(parms);
+        return new ResponseBodyVO(ResponseBodyVO.Response.SUCCESS, po);
 
     }
 
     //查唯一
     @PostMapping("/queryScoringRulesCount")
     @ResponseBody
-    public ResponseBodyVO<List<ScoringRulesPO>> queryScoringRulesCount(@RequestBody ScoringRulesParam parms)  {
-        if(ObjectUtil.isNull(parms.getRuleName())){
-            return new ResponseBodyVO(ResponseBodyVO.Response.CLIENT_FAILURE,"参数RulesName不能为空,请检查");
+    public ResponseBodyVO<List<ScoringRulesPO>> queryScoringRulesCount(@RequestBody ScoringRulesParam parms) {
+        if (ObjectUtil.isNull(parms.getRuleName())) {
+            return new ResponseBodyVO(ResponseBodyVO.Response.CLIENT_FAILURE, "参数RulesName不能为空,请检查");
         }
-        List<ScoringRulesPO> list=scoringRulesService.queryScoringRulesByRuleName(parms);
-        return new ResponseBodyVO(ResponseBodyVO.Response.SUCCESS,list);
-
+        List<ScoringRulesPO> list = scoringRulesService.queryScoringRulesByRuleName(parms);
+        return new ResponseBodyVO(ResponseBodyVO.Response.SUCCESS, list);
     }
+
     //新增打分规则
     @PostMapping("/saveScoringRules")
     @ResponseBody
     public ResponseBodyVO<String> saveScoringRules(@RequestBody ScoringRulesPO parms) {
-        ScoringRulesParam vo=new ScoringRulesParam();
-        BeanUtils.copyProperties(parms,vo);
+        ScoringRulesParam vo = new ScoringRulesParam();
+        BeanUtils.copyProperties(parms, vo);
         vo.setShare("0");
         vo.setCreateUserId(AuthUtil.getCurrentUserId());
-        List<ScoringRulesPO> list=scoringRulesService.queryScoringRulesByRuleName(vo);
-        if(list!=null && list.size()>0){
-            return new ResponseBodyVO(ResponseBodyVO.Response.CLIENT_FAILURE,"规则名称ruleName已存在,请重新命名");
+        List<ScoringRulesPO> list = scoringRulesService.queryScoringRulesByRuleName(vo);
+        if (list != null && list.size() > 0) {
+            return new ResponseBodyVO(ResponseBodyVO.Response.CLIENT_FAILURE, "规则名称ruleName已存在,请重新命名");
         }
-        if(ObjectUtil.isNull(parms.getRulesId())){
+        if (ObjectUtil.isNull(parms.getRulesId())) {
             scoringRulesService.saveScoringRules(parms);
-        }else{
+        } else {
             scoringRulesService.updateScoringRules(parms);
         }
-
         return new ResponseBodyVO(ResponseBodyVO.Response.SUCCESS);
     }
 
     //分享
     @PostMapping("/fxScoringRules")
     @ResponseBody
-    public ResponseBodyVO<String> fxScoringRules(@RequestBody ScoringRulesParam params)  {
-        if(ObjectUtil.isNull(params.getRulesId())){
-            return new ResponseBodyVO(ResponseBodyVO.Response.CLIENT_FAILURE,"参数RulesId不能为空,请检查");
+    public ResponseBodyVO<String> fxScoringRules(@RequestBody ScoringRulesParam params) {
+        if (ObjectUtil.isNull(params.getRulesId())) {
+            return new ResponseBodyVO(ResponseBodyVO.Response.CLIENT_FAILURE, "参数RulesId不能为空,请检查");
         }
-        ScoringRulesPO po=scoringRulesService.queryScoringRules(params);
+        ScoringRulesPO po = scoringRulesService.queryScoringRules(params);
         params.setShare("1");
         params.setRuleName(po.getRuleName());
-        List<ScoringRulesPO> list=scoringRulesService.queryScoringRulesByRuleName(params);
-        if(list!=null && list.size()>0){
-            return new ResponseBodyVO(ResponseBodyVO.Response.CLIENT_FAILURE,"规则名称ruleName已存在,请重新命名");
+        List<ScoringRulesPO> list = scoringRulesService.queryScoringRulesByRuleName(params);
+        if (list != null && list.size() > 0) {
+            return new ResponseBodyVO(ResponseBodyVO.Response.CLIENT_FAILURE, "规则名称ruleName已存在,请重新命名");
         }
         po.setShare("1");
         scoringRulesService.saveScoringRules(po);
@@ -108,34 +109,19 @@ public class ScoringRulesController {
     //删除
     @PostMapping("/deleteScoringRules")
     @ResponseBody
-    public ResponseBodyVO<String> deleteScoringRules(@RequestBody ScoringRulesPO params)  {
+    public ResponseBodyVO<String> deleteScoringRules(@RequestBody ScoringRulesPO params) {
         scoringRulesService.deleteScoringRules(params);
         return new ResponseBodyVO<>(ResponseBodyVO.Response.SUCCESS);
     }
 
-/*
-
-    @Resource
-    private FileDownService fileDownService;
-
-    @PostMapping(value = "/upload", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
-    public ResponseBodyVO<String> upload(@RequestPart("file") MultipartFile file,
-                                         @RequestParam("objectName") String objectName) {
-        System.out.println("上传文件名称--------"+file.getOriginalFilename());
-        return fileDownService.upload(file,file.getOriginalFilename());
-    }
-
-@GetMapping(value = "/download")
-    public void download(
-            HttpServletResponse response
-    ) throws IOException {
-    MinioParameter parms=new MinioParameter();
-    parms.setObjectName("new4.txt");
-        Response download = fileDownService.download(parms);
-        Response.Body body = download.body();
-        InputStream inputStream = body.asInputStream();
-        FileUtil.downloadForHttp(parms.getObjectName(), inputStream, response, 1024);
+    //测试包里面对应查询打分规则列表
+    @PostMapping("/queryCsb")
+    @ResponseBody
+    public ResponseBodyVO<List<ScoringRulesPO>> queryCsb() {
+        ScoringRulesParam params = new ScoringRulesParam();
+        params.setShare("0");
+        params.setCreateUserId(AuthUtil.getCurrentUserId());
+        List<ScoringRulesPO> list = scoringRulesService.queryScoringRulesList(params);
+        return new ResponseBodyVO(ResponseBodyVO.Response.SUCCESS, list);
     }
-*/
-
 }

+ 15 - 26
simulation-resource-server/src/main/java/com/css/simulation/resource/scene/ctrl/StandardsRegulationsController.java

@@ -32,22 +32,22 @@ public class StandardsRegulationsController {
     @Resource
     StandardsRegulationsService standardsRegulationsService;
 
-//查询列表
+    //查询列表
     @PostMapping("/queryStandardsRegulationsList")
     @ResponseBody
     public ResponseBodyVO<List<StandardsRegulationsVO>> queryStandardsRegulationsList(@RequestBody StandardsRegulationsParam parms) {
         PageUtil.setPageInfo(parms);
-        List<StandardsRegulationsPO> list=standardsRegulationsService.querySceneNaturalList(parms);
+        List<StandardsRegulationsPO> list = standardsRegulationsService.querySceneNaturalList(parms);
         PageInfo<StandardsRegulationsPO> objectPageInfo = new PageInfo<>(list);
-        List<StandardsRegulationsVO> list1=new ArrayList<>();
-        for (StandardsRegulationsPO po: list) {
-            StandardsRegulationsVO vo=new StandardsRegulationsVO();
-            BeanUtils.copyProperties(po,vo);
+        List<StandardsRegulationsVO> list1 = new ArrayList<>();
+        for (StandardsRegulationsPO po : list) {
+            StandardsRegulationsVO vo = new StandardsRegulationsVO();
+            BeanUtils.copyProperties(po, vo);
             list1.add(vo);
         }
-        PageInfo pageInfo=new PageInfo<>(list1);
+        PageInfo pageInfo = new PageInfo<>(list1);
         pageInfo.setTotal(objectPageInfo.getTotal());
-        return new ResponseBodyVO(ResponseBodyVO.Response.SUCCESS,pageInfo);
+        return new ResponseBodyVO(ResponseBodyVO.Response.SUCCESS, pageInfo);
     }
 
 
@@ -55,28 +55,17 @@ public class StandardsRegulationsController {
     @PostMapping("/saveStandardsRegulations")
     @ResponseBody
     public ResponseBodyVO<String> saveStandardsRegulations(@RequestBody StandardsRegulationsParam parms) {
-        standardsRegulationsService.importBzFg(parms);
-        return new ResponseBodyVO(ResponseBodyVO.Response.SUCCESS);
-    }
 
-    @Resource
-    private FileDownService fileDownService;
+        return standardsRegulationsService.importBzFg(parms);
 
-    @PostMapping(value = "/upload", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
-    public ResponseBodyVO<String> upload(@RequestPart("file") MultipartFile file,
-                                         @RequestParam("objectName") String objectName) {
-        System.out.println("上传文件名称--------"+file.getOriginalFilename());
-        return fileDownService.upload(file,file.getOriginalFilename());
     }
 
-@PostMapping(value = "/download")
-    public void download(
-            HttpServletResponse response,@RequestBody @Validated MinioParameter parms
-    ) throws IOException {
-        Response download = fileDownService.download(parms);
-        Response.Body body = download.body();
-        InputStream inputStream = body.asInputStream();
-        FileUtil.downloadForHttp(parms.getObjectName(), inputStream, response, 1024);
+    //删除
+    @PostMapping("/deleteStandardsRegulations")
+    @ResponseBody
+    public ResponseBodyVO<String> deleteStandardsRegulations(@RequestBody StandardsRegulationsPO parms) {
+        standardsRegulationsService.deleteStandardsRegulations(parms);
+        return new ResponseBodyVO(ResponseBodyVO.Response.SUCCESS);
     }
 
 }

+ 6 - 5
simulation-resource-server/src/main/java/com/css/simulation/resource/scene/mapper/SceneAccidentMapper.java

@@ -1,20 +1,21 @@
 package com.css.simulation.resource.scene.mapper;
 
-
 import api.common.pojo.param.scene.SceneAccidentParam;
 import api.common.pojo.po.scene.SceneAccidentPO;
 import org.apache.ibatis.annotations.Mapper;
 import org.springframework.stereotype.Repository;
-
 import java.util.List;
 
-
 @Mapper
 @Repository
 public interface SceneAccidentMapper {
 
-   void saveSceneAccident(SceneAccidentPO params);
+    void saveSceneAccident(SceneAccidentPO params);
+
+    List<SceneAccidentPO> querySceneAccidentList(SceneAccidentParam params);
+
+    void deleteSceneAccidentList(SceneAccidentPO params);
 
-   List<SceneAccidentPO> querySceneAccidentList(SceneAccidentParam params);
+    List<SceneAccidentPO> querySceneAccidentByNmae(SceneAccidentParam params);
 
 }

+ 6 - 5
simulation-resource-server/src/main/java/com/css/simulation/resource/scene/mapper/SceneNaturalMapper.java

@@ -1,6 +1,5 @@
 package com.css.simulation.resource.scene.mapper;
 
-
 import api.common.pojo.param.scene.SceneNaturalParam;
 import api.common.pojo.po.scene.SceneNaturalPO;
 import org.apache.ibatis.annotations.Mapper;
@@ -8,14 +7,16 @@ import org.springframework.stereotype.Repository;
 
 import java.util.List;
 
-
-
 @Mapper
 @Repository
 public interface SceneNaturalMapper {
 
-   void saveSceneNatural(SceneNaturalPO params);
+    void saveSceneNatural(SceneNaturalPO params);
+
+    List<SceneNaturalPO> querySceneNaturalList(SceneNaturalParam params);
+
+    void deleteSceneNatural(SceneNaturalPO params);
 
-   List<SceneNaturalPO> querySceneNaturalList(SceneNaturalParam params);
+    List<SceneNaturalPO> querySceneNaturaByName(SceneNaturalParam params);
 
 }

+ 13 - 13
simulation-resource-server/src/main/java/com/css/simulation/resource/scene/mapper/ScenePackageMapper.java

@@ -1,13 +1,10 @@
 package com.css.simulation.resource.scene.mapper;
 
-
 import api.common.pojo.param.scene.ScenePackageParam;
 import api.common.pojo.po.scene.ScenePackagePO;
 import api.common.pojo.vo.scene.ScenePackageNewVO;
-import api.common.pojo.vo.scene.ScenePackageSublistVO;
 import org.apache.ibatis.annotations.Mapper;
 import org.springframework.stereotype.Repository;
-
 import java.util.List;
 
 
@@ -15,18 +12,21 @@ import java.util.List;
 @Repository
 public interface ScenePackageMapper {
 
-   void saveScenePackage(ScenePackagePO params);
-   void updateScenePackage(ScenePackagePO params);
-   void deleteScenePackage(ScenePackagePO params);
-   //查询详情
-   ScenePackagePO queryScenePackage(ScenePackageParam params);
+    void saveScenePackage(ScenePackagePO params);
+
+    void updateScenePackage(ScenePackagePO params);
+
+    void deleteScenePackage(ScenePackagePO params);
+
+    //查询详情
+    ScenePackagePO queryScenePackage(ScenePackageParam params);
 
-   List<ScenePackagePO> queryScenePackageList(ScenePackageParam params);
+    List<ScenePackagePO> queryScenePackageList(ScenePackageParam params);
 
-   //单独给查询一个测试包的列表用
-   ScenePackageNewVO queryScenePackageBySublist(String packageId);
+    //单独给查询一个测试包的列表用
+    ScenePackageNewVO queryScenePackageBySublist(String packageId);
 
-   //测试包名查唯一
-   List<ScenePackageNewVO> queryByPackageName(ScenePackagePO params);
+    //测试包名查唯一
+    List<ScenePackageNewVO> queryByPackageName(ScenePackagePO params);
 
 }

+ 8 - 10
simulation-resource-server/src/main/java/com/css/simulation/resource/scene/mapper/ScenePackageSublistMapper.java

@@ -1,27 +1,25 @@
 package com.css.simulation.resource.scene.mapper;
 
 import api.common.pojo.po.scene.ScenePackageSublistPO;
-import api.common.pojo.vo.scene.ScenePackageNewVO;
 import api.common.pojo.vo.scene.ScenePackageSublistVO;
 import org.apache.ibatis.annotations.Mapper;
-import org.apache.ibatis.annotations.Param;
 import org.springframework.stereotype.Repository;
-
 import java.util.List;
-import java.util.Map;
 
 
 @Mapper
 @Repository
 public interface ScenePackageSublistMapper {
 
-   void saveScenePackageSublist(ScenePackageSublistPO params);
-   void saveScenePackageSublistAll(List<ScenePackageSublistPO> treeList);
-   void deleteScenePackageSublist(String  rootId);
+    void saveScenePackageSublist(ScenePackageSublistPO params);
+
+    void saveScenePackageSublistAll(List<ScenePackageSublistPO> treeList);
+
+    void deleteScenePackageSublist(String rootId);
 
-   List<ScenePackageSublistVO> queryScenePackageSublistList(ScenePackageSublistPO params);
+    List<ScenePackageSublistVO> queryScenePackageSublistList(ScenePackageSublistPO params);
 
-   //指标名查唯一
-   List<ScenePackageSublistVO> queryBySublistName(ScenePackageSublistPO params);
+    //指标名查唯一
+    List<ScenePackageSublistVO> queryBySublistName(ScenePackageSublistPO params);
 
 }

+ 10 - 8
simulation-resource-server/src/main/java/com/css/simulation/resource/scene/mapper/ScoringRulesMapper.java

@@ -1,11 +1,9 @@
 package com.css.simulation.resource.scene.mapper;
 
-
 import api.common.pojo.param.scene.ScoringRulesParam;
 import api.common.pojo.po.scene.ScoringRulesPO;
 import org.apache.ibatis.annotations.Mapper;
 import org.springframework.stereotype.Repository;
-
 import java.util.List;
 
 
@@ -13,12 +11,16 @@ import java.util.List;
 @Repository
 public interface ScoringRulesMapper {
 
-   void saveScoringRules(ScoringRulesPO params);
-   List<ScoringRulesPO> queryScoringRulesByRuleName(ScoringRulesParam params);
+    void saveScoringRules(ScoringRulesPO params);
+
+    List<ScoringRulesPO> queryScoringRulesByRuleName(ScoringRulesParam params);
+
+    List<ScoringRulesPO> queryScoringRulesList(ScoringRulesParam params);
+
+    ScoringRulesPO queryScoringRules(ScoringRulesParam params);
+
+    void updateScoringRules(ScoringRulesPO params);
 
-   List<ScoringRulesPO> queryScoringRulesList(ScoringRulesParam params);
-   ScoringRulesPO queryScoringRules(ScoringRulesParam params);
-   void updateScoringRules(ScoringRulesPO params);
-   void deleteScoringRules(ScoringRulesPO params);
+    void deleteScoringRules(ScoringRulesPO params);
 
 }

+ 7 - 3
simulation-resource-server/src/main/java/com/css/simulation/resource/scene/mapper/StandardsRegulationsMapper.java

@@ -4,7 +4,6 @@ import api.common.pojo.param.scene.StandardsRegulationsParam;
 import api.common.pojo.po.scene.StandardsRegulationsPO;
 import org.apache.ibatis.annotations.Mapper;
 import org.springframework.stereotype.Repository;
-
 import java.util.List;
 
 
@@ -12,8 +11,13 @@ import java.util.List;
 @Repository
 public interface StandardsRegulationsMapper {
 
-   void saveStandardsRegulations(StandardsRegulationsPO params);
+    void saveStandardsRegulations(StandardsRegulationsPO params);
+
+    List<StandardsRegulationsPO> queryStandardsRegulationsList(StandardsRegulationsParam params);
+
+    void deleteStandardsRegulations(StandardsRegulationsPO params);
+
+    List<StandardsRegulationsPO> queryStandardsRegulationsByName(StandardsRegulationsParam params);
 
-   List<StandardsRegulationsPO> queryStandardsRegulationsList(StandardsRegulationsParam params);
 
 }

+ 78 - 78
simulation-resource-server/src/main/java/com/css/simulation/resource/scene/service/SceneAccidentService.java

@@ -1,5 +1,6 @@
 package com.css.simulation.resource.scene.service;
 
+import api.common.pojo.common.ResponseBodyVO;
 import api.common.pojo.param.MinioParameter;
 import api.common.pojo.param.scene.SceneAccidentParam;
 import api.common.pojo.po.scene.SceneAccidentPO;
@@ -14,7 +15,6 @@ import feign.Response;
 import lombok.SneakyThrows;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.stereotype.Service;
-
 import javax.annotation.Resource;
 import java.io.File;
 import java.util.ArrayList;
@@ -30,78 +30,78 @@ public class SceneAccidentService {
 
     @Resource
     private FileDownService fileDownService;
+
     /**
      * 获取交通事故场景数据:
      */
     @SneakyThrows
-    public void importJtSg(SceneAccidentParam param) {
-
-        String fileName = null;
-        try {
-            MinioParameter MI=new MinioParameter();
-            MI.setObjectName(param.getJsonAddress());
-            Response download = fileDownService.download(MI);
-                // -------------------------------- label.json --------------------------------
-                String json = download.body().toString();;
-                    ObjectMapper objMap = new ObjectMapper();
-                    JsonNode root = objMap.readTree(json);
-
-                    SceneAccidentPO sceneAccidentPO = null;
-                    sceneAccidentPO = sceneAccidentPO.builder()
-                        .accidentId(StringUtil.getRandomUUID())
-                        .sceneName(root.path("场景名称").asText())
-                        .selfDriving(root.path("自车驾驶行为").asText())
-                        .targetDriving(root.path("目标驾驶行为").asText())
-                        .selfReaction(root.path("自车反应行为").asText())
-                        .conflictBehavior(root.path("冲突行为").asText())
-                        .conflictType(root.path("冲突类型").asText())
-                        .isDeleted("0")
-                        .build();
-                // -------------------------------- 保存数据到 mysql --------------------------------
-                    sceneAccidentPO.setCreateTime(TimeUtil.getNowForMysql());
-                    sceneAccidentPO.setCreateUserId(AuthUtil.getCurrentUserId());
-                    sceneAccidentPO.setModifyTime(TimeUtil.getNowForMysql());
-
-                    if(null!=param.getJsonAddress()&&!param.getJsonAddress().equals("")){
-                        sceneAccidentPO.setJsonAddress(param.getJsonAddress());
-                    }
-                    if(null!=param.getXmlAddress()&&!param.getXmlAddress().equals("")){
-                        sceneAccidentPO.setXmlAddress(param.getXmlAddress());
-                    }
-                    if(null!=param.getXodrAddress()&&!param.getXodrAddress().equals("")){
-                        sceneAccidentPO.setXodrAddress(param.getXodrAddress());
-                    }
-                    if(null!=param.getOsgbAddress()&&!param.getOsgbAddress().equals("")){
-                        sceneAccidentPO.setOsgbAddress(param.getOsgbAddress());
-                    }
-                    if(null!=param.getVideoAddress()&&!param.getVideoAddress().equals("")){
-                        sceneAccidentPO.setVideoAddress(param.getVideoAddress());
-                    }
-                    if(null!=param.getVideoPreview()&&!param.getVideoPreview().equals("")){
-                        sceneAccidentPO.setVideoPreview(param.getVideoPreview());
-                    }
-
-                    SceneAccidentMapper.saveSceneAccident(sceneAccidentPO);
-
-
-
+    public ResponseBodyVO<String> importJtSg(SceneAccidentParam param) {
+
+        MinioParameter MI = new MinioParameter();
+        MI.setObjectName(param.getJsonAddress());
+        Response download = fileDownService.download(MI);
+        // -------------------------------- label.json --------------------------------
+        String json = download.body().toString();
+        ;
+        ObjectMapper objMap = new ObjectMapper();
+        JsonNode root = objMap.readTree(json);
+        //判断场景名称唯一
+        String sceneName = root.path("场景名称").asText();
+        param.setSceneName(sceneName);
+        List<SceneAccidentPO> list = SceneAccidentMapper.querySceneAccidentByNmae(param);
+        if (list != null && list.size() > 0) {
+            return new ResponseBodyVO(ResponseBodyVO.Response.CLIENT_FAILURE, "该场景名称" + sceneName + "已存在,请检查");
+        }
 
-        } catch (Exception e) {
-            log.error("标准法规场景" + fileName + " 解析出错:", e);
+        SceneAccidentPO sceneAccidentPO = null;
+        sceneAccidentPO = sceneAccidentPO.builder()
+                .accidentId(StringUtil.getRandomUUID())
+                .sceneName(sceneName)
+                .selfDriving(root.path("自车驾驶行为").asText())
+                .targetDriving(root.path("目标驾驶行为").asText())
+                .selfReaction(root.path("自车反应行为").asText())
+                .conflictBehavior(root.path("冲突行为").asText())
+                .conflictType(root.path("冲突类型").asText())
+                .isDeleted("0")
+                .build();
+        // -------------------------------- 保存数据到 mysql --------------------------------
+        sceneAccidentPO.setCreateTime(TimeUtil.getNowForMysql());
+        sceneAccidentPO.setCreateUserId(AuthUtil.getCurrentUserId());
+        sceneAccidentPO.setModifyTime(TimeUtil.getNowForMysql());
+
+        if (null != param.getJsonAddress() && !param.getJsonAddress().equals("")) {
+            sceneAccidentPO.setJsonAddress(param.getJsonAddress());
+        }
+        if (null != param.getXmlAddress() && !param.getXmlAddress().equals("")) {
+            sceneAccidentPO.setXmlAddress(param.getXmlAddress());
+        }
+        if (null != param.getXodrAddress() && !param.getXodrAddress().equals("")) {
+            sceneAccidentPO.setXodrAddress(param.getXodrAddress());
+        }
+        if (null != param.getOsgbAddress() && !param.getOsgbAddress().equals("")) {
+            sceneAccidentPO.setOsgbAddress(param.getOsgbAddress());
+        }
+        if (null != param.getVideoAddress() && !param.getVideoAddress().equals("")) {
+            sceneAccidentPO.setVideoAddress(param.getVideoAddress());
+        }
+        if (null != param.getVideoPreview() && !param.getVideoPreview().equals("")) {
+            sceneAccidentPO.setVideoPreview(param.getVideoPreview());
         }
+        SceneAccidentMapper.saveSceneAccident(sceneAccidentPO);
+
+        return new ResponseBodyVO(ResponseBodyVO.Response.SUCCESS);
 
 
     }
 
     /**
      * 获取交通事故场景数据:
-     *//*
+     */
     @SneakyThrows
-    public void importJtSg(SceneAccidentParam param) {
+    public void testCS(SceneAccidentParam param) {
         //1 获取所有目录下所有场景
-        // String dataUrl0 ="C:\\Users\\CSS\\Desktop\\GQ\\仿真云平台\\测试场景样例数据\\交通事故场景\\China_Expressway_002";     // 场景数据根路径
-        String dataUrl0 =param.getPath();
-        System.out.println("--------"+param.getPath());
+        String dataUrl0 = "C:\\Users\\CSS\\Desktop\\GQ\\仿真云平台\\测试场景样例数据\\交通事故场景\\China_Expressway_002";     // 场景数据根路径
+        //  System.out.println("--------"+param.getPath());
         File[] scenes = FileUtil.getDirectory(dataUrl0).listFiles();
         if (scenes == null) {
             throw new RuntimeException("目录:" + dataUrl0 + " 下没有文件!");
@@ -109,22 +109,20 @@ public class SceneAccidentService {
 
         String fileName = null;
         try {
-
+            SceneAccidentPO sceneAccidentPO = null;
             for (File scene : scenes) {
                 String dataUrl = scene.getAbsolutePath();
-                if(dataUrl.indexOf(".json")!=-1){
+                if (dataUrl.indexOf(".json") != -1) {
                     //获取文件名
-                    File tempFile =new File( dataUrl.trim());
+                    File tempFile = new File(dataUrl.trim());
                     fileName = tempFile.getName();
-                    fileName=  fileName.substring(0,fileName.lastIndexOf("."));
+                    fileName = fileName.substring(0, fileName.lastIndexOf("."));
                     // -------------------------------- 读取结构化数据文件 --------------------------------
                     List<String> exceptionList = new ArrayList<>();     // 异常列表
                     // -------------------------------- label.json --------------------------------
                     String json = FileUtil.readFile(dataUrl);
                     ObjectMapper objMap = new ObjectMapper();
                     JsonNode root = objMap.readTree(json);
-
-                    SceneAccidentPO sceneAccidentPO = null;
                     sceneAccidentPO = sceneAccidentPO.builder()
                             .accidentId(StringUtil.getRandomUUID())
                             .sceneName(root.path("场景名称").asText())
@@ -140,37 +138,39 @@ public class SceneAccidentService {
                     sceneAccidentPO.setCreateUserId(AuthUtil.getCurrentUserId());
                     sceneAccidentPO.setModifyTime(TimeUtil.getNowForMysql());
 
-                    if(null!=param.getJsonAddress()&&!param.getJsonAddress().equals("")){
+                    if (null != param.getJsonAddress() && !param.getJsonAddress().equals("")) {
                         sceneAccidentPO.setJsonAddress(param.getJsonAddress());
                     }
-                    if(null!=param.getXmlAddress()&&!param.getXmlAddress().equals("")){
+                    if (null != param.getXmlAddress() && !param.getXmlAddress().equals("")) {
                         sceneAccidentPO.setXmlAddress(param.getXmlAddress());
                     }
-                    if(null!=param.getXodrAddress()&&!param.getXodrAddress().equals("")){
+                    if (null != param.getXodrAddress() && !param.getXodrAddress().equals("")) {
                         sceneAccidentPO.setXodrAddress(param.getXodrAddress());
                     }
-                    if(null!=param.getOsgbAddress()&&!param.getOsgbAddress().equals("")){
+                    if (null != param.getOsgbAddress() && !param.getOsgbAddress().equals("")) {
                         sceneAccidentPO.setOsgbAddress(param.getOsgbAddress());
                     }
-                    if(null!=param.getVideoAddress()&&!param.getVideoAddress().equals("")){
+                    if (null != param.getVideoAddress() && !param.getVideoAddress().equals("")) {
                         sceneAccidentPO.setVideoAddress(param.getVideoAddress());
                     }
-
-                    SceneAccidentMapper.saveSceneAccident(sceneAccidentPO);
-
                 }
-
             }
+            SceneAccidentMapper.saveSceneAccident(sceneAccidentPO);
         } catch (Exception e) {
             log.error("标准法规场景" + fileName + " 解析出错:", e);
         }
-
-
     }
-*/
 
-    public   List<SceneAccidentPO> querySceneAccidentList(SceneAccidentParam params) {
+    public List<SceneAccidentPO> querySceneAccidentList(SceneAccidentParam params) {
+
         List<SceneAccidentPO> list = SceneAccidentMapper.querySceneAccidentList(params);
         return list;
     }
+
+    public void deleteSceneAccidentList(SceneAccidentPO params) {
+        params.setIsDeleted("1");
+        params.setModifyTime(TimeUtil.getNowForMysql());
+        params.setModifyUserId(AuthUtil.getCurrentUserId());
+        SceneAccidentMapper.deleteSceneAccidentList(params);
+    }
 }

+ 133 - 121
simulation-resource-server/src/main/java/com/css/simulation/resource/scene/service/SceneNaturalService.java

@@ -1,10 +1,10 @@
 package com.css.simulation.resource.scene.service;
 
+import api.common.pojo.common.ResponseBodyVO;
 import api.common.pojo.param.MinioParameter;
 import api.common.pojo.param.scene.SceneNaturalNewParam;
 import api.common.pojo.param.scene.SceneNaturalParam;
 import api.common.pojo.po.scene.SceneNaturalPO;
-import api.common.util.FileUtil;
 import api.common.util.ObjectUtil;
 import api.common.util.ParamUtil;
 import api.common.util.TimeUtil;
@@ -20,11 +20,8 @@ import lombok.extern.slf4j.Slf4j;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
-import java.io.File;
 import java.util.ArrayList;
-import java.util.Arrays;
 import java.util.List;
-import java.util.stream.IntStream;
 
 
 @Slf4j
@@ -37,101 +34,107 @@ public class SceneNaturalService {
 
     @Resource
     private FileDownService fileDownService;
+
     /**
      * 获取自然驾驶场景数据:包括切分数据和标注数据
      */
     @SneakyThrows
-    public void importZrjsSceneCicv(SceneNaturalParam param) {
-        MinioParameter MI=new MinioParameter();
+    public ResponseBodyVO<String> importZrjsSceneCicv(SceneNaturalParam param) {
+        MinioParameter MI = new MinioParameter();
         MI.setObjectName(param.getJsonAddress());
-        int idx=param.getJsonAddress().lastIndexOf("/");
-        int end=param.getJsonAddress().lastIndexOf(".");
-       String  fileName=param.getJsonAddress().substring(idx+1,end);
+        int idx = param.getJsonAddress().lastIndexOf("/");
+        int end = param.getJsonAddress().lastIndexOf(".");
+        String fileName = param.getJsonAddress().substring(idx + 1, end);
+        param.setNaturalName(fileName);
+        List<SceneNaturalPO> list = sceneNaturalMapper.querySceneNaturaByName(param);
+        if (list != null && list.size() > 0) {
+            return new ResponseBodyVO(ResponseBodyVO.Response.CLIENT_FAILURE, "该场景编号" + fileName + "已存在,请检查");
+        }
         Response download = fileDownService.download(MI);
-                String json =download.body().toString();
-                    ObjectMapper objMap = new ObjectMapper();
-                    JsonNode root = objMap.readTree(json);
-                // -------------------------------- 自然环境 --------------------------------
-                JsonNode naturalEnvironment =  root.path("自然环境");
-                // -------------------------------- 道路 --------------------------------
-                JsonNode road =  root.path("道路");
-                // -------------------------------- 基础设施 --------------------------------
-                JsonNode infrastructure =  root.path("基础设施");
-                // -------------------------------- 临时性操纵 --------------------------------
-                JsonNode temporaryManipulation = root.path("临时性操纵");
-                // -------------------------------- 交通状况 --------------------------------
-                JsonNode traffic =  root.path("交通状况");
-                // -------------------------------- 自车行为 --------------------------------
-                JsonNode selfDrivingBehavior = root.path("自车行为");
-                // -------------------------------- 目标行为 --------------------------------
-                JsonNode targetBehavior =  root.path("目标行为");
-               SceneNaturalPO sceneNaturalPO = null;
-                sceneNaturalPO = sceneNaturalPO.builder()
-                        .naturalId(api.common.util.StringUtil.getRandomUUID())
-                        .naturalName(fileName)
-                        .weather(getSequenceNew(naturalEnvironment, "天气情况"))
-                        .backlight(getSequenceNew(naturalEnvironment, "逆光"))
-                        .lightChange(getSequenceNew(naturalEnvironment, "隧道光线变化"))
-                        .roadType(getSequenceNew(road, "道路类型"))
-                        .roadMatrrial(getSequenceNew(road, "路面材质"))
-                        .drivewayNum(getSequenceNew(road, "车道数量"))
-                        .drivewayType(getSequenceNew(road, "车道类型"))
-                        .roadFlatness(getSequenceNew(road, "道路平坦程度"))
-                        .roadCurvature(getSequenceNew(road, "道路弯曲度"))
-                        .ramp(getSequenceNew(road, "匝道"))
-                        .intersectionType(getSequenceNew(road, "路口类型"))
-                        .planeIntersection(getSequenceNew(road, "道路与铁路平面交叉"))
-                        .bridge(getSequenceNew(road, "桥梁"))
-                        .tunnel(getSequenceNew(road, "隧道"))
-                        .speedLimit(getSequenceNew(infrastructure, "限速标志"))
-                        .minSpeedLimit(getSequenceNew(infrastructure, "最低限速标志"))
-                        .noEntry(getSequenceNew(infrastructure, "禁止通行"))
-                        .noStopping(getSequenceNew(infrastructure, "禁止停车"))
-                        .leftLaneLine(getSequenceNew(infrastructure, "左侧车道线"))
-                        .rightLaneLine(getSequenceNew(infrastructure, "右侧车道线"))
-                        .conductorMarking(getSequenceNew(infrastructure, "导线标线及标志"))
-                        .pedestrianCrossing(getSequenceNew(infrastructure, "人行横道"))
-                        .trafficLight(getSequenceNew(infrastructure, "交通信号灯"))
-                        .decelerationMarking(getSequenceNew(infrastructure, "减速标线"))
-                        .pavementCondition(getSequenceNew(temporaryManipulation, "路面状况"))
-                        .naturalDisaster(getSequenceNew(temporaryManipulation, "自然灾害"))
-                        .roadSafetySigns(getSequenceNew(temporaryManipulation, "道路施工安全标识"))
-                        .safetyWarningBoard(getSequenceNew(temporaryManipulation, "三角安全警示牌"))
-                        .trafficAccident(getSequenceNew(traffic, "交通事故"))
-                        .violation(getSequenceNew(traffic, "违规"))
-                        .specialVehicleYield(getSequenceNew(traffic, "特种车辆让行"))
-                        .patency(getSequenceNew(traffic, "通畅情况"))
-                        .doubleFlashingCar(getSequenceNew(traffic, "双闪车辆"))
-                        .selfBehavior(getSequenceNew(selfDrivingBehavior))
-                        .targetBehavior(getSequenceNew(targetBehavior))
-                        .isDeleted("0")
-                        .build();
-                // -------------------------------- 保存数据到 mysql --------------------------------
-                sceneNaturalPO.setCreateTime(TimeUtil.getNowForMysql());
-                    sceneNaturalPO.setCreateUserId(AuthUtil.getCurrentUserId());
-                sceneNaturalPO.setModifyTime(TimeUtil.getNowForMysql());
-
-                    if(null!=param.getJsonAddress()&&!param.getJsonAddress().equals("")){
-                        sceneNaturalPO.setJsonAddress(param.getJsonAddress());
-                    }
-                    if(null!=param.getXoscAddress()&&!param.getXoscAddress().equals("")){
-                        sceneNaturalPO.setXoscAddress(param.getXoscAddress());
-                    }
-                    if(null!=param.getXodrAddress()&&!param.getXodrAddress().equals("")){
-                        sceneNaturalPO.setXodrAddress(param.getXodrAddress());
-                    }
-                    if(null!=param.getOsgbAddress()&&!param.getOsgbAddress().equals("")){
-                        sceneNaturalPO.setOsgbAddress(param.getOsgbAddress());
-                    }
-                    if(null!=param.getVideoAddress()&&!param.getVideoAddress().equals("")){
-                        sceneNaturalPO.setVideoAddress(param.getVideoAddress());
-                    }
-                    if(null!=param.getVideoPreview()&&!param.getVideoPreview().equals("")){
-                        sceneNaturalPO.setVideoPreview(param.getVideoPreview());
-                    }
-
-                    sceneNaturalMapper.saveSceneNatural(sceneNaturalPO);
+        String json = download.body().toString();
+        ObjectMapper objMap = new ObjectMapper();
+        JsonNode root = objMap.readTree(json);
+        // -------------------------------- 自然环境 --------------------------------
+        JsonNode naturalEnvironment = root.path("自然环境");
+        // -------------------------------- 道路 --------------------------------
+        JsonNode road = root.path("道路");
+        // -------------------------------- 基础设施 --------------------------------
+        JsonNode infrastructure = root.path("基础设施");
+        // -------------------------------- 临时性操纵 --------------------------------
+        JsonNode temporaryManipulation = root.path("临时性操纵");
+        // -------------------------------- 交通状况 --------------------------------
+        JsonNode traffic = root.path("交通状况");
+        // -------------------------------- 自车行为 --------------------------------
+        JsonNode selfDrivingBehavior = root.path("自车行为");
+        // -------------------------------- 目标行为 --------------------------------
+        JsonNode targetBehavior = root.path("目标行为");
+        SceneNaturalPO sceneNaturalPO = null;
+        sceneNaturalPO = sceneNaturalPO.builder()
+                .naturalId(api.common.util.StringUtil.getRandomUUID())
+                .naturalName(fileName)
+                .weather(getSequenceNew(naturalEnvironment, "天气情况"))
+                .backlight(getSequenceNew(naturalEnvironment, "逆光"))
+                .lightChange(getSequenceNew(naturalEnvironment, "隧道光线变化"))
+                .roadType(getSequenceNew(road, "道路类型"))
+                .roadMatrrial(getSequenceNew(road, "路面材质"))
+                .drivewayNum(getSequenceNew(road, "车道数量"))
+                .drivewayType(getSequenceNew(road, "车道类型"))
+                .roadFlatness(getSequenceNew(road, "道路平坦程度"))
+                .roadCurvature(getSequenceNew(road, "道路弯曲度"))
+                .ramp(getSequenceNew(road, "匝道"))
+                .intersectionType(getSequenceNew(road, "路口类型"))
+                .planeIntersection(getSequenceNew(road, "道路与铁路平面交叉"))
+                .bridge(getSequenceNew(road, "桥梁"))
+                .tunnel(getSequenceNew(road, "隧道"))
+                .speedLimit(getSequenceNew(infrastructure, "限速标志"))
+                .minSpeedLimit(getSequenceNew(infrastructure, "最低限速标志"))
+                .noEntry(getSequenceNew(infrastructure, "禁止通行"))
+                .noStopping(getSequenceNew(infrastructure, "禁止停车"))
+                .leftLaneLine(getSequenceNew(infrastructure, "左侧车道线"))
+                .rightLaneLine(getSequenceNew(infrastructure, "右侧车道线"))
+                .conductorMarking(getSequenceNew(infrastructure, "导线标线及标志"))
+                .pedestrianCrossing(getSequenceNew(infrastructure, "人行横道"))
+                .trafficLight(getSequenceNew(infrastructure, "交通信号灯"))
+                .decelerationMarking(getSequenceNew(infrastructure, "减速标线"))
+                .pavementCondition(getSequenceNew(temporaryManipulation, "路面状况"))
+                .naturalDisaster(getSequenceNew(temporaryManipulation, "自然灾害"))
+                .roadSafetySigns(getSequenceNew(temporaryManipulation, "道路施工安全标识"))
+                .safetyWarningBoard(getSequenceNew(temporaryManipulation, "三角安全警示牌"))
+                .trafficAccident(getSequenceNew(traffic, "交通事故"))
+                .violation(getSequenceNew(traffic, "违规"))
+                .specialVehicleYield(getSequenceNew(traffic, "特种车辆让行"))
+                .patency(getSequenceNew(traffic, "通畅情况"))
+                .doubleFlashingCar(getSequenceNew(traffic, "双闪车辆"))
+                .selfBehavior(getSequenceNew(selfDrivingBehavior))
+                .targetBehavior(getSequenceNew(targetBehavior))
+                .isDeleted("0")
+                .build();
+        // -------------------------------- 保存数据到 mysql --------------------------------
+        sceneNaturalPO.setCreateTime(TimeUtil.getNowForMysql());
+        sceneNaturalPO.setCreateUserId(AuthUtil.getCurrentUserId());
+        sceneNaturalPO.setModifyTime(TimeUtil.getNowForMysql());
+
+        if (null != param.getJsonAddress() && !param.getJsonAddress().equals("")) {
+            sceneNaturalPO.setJsonAddress(param.getJsonAddress());
+        }
+        if (null != param.getXoscAddress() && !param.getXoscAddress().equals("")) {
+            sceneNaturalPO.setXoscAddress(param.getXoscAddress());
+        }
+        if (null != param.getXodrAddress() && !param.getXodrAddress().equals("")) {
+            sceneNaturalPO.setXodrAddress(param.getXodrAddress());
+        }
+        if (null != param.getOsgbAddress() && !param.getOsgbAddress().equals("")) {
+            sceneNaturalPO.setOsgbAddress(param.getOsgbAddress());
+        }
+        if (null != param.getVideoAddress() && !param.getVideoAddress().equals("")) {
+            sceneNaturalPO.setVideoAddress(param.getVideoAddress());
+        }
+        if (null != param.getVideoPreview() && !param.getVideoPreview().equals("")) {
+            sceneNaturalPO.setVideoPreview(param.getVideoPreview());
+        }
 
+        sceneNaturalMapper.saveSceneNatural(sceneNaturalPO);
+        return new ResponseBodyVO(ResponseBodyVO.Response.SUCCESS);
     }
 
     public String getSequenceNew(JsonNode jsonObject, String field) throws Exception {
@@ -180,58 +183,67 @@ public class SceneNaturalService {
         else
             return s;
     }
-    public   List<SceneNaturalPO> querySceneNaturalList(SceneNaturalNewParam params) {
-        SceneNaturalParam  po=new SceneNaturalParam();
-         String naturalName=params.getNaturalName();      // 场景编号
-      String[][] naturalEnvironment=params.getNaturalEnvironment() ; //自然环境
-         String[][] road =params.getRoad(); //道路
-         String[][] infrastructure =params.getInfrastructure(); //基础设施
-       String[][] temporaryOperation =params.getTemporaryOperation(); //临时性操作
-        String[][] trafficCondition =params.getTrafficCondition(); //交通状况
-         String[][] selfBehavior =params.getSelfBehavior() ;//自车行为
-        String[][] targetBehavior =params.getTargetBehavior(); //目标行为
-        if(ObjectUtil.isNotNull(naturalName))   {
+
+    public List<SceneNaturalPO> querySceneNaturalList(SceneNaturalNewParam params) {
+        SceneNaturalParam po = new SceneNaturalParam();
+        String naturalName = params.getNaturalName();      // 场景编号
+        String[][] naturalEnvironment = params.getNaturalEnvironment(); //自然环境
+        String[][] road = params.getRoad(); //道路
+        String[][] infrastructure = params.getInfrastructure(); //基础设施
+        String[][] temporaryOperation = params.getTemporaryOperation(); //临时性操作
+        String[][] trafficCondition = params.getTrafficCondition(); //交通状况
+        String[][] selfBehavior = params.getSelfBehavior();//自车行为
+        String[][] targetBehavior = params.getTargetBehavior(); //目标行为
+        if (ObjectUtil.isNotNull(params.getIds())) {
+            po.setIds(params.getIds());
+        }
+        if (ObjectUtil.isNotNull(naturalName)) {
             po.setNaturalName(naturalName);
         }
-      if(naturalEnvironment!=null&&naturalEnvironment.length>0)   {
+        if (naturalEnvironment != null && naturalEnvironment.length > 0) {
             ParamUtil.arrConvertObj(naturalEnvironment, po);
         }
-        if(road!=null&&road.length>0)   {
+        if (road != null && road.length > 0) {
             ParamUtil.arrConvertObj(road, po);
         }
-        if(infrastructure!=null&&infrastructure.length>0)   {
+        if (infrastructure != null && infrastructure.length > 0) {
             ParamUtil.arrConvertObj(infrastructure, po);
         }
-        if(temporaryOperation!=null&&temporaryOperation.length>0)   {
+        if (temporaryOperation != null && temporaryOperation.length > 0) {
             ParamUtil.arrConvertObj(temporaryOperation, po);
         }
-        if(trafficCondition!=null&&trafficCondition.length>0)   {
+        if (trafficCondition != null && trafficCondition.length > 0) {
             ParamUtil.arrConvertObj(trafficCondition, po);
         }
-        if(selfBehavior!=null&&selfBehavior.length>0)   {
+        if (selfBehavior != null && selfBehavior.length > 0) {
             ParamUtil.arrConvertObj(selfBehavior, po);
-            for (String [] arr : selfBehavior) {
-                if(arr != null && arr.length ==1 ){
-                    List list=po.getSelfBehavior();
-                    if(list==null){
-                        List newList=new ArrayList();
+            for (String[] arr : selfBehavior) {
+                if (arr != null && arr.length == 1) {
+                    List list = po.getSelfBehavior();
+                    if (list == null) {
+                        List newList = new ArrayList();
                         newList.add(arr[0]);
-                        po.setSelfBehavior(newList);  ;
-                    }else{
+                        po.setSelfBehavior(newList);
+                        ;
+                    } else {
 
                         list.add(arr[0]);
-                        po.setSelfBehavior(list);  ;
+                        po.setSelfBehavior(list);
                     }
-
-
                 }
             }
-
         }
-        if(targetBehavior!=null&&targetBehavior.length>0)   {
+        if (targetBehavior != null && targetBehavior.length > 0) {
             ParamUtil.arrConvertObj(targetBehavior, po);
         }
         List<SceneNaturalPO> list = sceneNaturalMapper.querySceneNaturalList(po);
         return list;
     }
+
+    public void deleteSceneNatural(SceneNaturalPO params) {
+        params.setIsDeleted("1");
+        params.setModifyTime(TimeUtil.getNowForMysql());
+        params.setModifyUserId(AuthUtil.getCurrentUserId());
+        sceneNaturalMapper.deleteSceneNatural(params);
+    }
 }

+ 150 - 84
simulation-resource-server/src/main/java/com/css/simulation/resource/scene/service/ScenePackageService.java

@@ -1,14 +1,12 @@
 package com.css.simulation.resource.scene.service;
 
 import api.common.pojo.common.ResponseBodyVO;
-import api.common.pojo.param.scene.ScenePackageNewParam;
 import api.common.pojo.param.scene.ScenePackageParam;
 import api.common.pojo.po.scene.ScenePackagePO;
 import api.common.pojo.po.scene.ScenePackageSublistPO;
 import api.common.pojo.vo.scene.ScenePackageNewVO;
 import api.common.pojo.vo.scene.ScenePackageSublistVO;
 import api.common.util.StringUtil;
-
 import api.common.util.TimeUtil;
 import com.css.simulation.resource.common.utils.AuthUtil;
 import com.css.simulation.resource.scene.mapper.ScenePackageMapper;
@@ -17,12 +15,9 @@ import lombok.SneakyThrows;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.BeanUtils;
 import org.springframework.stereotype.Service;
-
 import javax.annotation.Resource;
 import java.util.ArrayList;
-import java.util.HashMap;
 import java.util.List;
-import java.util.Map;
 
 @Slf4j
 @Service
@@ -34,64 +29,92 @@ public class ScenePackageService {
     private ScenePackageSublistMapper scenePackageSublistMapper;
 
 
-
-
     /**
      * 测试包数据录入大保存:
      */
     @SneakyThrows
-    public ResponseBodyVO<String> saveScenePackage(ScenePackageNewParam params){
-        ScenePackagePO po=new ScenePackagePO();
-        BeanUtils.copyProperties(params,po);
-        po.setCreateUserId(AuthUtil.getCurrentUserId());
-        po.setShare("0");
-        List<ScenePackageNewVO> listName=scenePackageMapper.queryByPackageName(po);
-        if(listName!=null && listName.size()>0){
-            return new ResponseBodyVO(ResponseBodyVO.Response.CLIENT_FAILURE,"测试包名称packName="+po.getPackageName()+"已存在,请重新命名");
+    public ResponseBodyVO<String> saveScenePackage(List<ScenePackageSublistVO> params) {
+        List<ScenePackageSublistVO> listSublictTree = new ArrayList<>();
+        ScenePackagePO po = new ScenePackagePO();
+        for (ScenePackageSublistVO vo : params) {
+            po.setPackageName(vo.getSublistName());
+            po.setCreateUserId(AuthUtil.getCurrentUserId());
+            po.setShare("0");
+            List<ScenePackageNewVO> listName = scenePackageMapper.queryByPackageName(po);
+            if (listName != null && listName.size() > 0) {
+                return new ResponseBodyVO(ResponseBodyVO.Response.CLIENT_FAILURE, "测试包名称packName=" + po.getPackageName() + "已存在,请重新命名");
+            }
+            po.setWeight(vo.getWeight());
+            po.setRemarks(vo.getRemarks());
+            po.setSceneNum(vo.getSceneNum());
+            listSublictTree = vo.getChildren();
         }
         po.setCreateTime(TimeUtil.getNowForMysql());
         po.setModifyTime(TimeUtil.getNowForMysql());
         po.setPackageCode(StringUtil.getRandomCode());
-        String uuId=StringUtil.getRandomUUID();
+        String uuId = StringUtil.getRandomUUID();
         po.setPackageId(uuId);
         po.setIsDeleted("0");
+        po.setCreateUserId(AuthUtil.getCurrentUserId());
+
+        List<ScenePackageSublistPO> poList = new ArrayList<>();
+        List<ScenePackageSublistPO> treeList = instShareListTree(listSublictTree, uuId, uuId, poList, "0");
+        if (treeList == null || treeList.size() < 1) {
+            return new ResponseBodyVO(ResponseBodyVO.Response.CLIENT_FAILURE, "指标数据为空,请检查");
+        }
         scenePackageMapper.saveScenePackage(po);
-        List<ScenePackageSublistVO> list=params.getList();
-        List<ScenePackageSublistPO>  poList=new ArrayList<>();
-        List<ScenePackageSublistPO> treeList =instShareListTree(list,uuId,uuId,poList,"0");
         scenePackageSublistMapper.saveScenePackageSublistAll(treeList);
         return new ResponseBodyVO(ResponseBodyVO.Response.SUCCESS);
     }
+
     //查询测试包主表列表
     @SneakyThrows
-    public   List<ScenePackagePO> queryScenePackageList(ScenePackageParam params){
+    public List<ScenePackagePO> queryScenePackageList(ScenePackageParam params) {
         List<ScenePackagePO> list = scenePackageMapper.queryScenePackageList(params);
         return list;
     }
 
     //修改主表数据
     @SneakyThrows
-    public   void updateScenePackage(ScenePackageNewParam params) {
-        ScenePackagePO po=new ScenePackagePO();
-        BeanUtils.copyProperties(params,po);
-        po.setCreateTime(TimeUtil.getNowForMysql());
+    public ResponseBodyVO<String> updateScenePackage(List<ScenePackageSublistVO> params) {
+        List<ScenePackageSublistVO> listSublictTree = new ArrayList<>();
+        ScenePackagePO po = new ScenePackagePO();
+        for (ScenePackageSublistVO vo : params) {
+            //判断唯一
+            po.setPackageName(vo.getSublistName());
+            po.setCreateUserId(AuthUtil.getCurrentUserId());
+            po.setShare("0");
+            po.setPackageId(vo.getId());
+            List<ScenePackageNewVO> listName = scenePackageMapper.queryByPackageName(po);
+            if (listName != null && listName.size() > 0) {
+                return new ResponseBodyVO(ResponseBodyVO.Response.CLIENT_FAILURE, "测试包名称packName=" + po.getPackageName() + "已存在,请重新命名");
+            }
+            po.setWeight(vo.getWeight());
+            po.setRemarks(vo.getRemarks());
+            po.setSceneNum(vo.getSceneNum());
+            listSublictTree = vo.getChildren();
+        }
+
         po.setModifyTime(TimeUtil.getNowForMysql());
-        po.setCreateUserId(AuthUtil.getCurrentUserId());
+        po.setModifyUserId(AuthUtil.getCurrentUserId());
         po.setIsDeleted("0");
         po.setShare("0");
+        List<ScenePackageSublistPO> poList = new ArrayList<>();
+        List<ScenePackageSublistPO> treeList = instShareListTree(listSublictTree, po.getPackageId(), po.getPackageId(), poList, "0");
+        if (treeList == null || treeList.size() < 1) {
+            return new ResponseBodyVO(ResponseBodyVO.Response.CLIENT_FAILURE, "指标数据为空,请检查");
+        }
         scenePackageMapper.updateScenePackage(po);
-        scenePackageSublistMapper.deleteScenePackageSublist(params.getPackageId());
-        List<ScenePackageSublistVO> list=params.getList();
-        List<ScenePackageSublistPO>  poList=new ArrayList<>();
-        List<ScenePackageSublistPO> treeList =instShareListTree(list,params.getPackageId(),params.getPackageId(),poList,"0");
+        scenePackageSublistMapper.deleteScenePackageSublist(po.getPackageId());
         scenePackageSublistMapper.saveScenePackageSublistAll(treeList);
+        return new ResponseBodyVO(ResponseBodyVO.Response.SUCCESS);
     }
 
     //删除测试包
     @SneakyThrows
-    public   void deleteList(ScenePackageParam params) {
-        ScenePackagePO po=new ScenePackagePO();
-        po.setModifyUserId(StringUtil.getRandomUUID());
+    public void deleteList(ScenePackageParam params) {
+        ScenePackagePO po = new ScenePackagePO();
+        po.setModifyUserId(AuthUtil.getCurrentUserId());
         po.setModifyTime(TimeUtil.getNowForMysql());
         po.setIsDeleted("1");
         po.setPackageId(params.getPackageId());
@@ -101,44 +124,82 @@ public class ScenePackageService {
 
     //查询一个测试包的指标列表
     @SneakyThrows
-    public ScenePackageNewVO queryScenePackageSublistList(ScenePackageParam params){
-        ScenePackageSublistPO po=new ScenePackageSublistPO();
-        po.setParentId(params.getPackageId());
-        ScenePackageNewVO vo= scenePackageMapper.queryScenePackageBySublist(params.getPackageId());
-        List<ScenePackageSublistVO> list =selectScenePackageSubListTree(null,true,params.getPackageId());
-        vo.setList(list);
-     //   vo.setList(list);
+    public List<ScenePackageSublistVO> queryScenePackageSublistList(ScenePackageParam params) {
+        ScenePackageNewVO vo = scenePackageMapper.queryScenePackageBySublist(params.getPackageId());
+        ScenePackageSublistPO po = new ScenePackageSublistPO();
+        po.setRootId(params.getPackageId());
+        List<ScenePackageSublistVO> scenePackageSublistVOS = scenePackageSublistMapper.queryScenePackageSublistList(po);
+        //构建根节点
+        ScenePackageSublistVO root = new ScenePackageSublistVO();
+        root.setId(vo.getPackageId());
+        root.setParentId("0");
+        root.setSublistName(vo.getPackageName());
+        root.setWeight(vo.getWeight());
+        root.setSceneNum(vo.getSceneNum());
+        root.setRemarks(vo.getRemarks());
+        scenePackageSublistVOS.add(0, root);
+        //list转tree
+        List<ScenePackageSublistVO> tree = listToTree(scenePackageSublistVOS);
+        return tree;
+    }
+
+    /**
+     * list转tree
+     */
+    public static List<ScenePackageSublistVO> listToTree(List<ScenePackageSublistVO> list) {
+        List<ScenePackageSublistVO> treeList = new ArrayList<ScenePackageSublistVO>();
+        for (ScenePackageSublistVO vo : list) {
+            if ("0".equals(vo.getParentId())) {
+                treeList.add(findChildren(vo, list));
+            }
+        }
+        return treeList;
+    }
+
+    /**
+     * list转tree 递归
+     */
+    private static ScenePackageSublistVO findChildren(ScenePackageSublistVO vo, List<ScenePackageSublistVO> list) {
+        for (ScenePackageSublistVO node : list) {
+            if (vo.getId().equals(node.getParentId())) {
+                if (vo.getChildren() == null || vo.getChildren().size() == 0) {
+                    vo.setChildren(new ArrayList<ScenePackageSublistVO>());
+                }
+                vo.getChildren().add(findChildren(node, list));
+            }
+        }
         return vo;
     }
 
     /**
      * 级联获取场景指标
-     * @param parentVoList 首次传null
-     * @param isRoot 首次传true
+     *
+     * @param parentVoList   首次传null
+     * @param isRoot         首次传true
      * @param scenePackageId 场景包id
      * @return
      */
     public List<ScenePackageSublistVO> selectScenePackageSubListTree(List<ScenePackageSublistVO> parentVoList,
-                                                                     boolean isRoot,String scenePackageId){
-        ScenePackageSublistPO params=new ScenePackageSublistPO();
+                                                                     boolean isRoot, String scenePackageId) {
+        ScenePackageSublistPO params = new ScenePackageSublistPO();
         params.setParentId(scenePackageId);
-        if(isRoot){
-            //查找一级节点
-            parentVoList = scenePackageSublistMapper.queryScenePackageSublistList(params);
-            if(parentVoList != null && parentVoList.size() > 0){
-                selectScenePackageSubListTree(parentVoList, false, null);
-            }
-        }else{
+        if (isRoot) {
+                //查找一级节点
+                parentVoList = scenePackageSublistMapper.queryScenePackageSublistList(params);
+                if (parentVoList != null && parentVoList.size() > 0) {
+                    selectScenePackageSubListTree(parentVoList, false, null);
+                }
+            } else {
             //获取子节点集合
-            for(ScenePackageSublistVO pvo : parentVoList){
-                params.setParentId(pvo.getSublistId());
+            for (ScenePackageSublistVO pvo : parentVoList) {
+                params.setParentId(pvo.getId());
                 List<ScenePackageSublistVO> cvoList = scenePackageSublistMapper.queryScenePackageSublistList(params);
-                if(cvoList != null && cvoList.size() > 0){
+                if (cvoList != null && cvoList.size() > 0) {
                     //存入父节点集合中
-                    pvo.setList(cvoList);
-                    pvo.setHasChildren(true);
+                    pvo.setChildren(cvoList);
+                    //  pvo.setHasChildren(true);
                     //继续查找下一节点
-                    selectScenePackageSubListTree(cvoList,false, null);
+                    selectScenePackageSubListTree(cvoList, false, null);
                 }
             }
         }
@@ -146,66 +207,71 @@ public class ScenePackageService {
     }
 
 
-//分享
+    //分享
     @SneakyThrows
-    public ResponseBodyVO<String> instShareList(ScenePackageParam params){
+    public ResponseBodyVO<String> instShareList(ScenePackageParam params) {
         //查询测试包主表
-        ScenePackagePO scenePackagePO=scenePackageMapper.queryScenePackage(params);
-        ScenePackagePO po=new ScenePackagePO();
+        ScenePackagePO scenePackagePO = scenePackageMapper.queryScenePackage(params);
+        ScenePackagePO po = new ScenePackagePO();
         po.setShare("1");
-
-        List<ScenePackageNewVO> listName=scenePackageMapper.queryByPackageName(po);
-        if(listName!=null && listName.size()>0){
-            return new ResponseBodyVO(ResponseBodyVO.Response.CLIENT_FAILURE,"公有列表名称packName="+po.getPackageName()+"的测试包已存在,请检查");
+        po.setPackageName(scenePackagePO.getPackageName());
+        List<ScenePackageNewVO> listName = scenePackageMapper.queryByPackageName(po);
+        if (listName != null && listName.size() > 0) {
+            return new ResponseBodyVO(ResponseBodyVO.Response.CLIENT_FAILURE, "公有列表名称packName=" + listName.get(0).getPackageName() + "的测试包已存在,请检查");
         }
-        BeanUtils.copyProperties(scenePackagePO,po);
+        BeanUtils.copyProperties(scenePackagePO, po);
         po.setCreateTime(TimeUtil.getNowForMysql());
         po.setModifyTime(TimeUtil.getNowForMysql());
         po.setCreateUserId(AuthUtil.getCurrentUserId());
         po.setPackageCode(StringUtil.getRandomCode());
-        String uuId=StringUtil.getRandomUUID();
+        String uuId = StringUtil.getRandomUUID();
         po.setPackageId(uuId);
         po.setIsDeleted("0");
+        po.setShare("1");
         scenePackageMapper.saveScenePackage(po);
-        List<ScenePackageSublistPO>  poList=new ArrayList<>();
-        List<ScenePackageSublistVO> listSublist =selectScenePackageSubListTree(null,true,params.getPackageId());
-        List<ScenePackageSublistPO> treeList =instShareListTree(listSublist,uuId,uuId,poList,"1");
-       scenePackageSublistMapper.saveScenePackageSublistAll(treeList);
+        List<ScenePackageSublistPO> poList = new ArrayList<>();
+        List<ScenePackageSublistVO> listSublist = selectScenePackageSubListTree(null, true, params.getPackageId());
+        List<ScenePackageSublistPO> treeList = instShareListTree(listSublist, uuId, uuId, poList, "1");
+        scenePackageSublistMapper.saveScenePackageSublistAll(treeList);
         return new ResponseBodyVO(ResponseBodyVO.Response.SUCCESS);
     }
+
     /**
      * 根据级联结果转化为单级list
-     * @param parentVoList 首次传null
+     *
+     * @param parentVoList   首次传null
      * @param scenePackageId 场景包id
      * @return
      */
     public List<ScenePackageSublistPO> instShareListTree(List<ScenePackageSublistVO> parentVoList,
-                                                                    String scenePackageId,String rootId,List<ScenePackageSublistPO>  poList
-                                                                ,String share){
+                                       String scenePackageId, String rootId, List<ScenePackageSublistPO> poList
+            , String share) {
         {
             //获取子节点集合
-
-                for (int i=0;i< parentVoList.size() ;i++) {
-                ScenePackageSublistPO params=new ScenePackageSublistPO();
-                BeanUtils.copyProperties(parentVoList.get(i),params);
+            int a = 1;
+            for (int i = 0; i < parentVoList.size(); i++) {
+                ScenePackageSublistPO params = new ScenePackageSublistPO();
+                BeanUtils.copyProperties(parentVoList.get(i), params);
                 params.setParentId(scenePackageId);
                 params.setRootId(rootId);
                 params.setSublistName(parentVoList.get(i).getSublistName());
                 params.setCreateTime(TimeUtil.getNowForMysql());
                 params.setModifyTime(TimeUtil.getNowForMysql());
                 params.setCreateUserId(AuthUtil.getCurrentUserId());
-                String uuId= StringUtil.getRandomUUID();
-                params.setSublistId(uuId);   //主键ID
+                String uuId = StringUtil.getRandomUUID();
+                params.setId(uuId);   //主键ID
                 params.setIsDeleted("0");
                 params.setShare(share);
-                List<ScenePackageSublistVO> cvoList = parentVoList.get(i).getList();
+                params.setSeq(a);
+                List<ScenePackageSublistVO> cvoList = parentVoList.get(i).getChildren();
                 poList.add(params);
-                if(cvoList != null && cvoList.size() > 0){
+                if (cvoList != null && cvoList.size() > 0) {
                     //继续查找下一节点
-                    instShareListTree(cvoList, uuId,rootId,poList,share);
+                    instShareListTree(cvoList, uuId, rootId, poList, share);
                 }
                 parentVoList.remove(parentVoList.get(i));
                 i--;
+                a++;
             }
         }
 
@@ -213,8 +279,8 @@ public class ScenePackageService {
     }
 
     //测试包名查唯一
-    public List<ScenePackageNewVO> queryByPackageName(ScenePackagePO params){
-        return   scenePackageMapper.queryByPackageName(params);
+    public List<ScenePackageNewVO> queryByPackageName(ScenePackagePO params) {
+        return scenePackageMapper.queryByPackageName(params);
     }
 
 }

+ 14 - 12
simulation-resource-server/src/main/java/com/css/simulation/resource/scene/service/ScoringRulesService.java

@@ -9,7 +9,6 @@ import com.css.simulation.resource.scene.mapper.ScoringRulesMapper;
 import lombok.SneakyThrows;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.stereotype.Service;
-
 import javax.annotation.Resource;
 import java.util.List;
 
@@ -20,13 +19,11 @@ public class ScoringRulesService {
     @Resource
     private ScoringRulesMapper scoringRulesMapper;
 
-
-
     /**
      * 打分规则数据录入:
      */
     @SneakyThrows
-    public void saveScoringRules(ScoringRulesPO params){
+    public void saveScoringRules(ScoringRulesPO params) {
         params.setCreateTime(TimeUtil.getNowForMysql());
         params.setModifyTime(TimeUtil.getNowForMysql());
         params.setRulesId(StringUtil.getRandomUUID());
@@ -35,34 +32,39 @@ public class ScoringRulesService {
         params.setIsDeleted("0");
         scoringRulesMapper.saveScoringRules(params);
     }
+
     @SneakyThrows
-    public   List<ScoringRulesPO> queryScoringRulesList(ScoringRulesParam params){
-        if(params!=null &&params.getShare()!=null&&params.getShare().equals("0")){
+    public List<ScoringRulesPO> queryScoringRulesList(ScoringRulesParam params) {
+        if (params != null && params.getShare() != null && params.getShare().equals("0")) {
             params.setCreateUserId(AuthUtil.getCurrentUserId());
         }
         List<ScoringRulesPO> list = scoringRulesMapper.queryScoringRulesList(params);
         return list;
     }
+
     @SneakyThrows
-    public   ScoringRulesPO queryScoringRules(ScoringRulesParam params) {
+    public ScoringRulesPO queryScoringRules(ScoringRulesParam params) {
         ScoringRulesPO Po = scoringRulesMapper.queryScoringRules(params);
         return Po;
     }
+
     @SneakyThrows
-    public  List<ScoringRulesPO> queryScoringRulesByRuleName(ScoringRulesParam params) {
-        if(params.getShare().equals("0")){
+    public List<ScoringRulesPO> queryScoringRulesByRuleName(ScoringRulesParam params) {
+        if (params.getShare().equals("0")) {
             params.setCreateUserId(AuthUtil.getCurrentUserId());
         }
         return scoringRulesMapper.queryScoringRulesByRuleName(params);
     }
+
     @SneakyThrows
-    public   void updateScoringRules(ScoringRulesPO params) {
+    public void updateScoringRules(ScoringRulesPO params) {
         params.setModifyTime(TimeUtil.getNowForMysql());
         params.setModifyUserId(AuthUtil.getCurrentUserId());
-         scoringRulesMapper.updateScoringRules(params);
+        scoringRulesMapper.updateScoringRules(params);
     }
+
     @SneakyThrows
-    public   void deleteScoringRules(ScoringRulesPO params) {
+    public void deleteScoringRules(ScoringRulesPO params) {
         params.setIsDeleted("1");
         params.setModifyTime(TimeUtil.getNowForMysql());
         params.setModifyUserId(AuthUtil.getCurrentUserId());

+ 56 - 45
simulation-resource-server/src/main/java/com/css/simulation/resource/scene/service/StandardsRegulationsService.java

@@ -1,9 +1,9 @@
 package com.css.simulation.resource.scene.service;
 
+import api.common.pojo.common.ResponseBodyVO;
 import api.common.pojo.param.MinioParameter;
 import api.common.pojo.param.scene.StandardsRegulationsParam;
 import api.common.pojo.po.scene.StandardsRegulationsPO;
-import api.common.util.FileUtil;
 import api.common.util.StringUtil;
 import api.common.util.TimeUtil;
 import com.css.simulation.resource.common.utils.AuthUtil;
@@ -15,10 +15,7 @@ import feign.Response;
 import lombok.SneakyThrows;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.stereotype.Service;
-
 import javax.annotation.Resource;
-import java.io.File;
-import java.util.ArrayList;
 import java.util.List;
 
 @Slf4j
@@ -35,52 +32,66 @@ public class StandardsRegulationsService {
      * 获取标准法规场景数据:
      */
     @SneakyThrows
-    public void importBzFg(StandardsRegulationsParam param) {
-
-                    MinioParameter MI=new MinioParameter();
-                    MI.setObjectName(param.getJsonAddress());
-                    Response download = fileDownService.download(MI);
-                    String json =download.body().toString();
-                    ObjectMapper objMap = new ObjectMapper();
-                    JsonNode root = objMap.readTree(json);
+    public ResponseBodyVO<String> importBzFg(StandardsRegulationsParam param) {
 
-                    StandardsRegulationsPO standardsRegulationsPO = null;
-                    standardsRegulationsPO = standardsRegulationsPO.builder()
-                        .regulationsId(StringUtil.getRandomUUID())
-                        .sceneName(root.path("场景名称").asText())
-                        .regulationType(root.path("法规类型").asText())
-                        .standardType(root.path("标准类型").asText())
-                        .isDeleted("0")
-                        .build();
-                // -------------------------------- 保存数据到 mysql --------------------------------
-                    standardsRegulationsPO.setCreateTime(TimeUtil.getNowForMysql());
-                    standardsRegulationsPO.setModifyTime(TimeUtil.getNowForMysql());
-                    standardsRegulationsPO.setCreateUserId(AuthUtil.getCurrentUserId());
-                    if(null!=param.getJsonAddress()&&!param.getJsonAddress().equals("")){
-                        standardsRegulationsPO.setJsonAddress(param.getJsonAddress());
-                    }
-                    if(null!=param.getXmlAddress()&&!param.getXmlAddress().equals("")){
-                        standardsRegulationsPO.setXmlAddress(param.getXmlAddress());
-                    }
-                    if(null!=param.getXodrAddress()&&!param.getXodrAddress().equals("")){
-                        standardsRegulationsPO.setXodrAddress(param.getXodrAddress());
-                    }
-                    if(null!=param.getOsgbAddress()&&!param.getOsgbAddress().equals("")){
-                        standardsRegulationsPO.setOsgbAddress(param.getOsgbAddress());
-                    }
-                    if(null!=param.getVideoAddress()&&!param.getVideoAddress().equals("")){
-                        standardsRegulationsPO.setVideoAddress(param.getVideoAddress());
-                    }
-                    if(null!=param.getVideoPreview()&&!param.getVideoPreview().equals("")){
-                        standardsRegulationsPO.setVideoPreview(param.getVideoPreview());
-                    }
-                    standardsRegulationsMapper.saveStandardsRegulations(standardsRegulationsPO);
+        MinioParameter MI = new MinioParameter();
+        MI.setObjectName(param.getJsonAddress());
+        Response download = fileDownService.download(MI);
+        String json = download.body().toString();
+        ObjectMapper objMap = new ObjectMapper();
+        JsonNode root = objMap.readTree(json);
+        String sceneName = root.path("场景名称").asText();
+        param.setSceneName(sceneName);
+        List<StandardsRegulationsPO> list = standardsRegulationsMapper.queryStandardsRegulationsByName(param);
+        if (list != null && list.size() > 0) {
+            return new ResponseBodyVO(ResponseBodyVO.Response.CLIENT_FAILURE, "该场景名称" + sceneName + "已存在,请检查");
+        }
 
+        StandardsRegulationsPO standardsRegulationsPO = null;
+        standardsRegulationsPO = standardsRegulationsPO.builder()
+                .regulationsId(StringUtil.getRandomUUID())
+                .sceneName(sceneName)
+                .regulationType(root.path("法规类型").asText())
+                .standardType(root.path("标准类型").asText())
+                .isDeleted("0")
+                .build();
+        // -------------------------------- 保存数据到 mysql --------------------------------
+        standardsRegulationsPO.setCreateTime(TimeUtil.getNowForMysql());
+        standardsRegulationsPO.setModifyTime(TimeUtil.getNowForMysql());
+        standardsRegulationsPO.setCreateUserId(AuthUtil.getCurrentUserId());
+        if (null != param.getJsonAddress() && !param.getJsonAddress().equals("")) {
+            standardsRegulationsPO.setJsonAddress(param.getJsonAddress());
+        }
+        if (null != param.getXmlAddress() && !param.getXmlAddress().equals("")) {
+            standardsRegulationsPO.setXmlAddress(param.getXmlAddress());
+        }
+        if (null != param.getXodrAddress() && !param.getXodrAddress().equals("")) {
+            standardsRegulationsPO.setXodrAddress(param.getXodrAddress());
+        }
+        if (null != param.getOsgbAddress() && !param.getOsgbAddress().equals("")) {
+            standardsRegulationsPO.setOsgbAddress(param.getOsgbAddress());
+        }
+        if (null != param.getVideoAddress() && !param.getVideoAddress().equals("")) {
+            standardsRegulationsPO.setVideoAddress(param.getVideoAddress());
+        }
+        if (null != param.getVideoPreview() && !param.getVideoPreview().equals("")) {
+            standardsRegulationsPO.setVideoPreview(param.getVideoPreview());
+        }
+        standardsRegulationsMapper.saveStandardsRegulations(standardsRegulationsPO);
 
+        return new ResponseBodyVO(ResponseBodyVO.Response.SUCCESS);
     }
-//查看列表
-    public   List<StandardsRegulationsPO> querySceneNaturalList(StandardsRegulationsParam params) {
+
+    //查看列表
+    public List<StandardsRegulationsPO> querySceneNaturalList(StandardsRegulationsParam params) {
         List<StandardsRegulationsPO> list = standardsRegulationsMapper.queryStandardsRegulationsList(params);
         return list;
     }
+
+    public void deleteStandardsRegulations(StandardsRegulationsPO params) {
+        params.setIsDeleted("1");
+        params.setModifyTime(TimeUtil.getNowForMysql());
+        params.setModifyUserId(AuthUtil.getCurrentUserId());
+        standardsRegulationsMapper.deleteStandardsRegulations(params);
+    }
 }

+ 34 - 0
simulation-resource-server/src/main/java/com/css/simulation/resource/system/ctrl/MenuCtrl.java

@@ -0,0 +1,34 @@
+package com.css.simulation.resource.system.ctrl;
+
+import api.common.pojo.common.ResponseBodyVO;
+import api.common.pojo.vo.system.MenuVO;
+import com.css.simulation.resource.system.service.MenuService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.ResponseBody;
+
+import java.util.List;
+
+/**
+ * 菜单管理
+ */
+@Controller
+@RequestMapping("/menu")
+public class MenuCtrl {
+
+    @Autowired
+    MenuService menuService;
+
+    /**
+     * 获取当前登录人的菜单列表
+     */
+    @RequestMapping("/getMenus")
+    @ResponseBody
+    public ResponseBodyVO getMenus() {
+        ResponseBodyVO<List<MenuVO>> response = new ResponseBodyVO<List<MenuVO>>(ResponseBodyVO.Response.SUCCESS);
+        response.setInfo(menuService.getMenus());
+        return response;
+    }
+}

+ 16 - 0
simulation-resource-server/src/main/java/com/css/simulation/resource/system/mapper/MenuMapper.java

@@ -0,0 +1,16 @@
+package com.css.simulation.resource.system.mapper;
+
+import api.common.pojo.vo.system.MenuVO;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+import org.springframework.stereotype.Repository;
+
+import java.util.List;
+
+@Mapper
+@Repository
+public interface MenuMapper {
+
+    List<MenuVO> getMenus(@Param("userId") String userId);
+
+}

+ 24 - 0
simulation-resource-server/src/main/java/com/css/simulation/resource/system/service/MenuService.java

@@ -0,0 +1,24 @@
+package com.css.simulation.resource.system.service;
+
+import api.common.pojo.vo.system.MenuVO;
+import api.common.util.ObjectUtil;
+import com.css.simulation.resource.common.utils.AuthUtil;
+import com.css.simulation.resource.system.mapper.MenuMapper;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+@Service
+public class MenuService {
+
+    @Autowired
+    MenuMapper menuMapper;
+
+    public List<MenuVO> getMenus() {
+        String userId = AuthUtil.getCurrentUserId();
+        List<MenuVO> menus = menuMapper.getMenus(userId);
+        List<MenuVO> treeList = ObjectUtil.listToTree(menus, "0", MenuVO::getId, MenuVO::getParentId, MenuVO::getChildren, MenuVO::setChildren);
+        return treeList;
+    }
+}

+ 27 - 4
simulation-resource-server/src/main/resources/mapper/algorithm/AlgorithmMapper.xml

@@ -16,7 +16,6 @@
         git_token,
         file_name,
         minio_path,
-        linux_path,
         share,
         create_time,
         create_user_id,
@@ -35,7 +34,6 @@
         #{gitToken,jdbcType=VARCHAR},
         #{fileName,jdbcType=VARCHAR},
         #{minioPath,jdbcType=VARCHAR},
-        #{linuxPath,jdbcType=VARCHAR},
         #{share,jdbcType=VARCHAR},
         #{createTime,jdbcType=TIMESTAMP},
         #{createUserId,jdbcType=VARCHAR},
@@ -56,7 +54,7 @@
     <select id="selectAlgorithmList" parameterType="api.common.pojo.param.algorithm.AlgorithmParameter" resultType="api.common.pojo.vo.algorithm.AlgorithmVO">
         select id, algorithm_name, description, validation_status, upload_mode from algorithm
         <where>
-            is_deleted = '0'
+            is_deleted = '0' and share = '0'
         </where>
         <if test="id != null and id != ''">
             and id like CONCAT('%',#{id,jdbcType=VARCHAR},'%')
@@ -88,6 +86,22 @@
         </if>
     </select>
 
+    <!--查询算法名称是否已存在-当前用户-->
+    <select id="selectAlgorithmName"  parameterType="api.common.pojo.param.algorithm.AlgorithmParameter" resultType="api.common.pojo.po.algorithm.AlgorithmPO">
+        select id  from algorithm
+        where is_deleted = '0'
+        <if test="algorithmName != null and algorithmName != ''">
+            and  algorithm_name = #{algorithmName,jdbcType=VARCHAR}
+        </if>
+        <if test="createUserId != null and createUserId != ''">
+            and create_user_id = #{createUserId,jdbcType=VARCHAR}
+        </if>
+        <if test="id != null and id != ''">
+            and id != #{id,jdbcType=VARCHAR}
+        </if>
+    </select>
+
+
     <!--查询算法列表—公有-->
     <select id="selectSharedAlgorithmList" parameterType="api.common.pojo.param.algorithm.AlgorithmParameter" resultType="api.common.pojo.vo.algorithm.AlgorithmVO">
         select id, algorithm_name, description, validation_status, upload_mode from algorithm
@@ -112,6 +126,15 @@
         order by modify_time desc, create_time desc
     </select>
 
+    <!--查询算法名称是否已存在-公有-->
+    <select id="selectSharedAlgorithmName" resultType="api.common.pojo.po.algorithm.AlgorithmPO">
+        select id  from algorithm
+        where is_deleted = '0' and share = '1'
+        <if test="algorithmName != null and algorithmName != ''">
+            and  algorithm_name = #{algorithmName,jdbcType=VARCHAR}
+        </if>
+    </select>
+
     <!--删除-->
     <update id="deleteByid">
         update algorithm
@@ -131,7 +154,7 @@
         minio_path=#{minioPath,jdbcType=VARCHAR},
         linux_path=#{linuxPath,jdbcType=VARCHAR},
         modify_time=#{modifyTime,jdbcType=VARCHAR},
-        modify_user_id=#{modifyUserId,jdbcType=VARCHAR},
+        modify_user_id=#{modifyUserId,jdbcType=VARCHAR}
         where id=#{id,jdbcType=VARCHAR}
     </update>
 

+ 8 - 6
simulation-resource-server/src/main/resources/mapper/model/ConfigMapper.xml

@@ -47,12 +47,14 @@
         order by c.create_time desc
     </select>
 
-    <select id="getConfigInfo" parameterType="api.common.pojo.param.model.ConfigPageParam" resultMap="ConfigVOMap">
+    <select id="getConfigInfo" parameterType="api.common.pojo.vo.model.ConfigVO" resultMap="ConfigVOMap">
         SELECT
             c.id,
             c.config_code,
             c.config_name,
             c.description as configDescription,
+            c.vehicle_id,
+            c.share,
             v.vehicle_name,
             v.description as vehicleDescription
         FROM model_config c
@@ -61,7 +63,7 @@
         and c.id = #{id,jdbcType=VARCHAR}
     </select>
 
-    <select id="getConfigSensors" parameterType="api.common.pojo.param.model.ConfigPageParam" resultMap="ConfigSensorVOMap">
+    <select id="getConfigSensors" parameterType="api.common.pojo.vo.model.ConfigVO" resultMap="ConfigSensorVOMap">
         <!--摄像头-->
         SELECT
             r.id,r.config_id,r.sensor_id,
@@ -70,7 +72,7 @@
             r.sensor_x, r.sensor_y, r.sensor_z, r.sensor_h, r.sensor_p, r.sensor_r, r.sensor_port
         FROM relation_config_sensor r
         INNER JOIN model_sensor_camera s ON r.sensor_id = s.id
-        WHERE r.config_id = #{id,jdbcType=VARCHAR}
+        WHERE r.is_deleted = '0' and r.config_id = #{id,jdbcType=VARCHAR}
         UNION
         <!--完美传感器-->
         SELECT
@@ -80,7 +82,7 @@
             r.sensor_x, r.sensor_y, r.sensor_z, r.sensor_h, r.sensor_p, r.sensor_r, r.sensor_port
         FROM relation_config_sensor r
         INNER JOIN model_sensor_ogt s ON r.sensor_id = s.id
-        WHERE r.config_id = #{id,jdbcType=VARCHAR}
+        WHERE r.is_deleted = '0' and r.config_id = #{id,jdbcType=VARCHAR}
         UNION
         <!--激光雷达-->
         SELECT
@@ -90,7 +92,7 @@
             r.sensor_x, r.sensor_y, r.sensor_z, r.sensor_h, r.sensor_p, r.sensor_r, r.sensor_port
         FROM relation_config_sensor r
         INNER JOIN model_sensor_lidar s ON r.sensor_id = s.id
-        WHERE r.config_id = #{id,jdbcType=VARCHAR}
+        WHERE r.is_deleted = '0' and r.config_id = #{id,jdbcType=VARCHAR}
         UNION
         <!--GPS-->
         SELECT
@@ -100,7 +102,7 @@
             r.sensor_x, r.sensor_y, r.sensor_z, r.sensor_h, r.sensor_p, r.sensor_r, r.sensor_port
         FROM relation_config_sensor r
         INNER JOIN model_sensor_gps s ON r.sensor_id = s.id
-        WHERE r.config_id = #{id,jdbcType=VARCHAR}
+        WHERE r.is_deleted = '0' and r.config_id = #{id,jdbcType=VARCHAR}
     </select>
 
     <select id="checkConfigName" parameterType="api.common.pojo.po.model.ConfigPO" resultMap="ConfigVOMap">

+ 1 - 0
simulation-resource-server/src/main/resources/mapper/model/VehicleMapper.xml

@@ -34,6 +34,7 @@
         select
           id,
           vehicle_name,
+          description,
           share
         from model_vehicle v
         where v.is_deleted = '0'

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

@@ -130,10 +130,10 @@
         <where>
             is_deleted = '0'
             <if test="projectId != null and projectId != ''">
-                and project_id like CONCAT('%',#{project_id,jdbcType=VARCHAR},'%')
+                and project_id like CONCAT('%',#{projectId,jdbcType=VARCHAR},'%')
             </if>
             <if test="projectName != null and projectName != ''">
-                and project_name like CONCAT('%',#{project_name,jdbcType=VARCHAR},'%')
+                and project_name like CONCAT('%',#{projectName,jdbcType=VARCHAR},'%')
             </if>
             <if test="nowRunState != null and nowRunState != ''">
                 and now_run_state = #{nowRunState}

+ 49 - 12
simulation-resource-server/src/main/resources/mapper/scene/SceneAccidentMapper.xml

@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8" ?>
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
-<mapper namespace="com.css.simulation.resource.scene.mapper.SceneAccidentMapper" >
+<mapper namespace="com.css.simulation.resource.scene.mapper.SceneAccidentMapper">
 
     <insert id="saveSceneAccident" parameterType="api.common.pojo.po.scene.SceneAccidentPO">
         insert into simulation.scene_accident
@@ -18,7 +18,8 @@
     </insert>
 
 
-    <select id="querySceneAccidentList" parameterType="api.common.pojo.param.scene.SceneAccidentParam" resultType="api.common.pojo.po.scene.SceneAccidentPO">
+    <select id="querySceneAccidentList" parameterType="api.common.pojo.param.scene.SceneAccidentParam"
+            resultType="api.common.pojo.po.scene.SceneAccidentPO">
         select
         accident_id,scene_name,self_driving,target_driving,
         self_reaction,conflict_behavior,conflict_type,
@@ -33,42 +34,78 @@
             </if>
 
             <if test="selfDriving != null and selfDriving.length != 0 ">
-            and   self_driving  in
-            <foreach collection="selfDriving" item="item" index="index"
-                     separator="," open="(" close=")">
-                #{item}
-            </foreach>
+                and self_driving in
+                <foreach collection="selfDriving" item="item" index="index"
+                         separator="," open="(" close=")">
+                    #{item}
+                </foreach>
             </if>
             <if test="targetDriving != null and targetDriving.length != 0">
-               and   target_driving  in
+                and target_driving in
                 <foreach collection="targetDriving" item="item" index="index"
                          separator="," open="(" close=")">
                     #{item}
                 </foreach>
             </if>
             <if test="selfReaction != null and selfReaction.length != 0">
-                and  self_reaction  in
+                and self_reaction in
                 <foreach collection="selfReaction" item="item" index="index"
                          separator="," open="(" close=")">
                     #{item}
                 </foreach>
             </if>
             <if test="conflictBehavior != null and conflictBehavior.length != 0">
-                and   conflict_behavior  in
+                and conflict_behavior in
                 <foreach collection="conflictBehavior" item="item" index="index"
                          separator="," open="(" close=")">
                     #{item}
                 </foreach>
             </if>
             <if test="conflictType != null and conflictType.length != 0">
-                and   conflict_type  in
+                and conflict_type in
                 <foreach collection="conflictType" item="item" index="index"
                          separator="," open="(" close=")">
                     #{item}
                 </foreach>
             </if>
-            order by create_time desc
+            <if test="ids != null and ids.length>0">
+                and accident_id in
+                <foreach collection="ids" item="item" index="index"
+                         separator="," open="(" close=")">
+                    #{item}
+                </foreach>
+            </if>
+            order by modify_time desc
         </where>
     </select>
 
+    <update id="deleteSceneAccidentList" parameterType="api.common.pojo.po.scene.SceneAccidentPO">
+        update simulation.scene_accident
+        <set>
+            <if test="isDeleted != null and isDeleted!=''">
+                is_deleted = #{isDeleted,jdbcType=VARCHAR},
+            </if>
+            <if test="modifyUserId != null and modifyUserId!=''">
+                modify_user_id = #{modifyUserId,jdbcType=VARCHAR},
+            </if>
+            <if test="modifyTime != null">
+                modify_time = #{modifyTime},
+            </if>
+        </set>
+        where accident_id = #{accidentId,jdbcType=VARCHAR}
+    </update>
+
+
+    <select id="querySceneAccidentByNmae" parameterType="api.common.pojo.param.scene.SceneAccidentParam"
+            resultType="api.common.pojo.po.scene.SceneAccidentPO">
+        select
+        accident_id,scene_name
+        from simulation.scene_accident
+        <where>
+            is_deleted = '0'
+            <if test="sceneName != null and sceneName != ''">
+                and scene_name =#{sceneName,jdbcType=VARCHAR}
+            </if>
+        </where>
+    </select>
 </mapper>

+ 75 - 38
simulation-resource-server/src/main/resources/mapper/scene/SceneNaturalMapper.xml

@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8" ?>
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
-<mapper namespace="com.css.simulation.resource.scene.mapper.SceneNaturalMapper" >
+<mapper namespace="com.css.simulation.resource.scene.mapper.SceneNaturalMapper">
 
     <insert id="saveSceneNatural" parameterType="api.common.pojo.po.scene.SceneNaturalPO">
         insert into simulation.scene_natural
@@ -33,7 +33,8 @@
     </insert>
 
 
-    <select id="querySceneNaturalList" parameterType="api.common.pojo.param.scene.SceneNaturalParam" resultType="api.common.pojo.po.scene.SceneNaturalPO">
+    <select id="querySceneNaturalList" parameterType="api.common.pojo.param.scene.SceneNaturalParam"
+            resultType="api.common.pojo.po.scene.SceneNaturalPO">
         select
         natural_id,natural_name,weather,backlight,light_change,road_type,
         road_matrrial,driveway_num,driveway_type,road_flatness,road_curvature,
@@ -52,252 +53,288 @@
                 and natural_name like CONCAT('%',#{naturalName,jdbcType=VARCHAR},'%')
             </if>
             <if test="weather != null and weather != ''">
-                and   weather  in
+                and weather in
                 <foreach collection="weather" item="item" index="index"
                          separator="," open="(" close=")">
                     #{item}
                 </foreach>
             </if>
             <if test="backlight != null and backlight != ''">
-                and   backlight  in
+                and backlight in
                 <foreach collection="backlight" item="item" index="index"
                          separator="," open="(" close=")">
                     #{item}
                 </foreach>
             </if>
             <if test="lightChange != null and lightChange != ''">
-                and   light_change  in
+                and light_change in
                 <foreach collection="lightChange" item="item" index="index"
                          separator="," open="(" close=")">
                     #{item}
                 </foreach>
             </if>
             <if test="roadType != null and roadType != ''">
-                and   road_type  in
+                and road_type in
                 <foreach collection="roadType" item="item" index="index"
                          separator="," open="(" close=")">
                     #{item}
                 </foreach>
             </if>
             <if test="roadMatrrial != null and roadMatrrial != ''">
-                and   road_matrrial  in
+                and road_matrrial in
                 <foreach collection="roadMatrrial" item="item" index="index"
                          separator="," open="(" close=")">
                     #{item}
                 </foreach>
             </if>
             <if test="drivewayNum != null and drivewayNum != ''">
-                and   driveway_num  in
+                and driveway_num in
                 <foreach collection="drivewayNum" item="item" index="index"
                          separator="," open="(" close=")">
                     #{item}
                 </foreach>
             </if>
             <if test="drivewayType != null and drivewayType != ''">
-                and   driveway_type  in
+                and driveway_type in
                 <foreach collection="drivewayType" item="item" index="index"
                          separator="," open="(" close=")">
                     #{item}
                 </foreach>
             </if>
             <if test="roadFlatness != null and roadFlatness != ''">
-                and   road_flatness  in
+                and road_flatness in
                 <foreach collection="roadFlatness" item="item" index="index"
                          separator="," open="(" close=")">
                     #{item}
                 </foreach>
             </if>
             <if test="roadCurvature != null and roadCurvature != ''">
-                and   road_curvature  in
+                and road_curvature in
                 <foreach collection="roadCurvature" item="item" index="index"
                          separator="," open="(" close=")">
                     #{item}
                 </foreach>
             </if>
             <if test="ramp != null and ramp != ''">
-                and   ramp  in
+                and ramp in
                 <foreach collection="ramp" item="item" index="index"
                          separator="," open="(" close=")">
                     #{item}
                 </foreach>
             </if>
             <if test="intersectionType != null and intersectionType != ''">
-                and   intersection_type  in
+                and intersection_type in
                 <foreach collection="intersectionType" item="item" index="index"
                          separator="," open="(" close=")">
                     #{item}
                 </foreach>
             </if>
             <if test="planeIntersection != null and planeIntersection != ''">
-                and   plane_intersection  in
+                and plane_intersection in
                 <foreach collection="planeIntersection" item="item" index="index"
                          separator="," open="(" close=")">
                     #{item}
                 </foreach>
             </if>
             <if test="bridge != null and bridge != ''">
-                and   bridge  in
+                and bridge in
                 <foreach collection="bridge" item="item" index="index"
                          separator="," open="(" close=")">
                     #{item}
                 </foreach>
             </if>
             <if test="tunnel != null and tunnel != ''">
-                and   tunnel  in
+                and tunnel in
                 <foreach collection="tunnel" item="item" index="index"
                          separator="," open="(" close=")">
                     #{item}
                 </foreach>
             </if>
             <if test="speedLimit != null and speedLimit != ''">
-                and   speed_limit  in
+                and speed_limit in
                 <foreach collection="speedLimit" item="item" index="index"
                          separator="," open="(" close=")">
                     #{item}
                 </foreach>
             </if>
             <if test="minSpeedLimit != null and minSpeedLimit != ''">
-                and   min_speed_limit  in
+                and min_speed_limit in
                 <foreach collection="minSpeedLimit" item="item" index="index"
                          separator="," open="(" close=")">
                     #{item}
                 </foreach>
             </if>
             <if test="noEntry != null and noEntry != ''">
-                and   no_entry  in
+                and no_entry in
                 <foreach collection="noEntry" item="item" index="index"
                          separator="," open="(" close=")">
                     #{item}
                 </foreach>
             </if>
             <if test="noStopping != null and noStopping != ''">
-                and   no_stopping  in
+                and no_stopping in
                 <foreach collection="noStopping" item="item" index="index"
                          separator="," open="(" close=")">
                     #{item}
                 </foreach>
             </if>
             <if test="leftLaneLine != null and leftLaneLine != ''">
-                and   left_lane_line  in
+                and left_lane_line in
                 <foreach collection="leftLaneLine" item="item" index="index"
                          separator="," open="(" close=")">
                     #{item}
                 </foreach>
             </if>
             <if test="rightLaneLine != null and rightLaneLine != ''">
-                and   right_lane_line  in
+                and right_lane_line in
                 <foreach collection="rightLaneLine" item="item" index="index"
                          separator="," open="(" close=")">
                     #{item}
                 </foreach>
             </if>
             <if test="conductorMarking != null and conductorMarking != ''">
-                and   conductor_marking  in
+                and conductor_marking in
                 <foreach collection="conductorMarking" item="item" index="index"
                          separator="," open="(" close=")">
                     #{item}
                 </foreach>
             </if>
             <if test="pedestrianCrossing != null and pedestrianCrossing != ''">
-                and   pedestrian_crossing  in
+                and pedestrian_crossing in
                 <foreach collection="pedestrianCrossing" item="item" index="index"
                          separator="," open="(" close=")">
                     #{item}
                 </foreach>
             </if>
             <if test="trafficLight != null and trafficLight != ''">
-                and   traffic_light  in
+                and traffic_light in
                 <foreach collection="trafficLight" item="item" index="index"
                          separator="," open="(" close=")">
                     #{item}
                 </foreach>
             </if>
             <if test="decelerationMarking != null and decelerationMarking != ''">
-                and   deceleration_marking  in
+                and deceleration_marking in
                 <foreach collection="decelerationMarking" item="item" index="index"
                          separator="," open="(" close=")">
                     #{item}
                 </foreach>
             </if>
             <if test="pavementCondition != null and pavementCondition != ''">
-                and   pavement_condition  in
+                and pavement_condition in
                 <foreach collection="pavementCondition" item="item" index="index"
                          separator="," open="(" close=")">
                     #{item}
                 </foreach>
             </if>
             <if test="naturalDisaster != null and naturalDisaster != ''">
-                and   natural_disaster  in
+                and natural_disaster in
                 <foreach collection="naturalDisaster" item="item" index="index"
                          separator="," open="(" close=")">
                     #{item}
                 </foreach>
             </if>
             <if test="roadSafetySigns != null and roadSafetySigns != ''">
-                and   road_safety_signs  in
+                and road_safety_signs in
                 <foreach collection="roadSafetySigns" item="item" index="index"
                          separator="," open="(" close=")">
                     #{item}
                 </foreach>
             </if>
             <if test="safetyWarningBoard != null and safetyWarningBoard != ''">
-                and   safety_warning_board  in
+                and safety_warning_board in
                 <foreach collection="safetyWarningBoard" item="item" index="index"
                          separator="," open="(" close=")">
                     #{item}
                 </foreach>
             </if>
             <if test="trafficAccident != null and trafficAccident != ''">
-                and   traffic_accident  in
+                and traffic_accident in
                 <foreach collection="trafficAccident" item="item" index="index"
                          separator="," open="(" close=")">
                     #{item}
                 </foreach>
             </if>
             <if test="patency != null and patency != ''">
-                and   patency  in
+                and patency in
                 <foreach collection="patency" item="item" index="index"
                          separator="," open="(" close=")">
                     #{item}
                 </foreach>
             </if>
             <if test="specialVehicleYield != null and specialVehicleYield != ''">
-                and   special_vehicle_yield  in
+                and special_vehicle_yield in
                 <foreach collection="specialVehicleYield" item="item" index="index"
                          separator="," open="(" close=")">
                     #{item}
                 </foreach>
             </if>
             <if test="violation != null and violation != ''">
-                and   violation  in
+                and violation in
                 <foreach collection="violation" item="item" index="index"
                          separator="," open="(" close=")">
                     #{item}
                 </foreach>
             </if>
             <if test="doubleFlashingCar != null and doubleFlashingCar != ''">
-                and   double_flashing_car  in
+                and double_flashing_car in
                 <foreach collection="doubleFlashingCar" item="item" index="index"
                          separator="," open="(" close=")">
                     #{item}
                 </foreach>
             </if>
             <if test="selfBehavior != null and selfBehavior != ''">
-                and   self_behavior  in
+                and self_behavior in
                 <foreach collection="selfBehavior" item="item" index="index"
                          separator="," open="(" close=")">
                     #{item}
                 </foreach>
             </if>
             <if test="targetBehavior != null and targetBehavior != ''">
-                and   target_behavior  in
+                and target_behavior in
                 <foreach collection="targetBehavior" item="item" index="index"
                          separator="," open="(" close=")">
                     #{item}
                 </foreach>
             </if>
-            order by create_time desc
+            <if test="ids != null and ids.length>0">
+                and natural_id in
+                <foreach collection="ids" item="item" index="index"
+                         separator="," open="(" close=")">
+                    #{item}
+                </foreach>
+            </if>
+            order by modify_time desc
         </where>
     </select>
 
+    <update id="deleteSceneNatural" parameterType="api.common.pojo.po.scene.SceneNaturalPO">
+        update simulation.scene_natural
+        <set>
+            <if test="isDeleted != null and isDeleted!=''">
+                is_deleted = #{isDeleted,jdbcType=VARCHAR},
+            </if>
+            <if test="modifyUserId != null and modifyUserId!=''">
+                modify_user_id = #{modifyUserId,jdbcType=VARCHAR},
+            </if>
+            <if test="modifyTime != null">
+                modify_time = #{modifyTime},
+            </if>
+        </set>
+        where natural_id = #{naturalId,jdbcType=VARCHAR}
+    </update>
+
+
+    <select id="querySceneNaturaByName" parameterType="api.common.pojo.param.scene.SceneNaturalParam"
+            resultType="api.common.pojo.po.scene.SceneNaturalPO">
+        select
+        natural_id,natural_name
+        from simulation.scene_natural
+        <where>
+            is_deleted = '0'
+            <if test="naturalName != null and naturalName != ''">
+                and natural_name =#{naturalName,jdbcType=VARCHAR}
+            </if>
+        </where>
+    </select>
 </mapper>

+ 23 - 16
simulation-resource-server/src/main/resources/mapper/scene/ScenePackageMapper.xml

@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8" ?>
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
-<mapper namespace="com.css.simulation.resource.scene.mapper.ScenePackageMapper" >
+<mapper namespace="com.css.simulation.resource.scene.mapper.ScenePackageMapper">
 
 
     <insert id="saveScenePackage" parameterType="api.common.pojo.po.scene.ScenePackagePO">
@@ -16,7 +16,8 @@
     </insert>
 
 
-    <select id="queryScenePackageList" parameterType="api.common.pojo.param.scene.ScenePackageParam" resultType="api.common.pojo.po.scene.ScenePackagePO">
+    <select id="queryScenePackageList" parameterType="api.common.pojo.param.scene.ScenePackageParam"
+            resultType="api.common.pojo.po.scene.ScenePackagePO">
         select
         a.package_id,a.package_name,a.weight,a.package_code,
         a.package_and_rules,a.scene_num,a.remarks,
@@ -26,13 +27,13 @@
         <where>
             a.is_deleted = '0'
             <if test="packageId != null and packageId != ''">
-                and a.package_id  = #{packageId,jdbcType=VARCHAR}
+                and a.package_id = #{packageId,jdbcType=VARCHAR}
             </if>
             <if test="packageCode != null and packageCode != ''">
-                and a.package_code  = #{packageCode,jdbcType=VARCHAR}
+                and a.package_code = #{packageCode,jdbcType=VARCHAR}
             </if>
             <if test="share != null and share != ''">
-                and a.share  = #{share,jdbcType=VARCHAR}
+                and a.share = #{share,jdbcType=VARCHAR}
             </if>
             <if test="packageName != null and packageName != ''">
                 and a.package_name like CONCAT('%',#{packageName,jdbcType=VARCHAR},'%')
@@ -44,12 +45,13 @@
                 and create_user_id=#{createUserId,jdbcType=VARCHAR}
             </if>
 
-            order by a.create_time desc
+            order by a.modify_time desc
         </where>
     </select>
 
 
-    <select id="queryScenePackage" parameterType="api.common.pojo.param.scene.ScenePackageParam" resultType="api.common.pojo.po.scene.ScenePackagePO">
+    <select id="queryScenePackage" parameterType="api.common.pojo.param.scene.ScenePackageParam"
+            resultType="api.common.pojo.po.scene.ScenePackagePO">
         select
         a.package_id,a.package_name,a.package_code,a.weight,
         a.package_and_rules,a.scene_num,a.remarks,
@@ -59,10 +61,10 @@
         <where>
             a.is_deleted = '0'
             <if test="packageId != null and packageId != ''">
-                and a.package_id  = #{packageId,jdbcType=VARCHAR}
+                and a.package_id = #{packageId,jdbcType=VARCHAR}
             </if>
             <if test="packageCode != null and packageCode != ''">
-                and a.package_code  = #{packageCode,jdbcType=VARCHAR}
+                and a.package_code = #{packageCode,jdbcType=VARCHAR}
             </if>
             <if test="packageName != null and packageName != ''">
                 and a.package_name like CONCAT('%',#{packageName,jdbcType=VARCHAR},'%')
@@ -76,11 +78,12 @@
             <if test="share != null and share != ''">
                 and share=#{share,jdbcType=VARCHAR}
             </if>
-            order by a.create_time desc
+            order by a.modify_time desc
         </where>
     </select>
 
-    <select id="queryScenePackageBySublist" parameterType="java.lang.String" resultType="api.common.pojo.vo.scene.ScenePackageNewVO">
+    <select id="queryScenePackageBySublist" parameterType="java.lang.String"
+            resultType="api.common.pojo.vo.scene.ScenePackageNewVO">
         select
         a.package_id ,a.package_name ,a.weight,a.package_code,
         a.scene_num,a.remarks
@@ -88,7 +91,7 @@
         <where>
             a.is_deleted = '0'
             <if test="packageId != null and packageId != ''">
-                and a.package_id  = #{packageId,jdbcType=VARCHAR}
+                and a.package_id = #{packageId,jdbcType=VARCHAR}
             </if>
         </where>
     </select>
@@ -99,7 +102,10 @@
                 is_deleted = #{isDeleted,jdbcType=VARCHAR},
             </if>
             <if test="packageName != null and packageName!=''">
-                package_name = #{share,jdbcType=VARCHAR},
+                package_name = #{packageName,jdbcType=VARCHAR},
+            </if>
+            <if test="share != null and share!=''">
+                share = #{share,jdbcType=VARCHAR},
             </if>
             <if test="weight != null and weight!=''">
                 weight = #{weight,jdbcType=VARCHAR},
@@ -108,7 +114,7 @@
                 scene_num = #{sceneNum},
             </if>
             <if test="remarks != null and remarks!=''">
-                remarks = #{ruleDetails},
+                remarks = #{remarks},
             </if>
 
             <if test="modifyUserId != null and modifyUserId!=''">
@@ -139,14 +145,15 @@
     </update>
 
 
-    <select id="queryByPackageName" parameterType="api.common.pojo.po.scene.ScenePackagePO" resultType="api.common.pojo.vo.scene.ScenePackageNewVO">
+    <select id="queryByPackageName" parameterType="api.common.pojo.po.scene.ScenePackagePO"
+            resultType="api.common.pojo.vo.scene.ScenePackageNewVO">
         select
         package_id,package_name,package_code
         from simulation.scene_package
         <where>
             is_deleted = '0'
             <if test="packageId != null and packageId != ''">
-                and package_id  != #{packageId,jdbcType=VARCHAR}
+                and package_id != #{packageId,jdbcType=VARCHAR}
             </if>
             <if test="packageName != null and packageName != ''">
                 and package_name =#{packageName,jdbcType=VARCHAR}

+ 24 - 21
simulation-resource-server/src/main/resources/mapper/scene/ScenePackageSublistMapper.xml

@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8" ?>
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
-<mapper namespace="com.css.simulation.resource.scene.mapper.ScenePackageSublistMapper" >
+<mapper namespace="com.css.simulation.resource.scene.mapper.ScenePackageSublistMapper">
 
     <insert id="saveScenePackageSublist" parameterType="api.common.pojo.po.scene.ScenePackageSublistPO">
         insert into simulation.scene_package_sublist
@@ -9,7 +9,7 @@
         scene_num,parent_id,root_id,seq,package_level,remarks,
         create_user_id,create_time,modify_user_id,modify_time,
          is_deleted,share)
-        values (#{sublistId,jdbcType=VARCHAR},#{sublistName,jdbcType=VARCHAR},#{weight,jdbcType=VARCHAR},#{ruleName,jdbcType=VARCHAR},
+        values (#{id,jdbcType=VARCHAR},#{sublistName,jdbcType=VARCHAR},#{weight,jdbcType=VARCHAR},#{ruleName,jdbcType=VARCHAR},
         #{packageAndRules,jdbcType=VARCHAR},
         #{sceneNaturalIds}, #{sceneTrafficIds}, #{sceneStatueIds}, #{sceneGeneralizationIds},
         #{sceneNum},#{parentId,jdbcType=VARCHAR},#{rootId,jdbcType=VARCHAR},#{seq},
@@ -21,14 +21,14 @@
 
     <insert id="saveScenePackageSublistAll" parameterType="java.util.List">
 
-            insert into simulation.scene_package_sublist
-            (sublist_id,sublist_name,weight,rule_name,package_and_rules,
-            scene_natural_ids,scene_traffic_ids,scene_statue_ids,scene_generalization_ids,
-            scene_num,parent_id,root_id,seq,package_level,remarks,
-            create_user_id,create_time,modify_user_id,modify_time,
-            is_deleted,share) values
+        insert into simulation.scene_package_sublist
+        (sublist_id,sublist_name,weight,rule_name,package_and_rules,
+        scene_natural_ids,scene_traffic_ids,scene_statue_ids,scene_generalization_ids,
+        scene_num,parent_id,root_id,seq,package_level,remarks,
+        create_user_id,create_time,modify_user_id,modify_time,
+        is_deleted,share) values
         <foreach collection="list" index="index" item="item" separator=",">
-              (#{item.sublistId,jdbcType=VARCHAR},#{item.sublistName,jdbcType=VARCHAR},#{item.weight,jdbcType=VARCHAR},#{item.ruleName,jdbcType=VARCHAR},
+            (#{item.id,jdbcType=VARCHAR},#{item.sublistName,jdbcType=VARCHAR},#{item.weight,jdbcType=VARCHAR},#{item.ruleName,jdbcType=VARCHAR},
             #{item.packageAndRules,jdbcType=VARCHAR},
             #{item.sceneNaturalIds}, #{item.sceneTrafficIds}, #{item.sceneStatueIds}, #{item.sceneGeneralizationIds},
             #{item.sceneNum},#{item.parentId,jdbcType=VARCHAR},#{item.rootId,jdbcType=VARCHAR},#{item.seq},
@@ -38,19 +38,21 @@
         </foreach>
     </insert>
 
-    <select id="queryScenePackageSublistList" parameterType="api.common.pojo.po.scene.ScenePackageSublistPO" resultType="api.common.pojo.vo.scene.ScenePackageSublistVO">
+    <select id="queryScenePackageSublistList" parameterType="api.common.pojo.po.scene.ScenePackageSublistPO"
+            resultType="api.common.pojo.vo.scene.ScenePackageSublistVO">
         select
-        a.sublist_id,a.sublist_name,a.weight,b.rule_name,
+        a.sublist_id id,a.sublist_name,a.weight,b.rule_name,
         a.scene_num,a.parent_id,a.root_id,a.package_level,a.remarks,a.seq,a.package_and_rules,
         a.scene_natural_ids,a.scene_traffic_ids,a.scene_statue_ids,a.scene_generalization_ids
-        from simulation.scene_package_sublist as a  left join simulation.scoring_rules as b on a.package_and_rules=b.rules_id
+        from simulation.scene_package_sublist as a left join simulation.scoring_rules as b on
+        a.package_and_rules=b.rules_id
         <where>
             a.is_deleted = '0'
-            <if test="sublistId != null and sublistId != ''">
-                and a.sublist_id  = #{sublistId,jdbcType=VARCHAR}
+            <if test="id != null and id != ''">
+                and a.sublist_id = #{id,jdbcType=VARCHAR}
             </if>
             <if test="sublistName != null and sublistName != ''">
-                and a.sublist_name  = #{sublistName,jdbcType=VARCHAR}
+                and a.sublist_name = #{sublistName,jdbcType=VARCHAR}
             </if>
             <if test="createUserId != null and createUserId != ''">
                 and create_user_id=#{createUserId,jdbcType=VARCHAR}
@@ -61,7 +63,7 @@
             <if test="rootId != null and rootId != ''">
                 and a.root_id = #{rootId}
             </if>
-            order by a.seq,a.create_time
+            order by a.modify_time desc,a.seq
         </where>
     </select>
 
@@ -72,16 +74,17 @@
         where root_id = #{rootId,jdbcType=VARCHAR}
     </update>
 
-    <select id="queryBySublistName" parameterType="api.common.pojo.po.scene.ScenePackageSublistPO" resultType="api.common.pojo.vo.scene.ScenePackageNewVO">
-        select sublist_id,sublist_name
+    <select id="queryBySublistName" parameterType="api.common.pojo.po.scene.ScenePackageSublistPO"
+            resultType="api.common.pojo.vo.scene.ScenePackageSublistVO">
+        select sublist_id id,sublist_name
         from simulation.scene_package_sublist
         <where>
             is_deleted = '0'
-            <if test="sublistId != null and sublistId != ''">
-                and a.sublist_id  != #{sublistId,jdbcType=VARCHAR}
+            <if test="id != null and id != ''">
+                and a.sublist_id != #{id,jdbcType=VARCHAR}
             </if>
             <if test="sublistName != null and sublistName != ''">
-                and a.sublist_name  = #{sublistName,jdbcType=VARCHAR}
+                and a.sublist_name = #{sublistName,jdbcType=VARCHAR}
             </if>
             <if test="createUserId != null and createUserId != ''">
                 and create_user_id=#{createUserId,jdbcType=VARCHAR}

+ 14 - 11
simulation-resource-server/src/main/resources/mapper/scene/ScoringRulesMapper.xml

@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8" ?>
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
-<mapper namespace="com.css.simulation.resource.scene.mapper.ScoringRulesMapper" >
+<mapper namespace="com.css.simulation.resource.scene.mapper.ScoringRulesMapper">
 
     <insert id="saveScoringRules" parameterType="api.common.pojo.po.scene.ScoringRulesPO">
         insert into simulation.scoring_rules
@@ -13,7 +13,8 @@
     </insert>
 
 
-    <select id="queryScoringRulesList" parameterType="api.common.pojo.param.scene.ScoringRulesParam" resultType="api.common.pojo.po.scene.ScoringRulesPO">
+    <select id="queryScoringRulesList" parameterType="api.common.pojo.param.scene.ScoringRulesParam"
+            resultType="api.common.pojo.po.scene.ScoringRulesPO">
         select
         rules_id,rules_code,rule_name,rule_description,rule_details,
         create_user_id,create_time,modify_user_id,modify_time,
@@ -22,19 +23,19 @@
         <where>
             is_deleted = '0'
             <if test="rulesId != null and rulesId != ''">
-                and rules_id  = #{rulesId,jdbcType=VARCHAR}
+                and rules_id = #{rulesId,jdbcType=VARCHAR}
             </if>
             <if test="rulesCode != null and rulesCode != ''">
-                and rules_code  = #{rulesCode,jdbcType=VARCHAR}
+                and rules_code = #{rulesCode,jdbcType=VARCHAR}
             </if>
             <if test="share != null and share!=''">
-               and share = #{share,jdbcType=VARCHAR}
+                and share = #{share,jdbcType=VARCHAR}
             </if>
             <if test="ruleName != null and ruleName != ''">
                 and rule_name like CONCAT('%',#{ruleName,jdbcType=VARCHAR},'%')
             </if>
             <if test="ruleDescription != null and ruleDescription != ''">
-                and rule_description like  CONCAT('%',#{ruleDescription},'%')
+                and rule_description like CONCAT('%',#{ruleDescription},'%')
             </if>
             <if test="yearMax != null and yearMax != ''">
                 and #{yearMax,jdbcType=VARCHAR} &gt; create_time and #{yearMin,jdbcType=VARCHAR} &lt; create_time
@@ -43,10 +44,11 @@
                 and create_user_id=#{createUserId,jdbcType=VARCHAR}
             </if>
 
-            order by create_time desc
+            order by modify_time desc
         </where>
     </select>
-    <select id="queryScoringRules" parameterType="api.common.pojo.param.scene.ScoringRulesParam" resultType="api.common.pojo.po.scene.ScoringRulesPO">
+    <select id="queryScoringRules" parameterType="api.common.pojo.param.scene.ScoringRulesParam"
+            resultType="api.common.pojo.po.scene.ScoringRulesPO">
         select
         rules_id,rule_name,rule_description,rule_details,
         create_user_id,create_time,modify_user_id,modify_time,
@@ -55,7 +57,7 @@
         <where>
             is_deleted = '0'
             <if test="rulesId != null and rulesId != ''">
-                and rules_id  = #{rulesId,jdbcType=VARCHAR}
+                and rules_id = #{rulesId,jdbcType=VARCHAR}
             </if>
             <if test="ruleName != null and ruleName != ''">
                 and rule_name like CONCAT('%',#{ruleName,jdbcType=VARCHAR},'%')
@@ -63,8 +65,9 @@
         </where>
     </select>
 
-    <select id="queryScoringRulesByRuleName" parameterType="api.common.pojo.param.scene.ScoringRulesParam" resultType="api.common.pojo.po.scene.ScoringRulesPO">
-        select   rules_id,rule_name
+    <select id="queryScoringRulesByRuleName" parameterType="api.common.pojo.param.scene.ScoringRulesParam"
+            resultType="api.common.pojo.po.scene.ScoringRulesPO">
+        select rules_id,rule_name
         from simulation.scoring_rules
         <where>
             is_deleted = '0'

+ 44 - 8
simulation-resource-server/src/main/resources/mapper/scene/StandardsRegulationsMapper.xml

@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8" ?>
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
-<mapper namespace="com.css.simulation.resource.scene.mapper.StandardsRegulationsMapper" >
+<mapper namespace="com.css.simulation.resource.scene.mapper.StandardsRegulationsMapper">
 
 
     <insert id="saveStandardsRegulations" parameterType="api.common.pojo.po.scene.StandardsRegulationsPO">
@@ -17,7 +17,8 @@
     </insert>
 
 
-    <select id="queryStandardsRegulationsList" parameterType="api.common.pojo.param.scene.StandardsRegulationsParam" resultType="api.common.pojo.po.scene.StandardsRegulationsPO">
+    <select id="queryStandardsRegulationsList" parameterType="api.common.pojo.param.scene.StandardsRegulationsParam"
+            resultType="api.common.pojo.po.scene.StandardsRegulationsPO">
         select
         regulations_id,scene_name,regulation_type,standard_type,
         create_user_id,create_time,modify_user_id,
@@ -31,17 +32,52 @@
             </if>
 
             <if test="regulationType != null and regulationType.length != 0">
-            and  regulation_type  in
-            <foreach collection="regulationType" item="item" index="index"
-                     separator="," open="(" close=")">
-                #{item}
-            </foreach>
+                and regulation_type in
+                <foreach collection="regulationType" item="item" index="index"
+                         separator="," open="(" close=")">
+                    #{item}
+                </foreach>
             </if>
             <if test="standardType != null and standardType != ''">
                 and standard_type like CONCAT('%',#{standardType,jdbcType=VARCHAR},'%')
             </if>
-            order by create_time desc
+            <if test="ids != null and ids.length>0">
+                and regulations_id in
+                <foreach collection="ids" item="item" index="index"
+                         separator="," open="(" close=")">
+                    #{item}
+                </foreach>
+            </if>
+            order by modify_time desc
         </where>
     </select>
 
+    <update id="deleteStandardsRegulations" parameterType="api.common.pojo.po.scene.StandardsRegulationsPO">
+        update simulation.scene_standards_regulations
+        <set>
+            <if test="isDeleted != null and isDeleted!=''">
+                is_deleted = #{isDeleted,jdbcType=VARCHAR},
+            </if>
+            <if test="modifyUserId != null and modifyUserId!=''">
+                modify_user_id = #{modifyUserId,jdbcType=VARCHAR},
+            </if>
+            <if test="modifyTime != null">
+                modify_time = #{modifyTime},
+            </if>
+        </set>
+        where regulations_id = #{regulationsId,jdbcType=VARCHAR}
+    </update>
+
+    <select id="queryStandardsRegulationsByName" parameterType="api.common.pojo.param.scene.StandardsRegulationsParam"
+            resultType="api.common.pojo.po.scene.StandardsRegulationsPO">
+        select
+        regulations_id,scene_name
+        from simulation.scene_standards_regulations
+        <where>
+            is_deleted = '0'
+            <if test="sceneName != null and sceneName != ''">
+                and scene_name =#{sceneName,jdbcType=VARCHAR}
+            </if>
+        </where>
+    </select>
 </mapper>

+ 21 - 0
simulation-resource-server/src/main/resources/mapper/system/MenuMapper.xml

@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
+<mapper namespace="com.css.simulation.resource.system.mapper.MenuMapper" >
+
+
+    <select id="getMenus" parameterType="java.lang.String" resultType="api.common.pojo.vo.system.MenuVO">
+        select
+            m.id,
+            m.name,
+            m.router,
+            m.sort,
+            m.parent_id,
+            m.visible
+        FROM system_user_role ur
+		INNER JOIN system_role r ON r.id = ur.role_id AND r.visible='1' AND r.is_deleted='0'
+        INNER JOIN system_role_menu rm ON rm.role_id = ur.role_id AND rm.is_deleted='0'
+        INNER JOIN system_menu m ON m.id=rm.menu_id AND m.visible='1' AND m.is_deleted='0'
+        WHERE ur.user_id = #{userId,jdbcType=VARCHAR}
+        ORDER BY m.sort
+    </select>
+</mapper>