瀏覽代碼

调整回放接口001

yang 3 年之前
父節點
當前提交
f5343cca51

+ 20 - 0
huimv-farm-v2/huimv-produce-warning/src/main/java/com/huimv/produce/controller/IccChannelController.java

@@ -0,0 +1,20 @@
+package com.huimv.produce.controller;
+
+
+import org.springframework.web.bind.annotation.RequestMapping;
+
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * <p>
+ *  前端控制器
+ * </p>
+ *
+ * @author astupidcoder
+ * @since 2021-12-06
+ */
+@RestController
+@RequestMapping("/icc-channel")
+public class IccChannelController {
+
+}

+ 25 - 7
huimv-farm-v2/huimv-produce-warning/src/main/java/com/huimv/produce/dhicc/newcontroller/VideoRecorController.java

@@ -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");
         //发起请求处理应答

+ 35 - 0
huimv-farm-v2/huimv-produce-warning/src/main/java/com/huimv/produce/entity/IccChannel.java

@@ -0,0 +1,35 @@
+package com.huimv.produce.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.extension.activerecord.Model;
+import com.baomidou.mybatisplus.annotation.TableId;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+
+/**
+ * <p>
+ * 
+ * </p>
+ *
+ * @author astupidcoder
+ * @since 2021-12-06
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+@Accessors(chain = true)
+public class IccChannel extends Model {
+
+    private static final long serialVersionUID = 1L;
+
+    @TableId(value = "id", type = IdType.AUTO)
+    private Integer id;
+
+    private String channelName;
+
+    private String channelId;
+
+    private String remark;
+
+
+}

+ 17 - 0
huimv-farm-v2/huimv-produce-warning/src/main/java/com/huimv/produce/mapper/IccChannelMapper.java

@@ -0,0 +1,17 @@
+package com.huimv.produce.mapper;
+
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.huimv.produce.entity.IccChannel;
+
+/**
+ * <p>
+ *  Mapper 接口
+ * </p>
+ *
+ * @author astupidcoder
+ * @since 2021-12-06
+ */
+public interface IccChannelMapper extends BaseMapper<IccChannel> {
+
+}

+ 16 - 0
huimv-farm-v2/huimv-produce-warning/src/main/java/com/huimv/produce/service/IIccChannelService.java

@@ -0,0 +1,16 @@
+package com.huimv.produce.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.huimv.produce.entity.IccChannel;
+
+/**
+ * <p>
+ *  服务类
+ * </p>
+ *
+ * @author astupidcoder
+ * @since 2021-12-06
+ */
+public interface IIccChannelService extends IService<IccChannel> {
+
+}

+ 21 - 0
huimv-farm-v2/huimv-produce-warning/src/main/java/com/huimv/produce/service/impl/IccChannelServiceImpl.java

@@ -0,0 +1,21 @@
+package com.huimv.produce.service.impl;
+
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.huimv.produce.entity.IccChannel;
+import com.huimv.produce.mapper.IccChannelMapper;
+import com.huimv.produce.service.IIccChannelService;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ *  服务实现类
+ * </p>
+ *
+ * @author astupidcoder
+ * @since 2021-12-06
+ */
+@Service
+public class IccChannelServiceImpl extends ServiceImpl<IccChannelMapper, IccChannel> implements IIccChannelService {
+
+}