Jelajahi Sumber

v4场景下载

dengsixing 2 tahun lalu
induk
melakukan
4752bfe0f5

+ 12 - 2
src/main/java/com/fdkankan/download/service/impl/SceneDownloadHandlerServiceImpl.java

@@ -614,13 +614,22 @@ public class SceneDownloadHandlerServiceImpl {
                     continue;
                 }
                 imgKeys.add(fky);
-                HttpUtil.downloadFile(url, String.format(sourceLocal, sceneNum, this.wwwroot + fky));
+//                HttpUtil.downloadFile(url, String.format(sourceLocal, sceneNum, this.wwwroot + fky));
+                this.downloadFile(url, String.format(sourceLocal, sceneNum, this.wwwroot + fky));
             }
 
         }
 
     }
 
+    public void downloadFile(String url, String path){
+        File file = new File(path);
+        if(!file.getParentFile().exists()){
+            file.getParentFile().mkdirs();
+        }
+        HttpUtil.downloadFile(url, path);
+    }
+
     public void ProcessFiles(String num, String key, String prefix, Set<String> cacheKeys) throws Exception{
         if(cacheKeys.contains(key)){
             return;
@@ -641,7 +650,8 @@ public class SceneDownloadHandlerServiceImpl {
 
             FileUtil.writeUtf8String(content, String.format(sourceLocal, num, prefix + key));
         }else{
-            HttpUtil.downloadFile(url, String.format(sourceLocal, num, prefix + key));
+//            HttpUtil.downloadFile(url, String.format(sourceLocal, num, prefix + key));
+            this.downloadFile(url, String.format(sourceLocal, num, prefix + key));
         }
     }