mirror of
https://gitee.com/bookshelfplus/bookshelfplus
synced 2025-09-01 22:53:29 +08:00
登陆过期重新登录跳回原来页面;管理员后台文件详情页面文件详情和关联文件对象
This commit is contained in:
@@ -55,11 +55,11 @@ public class FileController extends BaseController {
|
||||
VisitorFingerprintLogServiceImpl visitorFingerprintLogService;
|
||||
|
||||
@ApiOperation(value = "书籍下载页面获取文件提供的下载方式", notes = "")
|
||||
@RequestMapping(value = "getFile", method = {RequestMethod.GET})
|
||||
@RequestMapping(value = "getFileByBookId", method = {RequestMethod.GET})
|
||||
@ResponseBody
|
||||
public CommonReturnType getFile(@RequestParam(value = "bookId", required = false) Integer bookId) throws BusinessException, InvocationTargetException, IllegalAccessException {
|
||||
public CommonReturnType getFileByBookId(@RequestParam(value = "bookId", required = false) Integer bookId) throws BusinessException, InvocationTargetException, IllegalAccessException {
|
||||
|
||||
List<FileModel> fileModels = fileService.getFile(bookId);
|
||||
List<FileModel> fileModels = fileService.getFileByBookId(bookId);
|
||||
List<FileVO> fileVOS = new ArrayList<>();
|
||||
for (FileModel fileModel : fileModels) {
|
||||
FileVO fileVO = convertFileVOFromModel(fileModel);
|
||||
@@ -80,6 +80,15 @@ public class FileController extends BaseController {
|
||||
return CommonReturnType.create(map);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "通过 fileId 获取文件信息", notes = "")
|
||||
@RequestMapping(value = "getFileById", method = {RequestMethod.GET})
|
||||
@ResponseBody
|
||||
public CommonReturnType getFileById(@RequestParam(value = "fileId", required = false) Integer fileId) throws BusinessException, InvocationTargetException, IllegalAccessException {
|
||||
FileModel fileModel = fileService.getFileById(fileId);
|
||||
FileVO fileVO = convertFileVOFromModel(fileModel);
|
||||
return CommonReturnType.create(fileVO);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "【管理员】查询文件列表", notes = "查询文件列表")
|
||||
@RequestMapping(value = "list", method = {RequestMethod.POST}, consumes = {CONTENT_TYPE_FORMED})
|
||||
@ResponseBody
|
||||
|
@@ -112,6 +112,20 @@ public class FileObjectController extends BaseController {
|
||||
return CommonReturnType.create(fileObjectVOS);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "查询指定文件的文件对象列表", notes = "传入文件Id,返回文件对象列表")
|
||||
@RequestMapping(value = "getByFileId", method = {RequestMethod.GET})
|
||||
@ResponseBody
|
||||
public CommonReturnType getFileObjectByFileId(@RequestParam(value = "fileId", required = false) Integer fileId) throws InvocationTargetException, IllegalAccessException, BusinessException {
|
||||
|
||||
List<FileObjectModel> fileObjectModels = fileObjectService.getFileObjectListByFileId(fileId);
|
||||
List<FileObjectVO> fileObjectVOS = new ArrayList<>();
|
||||
for (FileObjectModel fileObjectModel : fileObjectModels) {
|
||||
FileObjectVO fileObjectVO = convertFileObjectVOFromModel(fileObjectModel);
|
||||
fileObjectVOS.add(fileObjectVO);
|
||||
}
|
||||
return CommonReturnType.create(fileObjectVOS);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "【管理员】更新文件对象上传状态", notes = "重新从 COS 对象存储中获取文件对象上传状态")
|
||||
@RequestMapping(value = "refreshFileObjectStatus", method = {RequestMethod.POST}, consumes = {CONTENT_TYPE_FORMED})
|
||||
@ResponseBody
|
||||
|
@@ -68,6 +68,14 @@ public interface FileObjectDOMapper {
|
||||
*/
|
||||
FileObjectDO selectByFilePath(String filePath);
|
||||
|
||||
/**
|
||||
* 通过文件路径获取文件
|
||||
*
|
||||
* @param fileId 文件Id
|
||||
* @return
|
||||
*/
|
||||
FileObjectDO[] selectByFileId(Integer fileId);
|
||||
|
||||
/**
|
||||
* 通过书本Id获取关联文件,进而获取所有关联文件对应的文件对象
|
||||
*
|
||||
|
@@ -233,4 +233,23 @@ public class FileObjectServiceImpl implements FileObjectService {
|
||||
FileObjectModel fileObjectModel = convertFromDataObject(fileObjectDO);
|
||||
return fileObjectModel;
|
||||
}
|
||||
|
||||
/**
|
||||
* 列出指定文件的所有文件对象
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<FileObjectModel> getFileObjectListByFileId(Integer fileId) throws InvocationTargetException, IllegalAccessException, BusinessException {
|
||||
|
||||
FileObjectDO[] fileObjectDOS = fileObjectDOMapper.selectByFileId(fileId);
|
||||
|
||||
List<FileObjectModel> fileObjectModels = new ArrayList<>();
|
||||
for (FileObjectDO fileObjectDO : fileObjectDOS) {
|
||||
FileObjectModel fileObjectModel = convertFromDataObject(fileObjectDO);
|
||||
fileObjectModels.add(fileObjectModel);
|
||||
}
|
||||
|
||||
return fileObjectModels;
|
||||
}
|
||||
}
|
||||
|
@@ -42,10 +42,12 @@ public class FileServiceImpl implements FileService {
|
||||
/**
|
||||
* 列出文件支持的下载方式
|
||||
*
|
||||
* @param bookId
|
||||
* @return
|
||||
* @throws BusinessException
|
||||
*/
|
||||
@Override
|
||||
public List<FileModel> getFile(Integer bookId) throws BusinessException {
|
||||
public List<FileModel> getFileByBookId(Integer bookId) throws BusinessException {
|
||||
|
||||
if (bookId == 0 || bookId == null) {
|
||||
throw new BusinessException(BusinessErrorCode.PARAMETER_VALIDATION_ERROR, "bookId不能为空");
|
||||
@@ -62,6 +64,25 @@ public class FileServiceImpl implements FileService {
|
||||
return fileModels;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据文件ID获取文件信息
|
||||
*
|
||||
* @param fileId
|
||||
* @return
|
||||
* @throws BusinessException
|
||||
*/
|
||||
@Override
|
||||
public FileModel getFileById(Integer fileId) throws BusinessException {
|
||||
|
||||
if (fileId == 0 || fileId == null) {
|
||||
throw new BusinessException(BusinessErrorCode.PARAMETER_VALIDATION_ERROR, "fileId不能为空");
|
||||
}
|
||||
|
||||
FileDO fileDO = fileDOMapper.selectByPrimaryKey(fileId);
|
||||
FileModel fileModel = convertFromDataObject(fileDO);
|
||||
return fileModel;
|
||||
}
|
||||
|
||||
/**
|
||||
* 列出所有文件
|
||||
*
|
||||
|
@@ -82,4 +82,15 @@ public interface FileObjectService {
|
||||
* @throws IllegalAccessException
|
||||
*/
|
||||
FileObjectModel getFileObjectById(Integer fileObjectId) throws InvocationTargetException, IllegalAccessException;
|
||||
|
||||
/**
|
||||
* 列出指定文件的所有文件对象
|
||||
*
|
||||
* @param fileId
|
||||
* @return
|
||||
* @throws InvocationTargetException
|
||||
* @throws IllegalAccessException
|
||||
* @throws BusinessException
|
||||
*/
|
||||
List<FileObjectModel> getFileObjectListByFileId(Integer fileId) throws InvocationTargetException, IllegalAccessException, BusinessException;
|
||||
}
|
||||
|
@@ -16,7 +16,16 @@ public interface FileService {
|
||||
* @throws IllegalAccessException
|
||||
* @throws BusinessException
|
||||
*/
|
||||
List<FileModel> getFile(Integer bookId) throws InvocationTargetException, IllegalAccessException, BusinessException;
|
||||
List<FileModel> getFileByBookId(Integer bookId) throws InvocationTargetException, IllegalAccessException, BusinessException;
|
||||
|
||||
/**
|
||||
* 根据文件ID获取文件信息
|
||||
*
|
||||
* @param fileId
|
||||
* @return
|
||||
* @throws BusinessException
|
||||
*/
|
||||
FileModel getFileById(Integer fileId) throws BusinessException;
|
||||
|
||||
/**
|
||||
* 列出所有文件
|
||||
|
Reference in New Issue
Block a user