| | |
| | | nailEntity.setWorkspaceId(workspaceId); |
| | | nailEntity.setFileId(UUID.randomUUID().toString()); |
| | | nailMapper.insert(nailEntity); |
| | | MediaFileZipEntity zipEntity = this.fileUploadConvertToZipEntity((file)); |
| | | zipEntity.setWorkspaceId(workspaceId); |
| | | zipEntity.setFileId(UUID.randomUUID().toString()); |
| | | zipMapper.insert(zipEntity); |
| | | } else { |
| | | String url = pojo.getEndpoint() + "/" + pojo.getBucket() + file.getObjectKey(); |
| | | File file1 = TbFjServiceImpl.downloadFile(url); |
| | |
| | | nailEntity.setFilePath("nail" + file.getPath()); |
| | | String nailName = nailEntity.getObjectKey(); |
| | | nailEntity.setFileId(UUID.randomUUID().toString()); |
| | | uploadFile("http://139.196.74.78:9000", "sxkj", "sxkj2024", "cloud-bucket", file.getObjectKey(), file1, "image/jpeg"); |
| | | 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); |
| | | } |
| | | } |
| | | |
| | | // public void saveZipFile(String workspaceId, FileUploadDTO file) throws IOException, ImageProcessingException { |
| | | // updateStatue(file.getName()); |
| | | // boolean endsWith = file.getObjectKey().endsWith(".mp4"); |
| | | // if (endsWith) { |
| | | // MediaFileZipEntity nailEntity = this.fileUploadConvertToZipEntity((file)); |
| | | // nailEntity.setWorkspaceId(workspaceId); |
| | | // nailEntity.setFileId(UUID.randomUUID().toString()); |
| | | // zipMapper.insert(nailEntity); |
| | | // } else { |
| | | // String url = pojo.getEndpoint() + "/" + pojo.getBucket() + file.getObjectKey(); |
| | | // File file1 = TbFjServiceImpl.downloadFile(url); |
| | | // File nailFile = new File(ImgZipUtil.compressImageAndGetFile(file1, 0.5f).toURI()); |
| | | // MediaFileZipEntity zipEntity = this.fileUploadConvertToZipEntity(file); |
| | | // zipEntity.setIsOriginal(false); |
| | | // zipEntity.setWorkspaceId(workspaceId); |
| | | // zipEntity.setFileName("zip" + file.getName()); |
| | | // zipEntity.setObjectKey("/zip" + file.getPath() + "/" + file.getName()); |
| | | // zipEntity.setFilePath("zip" + file.getPath()); |
| | | // String nailName = zipEntity.getObjectKey(); |
| | | // zipEntity.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"); |
| | | // zipMapper.insert(zipEntity); |
| | | // } |
| | | // } |
| | | public void saveZipFile(String workspaceId, FileUploadDTO file) throws IOException, ImageProcessingException { |
| | | updateStatue(file.getName()); |
| | | boolean endsWith = file.getObjectKey().endsWith(".mp4"); |
| | | if (endsWith) { |
| | | MediaFileZipEntity zipEntity = this.fileUploadConvertToZipEntity((file)); |
| | | zipEntity.setWorkspaceId(workspaceId); |
| | | zipEntity.setFileId(UUID.randomUUID().toString()); |
| | | zipMapper.insert(zipEntity); |
| | | } else { |
| | | String url = pojo.getEndpoint() + "/" + pojo.getBucket() + file.getObjectKey(); |
| | | File file1 = TbFjServiceImpl.downloadFile(url); |
| | | File nailFile = new File(ImgZipUtil.compressImageAndGetFile(file1, 0.5f).toURI()); |
| | | MediaFileZipEntity zipEntity = this.fileUploadConvertToZipEntity(file); |
| | | zipEntity.setIsOriginal(false); |
| | | zipEntity.setWorkspaceId(workspaceId); |
| | | zipEntity.setFileName("zip" + file.getName()); |
| | | zipEntity.setObjectKey("/zip" + file.getPath() + "/" + file.getName()); |
| | | zipEntity.setFilePath("zip" + file.getPath()); |
| | | String nailName = zipEntity.getObjectKey(); |
| | | zipEntity.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"); |
| | | zipMapper.insert(zipEntity); |
| | | } |
| | | } |
| | | |
| | | public void updateStatue(String filename) { |
| | | if (filename.contains("~")) { |
| | |
| | | @Override |
| | | public ResponseResult downloadImages(List<String> jobIds) { |
| | | try { |
| | | String bucketPath = "/data/software/minio-data/cloud-bucket/"; |
| | | String bucketPath = "/data/software/minio-data/cloud-bucket"; |
| | | List<String> prefixes = getUniqueFilePaths(jobIds); |
| | | MinioFileDownloader downloader = new MinioFileDownloader(bucketPath); |
| | | // 下载并压缩文件到本地目录 |
| | | String localSaveDir = "/data/software/minio-data/zip-bucket/"; // 修改为你想保存的本地目录 |
| | | String localSaveDir = "/data/software/minio-data/zip-bucket"; // 修改为你想保存的本地目录 |
| | | downloader.downloadAndZipFolders(prefixes, localSaveDir); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | |
| | | for (MediaFileNailEntity mark : markEntities) { |
| | | updateNailMediaFileNames(mark.getJobId()); |
| | | updateMediaFileNames(mark.getJobId()); |
| | | // updateMediaZipFileNames(mark.getJobId()); |
| | | updateMediaZipFileNames(mark.getJobId()); |
| | | } |
| | | } |
| | | |