commit
080189629a
@ -148,6 +148,7 @@ public class FileDealComp {
|
|||||||
* @param sessionUserId
|
* @param sessionUserId
|
||||||
*/
|
*/
|
||||||
public void deleteRepeatSubDirFile(String filePath, Long sessionUserId) {
|
public void deleteRepeatSubDirFile(String filePath, Long sessionUserId) {
|
||||||
|
log.debug("删除子目录:"+filePath);
|
||||||
LambdaQueryWrapper<UserFile> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<UserFile> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
|
||||||
lambdaQueryWrapper.select(UserFile::getFileName, UserFile::getFilePath)
|
lambdaQueryWrapper.select(UserFile::getFileName, UserFile::getFilePath)
|
||||||
@ -269,7 +270,7 @@ public class FileDealComp {
|
|||||||
elasticSearchService.save(fileSearch);
|
elasticSearchService.save(fileSearch);
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("ES更新操作失败,请检查配置");
|
log.debug("ES更新操作失败,请检查配置");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -281,7 +282,7 @@ public class FileDealComp {
|
|||||||
try {
|
try {
|
||||||
elasticSearchService.deleteById(userFileId);
|
elasticSearchService.deleteById(userFileId);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("ES删除操作失败,请检查配置");
|
log.debug("ES删除操作失败,请检查配置");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -55,10 +55,7 @@ public class FiletransferController {
|
|||||||
FileDealComp fileDealComp;
|
FileDealComp fileDealComp;
|
||||||
@Resource
|
@Resource
|
||||||
StorageService storageService;
|
StorageService storageService;
|
||||||
@Resource
|
|
||||||
ShareService shareService;
|
|
||||||
@Resource
|
|
||||||
ShareFileService shareFileService;
|
|
||||||
public static final String CURRENT_MODULE = "文件传输接口";
|
public static final String CURRENT_MODULE = "文件传输接口";
|
||||||
|
|
||||||
@Operation(summary = "极速上传", description = "校验文件MD5判断文件是否存在,如果存在直接上传成功并返回skipUpload=true,如果不存在返回skipUpload=false需要再次调用该接口的POST方法", tags = {"filetransfer"})
|
@Operation(summary = "极速上传", description = "校验文件MD5判断文件是否存在,如果存在直接上传成功并返回skipUpload=true,如果不存在返回skipUpload=false需要再次调用该接口的POST方法", tags = {"filetransfer"})
|
||||||
@ -77,45 +74,45 @@ public class FiletransferController {
|
|||||||
UploadFileVo uploadFileVo = new UploadFileVo();
|
UploadFileVo uploadFileVo = new UploadFileVo();
|
||||||
Map<String, Object> param = new HashMap<String, Object>();
|
Map<String, Object> param = new HashMap<String, Object>();
|
||||||
param.put("identifier", uploadFileDto.getIdentifier());
|
param.put("identifier", uploadFileDto.getIdentifier());
|
||||||
synchronized (FiletransferController.class) {
|
|
||||||
List<FileBean> list = fileService.listByMap(param);
|
|
||||||
if (list != null && !list.isEmpty()) {
|
|
||||||
FileBean file = list.get(0);
|
|
||||||
|
|
||||||
UserFile userFile = new UserFile();
|
List<FileBean> list = fileService.listByMap(param);
|
||||||
|
if (list != null && !list.isEmpty()) {
|
||||||
|
FileBean file = list.get(0);
|
||||||
|
|
||||||
userFile.setUserId(sessionUserBean.getUserId());
|
UserFile userFile = new UserFile();
|
||||||
String relativePath = uploadFileDto.getRelativePath();
|
|
||||||
if (relativePath.contains("/")) {
|
|
||||||
userFile.setFilePath(uploadFileDto.getFilePath() + PathUtil.getParentPath(relativePath) + "/");
|
|
||||||
fileDealComp.restoreParentFilePath(uploadFileDto.getFilePath() + PathUtil.getParentPath(relativePath) + "/", sessionUserBean.getUserId());
|
|
||||||
} else {
|
|
||||||
userFile.setFilePath(uploadFileDto.getFilePath());
|
|
||||||
}
|
|
||||||
|
|
||||||
String fileName = uploadFileDto.getFilename();
|
|
||||||
userFile.setFileName(FileUtil.getFileNameNotExtend(fileName));
|
|
||||||
userFile.setExtendName(FileUtil.getFileExtendName(fileName));
|
|
||||||
userFile.setDeleteFlag(0);
|
|
||||||
List<FileListVo> userFileList = userFileService.userFileList(userFile, null, null);
|
|
||||||
if (userFileList.size() <= 0) {
|
|
||||||
|
|
||||||
userFile.setIsDir(0);
|
|
||||||
userFile.setUploadTime(DateUtil.getCurrentTime());
|
|
||||||
userFile.setFileId(file.getFileId());
|
|
||||||
//"fileName", "filePath", "extendName", "deleteFlag", "userId"
|
|
||||||
|
|
||||||
userFileService.save(userFile);
|
|
||||||
fileService.increaseFilePointCount(file.getFileId());
|
|
||||||
fileDealComp.uploadESByUserFileId(userFile.getUserFileId());
|
|
||||||
}
|
|
||||||
|
|
||||||
uploadFileVo.setSkipUpload(true);
|
|
||||||
|
|
||||||
|
userFile.setUserId(sessionUserBean.getUserId());
|
||||||
|
String relativePath = uploadFileDto.getRelativePath();
|
||||||
|
if (relativePath.contains("/")) {
|
||||||
|
userFile.setFilePath(uploadFileDto.getFilePath() + PathUtil.getParentPath(relativePath) + "/");
|
||||||
|
fileDealComp.restoreParentFilePath(uploadFileDto.getFilePath() + PathUtil.getParentPath(relativePath) + "/", sessionUserBean.getUserId());
|
||||||
|
fileDealComp.deleteRepeatSubDirFile(uploadFileDto.getFilePath(), sessionUserBean.getUserId());
|
||||||
} else {
|
} else {
|
||||||
uploadFileVo.setSkipUpload(false);
|
userFile.setFilePath(uploadFileDto.getFilePath());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String fileName = uploadFileDto.getFilename();
|
||||||
|
userFile.setFileName(FileUtil.getFileNameNotExtend(fileName));
|
||||||
|
userFile.setExtendName(FileUtil.getFileExtendName(fileName));
|
||||||
|
userFile.setDeleteFlag(0);
|
||||||
|
List<FileListVo> userFileList = userFileService.userFileList(userFile, null, null);
|
||||||
|
if (userFileList.size() <= 0) {
|
||||||
|
|
||||||
|
userFile.setIsDir(0);
|
||||||
|
userFile.setUploadTime(DateUtil.getCurrentTime());
|
||||||
|
userFile.setFileId(file.getFileId());
|
||||||
|
//"fileName", "filePath", "extendName", "deleteFlag", "userId"
|
||||||
|
|
||||||
|
userFileService.save(userFile);
|
||||||
|
fileService.increaseFilePointCount(file.getFileId());
|
||||||
|
fileDealComp.uploadESByUserFileId(userFile.getUserFileId());
|
||||||
|
}
|
||||||
|
|
||||||
|
uploadFileVo.setSkipUpload(true);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
uploadFileVo.setSkipUpload(false);
|
||||||
|
|
||||||
}
|
}
|
||||||
return RestResult.success().data(uploadFileVo);
|
return RestResult.success().data(uploadFileVo);
|
||||||
|
|
||||||
|
@ -64,7 +64,7 @@ public class TaskController {
|
|||||||
try {
|
try {
|
||||||
elasticSearchService.deleteAll();
|
elasticSearchService.deleteAll();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("删除ES失败:" + e);
|
log.debug("删除ES失败:" + e);
|
||||||
}
|
}
|
||||||
|
|
||||||
List<UserFile> userfileList = userFileService.list();
|
List<UserFile> userfileList = userFileService.list();
|
||||||
|
@ -103,6 +103,7 @@ public class FiletransferService implements IFiletransferService {
|
|||||||
if (relativePath.contains("/")) {
|
if (relativePath.contains("/")) {
|
||||||
userFile.setFilePath(uploadFileDto.getFilePath() + PathUtil.getParentPath(relativePath) + "/");
|
userFile.setFilePath(uploadFileDto.getFilePath() + PathUtil.getParentPath(relativePath) + "/");
|
||||||
fileDealComp.restoreParentFilePath(uploadFileDto.getFilePath() + PathUtil.getParentPath(relativePath) + "/", userId);
|
fileDealComp.restoreParentFilePath(uploadFileDto.getFilePath() + PathUtil.getParentPath(relativePath) + "/", userId);
|
||||||
|
fileDealComp.deleteRepeatSubDirFile(uploadFileDto.getFilePath(), userId);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
userFile.setFilePath(uploadFileDto.getFilePath());
|
userFile.setFilePath(uploadFileDto.getFilePath());
|
||||||
|
Loading…
Reference in New Issue
Block a user