无人机项目后端代码
sean.zhou
2022-12-12 2d8ded3e77b22e44985265ca4063102662e452c1
src/main/java/com/dji/sample/media/controller/FileController.java
@@ -32,23 +32,23 @@
    public ResponseResult<PaginationData<MediaFileDTO>> getFilesList(@RequestParam(defaultValue = "1") Long page,
                               @RequestParam(name = "page_size", defaultValue = "10") Long pageSize,
                               @PathVariable(name = "workspace_id") String workspaceId) {
        PaginationData<MediaFileDTO> filesList = fileService.getJobsPaginationByWorkspaceId(workspaceId, page, pageSize);
        PaginationData<MediaFileDTO> filesList = fileService.getMediaFilesPaginationByWorkspaceId(workspaceId, page, pageSize);
        return ResponseResult.success(filesList);
    }
    /**
     * Query the download address of the file according to the media file fingerprint,
     * Query the download address of the file according to the media file id,
     * and redirect to this address directly for download.
     * @param workspaceId
     * @param fingerprint
     * @param fileId
     * @param response
     */
    @GetMapping("/{workspace_id}/file/{fingerprint}/url")
    @GetMapping("/{workspace_id}/file/{file_id}/url")
    public void getFileUrl(@PathVariable(name = "workspace_id") String workspaceId,
                           @PathVariable String fingerprint, HttpServletResponse response) {
                           @PathVariable(name = "file_id") String fileId, HttpServletResponse response) {
        try {
            URL url = fileService.getObjectUrl(workspaceId, fingerprint);
            URL url = fileService.getObjectUrl(workspaceId, fileId);
            response.sendRedirect(url.toString());
        } catch (IOException e) {
            e.printStackTrace();