use of com.qiwenshare.file.domain.CommonFile in project qiwen-file by qiwenshare.
the class CommonFileController method commonFile.
@Operation(summary = "共享文件", description = "共享文件统一接口", tags = { "common" })
@PostMapping(value = "/commonfile")
@MyLog(operation = "共享文件", module = CURRENT_MODULE)
@ResponseBody
public RestResult<String> commonFile(@RequestBody CommonFileDTO commonFileDTO) {
CommonFile commonFile = new CommonFile();
commonFile.setUserFileId(commonFileDTO.getUserFileId());
commonFileService.save(commonFile);
List<Long> list = JSON.parseArray(commonFileDTO.getCommonUserIds(), Long.class);
List<FilePermission> filePermissionList = new ArrayList<>();
for (Long userId : list) {
FilePermission filePermission = new FilePermission();
filePermission.setUserId(Long.parseLong(commonFileDTO.getCommonUserIds()));
filePermission.setCommonFileId(commonFile.commonFileId);
filePermission.setFilePermissionCode(commonFileDTO.getPermissionCode());
filePermissionList.add(filePermission);
}
filePermissionService.saveBatch(filePermissionList);
return RestResult.success();
}
use of com.qiwenshare.file.domain.CommonFile in project qiwen-file by qiwenshare.
the class CommonFileController method commonFileList.
@Operation(summary = "获取共享用户文件列表", description = "用来做前台列表展示", tags = { "file" })
@RequestMapping(value = "/commonFileList", method = RequestMethod.GET)
@ResponseBody
public RestResult<FileListVo> commonFileList(@Parameter(description = "用户id", required = true) Long commonFileId, @Parameter(description = "文件路径", required = true) String filePath, @Parameter(description = "当前页", required = true) long currentPage, @Parameter(description = "页面数量", required = true) long pageCount) {
CommonFile commonFile = commonFileService.getById(commonFileId);
UserFile userFile = userFileService.getById(commonFile.getUserFileId());
filePath = userFile.getFilePath() + filePath;
IPage<FileListVo> fileList = userFileService.userFileList(userFile.getUserId(), filePath, currentPage, pageCount);
return RestResult.success().data(fileList);
}
Aggregations