|
@@ -14,10 +14,7 @@ import com.huimv.video.dhicc.result.R;
|
|
import com.huimv.video.dhicc.test.config.OauthConfigBaseInfo;
|
|
import com.huimv.video.dhicc.test.config.OauthConfigBaseInfo;
|
|
import com.huimv.video.dhicc.test.config.OauthConfigBaseInfo02;
|
|
import com.huimv.video.dhicc.test.config.OauthConfigBaseInfo02;
|
|
import com.huimv.video.dhicc.test.config.OauthConfigBaseInfo03;
|
|
import com.huimv.video.dhicc.test.config.OauthConfigBaseInfo03;
|
|
-import com.huimv.video.dhicc.test.request.Video.VideoRecordQueryRequestSg;
|
|
|
|
-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 com.huimv.video.dhicc.test.request.Video.*;
|
|
import net.sf.json.JSONObject;
|
|
import net.sf.json.JSONObject;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.web.bind.annotation.RequestBody;
|
|
import org.springframework.web.bind.annotation.RequestBody;
|
|
@@ -50,16 +47,15 @@ public class VideoRecorControllerSg {
|
|
@RequestMapping("/getVideoRecord")
|
|
@RequestMapping("/getVideoRecord")
|
|
public R getVideoRecord(@RequestBody Map<String, Object> params1) throws ClientException, ParseException {
|
|
public R getVideoRecord(@RequestBody Map<String, Object> params1) throws ClientException, ParseException {
|
|
String happendTime = (String) params1.get("happendTime");
|
|
String happendTime = (String) params1.get("happendTime");
|
|
- String channelId = (String) params1.get("nodeCode");
|
|
|
|
Integer farmId = (Integer) params1.get("farmId");
|
|
Integer farmId = (Integer) params1.get("farmId");
|
|
String channelName = (String) params1.get("channelName");
|
|
String channelName = (String) params1.get("channelName");
|
|
|
|
|
|
LambdaQueryWrapper<IccChannel> wrapper3 = Wrappers.lambdaQuery();
|
|
LambdaQueryWrapper<IccChannel> wrapper3 = Wrappers.lambdaQuery();
|
|
wrapper3.eq(IccChannel::getChannelName, channelName);
|
|
wrapper3.eq(IccChannel::getChannelName, channelName);
|
|
|
|
+ wrapper3.eq(IccChannel::getRemark, farmId);
|
|
IccChannel iccChannel = iccChannelMapper.selectOne(wrapper3);
|
|
IccChannel iccChannel = iccChannelMapper.selectOne(wrapper3);
|
|
System.out.println(iccChannel);
|
|
System.out.println(iccChannel);
|
|
|
|
|
|
-
|
|
|
|
//开始结束时间代为处理
|
|
//开始结束时间代为处理
|
|
DateFormat fmt = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
DateFormat fmt = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
//格式化传入的时间---拿传入时间前后五分钟的视频
|
|
//格式化传入的时间---拿传入时间前后五分钟的视频
|
|
@@ -77,72 +73,103 @@ public class VideoRecorControllerSg {
|
|
test.put("endTime", after);
|
|
test.put("endTime", after);
|
|
test.put("streamType", "0");
|
|
test.put("streamType", "0");
|
|
test.put("recordType", "0");
|
|
test.put("recordType", "0");
|
|
- VideoRecordQueryRequestSg queryRequestSg = new VideoRecordQueryRequestSg(oauthConfigBaseInfo);
|
|
|
|
- queryRequestSg.setData(test);
|
|
|
|
- System.out.println(queryRequestSg);
|
|
|
|
- com.alibaba.fastjson.JSONObject jsonObject2 = queryRequestSg.doAction();
|
|
|
|
- System.out.println(jsonObject2);
|
|
|
|
- JSONArray jsonArray = JSONArray.parseArray(jsonObject2.get("records").toString());
|
|
|
|
- System.out.println(jsonArray);
|
|
|
|
- if (ObjectUtil.isEmpty(jsonArray)) {
|
|
|
|
- return R.error("没有录像回放");
|
|
|
|
- } else {
|
|
|
|
|
|
+ if (farmId == 1) {
|
|
|
|
+ System.out.println("曙光");
|
|
|
|
+ VideoRecordQueryRequestSg queryRequestSg = new VideoRecordQueryRequestSg(oauthConfigBaseInfo);
|
|
|
|
+ queryRequestSg.setData(test);
|
|
|
|
+ System.out.println(queryRequestSg);
|
|
|
|
+ com.alibaba.fastjson.JSONObject jsonObject2 = queryRequestSg.doAction();
|
|
|
|
+ System.out.println(jsonObject2);
|
|
|
|
+ JSONArray jsonArray = JSONArray.parseArray(jsonObject2.get("records").toString());
|
|
|
|
+ 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", json.get("channelId"));
|
|
|
|
+ value.put("endTime", json.get("endTime"));
|
|
|
|
+ value.put("startTime", json.get("startTime"));
|
|
|
|
+
|
|
|
|
+ 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("海宁");
|
|
|
|
+ VideoRecordQueryRequestHn queryRequestHn = new VideoRecordQueryRequestHn(oauthConfigBaseInfo02);
|
|
|
|
+ queryRequestHn.setData(test);
|
|
|
|
+ System.out.println(queryRequestHn);
|
|
|
|
+ com.alibaba.fastjson.JSONObject jsonObject2 = queryRequestHn.doAction();
|
|
|
|
+ System.out.println(jsonObject2);
|
|
|
|
+ JSONArray jsonArray = JSONArray.parseArray(jsonObject2.get("records").toString());
|
|
|
|
+ System.out.println(jsonArray);
|
|
com.alibaba.fastjson.JSONObject json = (com.alibaba.fastjson.JSONObject) jsonArray.get(0);
|
|
com.alibaba.fastjson.JSONObject json = (com.alibaba.fastjson.JSONObject) jsonArray.get(0);
|
|
System.out.println(json);
|
|
System.out.println(json);
|
|
-
|
|
|
|
Map<String, Object> value = new HashMap<>();
|
|
Map<String, Object> value = new HashMap<>();
|
|
value.put("recordType", json.get("recordType"));
|
|
value.put("recordType", json.get("recordType"));
|
|
value.put("streamType", json.get("streamType"));
|
|
value.put("streamType", json.get("streamType"));
|
|
value.put("recordSource", json.get("recordSource"));
|
|
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();
|
|
|
|
- }
|
|
|
|
|
|
+ value.put("channelId", json.get("channelId"));
|
|
|
|
+ value.put("endTime", json.get("endTime"));
|
|
|
|
+ value.put("startTime", json.get("startTime"));
|
|
|
|
+
|
|
|
|
+ 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("苍南");
|
|
|
|
+ VideoRecordQueryRequestCn queryRequestCn = new VideoRecordQueryRequestCn(oauthConfigBaseInfo03);
|
|
|
|
+ queryRequestCn.setData(test);
|
|
|
|
+ System.out.println(queryRequestCn);
|
|
|
|
+ com.alibaba.fastjson.JSONObject jsonObject2 = queryRequestCn.doAction();
|
|
|
|
+ System.out.println(jsonObject2);
|
|
|
|
+ JSONArray jsonArray = JSONArray.parseArray(jsonObject2.get("records").toString());
|
|
|
|
+ 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", json.get("channelId"));
|
|
|
|
+ value.put("endTime", json.get("endTime"));
|
|
|
|
+ value.put("startTime", json.get("startTime"));
|
|
|
|
+
|
|
|
|
+ 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();
|
|
}
|
|
}
|
|
|
|
+
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|