wangzhiqiang пре 2 година
родитељ
комит
a5bc450eed
20 измењених фајлова са 558 додато и 273 уклоњено
  1. 1 0
      api-common/src/main/java/api/common/pojo/param/scene/SceneGeneralTemplateParam.java
  2. 1 1
      api-common/src/main/java/api/common/pojo/param/scene/SceneNaturalNewParam.java
  3. 1 0
      api-common/src/main/java/api/common/pojo/po/scene/SceneGeneralTemplatePO.java
  4. 11 0
      simulation-resource-server/src/main/java/com/css/simulation/resource/scene/ctrl/SceneAccidentController.java
  5. 1 1
      simulation-resource-server/src/main/java/com/css/simulation/resource/scene/ctrl/SceneGeneralTemplateController.java
  6. 9 0
      simulation-resource-server/src/main/java/com/css/simulation/resource/scene/ctrl/SceneNaturalController.java
  7. 8 0
      simulation-resource-server/src/main/java/com/css/simulation/resource/scene/ctrl/StandardsRegulationsController.java
  8. 2 2
      simulation-resource-server/src/main/java/com/css/simulation/resource/scene/mapper/SceneAccidentMapper.java
  9. 4 0
      simulation-resource-server/src/main/java/com/css/simulation/resource/scene/mapper/SceneGeneralTemplateMapper.java
  10. 2 1
      simulation-resource-server/src/main/java/com/css/simulation/resource/scene/mapper/SceneNaturalMapper.java
  11. 5 1
      simulation-resource-server/src/main/java/com/css/simulation/resource/scene/mapper/StandardsRegulationsMapper.java
  12. 45 35
      simulation-resource-server/src/main/java/com/css/simulation/resource/scene/service/SceneAccidentService.java
  13. 1 0
      simulation-resource-server/src/main/java/com/css/simulation/resource/scene/service/SceneGeneralTemplateService.java
  14. 93 61
      simulation-resource-server/src/main/java/com/css/simulation/resource/scene/service/SceneNaturalService.java
  15. 139 6
      simulation-resource-server/src/main/java/com/css/simulation/resource/scene/service/ScenePackageService.java
  16. 32 38
      simulation-resource-server/src/main/java/com/css/simulation/resource/scene/service/StandardsRegulationsService.java
  17. 38 93
      simulation-resource-server/src/main/resources/mapper/scene/SceneAccidentMapper.xml
  18. 95 4
      simulation-resource-server/src/main/resources/mapper/scene/SceneGeneralTemplateMapper.xml
  19. 37 3
      simulation-resource-server/src/main/resources/mapper/scene/SceneNaturalMapper.xml
  20. 33 27
      simulation-resource-server/src/main/resources/mapper/scene/StandardsRegulationsMapper.xml

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

@@ -29,5 +29,6 @@ public class SceneGeneralTemplateParam extends PageVO implements Serializable {
     private String[] allSceneNames ; //场景名集合
 
     private List<String> scenarioRoadType;//道路类型
+    private String share;
 
 }

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

@@ -36,5 +36,5 @@ public class SceneNaturalNewParam extends PageVO implements Serializable {
 
     private String[] allSceneNames ; //场景名集合
 
-
+    private String share;
 }

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

@@ -52,6 +52,7 @@ public class SceneGeneralTemplatePO implements Serializable {
     private String videoLink;//视频链接
     private String fileName;//文件名或地址
     private String version;//版本号
+    private String share;//0私有 1共有
 
 
     private List<String> fileNameAll;//sheet页集合

+ 11 - 0
simulation-resource-server/src/main/java/com/css/simulation/resource/scene/ctrl/SceneAccidentController.java

@@ -80,4 +80,15 @@ public class SceneAccidentController {
         return new ResponseBodyVO<>(ResponseBodyVO.Response.SUCCESS);
     }
 
+    //分享交通事故
+    @PostMapping("/instShareSceneAccident")
+    @ResponseBody
+    public ResponseBodyVO<String> instShareSceneAccident(@RequestBody SceneAccidentPO params) {
+         sceneAccidentService.instShareSceneAccident(params);
+
+        return new ResponseBodyVO<>(ResponseBodyVO.Response.SUCCESS);
+
+    }
+
+
 }

+ 1 - 1
simulation-resource-server/src/main/java/com/css/simulation/resource/scene/ctrl/SceneGeneralTemplateController.java

@@ -218,7 +218,7 @@ public class SceneGeneralTemplateController {
     }
 
 
-    //新增泛化模板
+    //新增泛化模板  现在
     @PostMapping("/saveSceneGeneralTemplateAll")
     @ResponseBody
     public ResponseBodyVO<String> saveSceneGeneralTemplateAll(@RequestParam("file") MultipartFile multipartFile, HttpServletRequest request) {

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

@@ -80,4 +80,13 @@ public class SceneNaturalController {
        return new ResponseBodyVO(ResponseBodyVO.Response.SUCCESS);
     }
 
+
+    //分享
+    @PostMapping("/instShareSceneNatural")
+    @ResponseBody
+    public ResponseBodyVO<String> instShareSceneNatural(@RequestBody SceneNaturalPO po) {
+      sceneNaturalService.instShareSceneNatural(po);
+
+        return new ResponseBodyVO(ResponseBodyVO.Response.SUCCESS);
+    }
 }

+ 8 - 0
simulation-resource-server/src/main/java/com/css/simulation/resource/scene/ctrl/StandardsRegulationsController.java

@@ -81,4 +81,12 @@ public class StandardsRegulationsController {
         return new ResponseBodyVO<>(ResponseBodyVO.Response.SUCCESS);
     }
 
+    //查詢法规类型
+    @PostMapping("/queryRegulationType")
+    @ResponseBody
+    public ResponseBodyVO<List<String>> queryRegulationType() {
+
+        return standardsRegulationsService.queryRegulationType();
+
+    }
 }

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

@@ -22,9 +22,9 @@ public interface SceneAccidentMapper {
 
     void deleteSceneAccidentList(SceneAccidentPO params);
 
-    String querySceneAccidentByNmae(String sceneName);
+    SceneAccidentPO querySceneAccidentByNmae(SceneAccidentPO sceneAccidentPO);
     void updateSceneAccident(SceneAccidentPO params);
     void updateSceneAccidentList(List<SceneAccidentPO> list);
-
+    SceneAccidentPO querySceneAccidentById(String id);
 
 }

+ 4 - 0
simulation-resource-server/src/main/java/com/css/simulation/resource/scene/mapper/SceneGeneralTemplateMapper.java

