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.SceneKind;
 import com.fdkankan.common.exception.BusinessException;
+import com.fdkankan.common.util.CmdUtils;
 import com.fdkankan.common.util.DateExtUtil;
 import com.fdkankan.common.util.FileUtils;
 import com.fdkankan.download.constant.CommonConstant;
@@ -172,7 +173,8 @@ public class DownloadServiceImpl implements IDownloadService {
             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, ""));
 
@@ -495,5 +497,13 @@ public class DownloadServiceImpl implements IDownloadService {
         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("打包失败");
+        }
+    }
+
 
 }