소스 검색

视频回放接口修改

gao.qiang 1 년 전
부모
커밋
d9bfb44357

+ 9 - 3
business-service/src/main/java/com/ozs/utils/CameraUtil.java

@@ -473,6 +473,11 @@ ffmpeg -i "concat:1.ts|2.ts" -c copy output.mp4
      * @return
      */
     public static String startRecording(String cameraCode, String channel) {
+        try {
+            Thread.sleep(2);
+        } catch (InterruptedException e) {
+            e.printStackTrace();
+        }
         log.info("-----startRecording------" + historyUrl + "/recordpro/api/start?streamPath=" + cameraCode + "/" + channel);
         return historyUrl + "/recordpro/api/start?streamPath=" + cameraCode + "/" + channel;
     }
@@ -1237,10 +1242,11 @@ ffmpeg -i "concat:1.ts|2.ts" -c copy output.mp4
     public String playbackURLs(String code, String frontValue, String laterValue) {
 
         try {
-            TimeUnit.SECONDS.sleep(65 * Integer.parseInt(laterValue));
-            log.info("--------------->playbackURLs");
+            log.info("--------------->playbackURLs-----异步开始-");
             log.info("frontValue------------->" + frontValue);
             log.info("laterValue------------->" + laterValue);
+            TimeUnit.SECONDS.sleep(65 * Integer.parseInt(laterValue));
+            log.info("--------------->playbackURLs");
             PlaybackVo playbackVo = new PlaybackVo();
             playbackVo.setCameraIndexCode(code);
             // 获取当前时间
@@ -1250,7 +1256,7 @@ ffmpeg -i "concat:1.ts|2.ts" -c copy output.mp4
             OffsetDateTime beforeTenMinutes = currentTime.minusMinutes(Long.parseLong(frontValue));
             log.info("beforeTenMinutes------------->" + beforeTenMinutes);
             // 获取报警后的时间
-            OffsetDateTime afterTenMinutes = currentTime.plusMinutes(Long.parseLong(laterValue));
+            OffsetDateTime afterTenMinutes = currentTime.plusMinutes(Long.parseLong("0"));
             log.info("afterTenMinutes------------->" + afterTenMinutes);
             // 格式化时间
             DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss.SSSXXX");

+ 5 - 1
vehicle-sdk/src/main/java/com/ozs/controller/upload/GeoHazardMonitorTokenController.java

@@ -14,6 +14,7 @@ import com.ozs.common.utils.HeartbeatUtils;
 import com.ozs.common.utils.HttpClientUtil;
 import com.ozs.common.utils.IgnoreUtils;
 import com.ozs.common.utils.StringUtils;
+import com.ozs.common.utils.http.HttpUtils;
 import com.ozs.common.utils.stateSecrets.SM4Utils;
 import com.ozs.config.Constant;
 import com.ozs.entity.BaseCameraManagement;
@@ -370,9 +371,12 @@ public class GeoHazardMonitorTokenController {
                     List<SysDictData> frontValue = dictTypeService.selectDictDataByType("alarm_play_time_front_value");
                     List<SysDictData> laterValue = dictTypeService.selectDictDataByType("alarm_play_time_later_value");
                     String finalCode = code;
+                    log.info("frontValue.get(0)-----11-------->" + frontValue.get(0).getDictValue());
+                    log.info("frontValue.get(0)-------22------>" + laterValue.get(0).getDictValue());
                     CompletableFuture.runAsync(() -> {
                         cameraUtil.playbackURLs(finalCode, frontValue.get(0).getDictValue(), laterValue.get(0).getDictValue());
-                        CameraUtil.startRecording(finalCode, "playback");
+                        String codes = HttpUtils.sendGet(CameraUtil.startRecording(finalCode, "playback"));
+                        log.info("codes------>" + codes);
                         SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
                         // 使用SimpleDateFormat将Date对象格式化为指定样式的字符串
                         String formattedDate = sdf.format(msgAlarmVice.getAlarmTime());