Prechádzať zdrojové kódy

场景库模块代码

wangzhiqiang 3 rokov pred
rodič
commit
7e1fe83794
18 zmenil súbory, kde vykonal 96 pridanie a 54 odobranie
  1. 1 1
      api-common/src/main/java/api/common/pojo/param/scene/SceneAccidentParam.java
  2. 1 0
      api-common/src/main/java/api/common/pojo/param/scene/SceneNaturalNewParam.java
  3. 1 0
      api-common/src/main/java/api/common/pojo/param/scene/SceneNaturalParam.java
  4. 1 1
      api-common/src/main/java/api/common/pojo/param/scene/StandardsRegulationsParam.java
  5. 4 0
      api-common/src/main/java/api/common/pojo/vo/scene/ScenePackageVO.java
  6. 2 0
      simulation-resource-server/src/main/java/com/css/simulation/resource/scene/ctrl/FileController.java
  7. 0 3
      simulation-resource-server/src/main/java/com/css/simulation/resource/scene/ctrl/SceneNaturalController.java
  8. 13 3
      simulation-resource-server/src/main/java/com/css/simulation/resource/scene/ctrl/ScenePackageController.java
  9. 9 23
      simulation-resource-server/src/main/java/com/css/simulation/resource/scene/ctrl/ScoringRulesController.java
  10. 1 0
      simulation-resource-server/src/main/java/com/css/simulation/resource/scene/service/SceneAccidentService.java
  11. 7 4
      simulation-resource-server/src/main/java/com/css/simulation/resource/scene/service/SceneNaturalService.java
  12. 23 10
      simulation-resource-server/src/main/java/com/css/simulation/resource/scene/service/ScenePackageService.java
  13. 8 1
      simulation-resource-server/src/main/resources/mapper/scene/SceneAccidentMapper.xml
  14. 8 1
      simulation-resource-server/src/main/resources/mapper/scene/SceneNaturalMapper.xml
  15. 7 4
      simulation-resource-server/src/main/resources/mapper/scene/ScenePackageMapper.xml
  16. 1 1
      simulation-resource-server/src/main/resources/mapper/scene/ScenePackageSublistMapper.xml
  17. 1 1
      simulation-resource-server/src/main/resources/mapper/scene/ScoringRulesMapper.xml
  18. 8 1
      simulation-resource-server/src/main/resources/mapper/scene/StandardsRegulationsMapper.xml

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

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

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

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

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

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

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

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

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

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

+ 2 - 0
simulation-resource-server/src/main/java/com/css/simulation/resource/scene/ctrl/FileController.java

@@ -62,6 +62,8 @@ public class FileController {
             map.put("videoPreview",videoPreview);
             map.put("fileName",fileName);
 
+            log.info("上穿成功--------"+fileName);
+
             return new ResponseBodyVO(ResponseBodyVO.Response.SUCCESS,map);
         }
         return new ResponseBodyVO(ResponseBodyVO.Response.CLIENT_FAILURE,"文件流file为空,请检查!");

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

@@ -6,13 +6,10 @@ import api.common.pojo.param.scene.SceneNaturalParam;
 import api.common.pojo.po.scene.SceneNaturalPO;
 import api.common.pojo.vo.scene.SceneNaturalVO;
 import com.css.simulation.resource.common.utils.PageUtil;
-import com.css.simulation.resource.feign.FileDownService;
 import com.css.simulation.resource.scene.service.SceneNaturalService;
 import com.github.pagehelper.PageInfo;
 import org.springframework.beans.BeanUtils;
-import org.springframework.http.MediaType;
 import org.springframework.web.bind.annotation.*;
-import org.springframework.web.multipart.MultipartFile;
 
 import javax.annotation.Resource;
 import java.util.ArrayList;

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

@@ -18,6 +18,7 @@ import org.springframework.web.bind.annotation.*;
 import javax.annotation.Resource;
 import java.util.ArrayList;
 import java.util.List;
+import java.util.Map;
 
 //测试包
 @RestController
