| | |
| | | @Override |
| | | public ResponseResult downloadImages(List<String> jobIds) { |
| | | String localSaveDir = "/home/drone/web/zip"; |
| | | String filepath=localSaveDir+TimerUtil.getNowDay(); |
| | | String downPath="https://wrj.shuixiongit.com/downloadZip/"; |
| | | String filepath=TimerUtil.getNowDay()+".zip"; |
| | | try { |
| | | String bucketPath = "/data/software/minio-data/cloud-bucket"; |
| | | List<String> prefixes = getUniqueFilePaths(jobIds); |
| | |
| | | e.printStackTrace(); |
| | | return ResponseResult.error("下载失败" + e.getMessage()); |
| | | } |
| | | return ResponseResult.success(filepath); |
| | | return ResponseResult.success(downPath+filepath); |
| | | } |
| | | |
| | | @Override |
| | |
| | | package com.dji.sample.media.util; |
| | | |
| | | import com.dji.sample.patches.utils.TimerUtil; |
| | | import io.minio.MinioClient; |
| | | import io.minio.RemoveObjectArgs; |
| | | import io.minio.StatObjectArgs; |
| | |
| | | this.bucketPath = bucketPath; |
| | | } |
| | | |
| | | public void downloadAndZipFolders(List<String> prefixes, String localSaveDir,String filepath) throws Exception { |
| | | public void downloadAndZipFolders(List<String> prefixes, String localSaveDir,String time) throws Exception { |
| | | // 创建目标文件夹路径并生成zip文件名 |
| | | Path localSavePath = Paths.get(localSaveDir); |
| | | if (!Files.exists(localSavePath)) { |
| | | Files.createDirectories(localSavePath); |
| | | } |
| | | String zipFileName = localSavePath.resolve(filepath).toString(); |
| | | String zipFileName = localSavePath.resolve(time).toString(); |
| | | |
| | | // 创建压缩文件输出流 |
| | | try (ZipOutputStream zos = new ZipOutputStream(new FileOutputStream(zipFileName))) { |