Преглед изворни кода

Merge branch 'hotfix-30056-20220811' into test

# Conflicts:
#	4dkankan-center-scene-download/src/main/java/com/fdkankan/download/service/impl/SceneDownloadHandlerServiceImpl.java
dengsixing пре 3 година
родитељ
комит
c449a05f08

+ 14 - 2
4dkankan-center-scene-download/src/main/java/com/fdkankan/download/service/impl/SceneDownloadHandlerServiceImpl.java

@@ -244,7 +244,6 @@ public class SceneDownloadHandlerServiceImpl {
 
         }catch (Exception e){
             log.error("下载失败,num={}", num);
-            Thread.sleep(30000);
             //更新进度为下载失败
             this.updateProgress( null, num, SceneDownloadProgressStatus.DOWNLOAD_FAILED.code(), null);
             //更新下载log状态为成功
@@ -262,6 +261,9 @@ public class SceneDownloadHandlerServiceImpl {
 
     private void zipOssFiles(ZipOutputStream out, List<String> ossFilePaths, String num, AtomicInteger count,
         int total, String resolution, int imagesVersion, Set<String> cacheKeys) throws Exception{
+        if(CollUtil.isEmpty(ossFilePaths)){
+            return;
+        }
         String imageNumPath = String.format(UploadFilePath.IMG_VIEW_PATH, num);
         ExecutorService executorService = Executors.newFixedThreadPool(this.zipNthreads);
         List<Future> futureList = new ArrayList<>();
@@ -277,9 +279,19 @@ public class SceneDownloadHandlerServiceImpl {
             futureList.add(executorService.submit(call));
         }
         //这里一定要加阻塞,不然会导致oss文件还没打包好,主程序已经结束返回了
+        Boolean zipSuccess = true;
         for (Future future : futureList) {
-            future.get();
+            try {
+                future.get();
+            }catch (Exception e){
+                log.error("打包oss文件失败", e);
+                zipSuccess = false;
+            }
+        }
+        if(!zipSuccess){
+            throw new Exception("打包oss文件失败");
         }
+
     }
 
     private void zipOssFilesHandler(ZipOutputStream out, String num,