rain
2024-07-29 fbe6adba1ec30aae74e8bf7962994a8cc8c9c2d1
修改喇叭参数
6 files modified
95 ■■■■■ changed files
src/main/java/com/dji/sample/media/service/IFileService.java 2 ●●● patch | view | raw | blame | history
src/main/java/com/dji/sample/media/service/impl/FileServiceImpl.java 78 ●●●●● patch | view | raw | blame | history
src/main/java/com/dji/sample/media/service/impl/MediaServiceImpl.java 5 ●●●●● patch | view | raw | blame | history
src/main/java/com/dji/sample/speak/controller/SpeakVoiceController.java 4 ●●●● patch | view | raw | blame | history
src/main/java/com/dji/sample/speak/service/SpeakVoiceService.java 2 ●●● patch | view | raw | blame | history
src/main/java/com/dji/sample/speak/service/serviceImpl/SpeakVoiceServiceImpl.java 4 ●●●● patch | view | raw | blame | history
src/main/java/com/dji/sample/media/service/IFileService.java
@@ -39,7 +39,7 @@
    Integer saveFile(String workspaceId, FileUploadDTO file) throws IOException, ImageProcessingException;
    void saveNailFile(String workspaceId, FileUploadDTO file) throws IOException, ImageProcessingException;
    void saveZipFile(String workspaceId, FileUploadDTO file) throws IOException, ImageProcessingException;
//    void saveZipFile(String workspaceId, FileUploadDTO file) throws IOException, ImageProcessingException;
    void updateNailMediaFileNames(String jobId);
    PaginationData<MediaFileEntity> getJobId( int pageNum, int pageSize,String workspaceId);
    PaginationData<MediaFileEntity> getPhotoByJobId(int page,int pageSize ,String workspaceId,String jobId);
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());
        }
    }
src/main/java/com/dji/sample/media/service/impl/MediaServiceImpl.java
@@ -226,9 +226,10 @@
        // set path
        String objectKey = callback.getFile().getObjectKey();
        callback.getFile().setPath(objectKey.substring(objectKey.indexOf("/") + 1, objectKey.lastIndexOf("/")));
        int count =fileService.saveFile(job.getWorkspaceId(), callback.getFile());
        fileService.saveNailFile(job.getWorkspaceId(), callback.getFile());
        fileService.saveZipFile(job.getWorkspaceId(),callback.getFile());
        return fileService.saveFile(job.getWorkspaceId(), callback.getFile()) > 0;
//        fileService.saveZipFile(job.getWorkspaceId(),callback.getFile());
        return count > 0;
    }
    /**
src/main/java/com/dji/sample/speak/controller/SpeakVoiceController.java
@@ -57,8 +57,8 @@
    }
    @PostMapping("/putVoice")
    public ResponseResult putVoice() {
        return ResponseResult.success(voiceServicel.awayRiver());
    public ResponseResult putVoice(@RequestParam  String sn) {
        return ResponseResult.success(voiceServicel.awayRiver(sn));
    }
    @GetMapping("/selectVoice")
src/main/java/com/dji/sample/speak/service/SpeakVoiceService.java
@@ -26,7 +26,7 @@
    int setVoiceVolume(SpeakVolumeDto dto,String sn);
    int awayRiver ();
    int awayRiver (String sn);
    PaginationData<SpeakVoiceEntity> getVoices(Integer pages,Integer page_size);
}
src/main/java/com/dji/sample/speak/service/serviceImpl/SpeakVoiceServiceImpl.java
@@ -89,7 +89,7 @@
    }
    @Override
    public int awayRiver() {
    public int awayRiver(String sn) {
        SpeakVoiceStartDto dto = new SpeakVoiceStartDto();
        SpeakVoiceFileDto fileDto = new SpeakVoiceFileDto();
        fileDto.setUrl("http://dev.jxpskj.com:9000/cloud-bucket/请远离河道07151604");
@@ -98,7 +98,7 @@
        fileDto.setName("河道危险");
        dto.setPsdk_index(2);
        dto.setFile(fileDto);
        return messageSenderService.publishServicesTopic("7CTDM5E00BR787", VoiceEnums.SPEAKER_AUDIO_PLAY_START.getMethod(), dto).getResult();
        return messageSenderService.publishServicesTopic(sn, VoiceEnums.SPEAKER_AUDIO_PLAY_START.getMethod(), dto).getResult();
    }
    @Override