| | |
| | | } |
| | | |
| | | @Override |
| | | public Integer saveFile(String workspaceId, FileUploadDTO file) throws IOException, ImageProcessingException { |
| | | public Integer saveFile(String workspaceId, FileUploadDTO file) { |
| | | MediaFileEntity fileEntity = this.fileUploadConvertToEntity(file); |
| | | fileEntity.setWorkspaceId(workspaceId); |
| | | fileEntity.setFileId(UUID.randomUUID().toString()); |
| | | int count = mapper.insert(fileEntity); |
| | | String url = pojo.getEndpoint() + "/" + pojo.getBucket() + file.getObjectKey(); |
| | | if (file.getObjectKey().endsWith(".jpeg")) { |
| | | File file1 = TbFjServiceImpl.downloadFile(url); |
| | | Object data = ImgUtil.getInfo(file1); |
| | | fileEntity.setDroneData(data); |
| | | saveNailFile(workspaceId, file, file1,data); |
| | | count = mapper.insert(fileEntity); |
| | | file1.delete(); |
| | | } |
| | | if (file.getObjectKey().endsWith(".mp4")) { |
| | | saveNailFile(workspaceId, file, null,null); |
| | | } |
| | | return count; |
| | | return mapper.insert(fileEntity); |
| | | } |
| | | |
| | | public void saveNailFile(String workspaceId, FileUploadDTO file, File file1,Object data) throws IOException { |
| | | public void saveNailFile(String workspaceId, FileUploadDTO file) throws IOException, ImageProcessingException { |
| | | updateStatue(file.getName()); |
| | | boolean endsWith = file.getObjectKey().endsWith(".mp4"); |
| | | if (endsWith) { |
| | |
| | | nailEntity.setFileId(UUID.randomUUID().toString()); |
| | | nailMapper.insert(nailEntity); |
| | | } else { |
| | | String url = pojo.getEndpoint() + "/" + pojo.getBucket() + file.getObjectKey(); |
| | | File file1 = TbFjServiceImpl.downloadFile(url); |
| | | File nailFile = new File(ImgZipUtil.compressImage(file1, 50).toURI()); |
| | | MediaFileNailEntity nailEntity = this.fileUploadConvertToNailEntity(file); |
| | | Object data = ImgUtil.getInfo(file1); |
| | | nailEntity.setIsOriginal(false); |
| | | nailEntity.setDronedata(data); |
| | | nailEntity.setWorkspaceId(workspaceId); |
| | |
| | | return markEntity.getDronedata(); |
| | | } |
| | | } |
| | | } else { |
| | | List<MediaFileNailEntity> entities = nailMapper.selectList(new LambdaQueryWrapper<MediaFileNailEntity>() |
| | | .eq(MediaFileNailEntity::getFileName, name)); |
| | | if (entities != null && !entities.isEmpty()) { |
| | | for (MediaFileNailEntity NailEntity : entities) { |
| | | if (NailEntity.getDronedata() != null) { |
| | | return NailEntity.getDronedata(); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | return "null"; |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public List<MediaFileDTO> getAllFilesByWorkspaceId(String workspaceId) { |