1
0
mirror of https://gitee.com/bookshelfplus/bookshelfplus synced 2025-09-14 20:41:38 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee

/file/list; /file/object/list 修改为POST提交;完善上传文件部分代码;清理多余import;修正一些代码Bug

This commit is contained in:
2022-04-15 21:38:57 +08:00
parent 0f6f148076
commit 5c1a935697
29 changed files with 1387 additions and 426 deletions

View File

@@ -1,5 +1,7 @@
package plus.bookshelf.Service.Service;
import org.springframework.transaction.annotation.Transactional;
import plus.bookshelf.Common.Enum.FileStorageMediumEnum;
import plus.bookshelf.Common.Error.BusinessException;
import plus.bookshelf.Service.Model.FileObjectModel;
@@ -7,10 +9,57 @@ import java.lang.reflect.InvocationTargetException;
import java.util.List;
public interface FileObjectService {
/**
* 列出所有文件对象
*
* @return
*/
List<FileObjectModel> list(String token) throws InvocationTargetException, IllegalAccessException, BusinessException;
/**
* 添加文件对象
* 返回是否添加成功
*
* @param fileObjectModel
* @return
* @throws InvocationTargetException
* @throws IllegalAccessException
*/
Boolean addFileObject(FileObjectModel fileObjectModel) throws InvocationTargetException, IllegalAccessException;
/**
* 向数据库中插入文件信息
*
* @param fileName 文件名
* @param filePath 文件路径
* @param fileSize 文件大小
* @param fileSHA1 文件SHA1
* @param fileExt 文件扩展名
* @param fileNameWithoutExt 文件名(不包含扩展名)
* @param fileStorageMediumEnum 文件存储介质
* @param bookOrigin 文件来源
* @return 是否插入成功
* @throws InvocationTargetException
* @throws IllegalAccessException
* @throws BusinessException
*/
@Transactional
Boolean uploadFile(Integer fileId, String fileName, String filePath, Long fileSize, String fileSHA1, String fileExt, String fileNameWithoutExt, FileStorageMediumEnum fileStorageMediumEnum, String bookOrigin) throws InvocationTargetException, IllegalAccessException, BusinessException;
/**
* 修改文件对象上传状态信息
*
* @param fileId
* @param fileStatus
*/
Boolean updateFileStatus(Integer fileId, String fileStatus) throws InvocationTargetException, IllegalAccessException;
/**
* 通过文件路径获取文件
*
* @param filePath 文件路径
* @return
*/
FileObjectModel getFileObjectByFilePath(String filePath) throws InvocationTargetException, IllegalAccessException;
}

View File

@@ -1,5 +1,6 @@
package plus.bookshelf.Service.Service;
import plus.bookshelf.Common.Error.BusinessException;
import plus.bookshelf.Service.Model.FileModel;
import java.lang.reflect.InvocationTargetException;
@@ -11,14 +12,23 @@ public interface FileService {
*
* @return
*/
List<FileModel> list(String token) throws InvocationTargetException, IllegalAccessException, BusinessException;
// /**
// * 向数据库中添加一个 scheduleTask
// *
// * @param expireMinute
// * @param fileName
// * @param urlGUID
// * @param userId
// */
// void addScheduleTask(Integer expireMinute, String fileName, String urlGUID, Integer userId);
/**
* 添加文件信息
* 返回是否添加成功
*
* @param fileModel
* @return
* @throws InvocationTargetException
* @throws IllegalAccessException
*/
Boolean addFile(FileModel fileModel) throws InvocationTargetException, IllegalAccessException;
/**
* 获取上一步添加的文件Id
*
* @return
*/
Integer getLastInsertId();
}