新建文档和解压适配优化
This commit is contained in:
parent
6073aef7c0
commit
271df4be4e
11
pom.xml
11
pom.xml
@ -6,12 +6,12 @@
|
||||
<parent>
|
||||
<groupId>com.qiwenshare</groupId>
|
||||
<artifactId>qiwenshare</artifactId>
|
||||
<version>1.0.5</version>
|
||||
<version>1.0.6</version>
|
||||
</parent>
|
||||
|
||||
<groupId>com.qiwenshare</groupId>
|
||||
<artifactId>qiwen-file</artifactId>
|
||||
<version>1.0.5-SNAPSHOT</version>
|
||||
<version>1.0.6-SNAPSHOT</version>
|
||||
<name>qiwen-file</name>
|
||||
<description>fileos.qiwenshare.com</description>
|
||||
<packaging>jar</packaging>
|
||||
@ -98,13 +98,6 @@
|
||||
<artifactId>ufop-spring-boot-starter</artifactId>
|
||||
</dependency>
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>4.13</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-data-elasticsearch</artifactId>
|
||||
|
@ -1,19 +0,0 @@
|
||||
package com.qiwenshare.file.anno;
|
||||
|
||||
import java.lang.annotation.*;
|
||||
|
||||
/**
|
||||
* 自定义注解类
|
||||
*/
|
||||
@Target(ElementType.METHOD) //注解放置的目标位置,METHOD是可注解在方法级别上
|
||||
@Retention(RetentionPolicy.RUNTIME) //注解在哪个阶段执行
|
||||
@Documented //生成文档
|
||||
public @interface MyLog {
|
||||
String module() default "";
|
||||
|
||||
String operation() default "";
|
||||
|
||||
String type() default "operation";
|
||||
|
||||
String level() default "0"; //0-低,1-中,2-高
|
||||
}
|
@ -1,13 +0,0 @@
|
||||
package com.qiwenshare.file.anno;
|
||||
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
import java.lang.annotation.*;
|
||||
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target({ElementType.TYPE, ElementType.METHOD})
|
||||
@Documented
|
||||
@ResponseBody
|
||||
public @interface ResponseResultBody {
|
||||
|
||||
}
|
@ -1,7 +1,7 @@
|
||||
package com.qiwenshare.file.aop;
|
||||
|
||||
import com.qiwenshare.common.anno.MyLog;
|
||||
import com.qiwenshare.common.result.RestResult;
|
||||
import com.qiwenshare.file.anno.MyLog;
|
||||
import com.qiwenshare.file.api.IOperationLogService;
|
||||
import com.qiwenshare.file.api.IUserService;
|
||||
import com.qiwenshare.file.domain.UserBean;
|
||||
@ -41,12 +41,11 @@ public class WebLogAcpect {
|
||||
private String token = "";
|
||||
private HttpServletRequest request;
|
||||
|
||||
private Logger logger = LoggerFactory.getLogger(WebLogAcpect.class);
|
||||
|
||||
/**
|
||||
* 定义切入点,切入点为com.example.aop下的所有函数
|
||||
*/
|
||||
@Pointcut("@annotation(com.qiwenshare.file.anno.MyLog)")
|
||||
@Pointcut("@annotation(com.qiwenshare.common.anno.MyLog)")
|
||||
public void webLog() {
|
||||
}
|
||||
|
||||
|
@ -9,7 +9,6 @@ import com.qiwenshare.file.api.*;
|
||||
import com.qiwenshare.file.config.es.FileSearch;
|
||||
import com.qiwenshare.file.domain.*;
|
||||
import com.qiwenshare.file.mapper.UserFileMapper;
|
||||
import com.qiwenshare.file.service.UserService;
|
||||
import com.qiwenshare.file.vo.file.FileListVo;
|
||||
import com.qiwenshare.ufop.factory.UFOPFactory;
|
||||
import com.qiwenshare.ufop.operation.read.Reader;
|
||||
@ -297,7 +296,7 @@ public class FileDealComp {
|
||||
String extractionCode,
|
||||
String token,
|
||||
long userFileId) {
|
||||
log.info("权限检查开始:shareBatchNum:{}, extractionCode:{}, token:{}, userFileId{}" , shareBatchNum, extractionCode, token, userFileId);
|
||||
log.debug("权限检查开始:shareBatchNum:{}, extractionCode:{}, token:{}, userFileId{}" , shareBatchNum, extractionCode, token, userFileId);
|
||||
UserFile userFile = userFileService.getById(userFileId);
|
||||
log.debug(JSON.toJSONString(userFile));
|
||||
if ("undefined".equals(shareBatchNum) || StringUtils.isEmpty(shareBatchNum)) {
|
||||
@ -310,7 +309,7 @@ public class FileDealComp {
|
||||
log.debug("文件所属用户id:" + userFile.getUserId());
|
||||
log.debug("登录用户id:" + sessionUserBean.getUserId());
|
||||
if (userFile.getUserId().longValue() != sessionUserBean.getUserId().longValue()) {
|
||||
log.debug("用户id不一致,权限校验失败:");
|
||||
log.info("用户id不一致,权限校验失败");
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
@ -319,18 +318,21 @@ public class FileDealComp {
|
||||
List<Share> shareList = shareService.listByMap(param);
|
||||
//判断批次号
|
||||
if (shareList.size() <= 0) {
|
||||
log.info("分享批次号不存在,权限校验失败");
|
||||
return false;
|
||||
}
|
||||
Integer shareType = shareList.get(0).getShareType();
|
||||
if (1 == shareType) {
|
||||
//判断提取码
|
||||
if (!shareList.get(0).getExtractionCode().equals(extractionCode)) {
|
||||
log.info("提取码错误,权限校验失败");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
param.put("userFileId", userFileId);
|
||||
List<ShareFile> shareFileList = shareFileService.listByMap(param);
|
||||
if (shareFileList.size() <= 0) {
|
||||
log.info("用户id和分享批次号不匹配,权限校验失败");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -4,12 +4,12 @@ import com.alibaba.fastjson.JSON;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.qiwenshare.common.anno.MyLog;
|
||||
import com.qiwenshare.common.exception.NotLoginException;
|
||||
import com.qiwenshare.common.util.DateUtil;
|
||||
import com.qiwenshare.common.result.RestResult;
|
||||
import com.qiwenshare.common.operation.FileOperation;
|
||||
import com.qiwenshare.common.util.FileUtil;
|
||||
import com.qiwenshare.file.anno.MyLog;
|
||||
import com.qiwenshare.file.api.*;
|
||||
import com.qiwenshare.file.component.FileDealComp;
|
||||
import com.qiwenshare.file.config.es.FileSearch;
|
||||
@ -18,6 +18,9 @@ import com.qiwenshare.file.dto.*;
|
||||
import com.qiwenshare.file.dto.file.*;
|
||||
import com.qiwenshare.file.vo.file.FileListVo;
|
||||
import com.qiwenshare.ufop.factory.UFOPFactory;
|
||||
import com.qiwenshare.ufop.operation.copy.domain.CopyFile;
|
||||
import com.qiwenshare.ufop.operation.download.Downloader;
|
||||
import com.qiwenshare.ufop.operation.download.domain.DownloadFile;
|
||||
import com.qiwenshare.ufop.operation.rename.domain.RenameFile;
|
||||
import com.qiwenshare.ufop.util.PathUtil;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
@ -25,10 +28,12 @@ import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.codec.digest.DigestUtils;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.eclipse.jetty.util.StringUtil;
|
||||
import org.elasticsearch.index.query.QueryBuilders;
|
||||
import org.elasticsearch.search.fetch.subphase.highlight.HighlightBuilder;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
import org.springframework.data.domain.Sort;
|
||||
import org.springframework.data.elasticsearch.core.ElasticsearchRestTemplate;
|
||||
@ -37,7 +42,7 @@ import org.springframework.data.elasticsearch.core.query.NativeSearchQueryBuilde
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.io.File;
|
||||
import java.io.*;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.Executor;
|
||||
import java.util.concurrent.Executors;
|
||||
@ -50,6 +55,8 @@ import static com.qiwenshare.common.util.FileUtil.getFileExtendsByType;
|
||||
@RequestMapping("/file")
|
||||
public class FileController {
|
||||
|
||||
@Value("${ufop.storage-type}")
|
||||
private Integer storageType;
|
||||
@Resource
|
||||
IFileService fileService;
|
||||
@Resource
|
||||
@ -296,20 +303,33 @@ public class FileController {
|
||||
if (sessionUserBean == null) {
|
||||
throw new NotLoginException();
|
||||
}
|
||||
String zipFileUrl = PathUtil.getStaticPath() + unzipFileDto.getFileUrl();
|
||||
File file = FileOperation.newFile(zipFileUrl);
|
||||
String extendName = FileUtil.getFileExtendName(zipFileUrl);
|
||||
String unzipUrl = zipFileUrl.replace("." + extendName, "");
|
||||
String[] arr = unzipFileDto.getFileUrl().split("\\.");
|
||||
if (arr.length <= 1) {
|
||||
return RestResult.fail().message("文件名格式错误!");
|
||||
UserFile userFile = userFileService.getById(unzipFileDto.getUserFileId());
|
||||
FileBean fileBean = fileService.getById(userFile.getFileId());
|
||||
File destFile = new File(PathUtil.getStaticPath() + "temp" + File.separator + fileBean.getFileUrl());
|
||||
|
||||
|
||||
Downloader downloader = ufopFactory.getDownloader(fileBean.getStorageType());
|
||||
DownloadFile downloadFile = new DownloadFile();
|
||||
downloadFile.setFileUrl(fileBean.getFileUrl());
|
||||
downloadFile.setFileSize(fileBean.getFileSize());
|
||||
InputStream inputStream = downloader.getInputStream(downloadFile);
|
||||
try {
|
||||
FileUtils.copyInputStreamToFile(inputStream, destFile);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
|
||||
String extendName = userFile.getExtendName();
|
||||
|
||||
String unzipUrl = (PathUtil.getStaticPath() + "temp" + File.separator + fileBean.getFileUrl()).replace("." + extendName, "");
|
||||
|
||||
List<String> fileEntryNameList = new ArrayList<>();
|
||||
if ("zip".equals(arr[1])) {
|
||||
fileEntryNameList = FileOperation.unzip(file, unzipUrl);
|
||||
} else if ("rar".equals(arr[1])) {
|
||||
if ("zip".equals(extendName)) {
|
||||
fileEntryNameList = FileOperation.unzip(destFile, unzipUrl);
|
||||
} else if ("rar".equals(extendName)) {
|
||||
try {
|
||||
fileEntryNameList = FileOperation.unrar(file, unzipUrl);
|
||||
fileEntryNameList = FileOperation.unrar(destFile, unzipUrl);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.error("rar解压失败" + e);
|
||||
@ -320,9 +340,9 @@ public class FileController {
|
||||
} else {
|
||||
return RestResult.fail().message("不支持的文件格式!");
|
||||
}
|
||||
|
||||
List<FileBean> fileBeanList = new ArrayList<>();
|
||||
|
||||
if (destFile.exists()) {
|
||||
destFile.delete();
|
||||
}
|
||||
for (int i = 0; i < fileEntryNameList.size(); i++){
|
||||
String entryName = fileEntryNameList.get(i);
|
||||
log.info("文件名:"+ entryName);
|
||||
@ -331,34 +351,61 @@ public class FileController {
|
||||
File currentFile = FileOperation.newFile(totalFileUrl);
|
||||
|
||||
FileBean tempFileBean = new FileBean();
|
||||
UserFile userFile = new UserFile();
|
||||
UserFile saveUserFile = new UserFile();
|
||||
|
||||
userFile.setUploadTime(DateUtil.getCurrentTime());
|
||||
userFile.setUserId(sessionUserBean.getUserId());
|
||||
userFile.setFilePath(FileUtil.pathSplitFormat(unzipFileDto.getFilePath() + entryName.replace(currentFile.getName(), "")).replace("\\", "/"));
|
||||
saveUserFile.setUploadTime(DateUtil.getCurrentTime());
|
||||
saveUserFile.setUserId(sessionUserBean.getUserId());
|
||||
saveUserFile.setFilePath(FileUtil.pathSplitFormat(userFile.getFilePath() + entryName.replace(currentFile.getName(), "")).replace("\\", "/"));
|
||||
|
||||
if (currentFile.isDirectory()){
|
||||
|
||||
userFile.setIsDir(1);
|
||||
|
||||
userFile.setFileName(currentFile.getName());
|
||||
tempFileBean.setTimeStampName(currentFile.getName());
|
||||
saveUserFile.setIsDir(1);
|
||||
saveUserFile.setFileName(currentFile.getName());
|
||||
}else{
|
||||
String saveFileUrl = "";
|
||||
FileInputStream fileInputStream = null;
|
||||
try {
|
||||
fileInputStream = new FileInputStream(currentFile);
|
||||
CopyFile createFile = new CopyFile();
|
||||
createFile.setExtendName(FileUtil.getFileExtendName(totalFileUrl));
|
||||
saveFileUrl = ufopFactory.getCopier().copy(fileInputStream, createFile);
|
||||
} catch (FileNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
if (fileInputStream != null) {
|
||||
try {
|
||||
log.info("关闭流");
|
||||
fileInputStream.close();
|
||||
|
||||
userFile.setIsDir(0);
|
||||
userFile.setExtendName(FileUtil.getFileExtendName(totalFileUrl));
|
||||
userFile.setFileName(FileUtil.getFileNameNotExtend(currentFile.getName()));
|
||||
System.gc();
|
||||
try {
|
||||
Thread.sleep(100);
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
saveUserFile.setIsDir(0);
|
||||
saveUserFile.setExtendName(FileUtil.getFileExtendName(totalFileUrl));
|
||||
saveUserFile.setFileName(FileUtil.getFileNameNotExtend(currentFile.getName()));
|
||||
tempFileBean.setFileSize(currentFile.length());
|
||||
tempFileBean.setTimeStampName(FileUtil.getFileNameNotExtend(currentFile.getName()));
|
||||
tempFileBean.setFileUrl(File.separator + (currentFile.getPath()).replace(PathUtil.getStaticPath(), ""));
|
||||
tempFileBean.setFileUrl(saveFileUrl);
|
||||
tempFileBean.setPointCount(1);
|
||||
tempFileBean.setStorageType(0);
|
||||
fileService.save(tempFileBean);
|
||||
tempFileBean.setStorageType(storageType);
|
||||
boolean saveResult = fileService.save(tempFileBean);
|
||||
if (saveResult) {
|
||||
boolean result = currentFile.delete();
|
||||
log.info("删除{}结果:{}",saveFileUrl, result);
|
||||
}
|
||||
}
|
||||
|
||||
userFile.setFileId(tempFileBean.getFileId());
|
||||
userFile.setDeleteFlag(0);
|
||||
userFileService.save(userFile);
|
||||
saveUserFile.setFileId(tempFileBean.getFileId());
|
||||
saveUserFile.setDeleteFlag(0);
|
||||
userFileService.save(saveUserFile);
|
||||
});
|
||||
|
||||
}
|
||||
|
@ -1,11 +1,11 @@
|
||||
package com.qiwenshare.file.controller;
|
||||
|
||||
import com.qiwenshare.common.anno.MyLog;
|
||||
import com.qiwenshare.common.exception.NotLoginException;
|
||||
import com.qiwenshare.common.result.RestResult;
|
||||
import com.qiwenshare.common.util.DateUtil;
|
||||
import com.qiwenshare.common.util.FileUtil;
|
||||
import com.qiwenshare.common.util.MimeUtils;
|
||||
import com.qiwenshare.file.anno.MyLog;
|
||||
import com.qiwenshare.file.api.IFileService;
|
||||
import com.qiwenshare.file.api.IFiletransferService;
|
||||
import com.qiwenshare.file.api.IUserFileService;
|
||||
@ -15,8 +15,6 @@ import com.qiwenshare.file.domain.*;
|
||||
import com.qiwenshare.file.dto.DownloadFileDTO;
|
||||
import com.qiwenshare.file.dto.UploadFileDTO;
|
||||
import com.qiwenshare.file.dto.file.PreviewDTO;
|
||||
import com.qiwenshare.file.service.ShareFileService;
|
||||
import com.qiwenshare.file.service.ShareService;
|
||||
import com.qiwenshare.file.service.StorageService;
|
||||
import com.qiwenshare.file.vo.file.FileListVo;
|
||||
import com.qiwenshare.file.vo.file.UploadFileVo;
|
||||
|
@ -6,7 +6,6 @@ import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.qiwenshare.common.exception.NotLoginException;
|
||||
import com.qiwenshare.common.result.RestResult;
|
||||
import com.qiwenshare.common.util.DateUtil;
|
||||
import com.qiwenshare.file.anno.MyLog;
|
||||
import com.qiwenshare.file.api.IFileService;
|
||||
import com.qiwenshare.file.api.IUserFileService;
|
||||
import com.qiwenshare.file.api.IUserService;
|
||||
@ -16,6 +15,8 @@ import com.qiwenshare.file.dto.file.EditOfficeFileDTO;
|
||||
import com.qiwenshare.file.dto.file.PreviewOfficeFileDTO;
|
||||
import com.qiwenshare.file.helper.ConfigManager;
|
||||
import com.qiwenshare.ufop.factory.UFOPFactory;
|
||||
import com.qiwenshare.ufop.operation.copy.Copier;
|
||||
import com.qiwenshare.ufop.operation.copy.domain.CopyFile;
|
||||
import com.qiwenshare.ufop.operation.download.domain.DownloadFile;
|
||||
import com.qiwenshare.ufop.operation.write.Writer;
|
||||
import com.qiwenshare.ufop.operation.write.domain.WriteFile;
|
||||
@ -24,9 +25,6 @@ import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.codec.digest.DigestUtils;
|
||||
import org.apache.poi.xslf.usermodel.XMLSlideShow;
|
||||
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||
import org.apache.poi.xwpf.usermodel.XWPFDocument;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@ -81,56 +79,27 @@ public class OfficeController {
|
||||
}
|
||||
String uuid = UUID.randomUUID().toString().replaceAll("-","");
|
||||
|
||||
SimpleDateFormat formater = new SimpleDateFormat("yyyyMMdd");
|
||||
|
||||
|
||||
String fileSavePath = PathUtil.getStaticPath() + "/create/" + formater.format(new Date());
|
||||
File fileSavePathFile = new File(fileSavePath);
|
||||
|
||||
if (!fileSavePathFile.exists()) {
|
||||
fileSavePathFile.mkdirs();
|
||||
String templateFilePath = "";
|
||||
if ("docx".equals(extendName)) {
|
||||
templateFilePath = "template/Word.docx";
|
||||
} else if ("xlsx".equals(extendName)) {
|
||||
templateFilePath = "template/Excel.xlsx";
|
||||
} else if ("pptx".equals(extendName)) {
|
||||
templateFilePath = "template/PowerPoint.pptx";
|
||||
}
|
||||
String fileUrl = "/create/" + formater.format(new Date()) + "/" + uuid + "." + extendName;
|
||||
String templateFileUrl = PathUtil.getStaticPath() + templateFilePath;
|
||||
FileInputStream fileInputStream = new FileInputStream(templateFileUrl);
|
||||
Copier copier = ufopFactory.getCopier();
|
||||
CopyFile copyFile = new CopyFile();
|
||||
copyFile.setExtendName(extendName);
|
||||
String fileUrl = copier.copy(fileInputStream, copyFile);
|
||||
|
||||
File file = new File(fileSavePath + "/" + uuid + "." + extendName);
|
||||
if(!file.exists()){
|
||||
try {
|
||||
if("docx".equals(extendName)){
|
||||
//创建word文档
|
||||
XWPFDocument document= new XWPFDocument();
|
||||
//Write the Document in file system
|
||||
FileOutputStream out = new FileOutputStream(file);
|
||||
document.write(out);
|
||||
out.close();
|
||||
}else if("xlsx".equals(extendName)){
|
||||
//创建excel表格
|
||||
XSSFWorkbook workbook = new XSSFWorkbook();
|
||||
//创建工作表
|
||||
workbook.createSheet("Sheet1");
|
||||
//Write the Document in file system
|
||||
FileOutputStream out = new FileOutputStream(file);
|
||||
workbook.write(out);
|
||||
out.close();
|
||||
}else if("pptx".equals(extendName)){
|
||||
//创建pptx演示文稿
|
||||
XMLSlideShow pptx = new XMLSlideShow();
|
||||
//创建工作表
|
||||
//Write the Document in file system
|
||||
FileOutputStream out = new FileOutputStream(file);
|
||||
pptx.write(out);
|
||||
out.close();
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
FileBean fileBean = new FileBean();
|
||||
fileBean.setFileSize(Long.valueOf(1024 * 3));
|
||||
fileBean.setFileSize(0L);
|
||||
fileBean.setFileUrl(fileUrl);
|
||||
fileBean.setStorageType(0);
|
||||
fileBean.setPointCount(1);
|
||||
fileBean.setIdentifier(uuid);
|
||||
fileBean.setTimeStampName(uuid);
|
||||
boolean saveFlag = fileService.save(fileBean);
|
||||
UserFile userFile = new UserFile();
|
||||
if(saveFlag) {
|
||||
@ -144,19 +113,6 @@ public class OfficeController {
|
||||
userFile.setFileId(fileBean.getFileId());
|
||||
userFileService.save(userFile);
|
||||
}
|
||||
Long newFileSize = file.length();
|
||||
//更新文件修改信息
|
||||
LambdaUpdateWrapper<FileBean> lambdaUpdateWrapper = new LambdaUpdateWrapper<>();
|
||||
FileInputStream fins = new FileInputStream(fileSavePath);
|
||||
String md5Str = DigestUtils.md5Hex(fins);
|
||||
fins.close();
|
||||
|
||||
lambdaUpdateWrapper
|
||||
.set(FileBean::getIdentifier, md5Str)
|
||||
.set(FileBean::getTimeStampName, md5Str)
|
||||
.set(FileBean::getFileSize, newFileSize)
|
||||
.eq(FileBean::getFileId, fileBean.getFileId());
|
||||
fileService.update(lambdaUpdateWrapper);
|
||||
|
||||
result.success();
|
||||
result.setMessage("文件创建成功!");
|
||||
|
@ -3,10 +3,10 @@ package com.qiwenshare.file.controller;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.qiwenshare.common.anno.MyLog;
|
||||
import com.qiwenshare.common.exception.NotLoginException;
|
||||
import com.qiwenshare.common.util.DateUtil;
|
||||
import com.qiwenshare.common.result.RestResult;
|
||||
import com.qiwenshare.file.anno.MyLog;
|
||||
import com.qiwenshare.file.api.IRecoveryFileService;
|
||||
import com.qiwenshare.file.api.IUserFileService;
|
||||
import com.qiwenshare.file.api.IUserService;
|
||||
|
@ -4,10 +4,10 @@ import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.util.RandomUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.qiwenshare.common.anno.MyLog;
|
||||
import com.qiwenshare.common.exception.NotLoginException;
|
||||
import com.qiwenshare.common.util.DateUtil;
|
||||
import com.qiwenshare.common.result.RestResult;
|
||||
import com.qiwenshare.file.anno.MyLog;
|
||||
import com.qiwenshare.file.api.*;
|
||||
import com.qiwenshare.file.component.FileDealComp;
|
||||
import com.qiwenshare.file.domain.Share;
|
||||
|
@ -69,7 +69,6 @@ public class TaskController {
|
||||
|
||||
List<UserFile> userfileList = userFileService.list();
|
||||
for (UserFile userFile : userfileList) {
|
||||
log.info(JSON.toJSONString(userFile));
|
||||
fileDealComp.uploadESByUserFileId(userFile.getUserFileId());
|
||||
}
|
||||
|
||||
|
@ -2,9 +2,9 @@ package com.qiwenshare.file.controller;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.qiwenshare.common.anno.MyLog;
|
||||
import com.qiwenshare.common.result.RestResult;
|
||||
import com.qiwenshare.common.util.JjwtUtil;
|
||||
import com.qiwenshare.file.anno.MyLog;
|
||||
import com.qiwenshare.file.api.IUserService;
|
||||
import com.qiwenshare.file.domain.UserBean;
|
||||
import com.qiwenshare.file.dto.user.RegisterDTO;
|
||||
|
@ -24,9 +24,6 @@ public class FileBean {
|
||||
@Column(columnDefinition="bigint(20)")
|
||||
private Long fileId;
|
||||
|
||||
@Column(columnDefinition="varchar(500)")
|
||||
private String timeStampName;
|
||||
|
||||
@Column(columnDefinition="varchar(500)")
|
||||
private String fileUrl;
|
||||
|
||||
|
@ -7,7 +7,12 @@ import lombok.Data;
|
||||
@Schema(name = "解压缩文件DTO",required = true)
|
||||
public class UnzipFileDTO {
|
||||
@Schema(description = "文件url", required = true)
|
||||
private long userFileId;
|
||||
|
||||
@Schema(description = "文件url", required = true)
|
||||
@Deprecated
|
||||
private String fileUrl;
|
||||
@Schema(description = "文件路径", required = true)
|
||||
@Deprecated
|
||||
private String filePath;
|
||||
}
|
||||
|
@ -91,7 +91,7 @@ public class FiletransferService implements IFiletransferService {
|
||||
uploadFile = uploadFileList.get(i);
|
||||
FileBean fileBean = new FileBean();
|
||||
BeanUtil.copyProperties(uploadFileDto, fileBean);
|
||||
fileBean.setTimeStampName(uploadFile.getTimeStampName());
|
||||
// fileBean.setTimeStampName(uploadFile.getTimeStampName());
|
||||
if (uploadFile.getSuccess() == 1){
|
||||
fileBean.setFileUrl(uploadFile.getUrl());
|
||||
fileBean.setFileSize(uploadFile.getFileSize());
|
||||
@ -262,7 +262,7 @@ public class FiletransferService implements IFiletransferService {
|
||||
deleter = ufopFactory.getDeleter(fileBean.getStorageType());
|
||||
DeleteFile deleteFile = new DeleteFile();
|
||||
deleteFile.setFileUrl(fileBean.getFileUrl());
|
||||
deleteFile.setTimeStampName(fileBean.getTimeStampName());
|
||||
// deleteFile.setTimeStampName(fileBean.getTimeStampName());
|
||||
deleter.delete(deleteFile);
|
||||
}
|
||||
|
||||
|
@ -63,13 +63,22 @@ ufop.aliyun.oss.access-key-secret=
|
||||
ufop.aliyun.oss.bucket-name=
|
||||
|
||||
#FastDFS配置
|
||||
fdfs.so-timeout=1501
|
||||
fdfs.connect-timeout=601
|
||||
#读取时间
|
||||
fdfs.so-timeout=15000
|
||||
#超时连接时间
|
||||
fdfs.connect-timeout=15000
|
||||
# 连接池最大数量
|
||||
fdfs.pool.max-total=200
|
||||
#单个tracker最大连接数
|
||||
fdfs.pool.max-total-per-key=50
|
||||
#连接耗尽最大等待时间 毫秒
|
||||
fdfs.pool.max-wait-millis=5000
|
||||
fdfs.tracker-list=127.0.0.1:22122
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# Redis数据库索引(默认为0)
|
||||
spring.redis.database=0
|
||||
# Redis服务器地址
|
||||
|
BIN
src/main/resources/static/template/Excel.xlsx
Normal file
BIN
src/main/resources/static/template/Excel.xlsx
Normal file
Binary file not shown.
0
src/main/resources/static/template/PowerPoint.pptx
Normal file
0
src/main/resources/static/template/PowerPoint.pptx
Normal file
0
src/main/resources/static/template/Word.docx
Normal file
0
src/main/resources/static/template/Word.docx
Normal file
@ -1,13 +1,10 @@
|
||||
package com.qiwenshare.file;
|
||||
|
||||
//import org.junit.Test;
|
||||
//import org.junit.runner.RunWith;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
@RunWith(SpringRunner.class)
|
||||
@SpringBootTest
|
||||
public class ScpApplicationTests {
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user