commit
a6debd17d0
2
pom.xml
2
pom.xml
@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>com.qiwenshare</groupId>
|
||||
<artifactId>qiwenshare</artifactId>
|
||||
<version>1.0.10</version>
|
||||
<version>1.1.0</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>qiwen-file</artifactId>
|
||||
|
@ -230,13 +230,8 @@ public class FiletransferController {
|
||||
|
||||
httpServletResponse.addHeader("Content-Disposition", "fileName=" + fileName);// 设置文件名
|
||||
|
||||
try {
|
||||
filetransferService.previewFile(httpServletResponse, previewDTO);
|
||||
}catch (Exception e){
|
||||
//org.apache.catalina.connector.ClientAbortException: java.io.IOException: 你的主机中的软件中止了一个已建立的连接。
|
||||
e.printStackTrace();
|
||||
log.error("该异常忽略不做处理:" + e);
|
||||
}
|
||||
filetransferService.previewFile(httpServletResponse, previewDTO);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
@ -3,6 +3,7 @@ package com.qiwenshare.file.controller;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.ClassUtils;
|
||||
import com.qiwenshare.common.exception.NotLoginException;
|
||||
import com.qiwenshare.common.result.RestResult;
|
||||
import com.qiwenshare.common.util.DateUtil;
|
||||
@ -89,8 +90,8 @@ public class OfficeController {
|
||||
} else if ("pptx".equals(extendName)) {
|
||||
templateFilePath = "template/PowerPoint.pptx";
|
||||
}
|
||||
String templateFileUrl = UFOPUtils.getStaticPath() + templateFilePath;
|
||||
FileInputStream fileInputStream = new FileInputStream(templateFileUrl);
|
||||
String url2 = ClassUtils.getDefaultClassLoader().getResource("static/" + templateFilePath).getPath();
|
||||
FileInputStream fileInputStream = new FileInputStream(url2);
|
||||
Copier copier = ufopFactory.getCopier();
|
||||
CopyFile copyFile = new CopyFile();
|
||||
copyFile.setExtendName(extendName);
|
||||
|
@ -11,9 +11,4 @@ public class BatchDeleteFileDTO {
|
||||
@Schema(description="文件集合", required = true)
|
||||
private String files;
|
||||
|
||||
public static void main(String[] args) {
|
||||
boolean ddd = Pattern.matches("(?!((^(con)$)|^(con)/..*|(^(prn)$)|^(prn)/..*|(^(aux)$)|^(aux)/..*|(^(nul)$)|^(nul)/..*|(^(com)[1-9]$)|^(com)[1-9]/..*|(^(lpt)[1-9]$)|^(lpt)[1-9]/..*)|^/s+|.*/s$)(^[^/////:/*/?/\"/</>/|]{1,255}$)", "con1");
|
||||
System.out.println(ddd);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -6,7 +6,7 @@ import lombok.Data;
|
||||
@Data
|
||||
@Schema(name = "下载文件DTO",required = true)
|
||||
public class DownloadFileDTO {
|
||||
private Long userFileId;
|
||||
private long userFileId;
|
||||
private String token;
|
||||
@Schema(description="批次号")
|
||||
private String shareBatchNum;
|
||||
|
@ -250,18 +250,29 @@ public class FiletransferService implements IFiletransferService {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
Downloader downloader = ufopFactory.getDownloader(StorageTypeEnum.LOCAL.getCode());
|
||||
DownloadFile downloadFile = new DownloadFile();
|
||||
downloadFile.setFileUrl("temp" + File.separator+userFile.getFileName() + ".zip");
|
||||
File tempFile = new File(UFOPUtils.getStaticPath() + downloadFile.getFileUrl());
|
||||
httpServletResponse.setContentLengthLong(tempFile.length());
|
||||
downloader.download(httpServletResponse, downloadFile);
|
||||
String zipPath = UFOPUtils.getStaticPath() + "temp" + File.separator+userFile.getFileName() + ".zip";
|
||||
File file = new File(zipPath);
|
||||
if (file.exists()) {
|
||||
file.delete();
|
||||
}
|
||||
String zipPath = "";
|
||||
try {
|
||||
Downloader downloader = ufopFactory.getDownloader(StorageTypeEnum.LOCAL.getCode());
|
||||
DownloadFile downloadFile = new DownloadFile();
|
||||
downloadFile.setFileUrl("temp" + File.separator + userFile.getFileName() + ".zip");
|
||||
File tempFile = new File(UFOPUtils.getStaticPath() + downloadFile.getFileUrl());
|
||||
httpServletResponse.setContentLengthLong(tempFile.length());
|
||||
downloader.download(httpServletResponse, downloadFile);
|
||||
zipPath = UFOPUtils.getStaticPath() + "temp" + File.separator + userFile.getFileName() + ".zip";
|
||||
} catch (Exception e) {
|
||||
//org.apache.catalina.connector.ClientAbortException: java.io.IOException: Connection reset by peer
|
||||
if (e.getMessage().contains("ClientAbortException")) {
|
||||
//该异常忽略不做处理
|
||||
} else {
|
||||
log.error("下传zip文件出现异常:{}", e.getMessage());
|
||||
}
|
||||
|
||||
} finally {
|
||||
File file = new File(zipPath);
|
||||
if (file.exists()) {
|
||||
file.delete();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -277,14 +288,24 @@ public class FiletransferService implements IFiletransferService {
|
||||
PreviewFile previewFile = new PreviewFile();
|
||||
previewFile.setFileUrl(fileBean.getFileUrl());
|
||||
previewFile.setFileSize(fileBean.getFileSize());
|
||||
if ("true".equals(previewDTO.getIsMin())) {
|
||||
previewer.imageThumbnailPreview(httpServletResponse, previewFile);
|
||||
try {
|
||||
if ("true".equals(previewDTO.getIsMin())) {
|
||||
previewer.imageThumbnailPreview(httpServletResponse, previewFile);
|
||||
} else {
|
||||
previewer.imageOriginalPreview(httpServletResponse, previewFile);
|
||||
}
|
||||
} catch (Exception e){
|
||||
//org.apache.catalina.connector.ClientAbortException: java.io.IOException: 你的主机中的软件中止了一个已建立的连接。
|
||||
if (e.getMessage().contains("ClientAbortException")) {
|
||||
//该异常忽略不做处理
|
||||
} else {
|
||||
previewer.imageOriginalPreview(httpServletResponse, previewFile);
|
||||
log.error("预览文件出现异常:{}", e.getMessage());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteFile(FileBean fileBean) {
|
||||
Deleter deleter = null;
|
||||
@ -292,7 +313,6 @@ public class FiletransferService implements IFiletransferService {
|
||||
deleter = ufopFactory.getDeleter(fileBean.getStorageType());
|
||||
DeleteFile deleteFile = new DeleteFile();
|
||||
deleteFile.setFileUrl(fileBean.getFileUrl());
|
||||
// deleteFile.setTimeStampName(fileBean.getTimeStampName());
|
||||
deleter.delete(deleteFile);
|
||||
}
|
||||
|
||||
|
@ -47,7 +47,7 @@ public class UserService extends ServiceImpl<UserMapper, UserBean> implements IU
|
||||
try {
|
||||
c = JjwtUtil.parseJWT(token);
|
||||
} catch (Exception e) {
|
||||
log.error("解码异常:" + e);
|
||||
log.info("解码异常:" + e);
|
||||
return null;
|
||||
}
|
||||
if (c == null) {
|
||||
|
Loading…
Reference in New Issue
Block a user