Browse Source

模拟预警信息接口开发

gao.qiang 5 months ago
parent
commit
094d3d4e42
1 changed files with 8 additions and 5 deletions
  1. 8 5
      business-service/src/main/java/com/ozs/utils/CameraUtil.java

+ 8 - 5
business-service/src/main/java/com/ozs/utils/CameraUtil.java

@@ -396,6 +396,7 @@ ffmpeg -i "concat:1.ts|2.ts" -c copy output.mp4
         int maxRetries = 3;
         int retryCount = 0;
         boolean success = false;
+        boolean state=true;
         JSONArray jsonArray = null;
         List<String> pathList = new ArrayList<>();
         //从redis中获取该相机的IP地址
@@ -422,10 +423,12 @@ ffmpeg -i "concat:1.ts|2.ts" -c copy output.mp4
             for (int i = 0; i < jsonArray.size(); i++) {
                 JSONObject jsonObject = jsonArray.getJSONObject(i);
                 String name = jsonObject.getString("Path");
-                pathList.add(name);
+                if (name.endsWith(cameraCode + "/" + channel)) {
+                    state=false;
+                    break;
+                }
             }
-            boolean contains = pathList.contains(cameraCode + "/" + channel);
-            if (!contains) {
+            if (!state) {
                 return null;
             } else {
                 return getPlayFlvRtsp(cameraCode, channel, type, cacheObject);
@@ -1652,13 +1655,13 @@ ffmpeg -i "concat:1.ts|2.ts" -c copy output.mp4
      *
      * @param baseCameraManagement
      */
-    public String getQueryRecords(String streamPath, String date, String type, String start,String end) {
+    public String getQueryRecords(String streamPath, String date, String type, String start, String end) {
 
         log.info("-----getQueryRecords------streamPath-----" + streamPath);
         log.info("-----getQueryRecords-------date----" + date);
         log.info("-----getQueryRecords-------type----" + type);
         try {
-            TimeUnit.SECONDS.sleep(60 * (Integer.parseInt(start)+Integer.parseInt(end)));
+            TimeUnit.SECONDS.sleep(60 * (Integer.parseInt(start) + Integer.parseInt(end)));
         } catch (InterruptedException e) {
             e.printStackTrace();
         }