Commit 738d17e2 by 龙于生 Committed by 284718418@qq.com

云盘 查询文件是否存在、新增文件查看记录 接口

parent 8763003d
......@@ -226,16 +226,17 @@ public class DiskFilesController {
@GetMapping(value = "/exportContract")
public void exportContract(@CurrentUser UserBean userBean, @ApiParam("文件ID") @RequestParam(required = true) Integer fileId,
@ApiParam("下载通道默认不传:我收到的列表下载传type=1") @RequestParam(required = false) Integer type, HttpServletResponse resp) {
if (fileId == null || fileId <= 0) {
DiskFiles diskFiles = DiskFiles.builder().id(fileId).build().selectById();
/*if (fileId == null || fileId <= 0) {
throw new CustomException("下载失败,请选择文件下载");
}
DiskFiles diskFiles = DiskFiles.builder().id(fileId).build().selectById();
if(StringUtils.isEmpty(diskFiles)){
throw new CustomException("下载失败,文件不存在");
}
if(diskFiles.getDeleteFlag() == 1 && StringUtils.isEmpty(type)){
throw new CustomException("下载失败,该文件已删除");
}
}*/
InputStream fis = null;
BufferedInputStream bis = null;
OutputStream os;
......@@ -285,10 +286,17 @@ public class DiskFilesController {
@ApiOperation(value = "新增文件查看记录", httpMethod = "GET", notes = "新增文件查看记录")
@GetMapping(value = "/look_log/{fileId}")
public Result<Object> lookLog(@CurrentUser UserBean userBean, @ApiParam("文件ID") @PathVariable Integer fileId){
@GetMapping(value = "/add_look_log")
public Result<Object> lookLog(@CurrentUser UserBean userBean,@ApiParam("文件ID") @RequestParam(required = true) Integer fileId,
@ApiParam("默认不传,我收到的列表查看传type=1") @RequestParam(required = false) Integer type){
DiskFiles diskFiles = DiskFiles.builder().id(fileId).build().selectById();
DiskFilesLog diskFilesLog = DiskFilesLog.builder().build();
if(StringUtils.isEmpty(diskFiles)){
throw new CustomException("查看失败,文件不存在");
}
if(diskFiles.getDeleteFlag() == 1 && StringUtils.isEmpty(type)){
throw new CustomException("查看失败,该文件已删除");
}
//新增 文件浏览记录
diskFilesLog.setFilePath(diskFiles.getUrlPath());
diskFilesLog.setFilesId(diskFiles.getId());
......@@ -301,4 +309,19 @@ public class DiskFilesController {
return ResultUtil.success();
}
@ApiOperation(value = "查询文件是否存在", httpMethod = "GET", notes = "查询文件是否存在")
@GetMapping(value = "/query_file_isExist")
public Result<Object> queryFileIsExist(@CurrentUser UserBean userBean,@ApiParam("文件ID") @RequestParam(required = true) Integer fileId,
@ApiParam("默认不传,我收到的列表查询传type=1") @RequestParam(required = false) Integer type){
DiskFiles diskFiles = DiskFiles.builder().id(fileId).build().selectById();
DiskFilesLog diskFilesLog = DiskFilesLog.builder().build();
if(StringUtils.isEmpty(diskFiles)){
throw new CustomException("文件不存在");
}
if(diskFiles.getDeleteFlag() == 1 && StringUtils.isEmpty(type)){
throw new CustomException("该文件已删除");
}
return ResultUtil.success();
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment