From fbe6adba1ec30aae74e8bf7962994a8cc8c9c2d1 Mon Sep 17 00:00:00 2001
From: rain <167982779@qq.com>
Date: Mon, 29 Jul 2024 14:55:23 +0800
Subject: [PATCH] 修改喇叭参数

---
 src/main/java/com/dji/sample/media/service/impl/FileServiceImpl.java |   78 +++++++++++++--------------------------
 1 files changed, 26 insertions(+), 52 deletions(-)

diff --git a/src/main/java/com/dji/sample/media/service/impl/FileServiceImpl.java b/src/main/java/com/dji/sample/media/service/impl/FileServiceImpl.java
index 757a713..0d89bc5 100644
--- a/src/main/java/com/dji/sample/media/service/impl/FileServiceImpl.java
+++ b/src/main/java/com/dji/sample/media/service/impl/FileServiceImpl.java
@@ -151,31 +151,31 @@
         }
     }
 
-    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 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 updateStatue(String filename) {
         if (filename.contains("~")) {
@@ -512,32 +512,6 @@
             builder.fileName(file.getName())
                     .filePath(file.getPath())
                     .examine(0)
-                    .fingerprint(file.getFingerprint())
-                    .objectKey(file.getObjectKey())
-                    .subFileType(file.getSubFileType())
-                    .isOriginal(file.getExt().getIsOriginal())
-                    .jobId(file.getExt().getFlightId())
-                    .drone(file.getExt().getSn()).metadata(file.getMetadata())
-                    .tinnyFingerprint(file.getExt().getTinnyFingerprint());
-
-            // domain-type-subType
-            int[] payloadModel = Arrays.stream(file.getExt().getPayloadModelKey().split("-"))
-                    .map(Integer::valueOf)
-                    .mapToInt(Integer::intValue)
-                    .toArray();
-            Optional<DeviceDictionaryDTO> payloadDict = deviceDictionaryService
-                    .getOneDictionaryInfoByTypeSubType(DeviceDomainEnum.PAYLOAD.getVal(), payloadModel[1], payloadModel[2]);
-            payloadDict.ifPresent(payload -> builder.payload(payload.getDeviceName()));
-        }
-        return builder.build();
-    }
-
-    private MediaFileMarkEntity fileUploadConvertToMarkEntity(FileUploadDTO file) {
-        MediaFileMarkEntity.MediaFileMarkEntityBuilder builder = MediaFileMarkEntity.builder();
-
-        if (file != null) {
-            builder.fileName(file.getName())
-                    .filePath(file.getPath())
                     .fingerprint(file.getFingerprint())
                     .objectKey(file.getObjectKey())
                     .subFileType(file.getSubFileType())
@@ -1077,7 +1051,7 @@
         for (MediaFileNailEntity mark : markEntities) {
             updateNailMediaFileNames(mark.getJobId());
             updateMediaFileNames(mark.getJobId());
-            updateMediaZipFileNames(mark.getJobId());
+//            updateMediaZipFileNames(mark.getJobId());
         }
     }
 

--
Gitblit v1.9.3