Forráskód Böngészése

修改下载逻辑

tianboguang 2 éve
szülő
commit
02d2eba03a

+ 9 - 5
src/main/java/com/fdkankan/download/service/impl/SceneDownloadHandlerServiceImpl.java

@@ -75,6 +75,9 @@ import org.springframework.stereotype.Service;
 @Service
 public class SceneDownloadHandlerServiceImpl {
 
+    @Autowired
+    private FYunFileServiceInterface fYunFileService;
+
     private static final String[] prefixArr = new String[]{
         UploadFilePath.DATA_VIEW_PATH,
         UploadFilePath.VOICE_VIEW_PATH,
@@ -612,7 +615,7 @@ public class SceneDownloadHandlerServiceImpl {
                     par += "&imagesVersion="+ imagesVersion;
                 }
 
-                var url = this.resourceUrl + key;
+                var url =  key;
                 FYunTypeEnum storageType = FYunTypeEnum.get(uploadType);
                 switch (storageType){
                     case OSS:
@@ -627,8 +630,8 @@ public class SceneDownloadHandlerServiceImpl {
                     continue;
                 }
                 imgKeys.add(fky);
-//                HttpUtil.downloadFile(url, String.format(sourceLocal, sceneNum, this.wwwroot + fky));
-                this.downloadFile(url, String.format(sourceLocal, sceneNum, this.wwwroot + fky));
+                // this.downloadFile(url, String.format(sourceLocal, sceneNum, this.wwwroot + fky));
+                fYunFileService.downloadFile(url, String.format(sourceLocal, sceneNum, this.wwwroot + fky));
             }
 
         }
@@ -652,7 +655,7 @@ public class SceneDownloadHandlerServiceImpl {
         }
         cacheKeys.add(key);
         String fileName = key.substring(key.lastIndexOf("/") + 1);
-        String url = this.resourceUrl + key.replace(fileName, URLEncoder.encode(fileName, "UTF-8")) + "?t=" + Calendar.getInstance().getTimeInMillis();
+        String url = key.replace(fileName, URLEncoder.encode(fileName, "UTF-8")) + "?t=" + Calendar.getInstance().getTimeInMillis();
         if(key.contains("hot.json") || key.contains("link-scene.json")){
             String content = fYunFileService.getFileContent(key);
             if(StrUtil.isEmpty(content)){
@@ -667,7 +670,8 @@ public class SceneDownloadHandlerServiceImpl {
         }else{
 //            HttpUtil.downloadFile(url, String.format(sourceLocal, num, prefix + key));
             try {
-                this.downloadFile(url, String.format(sourceLocal, num, prefix + key));
+                fYunFileService.downloadFile(url,String.format(sourceLocal, num, prefix + key));
+//                this.downloadFile(url, String.format(sourceLocal, num, prefix + key));
             }catch (Exception e){
                 log.info("下载文件报错,path:{}", String.format(sourceLocal, num, prefix + key));
             }