|
@@ -3,6 +3,8 @@ package com.huimv.produce.dhicc.newcontroller;
|
|
|
//拿视频回放
|
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.dahuatech.hutool.http.Method;
|
|
|
import com.dahuatech.icc.exception.ClientException;
|
|
|
import com.dahuatech.icc.oauth.http.DefaultClient;
|
|
@@ -10,7 +12,12 @@ import com.dahuatech.icc.oauth.http.IClient;
|
|
|
import com.dahuatech.icc.oauth.model.v202010.GeneralRequest;
|
|
|
import com.dahuatech.icc.oauth.model.v202010.GeneralResponse;
|
|
|
|
|
|
+import com.huimv.produce.entity.BaseTelecomRoom;
|
|
|
+import com.huimv.produce.entity.IccChannel;
|
|
|
+import com.huimv.produce.mapper.IccChannelMapper;
|
|
|
+import com.huimv.produce.service.IIccChannelService;
|
|
|
import net.sf.json.JSONObject;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.web.bind.annotation.CrossOrigin;
|
|
|
import org.springframework.web.bind.annotation.RequestBody;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
@@ -29,15 +36,24 @@ import com.huimv.produce.dhicc.result.R;
|
|
|
@CrossOrigin
|
|
|
public class VideoRecorController {
|
|
|
|
|
|
- @RequestMapping("/getVideoRecord")
|
|
|
- public R getVideoRecord(@RequestBody Map<String, Object> params) throws ClientException, ParseException {
|
|
|
- String happendTime = (String) params.get("happendTime");
|
|
|
- String channelId = (String) params.get("channelId");
|
|
|
+ @Autowired
|
|
|
+ private IIccChannelService iIccChannelService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private IccChannelMapper iccChannelMapper ;
|
|
|
|
|
|
+
|
|
|
+ @RequestMapping("/getVideoRecord")
|
|
|
+ public R getVideoRecord(@RequestBody Map<String, Object> params1) throws ClientException, ParseException {
|
|
|
+ String happendTime = (String) params1.get("happendTime");
|
|
|
+ String channelNmae = (String) params1.get("channelName");
|
|
|
+ LambdaQueryWrapper<IccChannel> wrapper3 = Wrappers.lambdaQuery();
|
|
|
+ wrapper3.eq(IccChannel::getChannelName, channelNmae);
|
|
|
+ IccChannel iccChannel = iccChannelMapper.selectOne(wrapper3);
|
|
|
String URL = "/evo-apigw/admin/API/SS/Playback/StartPlaybackByTime"; //获取事件URL post请求
|
|
|
IClient iClient = new DefaultClient();
|
|
|
GeneralRequest generalRequest = new GeneralRequest(URL, Method.POST);
|
|
|
- /* System.out.println("开始执行");
|
|
|
+ System.out.println("开始执行");
|
|
|
Map<String, Object> params = new HashMap<>();
|
|
|
Map<String, Object> value = new HashMap<>();
|
|
|
value.put("nvrId","");
|
|
@@ -45,7 +61,8 @@ public class VideoRecorController {
|
|
|
value.put("recordType","1");
|
|
|
value.put("streamType","1");
|
|
|
value.put("recordSource","2");
|
|
|
- value.put("channelId",channelId);
|
|
|
+ value.put("channelId",iccChannel.getChannelId());
|
|
|
+ System.out.println(iccChannel.toString());
|
|
|
//开始结束时间代为处理
|
|
|
DateFormat fmt = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
//格式化传入的时间---拿传入时间前后五分钟的视频
|
|
@@ -60,8 +77,9 @@ public class VideoRecorController {
|
|
|
params.put("clientPushId","");
|
|
|
params.put("project","PSDK");
|
|
|
params.put("method","SS.Playback.StartPlaybackByTime");
|
|
|
- params.put("data",value);*/
|
|
|
+ params.put("data",value);
|
|
|
generalRequest.body(JSON.toJSONString(params));
|
|
|
+ System.out.println(JSON.toJSONString(params));
|
|
|
//这种已经在配置文件里面安排了账号ip以及密码
|
|
|
generalRequest.header("Content-Type", " application/json");
|
|
|
//发起请求处理应答
|