| | |
| | | import com.dji.sample.media.model.MediaFileQueryParam; |
| | | import com.dji.sample.media.service.IFileService; |
| | | import com.dji.sample.media.util.ImageDownloaderAndCompressor; |
| | | import com.dji.sample.media.util.MinioFileDownloader; |
| | | import com.drew.imaging.ImageProcessingException; |
| | | import org.apache.ibatis.annotations.Update; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.mock.web.MockHttpServletResponse; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | |
| | | @RequestParam(defaultValue = "1") int page, |
| | | @RequestParam(name = "page_size", defaultValue = "10") int pageSize |
| | | ) { |
| | | return ResponseResult.success(fileService.getJobId(page, pageSize, workspaceId)); |
| | | return ResponseResult.success(fileService.mediaQuerys(page, pageSize, workspaceId)); |
| | | } |
| | | |
| | | @PutMapping("/examine") |
| | |
| | | @RequestParam(name = "updateStart", required = false) Long photoStart, |
| | | @RequestParam(name = "updateEnd", required = false) Long photoEnd, |
| | | @RequestParam(name = "jobName", required = false) String jobName, |
| | | @RequestParam(name = "jobId", required = false) String jobId, |
| | | @RequestParam(required = false) String type |
| | | ) { |
| | | |
| | | return ResponseResult.success(fileService.mediaQuery(page, pageSize, updateStart, updateEnd, photoStart, photoEnd, jobName, workspaceId, type)); |
| | | return ResponseResult.success(fileService.mediaQuery(page, pageSize, updateStart, updateEnd, photoStart, photoEnd, jobName, workspaceId, type,jobId)); |
| | | |
| | | } |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | 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); |
| | | @PostMapping("/download-images") |
| | | public ResponseResult downloadImages(@RequestBody List<String> jobIds) { |
| | | return fileService.downloadImages(jobIds); |
| | | } |
| | | |
| | | @GetMapping("/refreshPhoto") |
| | | public void refreshPhoto(){ |
| | | fileService.getNoaddFile(); |
| | | } |
| | | } |