Browse Source

回放修改2.0

wwh 2 years ago
parent
commit
1e3d9bc299

+ 17 - 6
huimv-farm-video/src/main/java/com/huimv/video/dhicc/test/controller/VideoRecorControllerSg.java

@@ -11,6 +11,7 @@ import com.huimv.video.dhicc.test.config.OauthConfigBaseInfo03;
 import com.huimv.video.dhicc.test.request.Video.VideoRecordRequestCn;
 import com.huimv.video.dhicc.test.request.Video.VideoRecordRequestHn;
 import com.huimv.video.dhicc.test.request.Video.VideoRecordRequestSg;
+import net.sf.json.JSONObject;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
@@ -39,7 +40,7 @@ public class VideoRecorControllerSg {
     @RequestMapping("/getVideoRecord")
     public R getVideoRecord(@RequestBody Map<String, Object> params1) throws ClientException, ParseException {
         String happendTime = (String) params1.get("happendTime");
-        String channelId = (String) params1.get("channelId");
+        String channelId = (String) params1.get("nodeCode");
         Integer farmId = (Integer) params1.get("farmId");
 
         Map<String, Object> value = new HashMap<>();
@@ -72,7 +73,11 @@ public class VideoRecorControllerSg {
             requestSg.setData(value);
             Object jsonObject1 = requestSg.doAction();
             System.out.println(jsonObject1);
-            return R.ok().put("data",jsonObject1);
+            String action =(String) JSONObject.fromObject(jsonObject1).get("url");
+            String[] split = action.split("\\|");// |需要转义符
+            JSONObject jsonObject = new JSONObject();
+            jsonObject.put("url", split[0]);
+            return R.ok().put("data",jsonObject);
         } else if (farmId==22) {
             System.out.println("海宁");
             VideoRecordRequestHn requestHn = new VideoRecordRequestHn(oauthConfigBaseInfo02);
@@ -82,8 +87,11 @@ public class VideoRecorControllerSg {
             requestHn.setMethod("SS.Playback.StartPlaybackByTime");
             requestHn.setData(value);
             Object jsonObject1 = requestHn.doAction();
-            System.out.println(jsonObject1);
-            return R.ok().put("data",jsonObject1);
+            String action =(String) JSONObject.fromObject(jsonObject1).get("url");
+            String[] split = action.split("\\|");// |需要转义符
+            JSONObject jsonObject = new JSONObject();
+            jsonObject.put("url", split[0]);
+            return R.ok().put("data",jsonObject);
         } else if (farmId==21){
             System.out.println("苍南");
             VideoRecordRequestCn requestCn = new VideoRecordRequestCn(oauthConfigBaseInfo03);
@@ -93,8 +101,11 @@ public class VideoRecorControllerSg {
             requestCn.setMethod("SS.Playback.StartPlaybackByTime");
             requestCn.setData(value);
             Object jsonObject1 = requestCn.doAction();
-            System.out.println(jsonObject1);
-            return R.ok().put("data",jsonObject1);
+            String action =(String) JSONObject.fromObject(jsonObject1).get("url");
+            String[] split = action.split("\\|");// |需要转义符
+            JSONObject jsonObject = new JSONObject();
+            jsonObject.put("url", split[0]);
+            return R.ok().put("data",jsonObject);
         }else {
             return R.error();
         }