@@ -49,15 +50,24 @@ public class ScenePackageController {
     //新增测试包
     @PostMapping("/saveScenePackage")
     @ResponseBody
-    public ResponseBodyVO<String> saveScoringRules(@RequestBody List<ScenePackageSublistVO> parms) {
+    public ResponseBodyVO<String> saveScoringRules(@RequestBody Map<String,List<ScenePackageSublistVO>> map) {
 
-        return scenePackageService.saveScenePackage(parms);
+        List<ScenePackageSublistVO> params= map.get("params");
+        if(params==null||params.size()<1) {
+            return new ResponseBodyVO(ResponseBodyVO.Response.CLIENT_FAILURE,"参数不能为空,请检查");
+                }else if(params.get(0).getId()==null || params.get(0).getPackageLevel()==1){
+                        params.get(0).setId("");
+                        return scenePackageService.saveScenePackage(params);
+                 }else{
+                return  scenePackageService.updateScenePackage(params);
+            }
     }
 
     //修改
     @PostMapping("/updateScenePackage")
     @ResponseBody
-    public ResponseBodyVO<String> updateScenePackage(@RequestBody List<ScenePackageSublistVO> params)  {
+    public ResponseBodyVO<String> updateScenePackage(@RequestBody Map<String,List<ScenePackageSublistVO>> map)  {
+        List<ScenePackageSublistVO> params= map.get("params");
         return  scenePackageService.updateScenePackage(params);
     }
 

+ 9 - 23
simulation-resource-server/src/main/java/com/css/simulation/resource/scene/ctrl/ScoringRulesController.java

@@ -113,29 +113,15 @@ public class ScoringRulesController {
         return new ResponseBodyVO<>(ResponseBodyVO.Response.SUCCESS);
     }
 
-/*
 
-    @Resource
-    private FileDownService fileDownService;
-
-    @PostMapping(value = "/upload", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
-    public ResponseBodyVO<String> upload(@RequestPart("file") MultipartFile file,
-                                         @RequestParam("objectName") String objectName) {
-        System.out.println("上传文件名称--------"+file.getOriginalFilename());
-        return fileDownService.upload(file,file.getOriginalFilename());
-    }
-
-@GetMapping(value = "/download")
-    public void download(
-            HttpServletResponse response
-    ) throws IOException {
-    MinioParameter parms=new MinioParameter();
-    parms.setObjectName("new4.txt");
-        Response download = fileDownService.download(parms);
-        Response.Body body = download.body();
-        InputStream inputStream = body.asInputStream();
-        FileUtil.downloadForHttp(parms.getObjectName(), inputStream, response, 1024);
+    //测试包查询列表
+    @PostMapping("/queryCsb")
+    @ResponseBody
+    public ResponseBodyVO<List<ScoringRulesPO>> queryCsb() {
+        ScoringRulesParam params=new ScoringRulesParam();
+        params.setShare("0");
+        params.setCreateUserId(AuthUtil.getCurrentUserId());
+        List<ScoringRulesPO> list=scoringRulesService.queryScoringRulesList(params);
+        return new ResponseBodyVO(ResponseBodyVO.Response.SUCCESS,list);
     }
-*/
-
 }

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

@@ -170,6 +170,7 @@ public class SceneAccidentService {
     }
 
     public   List<SceneAccidentPO> querySceneAccidentList(SceneAccidentParam params) {
+
         List<SceneAccidentPO> list = SceneAccidentMapper.querySceneAccidentList(params);
         return list;
     }

+ 7 - 4
simulation-resource-server/src/main/java/com/css/simulation/resource/scene/service/SceneNaturalService.java

@@ -49,10 +49,10 @@ public class SceneNaturalService {
         int end=param.getJsonAddress().lastIndexOf(".");
        String  fileName=param.getJsonAddress().substring(idx+1,end);
         param.setNaturalName(fileName);
-      List<SceneNaturalPO> list=  sceneNaturalMapper.querySceneNaturaByName(param);
-      if(list!=null && list.size()>0){
-          return new ResponseBodyVO(ResponseBodyVO.Response.CLIENT_FAILURE,"该场景编号"+ fileName+"已存在,请检查");
-      }
+          List<SceneNaturalPO> list=  sceneNaturalMapper.querySceneNaturaByName(param);
+          if(list!=null && list.size()>0){
+              return new ResponseBodyVO(ResponseBodyVO.Response.CLIENT_FAILURE,"该场景编号"+ fileName+"已存在,请检查");
+          }
         Response download = fileDownService.download(MI);
                 String json =download.body().toString();
                     ObjectMapper objMap = new ObjectMapper();
@@ -197,6 +197,9 @@ public class SceneNaturalService {
         String[][] trafficCondition =params.getTrafficCondition(); //交通状况
          String[][] selfBehavior =params.getSelfBehavior() ;//自车行为
         String[][] targetBehavior =params.getTargetBehavior(); //目标行为
+        if(ObjectUtil.isNotNull(params.getIds()))   {
+            po.setIds(params.getIds());
+        }
         if(ObjectUtil.isNotNull(naturalName))   {
             po.setNaturalName(naturalName);
         }

+ 23 - 10
simulation-resource-server/src/main/java/com/css/simulation/resource/scene/service/ScenePackageService.java

@@ -1,7 +1,6 @@
 package com.css.simulation.resource.scene.service;
 
 import api.common.pojo.common.ResponseBodyVO;
-import api.common.pojo.param.scene.ScenePackageNewParam;
 import api.common.pojo.param.scene.ScenePackageParam;
 import api.common.pojo.po.scene.ScenePackagePO;
 import api.common.pojo.po.scene.ScenePackageSublistPO;
@@ -44,7 +43,6 @@ public class ScenePackageService {
         List<ScenePackageSublistVO> listSublictTree=new ArrayList<>();
         ScenePackagePO po=new ScenePackagePO();
         for (ScenePackageSublistVO vo:params) {
-           //判断唯一
              po.setPackageName(vo.getSublistName());
             po.setCreateUserId(AuthUtil.getCurrentUserId());
             po.setShare("0");
@@ -64,9 +62,14 @@ public class ScenePackageService {
         String uuId=StringUtil.getRandomUUID();
         po.setPackageId(uuId);
         po.setIsDeleted("0");
-        scenePackageMapper.saveScenePackage(po);
+        po.setCreateUserId(AuthUtil.getCurrentUserId());
+
         List<ScenePackageSublistPO>  poList=new ArrayList<>();
         List<ScenePackageSublistPO> treeList =instShareListTree(listSublictTree,uuId,uuId,poList,"0");
+        if(treeList==null||treeList.size()<1){
+            return new ResponseBodyVO(ResponseBodyVO.Response.CLIENT_FAILURE,"指标数据为空,请检查");
+        }
+        scenePackageMapper.saveScenePackage(po);
         scenePackageSublistMapper.saveScenePackageSublistAll(treeList);
         return new ResponseBodyVO(ResponseBodyVO.Response.SUCCESS);
     }
@@ -87,6 +90,7 @@ public class ScenePackageService {
             po.setPackageName(vo.getSublistName());
             po.setCreateUserId(AuthUtil.getCurrentUserId());
             po.setShare("0");
+            po.setPackageId(vo.getId());
             List<ScenePackageNewVO> listName=scenePackageMapper.queryByPackageName(po);
             if(listName!=null && listName.size()>0){
                 return new ResponseBodyVO(ResponseBodyVO.Response.CLIENT_FAILURE,"测试包名称packName="+po.getPackageName()+"已存在,请重新命名");
@@ -102,11 +106,13 @@ public class ScenePackageService {
         po.setModifyUserId(AuthUtil.getCurrentUserId());
         po.setIsDeleted("0");
         po.setShare("0");
-        scenePackageMapper.updateScenePackage(po);
-        scenePackageSublistMapper.deleteScenePackageSublist(po.getPackageId());
-        //List<ScenePackageSublistVO> list=params.getList();
         List<ScenePackageSublistPO>  poList=new ArrayList<>();
         List<ScenePackageSublistPO> treeList =instShareListTree(listSublictTree,po.getPackageId(),po.getPackageId(),poList,"0");
+        if(treeList==null||treeList.size()<1){
+            return new ResponseBodyVO(ResponseBodyVO.Response.CLIENT_FAILURE,"指标数据为空,请检查");
+        }
+        scenePackageMapper.updateScenePackage(po);
+        scenePackageSublistMapper.deleteScenePackageSublist(po.getPackageId());
         scenePackageSublistMapper.saveScenePackageSublistAll(treeList);
         return new ResponseBodyVO(ResponseBodyVO.Response.SUCCESS);
     }
@@ -115,7 +121,7 @@ public class ScenePackageService {
     @SneakyThrows
     public   void deleteList(ScenePackageParam params) {
         ScenePackagePO po=new ScenePackagePO();
-        po.setModifyUserId(StringUtil.getRandomUUID());
+        po.setModifyUserId(AuthUtil.getCurrentUserId());
         po.setModifyTime(TimeUtil.getNowForMysql());
         po.setIsDeleted("1");
         po.setPackageId(params.getPackageId());
@@ -127,6 +133,8 @@ public class ScenePackageService {
     @SneakyThrows
     public List<ScenePackageSublistVO> queryScenePackageSublistList(ScenePackageParam params){
         ScenePackageNewVO vo = scenePackageMapper.queryScenePackageBySublist(params.getPackageId());
+        log.info(params.getPackageId()+"------params.getPackageId()");
+        log.info(vo+"------vo-----)"+vo.getPackageId());
         ScenePackageSublistPO po = new ScenePackageSublistPO();
         po.setRootId(params.getPackageId());
         List<ScenePackageSublistVO> scenePackageSublistVOS = scenePackageSublistMapper.queryScenePackageSublistList(po);
@@ -211,13 +219,15 @@ public class ScenePackageService {
     @SneakyThrows
     public ResponseBodyVO<String> instShareList(ScenePackageParam params){
         //查询测试包主表
+
         ScenePackagePO scenePackagePO=scenePackageMapper.queryScenePackage(params);
+
         ScenePackagePO po=new ScenePackagePO();
         po.setShare("1");
-
+        po.setPackageName(scenePackagePO.getPackageName());
         List<ScenePackageNewVO> listName=scenePackageMapper.queryByPackageName(po);
         if(listName!=null && listName.size()>0){
-            return new ResponseBodyVO(ResponseBodyVO.Response.CLIENT_FAILURE,"公有列表名称packName="+po.getPackageName()+"的测试包已存在,请检查");
+            return new ResponseBodyVO(ResponseBodyVO.Response.CLIENT_FAILURE,"公有列表名称packName="+listName.get(0).getPackageName()+"的测试包已存在,请检查");
         }
         BeanUtils.copyProperties(scenePackagePO,po);
         po.setCreateTime(TimeUtil.getNowForMysql());
@@ -227,6 +237,7 @@ public class ScenePackageService {
         String uuId=StringUtil.getRandomUUID();
         po.setPackageId(uuId);
         po.setIsDeleted("0");
+        po.setShare("1");
         scenePackageMapper.saveScenePackage(po);
         List<ScenePackageSublistPO>  poList=new ArrayList<>();
         List<ScenePackageSublistVO> listSublist =selectScenePackageSubListTree(null,true,params.getPackageId());
@@ -245,7 +256,7 @@ public class ScenePackageService {
                                                                 ,String share){
         {
             //获取子节点集合
-
+                int a=1;
                 for (int i=0;i< parentVoList.size() ;i++) {
                 ScenePackageSublistPO params=new ScenePackageSublistPO();
                 BeanUtils.copyProperties(parentVoList.get(i),params);
@@ -259,6 +270,7 @@ public class ScenePackageService {
                 params.setId(uuId);   //主键ID
                 params.setIsDeleted("0");
                 params.setShare(share);
+                params.setSeq(a);
                 List<ScenePackageSublistVO> cvoList = parentVoList.get(i).getChildren();
                 poList.add(params);
                 if(cvoList != null && cvoList.size() > 0){
@@ -267,6 +279,7 @@ public class ScenePackageService {
                 }
                 parentVoList.remove(parentVoList.get(i));
                 i--;
+                a++;
             }
         }
 

+ 8 - 1
simulation-resource-server/src/main/resources/mapper/scene/SceneAccidentMapper.xml

@@ -67,7 +67,14 @@
                     #{item}
                 </foreach>
             </if>
-            order by create_time desc
+            <if test="ids != null and ids.length>0">
+                and   accident_id  in
+                <foreach collection="ids" item="item" index="index"
+                         separator="," open="(" close=")">
+                    #{item}
+                </foreach>
+            </if>
+            order by modify_time desc
         </where>
     </select>
 

+ 8 - 1
simulation-resource-server/src/main/resources/mapper/scene/SceneNaturalMapper.xml

@@ -296,7 +296,14 @@
                     #{item}
                 </foreach>
             </if>
-            order by create_time desc
+            <if test="ids != null and ids.length>0">
+                and   natural_id  in
+                <foreach collection="ids" item="item" index="index"
+                         separator="," open="(" close=")">
+                    #{item}
+                </foreach>
+            </if>
+            order by modify_time desc
         </where>
     </select>
 

+ 7 - 4
simulation-resource-server/src/main/resources/mapper/scene/ScenePackageMapper.xml

@@ -44,7 +44,7 @@
                 and create_user_id=#{createUserId,jdbcType=VARCHAR}
             </if>
 
-            order by a.create_time desc
+            order by a.modify_time,a.create_time desc
         </where>
     </select>
 
@@ -76,7 +76,7 @@
             <if test="share != null and share != ''">
                 and share=#{share,jdbcType=VARCHAR}
             </if>
-            order by a.create_time desc
+            order by a.modify_time desc
         </where>
     </select>
 
@@ -99,7 +99,10 @@
                 is_deleted = #{isDeleted,jdbcType=VARCHAR},
             </if>
             <if test="packageName != null and packageName!=''">
-                package_name = #{share,jdbcType=VARCHAR},
+                package_name = #{packageName,jdbcType=VARCHAR},
+            </if>
+            <if test="share != null and share!=''">
+                share = #{share,jdbcType=VARCHAR},
             </if>
             <if test="weight != null and weight!=''">
                 weight = #{weight,jdbcType=VARCHAR},
@@ -108,7 +111,7 @@
                 scene_num = #{sceneNum},
             </if>
             <if test="remarks != null and remarks!=''">
-                remarks = #{ruleDetails},
+                remarks = #{remarks},
             </if>
 
             <if test="modifyUserId != null and modifyUserId!=''">

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

@@ -61,7 +61,7 @@
             <if test="rootId != null and rootId != ''">
                 and a.root_id = #{rootId}
             </if>
-            order by a.seq,a.create_time
+            order by a.modify_time,a.seq
         </where>
     </select>
 

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

@@ -43,7 +43,7 @@
                 and create_user_id=#{createUserId,jdbcType=VARCHAR}
             </if>
 
-            order by create_time desc
+            order by modify_time desc
         </where>
     </select>
     <select id="queryScoringRules" parameterType="api.common.pojo.param.scene.ScoringRulesParam" resultType="api.common.pojo.po.scene.ScoringRulesPO">

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

@@ -40,7 +40,14 @@
             <if test="standardType != null and standardType != ''">
                 and standard_type like CONCAT('%',#{standardType,jdbcType=VARCHAR},'%')
             </if>
-            order by create_time desc
+            <if test="ids != null and ids.length>0">
+                and   regulations_id  in
+                <foreach collection="ids" item="item" index="index"
+                         separator="," open="(" close=")">
+                    #{item}
+                </foreach>
+            </if>
+            order by modify_time desc
         </where>
     </select>