Browse Source

报警回放修改

gao.qiang 1 year ago
parent
commit
bd36e5e5f4

+ 27 - 1
business-service/src/main/java/com/ozs/utils/CameraUtil.java

@@ -437,7 +437,7 @@ ffmpeg -i "concat:1.ts|2.ts" -c copy output.mp4
      * @return
      */
     public static String startRecording(String cameraCode, String channel) {
-        log.info("-----startRecording------"+historyUrl + "/recordpro/api/start?streamPath=" + cameraCode + "/" + channel);
+        log.info("-----startRecording------" + historyUrl + "/recordpro/api/start?streamPath=" + cameraCode + "/" + channel);
         return historyUrl + "/recordpro/api/start?streamPath=" + cameraCode + "/" + channel;
     }
 
@@ -1421,4 +1421,30 @@ ffmpeg -i "concat:1.ts|2.ts" -c copy output.mp4
             return null;
         }
     }
+
+    /**
+     * 根据设备id和通道ID和日期获取设备录像文件
+     *
+     * @param baseCameraManagement
+     */
+    public String getQueryRecords(String streamPath, String date) {
+        log.info("-----getQueryRecords------streamPath-----"+streamPath);
+        log.info("-----getQueryRecords-------date----"+date);
+        String param = "{\n" +
+                "    \"streamPath\":\"" + streamPath + "\",\n" +
+                "    \"date\":\"" + date + "\"\n" +
+                "}";
+
+        String jsonStr = HttpUtils.sendPost("http://10.48.36.47:9080" + "/recordpro/api/query/records", param);
+        log.info("-----getQueryRecords-------jsonStr----"+jsonStr);
+        JSONObject jsonObj = JSON.parseObject(jsonStr);
+        log.info("-----getQueryRecords-------jsonObj----"+jsonObj);
+        JSONArray resultArray = jsonObj.getJSONArray("result");
+        log.info("-----getQueryRecords-------resultArray----"+resultArray);
+        JSONObject resultObj = resultArray.getJSONObject(0);
+        log.info("-----getQueryRecords-------resultObj----"+resultObj);
+        String path = resultObj.getString("Path");
+        log.info("-----getQueryRecords-------path----"+path);
+        return caneraConfig.getRecordUrl()+Constants.RESOURCE_PREFIX+path;
+    }
 }

+ 1 - 1
business-service/src/main/java/com/ozs/utils/CaneraConfig.java

@@ -44,7 +44,7 @@ public class CaneraConfig {
     @Value("${base.wsUrl:http://124.70.58.209:18891}")
     private String wsUrl;
 
-    @Value("${base.recordUrl:http://183.236.39.220:8083}")
+    @Value("${base.recordUrl:http://123.139.243.142:18084}")
     private String recordUrl;
 
     @Value("${base.hkUrl:http://10.48.253.21:1443}")

+ 10 - 0
vehicle-sdk/src/main/java/com/ozs/controller/upload/GeoHazardMonitorTokenController.java

@@ -409,6 +409,16 @@ public class GeoHazardMonitorTokenController {
                         jsonObject.put("resultCode", 0);
                         jsonObject.put("message", url);
                         return SM4Utils.encryptData_ECB(JSONObject.toJSONString(jsonObject), key);
+                    }else {
+                        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
+                        // 使用SimpleDateFormat将Date对象格式化为指定样式的字符串
+                        String formattedDate = sdf.format(msgAlarmVice.getAlarmTime());
+                        log.info("-----formattedDate-----------"+formattedDate);
+                        String records = cameraUtil.getQueryRecords(code + "/playback", formattedDate);
+                        log.info("-----records-----------"+records);
+                        MsgAlarm alarm1 = msgAlarmService.getById(msgAlarm.getId());
+                        alarm1.setReleasedUrl(records);
+                        msgAlarmService.updateById(alarm1);
                     }
                 }
             } else {

+ 1 - 1
vehicle-sdk/src/main/resources/application.yml

@@ -9,7 +9,7 @@ base:
   # 实例演示开关
   demoEnabled: true
   # 文件路径 示例( Windows配置D:/ruoyi/uploadPath,Linux配置 /home/ruoyi/uploadPath)
-  profile: /opt/streams/record/flv
+  profile: /opt/streams
   # 获取ip地址开关
   addressEnabled: false
   # 验证码类型 math 数组计算 char 字符验证