3 Commits fa90cc54c8 ... d329c83f83

Autor SHA1 Mensagem Data
  xujunwei d329c83f83 通道查询 1 year atrás
  xujunwei 00185482a7 通道查询 1 year atrás
  xujunwei ec3b1cead4 通道查询 1 year atrás

+ 32 - 0
src/main/java/com/genersoft/iot/vmp/extend/controller/ExtendDeviceController.java

@@ -2,11 +2,20 @@ package com.genersoft.iot.vmp.extend.controller;
 
 import com.genersoft.iot.vmp.extend.dto.ExtendDevicePageDto;
 import com.genersoft.iot.vmp.extend.entity.ExtendDevice;
+import com.genersoft.iot.vmp.extend.entity.ExtendDeviceChannel;
+import com.genersoft.iot.vmp.extend.service.ExtendDeviceChannelService;
 import com.genersoft.iot.vmp.extend.service.ExtendDeviceService;
+import com.genersoft.iot.vmp.vmanager.bean.StreamContent;
+import com.genersoft.iot.vmp.vmanager.bean.WVPResult;
+import com.genersoft.iot.vmp.vmanager.gb28181.play.PlayController;
 import com.github.pagehelper.PageInfo;
 import org.springframework.web.bind.annotation.*;
+import org.springframework.web.context.request.async.DeferredResult;
 
 import javax.annotation.Resource;
+import javax.servlet.http.HttpServletRequest;
+import java.util.List;
+import java.util.Map;
 
 @RestController
 @RequestMapping(value = "/internal/device")
