lyhzzz 6 月之前
父節點
當前提交
2d77536ece
共有 1 個文件被更改,包括 7 次插入5 次删除
  1. 7 5
      src/main/java/com/fdkankan/fusion/down/CaseDownService.java

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

@@ -125,6 +125,9 @@ public class CaseDownService {
     }
     @Async
     public void downOffline(Integer caseId){
+        String path = "/mnt/fusion/offline";
+        String name = "offline_"+ caseId;
+        String zipName = path+File.separator+name+".zip";
         try {
             String redisKey = String.format(downProcessKey, caseId);
             if( redisUtil.hasKey(redisKey)){
@@ -143,23 +146,22 @@ public class CaseDownService {
             createDataJson(caseId);
             setRedisProcess(caseId,50);
             //打包zip
-            String path = "/mnt/fusion/offline";
-            String name = "offline_"+ caseId;
-            String zipName = path+File.separator+name+".zip";
             ShellUtil.zipOffline(zipName,name);
             setRedisProcess(caseId,70);
             //上传oss
             String ossUrl = zipName.replace("/mnt/", "");
             ShellUtil.yunUpload(zipName,ossUrl);
             Thread.sleep(2000L);
-            FileUtil.del(zipName);
-            FileUtil.del(path+File.separator+name);
+
             ossUrl = queryPath + ossUrl;
             caseOfflineService.saveByCase(caseId,ossUrl);
             setRedisProcess(caseId,100,ossUrl);
         }catch (Exception e){
             log.info("down-offline-error:{}",caseId,e);
             setRedisProcess(caseId,0,null,1003);
+        }finally {
+            FileUtil.del(zipName);
+            FileUtil.del(path+File.separator+name);
         }
 
     }