fix(解压缩): 新增RAR5格式文件解压缩及其他多种压缩格式解压缩
This commit is contained in:
parent
c97601432c
commit
1c05579387
@ -8,7 +8,7 @@ public interface IFileService extends IService<FileBean> {
|
||||
Long getFilePointCount(Long fileId);
|
||||
void unzipFile(long userFileId, int unzipMode, String filePath);
|
||||
|
||||
|
||||
public void updateFileDetail(long userFileId, String identifier, long fileSize, long modifyUserId);
|
||||
|
||||
|
||||
|
||||
|
@ -1,14 +0,0 @@
|
||||
package com.qiwenshare.file.config;
|
||||
|
||||
import com.github.tobato.fastdfs.FdfsClientConfig;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.EnableMBeanExport;
|
||||
import org.springframework.context.annotation.Import;
|
||||
import org.springframework.jmx.support.RegistrationPolicy;
|
||||
|
||||
@Configuration
|
||||
@Import(FdfsClientConfig.class)
|
||||
@EnableMBeanExport(registration = RegistrationPolicy.IGNORE_EXISTING)
|
||||
public class FdfsConfig {
|
||||
|
||||
}
|
@ -1,27 +0,0 @@
|
||||
package com.qiwenshare.file.constant;
|
||||
|
||||
/**
|
||||
* @author MAC
|
||||
* @version 1.0
|
||||
* @description: TODO
|
||||
* @date 2022/1/12 15:44
|
||||
*/
|
||||
public enum FilePermissionEnum {
|
||||
READ(1, "读取"),
|
||||
READ_WRITE(2, "读取/写入");
|
||||
|
||||
private int type;
|
||||
private String desc;
|
||||
FilePermissionEnum(int type, String desc) {
|
||||
this.type = type;
|
||||
this.desc = desc;
|
||||
}
|
||||
|
||||
public int getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public String getDesc() {
|
||||
return desc;
|
||||
}
|
||||
}
|
@ -1,9 +1,12 @@
|
||||
package com.qiwenshare.file.service;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.qiwenshare.common.exception.QiwenException;
|
||||
import com.qiwenshare.common.operation.FileOperation;
|
||||
import com.qiwenshare.common.util.DateUtil;
|
||||
import com.qiwenshare.file.api.IFileService;
|
||||
import com.qiwenshare.file.component.AsyncTaskComp;
|
||||
import com.qiwenshare.file.domain.FileBean;
|
||||
@ -81,19 +84,15 @@ public class FileService extends ServiceImpl<FileMapper, FileBean> implements IF
|
||||
String unzipUrl = UFOPUtils.getTempFile(fileBean.getFileUrl()).getAbsolutePath().replace("." + extendName, "");
|
||||
|
||||
List<String> fileEntryNameList = new ArrayList<>();
|
||||
if ("zip".equals(extendName)) {
|
||||
fileEntryNameList = FileOperation.unzip(destFile, unzipUrl);
|
||||
} else if ("rar".equals(extendName)) {
|
||||
|
||||
try {
|
||||
fileEntryNameList = FileOperation.unrar(destFile, unzipUrl);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.error("rar解压失败" + e);
|
||||
throw new QiwenException(500001, "rar解压异常:" + e.getMessage());
|
||||
}
|
||||
} else {
|
||||
throw new QiwenException(500002, "不支持的文件格式!");
|
||||
log.error("解压失败" + e);
|
||||
throw new QiwenException(500001, "解压异常:" + e.getMessage());
|
||||
}
|
||||
|
||||
if (destFile.exists()) {
|
||||
destFile.delete();
|
||||
}
|
||||
@ -110,4 +109,16 @@ public class FileService extends ServiceImpl<FileMapper, FileBean> implements IF
|
||||
}
|
||||
|
||||
|
||||
public void updateFileDetail(long userFileId, String identifier, long fileSize, long modifyUserId) {
|
||||
UserFile userFile = userFileMapper.selectById(userFileId);
|
||||
|
||||
FileBean fileBean = new FileBean();
|
||||
fileBean.setIdentifier(identifier);
|
||||
fileBean.setFileSize(fileSize);
|
||||
fileBean.setModifyTime(DateUtil.getCurrentTime());
|
||||
fileBean.setModifyUserId(modifyUserId);
|
||||
fileBean.setFileId(userFile.getFileId());
|
||||
fileMapper.updateById(fileBean);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -158,10 +158,10 @@ under the License.
|
||||
</mirror>
|
||||
-->
|
||||
<mirror>
|
||||
<id>alimaven</id>
|
||||
<mirrorOf>central</mirrorOf>
|
||||
<name>aliyun maven.</name>
|
||||
<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
|
||||
<id>aliyunmaven</id>
|
||||
<mirrorOf>*</mirrorOf>
|
||||
<name>阿里云公共仓库</name>
|
||||
<url>https://maven.aliyun.com/repository/public</url>
|
||||
</mirror>
|
||||
</mirrors>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user