src/main/java/com/dji/sample/media/service/impl/FileServiceImpl.java
@@ -115,7 +115,14 @@ return mapper.insert(fileEntity); } public void saveMarkFile(String workspaceId, FileUploadDTO file) throws IOException, FontFormatException, ImageProcessingException { 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(); @@ -134,8 +141,7 @@ uploadFile(endpoint, accessKey, secretKey, bucketName, nailName, nailFile, "image/jpeg"); nailMapper.insert(nailEntity); try { boolean contains = file.getName().contains("~"); if (contains) { 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()) { @@ -145,13 +151,6 @@ .set(LotInfo::getInvestigate, 1); patchesMapper.update(null, updateWrapper); } boolean endsWith = file.getObjectKey().endsWith(".mp4"); if (endsWith) { MediaFileMarkEntity mediaFileMarkEntity = this.fileUploadConvertToMarkEntity(file); mediaFileMarkEntity.setWorkspaceId(workspaceId); mediaFileMarkEntity.setFileId(UUID.randomUUID().toString()); markMapper.insert(mediaFileMarkEntity); } MediaFileMarkEntity mediaFileMarkEntity = this.fileUploadConvertToMarkEntity(file); long timestamp = convertToTimestamp(file.getMetadata().getCreatedTime()); @@ -169,11 +168,11 @@ String objectName = mediaFileMarkEntity.getObjectKey(); // 例如 "folder/file.txt" uploadFile(endpoint, accessKey, secretKey, bucketName, objectName, markFile, "image/jpeg"); markMapper.insert(mediaFileMarkEntity); } } catch (Exception e) { e.printStackTrace(); } } } @Override public Object mediaInfo(String filename) { src/main/java/com/dji/sample/patches/controller/PatchesController.java
@@ -165,7 +165,7 @@ @GetMapping("/useMyTask") public ResponseResult useMyTask() throws Exception { try { timerUtil.myTask(); TimerUtil.mytask10(); // timerUtil.myTask2(); // timerUtil.myTask3(); // timerUtil.mytask4(); src/main/java/com/dji/sample/patches/utils/TimerUtil.java
@@ -218,6 +218,24 @@ String times = convertTimestampToFormattedString(time); sendPostWithParameters("定时任务4:30", "c3a7b125-bc0b-49d4-96ed-80743200ab80", times, lists1, listOfLists); } @Scheduled(cron = "0 0 6 * * ?") public static void mytask10() { File directory = new File("/tmp"); String[] partialFileNames = {"temp", "mark"}; // 要匹配的部分文件名 if (directory.isDirectory()) { File[] files = directory.listFiles(); if (files != null) { for (File file : files) { for (String partialFileName : partialFileNames) { if (file.isFile() && file.getName().contains(partialFileName)) { file.delete(); break; // 跳出内层循环,以免重复删除同一个文件 } } } } } } /** * 完成对未推送的图斑数据进行整合发送 * @@ -272,6 +290,7 @@ return convert(new File(destKMZFile)); } /** * 将航线上传Oss * src/main/java/com/dji/sample/speak/controller/SpeakVoiceController.java
@@ -57,8 +57,8 @@ } @PostMapping("/putVoice") public ResponseResult putVoice(int id) { return ResponseResult.success(voiceServicel.awayRiver(id)); public ResponseResult putVoice() { return ResponseResult.success(voiceServicel.awayRiver()); } @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 id); int awayRiver (); PaginationData<SpeakVoiceEntity> getVoices(Integer pages,Integer page_size); } src/main/java/com/dji/sample/speak/service/serviceImpl/SpeakVoiceServiceImpl.java
@@ -89,14 +89,13 @@ } @Override public int awayRiver(int id) { SpeakVoiceEntity voiceEntity=voiceMapper.selectById(id); public int awayRiver() { SpeakVoiceStartDto dto = new SpeakVoiceStartDto(); SpeakVoiceFileDto fileDto = new SpeakVoiceFileDto(); fileDto.setUrl(voiceEntity.getUrl()); fileDto.setMd5(voiceEntity.getMd5()); fileDto.setUrl("http://dev.jxpskj.com:9000/cloud-bucket/请远离河道07151604"); fileDto.setMd5("d2b448dcba09071834d02f082dc5386f"); fileDto.setFormat(FormatEnum.PCM); fileDto.setName(voiceEntity.getName()); fileDto.setName("河道危险"); dto.setPsdk_index(2); dto.setFile(fileDto); return messageSenderService.publishServicesTopic("4TADKCM0010016", VoiceEnums.SPEAKER_AUDIO_PLAY_START.getMethod(), dto).getResult();