root 2 yıl önce
ebeveyn
işleme
b4e0a2969d

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

@@ -16,6 +16,7 @@ import java.util.List;
 @AllArgsConstructor
 public class SceneAccidentParam extends PageVO implements Serializable {
 
+    private List<String> sceneNameList;   // 用于批量删除的名称列表
     private String accidentId;              // (唯一)
     private String sceneName;  //场景名称
     private List<String> selfDriving;  //自车驾驶行为

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

@@ -9,32 +9,32 @@ import java.util.List;
 /**
  * 自然驾驶场景
  */
-@EqualsAndHashCode()
+@EqualsAndHashCode(callSuper = false)
 @Data
 @Builder
 @NoArgsConstructor
 @AllArgsConstructor
 public class SceneNaturalNewParam extends PageVO implements Serializable {
 
-    private String naturalName;              // 场景编号
-    private String[][] naturalEnvironment ; //自然环境
-    private String[][] road ; //道路
-    private String[][] infrastructure ; //基础设施
-    private String[][] temporaryOperation ; //临时性操作
-    private String[][] trafficCondition ; //交通状况
-    private String[][] selfBehavior  ;//自车行为
-    private String[][] targetBehavior ; //目标行为
-    private String[] ids ; //回显数组
+    private List<String> naturalNameList;        // 用于批量删除的名称列表
+    private String naturalName;             // 场景编号
+    private String[][] naturalEnvironment;  // 自然环境
+    private String[][] road;                // 道路
+    private String[][] infrastructure;      // 基础设施
+    private String[][] temporaryOperation;  // 临时性操作
+    private String[][] trafficCondition;    // 交通状况
+    private String[][] selfBehavior;        // 自车行为
+    private String[][] targetBehavior;      // 目标行为
+    private String[] ids;                   // 回显数组
+    private String[][] highSpeed;           // 高速
+    private String[][] ramp;                // 匝道
+    private String[][] tunnel;              // 隧道
+    private String[][] cutIn;               //切入
+    private String[][] cutOut;              //切出
+    private String[][] laneChange;          //变道
+    private String[][] turnAround;          //掉头
 
-    private String[][] highSpeed ;//高速
-    private String[][] ramp;//匝道
-    private String[][] tunnel;//隧道
-    private String[][] cutIn;//切入
-    private String[][] cutOut;//切出
-    private String[][] laneChange;//变道
-    private String[][] turnAround;//掉头
-
-    private String[] allSceneNames ; //场景名集合
-    private String userId;//用户id
+    private String[] allSceneNames;         //场景名集合
+    private String userId;                  //用户id
     private String share;
 }

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

@@ -16,26 +16,27 @@ import java.util.List;
 @AllArgsConstructor
 public class StandardsRegulationsParam extends PageVO implements Serializable {
 
+    private List<String> sceneNameList;   // 用于批量删除的名称列表
     private String regulationsId;              // (唯一)
     private String sceneName;  //场景名称
     private List<String> regulationType;  //法规类型
     private String standardType;  //标准类型
-    private String share ; //是否分析  1为分享
+    private String share; //是否分析  1为分享
 
-    private String videoAddress ; //视频地址
-    private String osgbAddress  ;//
-    private String xmlAddress ; //
-    private String xodrAddress ; //
-    private String jsonAddress ; //
+    private String videoAddress; //视频地址
+    private String osgbAddress;//
+    private String xmlAddress; //
+    private String xodrAddress; //
+    private String jsonAddress; //
     private String videoPreview;//视频预览地址
-    private String[] ids ; //回显数组
+    private String[] ids; //回显数组
     private List<String> label;  //法规类型
-    private List<String> AllIds ; //权限集合
+    private List<String> AllIds; //权限集合
 
-    private String  xlk="0";//判断下拉框是否为空 0为空  1为有值
-    private String  bq="0";//判断标签是否为空 0为空  1为有值
+    private String xlk = "0";//判断下拉框是否为空 0为空  1为有值
+    private String bq = "0";//判断标签是否为空 0为空  1为有值
 
     private String userId;
 
-    private String[] allSceneNames ; //场景名集合
+    private String[] allSceneNames; //场景名集合
 }

+ 34 - 33
simulation-resource-server/src/main/java/com/css/simulation/resource/log/service/LogService.java

@@ -76,16 +76,16 @@ public class LogService {
         PageUtil.setPageInfo(pageParam);
         List<LogOperationPO> list = new ArrayList<>();
         String roleCode = AuthUtil.getCurrentUserRoleCode();
-        if(DictConstants.ROLE_CODE_UESR.equals(roleCode)){//普通用户
+        if (DictConstants.ROLE_CODE_UESR.equals(roleCode)) {//普通用户
             String currentUserId = AuthUtil.getCurrentUserId();
             pageParam.setContent(currentUserId);//借用该字段传递当前用户id
             list = logMapper.getUserOperationLogPageList(pageParam);
-        }else{//管理员
+        } else {//管理员
             list = logMapper.getOperationLogPageList(pageParam);
         }
         //字典翻译
         Map<String, Map<String, String>> dictMaps = dictService.getDictMapsByTypes(LogConstants.MODULE_TYPE + "," + LogConstants.OPERATION_TYPE);
-        list.forEach(po ->{
+        list.forEach(po -> {
             po.setModule(dictMaps.get(LogConstants.MODULE_TYPE).get(po.getModule()));
             po.setOperationType(dictMaps.get(LogConstants.OPERATION_TYPE).get(po.getOperationType()));
         });
@@ -100,7 +100,7 @@ public class LogService {
         List<LogSystemPO> list = logMapper.getSystemLogPageList(pageParam);
         //字典翻译
         Map<String, Map<String, String>> dictMaps = dictService.getDictMapsByTypes(LogConstants.SYS_LOG_TYPE + "," + DictConstants.ROLE_CODE);
-        list.forEach(po ->{
+        list.forEach(po -> {
             po.setModule(dictMaps.get(LogConstants.SYS_LOG_TYPE).get(po.getModule()));
             po.setOperationType(dictMaps.get(LogConstants.SYS_LOG_TYPE).get(po.getOperationType()));
             po.setRoleCode(dictMaps.get(DictConstants.ROLE_CODE).get(po.getRoleCode()));
@@ -116,14 +116,14 @@ public class LogService {
             LogSystemPO po = getLogSystemPO(LogConstants.SYS_LOG_USER, operationType);
             String userId = userPO.getId();
             String username = userPO.getUsername();
-            if(ObjectUtil.isNull(username)){
+            if (ObjectUtil.isNull(username)) {
                 UserVO userVO = userMapper.getUserInfo(userId);
                 username = userVO.getUsername();
             }
             String content = username + " ( ID: " + userId + " )";
             po.setContent(content);
             logMapper.insertSystemLog(po);
-        }catch (Exception e){
+        } catch (Exception e) {
             e.printStackTrace();
         }
     }
@@ -136,7 +136,7 @@ public class LogService {
             LogSystemPO po = getLogSystemPO(LogConstants.SYS_LOG_VEHICLE, operationType);
             String vehicleTempId = vehicleTempPO.getId();
             String modelLabel = vehicleTempPO.getModelLabel();
-            if(ObjectUtil.isNull(modelLabel)){
+            if (ObjectUtil.isNull(modelLabel)) {
                 VehiclePageParam param = new VehiclePageParam();
                 param.setId(vehicleTempId);
                 VehicleTempVO vehicleTempInfo = vehicleTempMapper.getVehicleTempInfo(param);
@@ -145,7 +145,7 @@ public class LogService {
             String content = modelLabel + " ( ID: " + vehicleTempId + " )";
             po.setContent(content);
             logMapper.insertSystemLog(po);
-        }catch (Exception e){
+        } catch (Exception e) {
             e.printStackTrace();
         }
     }
@@ -159,10 +159,10 @@ public class LogService {
             String paramId = parameterPO.getId();
             String userId = parameterPO.getUserId();
             String userName = parameterPO.getUserName();
-            String content = "账户:" + userName +  " ( ID: " + userId + " ); 参数配置" +  " ( ID: " + paramId + " )";
+            String content = "账户:" + userName + " ( ID: " + userId + " ); 参数配置" + " ( ID: " + paramId + " )";
             po.setContent(content);
             logMapper.insertSystemLog(po);
-        }catch (Exception e){
+        } catch (Exception e) {
             e.printStackTrace();
         }
     }
@@ -176,10 +176,10 @@ public class LogService {
             String clusterId = clusterPO.getId();
             String userId = clusterPO.getUserId();
             String userName = clusterPO.getUserName();
-            String content = "账户:" + userName +  " ( ID: " + userId + " ); 节点配置" +  " ( ID: " + clusterId + " )";
+            String content = "账户:" + userName + " ( ID: " + userId + " ); 节点配置" + " ( ID: " + clusterId + " )";
             po.setContent(content);
             logMapper.insertSystemLog(po);
-        }catch (Exception e){
+        } catch (Exception e) {
             e.printStackTrace();
         }
     }
@@ -202,50 +202,51 @@ public class LogService {
     /**
      * 记录场景包模块日志
      */
-    public void logScenePackage(String operationType, SystemScenePackagePO packagePO,SystemUserSceneParam params) {
+    public void logScenePackage(String operationType, SystemScenePackagePO packagePO, SystemUserSceneParam params) {
         try {
             LogSystemPO po = getLogSystemPO(LogConstants.SYS_LOG_PACKAGE, operationType);
             //获取当前登录人姓名
-            String content=null;
-            if(operationType.equals(LogConstants.SYS_LOG_PACKAGE_DELETE)){
-                content = "删除场景包:"+packagePO.getPackageName()+"(ID:"+packagePO.getId()+")";
-            }else if(operationType.equals(LogConstants.SYS_LOG_PACKAGE_UPDATE)){
-                content = "编辑场景包:"+packagePO.getPackageName()+"(ID:"+packagePO.getId()+")";
-            }else if(operationType.equals(LogConstants.SYS_LOG_PACKAGE_INSERT)){
-                content = "创建场景包:"+packagePO.getPackageName()+"(ID:"+packagePO.getId()+")";
-            }else if(operationType.equals(LogConstants.SYS_LOG_PACKAGE_DISTRIBUTION)){
+            String content = null;
+            if (operationType.equals(LogConstants.SYS_LOG_PACKAGE_DELETE)) {
+                content = "删除场景包:" + packagePO.getPackageName() + "(ID:" + packagePO.getId() + ")";
+            } else if (operationType.equals(LogConstants.SYS_LOG_PACKAGE_UPDATE)) {
+                content = "编辑场景包:" + packagePO.getPackageName() + "(ID:" + packagePO.getId() + ")";
+            } else if (operationType.equals(LogConstants.SYS_LOG_PACKAGE_INSERT)) {
+                content = "创建场景包:" + packagePO.getPackageName() + "(ID:" + packagePO.getId() + ")";
+            } else if (operationType.equals(LogConstants.SYS_LOG_PACKAGE_DISTRIBUTION)) {
                 List<UserSceneVO> users = params.getUserIds();
                 StringBuffer sb = new StringBuffer();
                 for (UserSceneVO vo : users) {
                     sb.append("、").append(vo.getUserName()).append("((ID:").append(vo.getUserId()).append(")");
                 }
                 sb.deleteCharAt(0);
-                content = "分配场景包:"+params.getPackageName()+"(ID:"+params.getPackageId()+")给用户:"+sb.toString();
-            }else if(operationType.equals(LogConstants.SYS_LOG_PACKAGE_DISTRIBUTION_DELETE)){
-                List<UserSceneVO> users= params.getUserIds();
+                content = "分配场景包:" + params.getPackageName() + "(ID:" + params.getPackageId() + ")给用户:" + sb.toString();
+            } else if (operationType.equals(LogConstants.SYS_LOG_PACKAGE_DISTRIBUTION_DELETE)) {
+                List<UserSceneVO> users = params.getUserIds();
                 StringBuffer sb = new StringBuffer();
                 for (UserSceneVO vo : users) {
                     sb.append("、").append(vo.getUserName()).append("((ID:").append(vo.getUserId()).append(")");
                 }
                 sb.deleteCharAt(0);
-                content = "分配场景包:"+params.getPackageName()+"(ID:"+params.getPackageId()+")时移除用户:"+sb.toString();
+                content = "分配场景包:" + params.getPackageName() + "(ID:" + params.getPackageId() + ")时移除用户:" + sb.toString();
             }
             po.setContent(content);
             logMapper.insertSystemLog(po);
-        }catch (Exception e){
+        } catch (Exception e) {
             e.printStackTrace();
         }
     }
+
     /**
      * 记录场景包分配模块日志
      */
-    public void logSystemUserSceneByPackageId(String operationType, SystemUserSceneParam param,String packageCount) {
+    public void logSystemUserSceneByPackageId(String operationType, SystemUserSceneParam param, String packageCount) {
         try {
             LogSystemPO po = getLogSystemPO(LogConstants.SYS_LOG_PACKAGE_GRANT, operationType);
-            String content = param.getUserName()+"(ID"+param.getUserId()+")"+"分配场景包:"+packageCount;
+            String content = param.getUserName() + "(ID" + param.getUserId() + ")" + "分配场景包:" + packageCount;
             po.setContent(content);
             logMapper.insertSystemLog(po);
-        }catch (Exception e){
+        } catch (Exception e) {
             e.printStackTrace();
         }
     }
@@ -256,11 +257,11 @@ public class LogService {
     public void logSceneDelete(String operationType, Map map) {
         try {
             LogSystemPO po = getLogSystemPO(LogConstants.SYS_LOG_SCENE, operationType);
-            Map<String,String>  mapType= dictService.getDictMapByType(DictConstants.SCENE_TYPE);
-            String content = "删除"+mapType.get(map.get("type"))+":"+map.get("sceneName")+"(ID:"+map.get("sceneId")+")" ;
+            Map<String, String> mapType = dictService.getDictMapByType(DictConstants.SCENE_TYPE);
+            String content = "删除" + mapType.get(map.get("type")) + ":" + map.get("sceneName");
             po.setContent(content);
             logMapper.insertSystemLog(po);
-        }catch (Exception e){
+        } catch (Exception e) {
             e.printStackTrace();
         }
     }
@@ -274,7 +275,7 @@ public class LogService {
             //获取当前登录人姓名
             po.setContent(content);
             logMapper.insertSystemLog(po);
-        }catch (Exception e){
+        } catch (Exception e) {
             e.printStackTrace();
         }
     }

+ 13 - 3
simulation-resource-server/src/main/java/com/css/simulation/resource/scene/ctrl/SceneAccidentController.java

@@ -13,7 +13,10 @@ import com.css.simulation.resource.scene.service.SceneAccidentService;
 import com.css.simulation.resource.system.service.SceneImportService;
 import com.github.pagehelper.PageInfo;
 import org.springframework.beans.BeanUtils;
-import org.springframework.web.bind.annotation.*;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
 
 import javax.annotation.Resource;
 import java.util.ArrayList;
@@ -25,10 +28,17 @@ import java.util.List;
 public class SceneAccidentController {
 
     @Resource
-   private  SceneAccidentService sceneAccidentService;
+    private SceneAccidentService sceneAccidentService;
     @Resource
     private SceneImportService sceneImportService;
 
+    @PostMapping("/batchDeleteSceneAccident")
+    public ResponseBodyVO<String> batchDeleteSceneAccident(@RequestBody SceneAccidentParam params) {
+        List<String> sceneNameList = params.getSceneNameList();
+        sceneAccidentService.batchDeleteSceneAccident(sceneNameList);
+        return new ResponseBodyVO<>(ResponseBodyVO.Response.SUCCESS);
+    }
+
     //查询列表
     @PostMapping("/querySceneAccidentList")
     public ResponseBodyVO<PageInfo<SceneAccidentVO>> querySceneAccidentList(@RequestBody SceneAccidentParam params) {
@@ -86,7 +96,7 @@ public class SceneAccidentController {
      */
     @PostMapping("/instShareSceneAccident")
     public ResponseBodyVO<String> instShareSceneAccident(@RequestBody SceneAccidentPO params) {
-         sceneAccidentService.instShareSceneAccident(params);
+        sceneAccidentService.instShareSceneAccident(params);
 
         return new ResponseBodyVO<>(ResponseBodyVO.Response.SUCCESS);
 

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

@@ -29,11 +29,20 @@ import java.util.List;
 public class SceneNaturalController {
 
     @Resource
-    SceneNaturalService sceneNaturalService;
+    private SceneNaturalService sceneNaturalService;
     @Resource
-    SceneImportService sceneImportService;
+    private SceneImportService sceneImportService;
 
-    //查询列表
+    @PostMapping("/batchDeleteSceneNatural")
+    public ResponseBodyVO<String> batchDeleteSceneNatural(@RequestBody SceneNaturalNewParam params) {
+        List<String> naturalNameList = params.getNaturalNameList();
+        sceneNaturalService.batchDeleteSceneNatural(naturalNameList);
+        return new ResponseBodyVO<>(ResponseBodyVO.Response.SUCCESS);
+    }
+
+    /**
+     * 查询自然驾驶数据
+     */
     @PostMapping("/querySceneNaturalList")
     public ResponseBodyVO<PageInfo<SceneNaturalVO>> querySceneNaturalList(@RequestBody SceneNaturalNewParam params) {
         PageUtil.setPageInfo(params);

+ 13 - 3
simulation-resource-server/src/main/java/com/css/simulation/resource/scene/ctrl/StandardsRegulationsController.java

@@ -13,7 +13,10 @@ import com.css.simulation.resource.scene.service.StandardsRegulationsService;
 import com.css.simulation.resource.system.service.SceneImportService;
 import com.github.pagehelper.PageInfo;
 import org.springframework.beans.BeanUtils;
-import org.springframework.web.bind.annotation.*;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
 
 import javax.annotation.Resource;
 import java.util.ArrayList;
@@ -25,9 +28,16 @@ import java.util.List;
 public class StandardsRegulationsController {
 
     @Resource
-    StandardsRegulationsService standardsRegulationsService;
+    private StandardsRegulationsService standardsRegulationsService;
     @Resource
-    SceneImportService sceneImportService;
+    private SceneImportService sceneImportService;
+
+    @PostMapping("/batchDeleteSceneStandards")
+    public ResponseBodyVO<String> batchDeleteSceneStandards(@RequestBody StandardsRegulationsParam params) {
+       List<String> sceneNameList = params.getSceneNameList();
+        standardsRegulationsService.batchDeleteSceneStandards(sceneNameList);
+        return new ResponseBodyVO<>(ResponseBodyVO.Response.SUCCESS);
+    }
 
     //查询列表
     @PostMapping("/queryStandardsRegulationsList")

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

@@ -371,6 +371,15 @@ public class SceneAccidentService {
         return list;
     }
 
+    public void batchDeleteSceneAccident(List<String> sceneNameList) {
+
+        for (String sceneName : sceneNameList) {
+            SceneAccidentPO sceneAccidentPO = new SceneAccidentPO();
+            sceneAccidentPO.setSceneName(sceneName);
+            deleteSceneAccidentList(sceneAccidentPO);
+        }
+    }
+
     public void deleteSceneAccidentList(SceneAccidentPO params) {
         //1 获取参数
         String sceneName = params.getSceneName(); // 场景名称
@@ -815,4 +824,6 @@ public class SceneAccidentService {
         }
 
     }
+
+
 }

+ 10 - 1
simulation-resource-server/src/main/java/com/css/simulation/resource/scene/service/SceneNaturalService.java

@@ -351,6 +351,15 @@ public class SceneNaturalService {
         return list;
     }
 
+
+    public void batchDeleteSceneNatural(List<String> naturalNameList) {
+        for (String naturalName : naturalNameList) {
+            SceneNaturalPO sceneNaturalPO = new SceneNaturalPO();
+            sceneNaturalPO.setNaturalName(naturalName);
+            deleteSceneNatural(sceneNaturalPO);
+        }
+    }
+
     @SneakyThrows
     public void deleteSceneNatural(SceneNaturalPO params) {
         //1 获取参数
@@ -373,7 +382,6 @@ public class SceneNaturalService {
         sceneNaturalMapper.deleteByName(sceneName, AuthUtil.getCreateUserId());
         //7 记录日志
         Map<String, String> map = new HashMap<>();
-        map.put("sceneId", params.getNaturalId());
         map.put("sceneName", params.getNaturalName());
         map.put("type", DictConstants.SCENE_NATURAL);
         logService.logSceneDelete(LogConstants.SYS_LOG_SCENE_DELETE, map);
@@ -632,4 +640,5 @@ public class SceneNaturalService {
 
     }
 
+
 }

+ 12 - 2
simulation-resource-server/src/main/java/com/css/simulation/resource/scene/service/StandardsRegulationsService.java

@@ -169,6 +169,14 @@ public class StandardsRegulationsService {
         return list;
     }
 
+    public void batchDeleteSceneStandards(List<String> sceneNameList) {
+        for (String sceneName : sceneNameList) {
+            StandardsRegulationsPO standardsRegulationsPO = new StandardsRegulationsPO();
+            standardsRegulationsPO.setSceneName(sceneName);
+            deleteStandardsRegulations(standardsRegulationsPO);
+        }
+    }
+
     public void deleteStandardsRegulations(StandardsRegulationsPO params) {
         //1 获取参数
         String sceneName = params.getSceneName(); // 场景名称
@@ -189,7 +197,7 @@ public class StandardsRegulationsService {
         //6 删除所有同名场景(包括公有和私有)
         standardsRegulationsMapper.deleteByName(sceneName, AuthUtil.getCreateUserId());
         //7 记录日志
-        Map<String,String> map = new HashMap<>();
+        Map<String, String> map = new HashMap<>();
         map.put("sceneId", params.getRegulationsId());
         map.put("sceneName", params.getSceneName());
         map.put("type", DictConstants.SCENE_STANDARD);
@@ -257,7 +265,7 @@ public class StandardsRegulationsService {
                                     ObjectMapper objMap = new ObjectMapper();
                                     JsonNode root = objMap.readTree(json);
                                     //判断场景名称唯一
-                                   sceneName = root.path("场景名称").asText();
+                                    sceneName = root.path("场景名称").asText();
                                     String regulationType = root.path("法规类型").asText();
                                     String standardType = root.path("标准类型").asText();
                                     String osgb = root.path("osgb").asText();
@@ -366,4 +374,6 @@ public class StandardsRegulationsService {
         }
 
     }
+
+
 }