新增mongo版文件业务,实现minio多系统统一文件管理
This commit is contained in:
parent
7acb9711cd
commit
54a6a6c311
@ -0,0 +1,65 @@
|
||||
package ink.wgink.interfaces.file;
|
||||
|
||||
import ink.wgink.pojo.ListPage;
|
||||
import ink.wgink.pojo.pos.FilePO;
|
||||
import ink.wgink.pojo.result.SuccessResultList;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @ClassName: IMongoFileService
|
||||
* @Description: Mongo文件业务
|
||||
* @Author: wanggeng
|
||||
* @Date: 2021/12/12 6:16 PM
|
||||
* @Version: 1.0
|
||||
*/
|
||||
public interface IMongoFileService {
|
||||
|
||||
String UPLOAD_FILE_COLLECTION_NAME = "uploadFiles";
|
||||
|
||||
/**
|
||||
* 保存文件
|
||||
*
|
||||
* @param filePO
|
||||
*/
|
||||
void saveByUserId(String userId, FilePO filePO);
|
||||
|
||||
/**
|
||||
* 删除文件
|
||||
*
|
||||
* @param fileIds 文件ID列表
|
||||
*/
|
||||
void delete(List<String> fileIds);
|
||||
|
||||
/**
|
||||
* 文件详情
|
||||
*
|
||||
* @param fileId
|
||||
* @return
|
||||
*/
|
||||
FilePO getPO(String fileId);
|
||||
|
||||
/**
|
||||
* 文件分页列表
|
||||
*
|
||||
* @param page
|
||||
* @return
|
||||
*/
|
||||
SuccessResultList<List<FilePO>> listPage(ListPage page);
|
||||
|
||||
/**
|
||||
* 文件列表
|
||||
*
|
||||
* @param fileIds
|
||||
* @return
|
||||
*/
|
||||
List<FilePO> listByIds(List<String> fileIds);
|
||||
|
||||
/**
|
||||
* 文件列表
|
||||
*
|
||||
* @param fileUrl 文件url
|
||||
* @return
|
||||
*/
|
||||
List<FilePO> listByUrl(String fileUrl);
|
||||
}
|
@ -17,7 +17,7 @@ public class FilePO implements Serializable {
|
||||
private String filePath;
|
||||
private String fileUrl;
|
||||
private String fileType;
|
||||
private String fileSize;
|
||||
private Long fileSize;
|
||||
private String fileSummary;
|
||||
private Integer isBack;
|
||||
private String creator;
|
||||
@ -66,11 +66,11 @@ public class FilePO implements Serializable {
|
||||
this.fileType = fileType;
|
||||
}
|
||||
|
||||
public String getFileSize() {
|
||||
return fileSize == null ? "" : fileSize.trim();
|
||||
public Long getFileSize() {
|
||||
return fileSize == null ? 0 : fileSize;
|
||||
}
|
||||
|
||||
public void setFileSize(String fileSize) {
|
||||
public void setFileSize(Long fileSize) {
|
||||
this.fileSize = fileSize;
|
||||
}
|
||||
|
||||
@ -83,7 +83,7 @@ public class FilePO implements Serializable {
|
||||
}
|
||||
|
||||
public Integer getIsBack() {
|
||||
return isBack;
|
||||
return isBack == null ? 0 : isBack;
|
||||
}
|
||||
|
||||
public void setIsBack(Integer isBack) {
|
||||
@ -123,7 +123,7 @@ public class FilePO implements Serializable {
|
||||
}
|
||||
|
||||
public Integer getIsDelete() {
|
||||
return isDelete;
|
||||
return isDelete == null ? 0 : isDelete;
|
||||
}
|
||||
|
||||
public void setIsDelete(Integer isDelete) {
|
||||
|
@ -37,7 +37,6 @@
|
||||
<dependency>
|
||||
<groupId>org.springframework.data</groupId>
|
||||
<artifactId>spring-data-mongodb</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<!-- mongodb end -->
|
||||
|
||||
|
@ -1,5 +1,7 @@
|
||||
package ink.wgink.module.file.pojo.vos;
|
||||
|
||||
import ink.wgink.pojo.pos.FilePO;
|
||||
|
||||
/**
|
||||
* When you feel like quitting. Think about why you started
|
||||
* 当你想要放弃的时候,想想当初你为何开始
|
||||
@ -10,79 +12,6 @@ package ink.wgink.module.file.pojo.vos;
|
||||
* @Date: 2021/3/15 11:39 上午
|
||||
* @Version: 1.0
|
||||
*/
|
||||
public class FileVO {
|
||||
public class FileVO extends FilePO {
|
||||
|
||||
String fileName;
|
||||
String filePath;
|
||||
String fileFullPath;
|
||||
String fileUrl;
|
||||
String fileType;
|
||||
Long fileSize;
|
||||
|
||||
public String getFileName() {
|
||||
return fileName == null ? "" : fileName;
|
||||
}
|
||||
|
||||
public void setFileName(String fileName) {
|
||||
this.fileName = fileName;
|
||||
}
|
||||
|
||||
public String getFilePath() {
|
||||
return filePath == null ? "" : filePath;
|
||||
}
|
||||
|
||||
public void setFilePath(String filePath) {
|
||||
this.filePath = filePath;
|
||||
}
|
||||
|
||||
public String getFileFullPath() {
|
||||
return fileFullPath == null ? "" : fileFullPath;
|
||||
}
|
||||
|
||||
public void setFileFullPath(String fileFullPath) {
|
||||
this.fileFullPath = fileFullPath;
|
||||
}
|
||||
|
||||
public String getFileUrl() {
|
||||
return fileUrl == null ? "" : fileUrl;
|
||||
}
|
||||
|
||||
public void setFileUrl(String fileUrl) {
|
||||
this.fileUrl = fileUrl;
|
||||
}
|
||||
|
||||
public String getFileType() {
|
||||
return fileType == null ? "" : fileType;
|
||||
}
|
||||
|
||||
public void setFileType(String fileType) {
|
||||
this.fileType = fileType;
|
||||
}
|
||||
|
||||
public Long getFileSize() {
|
||||
return fileSize == null ? 0 : fileSize;
|
||||
}
|
||||
|
||||
public void setFileSize(Long fileSize) {
|
||||
this.fileSize = fileSize;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
final StringBuilder sb = new StringBuilder("{");
|
||||
sb.append("\"fileName\":\"")
|
||||
.append(fileName).append('\"');
|
||||
sb.append(",\"filePath\":\"")
|
||||
.append(filePath).append('\"');
|
||||
sb.append(",\"fileFullPath\":\"")
|
||||
.append(fileFullPath).append('\"');
|
||||
sb.append(",\"fileUrl\":\"")
|
||||
.append(fileUrl).append('\"');
|
||||
sb.append(",\"fileType\":\"")
|
||||
.append(fileType).append('\"');
|
||||
sb.append(",\"fileSize\":")
|
||||
.append(fileSize);
|
||||
sb.append('}');
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
|
@ -25,6 +25,20 @@ import java.util.Map;
|
||||
*/
|
||||
public interface IDefaultFileService {
|
||||
|
||||
/**
|
||||
* 保存文件
|
||||
*
|
||||
* @param fileVO
|
||||
*/
|
||||
void saveFile(FileVO fileVO);
|
||||
|
||||
/**
|
||||
* 保存文件
|
||||
*
|
||||
* @param userId
|
||||
* @param fileVO
|
||||
* @return
|
||||
*/
|
||||
String saveFileByUserId(String userId, FileVO fileVO);
|
||||
|
||||
/**
|
||||
@ -48,6 +62,11 @@ public interface IDefaultFileService {
|
||||
*/
|
||||
void uploadFileByUserId(String userId, MultipartFile uploadFile, UploadTypeEnum uploadTypeEnum, Map<String, Object> params);
|
||||
|
||||
/**
|
||||
* 删除文件
|
||||
*
|
||||
* @param ids
|
||||
*/
|
||||
void remove(List<String> ids);
|
||||
|
||||
/**
|
||||
@ -89,17 +108,6 @@ public interface IDefaultFileService {
|
||||
*/
|
||||
void saveUploadFileInfoByUserId(String userId, String fileName, String uploadPath, String uploadFileName, String fileType, long fileSize, Map<String, Object> params);
|
||||
|
||||
/**
|
||||
* 获取上传文件路径
|
||||
*
|
||||
* @param baseUploadPath
|
||||
* @param uploadTypeEnum
|
||||
* @param fileType
|
||||
* @return
|
||||
* @throws FileException
|
||||
*/
|
||||
String getUploadPath(String baseUploadPath, UploadTypeEnum uploadTypeEnum, String fileType) throws FileException;
|
||||
|
||||
/**
|
||||
* 下载文件
|
||||
*
|
||||
@ -122,14 +130,55 @@ public interface IDefaultFileService {
|
||||
*/
|
||||
boolean downLoadFile(HttpServletRequest request, HttpServletResponse response, FilePO filePO, boolean isOpen, boolean canRange);
|
||||
|
||||
/**
|
||||
* 获取上传文件路径
|
||||
*
|
||||
* @param baseUploadPath
|
||||
* @param uploadTypeEnum
|
||||
* @param fileType
|
||||
* @return
|
||||
* @throws FileException
|
||||
*/
|
||||
String getUploadPath(String baseUploadPath, UploadTypeEnum uploadTypeEnum, String fileType) throws FileException;
|
||||
|
||||
/**
|
||||
* 文件分页列表
|
||||
*
|
||||
* @param page
|
||||
* @return
|
||||
*/
|
||||
SuccessResultList<List<FileInfoDTO>> listPageInfo(ListPage page);
|
||||
|
||||
/**
|
||||
* 文件列表
|
||||
*
|
||||
* @param idList
|
||||
* @return
|
||||
*/
|
||||
List<FileDTO> list(List<String> idList);
|
||||
|
||||
/**
|
||||
* 文件列表
|
||||
*
|
||||
* @param idList
|
||||
* @return
|
||||
*/
|
||||
List<FilePO> listPO(List<String> idList);
|
||||
|
||||
/**
|
||||
* 文件详情
|
||||
*
|
||||
* @param fileId
|
||||
* @return
|
||||
*/
|
||||
FilePO getPO(String fileId);
|
||||
|
||||
/**
|
||||
* 文件列表
|
||||
*
|
||||
* @param url 文件url
|
||||
* @return
|
||||
*/
|
||||
List<FileDTO> listByUrl(String url);
|
||||
|
||||
}
|
||||
|
@ -92,14 +92,6 @@ public interface IFileService {
|
||||
*/
|
||||
String saveFileByUserId(String userId, FileVO fileVO);
|
||||
|
||||
/**
|
||||
* 文件分页列表
|
||||
*
|
||||
* @param page
|
||||
* @return
|
||||
*/
|
||||
SuccessResultList<List<FileInfoDTO>> listPageInfo(ListPage page);
|
||||
|
||||
/**
|
||||
* 删除记录
|
||||
*
|
||||
@ -174,6 +166,16 @@ public interface IFileService {
|
||||
*/
|
||||
FileDTO uploadSingleForFileDTO(String token, MultipartFile uploadFile, UploadTypeEnum uploadTypeEnum, Map<String, Object> params);
|
||||
|
||||
/**
|
||||
* 保存导入Excel异常文件信息
|
||||
*
|
||||
* @param fileName
|
||||
* @param uploadPath
|
||||
* @param fileSize
|
||||
* @param params
|
||||
*/
|
||||
void uploadErrorExcelFileInfo(String fileName, String uploadPath, long fileSize, Map<String, Object> params);
|
||||
|
||||
/**
|
||||
* 文件下载
|
||||
*
|
||||
@ -231,16 +233,6 @@ public interface IFileService {
|
||||
@Deprecated
|
||||
FilePO getPO(Map<String, Object> params);
|
||||
|
||||
/**
|
||||
* 保存导入Excel异常文件信息
|
||||
*
|
||||
* @param fileName
|
||||
* @param uploadPath
|
||||
* @param fileSize
|
||||
* @param params
|
||||
*/
|
||||
void uploadErrorExcelFileInfo(String fileName, String uploadPath, long fileSize, Map<String, Object> params);
|
||||
|
||||
/**
|
||||
* 获取导入Excel异常文件路径
|
||||
*
|
||||
@ -264,4 +256,12 @@ public interface IFileService {
|
||||
*/
|
||||
List<FilePO> listPO(List<String> idList);
|
||||
|
||||
/**
|
||||
* 文件分页列表
|
||||
*
|
||||
* @param page
|
||||
* @return
|
||||
*/
|
||||
SuccessResultList<List<FileInfoDTO>> listPageInfo(ListPage page);
|
||||
|
||||
}
|
||||
|
@ -23,8 +23,20 @@ import java.util.Map;
|
||||
*/
|
||||
public interface IMinIoFileService {
|
||||
|
||||
/**
|
||||
* 保存
|
||||
*
|
||||
* @param userId
|
||||
* @param fileVO
|
||||
* @return
|
||||
*/
|
||||
String saveFileByUserId(String userId, FileVO fileVO);
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*
|
||||
* @param ids
|
||||
*/
|
||||
void remove(List<String> ids);
|
||||
|
||||
/**
|
||||
@ -76,13 +88,43 @@ public interface IMinIoFileService {
|
||||
*/
|
||||
boolean downLoadFile(HttpServletRequest request, HttpServletResponse response, FilePO filePO, boolean isOpen, boolean canRange);
|
||||
|
||||
/**
|
||||
* 文件分页列表
|
||||
*
|
||||
* @param page
|
||||
* @return
|
||||
*/
|
||||
SuccessResultList<List<FileInfoDTO>> listPageInfo(ListPage page);
|
||||
|
||||
/**
|
||||
* 文件列表
|
||||
*
|
||||
* @param idList
|
||||
* @return
|
||||
*/
|
||||
List<FileDTO> list(List<String> idList);
|
||||
|
||||
/**
|
||||
* 文件列表
|
||||
*
|
||||
* @param idList
|
||||
* @return
|
||||
*/
|
||||
List<FilePO> listPO(List<String> idList);
|
||||
|
||||
/**
|
||||
* 详情
|
||||
*
|
||||
* @param fileId
|
||||
* @return
|
||||
*/
|
||||
FilePO getPO(String fileId);
|
||||
|
||||
/**
|
||||
* 文件列表
|
||||
*
|
||||
* @param fileUrl
|
||||
* @return
|
||||
*/
|
||||
List<FileDTO> listByUrl(String fileUrl);
|
||||
}
|
||||
|
@ -64,13 +64,30 @@ public class DefaultFileServiceImpl extends DefaultBaseService implements IDefau
|
||||
private String[] audioTypes;
|
||||
private String[] fileTypes;
|
||||
|
||||
@Override
|
||||
public void saveFile(FileVO fileVO) {
|
||||
fileDao.save(HashMapUtil.beanToMap(fileVO));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String saveFileByUserId(String userId, FileVO fileVO) {
|
||||
String fileId = UUIDUtil.getUUID();
|
||||
String fileId;
|
||||
if (StringUtils.isBlank(fileVO.getFileId())) {
|
||||
fileId = UUIDUtil.getUUID();
|
||||
fileVO.setFileId(fileId);
|
||||
} else {
|
||||
fileId = fileVO.getFileId();
|
||||
}
|
||||
if (StringUtils.isBlank(fileVO.getGmtCreate())) {
|
||||
String dateTime = DateUtil.getTime();
|
||||
fileVO.setGmtCreate(dateTime);
|
||||
fileVO.setGmtModified(dateTime);
|
||||
}
|
||||
if (StringUtils.isBlank(fileVO.getCreator())) {
|
||||
fileVO.setCreator(userId);
|
||||
fileVO.setModifier(userId);
|
||||
}
|
||||
Map<String, Object> params = HashMapUtil.beanToMap(fileVO);
|
||||
params.put("fileId", fileId);
|
||||
params.put("isBack", 0);
|
||||
setSaveInfoByUserId(params, userId);
|
||||
fileDao.save(params);
|
||||
return fileId;
|
||||
}
|
||||
@ -327,7 +344,7 @@ public class DefaultFileServiceImpl extends DefaultBaseService implements IDefau
|
||||
OutputStream outputStream = response.getOutputStream();
|
||||
WritableByteChannel writableByteChannel = Channels.newChannel(outputStream);
|
||||
) {
|
||||
response.setHeader("Content-Length", filePO.getFileSize());
|
||||
response.setHeader("Content-Length", filePO.getFileSize().toString());
|
||||
response.setContentType(StaticResourceRequestUtil.getContentType(filePO.getFileType()));
|
||||
if (!isOpen) {
|
||||
// 下载
|
||||
@ -388,6 +405,57 @@ public class DefaultFileServiceImpl extends DefaultBaseService implements IDefau
|
||||
return isDownloadComplete;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getUploadPath(String baseUploadPath, UploadTypeEnum uploadTypeEnum, String fileType) throws FileException {
|
||||
StringBuilder filePath = new StringBuilder();
|
||||
if (!baseUploadPath.endsWith(File.separator)) {
|
||||
filePath.append(baseUploadPath).append(File.separator);
|
||||
} else {
|
||||
filePath.append(baseUploadPath);
|
||||
}
|
||||
boolean hasFileType = !StringUtils.isBlank(fileType);
|
||||
if (uploadTypeEnum.getValue() == UploadTypeEnum.IMAGE.getValue()) {
|
||||
if (hasFileType && !isTypeCorrect(getImageTypes(), fileType)) {
|
||||
throw new FileException("图片格式不支持上传");
|
||||
}
|
||||
filePath.append("images");
|
||||
} else if (uploadTypeEnum.getValue() == UploadTypeEnum.VIDEO.getValue()) {
|
||||
if (hasFileType && !isTypeCorrect(getVideoTypes(), fileType)) {
|
||||
throw new FileException("视频格式不支持上传");
|
||||
}
|
||||
filePath.append("videos");
|
||||
} else if (uploadTypeEnum.getValue() == UploadTypeEnum.AUDIO.getValue()) {
|
||||
if (hasFileType && !isTypeCorrect(getAudioTypes(), fileType)) {
|
||||
throw new FileException("音频格式不支持上传");
|
||||
}
|
||||
filePath.append("audios");
|
||||
} else if (uploadTypeEnum.getValue() == UploadTypeEnum.ERROR_EXCEL.getValue()) {
|
||||
filePath.append("errorexcels");
|
||||
} else {
|
||||
if (hasFileType && !isTypeCorrect(getFileTypes(), fileType)) {
|
||||
throw new FileException("文件格式不支持上传");
|
||||
}
|
||||
filePath.append("files");
|
||||
}
|
||||
filePath.append(File.separator).append(DateUtil.getDays());
|
||||
return filePath.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取上传文件名称
|
||||
*
|
||||
* @param fileType
|
||||
* @return
|
||||
*/
|
||||
private String getUploadFileName(String fileType) {
|
||||
String uploadFileName = UUIDUtil.get32UUID();
|
||||
if (!StringUtils.isEmpty(fileType)) {
|
||||
uploadFileName += "." + fileType;
|
||||
}
|
||||
return uploadFileName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SuccessResultList<List<FileInfoDTO>> listPageInfo(ListPage page) {
|
||||
PageHelper.startPage(page.getPage(), page.getRows());
|
||||
@ -540,56 +608,6 @@ public class DefaultFileServiceImpl extends DefaultBaseService implements IDefau
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUploadPath(String baseUploadPath, UploadTypeEnum uploadTypeEnum, String fileType) throws FileException {
|
||||
StringBuilder filePath = new StringBuilder();
|
||||
if (!baseUploadPath.endsWith(File.separator)) {
|
||||
filePath.append(baseUploadPath).append(File.separator);
|
||||
} else {
|
||||
filePath.append(baseUploadPath);
|
||||
}
|
||||
boolean hasFileType = !StringUtils.isBlank(fileType);
|
||||
if (uploadTypeEnum.getValue() == UploadTypeEnum.IMAGE.getValue()) {
|
||||
if (hasFileType && !isTypeCorrect(getImageTypes(), fileType)) {
|
||||
throw new FileException("图片格式不支持上传");
|
||||
}
|
||||
filePath.append("images");
|
||||
} else if (uploadTypeEnum.getValue() == UploadTypeEnum.VIDEO.getValue()) {
|
||||
if (hasFileType && !isTypeCorrect(getVideoTypes(), fileType)) {
|
||||
throw new FileException("视频格式不支持上传");
|
||||
}
|
||||
filePath.append("videos");
|
||||
} else if (uploadTypeEnum.getValue() == UploadTypeEnum.AUDIO.getValue()) {
|
||||
if (hasFileType && !isTypeCorrect(getAudioTypes(), fileType)) {
|
||||
throw new FileException("音频格式不支持上传");
|
||||
}
|
||||
filePath.append("audios");
|
||||
} else if (uploadTypeEnum.getValue() == UploadTypeEnum.ERROR_EXCEL.getValue()) {
|
||||
filePath.append("errorexcels");
|
||||
} else {
|
||||
if (hasFileType && !isTypeCorrect(getFileTypes(), fileType)) {
|
||||
throw new FileException("文件格式不支持上传");
|
||||
}
|
||||
filePath.append("files");
|
||||
}
|
||||
filePath.append(File.separator).append(DateUtil.getDays());
|
||||
return filePath.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取上传文件名称
|
||||
*
|
||||
* @param fileType
|
||||
* @return
|
||||
*/
|
||||
private String getUploadFileName(String fileType) {
|
||||
String uploadFileName = UUIDUtil.get32UUID();
|
||||
if (!StringUtils.isEmpty(fileType)) {
|
||||
uploadFileName += "." + fileType;
|
||||
}
|
||||
return uploadFileName;
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存文件到本地
|
||||
*
|
||||
|
@ -51,15 +51,6 @@ public class FileServiceImpl extends DefaultBaseService implements IFileService
|
||||
@Autowired
|
||||
private IMinIoFileService minIoFileService;
|
||||
|
||||
@Override
|
||||
public SuccessResultList<List<FileInfoDTO>> listPageInfo(ListPage page) {
|
||||
if (fileProperties.getUseMinIo()) {
|
||||
return minIoFileService.listPageInfo(page);
|
||||
} else {
|
||||
return defaultFileService.listPageInfo(page);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void remove(String ids) {
|
||||
remove(Arrays.asList(ids.split("_")));
|
||||
@ -161,33 +152,6 @@ public class FileServiceImpl extends DefaultBaseService implements IFileService
|
||||
defaultFileService.saveUploadFileInfo(null, fileName, uploadPath, fileName, "xls", fileSize, params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUploadExcelErrorPath() {
|
||||
String baseUploadPath = fileProperties.getUploadPath();
|
||||
if (StringUtils.isBlank(baseUploadPath)) {
|
||||
throw new SystemException("上传路径未配置");
|
||||
}
|
||||
return defaultFileService.getUploadPath(baseUploadPath, UploadTypeEnum.ERROR_EXCEL, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<FileDTO> list(List<String> idList) throws SearchException {
|
||||
if (fileProperties.getUseMinIo()) {
|
||||
return minIoFileService.list(idList);
|
||||
} else {
|
||||
return defaultFileService.list(idList);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<FilePO> listPO(List<String> idList) {
|
||||
if (fileProperties.getUseMinIo()) {
|
||||
return minIoFileService.listPO(idList);
|
||||
} else {
|
||||
return defaultFileService.listPO(idList);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String saveFileByUserId(String userId, FileVO fileVO) {
|
||||
if (fileProperties.getUseMinIo()) {
|
||||
@ -265,6 +229,42 @@ public class FileServiceImpl extends DefaultBaseService implements IFileService
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUploadExcelErrorPath() {
|
||||
String baseUploadPath = fileProperties.getUploadPath();
|
||||
if (StringUtils.isBlank(baseUploadPath)) {
|
||||
throw new SystemException("上传路径未配置");
|
||||
}
|
||||
return defaultFileService.getUploadPath(baseUploadPath, UploadTypeEnum.ERROR_EXCEL, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<FileDTO> list(List<String> idList) throws SearchException {
|
||||
if (fileProperties.getUseMinIo()) {
|
||||
return minIoFileService.list(idList);
|
||||
} else {
|
||||
return defaultFileService.list(idList);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<FilePO> listPO(List<String> idList) {
|
||||
if (fileProperties.getUseMinIo()) {
|
||||
return minIoFileService.listPO(idList);
|
||||
} else {
|
||||
return defaultFileService.listPO(idList);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public SuccessResultList<List<FileInfoDTO>> listPageInfo(ListPage page) {
|
||||
if (fileProperties.getUseMinIo()) {
|
||||
return minIoFileService.listPageInfo(page);
|
||||
} else {
|
||||
return defaultFileService.listPageInfo(page);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* uEditor文件列表
|
||||
*
|
||||
|
@ -3,7 +3,7 @@ package ink.wgink.module.file.service.impl;
|
||||
import ink.wgink.common.base.DefaultBaseService;
|
||||
import ink.wgink.exceptions.FileException;
|
||||
import ink.wgink.exceptions.base.SystemException;
|
||||
import ink.wgink.module.file.dao.IFileDao;
|
||||
import ink.wgink.interfaces.file.IMongoFileService;
|
||||
import ink.wgink.module.file.enums.UploadTypeEnum;
|
||||
import ink.wgink.module.file.pojo.dtos.FileDTO;
|
||||
import ink.wgink.module.file.pojo.dtos.FileInfoDTO;
|
||||
@ -18,18 +18,15 @@ import ink.wgink.properties.FileMinIoProperties;
|
||||
import ink.wgink.properties.FileProperties;
|
||||
import ink.wgink.util.ArrayListUtil;
|
||||
import ink.wgink.util.UUIDUtil;
|
||||
import ink.wgink.util.map.HashMapUtil;
|
||||
import ink.wgink.util.date.DateUtil;
|
||||
import ink.wgink.util.request.StaticResourceRequestUtil;
|
||||
import io.minio.*;
|
||||
import io.minio.errors.*;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.joda.time.DateTime;
|
||||
import org.joda.time.DateTimeZone;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.mongodb.core.MongoTemplate;
|
||||
import org.springframework.data.mongodb.core.query.Criteria;
|
||||
import org.springframework.data.mongodb.core.query.Query;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
@ -45,7 +42,6 @@ import java.security.NoSuchAlgorithmException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/**
|
||||
* @ClassName: MinIOServiceImpl
|
||||
@ -57,15 +53,12 @@ import java.util.regex.Pattern;
|
||||
@Service
|
||||
public class MinIoFileServiceImpl extends DefaultBaseService implements IMinIoFileService {
|
||||
|
||||
public static final String UPLOAD_FILE_COLLECTION_NAME = "uploadFiles";
|
||||
@Autowired
|
||||
private FileProperties fileProperties;
|
||||
@Autowired
|
||||
private IFileDao fileDao;
|
||||
@Autowired
|
||||
private IDefaultFileService defaultFileService;
|
||||
@Autowired(required = false)
|
||||
private MongoTemplate mongoTemplate;
|
||||
private IMongoFileService mongoFileService;
|
||||
private FileMinIoProperties minIoProperties;
|
||||
private MinioClient minioClient;
|
||||
|
||||
@ -84,12 +77,8 @@ public class MinIoFileServiceImpl extends DefaultBaseService implements IMinIoFi
|
||||
@Override
|
||||
public String saveFileByUserId(String userId, FileVO fileVO) {
|
||||
String fileId = defaultFileService.saveFileByUserId(userId, fileVO);
|
||||
if (mongoTemplate != null) {
|
||||
Map<String, Object> params = HashMapUtil.beanToMap(fileVO);
|
||||
params.put("fileId", fileId);
|
||||
params.put("isBack", 0);
|
||||
setSaveInfoByUserId(params, userId);
|
||||
mongoTemplate.insert(params);
|
||||
if (mongoFileService != null) {
|
||||
mongoFileService.saveByUserId(userId, fileVO);
|
||||
}
|
||||
return fileId;
|
||||
}
|
||||
@ -100,9 +89,8 @@ public class MinIoFileServiceImpl extends DefaultBaseService implements IMinIoFi
|
||||
return;
|
||||
}
|
||||
defaultFileService.remove(ids);
|
||||
// 删除缓存
|
||||
if (mongoTemplate != null) {
|
||||
mongoTemplate.remove(Query.query(Criteria.where("fileId").in(ids)), UPLOAD_FILE_COLLECTION_NAME);
|
||||
if (mongoFileService != null) {
|
||||
mongoFileService.delete(ids);
|
||||
}
|
||||
}
|
||||
|
||||
@ -114,8 +102,8 @@ public class MinIoFileServiceImpl extends DefaultBaseService implements IMinIoFi
|
||||
}
|
||||
List<String> fileIds = ArrayListUtil.listBeanStringIdValue(filePOs, "fileId", FilePO.class);
|
||||
defaultFileService.delete(fileIds);
|
||||
if (mongoTemplate != null) {
|
||||
mongoTemplate.remove(Query.query(Criteria.where("fileId").in(fileIds)));
|
||||
if (mongoFileService != null) {
|
||||
mongoFileService.delete(fileIds);
|
||||
}
|
||||
}
|
||||
|
||||
@ -131,12 +119,13 @@ public class MinIoFileServiceImpl extends DefaultBaseService implements IMinIoFi
|
||||
|
||||
@Override
|
||||
public boolean downLoadFile(HttpServletRequest request, HttpServletResponse response, Map<String, Object> params, boolean canRange) {
|
||||
String fileId = params.get("fileId").toString();
|
||||
FilePO filePO = null;
|
||||
if (mongoTemplate != null) {
|
||||
filePO = mongoTemplate.findOne(Query.query(Criteria.where("fileId").is(params.get("fileId").toString())), FilePO.class, UPLOAD_FILE_COLLECTION_NAME);
|
||||
if (mongoFileService != null) {
|
||||
filePO = mongoFileService.getPO(fileId);
|
||||
}
|
||||
if (filePO == null) {
|
||||
filePO = fileDao.getPO(params);
|
||||
filePO = defaultFileService.getPO(fileId);
|
||||
}
|
||||
if (filePO == null) {
|
||||
throw new FileException("文件不存在");
|
||||
@ -181,7 +170,7 @@ public class MinIoFileServiceImpl extends DefaultBaseService implements IMinIoFi
|
||||
String objectName = filePO.getFileId() + "." + filePO.getFileType();
|
||||
InputStream inputStream = null;
|
||||
try (OutputStream outputStream = response.getOutputStream();) {
|
||||
response.setHeader("Content-Length", filePO.getFileSize());
|
||||
response.setHeader("Content-Length", filePO.getFileSize().toString());
|
||||
response.setContentType(StaticResourceRequestUtil.getContentType(filePO.getFileType()));
|
||||
if (!isOpen) {
|
||||
// 下载
|
||||
@ -251,44 +240,36 @@ public class MinIoFileServiceImpl extends DefaultBaseService implements IMinIoFi
|
||||
|
||||
@Override
|
||||
public SuccessResultList<List<FileInfoDTO>> listPageInfo(ListPage page) {
|
||||
SuccessResultList<List<FileInfoDTO>> successResultList = null;
|
||||
if (mongoTemplate != null) {
|
||||
Query query = new Query();
|
||||
String keywords = getKeywords(page.getParams());
|
||||
if (!StringUtils.isBlank(keywords)) {
|
||||
Pattern pattern = Pattern.compile("^.*" + keywords + ".*$", Pattern.CASE_INSENSITIVE);
|
||||
query.addCriteria(Criteria.where("fileName").regex(pattern));
|
||||
}
|
||||
long total = mongoTemplate.count(query, UPLOAD_FILE_COLLECTION_NAME);
|
||||
query.with(Pageable.ofSize(page.getRows()).withPage(page.getPage() - 1));
|
||||
List<FileInfoDTO> dataDTOs = mongoTemplate.find(query, FileInfoDTO.class, UPLOAD_FILE_COLLECTION_NAME);
|
||||
successResultList = new SuccessResultList<>(dataDTOs, page.getPage(), total);
|
||||
SuccessResultList<List<FilePO>> filePOSuccessResultList = null;
|
||||
if (mongoFileService != null) {
|
||||
filePOSuccessResultList = mongoFileService.listPage(page);
|
||||
}
|
||||
if (successResultList != null && !successResultList.getRows().isEmpty()) {
|
||||
return successResultList;
|
||||
if (filePOSuccessResultList != null && !filePOSuccessResultList.getRows().isEmpty()) {
|
||||
List<FileInfoDTO> mongoFileInfos = filePO2FileInfo(filePOSuccessResultList.getRows());
|
||||
return new SuccessResultList<>(mongoFileInfos, filePOSuccessResultList.getPage(), filePOSuccessResultList.getTotal());
|
||||
}
|
||||
return defaultFileService.listPageInfo(page);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<FileDTO> list(List<String> idList) {
|
||||
List<FileDTO> fileDTOs = new ArrayList<>();
|
||||
if (mongoTemplate != null) {
|
||||
return mongoTemplate.find(Query.query(Criteria.where("fileId").in(idList)), FileDTO.class, UPLOAD_FILE_COLLECTION_NAME);
|
||||
List<FilePO> filePOs = null;
|
||||
if (mongoFileService != null) {
|
||||
filePOs = mongoFileService.listByIds(idList);
|
||||
}
|
||||
if (!fileDTOs.isEmpty()) {
|
||||
return fileDTOs;
|
||||
if (filePOs != null && !filePOs.isEmpty()) {
|
||||
return filePO2FileDTO(filePOs);
|
||||
}
|
||||
return defaultFileService.list(idList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<FilePO> listPO(List<String> idList) {
|
||||
List<FilePO> filePOs = new ArrayList<>();
|
||||
if (mongoTemplate != null) {
|
||||
filePOs = mongoTemplate.find(Query.query(Criteria.where("fileId").in(idList)), FilePO.class, UPLOAD_FILE_COLLECTION_NAME);
|
||||
List<FilePO> filePOs = null;
|
||||
if (mongoFileService != null) {
|
||||
filePOs = mongoFileService.listByIds(idList);
|
||||
}
|
||||
if (!filePOs.isEmpty()) {
|
||||
if (filePOs != null && !filePOs.isEmpty()) {
|
||||
return filePOs;
|
||||
}
|
||||
return defaultFileService.listPO(idList);
|
||||
@ -297,8 +278,8 @@ public class MinIoFileServiceImpl extends DefaultBaseService implements IMinIoFi
|
||||
@Override
|
||||
public FilePO getPO(String fileId) {
|
||||
FilePO filePO = null;
|
||||
if (mongoTemplate != null) {
|
||||
filePO = mongoTemplate.findOne(Query.query(Criteria.where("fileId").is(fileId)), FilePO.class, UPLOAD_FILE_COLLECTION_NAME);
|
||||
if (mongoFileService != null) {
|
||||
filePO = mongoFileService.getPO(fileId);
|
||||
}
|
||||
if (filePO != null) {
|
||||
return filePO;
|
||||
@ -308,17 +289,48 @@ public class MinIoFileServiceImpl extends DefaultBaseService implements IMinIoFi
|
||||
|
||||
@Override
|
||||
public List<FileDTO> listByUrl(String fileUrl) {
|
||||
List<FileDTO> fileDTOs = new ArrayList<>();
|
||||
if (mongoTemplate != null) {
|
||||
Pattern pattern = Pattern.compile("^.*" + fileUrl + ".*$", Pattern.CASE_INSENSITIVE);
|
||||
fileDTOs = mongoTemplate.find(Query.query(Criteria.where("fileUrl").regex(pattern)), FileDTO.class, UPLOAD_FILE_COLLECTION_NAME);
|
||||
List<FilePO> filePOs = null;
|
||||
if (mongoFileService != null) {
|
||||
filePOs = mongoFileService.listByUrl(fileUrl);
|
||||
}
|
||||
if (!fileDTOs.isEmpty()) {
|
||||
return fileDTOs;
|
||||
if (filePOs != null && !filePOs.isEmpty()) {
|
||||
return filePO2FileDTO(filePOs);
|
||||
}
|
||||
return defaultFileService.listByUrl(fileUrl);
|
||||
}
|
||||
|
||||
/**
|
||||
* mongoFile转fileInfo
|
||||
*
|
||||
* @param filePOs
|
||||
* @return
|
||||
*/
|
||||
private List<FileInfoDTO> filePO2FileInfo(List<FilePO> filePOs) {
|
||||
List<FileInfoDTO> fileInfoDTOs = new ArrayList<>();
|
||||
filePOs.forEach(mongoFile -> {
|
||||
FileInfoDTO fileInfoDTO = new FileInfoDTO();
|
||||
BeanUtils.copyProperties(mongoFile, fileInfoDTO);
|
||||
fileInfoDTOs.add(fileInfoDTO);
|
||||
});
|
||||
return fileInfoDTOs;
|
||||
}
|
||||
|
||||
/**
|
||||
* mongoFile转fileDTO
|
||||
*
|
||||
* @param filePOs
|
||||
* @return
|
||||
*/
|
||||
private List<FileDTO> filePO2FileDTO(List<FilePO> filePOs) {
|
||||
List<FileDTO> fileDTOs = new ArrayList<>();
|
||||
filePOs.forEach(mongoFile -> {
|
||||
FileDTO fileDTO = new FileDTO();
|
||||
BeanUtils.copyProperties(mongoFile, fileDTO);
|
||||
fileDTOs.add(fileDTO);
|
||||
});
|
||||
return fileDTOs;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 上传文件到minIo
|
||||
@ -334,7 +346,7 @@ public class MinIoFileServiceImpl extends DefaultBaseService implements IMinIoFi
|
||||
if (!minioClient.bucketExists(BucketExistsArgs.builder().bucket(bucketName).build())) {
|
||||
minioClient.makeBucket(MakeBucketArgs.builder().bucket(bucketName).build());
|
||||
}
|
||||
minioClient.putObject(PutObjectArgs.builder().bucket(bucketName).object(uploadFileName).stream(inputStream, fileSize, -1).contentType(uploadFile.getContentType()).build());
|
||||
minioClient.putObject(PutObjectArgs.builder().bucket(bucketName).object(uploadFileName).stream(inputStream, fileSize, -1).contentType(StaticResourceRequestUtil.getContentType(uploadFileName)).build());
|
||||
} catch (MinioException | InvalidKeyException | IOException | NoSuchAlgorithmException e) {
|
||||
throw new SystemException(e);
|
||||
}
|
||||
@ -351,16 +363,14 @@ public class MinIoFileServiceImpl extends DefaultBaseService implements IMinIoFi
|
||||
* @param bucketName 桶名称
|
||||
*/
|
||||
private void saveFile(String token, String fileId, String fileName, String fileType, long fileSize, String bucketName) {
|
||||
Map<String, Object> params = getFileParams(fileId, fileName, fileType, fileSize, bucketName);
|
||||
if (StringUtils.isBlank(token)) {
|
||||
setSaveInfo(params);
|
||||
String userId;
|
||||
if(StringUtils.isBlank(token)) {
|
||||
userId = securityComponent.getCurrentUser().getUserId();
|
||||
} else {
|
||||
setAppSaveInfo(token, params);
|
||||
}
|
||||
fileDao.save(params);
|
||||
if (mongoTemplate != null) {
|
||||
mongoTemplate.insert(params, UPLOAD_FILE_COLLECTION_NAME);
|
||||
userId = getAppTokenUser(token).getId();
|
||||
}
|
||||
saveFileByUserId(userId, fileId, fileName, fileType, fileSize, bucketName);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@ -374,25 +384,37 @@ public class MinIoFileServiceImpl extends DefaultBaseService implements IMinIoFi
|
||||
* @param bucketName
|
||||
*/
|
||||
private void saveFileByUserId(String userId, String fileId, String fileName, String fileType, long fileSize, String bucketName) {
|
||||
Map<String, Object> params = getFileParams(fileId, fileName, fileType, fileSize, bucketName);
|
||||
setSaveInfoByUserId(params, userId);
|
||||
fileDao.save(params);
|
||||
if (mongoTemplate != null) {
|
||||
mongoTemplate.insert(params, UPLOAD_FILE_COLLECTION_NAME);
|
||||
FileVO fileVO = getFileVO(fileId, fileName, fileType, fileSize, bucketName);
|
||||
defaultFileService.saveFile(fileVO);
|
||||
if (mongoFileService != null) {
|
||||
mongoFileService.saveByUserId(userId, fileVO);
|
||||
}
|
||||
}
|
||||
|
||||
private Map<String, Object> getFileParams(String fileId, String fileName, String fileType, long fileSize, String bucketName) {
|
||||
Map<String, Object> params = getHashMap(2);
|
||||
params.put("fileId", fileId);
|
||||
params.put("fileName", fileName);
|
||||
params.put("filePath", null);
|
||||
params.put("fileUrl", bucketName);
|
||||
params.put("fileType", fileType);
|
||||
params.put("fileSize", fileSize);
|
||||
params.put("fileSummary", "minio");
|
||||
params.put("isBack", 1);
|
||||
return params;
|
||||
/**
|
||||
* 获取文件VO
|
||||
*
|
||||
* @param fileId
|
||||
* @param fileName
|
||||
* @param fileType
|
||||
* @param fileSize
|
||||
* @param bucketName
|
||||
* @return
|
||||
*/
|
||||
private FileVO getFileVO(String fileId, String fileName, String fileType, long fileSize, String bucketName) {
|
||||
String dateTime = DateUtil.getTime();
|
||||
FileVO fileVO = new FileVO();
|
||||
fileVO.setFileId(fileId);
|
||||
fileVO.setFileName(fileName);
|
||||
fileVO.setFilePath(null);
|
||||
fileVO.setFileUrl(bucketName);
|
||||
fileVO.setFileType(fileType);
|
||||
fileVO.setFileSize(fileSize);
|
||||
fileVO.setFileSummary("minio");
|
||||
fileVO.setIsBack(1);
|
||||
fileVO.setGmtCreate(dateTime);
|
||||
fileVO.setGmtModified(dateTime);
|
||||
return fileVO;
|
||||
}
|
||||
|
||||
/**
|
||||
|
28
mongo-module-file/pom.xml
Normal file
28
mongo-module-file/pom.xml
Normal file
@ -0,0 +1,28 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<artifactId>wg-basic</artifactId>
|
||||
<groupId>ink.wgink</groupId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>mongo-module-file</artifactId>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework.data</groupId>
|
||||
<artifactId>spring-data-mongodb</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ink.wgink</groupId>
|
||||
<artifactId>module-file</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
@ -0,0 +1,75 @@
|
||||
package ink.wgink.mongo.module.file.service;
|
||||
|
||||
import ink.wgink.common.base.DefaultBaseService;
|
||||
import ink.wgink.interfaces.file.IMongoFileService;
|
||||
import ink.wgink.pojo.ListPage;
|
||||
import ink.wgink.pojo.pos.FilePO;
|
||||
import ink.wgink.pojo.result.SuccessResultList;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.mongodb.core.MongoTemplate;
|
||||
import org.springframework.data.mongodb.core.query.Criteria;
|
||||
import org.springframework.data.mongodb.core.query.Query;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/**
|
||||
* @ClassName: MongoFileService
|
||||
* @Description:
|
||||
* @Author: wanggeng
|
||||
* @Date: 2021/12/12 6:18 PM
|
||||
* @Version: 1.0
|
||||
*/
|
||||
@Service
|
||||
public class MongoFileService extends DefaultBaseService implements IMongoFileService {
|
||||
|
||||
@Autowired(required = false)
|
||||
private MongoTemplate mongoTemplate;
|
||||
|
||||
@Override
|
||||
public void saveByUserId(String userId, FilePO filePO) {
|
||||
filePO.setCreator(userId);
|
||||
filePO.setModifier(userId);
|
||||
mongoTemplate.insert(filePO, UPLOAD_FILE_COLLECTION_NAME);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void delete(List<String> fileIds) {
|
||||
mongoTemplate.remove(Query.query(Criteria.where("fileId").in(fileIds)), UPLOAD_FILE_COLLECTION_NAME);
|
||||
}
|
||||
|
||||
@Override
|
||||
public FilePO getPO(String fileId) {
|
||||
return mongoTemplate.findOne(Query.query(Criteria.where("fileId").is(fileId)), FilePO.class, UPLOAD_FILE_COLLECTION_NAME);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SuccessResultList<List<FilePO>> listPage(ListPage page) {
|
||||
Query query = new Query();
|
||||
String keywords = getKeywords(page.getParams());
|
||||
if (!StringUtils.isBlank(keywords)) {
|
||||
Pattern pattern = Pattern.compile("^.*" + keywords + ".*$", Pattern.CASE_INSENSITIVE);
|
||||
query.addCriteria(Criteria.where("fileName").regex(pattern));
|
||||
}
|
||||
long total = mongoTemplate.count(query, UPLOAD_FILE_COLLECTION_NAME);
|
||||
query.with(Pageable.ofSize(page.getRows()).withPage(page.getPage() - 1));
|
||||
List<FilePO> dataDTOs = mongoTemplate.find(query, FilePO.class, UPLOAD_FILE_COLLECTION_NAME);
|
||||
return new SuccessResultList<>(dataDTOs, page.getPage(), total);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<FilePO> listByIds(List<String> fileIds) {
|
||||
return mongoTemplate.find(Query.query(Criteria.where("fileId").in(fileIds)), FilePO.class, UPLOAD_FILE_COLLECTION_NAME);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<FilePO> listByUrl(String fileUrl) {
|
||||
Pattern pattern = Pattern.compile("^.*" + fileUrl + ".*$", Pattern.CASE_INSENSITIVE);
|
||||
return mongoTemplate.find(Query.query(Criteria.where("fileUrl").regex(pattern)), FilePO.class, UPLOAD_FILE_COLLECTION_NAME);
|
||||
}
|
||||
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user