|
@@ -3,6 +3,7 @@ package com.huimv.video.dhicc.test.controller;
|
|
//拿视频回放
|
|
//拿视频回放
|
|
|
|
|
|
|
|
|
|
|
|
+import cn.hutool.core.util.ObjectUtil;
|
|
import com.alibaba.fastjson.JSONArray;
|
|
import com.alibaba.fastjson.JSONArray;
|
|
import com.dahuatech.icc.exception.ClientException;
|
|
import com.dahuatech.icc.exception.ClientException;
|
|
import com.huimv.video.dhicc.result.R;
|
|
import com.huimv.video.dhicc.result.R;
|
|
@@ -71,62 +72,65 @@ public class VideoRecorControllerSg {
|
|
System.out.println(jsonObject2);
|
|
System.out.println(jsonObject2);
|
|
JSONArray jsonArray = JSONArray.parseArray(jsonObject2.get("records").toString());
|
|
JSONArray jsonArray = JSONArray.parseArray(jsonObject2.get("records").toString());
|
|
System.out.println(jsonArray);
|
|
System.out.println(jsonArray);
|
|
- com.alibaba.fastjson.JSONObject json = (com.alibaba.fastjson.JSONObject) jsonArray.get(0);
|
|
|
|
- System.out.println(json);
|
|
|
|
-
|
|
|
|
- Map<String, Object> value = new HashMap<>();
|
|
|
|
- value.put("recordType", json.get("recordType"));
|
|
|
|
- value.put("streamType", json.get("streamType"));
|
|
|
|
- value.put("recordSource",json.get("recordSource"));
|
|
|
|
- value.put("channelId", channelId);
|
|
|
|
- value.put("endTime", json.get("startTime"));
|
|
|
|
- value.put("startTime", json.get("endTime"));
|
|
|
|
- if (farmId == 1) {
|
|
|
|
- System.out.println("曙光");
|
|
|
|
- VideoRecordRequestSg requestSg = new VideoRecordRequestSg(oauthConfigBaseInfo);
|
|
|
|
- requestSg.setData(value);
|
|
|
|
- Object jsonObject1 = requestSg.doAction();
|
|
|
|
- System.out.println(jsonObject1);
|
|
|
|
- String action = (String) JSONObject.fromObject(jsonObject1).get("url");
|
|
|
|
- String token = (String) JSONObject.fromObject(jsonObject1).get("token");
|
|
|
|
- String[] split = action.split("\\|");// |需要转义符
|
|
|
|
- JSONObject jsonObject = new JSONObject();
|
|
|
|
- jsonObject.put("url", split[1] + "?token=" + token + "&trackID=701");
|
|
|
|
- return R.ok().put("data", jsonObject);
|
|
|
|
- } else if (farmId == 22) {
|
|
|
|
- System.out.println("海宁");
|
|
|
|
- VideoRecordRequestHn requestHn = new VideoRecordRequestHn(oauthConfigBaseInfo02);
|
|
|
|
- requestHn.setClientMac("30:9c:23:79:40:08");
|
|
|
|
- requestHn.setClientPushId("");
|
|
|
|
- requestHn.setProject("PSDK");
|
|
|
|
- requestHn.setMethod("SS.Playback.StartPlaybackByTime");
|
|
|
|
- requestHn.setData(value);
|
|
|
|
- Object jsonObject1 = requestHn.doAction();
|
|
|
|
- String action = (String) JSONObject.fromObject(jsonObject1).get("url");
|
|
|
|
- String token = (String) JSONObject.fromObject(jsonObject1).get("token");
|
|
|
|
- String[] split = action.split("\\|");// |需要转义符
|
|
|
|
- JSONObject jsonObject = new JSONObject();
|
|
|
|
- jsonObject.put("url", split[1] + "?token=" + token + "&trackID=701");
|
|
|
|
- return R.ok().put("data", jsonObject);
|
|
|
|
- } else if (farmId == 21) {
|
|
|
|
- System.out.println("苍南");
|
|
|
|
- VideoRecordRequestCn requestCn = new VideoRecordRequestCn(oauthConfigBaseInfo03);
|
|
|
|
- requestCn.setClientMac("30:9c:23:79:40:08");
|
|
|
|
- requestCn.setClientPushId("");
|
|
|
|
- requestCn.setProject("PSDK");
|
|
|
|
- requestCn.setMethod("SS.Playback.StartPlaybackByTime");
|
|
|
|
- requestCn.setData(value);
|
|
|
|
- Object jsonObject1 = requestCn.doAction();
|
|
|
|
- String action = (String) JSONObject.fromObject(jsonObject1).get("url");
|
|
|
|
- String token = (String) JSONObject.fromObject(jsonObject1).get("token");
|
|
|
|
- String[] split = action.split("\\|");// |需要转义符
|
|
|
|
- JSONObject jsonObject = new JSONObject();
|
|
|
|
- jsonObject.put("url", split[1] + "?token=" + token + "&trackID=701");
|
|
|
|
- return R.ok().put("data", jsonObject);
|
|
|
|
|
|
+ if (ObjectUtil.isEmpty(jsonArray)) {
|
|
|
|
+ return R.error("没有录像回放");
|
|
} else {
|
|
} else {
|
|
- return R.error();
|
|
|
|
|
|
+ com.alibaba.fastjson.JSONObject json = (com.alibaba.fastjson.JSONObject) jsonArray.get(0);
|
|
|
|
+ System.out.println(json);
|
|
|
|
+
|
|
|
|
+ Map<String, Object> value = new HashMap<>();
|
|
|
|
+ value.put("recordType", json.get("recordType"));
|
|
|
|
+ value.put("streamType", json.get("streamType"));
|
|
|
|
+ value.put("recordSource", json.get("recordSource"));
|
|
|
|
+ value.put("channelId", channelId);
|
|
|
|
+ value.put("endTime", json.get("startTime"));
|
|
|
|
+ value.put("startTime", json.get("endTime"));
|
|
|
|
+ if (farmId == 1) {
|
|
|
|
+ System.out.println("曙光");
|
|
|
|
+ VideoRecordRequestSg requestSg = new VideoRecordRequestSg(oauthConfigBaseInfo);
|
|
|
|
+ requestSg.setData(value);
|
|
|
|
+ Object jsonObject1 = requestSg.doAction();
|
|
|
|
+ System.out.println(jsonObject1);
|
|
|
|
+ String action = (String) JSONObject.fromObject(jsonObject1).get("url");
|
|
|
|
+ String token = (String) JSONObject.fromObject(jsonObject1).get("token");
|
|
|
|
+ String[] split = action.split("\\|");// |需要转义符
|
|
|
|
+ JSONObject jsonObject = new JSONObject();
|
|
|
|
+ jsonObject.put("url", split[1] + "?token=" + token + "&trackID=701");
|
|
|
|
+ return R.ok().put("data", jsonObject);
|
|
|
|
+ } else if (farmId == 22) {
|
|
|
|
+ System.out.println("海宁");
|
|
|
|
+ VideoRecordRequestHn requestHn = new VideoRecordRequestHn(oauthConfigBaseInfo02);
|
|
|
|
+ requestHn.setClientMac("30:9c:23:79:40:08");
|
|
|
|
+ requestHn.setClientPushId("");
|
|
|
|
+ requestHn.setProject("PSDK");
|
|
|
|
+ requestHn.setMethod("SS.Playback.StartPlaybackByTime");
|
|
|
|
+ requestHn.setData(value);
|
|
|
|
+ Object jsonObject1 = requestHn.doAction();
|
|
|
|
+ String action = (String) JSONObject.fromObject(jsonObject1).get("url");
|
|
|
|
+ String token = (String) JSONObject.fromObject(jsonObject1).get("token");
|
|
|
|
+ String[] split = action.split("\\|");// |需要转义符
|
|
|
|
+ JSONObject jsonObject = new JSONObject();
|
|
|
|
+ jsonObject.put("url", split[1] + "?token=" + token + "&trackID=701");
|
|
|
|
+ return R.ok().put("data", jsonObject);
|
|
|
|
+ } else if (farmId == 21) {
|
|
|
|
+ System.out.println("苍南");
|
|
|
|
+ VideoRecordRequestCn requestCn = new VideoRecordRequestCn(oauthConfigBaseInfo03);
|
|
|
|
+ requestCn.setClientMac("30:9c:23:79:40:08");
|
|
|
|
+ requestCn.setClientPushId("");
|
|
|
|
+ requestCn.setProject("PSDK");
|
|
|
|
+ requestCn.setMethod("SS.Playback.StartPlaybackByTime");
|
|
|
|
+ requestCn.setData(value);
|
|
|
|
+ Object jsonObject1 = requestCn.doAction();
|
|
|
|
+ String action = (String) JSONObject.fromObject(jsonObject1).get("url");
|
|
|
|
+ String token = (String) JSONObject.fromObject(jsonObject1).get("token");
|
|
|
|
+ String[] split = action.split("\\|");// |需要转义符
|
|
|
|
+ JSONObject jsonObject = new JSONObject();
|
|
|
|
+ jsonObject.put("url", split[1] + "?token=" + token + "&trackID=701");
|
|
|
|
+ return R.ok().put("data", jsonObject);
|
|
|
|
+ } else {
|
|
|
|
+ return R.error();
|
|
|
|
+ }
|
|
}
|
|
}
|
|
-
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|