rain
2024-08-16 589ff1b4b598f2f763eb421da960d5550e719144
src/main/java/com/dji/sample/media/service/impl/MediaServiceImpl.java
@@ -89,7 +89,7 @@
    }
    @Override
    public Integer saveMediaFile(String workspaceId, FileUploadDTO file) throws ImageProcessingException, IOException {
    public Integer saveMediaFile(String workspaceId, FileUploadDTO file) throws IOException, ImageProcessingException {
        return fileService.saveFile(workspaceId, file);
    }
@@ -218,7 +218,7 @@
                BizCodeEnum.FILE_UPLOAD_CALLBACK.getCode(), mediaFileCount);
    }
    private Boolean parseMediaFile(FileUploadCallback callback, WaylineJobDTO job) throws IOException, FontFormatException, ImageProcessingException {
    private Boolean parseMediaFile(FileUploadCallback callback, WaylineJobDTO job) throws ImageProcessingException, IOException, FontFormatException {
        // Set the drone sn that shoots the media
        Optional<DeviceDTO> dockDTO = deviceService.getDeviceBySn(job.getDockSn());
        dockDTO.ifPresent(dock -> callback.getFile().getExt().setSn(dock.getChildDeviceSn()));
@@ -226,28 +226,15 @@
        // set path
        String objectKey = callback.getFile().getObjectKey();
        callback.getFile().setPath(objectKey.substring(objectKey.indexOf("/") + 1, objectKey.lastIndexOf("/")));
        try {
            ExecutorService executor = Executors.newSingleThreadExecutor();
            executor.execute(() -> {
                try {
                    fileService.saveMarkFile(job.getWorkspaceId(), callback.getFile());
                } catch (Exception e) {
                    throw new RuntimeException(e);
                }
            });
            executor.shutdown();
        } catch (Exception e) {
            log.error("方法执行有误==============: ", e);
            throw e;
        }
        return fileService.saveFile(job.getWorkspaceId(), callback.getFile()) > 0;
        int count =fileService.saveFile(job.getWorkspaceId(), callback.getFile());
//        fileService.saveFiles(job.getWorkspaceId(), callback.getFile());
//        fileService.saveZipFile(job.getWorkspaceId(),callback.getFile());
        return count > 0;
    }
    /**
     * Handles the highest priority message about media uploads.
     *
     * 处理有关媒体上传的最高优先级消息。
     * @param receiver
     * @param headers
     * @return
@@ -285,4 +272,9 @@
        return receiver;
    }
    @Override
    public MediaFileEntity getMediaFieByTid(String timestamp) {
        return mapper.getMediaFieByTid(timestamp);
    }
}