| | |
| | | .eq(MediaFileEntity::getFileId, fileId)); |
| | | return Optional.ofNullable(fileEntity); |
| | | } |
| | | |
| | | public void saveMarkFile(String workspaceId, MediaFileEntity file,File file1) { |
| | | try { |
| | | MediaFileMarkEntity mediaFileMarkEntity= new MediaFileMarkEntity(); |
| | | mediaFileMarkEntity.setWorkspaceId(workspaceId); |
| | | mediaFileMarkEntity.setIsadd(0); |
| | | mediaFileMarkEntity.setIsOriginal(false); |
| | | mediaFileMarkEntity.setFileId(UUID.randomUUID().toString()); |
| | | mediaFileMarkEntity.setObjectKey("/mark" + file.getFilePath()+ "/" + file.getFileName()); |
| | | mediaFileMarkEntity.setFileName("mark" + file.getFileName()); |
| | | mediaFileMarkEntity.setFilePath("mark" + file.getFilePath()); |
| | | uploadFile(pojo.getEndpoint(), pojo.getAccessKey(), pojo.getSecretKey(), pojo.getBucket(), mediaFileMarkEntity.getObjectKey(), file1, "image/jpeg"); |
| | | markMapper.insert(mediaFileMarkEntity); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | @Override |
| | | public Boolean checkExist(String workspaceId, String fingerprint) { |
| | | return this.getMediaByFingerprint(workspaceId, fingerprint).isPresent(); |
| | |
| | | public Integer saveFile(String workspaceId, FileUploadDTO file) throws ImageProcessingException, IOException { |
| | | MediaFileEntity fileEntity = this.fileUploadConvertToEntity(file); |
| | | fileEntity.setWorkspaceId(workspaceId); |
| | | fileEntity.setIsadd(0); |
| | | fileEntity.setFileId(UUID.randomUUID().toString()); |
| | | String url = pojo.getEndpoint() + "/" + pojo.getBucket() + file.getObjectKey(); |
| | | File downloadedFile = TbFjServiceImpl.downloadFile(url); |
| | | Object data = ImgUtil.getInfo(downloadedFile); |
| | | fileEntity.setDroneData(data); |
| | | //避免对视频处理引发报错 |
| | | if (file.getObjectKey().endsWith("jpeg")){ |
| | | fileEntity.setIsadd(0); |
| | | String url = pojo.getEndpoint() + "/" + pojo.getBucket() + file.getObjectKey(); |
| | | File downloadedFile = TbFjServiceImpl.downloadFile(url); |
| | | Object data = ImgUtil.getInfo(downloadedFile); |
| | | fileEntity.setDroneData(data); |
| | | updateStatue(file.getName()); |
| | | } |
| | | return mapper.insert(fileEntity); |
| | | } |
| | | public void saveFiles(String workspaceId, FileUploadDTO file) { |