dsx 1 년 전
부모
커밋
77108d71aa
1개의 변경된 파일11개의 추가작업 그리고 1개의 파일을 삭제
  1. 11 1
      src/main/java/com/fdkankan/download/service/impl/DownloadServiceImpl.java

+ 11 - 1
src/main/java/com/fdkankan/download/service/impl/DownloadServiceImpl.java

@@ -14,6 +14,7 @@ import com.fdkankan.common.constant.CommonStatus;
 import com.fdkankan.common.constant.ErrorCode;
 import com.fdkankan.common.constant.ErrorCode;
 import com.fdkankan.common.constant.SceneKind;
 import com.fdkankan.common.constant.SceneKind;
 import com.fdkankan.common.exception.BusinessException;
 import com.fdkankan.common.exception.BusinessException;
+import com.fdkankan.common.util.CmdUtils;
 import com.fdkankan.common.util.DateExtUtil;
 import com.fdkankan.common.util.DateExtUtil;
 import com.fdkankan.common.util.FileUtils;
 import com.fdkankan.common.util.FileUtils;
 import com.fdkankan.download.constant.CommonConstant;
 import com.fdkankan.download.constant.CommonConstant;
@@ -172,7 +173,8 @@ public class DownloadServiceImpl implements IDownloadService {
             this.zipBat(num, "v4");
             this.zipBat(num, "v4");
 
 
             //打压缩包
             //打压缩包
-            ZipUtil.zip(String.format(this.sourceLocal, num, ""), zipPath);
+//            ZipUtil.zip(String.format(this.sourceLocal, num, ""), zipPath);
+            this.zip(String.format(this.sourceLocal, num, ""), zipPath);
 
 
             FileUtil.del(String.format(this.sourceLocal, num, ""));
             FileUtil.del(String.format(this.sourceLocal, num, ""));
 
 
@@ -495,5 +497,13 @@ public class DownloadServiceImpl implements IDownloadService {
         return map;
         return map;
     }
     }
 
 
+    private void zip(String sourcePath, String zipPath) throws Exception {
+        String cmd = "cd " + sourcePath + " && zip -r " + zipPath + " " + "*";
+        CmdUtils.callLineSh(cmd, 200);
+        if(!FileUtil.exist(zipPath)){
+            throw new RuntimeException("打包失败");
+        }
+    }
+
 
 
 }
 }