| | |
| | | //相机已经在直播中,请勿重复开启直播 |
| | | if(receiveReply.getResult() == 513003) { |
| | | LiveDTO live = new LiveDTO(); |
| | | // live.setUrl(liveParam.getUrl().replace("rtmp", "https").replace("735","700") + ".flv"); |
| | | LiveUrlGB28181DTO gb28181 = urlToGB28181(liveParam.getUrl()); |
| | | live.setUrl(new StringBuilder() |
| | | .append("http://") |
| | | .append(gb28181.getServerIP()) |
| | | .append(":8880/rtp/") |
| | | .append(gb28181.getAgentID()) |
| | | .append("_") |
| | | .append(gb28181.getChannel()) |
| | | .append(".live.flv") |
| | | .toString()); |
| | | live.setUrl(liveParam.getUrl().replace("rtmp", "https").replace("735","700") + ".flv"); |
| | | // LiveUrlGB28181DTO gb28181 = urlToGB28181(liveParam.getUrl()); |
| | | // live.setUrl(new StringBuilder() |
| | | // .append("https://wrj.shuixiongit.com/zb/rtp/") |
| | | // .append(gb28181.getAgentID()) |
| | | // .append("_") |
| | | // .append(gb28181.getChannel()) |
| | | // .append(".live.flv") |
| | | // .toString()); |
| | | return ResponseResult.success(live); |
| | | } |
| | | |
| | |
| | | // live.setUrl(liveParam.getUrl().replace("rtmp", "webrtc")); |
| | | live.setUrl(liveParam.getUrl().replace("rtmp", "https").replace("735","700") + ".flv"); |
| | | break; |
| | | // case GB28181: |
| | | // LiveUrlGB28181DTO gb28181 = urlToGB28181(liveParam.getUrl()); |
| | | // live.setUrl(new StringBuilder() |
| | | // .append("webrtc://") |
| | | // .append(gb28181.getServerIP()) |
| | | // .append("/live/") |
| | | // .append(gb28181.getAgentID()) |
| | | // .append("@") |
| | | // .append(gb28181.getChannel()) |
| | | // .toString()); |
| | | // break; |
| | | case GB28181: |
| | | LiveUrlGB28181DTO gb28181 = urlToGB28181(liveParam.getUrl()); |
| | | live.setUrl(new StringBuilder() |
| | | .append("http://") |
| | | .append("webrtc://") |
| | | .append(gb28181.getServerIP()) |
| | | .append(":8880/rtp/") |
| | | .append("/live/") |
| | | .append(gb28181.getAgentID()) |
| | | .append("_") |
| | | .append("@") |
| | | .append(gb28181.getChannel()) |
| | | .append(".live.flv") |
| | | .toString()); |
| | | break; |
| | | // case GB28181: |
| | | // LiveUrlGB28181DTO gb28181 = urlToGB28181(liveParam.getUrl()); |
| | | // live.setUrl(new StringBuilder() |
| | | // .append("https://wrj.shuixiongit.com/zb/rtp/") |
| | | // .append(gb28181.getAgentID()) |
| | | // .append("_") |
| | | // .append(gb28181.getChannel()) |
| | | // .append(".live.flv") |
| | | // .toString()); |
| | | // break; |
| | | case RTSP: |
| | | String url = receiveReply.getOutput().toString(); |
| | | this.resolveUrlUser(url, live); |
| | |
| | | File file1 = TbFjServiceImpl.downloadFile(url); |
| | | long timestamp = convertToTimestamp(file.getMetadata().getCreatedTime()); |
| | | File file2 = new File(WaterMarkUtil.addWatermark(file1, timestamp, file.getMetadata().getShootPosition().getLat(), |
| | | file.getMetadata().getShootPosition().getLng(), file.getMetadata().getGimbalYawDegree(),territoryConfigPojo.getWatermark()).toURI()); |
| | | file.getMetadata().getShootPosition().getLng(), file.getMetadata().getGimbalYawDegree()).toURI()); |
| | | Object data = ImgUtil.getInfo(file1); |
| | | mediaFileMarkEntity.setDronedata(data); |
| | | mediaFileMarkEntity.setWorkspaceId(workspaceId); |
| | |
| | | int count=getPatchesService.delPatches(workspaceId); |
| | | return ResponseResult.success("删除的图斑数量是"+count); |
| | | } |
| | | |
| | | @DeleteMapping("/deleteOne") |
| | | public ResponseResult deleteOne(int id){ |
| | | int count= getPatchesService.deleteOne(id); |
| | |
| | | String xzq = DistrictCodeUtils.nameToCode(code); |
| | | return ResponseResult.success(xzq); |
| | | } |
| | | |
| | | @GetMapping("/getInfoById") |
| | | public ResponseResult<LotInfo> wayAndPatchesId(@RequestParam String patchesId) { |
| | | return ResponseResult.success(getPatchesService.getPatchesFromId(patchesId)); |
| | | } |
| | | |
| | | @GetMapping("/getWayline") |
| | | public ResponseResult getWayline(@RequestParam String waylineName, @RequestBody List<LotInfo> list){ |
| | | try { |
| | |
| | | @GetMapping("/useMyTask") |
| | | public ResponseResult useMyTask() throws Exception { |
| | | try { |
| | | timerUtil.myTask(); |
| | | // timerUtil.myTask(); |
| | | // timerUtil.myTask2(); |
| | | // timerUtil.myTask3(); |
| | | timerUtil.mytask4(); |
| | | |
| | | } catch (Exception e) { |
| | | throw new RuntimeException("db存储发送出现异常"+e); |
| | | } |
| | | return ResponseResult.success(); |
| | | } |
| | | |
| | | // @GetMapping ("/tests") |
| | | // public ResponseResult use() { |
| | | // try { |
| | |
| | | // } |
| | | // return ResponseResult.success(); |
| | | // } |
| | | @PostMapping("/way") |
| | | public void getway(@RequestParam("file") MultipartFile file, |
| | | @RequestParam String workspaceId, |
| | | @RequestParam String waylineName, |
| | | @RequestParam String username) { |
| | | waylineFileService.importKmzFileBack(file, workspaceId, username); |
| | | } |
| | | |
| | | /** |
| | | * 根据图斑的地块编号获取相对应音视频 |
| | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.core.io.ByteArrayResource; |
| | | import org.springframework.http.*; |
| | | import org.springframework.mock.web.MockMultipartFile; |
| | | import org.springframework.scheduling.annotation.Scheduled; |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | |
| | | */ |
| | | @Scheduled(cron = "0 0 0 * * ?") |
| | | public void myTask() throws Exception { |
| | | Long time = getCurrentTimestampPlus8Hours(); |
| | | Long time = getCurrentTimestampPlus8Hours(14); |
| | | String taskId = ""; |
| | | String workspaceId = "4a574db8-4ad3-48f7-9f16-3edbcd8056e1"; |
| | | // 获取未规划的图斑集合 |
| | |
| | | Optional<WaylineJobDTO> waylineJobDTO = waylineJobService.getJobByJobId(workspaceId, jobid, true); |
| | | waylineJobService.publishOneFlightTask(waylineJobDTO.get()); |
| | | } |
| | | } |
| | | @Scheduled(cron = "0 0 0 * * ?") |
| | | public void mytask4() throws IOException { |
| | | Long time = getCurrentTimestampPlus8Hours(9); |
| | | List<List<Long>> listOfLists = new ArrayList<>(); |
| | | List<Long> sublist = new ArrayList<>(); |
| | | sublist.add(time); // 添加整数值 |
| | | listOfLists.add(sublist); |
| | | List<Long> lists1 = new ArrayList<>(); |
| | | lists1.add(time); |
| | | String times = convertTimestampToFormattedString(time); |
| | | sendPostWithParameters("九洲巡查","73e14492-f1b2-4fc4-81c0-7ca65cd3bc56", times, lists1, listOfLists); |
| | | } |
| | | |
| | | /** |
| | |
| | | return folder; |
| | | } |
| | | |
| | | public static Long getCurrentTimestampPlus8Hours() { |
| | | public static Long getCurrentTimestampPlus8Hours(long hours) { |
| | | // 获取当前时间 |
| | | LocalDateTime now = LocalDateTime.now(); |
| | | |
| | | // 加上8小时 |
| | | LocalDateTime nowPlus8Hours = now.plusHours(8); |
| | | LocalDateTime nowPlus8Hours = now.plusHours(hours); |
| | | |
| | | // 转换为UTC时间戳 |
| | | ZonedDateTime zonedDateTime = nowPlus8Hours.atZone(ZoneId.systemDefault()); |
| | |
| | | |
| | | // 格式化时间,生成当前时间 |
| | | return "云飞行计划" + currentTime.format(DateTimeFormatter.ofPattern("MMdd")); |
| | | } |
| | | |
| | | public static void main(String[] args) { |
| | | // 获取当前时间 |
| | | LocalDateTime currentTime = LocalDateTime.now(); |
| | | |
| | | // 格式化时间,生成文件夹名字 |
| | | String folderName = currentTime.format(DateTimeFormatter.ofPattern("MMddHHmmssSS")); |
| | | System.out.println(folderName); |
| | | } |
| | | } |
| | |
| | | @Value("${db.sqlite.resourceSave}") |
| | | private String resourcesave; |
| | | |
| | | @Value("${db.sqlite.waterMark}") |
| | | private String watermark; |
| | | |
| | | } |
| | |
| | | //对应图片和视频文件进行不同处理 |
| | | boolean endsWith = key.endsWith(".mp4"); |
| | | if (!endsWith) { |
| | | file1 = WaterMarkUtil.addWatermark(file, sj, lat, lng, gimbalYawDegree,territoryConfigPojo.getWatermark()); |
| | | file1 = WaterMarkUtil.addWatermark(file, sj, lat, lng, gimbalYawDegree); |
| | | byte[] bytesArray = Files.readAllBytes(file1.toPath()); |
| | | fjhxz= sm3(bytesArray); |
| | | FJ = fileToByteArray(file1); |
| | |
| | | * @return 添加水印并压缩后的图片文件。 |
| | | * @throws IOException 如果读取或保存图片失败。 |
| | | */ |
| | | public static File addWatermark(File file, Long pssj, Double lat, Double lng, Double angles,String path) throws IOException, FontFormatException { |
| | | public static File addWatermark(File file, Long pssj, Double lat, Double lng, Double angles) throws IOException, FontFormatException { |
| | | double anglses = convertAngle(angles); |
| | | String angel = angle(anglses); |
| | | Long timestamp = pssj; // 例如:Unix 时间戳(以秒为单位) |
| | |
| | | alphaComposite = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.7f); |
| | | g2d.setComposite(alphaComposite); |
| | | String extraInfo = String.format("Lon:%.7f Lat:%.7f\n%s %s", lng, lat, angel, sd); |
| | | File fontFile = new File("src/main/resources/MiSans-Normal.ttf"); // 替换为你的字体文件路径 |
| | | // File fontFile = new File("/usr/share/fonts/MiSans-Normal.ttf"); // 替换为你的字体文件路径 |
| | | File fontFile = new File("/usr/share/fonts/MiSans-Normal.ttf"); // 替换为你的字体文件路径 |
| | | Font customFont = Font.createFont(Font.TRUETYPE_FONT, fontFile).deriveFont(36.00F); |
| | | // 注册字体 |
| | | GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); |
| | |
| | | result: DB/result_db.db |
| | | resultSave: src/main/resources/tmp |
| | | resourceSave: src/main/resources/tmp |
| | | waterMark: src/main/resources/MiSans-Normal.ttf |
| | |
| | | result: /home/drone/server/sqlite/result_db.db |
| | | resultSave: /home/drone/server/sqlite/retUpload/ |
| | | resourceSave: /home/drone/server/sqlite/upload/ |
| | | waterMark: /usr/share/fonts/MiSans-Normal.ttf |
| | | |