lyhzzz před 3 měsíci
rodič
revize
2548c4b9c7

+ 14 - 5
src/main/java/com/fdkankan/fusion/down/CaseDownService.java

@@ -310,7 +310,10 @@ public class CaseDownService {
 
         List<CaseFiles> caseFilesList = caseFilesService.allList(caseId, null);
         for (CaseFiles files : caseFilesList) {
-            downResource(caseId,files.getFilesUrl());
+            if(StringUtils.isNotBlank(files.getFilesUrl())){
+                downResourceParent(caseId,files.getFilesUrl());
+            }
+
         }
         jsonObject.put(basePath+caseFiles+caseId, ResultData.ok(caseFilesList));
 
@@ -499,10 +502,6 @@ public class CaseDownService {
             return;
         }
         url = url.replace(queryPath, "");
-//        if( !uploadToOssUtil.existKey(url)){
-//            log.info("downResource文件不存在:{},{}",caseId,url);
-//            return;
-//        }
         String path = String.format(FilePath.OFFLINE_OSS_PATH,caseId);
         String desPath = path + "/oss/" + url;
         if(!desPath.contains(".")){
@@ -512,6 +511,16 @@ public class CaseDownService {
         ShellUtil.yunDownload(url,desPath);
     }
 
+    public void downResourceParent(Integer caseId,String url) {
+        if(StringUtils.isBlank(url) ){
+            return;
+        }
+        url = url.replace(queryPath, "");
+        String path = String.format(FilePath.OFFLINE_OSS_PATH,caseId);
+        String desPath = path + "/oss/" + url;
+        ShellUtil.yunDownload(url, new File(desPath).getParentFile().getPath());
+    }
+
     public void downWordByTemplate(Integer caseId,XWPFTemplate template,String name){
         // 指定输出文件的路径
         String outputPath = String.format(FilePath.OFFLINE_RESOURCE_PACKAGE_PATH,caseId) + name;