Pārlūkot izejas kodu

王耀栋--工作台模块代码,修改打包下载功能,查询场景信息修改为同时查询已删除信息

wangyaodong 3 gadi atpakaļ
vecāks
revīzija
c9e9b1f40b

+ 36 - 26
simulation-resource-server/src/main/java/com/css/simulation/resource/project/impl/SimulationProjectServiceImpl.java

@@ -3282,17 +3282,11 @@ public class SimulationProjectServiceImpl implements SimulationProjectService {
             response.setHeader("Content-Disposition", "attachment;fileName=" + URLEncoder.encode("运行任务包.zip", "UTF-8"));
             zos = new ZipOutputStream(response.getOutputStream());
             int i = 1;
+            String egoFile= "Ego.csv";
             for(ManualProjectTaskVo v : manualProjectTaskVos){
                 String runResultFilePath = v.getRunResultFilePath();
                 if(!isEmpty(runResultFilePath)){
 
-                    MinioParameter minioParameter = new MinioParameter();
-                    minioParameter.setObjectName(runResultFilePath+"/Ego.csv");
-                    Response download = fileDownService.download(minioParameter);
-                    Response.Body body = download.body();
-                    inputStream = body.asInputStream();
-                    in =  new BufferedInputStream(inputStream);
-
                     //获取场景名
                     SceneBaseInfoVo sceneBaseInfoVo = getsceneNameAndOther(v.getSceneId(), v.getSceneType());
                     String sceneName = sceneBaseInfoVo.getCommonSceneName();
@@ -3301,33 +3295,25 @@ public class SimulationProjectServiceImpl implements SimulationProjectService {
                     String taskPagePath = rootPath+File.separator+sceneName+"("+i+")";
 //                    FileUtil.createDirectory(taskPagePath);
 
-                    //任务文件路径
-                    String taskFilePath = taskPagePath +File.separator+ ".Ego.csv";
-//                    FileUtil.writeInputStreamToLocalFile(inputStream,taskFilePath);
-
-                    ZipEntry entry = new ZipEntry(taskFilePath);
-                    in = new BufferedInputStream(inputStream);
-                    zos.putNextEntry(entry);
-                    while ((len = in.read(buffer)) != -1 ) {
-                        zos.write(buffer, 0, len);
-                    }
-
                     //视频文件路径
                     MinioParameter minioParameter1 = new MinioParameter();
                     minioParameter1.setObjectName(runResultFilePath);
                     ResponseBodyVO<List<String>> list = fileDownService.list(minioParameter1);
                     List<String> info = list.getInfo();
                     for(String s : info){
-                        String videoPath = "";
+                        String fileName = "";
+                        String zipPath = "";
+                        //获取文件名
+                        if(s.contains("/")){
+                            fileName = s.substring(s.lastIndexOf("/")+1);
+                        }else{
+                            fileName = s.substring(s.lastIndexOf("\\")+1);
+                        }
+                        zipPath = taskPagePath + File.separator + fileName;
+                        //文件后缀
                         String substring = s.substring(s.lastIndexOf(".") + 1);
                         if("mp4".equals(substring)){
                             //mp4视频文件导出
-                            if(s.contains("/")){
-                                videoPath = taskPagePath + File.separator + s.substring(s.lastIndexOf("/")+1);
-                            }else{
-                                videoPath = taskPagePath + File.separator + s.substring(s.lastIndexOf("\\")+1);
-                            }
-
                             MinioParameter minioParameter2 = new MinioParameter();
                             minioParameter2.setObjectName(s);
                             Response download2 = fileDownService.download(minioParameter2);
@@ -3335,12 +3321,36 @@ public class SimulationProjectServiceImpl implements SimulationProjectService {
                             inputStream = body2.asInputStream();
                             in = new BufferedInputStream(inputStream);
 
-                            ZipEntry entry2 = new ZipEntry(videoPath);
+                            ZipEntry entry2 = new ZipEntry(zipPath);
                             zos.putNextEntry(entry2);
                             while ((len = in.read(buffer)) != -1 ) {
                                 zos.write(buffer, 0, len);
                             }
 
+                        }else if(egoFile.equals(fileName)){
+
+                            MinioParameter minioParameter = new MinioParameter();
+                            if(s.contains("/")){
+                                minioParameter.setObjectName(runResultFilePath+"/"+egoFile);
+                            }else{
+                                minioParameter.setObjectName(runResultFilePath+"\\"+egoFile);
+                            }
+
+                            Response download = fileDownService.download(minioParameter);
+                            Response.Body body = download.body();
+                            inputStream = body.asInputStream();
+                            in =  new BufferedInputStream(inputStream);
+
+                            //任务文件路径
+                            String taskFilePath = taskPagePath +File.separator + egoFile;
+//                          FileUtil.writeInputStreamToLocalFile(inputStream,taskFilePath);
+
+                            ZipEntry entry = new ZipEntry(taskFilePath);
+                            in = new BufferedInputStream(inputStream);
+                            zos.putNextEntry(entry);
+                            while ((len = in.read(buffer)) != -1 ) {
+                                zos.write(buffer, 0, len);
+                            }
                         }
 
                     }

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

@@ -340,20 +340,20 @@
     <select id="selectSceneAccidentById" parameterType="string" resultType="api.common.pojo.vo.project.SceneBaseInfoVo">
         select scene_name
         from scene_accident
-        where accident_id = #{id,jdbcType=VARCHAR} and is_deleted = '0'
+        where accident_id = #{id,jdbcType=VARCHAR}
     </select>
     <!--查询自然场景信息-->
     <select id="selectSceneNatural" parameterType="string" resultType="api.common.pojo.vo.project.SceneBaseInfoVo">
         select natural_name
         from scene_natural
-        where natural_id = #{id,jdbcType=VARCHAR} and is_deleted = '0'
+        where natural_id = #{id,jdbcType=VARCHAR}
 
     </select>
     <!--查询标准法规场景信息-->
     <select id="selectSceneStandardsRegulations" parameterType="string" resultType="api.common.pojo.vo.project.SceneBaseInfoVo">
         select scene_name
         from scene_standards_regulations
-        where regulations_id = #{id,jdbcType=VARCHAR} and is_deleted = '0'
+        where regulations_id = #{id,jdbcType=VARCHAR}
     </select>
 
     <!--根据场景包id获取场景子集-->