rain
2024-07-20 bf7a9ef439e3b49268974d564107999619b2b4fd
src/main/java/com/dji/sample/media/controller/FileController.java
@@ -171,23 +171,9 @@
        }
    }
    private static final String BASE_URL = "http://dev.jxpskj.com:9000/cloud-bucket";
    @GetMapping("/download-images")
    public void downloadImages(@RequestParam String jobId, HttpServletResponse response) {
        List<MediaFileEntity> entities = fileService.getMedia(jobId);
        List<String> urls = entities.stream()
                .map(MediaFileEntity::getObjectKey)
                .map(objectKey -> BASE_URL + objectKey)
                .collect(Collectors.toList());
        String outputFolder = "images"; // 存放图片的文件夹
        new File(outputFolder).mkdirs(); // 创建文件夹
        downloadAndSaveImages(urls, outputFolder);
        zipAndSendFolder(outputFolder, response);
        cleanUp(outputFolder);
    fileService.downloadImages(jobId,response);
    }
}