| | |
| | | fileEntity.setFileId(UUID.randomUUID().toString()); |
| | | int count=mapper.insert(fileEntity); |
| | | String url = pojo.getEndpoint() + "/" + pojo.getBucket() + file.getObjectKey(); |
| | | updateStatue(file.getName()); |
| | | if (!file.getObjectKey().endsWith(".mp4")){ |
| | | if (file.getObjectKey().endsWith(".jpeg")) { |
| | | File file1 = TbFjServiceImpl.downloadFile(url); |
| | | saveNailFile(workspaceId,file,file1); |
| | | Object data = ImgUtil.getInfo(file1); |
| | | fileEntity.setDroneData(data); |
| | | saveNailFile(workspaceId, file, file1,data); |
| | | count = mapper.insert(fileEntity); |
| | | file1.delete(); |
| | | } |
| | | else { |
| | | File file1 = TbFjServiceImpl.downloadFile(url); |
| | | saveNailFile(workspaceId,file,file1); |
| | | file1.delete(); |
| | | if (file.getObjectKey().endsWith(".mp4")) { |
| | | saveNailFile(workspaceId, file, null,null); |
| | | } |
| | | return count; |
| | | } |
| | | |
| | | public void saveNailFile(String workspaceId,FileUploadDTO file,File file1) throws IOException { |
| | | public void saveNailFile(String workspaceId, FileUploadDTO file, File file1,Object data) throws IOException { |
| | | updateStatue(file.getName()); |
| | | boolean endsWith = file.getObjectKey().endsWith(".mp4"); |
| | | if (endsWith) { |
| | | MediaFileNailEntity nailEntity = this.fileUploadConvertToNailEntity((file)); |
| | |
| | | File nailFile = new File(ImgZipUtil.compressImage(file1, 50).toURI()); |
| | | MediaFileNailEntity nailEntity = this.fileUploadConvertToNailEntity(file); |
| | | nailEntity.setIsOriginal(false); |
| | | nailEntity.setDronedata(data); |
| | | nailEntity.setWorkspaceId(workspaceId); |
| | | nailEntity.setFileName("nail" + file.getName()); |
| | | nailEntity.setObjectKey("/nail" + file.getPath() + "/" + file.getName()); |
| | |
| | | String nailName = nailEntity.getObjectKey(); |
| | | nailEntity.setFileId(UUID.randomUUID().toString()); |
| | | uploadFile(pojo.getEndpoint(), pojo.getAccessKey(), pojo.getSecretKey(), pojo.getBucket(), nailName, nailFile, "image/jpeg"); |
| | | uploadFile("http://139.196.74.78:9000", "sxkj", "sxkj2024", "cloud-bucket", nailName, nailFile, "image/jpeg"); |
| | | nailMapper.insert(nailEntity); |
| | | } |
| | | } |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public Object mediaInfo(String filename) { |
| | | String name = filename; |
| | |
| | | } |
| | | return ResponseResult.success("下载成功"); |
| | | } |
| | | |
| | | @Override |
| | | public List<String> getUniqueFilePaths(List<String> jobIds) { |
| | | return mapper.selectList( |
| | |
| | | .distinct() |
| | | .collect(Collectors.toList()); |
| | | } |
| | | |
| | | @Override |
| | | public List<MediaFileDTO> getFilesByWorkspaceAndJobId(String workspaceId, String jobId) { |
| | | return mapper.selectList(new LambdaQueryWrapper<MediaFileEntity>() |
| | |
| | | |
| | | return builder.build(); |
| | | } |
| | | |
| | | public static void uploadFile(String endpoint, String accessKey, String secretKey, String bucketName, String objectName, File file, String type) { |
| | | try { |
| | | // 创建MinIO客户端实例 |
| | |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public PaginationData<MediaFileEntity> getJobId(int pageNum, int pageSize, String workspaceId) { |
| | | List<MediaFileEntity> allRecords = new ArrayList<>(); |
| | |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | @Override |
| | | public PaginationData<MediaFileEntity> getPhotoByJobId(int pageNum, int pageSize, String workspaceId, String jobId) { |
| | | |
| | |
| | | |
| | | return new PaginationData<>(pagedUniqueFiles, pagination); |
| | | } |
| | | |
| | | |
| | | |
| | | public List<MediaFileEntity> getMedia(String jobId) { |