@@ -15,6 +24,12 @@ public class ExtendDeviceController {
     @Resource
     private ExtendDeviceService deviceService;
 
+    @Resource
+    private ExtendDeviceChannelService deviceChannelService;
+
+    @Resource
+    private PlayController playController;
+
     @PostMapping("/page")
     public PageInfo<ExtendDevice> page(@RequestBody ExtendDevicePageDto dto) {
         if (dto.getPageNum() == 0) {
@@ -26,4 +41,21 @@ public class ExtendDeviceController {
         return deviceService.page(dto);
     }
 
+    @RequestMapping("/getDevices")
+    public Map<String,ExtendDevice> getDevices(@RequestParam List<String> deviceIds) {
+        return deviceService.getDevices(deviceIds);
+    }
+
+    @RequestMapping("/deviceChannel")
+    public List<ExtendDeviceChannel> deviceChannel(@RequestParam String deviceId) {
+        return deviceChannelService.deviceChannel(deviceId);
+    }
+
+
+    @RequestMapping("/start")
+    public DeferredResult<WVPResult<StreamContent>> start(HttpServletRequest request, @RequestParam String deviceId,
+                                                          @RequestParam String channelId) {
+        return playController.play(request,deviceId,channelId);
+    }
+
 }

+ 257 - 0
src/main/java/com/genersoft/iot/vmp/extend/entity/ExtendDeviceChannel.java

@@ -0,0 +1,257 @@
+package com.genersoft.iot.vmp.extend.entity;
+
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+@Schema(description = "通道信息")
+@TableName("wvp_device_channel")
+@Data
+public class ExtendDeviceChannel {
+
+    /**
+     * 数据库自增ID
+     */
+    @Schema(description = "数据库自增ID")
+    private int id;
+
+    /**
+     * 通道国标编号
+     */
+    @Schema(description = "通道国标编号")
+    private String channelId;
+
+    /**
+     * 设备国标编号
+     */
+    @Schema(description = "设备国标编号")
+    private String deviceId;
+
+    /**
+     * 通道名
+     */
+    @Schema(description = "名称")
+    private String name;
+
+    /**
+     * 生产厂商
+     */
+    @Schema(description = "生产厂商")
+    private String manufacture;
+
+    /**
+     * 型号
+     */
+    @Schema(description = "型号")
+    private String model;
+
+    /**
+     * 设备归属
+     */
+    @Schema(description = "设备归属")
+    private String owner;
+
+    /**
+     * 行政区域
+     */
+    @Schema(description = "行政区域")
+    private String civilCode;
+
+    /**
+     * 警区
+     */
+    @Schema(description = "警区")
+    private String block;
+
+    /**
+     * 安装地址
+     */
+    @Schema(description = "安装地址")
+    private String address;
+
+    /**
+     * 是否有子设备 1有, 0没有
+     */
+    @Schema(description = "是否有子设备 1有, 0没有")
+    private int parental;
+
+    /**
+     * 父级id
+     */
+    @Schema(description = "父级id")
+    private String parentId;
+
+    /**
+     * 信令安全模式  缺省为0; 0:不采用; 2: S/MIME签名方式; 3: S/ MIME加密签名同时采用方式; 4:数字摘要方式
+     */
+    @Schema(description = "信令安全模式  缺省为0; 0:不采用; 2: S/MIME签名方式; 3: S/ MIME加密签名同时采用方式; 4:数字摘要方式")
+    private int safetyWay;
+
+    /**
+     * 注册方式 缺省为1;1:符合IETFRFC3261标准的认证注册模 式; 2:基于口令的双向认证注册模式; 3:基于数字证书的双向认证注册模式
+     */
+    @Schema(description = "注册方式 缺省为1;1:符合IETFRFC3261标准的认证注册模 式; 2:基于口令的双向认证注册模式; 3:基于数字证书的双向认证注册模式")
+    private int registerWay;
+
+    /**
+     * 证书序列号
+     */
+    @Schema(description = "证书序列号")
+    private String certNum;
+
+    /**
+     * 证书有效标识 缺省为0;证书有效标识:0:无效1: 有效
+     */
+    @Schema(description = "证书有效标识 缺省为0;证书有效标识:0:无效1: 有效")
+    private int certifiable;
+
+    /**
+     * 证书无效原因码
+     */
+    @Schema(description = "证书无效原因码")
+    private int errCode;
+
+    /**
+     * 证书终止有效期
+     */
+    @Schema(description = "证书终止有效期")
+    private String endTime;
+
+    /**
+     * 保密属性 缺省为0; 0:不涉密, 1:涉密
+     */
+    @Schema(description = "保密属性 缺省为0; 0:不涉密, 1:涉密")
+    private String secrecy;
+
+    /**
+     * IP地址
+     */
+    @Schema(description = "IP地址")
+    private String ipAddress;
+
+    /**
+     * 端口号
+     */
+    @Schema(description = "端口号")
+    private int port;
+
+    /**
+     * 密码
+     */
+    @Schema(description = "密码")
+    private String password;
+
+    /**
+     * 云台类型
+     */
+    @Schema(description = "云台类型")
+    private int ptzType;
+
+    /**
+     * 创建时间
+     */
+    @Schema(description = "创建时间")
+    private String createTime;
+
+    /**
+     * 更新时间
+     */
+    @Schema(description = "更新时间")
+    private String updateTime;
+
+    /**
+     * 在线/离线
+     * 1在线,0离线
+     * 默认在线
+     * 信令:
+     * <Status>ON</Status>
+     * <Status>OFF</Status>
+     * 遇到过NVR下的IPC下发信令可以推流, 但是 Status 响应 OFF
+     */
+    @Schema(description = "在线/离线, 1在线,0离线")
+    private boolean status;
+
+    /**
+     * 经度
+     */
+    @Schema(description = "经度")
+    private double longitude;
+
+    /**
+     * 纬度
+     */
+    @Schema(description = "纬度")
+    private double latitude;
+
+    /**
+     * 经度
+     */
+    @Schema(description = "自定义经度")
+    private double customLongitude;
+
+    /**
+     * 纬度
+     */
+    @Schema(description = "自定义纬度")
+    private double customLatitude;
+
+    /**
+     * 经度 GCJ02
+     */
+    @Schema(description = "GCJ02坐标系经度")
+    private double longitudeGcj02;
+
+    /**
+     * 纬度 GCJ02
+     */
+    @Schema(description = "GCJ02坐标系纬度")
+    private double latitudeGcj02;
+
+    /**
+     * 经度 WGS84
+     */
+    @Schema(description = "WGS84坐标系经度")
+    private double longitudeWgs84;
+
+    /**
+     * 纬度 WGS84
+     */
+    @Schema(description = "WGS84坐标系纬度")
+    private double latitudeWgs84;
+
+    /**
+     * 子设备数
+     */
+    @Schema(description = "子设备数")
+    private int subCount;
+
+    /**
+     * 流唯一编号,存在表示正在直播
+     */
+    @Schema(description = "流唯一编号,存在表示正在直播")
+    private String  streamId;
+
+    /**
+     *  是否含有音频
+     */
+    @Schema(description = "是否含有音频")
+    private Boolean hasAudio;
+
+    /**
+     * 业务分组
+     */
+    @Schema(description = "业务分组")
+    private String businessGroupId;
+
+    /**
+     * GPS的更新时间
+     */
+    @Schema(description = "GPS的更新时间")
+    private String gpsTime;
+
+    @Schema(description = "码流标识,优先级高于设备中码流标识," +
+            "用于选择码流时组成码流标识。默认为null,不设置。可选值: stream/streamnumber/streamprofile/streamMode")
+    private String streamIdentification;
+
+}

+ 7 - 0
src/main/java/com/genersoft/iot/vmp/extend/mapper/ExtendDeviceChannelMapper.java

@@ -0,0 +1,7 @@
+package com.genersoft.iot.vmp.extend.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.genersoft.iot.vmp.extend.entity.ExtendDeviceChannel;
+
+public interface ExtendDeviceChannelMapper extends BaseMapper<ExtendDeviceChannel> {
+}

+ 25 - 0
src/main/java/com/genersoft/iot/vmp/extend/service/ExtendDeviceChannelService.java

@@ -0,0 +1,25 @@
+package com.genersoft.iot.vmp.extend.service;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.genersoft.iot.vmp.extend.entity.ExtendDeviceChannel;
+import com.genersoft.iot.vmp.extend.mapper.ExtendDeviceChannelMapper;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+@Service
+public class ExtendDeviceChannelService extends ServiceImpl<ExtendDeviceChannelMapper, ExtendDeviceChannel> {
+
+    /**
+     * 查询
+     * @param deviceId
+     * @return
+     */
+    public List<ExtendDeviceChannel> deviceChannel(String deviceId) {
+        LambdaQueryWrapper<ExtendDeviceChannel> qw = new LambdaQueryWrapper<>();
+        qw.eq(ExtendDeviceChannel::getDeviceId,deviceId);
+        return list(qw);
+    }
+
+}

+ 15 - 0
src/main/java/com/genersoft/iot/vmp/extend/service/ExtendDeviceService.java

@@ -9,8 +9,11 @@ import com.genersoft.iot.vmp.extend.mapper.ExtendDeviceMapper;
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
 import org.springframework.stereotype.Service;
+import org.springframework.web.bind.annotation.RequestParam;
 
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 
 @Service
 public class ExtendDeviceService extends ServiceImpl<ExtendDeviceMapper, ExtendDevice> {
@@ -30,4 +33,16 @@ public class ExtendDeviceService extends ServiceImpl<ExtendDeviceMapper, ExtendD
         return new PageInfo<>(rsList);
     }
 
+    public Map<String,ExtendDevice> getDevices(List<String> deviceIds) {
+        LambdaQueryWrapper<ExtendDevice> lqw = new LambdaQueryWrapper<>();
+        lqw.in(ExtendDevice :: getDeviceId,deviceIds);
+        List<ExtendDevice> list = list(lqw);
+        Map<String,ExtendDevice> result = new HashMap<>();
+        for(ExtendDevice temp : list) {
+            result.put(temp.getDeviceId(),temp);
+        }
+        return result;
+
+    }
+
 }

+ 1 - 1
src/main/resources/application-local.yml

@@ -60,7 +60,7 @@ sip:
   # 如果要监听多张网卡,可以使用逗号分隔多个IP, 例如: 192.168.1.4,10.0.0.4
   # 如果不明白,就使用0.0.0.0,大部分情况都是可以的
   # 请不要使用127.0.0.1,任何包括localhost在内的域名都是不可以的。
-  ip: 10.11.20.82
+  ip: 10.11.20.68
   # [可选] 28181服务监听的端口
   port: 8116
   # 根据国标6.1.2中规定,domain宜采用ID统一编码的前十位编码。国标附录D中定义前8位为中心编码(由省级、市级、区级、基层编号组成,参照GB/T 2260-2007)