Search in sources :

Example 1 with CommonFile

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();
}
Also used : CommonFile(com.qiwenshare.file.domain.CommonFile) ArrayList(java.util.ArrayList) FilePermission(com.qiwenshare.file.domain.FilePermission) Operation(io.swagger.v3.oas.annotations.Operation) MyLog(com.qiwenshare.common.anno.MyLog)

Example 2 with CommonFile

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);
}
Also used : CommonFile(com.qiwenshare.file.domain.CommonFile) UserFile(com.qiwenshare.file.domain.UserFile) CommonFileListVo(com.qiwenshare.file.vo.commonfile.CommonFileListVo) FileListVo(com.qiwenshare.file.vo.file.FileListVo) Operation(io.swagger.v3.oas.annotations.Operation)

Aggregations

CommonFile (com.qiwenshare.file.domain.CommonFile)2 Operation (io.swagger.v3.oas.annotations.Operation)2 MyLog (com.qiwenshare.common.anno.MyLog)1 FilePermission (com.qiwenshare.file.domain.FilePermission)1 UserFile (com.qiwenshare.file.domain.UserFile)1 CommonFileListVo (com.qiwenshare.file.vo.commonfile.CommonFileListVo)1 FileListVo (com.qiwenshare.file.vo.file.FileListVo)1 ArrayList (java.util.ArrayList)1