mirror of
https://gitee.com/dromara/Jpom.git
synced 2024-12-03 04:18:21 +08:00
多格式文件解压
This commit is contained in:
parent
7b80d449c1
commit
19080a73d7
@ -2,7 +2,6 @@ package cn.keepbx.jpom.controller.manage;
|
||||
|
||||
import cn.hutool.core.io.FileUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.core.util.ZipUtil;
|
||||
import cn.hutool.extra.servlet.ServletUtil;
|
||||
import cn.jiangzeyin.common.DefaultSystemLog;
|
||||
import cn.jiangzeyin.common.JsonMessage;
|
||||
@ -12,6 +11,7 @@ import cn.keepbx.jpom.model.data.ProjectInfoModel;
|
||||
import cn.keepbx.jpom.service.manage.ConsoleService;
|
||||
import cn.keepbx.jpom.socket.ConsoleCommandOp;
|
||||
import cn.keepbx.jpom.system.AgentConfigBean;
|
||||
import cn.keepbx.jpom.util.CompressionFileUtil;
|
||||
import cn.keepbx.jpom.util.FileUtils;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import org.springframework.http.MediaType;
|
||||
@ -78,7 +78,8 @@ public class ProjectFileControl extends BaseAgentController {
|
||||
}
|
||||
|
||||
if ("unzip".equals(type)) {
|
||||
multipartFileBuilder.setInputStreamType("zip");
|
||||
// multipartFileBuilder.setInputStreamType("tar", "bz2", "zip", "gz", "tar.bz2", "tar.gz");
|
||||
multipartFileBuilder.setFileExt("tar", "bz2", "zip", "gz", "tar.bz2", "tar.gz");
|
||||
multipartFileBuilder.setSavePath(AgentConfigBean.getInstance().getTempPathName());
|
||||
String path = multipartFileBuilder.save();
|
||||
//
|
||||
@ -91,7 +92,8 @@ public class ProjectFileControl extends BaseAgentController {
|
||||
}
|
||||
// 解压
|
||||
File file = new File(path);
|
||||
ZipUtil.unzip(file, lib);
|
||||
// ZipUtil.unzip(file, lib);
|
||||
CompressionFileUtil.unCompress(file.getAbsolutePath(), lib.getAbsolutePath());
|
||||
if (!file.delete()) {
|
||||
DefaultSystemLog.LOG().info("删除失败:" + file.getPath());
|
||||
}
|
||||
|
@ -1,5 +1,7 @@
|
||||
package cn.keepbx.jpom.util;
|
||||
|
||||
import cn.hutool.core.io.FileTypeUtil;
|
||||
import cn.hutool.core.io.FileUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import org.apache.commons.compress.archivers.tar.TarArchiveEntry;
|
||||
import org.apache.commons.compress.archivers.tar.TarArchiveInputStream;
|
||||
@ -230,9 +232,8 @@ public class CompressionFileUtil {
|
||||
}
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
System.out.println(unGZ("D:\\systemDocument\\桌面\\zip\\aaa.txt.gz", "D:\\systemDocument\\桌面\\zip\\gz"));
|
||||
System.out.println(unBZip2("D:\\systemDocument\\桌面\\zip\\aaa.txt.bz2", "D:\\systemDocument\\桌面\\zip\\bz"));
|
||||
|
||||
// System.out.println(unGZ("D:\\systemDocument\\桌面\\zip\\aaa.txt.gz", "D:\\systemDocument\\桌面\\zip\\gz"));
|
||||
// System.out.println(unBZip2("D:\\systemDocument\\桌面\\zip\\aaa.txt.bz2", "D:\\systemDocument\\桌面\\zip\\bz"));
|
||||
|
||||
// System.out.println(unZip("D:\\systemDocument\\桌面\\zip\\test.zip", "D:\\systemDocument\\桌面\\zip\\zip"));
|
||||
// System.out.println(unTar("D:\\systemDocument\\桌面\\zip\\aaa.tar", "D:\\systemDocument\\桌面\\zip\\tar"));
|
||||
|
@ -217,8 +217,8 @@
|
||||
}
|
||||
},
|
||||
multiple: false,
|
||||
exts: 'zip',
|
||||
acceptMime: '.zip',
|
||||
exts: 'tar|bz2|gz|zip|tar.bz2|tar.gz',
|
||||
// acceptMime: 'application/zip,application/x-tar,application/x-gzip',
|
||||
url: './upload',
|
||||
before: function () {
|
||||
layer.load(1, {
|
||||
|
Loading…
Reference in New Issue
Block a user