src/main/java/com/dji/sample/media/service/impl/FileServiceImpl.java
@@ -115,65 +115,64 @@
        return mapper.insert(fileEntity);
    }
    public void saveMarkFile(String workspaceId, FileUploadDTO file) throws IOException, FontFormatException, ImageProcessingException {
        String endpoint = pojo.getEndpoint();
        String accessKey = pojo.getAccessKey();
        String secretKey = pojo.getSecretKey();
        String bucketName = pojo.getBucket();
        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);
        nailEntity.setIsOriginal(false);
        nailEntity.setWorkspaceId(workspaceId);
        nailEntity.setFileName("nail" + file.getName());
        nailEntity.setObjectKey("/nail" + file.getPath() + "/" + file.getName());
        nailEntity.setFilePath("nail" + file.getPath());
        String nailName = nailEntity.getObjectKey();
        nailEntity.setFileId(UUID.randomUUID().toString());
        uploadFile(endpoint, accessKey, secretKey, bucketName, nailName, nailFile, "image/jpeg");
        nailMapper.insert(nailEntity);
        try {
            boolean contains = file.getName().contains("~");
            if (contains) {
                String name = TimerUtil.getDkbh(file.getName());
                List<LotInfo> lotInfos = patchesMapper.selectList(new LambdaQueryWrapper<LotInfo>().eq(LotInfo::getDkbh, name));
                if (!lotInfos.isEmpty()) {
                    LambdaUpdateWrapper<LotInfo> updateWrapper = new LambdaUpdateWrapper<>();
                    updateWrapper.eq(LotInfo::getDkbh, name)
                            .eq(LotInfo::getInvestigate, 0)
                            .set(LotInfo::getInvestigate, 1);
                    patchesMapper.update(null, updateWrapper);
    public void saveMarkFile(String workspaceId, FileUploadDTO file) throws IOException {
        boolean endsWith = file.getObjectKey().endsWith(".mp4");
        if (endsWith) {
            MediaFileNailEntity nailEntity = this.fileUploadConvertToNailEntity((file));
            nailEntity.setWorkspaceId(workspaceId);
            nailEntity.setFileId(UUID.randomUUID().toString());
            nailMapper.insert(nailEntity);
        } else {
            String endpoint = pojo.getEndpoint();
            String accessKey = pojo.getAccessKey();
            String secretKey = pojo.getSecretKey();
            String bucketName = pojo.getBucket();
            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);
            nailEntity.setIsOriginal(false);
            nailEntity.setWorkspaceId(workspaceId);
            nailEntity.setFileName("nail" + file.getName());
            nailEntity.setObjectKey("/nail" + file.getPath() + "/" + file.getName());
            nailEntity.setFilePath("nail" + file.getPath());
            String nailName = nailEntity.getObjectKey();
            nailEntity.setFileId(UUID.randomUUID().toString());
            uploadFile(endpoint, accessKey, secretKey, bucketName, nailName, nailFile, "image/jpeg");
            nailMapper.insert(nailEntity);
            try {
                if (file.getName().contains("~")) {
                    String name = TimerUtil.getDkbh(file.getName());
                    List<LotInfo> lotInfos = patchesMapper.selectList(new LambdaQueryWrapper<LotInfo>().eq(LotInfo::getDkbh, name));
                    if (!lotInfos.isEmpty()) {
                        LambdaUpdateWrapper<LotInfo> updateWrapper = new LambdaUpdateWrapper<>();
                        updateWrapper.eq(LotInfo::getDkbh, name)
                                .eq(LotInfo::getInvestigate, 0)
                                .set(LotInfo::getInvestigate, 1);
                        patchesMapper.update(null, updateWrapper);
                    }
                }
                boolean endsWith = file.getObjectKey().endsWith(".mp4");
                if (endsWith) {
                    MediaFileMarkEntity mediaFileMarkEntity = this.fileUploadConvertToMarkEntity(file);
                    long timestamp = convertToTimestamp(file.getMetadata().getCreatedTime());
                    File markFile = new File(WaterMarkUtil.addWatermark(file1, timestamp, file.getMetadata().getShootPosition().getLat(),
                            file.getMetadata().getShootPosition().getLng(), file.getMetadata().getGimbalYawDegree()).toURI());
                    Object data = ImgUtil.getInfo(file1);
                    mediaFileMarkEntity.setDronedata(data);
                    mediaFileMarkEntity.setWorkspaceId(workspaceId);
                    mediaFileMarkEntity.setIsadd(0);
                    mediaFileMarkEntity.setIsOriginal(false);
                    mediaFileMarkEntity.setFileId(UUID.randomUUID().toString());
                    mediaFileMarkEntity.setObjectKey("/mark" + file.getPath() + "/" + file.getName());
                    mediaFileMarkEntity.setFileName("mark" + file.getName());
                    mediaFileMarkEntity.setFilePath("mark" + file.getPath());
                    String objectName = mediaFileMarkEntity.getObjectKey(); // 例如 "folder/file.txt"
                    uploadFile(endpoint, accessKey, secretKey, bucketName, objectName, markFile, "image/jpeg");
                    markMapper.insert(mediaFileMarkEntity);
                }
                MediaFileMarkEntity mediaFileMarkEntity = this.fileUploadConvertToMarkEntity(file);
                long timestamp = convertToTimestamp(file.getMetadata().getCreatedTime());
                File markFile = new File(WaterMarkUtil.addWatermark(file1, timestamp, file.getMetadata().getShootPosition().getLat(),
                        file.getMetadata().getShootPosition().getLng(), file.getMetadata().getGimbalYawDegree()).toURI());
                Object data = ImgUtil.getInfo(file1);
                mediaFileMarkEntity.setDronedata(data);
                mediaFileMarkEntity.setWorkspaceId(workspaceId);
                mediaFileMarkEntity.setIsadd(0);
                mediaFileMarkEntity.setIsOriginal(false);
                mediaFileMarkEntity.setFileId(UUID.randomUUID().toString());
                mediaFileMarkEntity.setObjectKey("/mark" + file.getPath() + "/" + file.getName());
                mediaFileMarkEntity.setFileName("mark" + file.getName());
                mediaFileMarkEntity.setFilePath("mark" + file.getPath());
                String objectName = mediaFileMarkEntity.getObjectKey(); // 例如 "folder/file.txt"
                uploadFile(endpoint, accessKey, secretKey, bucketName, objectName, markFile, "image/jpeg");
                markMapper.insert(mediaFileMarkEntity);
            } catch (Exception e) {
                e.printStackTrace();
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
            }
    }
    @Override
    public Object mediaInfo(String filename) {