@@ -12,6 +12,7 @@ import java.util.List;
 public interface SceneGeneralTemplateMapper {
 
     void saveSceneGeneralTemplateAll(List<SceneGeneralTemplatePO> list);
+    void saveSceneGeneralTemplate(SceneGeneralTemplatePO po);
     List<SceneGeneralTemplatePO> querySceneGeneralTemplateList(SceneGeneralTemplateParam params);
     SceneGeneralTemplatePO querySceneGeneralTemplateById(String id);
     void deleteSceneGeneralTemplateAll(SceneGeneralTemplatePO po);
@@ -20,4 +21,7 @@ public interface SceneGeneralTemplateMapper {
 
     List<SceneGeneralTemplatePO> querySceneGeneralTemplateListByQx(SceneGeneralTemplateParam params);
 
+    SceneGeneralTemplatePO querySceneGeneralTemplateByName(SceneGeneralTemplatePO sceneGeneralTemplatePO);
+    void updateSceneGeneralTemplate(SceneGeneralTemplatePO po);
+
 }

+ 2 - 1
simulation-resource-server/src/main/java/com/css/simulation/resource/scene/mapper/SceneNaturalMapper.java

@@ -21,7 +21,7 @@ public interface SceneNaturalMapper {
 
     void deleteSceneNatural(SceneNaturalPO params);
 
-    String querySceneNaturaByName(String fileName);
+    SceneNaturalPO querySceneNaturaByName(SceneNaturalPO sceneNaturalPO);
 
     Integer querySceneNumBySy(SceneNaturalParam params);
 
@@ -31,4 +31,5 @@ public interface SceneNaturalMapper {
     List<SceneNaturalPO> querySceneNaturalListByQx(SceneNaturalParam params);
     List<SceneNaturalPO> querySceneNaturalListByBqAndXlkAndQx(Map<String,SceneNaturalParam> map);
     List<SceneNaturalPO> querySceneNaturalListByBqAndQx(Map<String,SceneNaturalParam> map);
+    SceneNaturalPO querySceneNaturalById(String id);
 }

+ 5 - 1
simulation-resource-server/src/main/java/com/css/simulation/resource/scene/mapper/StandardsRegulationsMapper.java

@@ -19,11 +19,15 @@ public interface StandardsRegulationsMapper {
 
     void deleteStandardsRegulations(StandardsRegulationsPO params);
 
-    String queryStandardsRegulationsByName(String sceneName);
+    StandardsRegulationsPO queryStandardsRegulationsByName(StandardsRegulationsPO standardsRegulationsPO);
 
     void updateStandardsRegulations(StandardsRegulationsPO params);
     void updateStandardsRegulationsList(List<StandardsRegulationsPO> list);
 
     List<StandardsRegulationsPO> queryStandardsRegulationsListByQx(StandardsRegulationsParam params);
     List<StandardsRegulationsPO> queryStandardsRegulationsListByBqAndQx(StandardsRegulationsParam params);
+
+    List<String> queryRegulationType(String userId);
+
+    StandardsRegulationsPO queryStandardsRegulationsById(String id);
 }

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

@@ -64,8 +64,11 @@ public class SceneAccidentService {
         JsonNode root = objMap.readTree(json);
         //判断场景名称唯一
         String sceneName = root.path("场景名称").asText();
-        String sceneId = SceneAccidentMapper.querySceneAccidentByNmae(sceneName);
         SceneAccidentPO sceneAccidentPO = new SceneAccidentPO();
+        sceneAccidentPO.setShare("0");
+        sceneAccidentPO.setSceneName(sceneName);
+        SceneAccidentPO sceneAccidentPOByName = SceneAccidentMapper.querySceneAccidentByNmae(sceneAccidentPO);
+
         sceneAccidentPO = sceneAccidentPO.builder()
                 .accidentId(StringUtil.getRandomUUID())
                 .sceneName(sceneName)
@@ -95,7 +98,7 @@ public class SceneAccidentService {
         if (null != param.getVideoAddress() && !param.getVideoAddress().equals("")) {
             sceneAccidentPO.setVideoAddress(param.getVideoAddress());
         }
-        if (ObjectUtil.isNull(sceneId)) {
+        if (ObjectUtil.isNull(sceneAccidentPOByName)) {
             // -------------------------------- 保存数据到 mysql --------------------------------
             sceneAccidentPO.setCreateTime(TimeUtil.getNowForMysql());
             sceneAccidentPO.setCreateUserId(AuthUtil.getCurrentUserId());
@@ -108,7 +111,7 @@ public class SceneAccidentService {
             SceneAccidentMapper.saveSceneAccident(sceneAccidentPO);
         } else {
             // -------------------------------- 修改数据到 mysql --------------------------------
-            sceneAccidentPO.setAccidentId(sceneId);
+            sceneAccidentPO.setAccidentId(sceneAccidentPOByName.getAccidentId());
             sceneAccidentPO.setModifyTime(TimeUtil.getNowForMysql());
             sceneAccidentPO.setModifyUserId(AuthUtil.getCurrentUserId());
             SceneAccidentMapper.updateSceneAccident(sceneAccidentPO);
@@ -191,43 +194,23 @@ public class SceneAccidentService {
     }
 */
     public List<SceneAccidentPO> querySceneAccidentList(SceneAccidentParam params) {
-        if (ObjectUtil.isNotNull(params.getSceneName()) || (params.getSelfDriving() != null && params.getSelfDriving().size() > 0) || (params.getTargetDriving() != null && params.getTargetDriving().size() > 0)
-                || (params.getSelfReaction() != null && params.getSelfReaction().size() > 0) || (params.getConflictType() != null && params.getConflictType().size() > 0) || (params.getConflictBehavior() != null && params.getConflictBehavior().size() > 0) || (params.getIds() != null && params.getIds().length > 0)) {
-            params.setXlk("1");
-        }
-        if (ObjectUtil.isNotNull(params.getRearEndCollision()) || ObjectUtil.isNotNull(params.getCutIn()) || ObjectUtil.isNotNull(params.getDriveCurve()) || ObjectUtil.isNotNull(params.getCarConflict())) {
-            params.setBq(1);
-        }
+
         List<SceneAccidentPO> list = new ArrayList<>();
 
         String roleCode = AuthUtil.getCurrentUserRoleCode();
         String userId = AuthUtil.getCurrentUserId();
         if (DictConstants.ROLE_CODE_ADMIN.equals(roleCode) || DictConstants.ROLE_CODE_SYSADMIN.equals(roleCode)) { //管理员账户
-
-            if ((params.getXlk().equals("1") && params.getBq().equals(1)) || (params.getXlk().equals("0") && params.getBq().equals(0)) || (params.getXlk().equals("1") && params.getBq().equals(0))) {
                 list = SceneAccidentMapper.querySceneAccidentList(params);
-            }/*else if(params.getXlk().equals("1")&&params.getBq().equals("0")){
-            list = SceneAccidentMapper.querySceneAccidentListByXlk(params);
-        }*/ else if (params.getXlk().equals("0") && params.getBq().equals(1)) {
-                list = SceneAccidentMapper.querySceneAccidentListByBq(params);
-            }
         } else if (DictConstants.ROLE_CODE_SUBUESR.equals(roleCode)) {
             //查询父账户
             userId = AuthUtil.getCreateUserId();
             params.setUserId(userId);
-            if ((params.getXlk().equals("1") && params.getBq().equals(1)) || (params.getXlk().equals("0") && params.getBq().equals(0)) || (params.getXlk().equals("1") && params.getBq().equals(0))) {
                 list = SceneAccidentMapper.querySceneAccidentListByQx(params);
-            } else if (params.getXlk().equals("0") && params.getBq().equals(1)) {
-                list = SceneAccidentMapper.querySceneAccidentListByBqAndQx(params);
-            }
+
         } else if (DictConstants.ROLE_CODE_UESR.equals(roleCode)) {
             //查询普通账户
             params.setUserId(userId);
-            if ((params.getXlk().equals("1") && params.getBq().equals(1)) || (params.getXlk().equals("0") && params.getBq().equals(0)) || (params.getXlk().equals("1") && params.getBq().equals(0))) {
                 list = SceneAccidentMapper.querySceneAccidentListByQx(params);
-            } else if (params.getXlk().equals("0") && params.getBq().equals(1)) {
-                list = SceneAccidentMapper.querySceneAccidentListByBqAndQx(params);
-            }
         }
 
      /*   if ((params.getXlk().equals("1") && params.getBq().equals(1)) || (params.getXlk().equals("0") && params.getBq().equals(0)) || (params.getXlk().equals("1") && params.getBq().equals(0))) {
@@ -505,7 +488,7 @@ public class SceneAccidentService {
     /*
      * 获取交通事故场景数据:最新的自己获取路径
      */
-    @SneakyThrows
+   /* @SneakyThrows
     public ResponseBodyVO<String> saveAllNew(String dataUrl1) {
         //1 获取所有目录下所有场景
         // String dataUrl0 = "D:\\自然驾驶场景样例";     // 场景数据根路径
@@ -584,11 +567,11 @@ public class SceneAccidentService {
                                 sceneAccidentPO.setJsonAddress(dataUrl);
                             } else if (dataUrl.indexOf(".xml") != -1 || dataUrl.indexOf(".xosc") != -1) {
                                 sceneAccidentPO.setXmlAddress(dataUrl);
-                            } /*else if (dataUrl.indexOf(".xodr") != -1) {
+                            } *//*else if (dataUrl.indexOf(".xodr") != -1) {
                         sceneAccidentPO.setXodrAddress(dataUrl);
                     } else if (dataUrl.indexOf(".osgb") != -1) {
                         sceneAccidentPO.setOsgbAddress(dataUrl);
-                    }*/ else if (dataUrl.indexOf("simulation.mp4") != -1) {
+                    }*//* else if (dataUrl.indexOf("simulation.mp4") != -1) {
                                 sceneAccidentPO.setVideoAddress(dataUrl);
                             } else if (dataUrl.indexOf("simulation.mp4") == -1 && dataUrl.indexOf(".mp4") != -1) {
                                 sceneAccidentPO.setVideoPreview(dataUrl);
@@ -619,7 +602,7 @@ public class SceneAccidentService {
         }
 
 
-    }
+    }*/
 
 /*    public static FileItem createFileItem(String filePath, String fileName){
         String fieldName = "file";
@@ -642,7 +625,7 @@ public class SceneAccidentService {
 
 
     /**
-     * 获取交通事故场景数据:
+     * 获取交通事故场景数据:现在
      */
     public SceneImportPO importMiNio(SceneImportParam parms) {
         SceneImportPO sceneImportPO = new SceneImportPO();
@@ -697,11 +680,14 @@ public class SceneAccidentService {
 //                                        sceneImportPO.setErrorMessage("文件 " + adress + " 与交通事故场景类型不匹配,解析失败,请检查");
                                         return sceneImportPO;
                                     }
-                                    String sceneId = SceneAccidentMapper.querySceneAccidentByNmae(sceneName);
+
+                                    sceneAccidentPO.setSceneName(sceneName);
+                                    sceneAccidentPO.setShare("0");
+                                    SceneAccidentPO sceneAccidentPOByName = SceneAccidentMapper.querySceneAccidentByNmae(sceneAccidentPO);
                                     String osgbAdress = OsgbPath + "/" + root.path("osgb").asText();
                                     String xodrAdress = XodrPath + "/" + root.path("xodr").asText();
                                     sceneAccidentPO.setAccidentId(StringUtil.getRandomUUID());
-                                    sceneAccidentPO.setSceneName(sceneName);
+
                                     sceneAccidentPO.setScenceResume(root.path("场景描述").asText());
                                     sceneAccidentPO.setSelfDriving(selfDriving);
                                     sceneAccidentPO.setTargetDriving(root.path("目标驾驶行为").asText());
@@ -712,18 +698,18 @@ public class SceneAccidentService {
                                     sceneAccidentPO.setSceneWeather(root.path("天气").asText());
                                     sceneAccidentPO.setMaxTime(root.path("max_time").asText());
                                     sceneAccidentPO.setIsDeleted("0");
-                                    sceneAccidentPO.setShare("0");
+
                                     if (ObjectUtil.isNull(sceneAccidentPO.getOsgbAddress())) {
                                         sceneAccidentPO.setOsgbAddress(osgbAdress);
                                     }
                                     if (ObjectUtil.isNull(sceneAccidentPO.getXodrAddress())) {
                                         sceneAccidentPO.setXodrAddress(xodrAdress);
                                     }
-                                    if (ObjectUtil.isNull(sceneId)) {
+                                    if (ObjectUtil.isNull(sceneAccidentPOByName)) {
                                         isupdate = "0";
                                     } else {
                                         isupdate = "1";
-                                        sceneAccidentPO.setAccidentId(sceneId);
+                                        sceneAccidentPO.setAccidentId(sceneAccidentPOByName.getAccidentId());
                                     }
                                 }
                                 if (adress.contains(".json")) {
@@ -777,4 +763,28 @@ public class SceneAccidentService {
         }
     }
 
+
+    /**
+     * 分享
+     */
+    public void instShareSceneAccident(SceneAccidentPO po) {
+        SceneAccidentPO syPO=SceneAccidentMapper.querySceneAccidentById(po.getAccidentId());
+        syPO.setShare("1");
+        SceneAccidentPO sceneAccidentPOByName = SceneAccidentMapper.querySceneAccidentByNmae(syPO);
+        if(ObjectUtil.isNull(sceneAccidentPOByName)){
+                                // -------------------------------- 保存数据到 mysql --------------------------------
+                                syPO.setCreateTime(TimeUtil.getNowForMysql());
+                                syPO.setCreateUserId(AuthUtil.getCurrentUserId());
+                                syPO.setModifyTime(TimeUtil.getNowForMysql());
+                                syPO.setModifyUserId("");
+                                SceneAccidentMapper.saveSceneAccident(syPO);
+                            } else {
+                                // -------------------------------- 修改数据到 mysql --------------------------------
+                                syPO.setModifyTime(TimeUtil.getNowForMysql());
+                                syPO.setModifyUserId(AuthUtil.getCurrentUserId());
+                                syPO.setAccidentId(sceneAccidentPOByName.getAccidentId());
+                                SceneAccidentMapper.updateSceneAccident(syPO);
+                            }
+
+    }
 }

+ 1 - 0
simulation-resource-server/src/main/java/com/css/simulation/resource/scene/service/SceneGeneralTemplateService.java

@@ -205,6 +205,7 @@ public class SceneGeneralTemplateService {
                             po.setModifyUserId(AuthUtil.getCurrentUserId());
                             po.setModifyTime(TimeUtil.getNowForMysql());
                             po.setIsDeleted("0");
+                            po.setShare("0");
                             po.setId(StringUtil.getRandomUUID());
                             po.setFileName(sheetName);
                             po.setVersion(version);

+ 93 - 61
simulation-resource-server/src/main/java/com/css/simulation/resource/scene/service/SceneNaturalService.java

@@ -58,7 +58,10 @@ public class SceneNaturalService {
         int end = param.getJsonAddress().lastIndexOf(".");
         String fileName = param.getJsonAddress().substring(idx + 1, end);
         param.setNaturalName(fileName);
-        String sceneId = sceneNaturalMapper.querySceneNaturaByName(fileName);
+        SceneNaturalPO sceneNaturalPO = new SceneNaturalPO();
+        sceneNaturalPO.setShare("0");
+        sceneNaturalPO.setNaturalName(fileName);
+        SceneNaturalPO sceneNaturalPOByName = sceneNaturalMapper.querySceneNaturaByName(sceneNaturalPO);
         Response download = fileDownService.download(MI);
         String json = download.body().toString();
         ObjectMapper objMap = new ObjectMapper();
@@ -77,7 +80,7 @@ public class SceneNaturalService {
         JsonNode selfDrivingBehavior = root.path("自车行为");
         // -------------------------------- 目标行为 --------------------------------
         JsonNode targetBehavior = root.path("目标行为");
-        SceneNaturalPO sceneNaturalPO = new SceneNaturalPO();
+
         sceneNaturalPO = sceneNaturalPO.builder()
                 .naturalId(api.common.util.StringUtil.getRandomUUID())
                 .naturalName(fileName)
@@ -138,18 +141,18 @@ public class SceneNaturalService {
             sceneNaturalPO.setVideoPreview(param.getVideoPreview());
         }
 
-        if (ObjectUtil.isNull(sceneId)) {
+        if (ObjectUtil.isNull(sceneNaturalPOByName)) {
             // -------------------------------- 保存数据到 mysql --------------------------------
             sceneNaturalPO.setCreateTime(TimeUtil.getNowForMysql());
             sceneNaturalPO.setCreateUserId(AuthUtil.getCurrentUserId());
             sceneNaturalPO.setModifyTime(TimeUtil.getNowForMysql());
             sceneNaturalMapper.saveSceneNatural(sceneNaturalPO);
-          //  return new ResponseBodyVO(ResponseBodyVO.Response.CLIENT_FAILURE, "该场景编号" + fileName + "已存在,请检查");
-        }else{
+            //  return new ResponseBodyVO(ResponseBodyVO.Response.CLIENT_FAILURE, "该场景编号" + fileName + "已存在,请检查");
+        } else {
             // -------------------------------- 修改数据到 mysql --------------------------------
             sceneNaturalPO.setModifyUserId(AuthUtil.getCurrentUserId());
             sceneNaturalPO.setModifyTime(TimeUtil.getNowForMysql());
-            sceneNaturalPO.setNaturalId(sceneId);
+            sceneNaturalPO.setNaturalId(sceneNaturalPOByName.getNaturalId());
             sceneNaturalMapper.updateSceneNatural(sceneNaturalPO);
         }
         return new ResponseBodyVO(ResponseBodyVO.Response.SUCCESS);
@@ -213,12 +216,12 @@ public class SceneNaturalService {
         String[][] selfBehavior = params.getSelfBehavior();//自车行为
         String[][] targetBehavior = params.getTargetBehavior(); //目标行为
         //判断下拉选项是否为空
-        if(ObjectUtil.isNotNull(naturalName)||(naturalEnvironment!=null&&naturalEnvironment.length>0)||(road!=null&&road.length>0)
+     /*   if(ObjectUtil.isNotNull(naturalName)||(naturalEnvironment!=null&&naturalEnvironment.length>0)||(road!=null&&road.length>0)
         ||(infrastructure!=null&&infrastructure.length>0)||(temporaryOperation!=null&&temporaryOperation.length>0)||(trafficCondition!=null&&trafficCondition.length>0)||
          (selfBehavior!=null&&selfBehavior.length>0)||(targetBehavior!=null&&targetBehavior.length>0)||(params.getIds()!=null&&params.getIds().length>0)){
             po.setXlk("1");
-        }
-        SceneNaturalParam poBq = new SceneNaturalParam();
+        }*/
+    /*    SceneNaturalParam poBq = new SceneNaturalParam();
         String[][] highSpeed=params.getHighSpeed() ;//高速
         String[][] ramp=params.getRamp();//匝道
         String[][] tunnel=params.getTunnel();//隧道
@@ -252,7 +255,7 @@ public class SceneNaturalService {
         }
         if (laneChange != null && laneChange.length > 0) {
             ParamUtil.arrConvertObj(laneChange, poBq);
-        }
+        }*/
 
 
         if (ObjectUtil.isNotNull(params.getIds())) {
@@ -301,7 +304,7 @@ public class SceneNaturalService {
             ParamUtil.arrConvertObj(targetBehavior, po);
         }
 
-     //获取权限并赋值
+        //获取权限并赋值
      /* List<String> listType=  systemUserSceneService.querySystemUserSceneByType(DictConstants.SCENE_NATURAL);
         if(listType!=null&&listType.size()>0){
             po.setAllIds(listType);
@@ -310,12 +313,12 @@ public class SceneNaturalService {
             listA.add("没有权限");
             po.setAllIds(listA);
         }*/
-         Map<String,SceneNaturalParam> map=new HashMap<String,SceneNaturalParam>();
+     /*    Map<String,SceneNaturalParam> map=new HashMap<String,SceneNaturalParam>();
          map.put("po",po);
-         map.put("poBq",poBq);
+         map.put("poBq",poBq);*/
         //List<SceneNaturalPO> list = sceneNaturalMapper.querySceneNaturalList(po);
         //只有标签,或下拉框,或者两者都为空
-        List<SceneNaturalPO> list=new ArrayList<>();
+        List<SceneNaturalPO> list = new ArrayList<>();
      /*   if((po.getXlk().equals("0")&&po.getBq().equals("0"))||(po.getXlk().equals("1")&&po.getBq().equals("0"))){
             list = sceneNaturalMapper.querySceneNaturalList(po);
         }else if((po.getXlk().equals("0")&&po.getBq().equals("1"))) {
@@ -327,39 +330,41 @@ public class SceneNaturalService {
         //添加权限
         String roleCode = AuthUtil.getCurrentUserRoleCode();
         String userId = AuthUtil.getCurrentUserId();
-        if(DictConstants.ROLE_CODE_ADMIN.equals(roleCode) || DictConstants.ROLE_CODE_SYSADMIN.equals(roleCode)){ //管理员账户
+        if (DictConstants.ROLE_CODE_ADMIN.equals(roleCode) || DictConstants.ROLE_CODE_SYSADMIN.equals(roleCode)) { //管理员账户
+/*
             if((po.getXlk().equals("0")&&po.getBq().equals("0"))||(po.getXlk().equals("1")&&po.getBq().equals("0"))){
-                list = sceneNaturalMapper.querySceneNaturalList(po);
-            }else if((po.getXlk().equals("0")&&po.getBq().equals("1"))) {
+*/
+            list = sceneNaturalMapper.querySceneNaturalList(po);
+            /*}else if((po.getXlk().equals("0")&&po.getBq().equals("1"))) {
                 list = sceneNaturalMapper.querySceneNaturalListByBq(map);
             }else{
                 list = sceneNaturalMapper.querySceneNaturalListByBqAndXlk(map);
             }
-
-        }else if(DictConstants.ROLE_CODE_SUBUESR.equals(roleCode)){
+*/
+        } else if (DictConstants.ROLE_CODE_SUBUESR.equals(roleCode)) {
             //查询父账户
             userId = AuthUtil.getCreateUserId();
             po.setUserId(userId);
-            poBq.setUserId(userId);
-            if((po.getXlk().equals("0")&&po.getBq().equals("0"))||(po.getXlk().equals("1")&&po.getBq().equals("0"))){
-                list = sceneNaturalMapper.querySceneNaturalListByQx(po);
-            }else if((po.getXlk().equals("0")&&po.getBq().equals("1"))) {
+            // poBq.setUserId(userId);
+            //if((po.getXlk().equals("0")&&po.getBq().equals("0"))||(po.getXlk().equals("1")&&po.getBq().equals("0"))){
+            list = sceneNaturalMapper.querySceneNaturalListByQx(po);
+           /* }else if((po.getXlk().equals("0")&&po.getBq().equals("1"))) {
                 list = sceneNaturalMapper.querySceneNaturalListByBqAndQx(map);
             }else{
                 list = sceneNaturalMapper.querySceneNaturalListByBqAndXlkAndQx(map);
             }
-
-        }else if(DictConstants.ROLE_CODE_UESR.equals(roleCode)){
+*/
+        } else if (DictConstants.ROLE_CODE_UESR.equals(roleCode)) {
             //查询普通账户
             po.setUserId(userId);
-            poBq.setUserId(userId);
-            if((po.getXlk().equals("0")&&po.getBq().equals("0"))||(po.getXlk().equals("1")&&po.getBq().equals("0"))){
-                list = sceneNaturalMapper.querySceneNaturalListByQx(po);
-            }else if((po.getXlk().equals("0")&&po.getBq().equals("1"))) {
+            // poBq.setUserId(userId);
+            //  if((po.getXlk().equals("0")&&po.getBq().equals("0"))||(po.getXlk().equals("1")&&po.getBq().equals("0"))){
+            list = sceneNaturalMapper.querySceneNaturalListByQx(po);
+           /* }else if((po.getXlk().equals("0")&&po.getBq().equals("1"))) {
                 list = sceneNaturalMapper.querySceneNaturalListByBqAndQx(map);
             }else{
                 list = sceneNaturalMapper.querySceneNaturalListByBqAndXlkAndQx(map);
-            }
+            }*/
         }
         //list = sceneNaturalMapper.querySceneNaturalListByBq(map);
         //List<SceneNaturalPO> list = sceneNaturalMapper.querySceneNaturalList(map);
@@ -385,29 +390,29 @@ public class SceneNaturalService {
                     vo.setLabel(vo.getLabel() + ",隧道");
                 }
             }
-            if (vo.getTargetBehavior().indexOf("机动车从左侧切入成功")>-1 ||vo.getTargetBehavior().indexOf("机动车从右侧切入成功")>-1) {
-                if (ObjectUtil.isNull(vo.getLabel())){
+            if (vo.getTargetBehavior().indexOf("机动车从左侧切入成功") > -1 || vo.getTargetBehavior().indexOf("机动车从右侧切入成功") > -1) {
+                if (ObjectUtil.isNull(vo.getLabel())) {
                     vo.setLabel("切入");
                 } else {
                     vo.setLabel(vo.getLabel() + ",切入");
                 }
             }
-            if (vo.getTargetBehavior().equals("机动车向左侧切出成功") ||vo.getTargetBehavior().equals("机动车向右侧切出成功")) {
-                if (ObjectUtil.isNull(vo.getLabel())){
+            if (vo.getTargetBehavior().equals("机动车向左侧切出成功") || vo.getTargetBehavior().equals("机动车向右侧切出成功")) {
+                if (ObjectUtil.isNull(vo.getLabel())) {
                     vo.setLabel("切出");
                 } else {
                     vo.setLabel(vo.getLabel() + ",切出");
                 }
             }
-            if (vo.getSelfBehavior().indexOf("直路掉头")>-1 ||vo.getSelfBehavior().indexOf("路口掉头")>-1){
-                if (ObjectUtil.isNull(vo.getLabel())){
+            if (vo.getSelfBehavior().indexOf("直路掉头") > -1 || vo.getSelfBehavior().indexOf("路口掉头") > -1) {
+                if (ObjectUtil.isNull(vo.getLabel())) {
                     vo.setLabel("掉头");
                 } else {
                     vo.setLabel(vo.getLabel() + ",掉头");
                 }
             }
-            if (vo.getSelfBehavior().indexOf("向左变道成功") >-1||vo.getSelfBehavior().equals("向右变道成功")||vo.getSelfBehavior().indexOf("向左连续变道")>-1||vo.getSelfBehavior().indexOf("向右连续变道")>-1||vo.getSelfBehavior().indexOf("向左变道超车")>-1||vo.getSelfBehavior().indexOf("向右变道超车")>-1) {
-                if (ObjectUtil.isNull(vo.getLabel())){
+            if (vo.getSelfBehavior().indexOf("向左变道成功") > -1 || vo.getSelfBehavior().equals("向右变道成功") || vo.getSelfBehavior().indexOf("向左连续变道") > -1 || vo.getSelfBehavior().indexOf("向右连续变道") > -1 || vo.getSelfBehavior().indexOf("向左变道超车") > -1 || vo.getSelfBehavior().indexOf("向右变道超车") > -1) {
+                if (ObjectUtil.isNull(vo.getLabel())) {
                     vo.setLabel("变道");
                 } else {
                     vo.setLabel(vo.getLabel() + ",变道");
@@ -422,26 +427,27 @@ public class SceneNaturalService {
         params.setModifyTime(TimeUtil.getNowForMysql());
         params.setModifyUserId(AuthUtil.getCurrentUserId());
         sceneNaturalMapper.deleteSceneNatural(params);
-        Map map=new HashMap();
-        map.put("sceneId",params.getNaturalId());
-        map.put("sceneName",params.getNaturalName());
-        map.put("type",DictConstants.SCENE_NATURAL);
+        Map 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);
 
         // systemUserSceneService.deleteSystemUserSceneBySceneId(params.getNaturalId());
     }
+
     public Integer querySceneNumBySy() {
-        SceneNaturalParam params=new SceneNaturalParam();
+        SceneNaturalParam params = new SceneNaturalParam();
         String roleCode = AuthUtil.getCurrentUserRoleCode();
         String userId = AuthUtil.getCurrentUserId();
-        if(DictConstants.ROLE_CODE_ADMIN.equals(roleCode) || DictConstants.ROLE_CODE_SYSADMIN.equals(roleCode)){
+        if (DictConstants.ROLE_CODE_ADMIN.equals(roleCode) || DictConstants.ROLE_CODE_SYSADMIN.equals(roleCode)) {
             //管理员账户
             return sceneNaturalMapper.querySceneNumBySy(params);
-        }else if(DictConstants.ROLE_CODE_SUBUESR.equals(roleCode)){
+        } else if (DictConstants.ROLE_CODE_SUBUESR.equals(roleCode)) {
             //根据普通子账户查询父账户
             userId = AuthUtil.getCreateUserId();
-           return systemScenePackageMapper.querySceneNum(userId);
-        }else if(DictConstants.ROLE_CODE_UESR.equals(roleCode)){
+            return systemScenePackageMapper.querySceneNum(userId);
+        } else if (DictConstants.ROLE_CODE_UESR.equals(roleCode)) {
             //查询普通账户
             return systemScenePackageMapper.querySceneNum(userId);
         }
@@ -449,14 +455,13 @@ public class SceneNaturalService {
     }
 
 
-
     /**
      * 获取自然场景数据:
      */
     public SceneImportPO importMiNio(SceneImportParam parms) {
-        SceneImportPO sceneImportPO=new  SceneImportPO();
+        SceneImportPO sceneImportPO = new SceneImportPO();
         sceneImportPO.setId(parms.getId());
-        List<String>  listLog=new ArrayList<>();
+        List<String> listLog = new ArrayList<>();
         try {
             MinioParameter MI = new MinioParameter();
             MI.setObjectName(parms.getMinioDirectory());
@@ -482,6 +487,7 @@ public class SceneNaturalService {
                             MI.setObjectName(scenePath);
                             List<String> listAderss = fileDownService.list(MI).getInfo();
                             SceneNaturalPO sceneNaturalPO = new SceneNaturalPO();
+                            sceneNaturalPO.setShare("0");
                             String isupdate = null;
                             for (String adress : listAderss) {
                                 if (adress.indexOf(".json") != -1) {
@@ -495,7 +501,9 @@ public class SceneNaturalService {
                                     int idx = adress.lastIndexOf("/");
                                     int end = adress.lastIndexOf(".");
                                     String fileName = adress.substring(idx + 1, end);
-                                    String sceneId = sceneNaturalMapper.querySceneNaturaByName(fileName);
+                                    sceneNaturalPO.setNaturalName(fileName);
+                                    sceneNaturalPO.setShare("0");
+                                    SceneNaturalPO sceneNaturalPOByName = sceneNaturalMapper.querySceneNaturaByName(sceneNaturalPO);
                                     String osgbAdress = OsgbPath + "/" + root.path("osgb").asText();
                                     String xodrAdress = XodrPath + "/" + root.path("xodr").asText();
                                     // -------------------------------- 自然环境 --------------------------------
@@ -513,9 +521,9 @@ public class SceneNaturalService {
                                     // -------------------------------- 目标行为 --------------------------------
                                     JsonNode targetBehavior = root.path("目标行为");
 
-                                    if(ObjectUtil.isNull(naturalEnvironment)&&ObjectUtil.isNull(road)&&ObjectUtil.isNull(selfDrivingBehavior)&&ObjectUtil.isNull(targetBehavior)){
+                                    if (ObjectUtil.isNull(naturalEnvironment) && ObjectUtil.isNull(road) && ObjectUtil.isNull(selfDrivingBehavior) && ObjectUtil.isNull(targetBehavior)) {
                                         sceneImportPO.setStatus(DictConstants.SCENE_IMPORT_STATUS_2);
-                                        sceneImportPO.setErrorMessage("该文件:"+adress+"与自然场景类型不匹配,解析失败,请检查");
+                                        sceneImportPO.setErrorMessage("该文件:" + adress + "与自然场景类型不匹配,解析失败,请检查");
                                         return sceneImportPO;
                                     }
                                     sceneNaturalPO.setNaturalId(api.common.util.StringUtil.getRandomUUID());
@@ -556,18 +564,18 @@ public class SceneNaturalService {
                                     sceneNaturalPO.setSelfBehavior(getSequenceNew(selfDrivingBehavior));
                                     sceneNaturalPO.setTargetBehavior(getSequenceNew(targetBehavior));
                                     sceneNaturalPO.setMaxTime(root.path("max_time").asText());
-                                             sceneNaturalPO.setIsDeleted("0");
-                                    if(ObjectUtil.isNull(sceneNaturalPO.getOsgbAddress())){
+                                    sceneNaturalPO.setIsDeleted("0");
+                                    if (ObjectUtil.isNull(sceneNaturalPO.getOsgbAddress())) {
                                         sceneNaturalPO.setOsgbAddress(osgbAdress);
                                     }
-                                    if(ObjectUtil.isNull(sceneNaturalPO.getXodrAddress())){
+                                    if (ObjectUtil.isNull(sceneNaturalPO.getXodrAddress())) {
                                         sceneNaturalPO.setXodrAddress(xodrAdress);
                                     }
-                                    if (ObjectUtil.isNull(sceneId)) {
+                                    if (ObjectUtil.isNull(sceneNaturalPOByName)) {
                                         isupdate = "0";
                                     } else {
                                         isupdate = "1";
-                                        sceneNaturalPO.setNaturalId(sceneId);
+                                        sceneNaturalPO.setNaturalId(sceneNaturalPOByName.getNaturalId());
                                     }
                                 }
                                 if (adress.indexOf(".json") != -1) {
@@ -580,7 +588,7 @@ public class SceneNaturalService {
                                     sceneNaturalPO.setOsgbAddress(adress);
                                 } else if (adress.indexOf("simulation.mp4") != -1) {
                                     sceneNaturalPO.setVideoAddress(adress);
-                                }else if (adress.indexOf(".mp4") != -1) {
+                                } else if (adress.indexOf(".mp4") != -1) {
                                     sceneNaturalPO.setVideoPreview(adress);
                                 }
                             }
@@ -614,11 +622,35 @@ public class SceneNaturalService {
             sceneImportPO.setFalseNum(falseNum);
             sceneImportPO.setErrorMessage(errorMessage);
             return sceneImportPO;
-        }catch (Exception e){
+        } catch (Exception e) {
             sceneImportPO.setStatus(DictConstants.SCENE_IMPORT_STATUS_2);
-            sceneImportPO.setErrorMessage("该文件地址:"+parms.getMinioDirectory()+"解析失败,请检查");
+            sceneImportPO.setErrorMessage("该文件地址:" + parms.getMinioDirectory() + "解析失败,请检查");
             return sceneImportPO;
         }
     }
 
+
+    /**
+     * 分享
+     */
+       public void instShareSceneNatural(SceneNaturalPO parms) {
+        SceneNaturalPO syPo=sceneNaturalMapper.querySceneNaturalById(parms.getNaturalId());
+        syPo.setShare("1");
+        SceneNaturalPO sceneNaturalPOByName = sceneNaturalMapper.querySceneNaturaByName(syPo);
+        if (ObjectUtil.isNull(sceneNaturalPOByName)) {
+            // -------------------------------- 保存数据到 mysql --------------------------------
+            syPo.setCreateTime(TimeUtil.getNowForMysql());
+            syPo.setCreateUserId(AuthUtil.getCurrentUserId());
+            syPo.setModifyTime(TimeUtil.getNowForMysql());
+            syPo.setModifyUserId("");
+            sceneNaturalMapper.saveSceneNatural(syPo);
+        } else {
+            // -------------------------------- 修改数据到 mysql --------------------------------
+            syPo.setModifyTime(TimeUtil.getNowForMysql());
+            syPo.setModifyUserId(AuthUtil.getCurrentUserId());
+            sceneNaturalMapper.updateSceneNatural(syPo);
+        }
+
+    }
+
 }

+ 139 - 6
simulation-resource-server/src/main/java/com/css/simulation/resource/scene/service/ScenePackageService.java

@@ -3,9 +3,7 @@ package com.css.simulation.resource.scene.service;
 import api.common.pojo.common.ResponseBodyVO;
 import api.common.pojo.param.scene.ScenePackageParam;
 import api.common.pojo.param.scene.ScoringRulesParam;
-import api.common.pojo.po.scene.ScenePackagePO;
-import api.common.pojo.po.scene.ScenePackageSublistPO;
-import api.common.pojo.po.scene.ScoringRulesPO;
+import api.common.pojo.po.scene.*;
 import api.common.pojo.vo.scene.ScenePackageNewVO;
 import api.common.pojo.vo.scene.ScenePackageSublistVO;
 import api.common.util.LogUtil;
@@ -13,9 +11,7 @@ import api.common.util.ObjectUtil;
 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;
-import com.css.simulation.resource.scene.mapper.ScenePackageSublistMapper;
-import com.css.simulation.resource.scene.mapper.ScoringRulesMapper;
+import com.css.simulation.resource.scene.mapper.*;
 import com.css.simulation.resource.system.service.ParameterService;
 import lombok.SneakyThrows;
 import lombok.extern.slf4j.Slf4j;
@@ -37,6 +33,15 @@ public class ScenePackageService {
     private ParameterService parameterService;
     @Resource
     private ScoringRulesMapper scoringRulesMapper;
+    @Resource
+    private SceneNaturalMapper sceneNaturalMapper;
+    @Resource
+    private SceneAccidentMapper sceneAccidentMapper;
+    @Resource
+    private StandardsRegulationsMapper standardsRegulationsMapper;
+    @Resource
+    private SceneGeneralTemplateMapper sceneGeneralTemplateMapper;
+
 
 
     /**
@@ -319,6 +324,134 @@ public class ScenePackageService {
                     vo.setPackageAndRules(syPo.getRulesId());
                 }
 
+
+                //分享场景
+                //自然场景
+                String sceneNaturalIds=vo.getSceneNaturalIds();
+                if(ObjectUtil.isNotNull(sceneNaturalIds)){
+                    List<String> sceneNaturalIdList=Arrays.asList(sceneNaturalIds.split(","));
+                    SceneNaturalPO SceneNaturalparm=new SceneNaturalPO();
+                    SceneNaturalparm.setShare("1");
+                    for (String naturalId: sceneNaturalIdList) {
+                        SceneNaturalPO SceneNaturalPOSy= sceneNaturalMapper.querySceneNaturalById(naturalId);
+                        SceneNaturalparm.setNaturalName(SceneNaturalPOSy.getNaturalName());
+                       SceneNaturalPO sceneNaturalPOByName= sceneNaturalMapper.querySceneNaturaByName(SceneNaturalparm);
+                        SceneNaturalPOSy.setShare("1");
+                        //是否已存在
+                       if(ObjectUtil.isNotNull(sceneNaturalPOByName)){
+                          /* if(!sceneNaturalPOByName.getShare().equals("1")){
+
+                           }*/
+                           SceneNaturalPOSy.setNaturalId(sceneNaturalPOByName.getNaturalId());
+                           SceneNaturalPOSy.setModifyTime(TimeUtil.getNowForMysql());
+                           SceneNaturalPOSy.setModifyUserId(AuthUtil.getCurrentUserId());
+                           sceneNaturalMapper.updateSceneNatural(SceneNaturalPOSy);
+                       }else{
+                           SceneNaturalPOSy.setNaturalId(StringUtil.getRandomUUID());
+                           SceneNaturalPOSy.setCreateTime(TimeUtil.getNowForMysql());
+                           SceneNaturalPOSy.setCreateUserId(AuthUtil.getCurrentUserId());
+                           SceneNaturalPOSy.setModifyTime(TimeUtil.getNowForMysql());
+                           SceneNaturalPOSy.setModifyUserId("");
+                           sceneNaturalMapper.saveSceneNatural(SceneNaturalPOSy);
+                       }
+
+                    }
+                };
+
+                //标准法规
+                String sceneStatueIds=vo.getSceneStatueIds();
+                if(ObjectUtil.isNotNull(sceneStatueIds)){
+                    List<String> sceneStatueIdList=Arrays.asList(sceneStatueIds.split(","));
+                    StandardsRegulationsPO standardsRegulationsPO=new StandardsRegulationsPO();
+                    standardsRegulationsPO.setShare("1");
+                    for (String sceneStatueId: sceneStatueIdList) {
+                        StandardsRegulationsPO standardsRegulationsPOSy= standardsRegulationsMapper.queryStandardsRegulationsById(sceneStatueId);
+                        standardsRegulationsPO.setSceneName(standardsRegulationsPOSy.getSceneName());
+                        StandardsRegulationsPO StandardsRegulationsByName= standardsRegulationsMapper.queryStandardsRegulationsByName(standardsRegulationsPO);
+                        standardsRegulationsPOSy.setShare("1");
+                        //是否已存在
+                        if(ObjectUtil.isNotNull(StandardsRegulationsByName)){
+                          /* if(!sceneNaturalPOByName.getShare().equals("1")){
+
+                           }*/
+                            standardsRegulationsPOSy.setRegulationsId(StandardsRegulationsByName.getRegulationsId());
+                            standardsRegulationsPOSy.setModifyTime(TimeUtil.getNowForMysql());
+                            standardsRegulationsPOSy.setModifyUserId(AuthUtil.getCurrentUserId());
+                            standardsRegulationsMapper.updateStandardsRegulations(standardsRegulationsPOSy);
+                        }else{
+                            standardsRegulationsPOSy.setRegulationsId(StringUtil.getRandomUUID());
+                            standardsRegulationsPOSy.setCreateTime(TimeUtil.getNowForMysql());
+                            standardsRegulationsPOSy.setCreateUserId(AuthUtil.getCurrentUserId());
+                            standardsRegulationsPOSy.setModifyTime(TimeUtil.getNowForMysql());
+                            standardsRegulationsPOSy.setModifyUserId("");
+                            standardsRegulationsMapper.saveStandardsRegulations(standardsRegulationsPOSy);
+                        }
+                    }
+                };
+
+                //交通事故
+                String sceneTrafficIds=vo.getSceneTrafficIds();
+                if(ObjectUtil.isNotNull(sceneTrafficIds)){
+                    List<String> sceneTrafficIdList=Arrays.asList(sceneTrafficIds.split(","));
+                    SceneAccidentPO sceneAccidentPO=new SceneAccidentPO();
+                    sceneAccidentPO.setShare("1");
+                    for (String sceneStatueId: sceneTrafficIdList) {
+                        SceneAccidentPO sceneAccidentPOSy = sceneAccidentMapper.querySceneAccidentById(sceneStatueId);
+                        sceneAccidentPO.setSceneName(sceneAccidentPOSy.getSceneName());
+                        SceneAccidentPO sceneAccidentPOByName=  sceneAccidentMapper.querySceneAccidentByNmae(sceneAccidentPO);
+                        sceneAccidentPOSy.setShare("1");
+                        //是否已存在
+                        if(ObjectUtil.isNotNull(sceneAccidentPOByName)){
+                          /* if(!sceneNaturalPOByName.getShare().equals("1")){
+
+                           }*/
+                            sceneAccidentPOSy.setAccidentId(sceneAccidentPOByName.getAccidentId());
+                            sceneAccidentPOSy.setModifyTime(TimeUtil.getNowForMysql());
+                            sceneAccidentPOSy.setModifyUserId(AuthUtil.getCurrentUserId());
+                            sceneAccidentMapper.updateSceneAccident(sceneAccidentPOSy);
+                        }else{
+                            sceneAccidentPOSy.setAccidentId(StringUtil.getRandomUUID());
+                            sceneAccidentPOSy.setCreateTime(TimeUtil.getNowForMysql());
+                            sceneAccidentPOSy.setCreateUserId(AuthUtil.getCurrentUserId());
+                            sceneAccidentPOSy.setModifyTime(TimeUtil.getNowForMysql());
+                            sceneAccidentPOSy.setModifyUserId("");
+                            sceneAccidentMapper.saveSceneAccident(sceneAccidentPOSy);
+                        }
+                    }
+                };
+
+                //泛化模板
+                String sceneGeneralizationIds=vo.getSceneGeneralizationIds();
+                if(ObjectUtil.isNotNull(sceneGeneralizationIds)){
+                    List<String> sceneGeneralizationIdList=Arrays.asList(sceneGeneralizationIds.split(","));
+                    SceneGeneralTemplatePO sceneGeneralTemplatePO=new SceneGeneralTemplatePO();
+                    sceneGeneralTemplatePO.setShare("1");
+                    for (String sceneStatueId: sceneGeneralizationIdList) {
+                        SceneGeneralTemplatePO sceneGeneralTemplatePOSy = sceneGeneralTemplateMapper.querySceneGeneralTemplateById(sceneStatueId);
+                        sceneGeneralTemplatePO.setSceneId(sceneGeneralTemplatePOSy.getSceneId());
+                        SceneGeneralTemplatePO sceneGeneralTemplatePOByName=  sceneGeneralTemplateMapper.querySceneGeneralTemplateByName(sceneGeneralTemplatePO);
+                        sceneGeneralTemplatePOSy.setShare("1");
+                        //是否已存在
+                        if(ObjectUtil.isNotNull(sceneGeneralTemplatePOByName)){
+                          /* if(!sceneNaturalPOByName.getShare().equals("1")){
+
+                           }*/
+                            sceneGeneralTemplatePOSy.setId(sceneGeneralTemplatePOByName.getId());
+                            sceneGeneralTemplatePOSy.setModifyTime(TimeUtil.getNowForMysql());
+                            sceneGeneralTemplatePOSy.setModifyUserId(AuthUtil.getCurrentUserId());
+                            sceneGeneralTemplateMapper.updateSceneGeneralTemplate(sceneGeneralTemplatePOSy);
+                        }else{
+                            sceneGeneralTemplatePOSy.setId(StringUtil.getRandomUUID());
+                            sceneGeneralTemplatePOSy.setCreateTime(TimeUtil.getNowForMysql());
+                            sceneGeneralTemplatePOSy.setCreateUserId(AuthUtil.getCurrentUserId());
+                            sceneGeneralTemplatePOSy.setModifyTime(TimeUtil.getNowForMysql());
+                            sceneGeneralTemplatePOSy.setModifyUserId("");
+                            sceneGeneralTemplateMapper.saveSceneGeneralTemplate(sceneGeneralTemplatePOSy);
+                        }
+                    }
+                };
+
+
             }
             if (ObjectUtil.isNotNull(set)) {
                 return new ResponseBodyVO<>(ResponseBodyVO.Response.CLIENT_FAILURE, "该条数据中指标名称:" + set + "重复,请检查");

+ 32 - 38
simulation-resource-server/src/main/java/com/css/simulation/resource/scene/service/StandardsRegulationsService.java

@@ -58,9 +58,12 @@ public class StandardsRegulationsService {
         ObjectMapper objMap = new ObjectMapper();
         JsonNode root = objMap.readTree(json);
         String sceneName = root.path("场景名称").asText();
-        String sceneId = standardsRegulationsMapper.queryStandardsRegulationsByName(sceneName);
-
         StandardsRegulationsPO standardsRegulationsPO = new StandardsRegulationsPO();
+        standardsRegulationsPO.setShare("0");
+        standardsRegulationsPO.setSceneName(sceneName);
+        StandardsRegulationsPO PoByName = standardsRegulationsMapper.queryStandardsRegulationsByName(standardsRegulationsPO);
+
+
         standardsRegulationsPO = standardsRegulationsPO.builder()
                 .regulationsId(StringUtil.getRandomUUID())
                 .sceneName(sceneName)
@@ -88,7 +91,7 @@ public class StandardsRegulationsService {
             standardsRegulationsPO.setVideoPreview(param.getVideoPreview());
         }
 
-        if (ObjectUtil.isNull(sceneId)) {
+        if (ObjectUtil.isNull(standardsRegulationsPO)) {
             // -------------------------------- 保存数据到 mysql --------------------------------
             standardsRegulationsPO.setCreateTime(TimeUtil.getNowForMysql());
             standardsRegulationsPO.setModifyTime(TimeUtil.getNowForMysql());
@@ -98,7 +101,7 @@ public class StandardsRegulationsService {
             // return new ResponseBodyVO(ResponseBodyVO.Response.CLIENT_FAILURE, "该场景名称" + sceneName + "已存在,请检查");
         } else {
             // -------------------------------- 修改数据到 mysql --------------------------------
-            standardsRegulationsPO.setRegulationsId(sceneId);
+            standardsRegulationsPO.setRegulationsId(standardsRegulationsPO.getRegulationsId());
             standardsRegulationsPO.setModifyTime(TimeUtil.getNowForMysql());
             standardsRegulationsPO.setModifyUserId(AuthUtil.getCurrentUserId());
             standardsRegulationsMapper.updateStandardsRegulations(standardsRegulationsPO);
@@ -108,50 +111,23 @@ public class StandardsRegulationsService {
 
     //查看列表
     public List<StandardsRegulationsPO> queryStandardsRegulationsList(StandardsRegulationsParam params) {
-        if (ObjectUtil.isNotNull(params.getSceneName()) || (params.getRegulationType() != null && params.getRegulationType().size() > 0) || ObjectUtil.isNotNull(params.getStandardType()) || ObjectUtil.isNotNull(params.getStandardType())
-                || (params.getIds() != null && params.getIds().length > 0)) {
-            params.setXlk("1");
-        }
-        if (params.getLabel() != null && params.getLabel().size() > 0) {
-            params.setBq("1");
-        }
+
         List<StandardsRegulationsPO> list = new ArrayList<>();
-        /*if((params.getXlk().equals("1")&&params.getBq().equals("1"))||(params.getXlk().equals("0")&&params.getBq().equals("0"))||(params.getXlk().equals("1")&&params.getBq().equals("0"))){
-            list =  standardsRegulationsMapper.queryStandardsRegulationsList(params);
-        }*//*else if(params.getXlk().equals("1")&&params.getBq().equals("0")){
-            list =  standardsRegulationsMapper.queryStandardsRegulationsList(params);
-        }*//*else if(params.getXlk().equals("0")&&params.getBq().equals("1")){
-            list =  standardsRegulationsMapper.queryStandardsRegulationsListByBq(params);
-        }*/
 
         //添加权限
         String roleCode = AuthUtil.getCurrentUserRoleCode();
         String userId = AuthUtil.getCurrentUserId();
         if (DictConstants.ROLE_CODE_ADMIN.equals(roleCode) || DictConstants.ROLE_CODE_SYSADMIN.equals(roleCode)) { //管理员账户
-            if ((params.getXlk().equals("1") && params.getBq().equals("1")) || (params.getXlk().equals("0") && params.getBq().equals("0")) || (params.getXlk().equals("1") && params.getBq().equals("0"))) {
                 list = standardsRegulationsMapper.queryStandardsRegulationsList(params);
-            } else if (params.getXlk().equals("0") && params.getBq().equals("1")) {
-                list = standardsRegulationsMapper.queryStandardsRegulationsListByBq(params);
-            }
-
         } else if (DictConstants.ROLE_CODE_SUBUESR.equals(roleCode)) {
             //查询父账户
             userId = AuthUtil.getCreateUserId();
             params.setUserId(userId);
-            if ((params.getXlk().equals("1") && params.getBq().equals("1")) || (params.getXlk().equals("0") && params.getBq().equals("0")) || (params.getXlk().equals("1") && params.getBq().equals("0"))) {
-                list = standardsRegulationsMapper.queryStandardsRegulationsListByQx(params);
-            } else if (params.getXlk().equals("0") && params.getBq().equals("1")) {
-                list = standardsRegulationsMapper.queryStandardsRegulationsListByBqAndQx(params);
-            }
-
+            list = standardsRegulationsMapper.queryStandardsRegulationsListByQx(params);
         } else if (DictConstants.ROLE_CODE_UESR.equals(roleCode)) {
             //查询普通账户
             params.setUserId(userId);
-            if ((params.getXlk().equals("1") && params.getBq().equals("1")) || (params.getXlk().equals("0") && params.getBq().equals("0")) || (params.getXlk().equals("1") && params.getBq().equals("0"))) {
-                list = standardsRegulationsMapper.queryStandardsRegulationsListByQx(params);
-            } else if (params.getXlk().equals("0") && params.getBq().equals("1")) {
-                list = standardsRegulationsMapper.queryStandardsRegulationsListByBqAndQx(params);
-            }
+            list = standardsRegulationsMapper.queryStandardsRegulationsListByQx(params);
         }
        /* if(params.getLabel()!=null&&params.getLabel().size()>0){
             if(params.getRegulationType()!=null&&params.getRegulationType().size()>0){
@@ -192,6 +168,23 @@ public class StandardsRegulationsService {
     }
 
 
+
+    public ResponseBodyVO<List<String>> queryRegulationType() {
+        //添加权限
+        String roleCode = AuthUtil.getCurrentUserRoleCode();
+        String userId = AuthUtil.getCurrentUserId();
+        if (DictConstants.ROLE_CODE_ADMIN.equals(roleCode) || DictConstants.ROLE_CODE_SYSADMIN.equals(roleCode)) { //管理员账户
+            userId="";
+        } else if (DictConstants.ROLE_CODE_SUBUESR.equals(roleCode)) {
+            //查询父账户
+            userId = AuthUtil.getCreateUserId();
+        }
+       List<String> list=  standardsRegulationsMapper.queryRegulationType(userId);
+
+        return new ResponseBodyVO(ResponseBodyVO.Response.SUCCESS, list);
+
+    }
+
     /**
      * 获取标准法规场景数据:
      */
@@ -250,9 +243,10 @@ public class StandardsRegulationsService {
                                     }
                                     String osgbAdress = OsgbPath + "/" + osgb;
                                     String xodrAdress = XodrPath + "/" + xodr;
-                                    String sceneId = standardsRegulationsMapper.queryStandardsRegulationsByName(sceneName);
-                                    standardsRegulationsPO.setRegulationsId(StringUtil.getRandomUUID());
+                                    standardsRegulationsPO.setShare("0");
                                     standardsRegulationsPO.setSceneName(sceneName);
+                                    StandardsRegulationsPO PoByName = standardsRegulationsMapper.queryStandardsRegulationsByName(standardsRegulationsPO);
+                                    standardsRegulationsPO.setRegulationsId(StringUtil.getRandomUUID());
                                     standardsRegulationsPO.setRegulationType(regulationType);
                                     standardsRegulationsPO.setStandardType(standardType);
                                     standardsRegulationsPO.setMaxTime(root.path("max_time").asText());
@@ -264,11 +258,11 @@ public class StandardsRegulationsService {
                                     if (ObjectUtil.isNull(standardsRegulationsPO.getXodrAddress())) {
                                         standardsRegulationsPO.setXodrAddress(xodrAdress);
                                     }
-                                    if (ObjectUtil.isNull(sceneId)) {
+                                    if (ObjectUtil.isNull(PoByName)) {
                                         isupdate = "0";
                                     } else {
                                         isupdate = "1";
-                                        standardsRegulationsPO.setRegulationsId(sceneId);
+                                        standardsRegulationsPO.setRegulationsId(PoByName.getRegulationsId());
                                     }
                                 }
                                 if (adress.contains(".json")) {

+ 38 - 93
simulation-resource-server/src/main/resources/mapper/scene/SceneAccidentMapper.xml

@@ -47,19 +47,15 @@
         create_user_id,create_time,modify_user_id,modify_time,
         is_deleted,share,video_address,video_preview,osgb_address,xml_address,xodr_address,
         json_address,max_time
-        from(
-        select
-        accident_id,scene_name,self_driving,target_driving,
-        self_reaction,conflict_behavior,conflict_type,
-        scence_resume,scene_time,scene_weather,
-        create_user_id,create_time,modify_user_id,modify_time,
-        is_deleted,share,video_address,video_preview,osgb_address,xml_address,xodr_address,
-        json_address,max_time
         from simulation.scene_accident
         <where>
+            is_deleted=0
             <if test="sceneName != null and sceneName != ''">
                 and scene_name like CONCAT('%',#{sceneName,jdbcType=VARCHAR},'%')
             </if>
+            <if test="share != null and share != ''">
+                and share =#{share}
+            </if>
             <if test="selfDriving != null and selfDriving.size()>0 ">
                 and self_driving in
                 <foreach collection="selfDriving" item="item" index="index"
@@ -110,43 +106,7 @@
                 </foreach>
             </if>
         </where>
-         <if test="bq != null and bq.equals(1)">
-            union
-            select
-            accident_id,scene_name,self_driving,target_driving,
-            self_reaction,conflict_behavior,conflict_type,
-             scence_resume,scene_time,scene_weather,
-            create_user_id,create_time,modify_user_id,modify_time,
-            is_deleted,share,video_address,video_preview,osgb_address,xml_address,xodr_address,
-            json_address,max_time
-            from simulation.scene_accident
-            <where>
-                <if test="rearEndCollision != null and rearEndCollision!=''">
-                    or conflict_behavior =#{rearEndCollision}
-                </if>
-                <if test="cutIn != null and cutIn!=''">
-                    or target_driving =#{cutIn}
-                </if>
-                <if test="driveCurve != null and driveCurve!=''">
-                    or target_driving =#{driveCurve}
-                </if>
-                <if test="carConflict != null and carConflict!=''">
-                    or conflict_type =#{carConflict}
-                </if>
-            </where>
-        </if>
-
-        ) a where
-        a.is_deleted = '0'
-        <if test="AllIds != null and AllIds.size()>0">
-            and a.accident_id in
-            <foreach collection="AllIds" item="item" index="index"
-                     separator="," open="(" close=")">
-                #{item}
-            </foreach>
-        </if>
-
-        order by a.modify_time desc
+        order by modify_time desc
     </select>
     <select id="querySceneAccidentListByBq" parameterType="api.common.pojo.param.scene.SceneAccidentParam"
             resultType="api.common.pojo.po.scene.SceneAccidentPO">
@@ -261,6 +221,9 @@
                     #{item}
                 </foreach>
             </if>
+            <if test="share != null and share != ''">
+                and share =#{share}
+            </if>
         </where>
 
         order by modify_time desc
@@ -283,13 +246,23 @@
     </update>
 
 
-    <select id="querySceneAccidentByNmae" parameterType="java.lang.String" resultType="java.lang.String">
+    <select id="querySceneAccidentByNmae" parameterType="api.common.pojo.po.scene.SceneAccidentPO" resultType="api.common.pojo.po.scene.SceneAccidentPO">
         select
-        accident_id  sceneId
+        accident_id ,share
         from simulation.scene_accident
-        where
-            is_deleted = '0'
-                and scene_name =#{sceneName,jdbcType=VARCHAR}
+        <where>
+        is_deleted = '0'
+        <if test="sceneName != null and sceneName != ''">
+            and scene_name =#{sceneName,jdbcType=VARCHAR}
+        </if>
+        <if test="share != null and share=='0'">
+            and share =#{share}
+        </if>
+        <if test="share != null and share!='0'">
+            and share !='0'
+        </if>
+
+        </where>
     </select>
 
 
@@ -326,14 +299,7 @@
 
     <select id="querySceneAccidentListByQx" 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,
-        scence_resume,scene_time,scene_weather,
-        create_user_id,create_time,modify_user_id,modify_time,
-        is_deleted,share,video_address,video_preview,osgb_address,xml_address,xodr_address,
-        json_address,max_time
-        from(
+
         select
         accident_id,scene_name,self_driving,target_driving,
         self_reaction,conflict_behavior,conflict_type,
@@ -399,39 +365,6 @@
                     #{item}
                 </foreach>
             </if>
-        </where>
-        <if test="bq != null and bq.equals(1)">
-            union
-            select
-            accident_id,scene_name,self_driving,target_driving,
-            self_reaction,conflict_behavior,conflict_type,
-            scence_resume,scene_time,scene_weather,
-            create_user_id,create_time,modify_user_id,modify_time,
-            is_deleted,share,video_address,video_preview,osgb_address,xml_address,xodr_address,
-            json_address,max_time
-            from ( select jt.* from( select s.scene_name
-            FROM system_scene_package p
-            JOIN system_user_scene u on p.id = u.package_id and u.is_deleted = '0' and p.is_deleted = '0'
-            JOIN system_scene_package_sublist s on p.id = s.scene_and_package
-            where scene_type='3' and  s.is_deleted = '0' and user_id=#{userId} group by s.scene_name)qx join  scene_accident jt on qx.scene_name=jt.scene_name) dd
-            <where>
-                <if test="rearEndCollision != null and rearEndCollision!=''">
-                    or conflict_behavior =#{rearEndCollision}
-                </if>
-                <if test="cutIn != null and cutIn!=''">
-                    or target_driving =#{cutIn}
-                </if>
-                <if test="driveCurve != null and driveCurve!=''">
-                    or target_driving =#{driveCurve}
-                </if>
-                <if test="carConflict != null and carConflict!=''">
-                    or conflict_type =#{carConflict}
-                </if>
-            </where>
-        </if>
-
-        ) a where
-        a.is_deleted = '0'
         <if test="AllIds != null and AllIds.size()>0">
             and a.accident_id in
             <foreach collection="AllIds" item="item" index="index"
@@ -439,8 +372,8 @@
                 #{item}
             </foreach>
         </if>
-
-        order by a.modify_time desc
+        </where>
+        order by cc.modify_time desc
     </select>
 
     <select id="querySceneAccidentListByBqAndQx" parameterType="api.common.pojo.param.scene.SceneAccidentParam"
@@ -489,4 +422,16 @@
         order by a.modify_time desc
     </select>
 
+
+    <select id="querySceneAccidentById" parameterType="java.lang.String" resultType="api.common.pojo.po.scene.SceneAccidentPO">
+        select
+       accident_id,scene_name,self_driving,target_driving,
+        self_reaction,conflict_behavior,conflict_type,
+        scence_resume,scene_time,scene_weather,
+       create_user_id,create_time,modify_user_id,modify_time,
+         is_deleted,share,video_preview,video_address,osgb_address,xml_address,xodr_address,
+        json_address,max_time
+        from simulation.scene_accident
+        where accident_id=#{id}
+    </select>
 </mapper>

+ 95 - 4
simulation-resource-server/src/main/resources/mapper/scene/SceneGeneralTemplateMapper.xml

@@ -11,7 +11,7 @@
         obs_lateral_acceleration,obs_longitudinal_acceleration,
         obs_heading_angle_rel,obs_velocity_status,obs_trajectory,obs_duration_time,obs_velocity_time,
         obs_trail_time,generalization_type,scenario_resume,scene_detailed_description,evaluating_indicator,
-        video_link,file_name,version,
+        video_link,file_name,version,share,
         create_user_id,create_time,modify_time,
         is_deleted,obs_type) values
         <foreach collection="list" index="index" item="item" separator=",">
@@ -22,13 +22,36 @@
             #{item.obsLateralAcceleration,jdbcType=VARCHAR}, #{item.obsLongitudinalAcceleration,jdbcType=VARCHAR},
             #{item.obsHeadingAngleRel,jdbcType=VARCHAR}, #{item.obsVelocityStatus,jdbcType=VARCHAR},#{item.obsTrajectory,jdbcType=VARCHAR},#{item.obsDurationTime,jdbcType=VARCHAR},#{item.obsVelocityTime,jdbcType=VARCHAR},
             #{item.obsTrailTime,jdbcType=VARCHAR}, #{item.generalizationType,jdbcType=VARCHAR},#{item.scenarioResume,jdbcType=VARCHAR},#{item.sceneDetailedDescription},#{item.evaluatingIndicator,jdbcType=VARCHAR},
-            #{item.videoLink},#{item.fileName},#{item.version},
+            #{item.videoLink},#{item.fileName},#{item.version},#{item.share},
 
             #{item.createUserId,jdbcType=VARCHAR},#{item.createTime},#{item.modifyTime},
             #{item.isDeleted,jdbcType=VARCHAR},#{item.obsType})
         </foreach>
     </insert>
 
+    <insert id="saveSceneGeneralTemplate" parameterType="api.common.pojo.po.scene.SceneGeneralTemplatePO">
+        insert into simulation.scene_general_template
+        (id,scene_id,scenario_name,scenario_weather,scenario_time,
+        scenario_vehicle_model,scenario_road_type,scenario_radius_curvature,ego_start_x,ego_start_y,
+        ego_start_velocity,ego_heading_angle,ego_velocity_status,ego_trajectory,ego_duration_time,
+        ego_velocity_time,ego_trajectory_time,obs_start_x,obs_start_y,obs_start_velocity,
+        obs_lateral_acceleration,obs_longitudinal_acceleration,
+        obs_heading_angle_rel,obs_velocity_status,obs_trajectory,obs_duration_time,obs_velocity_time,
+        obs_trail_time,generalization_type,scenario_resume,scene_detailed_description,evaluating_indicator,
+        video_link,file_name,version,share,
+        create_user_id,create_time,modify_time,
+        is_deleted,obs_type) values
+         (#{id,jdbcType=VARCHAR},#{sceneId,jdbcType=VARCHAR},#{scenarioName,jdbcType=VARCHAR},#{scenarioWeather,jdbcType=VARCHAR},#{scenarioTime,jdbcType=VARCHAR},
+            #{scenarioVehicleModel,jdbcType=VARCHAR}, #{scenarioRoadType,jdbcType=VARCHAR}, #{scenarioRadiusCurvature,jdbcType=VARCHAR},#{egoStartX,jdbcType=VARCHAR}, #{egoStartY,jdbcType=VARCHAR},
+            #{egoStartVelocity,jdbcType=VARCHAR}, #{egoHeadingAngle,jdbcType=VARCHAR},#{egoVelocityStatus,jdbcType=VARCHAR},#{egoTrajectory,jdbcType=VARCHAR},#{egoDurationTime,jdbcType=VARCHAR},
+            #{egoVelocityTime,jdbcType=VARCHAR}, #{egoTrajectoryTime,jdbcType=VARCHAR},#{obsStartX,jdbcType=VARCHAR},#{obsStartY,jdbcType=VARCHAR},#{obsStartVelocity,jdbcType=VARCHAR},
+            #{obsLateralAcceleration,jdbcType=VARCHAR}, #{obsLongitudinalAcceleration,jdbcType=VARCHAR},
+            #{obsHeadingAngleRel,jdbcType=VARCHAR}, #{obsVelocityStatus,jdbcType=VARCHAR},#{obsTrajectory,jdbcType=VARCHAR},#{obsDurationTime,jdbcType=VARCHAR},#{obsVelocityTime,jdbcType=VARCHAR},
+            #{obsTrailTime,jdbcType=VARCHAR}, #{generalizationType,jdbcType=VARCHAR},#{scenarioResume,jdbcType=VARCHAR},#{sceneDetailedDescription},#{evaluatingIndicator,jdbcType=VARCHAR},
+            #{videoLink},#{fileName},#{version},#{share},
+            #{createUserId,jdbcType=VARCHAR},#{createTime},#{modifyTime},
+            #{isDeleted,jdbcType=VARCHAR},#{obsType})
+    </insert>
     <select id="querySceneGeneralTemplateList" parameterType="api.common.pojo.param.scene.SceneGeneralTemplateParam"
             resultType="api.common.pojo.po.scene.SceneGeneralTemplatePO">
         select
@@ -39,7 +62,7 @@
         obs_lateral_acceleration,obs_longitudinal_acceleration,
         obs_heading_angle_rel,obs_velocity_status,obs_trajectory,obs_duration_time,obs_velocity_time,
         obs_trail_time,generalization_type,scenario_resume,scene_detailed_description,evaluating_indicator,
-        video_link,file_name,version,
+        video_link,file_name,version,share,
         create_user_id,create_time,modify_time,obs_type
         from simulation.scene_general_template
         <where>
@@ -73,6 +96,9 @@
             <if test="obsType != null and obsType != ''">
                 and obs_type= #{obsType}
             </if>
+            <if test="share != null and share != ''">
+                and share= #{share}
+            </if>
             <if test="allSceneNames != null and allSceneNames.length>0">
                 and scene_id in
                 <foreach collection="allSceneNames" item="item" index="index"
@@ -166,7 +192,7 @@
         obs_lateral_acceleration,obs_longitudinal_acceleration,
         obs_heading_angle_rel,obs_velocity_status,obs_trajectory,obs_duration_time,obs_velocity_time,
         obs_trail_time,generalization_type,scenario_resume,scene_detailed_description,evaluating_indicator,
-        video_link,file_name,version,
+        video_link,file_name,version,share,
         create_user_id,create_time,modify_time
         from (select fh.* from( select s.scene_name
         FROM system_scene_package p
@@ -201,6 +227,9 @@
             <if test="version != null and version != ''">
                 and version= #{version}
             </if>
+            <if test="share != null and share != ''">
+                and share= #{share}
+            </if>
             <if test="allSceneNames != null and allSceneNames.length>0">
                 and scene_id in
                 <foreach collection="allSceneNames" item="item" index="index"
@@ -218,4 +247,66 @@
             order by modify_time desc
         </where>
     </select>
+
+    <select id="querySceneGeneralTemplateByName" parameterType="api.common.pojo.po.scene.SceneGeneralTemplatePO" resultType="api.common.pojo.po.scene.SceneGeneralTemplatePO">
+        select id,share
+        from simulation.scene_general_template
+        <where >
+            is_deleted = '0'
+            <if test="sceneId != null and sceneId!=''">
+                and scene_id =#{sceneId}
+            </if>
+            <if test="share != null and share=='0'">
+                and share =#{share}
+            </if>
+            <if test="share != null and share!='0'">
+                and share !='0'
+            </if>
+        </where>
+    </select>
+
+    <update id="updateSceneGeneralTemplate" parameterType="api.common.pojo.po.scene.SceneGeneralTemplatePO">
+        update simulation.scene_general_template
+        set scene_id=#{sceneId,jdbcType=VARCHAR},
+        scenario_name=#{scenarioName,jdbcType=VARCHAR},
+        scenario_weather=#{scenarioWeather,jdbcType=VARCHAR},
+        scenario_time=#{scenarioTime,jdbcType=VARCHAR},
+        scenario_vehicle_model= #{scenarioVehicleModel,jdbcType=VARCHAR},
+        scenario_road_type=#{scenarioRoadType,jdbcType=VARCHAR},
+        scenario_radius_curvature= #{scenarioRadiusCurvature,jdbcType=VARCHAR},
+        ego_start_x= #{egoStartX,jdbcType=VARCHAR},
+        ego_start_y= #{egoStartY,jdbcType=VARCHAR},
+        ego_start_velocity= #{egoStartVelocity,jdbcType=VARCHAR},
+        ego_heading_angle=#{egoHeadingAngle,jdbcType=VARCHAR},
+        ego_velocity_status=#{egoVelocityStatus,jdbcType=VARCHAR},
+        ego_trajectory= #{egoTrajectory,jdbcType=VARCHAR},
+        ego_duration_time= #{egoDurationTime,jdbcType=VARCHAR},
+        ego_velocity_time=#{egoVelocityTime,jdbcType=VARCHAR},
+        ego_trajectory_time=#{egoTrajectoryTime,jdbcType=VARCHAR},
+        obs_start_x=#{obsStartX,jdbcType=VARCHAR},
+        obs_start_y=#{obsStartY,jdbcType=VARCHAR},
+        obs_start_velocity=#{obsStartVelocity,jdbcType=VARCHAR},
+        obs_lateral_acceleration=#{obsLateralAcceleration,jdbcType=VARCHAR},
+        obs_longitudinal_acceleration=#{obsLongitudinalAcceleration,jdbcType=VARCHAR},
+        obs_heading_angle_rel=#{obsHeadingAngleRel,jdbcType=VARCHAR},
+        obs_velocity_status=#{obsVelocityStatus,jdbcType=VARCHAR},
+        obs_trajectory=#{obsTrajectory,jdbcType=VARCHAR},
+        obs_duration_time=#{obsDurationTime,jdbcType=VARCHAR},
+        obs_velocity_time=#{obsVelocityTime,jdbcType=VARCHAR},
+        obs_trail_time=#{obsTrailTime,jdbcType=VARCHAR},
+        generalization_type= #{generalizationType,jdbcType=VARCHAR},
+        scenario_resume=#{scenarioResume,jdbcType=VARCHAR},
+        scene_detailed_description=#{sceneDetailedDescription},
+        evaluating_indicator=#{evaluatingIndicator,jdbcType=VARCHAR},
+        video_link=#{videoLink},
+        file_name=#{fileName},
+        version= #{version},
+        share=#{share},
+        create_user_id=#{createUserId,jdbcType=VARCHAR},
+        create_time=#{createTime},
+        modify_time=#{modifyTime},
+        is_deleted=#{isDeleted,jdbcType=VARCHAR},
+        obs_type=#{obsType}
+        where id = #{id,jdbcType=VARCHAR}
+    </update>
 </mapper>

+ 37 - 3
simulation-resource-server/src/main/resources/mapper/scene/SceneNaturalMapper.xml

@@ -359,6 +359,9 @@
                     #{item}
                 </foreach>
             </if>
+            <if test="share != null and share != ''">
+                and share =#{share}
+            </if>
             order by modify_time desc
         </where>
     </select>
@@ -380,10 +383,21 @@
     </update>
 
 
-    <select id="querySceneNaturaByName" parameterType="java.lang.String" resultType="java.lang.String">
-        select natural_id
+    <select id="querySceneNaturaByName" parameterType="api.common.pojo.po.scene.SceneNaturalPO" resultType="api.common.pojo.po.scene.SceneNaturalPO">
+        select natural_id,share
         from simulation.scene_natural
-        where is_deleted = '0' and natural_name =#{naturalName}
+        <where >
+            is_deleted = '0'
+            <if test="naturalName != null and naturalName!=''">
+                and natural_name =#{naturalName}
+            </if>
+            <if test="share != null and share=='0'">
+                and share =#{share}
+            </if>
+            <if test="share != null and share!='0'">
+                and share !='0'
+            </if>
+        </where>
     </select>
 
     <select id="querySceneNumBySy" parameterType="api.common.pojo.param.scene.SceneNaturalParam" resultType="java.lang.Integer">
@@ -1644,6 +1658,9 @@
                     #{item}
                 </foreach>
             </if>
+            <if test="share != null and share != ''">
+                and share =#{share}
+            </if>
             order by modify_time desc
         </where>
     </select>
@@ -2565,4 +2582,21 @@
         </where>
     </select>
 
+    <select id="querySceneNaturalById" parameterType="java.lang.String"
+            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,ramp,
+    intersection_type,plane_intersection,bridge,tunnel,
+    speed_limit,min_speed_limit,no_entry,no_stopping,
+    left_lane_line,right_lane_line,conductor_marking,pedestrian_crossing,
+    traffic_light,deceleration_marking,pavement_condition,natural_disaster,
+    road_safety_signs,safety_warning_board,traffic_accident,patency,
+    special_vehicle_yield,violation,double_flashing_car,self_behavior,
+    target_behavior,create_user_id,create_time,modify_user_id,modify_time,
+    is_deleted,share,video_preview,video_address,osgb_address,xodr_address,xosc_address,
+    json_address,max_time from scene_natural where natural_id=#{id}
+    </select>
+
 </mapper>

+ 33 - 27
simulation-resource-server/src/main/resources/mapper/scene/StandardsRegulationsMapper.xml

@@ -47,9 +47,8 @@
         xml_address,xodr_address,json_address,video_preview,max_time
         from simulation.scene_standards_regulations
         <where>
-            (is_deleted = '0'
-            <if test=
-                        "sceneName != null and sceneName != ''">
+            is_deleted = '0'
+            <if test="sceneName != null and sceneName != ''">
                 and scene_name like CONCAT('%',#{sceneName,jdbcType=VARCHAR},'%')
             </if>
             <if test="regulationType != null and regulationType.size()>0">
@@ -83,14 +82,8 @@
                     #{item}
                 </foreach>
             </if>
-            )
-            <if test="label != null and label.size()>0">
-                or (regulation_type in
-                <foreach collection="label" item="item" index="index"
-                         separator="," open="(" close=")">
-                    #{item}
-                </foreach>
-                and is_deleted = '0')
+            <if test="share != null and share != ''">
+               and share=#{share}
             </if>
         </where>
         order by modify_time desc
@@ -142,13 +135,22 @@
         where regulations_id = #{regulationsId,jdbcType=VARCHAR}
     </update>
 
-    <select id="queryStandardsRegulationsByName" parameterType="java.lang.String"
-            resultType="java.lang.String">
-        select regulations_id
+    <select id="queryStandardsRegulationsByName" parameterType="api.common.pojo.po.scene.StandardsRegulationsPO"
+            resultType="api.common.pojo.po.scene.StandardsRegulationsPO">
+        select regulations_id,share
         from simulation.scene_standards_regulations
-        where is_deleted = '0'
+        <where>
+        is_deleted = '0'
+        <if test="sceneName != null and sceneName!=''">
           and scene_name = #{sceneName,jdbcType=VARCHAR}
-
+        </if>
+        <if test="share != null and share=='0'">
+             and share =#{share}
+        </if>
+        <if test="share != null and share!='0'">
+           and share !='0'
+        </if>
+        </where>
     </select>
 
     <update id="updateStandardsRegulations" parameterType="api.common.pojo.po.scene.StandardsRegulationsPO">
@@ -192,9 +194,8 @@
         where scene_type='2' and s.is_deleted = '0' and user_id=#{userId} group by s.scene_name)qx join
         scene_standards_regulations bz on qx.scene_name=bz.scene_name) dd
         <where>
-            (is_deleted = '0'
-            <if test=
-                        "sceneName != null and sceneName != ''">
+            is_deleted = '0'
+            <if test="sceneName != null and sceneName != ''">
                 and scene_name like CONCAT('%',#{sceneName,jdbcType=VARCHAR},'%')
             </if>
             <if test="regulationType != null and regulationType.size()>0">
@@ -228,14 +229,9 @@
                     #{item}
                 </foreach>
             </if>
-            )
-            <if test="label != null and label.size()>0">
-                or (regulation_type in
-                <foreach collection="label" item="item" index="index"
-                         separator="," open="(" close=")">
-                    #{item}
-                </foreach>
-                and is_deleted = '0')
+
+            <if test="share != null and share != ''">
+                and share =#{share}
             </if>
         </where>
         order by modify_time desc
@@ -277,4 +273,14 @@
         order by modify_time desc
 
     </select>
+
+    <select id="queryStandardsRegulationsById" parameterType="java.lang.String"
+            resultType="api.common.pojo.po.scene.StandardsRegulationsPO">
+        select regulations_id, scene_name, regulation_type, standard_type,
+         create_user_id, create_time, modify_user_id, modify_time,
+         is_deleted, share, video_preview, video_address, osgb_address, xml_address, xodr_address,
+         json_address, max_time
+        from simulation.scene_standards_regulations
+     where regulations_id=#{id}
+    </select>
 </mapper>