依赖包版本升级
This commit is contained in:
parent
8f77d0c25c
commit
1a9e49d9ff
44
pom.xml
44
pom.xml
@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-parent</artifactId>
|
||||
<version>2.3.5.RELEASE</version>
|
||||
<version>2.7.2</version>
|
||||
</parent>
|
||||
|
||||
<groupId>com.genersoft</groupId>
|
||||
@ -47,7 +47,6 @@
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<maven.build.timestamp.format>MMddHHmm</maven.build.timestamp.format>
|
||||
<maven-jar-plugin.version>3.1.1</maven-jar-plugin.version>
|
||||
<jedis-version>3.1.0</jedis-version>
|
||||
|
||||
<!-- 依赖版本 -->
|
||||
<snippetsDirectory>${project.build.directory}/generated-snippets</snippetsDirectory>
|
||||
@ -74,7 +73,7 @@
|
||||
<dependency>
|
||||
<groupId>org.mybatis.spring.boot</groupId>
|
||||
<artifactId>mybatis-spring-boot-starter</artifactId>
|
||||
<version>2.1.4</version>
|
||||
<version>2.2.2</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>com.zaxxer</groupId>
|
||||
@ -91,36 +90,35 @@
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>druid-spring-boot-starter</artifactId>
|
||||
<version>1.1.22</version>
|
||||
<version>1.2.11</version>
|
||||
</dependency>
|
||||
|
||||
<!-- mysql数据库 -->
|
||||
<dependency>
|
||||
<groupId>mysql</groupId>
|
||||
<artifactId>mysql-connector-java</artifactId>
|
||||
<version>8.0.22</version>
|
||||
<version>8.0.30</version>
|
||||
</dependency>
|
||||
|
||||
<!--Mybatis分页插件 -->
|
||||
<dependency>
|
||||
<groupId>com.github.pagehelper</groupId>
|
||||
<artifactId>pagehelper-spring-boot-starter</artifactId>
|
||||
<version>1.4.1</version>
|
||||
<version>1.4.3</version>
|
||||
</dependency>
|
||||
|
||||
<!--Swagger3 -->
|
||||
<!--在线文档 -->
|
||||
<dependency>
|
||||
<groupId>io.springfox</groupId>
|
||||
<artifactId>springfox-boot-starter</artifactId>
|
||||
<version>3.0.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.github.xiaoymin</groupId>
|
||||
<artifactId>knife4j-spring-boot-starter</artifactId>
|
||||
<version>3.0.2</version>
|
||||
<groupId>org.springdoc</groupId>
|
||||
<artifactId>springdoc-openapi-ui</artifactId>
|
||||
<version>1.6.10</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.github.xiaoymin</groupId>
|
||||
<artifactId>knife4j-springdoc-ui</artifactId>
|
||||
<version>3.0.3</version>
|
||||
</dependency>
|
||||
|
||||
<!--参数校验 -->
|
||||
<dependency>
|
||||
@ -145,7 +143,7 @@
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>log4j-over-slf4j</artifactId>
|
||||
<version>1.7.35</version>
|
||||
<version>1.7.36</version>
|
||||
</dependency>
|
||||
|
||||
<!-- xml解析库 -->
|
||||
@ -167,14 +165,14 @@
|
||||
<dependency>
|
||||
<groupId>com.squareup.okhttp3</groupId>
|
||||
<artifactId>okhttp</artifactId>
|
||||
<version>4.9.0</version>
|
||||
<version>4.10.0</version>
|
||||
</dependency>
|
||||
|
||||
<!-- okhttp 调试日志 -->
|
||||
<dependency>
|
||||
<groupId>com.squareup.okhttp3</groupId>
|
||||
<artifactId>logging-interceptor</artifactId>
|
||||
<version>4.9.0</version>
|
||||
<version>4.10.0</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
@ -183,7 +181,7 @@
|
||||
<dependency>
|
||||
<groupId>io.github.rburgst</groupId>
|
||||
<artifactId>okhttp-digest</artifactId>
|
||||
<version>2.5</version>
|
||||
<version>2.7</version>
|
||||
</dependency>
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/net.sf.kxml/kxml2 -->
|
||||
@ -197,21 +195,21 @@
|
||||
<dependency>
|
||||
<groupId>org.mitre.dsmiley.httpproxy</groupId>
|
||||
<artifactId>smiley-http-proxy-servlet</artifactId>
|
||||
<version>1.12</version>
|
||||
<version>1.12.1</version>
|
||||
</dependency>
|
||||
|
||||
<!--excel解析库-->
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>easyexcel</artifactId>
|
||||
<version>3.0.4</version>
|
||||
<version>3.1.1</version>
|
||||
</dependency>
|
||||
|
||||
<!-- 获取系统信息 -->
|
||||
<dependency>
|
||||
<groupId>com.github.oshi</groupId>
|
||||
<artifactId>oshi-core</artifactId>
|
||||
<version>6.1.0</version>
|
||||
<version>6.2.2</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
@ -231,7 +229,7 @@
|
||||
<dependency>
|
||||
<groupId>com.google.guava</groupId>
|
||||
<artifactId>guava</artifactId>
|
||||
<version>31.0.1-jre</version>
|
||||
<version>31.1-jre</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
|
@ -8,7 +8,6 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.boot.web.servlet.ServletComponentScan;
|
||||
import org.springframework.context.ConfigurableApplicationContext;
|
||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||
import springfox.documentation.oas.annotations.EnableOpenApi;
|
||||
|
||||
/**
|
||||
* 启动类
|
||||
@ -16,7 +15,6 @@ import springfox.documentation.oas.annotations.EnableOpenApi;
|
||||
@ServletComponentScan("com.genersoft.iot.vmp.conf")
|
||||
@SpringBootApplication
|
||||
@EnableScheduling
|
||||
@EnableOpenApi
|
||||
@EnableDruidSupport
|
||||
public class VManageBootstrap extends LogManager {
|
||||
private static String[] args;
|
||||
|
@ -1,6 +1,5 @@
|
||||
package com.genersoft.iot.vmp.common;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
|
||||
public class StreamInfo {
|
||||
|
||||
|
@ -9,6 +9,7 @@ import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import java.time.Instant;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
@ -25,20 +26,18 @@ public class DynamicTask {
|
||||
|
||||
private final Logger logger = LoggerFactory.getLogger(DynamicTask.class);
|
||||
|
||||
@Autowired
|
||||
private ThreadPoolTaskScheduler threadPoolTaskScheduler;
|
||||
|
||||
private final Map<String, ScheduledFuture<?>> futureMap = new ConcurrentHashMap<>();
|
||||
private final Map<String, Runnable> runnableMap = new ConcurrentHashMap<>();
|
||||
|
||||
@Bean
|
||||
public ThreadPoolTaskScheduler threadPoolTaskScheduler() {
|
||||
ThreadPoolTaskScheduler schedulerPool = new ThreadPoolTaskScheduler();
|
||||
schedulerPool.setPoolSize(300);
|
||||
schedulerPool.setWaitForTasksToCompleteOnShutdown(true);
|
||||
schedulerPool.setAwaitTerminationSeconds(10);
|
||||
return schedulerPool;
|
||||
|
||||
@PostConstruct
|
||||
public void DynamicTask() {
|
||||
threadPoolTaskScheduler = new ThreadPoolTaskScheduler();
|
||||
threadPoolTaskScheduler.setPoolSize(300);
|
||||
threadPoolTaskScheduler.setWaitForTasksToCompleteOnShutdown(true);
|
||||
threadPoolTaskScheduler.setAwaitTerminationSeconds(10);
|
||||
threadPoolTaskScheduler.initialize();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1,19 +1,18 @@
|
||||
package com.genersoft.iot.vmp.conf;
|
||||
package com.genersoft.iot.vmp.conf.redis;
|
||||
|
||||
|
||||
import com.alibaba.fastjson.parser.ParserConfig;
|
||||
import com.genersoft.iot.vmp.common.VideoManagerConstants;
|
||||
import com.genersoft.iot.vmp.service.impl.*;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.cache.annotation.CachingConfigurerSupport;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.data.redis.connection.RedisConnectionFactory;
|
||||
import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.data.redis.listener.PatternTopic;
|
||||
import org.springframework.data.redis.listener.RedisMessageListenerContainer;
|
||||
import org.springframework.data.redis.serializer.RedisSerializer;
|
||||
import org.springframework.data.redis.serializer.StringRedisSerializer;
|
||||
|
||||
import com.genersoft.iot.vmp.utils.redis.FastJsonRedisSerializer;
|
||||
@ -56,8 +55,6 @@ public class RedisConfig extends CachingConfigurerSupport {
|
||||
redisTemplate.setHashValueSerializer(fastJsonRedisSerializer);
|
||||
// 全局开启AutoType,不建议使用
|
||||
ParserConfig.getGlobalInstance().setAutoTypeSupport(true);
|
||||
// 建议使用这种方式,小范围指定白名单,需要序列化的类
|
||||
// ParserConfig.getGlobalInstance().addAccept("com.avatar");
|
||||
// key的序列化采用StringRedisSerializer
|
||||
redisTemplate.setKeySerializer(new StringRedisSerializer());
|
||||
redisTemplate.setHashKeySerializer(new StringRedisSerializer());
|
@ -1,41 +1,50 @@
|
||||
package com.genersoft.iot.vmp.gb28181.bean;
|
||||
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
/**
|
||||
* 国标设备/平台
|
||||
* @author lin
|
||||
*/
|
||||
@Schema(description = "国标设备/平台")
|
||||
public class Device {
|
||||
|
||||
/**
|
||||
* 设备Id
|
||||
* 设备国标编号
|
||||
*/
|
||||
@Schema(description = "设备国标编号")
|
||||
private String deviceId;
|
||||
|
||||
/**
|
||||
* 设备名
|
||||
*/
|
||||
@Schema(description = "名称")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 生产厂商
|
||||
*/
|
||||
@Schema(description = "生产厂商")
|
||||
private String manufacturer;
|
||||
|
||||
/**
|
||||
* 型号
|
||||
*/
|
||||
@Schema(description = "型号")
|
||||
private String model;
|
||||
|
||||
/**
|
||||
* 固件版本
|
||||
*/
|
||||
@Schema(description = "固件版本")
|
||||
private String firmware;
|
||||
|
||||
/**
|
||||
* 传输协议
|
||||
* UDP/TCP
|
||||
*/
|
||||
@Schema(description = "传输协议(UDP/TCP)")
|
||||
private String transport;
|
||||
|
||||
/**
|
||||
@ -44,103 +53,123 @@ public class Device {
|
||||
* TCP-ACTIVE:tcp主动模式
|
||||
* TCP-PASSIVE:tcp被动模式
|
||||
*/
|
||||
@Schema(description = "数据流传输模式")
|
||||
private String streamMode;
|
||||
|
||||
/**
|
||||
* wan地址_ip
|
||||
*/
|
||||
@Schema(description = "IP")
|
||||
private String ip;
|
||||
|
||||
/**
|
||||
* wan地址_port
|
||||
*/
|
||||
@Schema(description = "端口")
|
||||
private int port;
|
||||
|
||||
/**
|
||||
* wan地址
|
||||
*/
|
||||
@Schema(description = "wan地址")
|
||||
private String hostAddress;
|
||||
|
||||
/**
|
||||
* 在线
|
||||
*/
|
||||
@Schema(description = "是否在线,1为在线,0为离线")
|
||||
private int online;
|
||||
|
||||
|
||||
/**
|
||||
* 注册时间
|
||||
*/
|
||||
@Schema(description = "注册时间")
|
||||
private String registerTime;
|
||||
|
||||
|
||||
/**
|
||||
* 心跳时间
|
||||
*/
|
||||
@Schema(description = "心跳时间")
|
||||
private String keepaliveTime;
|
||||
|
||||
/**
|
||||
* 通道个数
|
||||
*/
|
||||
@Schema(description = "通道个数")
|
||||
private int channelCount;
|
||||
|
||||
/**
|
||||
* 注册有效期
|
||||
*/
|
||||
@Schema(description = "注册有效期")
|
||||
private int expires;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@Schema(description = "创建时间")
|
||||
private String createTime;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
@Schema(description = "更新时间")
|
||||
private String updateTime;
|
||||
|
||||
/**
|
||||
* 设备使用的媒体id, 默认为null
|
||||
*/
|
||||
@Schema(description = "设备使用的媒体id, 默认为null")
|
||||
private String mediaServerId;
|
||||
|
||||
/**
|
||||
* 字符集, 支持 UTF-8 与 GB2312
|
||||
*/
|
||||
@Schema(description = "符集, 支持 UTF-8 与 GB2312")
|
||||
private String charset ;
|
||||
|
||||
/**
|
||||
* 目录订阅周期,0为不订阅
|
||||
*/
|
||||
@Schema(description = "目录订阅周期,0为不订阅")
|
||||
private int subscribeCycleForCatalog;
|
||||
|
||||
/**
|
||||
* 移动设备位置订阅周期,0为不订阅
|
||||
*/
|
||||
@Schema(description = "移动设备位置订阅周期,0为不订阅")
|
||||
private int subscribeCycleForMobilePosition;
|
||||
|
||||
/**
|
||||
* 移动设备位置信息上报时间间隔,单位:秒,默认值5
|
||||
*/
|
||||
@Schema(description = "移动设备位置信息上报时间间隔,单位:秒,默认值5")
|
||||
private int mobilePositionSubmissionInterval = 5;
|
||||
|
||||
/**
|
||||
* 报警订阅周期,0为不订阅
|
||||
*/
|
||||
@Schema(description = "报警心跳时间订阅周期,0为不订阅")
|
||||
private int subscribeCycleForAlarm;
|
||||
|
||||
/**
|
||||
* 是否开启ssrc校验,默认关闭,开启可以防止串流
|
||||
*/
|
||||
@Schema(description = "是否开启ssrc校验,默认关闭,开启可以防止串流")
|
||||
private boolean ssrcCheck = true;
|
||||
|
||||
/**
|
||||
* 地理坐标系, 目前支持 WGS84,GCJ02 TODO CGCS2000
|
||||
* 地理坐标系, 目前支持 WGS84,GCJ02
|
||||
*/
|
||||
@Schema(description = "地理坐标系, 目前支持 WGS84,GCJ02")
|
||||
private String geoCoordSys;
|
||||
|
||||
/**
|
||||
* 树类型 国标规定了两种树的展现方式 行政区划:CivilCode 和业务分组:BusinessGroup
|
||||
*/
|
||||
@Schema(description = "树类型 国标规定了两种树的展现方式 行政区划:CivilCode 和业务分组:BusinessGroup")
|
||||
private String treeType;
|
||||
|
||||
|
||||
|
@ -1,52 +1,67 @@
|
||||
package com.genersoft.iot.vmp.gb28181.bean;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
/**
|
||||
* @author lin
|
||||
*/
|
||||
@Schema(description = "报警信息")
|
||||
public class DeviceAlarm {
|
||||
|
||||
/**
|
||||
* 数据库id
|
||||
*/
|
||||
@Schema(description = "数据库id")
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 设备Id
|
||||
*/
|
||||
@Schema(description = "设备的国标编号")
|
||||
private String deviceId;
|
||||
|
||||
/**
|
||||
* 通道Id
|
||||
*/
|
||||
@Schema(description = "通道的国标编号")
|
||||
private String channelId;
|
||||
|
||||
/**
|
||||
* 报警级别, 1为一级警情, 2为二级警情, 3为三级警情, 4为四级 警情-
|
||||
* 报警级别, 1为一级警情, 2为二级警情, 3为三级警情, 4为四级警情
|
||||
*/
|
||||
@Schema(description = "报警级别, 1为一级警情, 2为二级警情, 3为三级警情, 4为四级警情")
|
||||
private String alarmPriority;
|
||||
|
||||
/**
|
||||
* 报警方式 , 1为电话报警, 2为设备报警, 3为短信报警, 4为 GPS报警, 5为视频报警, 6为设备故障报警,
|
||||
* 7其他报警;可以为直接组合如12为电话报警或 设备报警-
|
||||
*/
|
||||
@Schema(description = "报警方式 , 1为电话报警, 2为设备报警, 3为短信报警, 4为 GPS报警, 5为视频报警, 6为设备故障报警,\n" +
|
||||
"\t * 7其他报警;可以为直接组合如12为电话报警或设备报警")
|
||||
private String alarmMethod;
|
||||
|
||||
/**
|
||||
* 报警时间
|
||||
*/
|
||||
@Schema(description = "报警时间")
|
||||
private String alarmTime;
|
||||
|
||||
/**
|
||||
* 报警内容描述
|
||||
*/
|
||||
@Schema(description = "报警内容描述")
|
||||
private String alarmDescription;
|
||||
|
||||
/**
|
||||
* 经度
|
||||
*/
|
||||
@Schema(description = "经度")
|
||||
private double longitude;
|
||||
|
||||
/**
|
||||
* 纬度
|
||||
*/
|
||||
@Schema(description = "纬度")
|
||||
private double latitude;
|
||||
|
||||
/**
|
||||
@ -75,8 +90,10 @@ public class DeviceAlarm {
|
||||
* 1-存储设备磁盘故障报警;
|
||||
* 2-存储设备风扇故障报警。
|
||||
*/
|
||||
@Schema(description = "报警类型")
|
||||
private String alarmType;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
private String createTime;
|
||||
|
||||
|
||||
|
@ -1,136 +1,165 @@
|
||||
package com.genersoft.iot.vmp.gb28181.bean;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
@Schema(description = "通道信息")
|
||||
public class DeviceChannel {
|
||||
|
||||
|
||||
/**
|
||||
* 数据库自增ID
|
||||
*/
|
||||
@Schema(description = "数据库自增ID")
|
||||
private int id;
|
||||
|
||||
/**
|
||||
* 通道id
|
||||
* 通道国标编号
|
||||
*/
|
||||
@Schema(description = "通道国标编号")
|
||||
private String channelId;
|
||||
|
||||
/**
|
||||
* 设备id
|
||||
* 设备国标编号
|
||||
*/
|
||||
@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 PTZTypeText;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@Schema(description = "创建时间")
|
||||
private String createTime;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
@Schema(description = "更新时间")
|
||||
private String updateTime;
|
||||
|
||||
/**
|
||||
@ -142,66 +171,79 @@ public class DeviceChannel {
|
||||
* <Status>OFF</Status>
|
||||
* 遇到过NVR下的IPC下发信令可以推流, 但是 Status 响应 OFF
|
||||
*/
|
||||
@Schema(description = "在线/离线, 1在线,0离线")
|
||||
private int status;
|
||||
|
||||
/**
|
||||
* 经度
|
||||
*/
|
||||
@Schema(description = "经度")
|
||||
private double longitude;
|
||||
|
||||
/**
|
||||
* 纬度
|
||||
*/
|
||||
@Schema(description = "纬度")
|
||||
private double latitude;
|
||||
|
||||
/**
|
||||
* 经度 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;
|
||||
|
||||
/**
|
||||
* 标记通道的类型,0->国标通道 1->直播流通道 2->业务分组/虚拟组织/行政区划
|
||||
*/
|
||||
@Schema(description = "标记通道的类型,0->国标通道 1->直播流通道 2->业务分组/虚拟组织/行政区划")
|
||||
private int channelType;
|
||||
|
||||
/**
|
||||
* 业务分组
|
||||
*/
|
||||
@Schema(description = "业务分组")
|
||||
private String businessGroupId;
|
||||
|
||||
/**
|
||||
* GPS的更新时间
|
||||
*/
|
||||
@Schema(description = "GPS的更新时间")
|
||||
private String gpsTime;
|
||||
|
||||
public int getId() {
|
||||
|
@ -1,21 +1,36 @@
|
||||
package com.genersoft.iot.vmp.gb28181.bean;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
/**
|
||||
* 直播流关联国标上级平台
|
||||
* @author lin
|
||||
*/
|
||||
@Schema(description = "直播流关联国标上级平台")
|
||||
public class GbStream extends PlatformGbStream{
|
||||
|
||||
@Schema(description = "ID")
|
||||
private Integer gbStreamId;
|
||||
@Schema(description = "应用名")
|
||||
private String app;
|
||||
@Schema(description = "流ID")
|
||||
private String stream;
|
||||
@Schema(description = "国标ID")
|
||||
private String gbId;
|
||||
@Schema(description = "名称")
|
||||
private String name;
|
||||
@Schema(description = "流媒体ID")
|
||||
private String mediaServerId;
|
||||
@Schema(description = "经度")
|
||||
private double longitude;
|
||||
@Schema(description = "纬度")
|
||||
private double latitude;
|
||||
@Schema(description = "流类型(拉流/推流)")
|
||||
private String streamType;
|
||||
@Schema(description = "状态")
|
||||
private boolean status;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
public String createTime;
|
||||
|
||||
@Override
|
||||
|
@ -1,157 +1,193 @@
|
||||
package com.genersoft.iot.vmp.gb28181.bean;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
/**
|
||||
* @author lin
|
||||
*/
|
||||
@Schema(description = "平台信息")
|
||||
public class ParentPlatform {
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
@Schema(description = "ID(数据库中)")
|
||||
private Integer id;
|
||||
|
||||
/**
|
||||
* 是否启用
|
||||
*/
|
||||
@Schema(description = "是否启用")
|
||||
private boolean enable;
|
||||
|
||||
/**
|
||||
* 名称
|
||||
*/
|
||||
@Schema(description = "名称")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* SIP服务国标编码
|
||||
*/
|
||||
@Schema(description = "SIP服务国标编码")
|
||||
private String serverGBId;
|
||||
|
||||
/**
|
||||
* SIP服务国标域
|
||||
*/
|
||||
@Schema(description = "SIP服务国标域")
|
||||
private String serverGBDomain;
|
||||
|
||||
/**
|
||||
* SIP服务IP
|
||||
*/
|
||||
@Schema(description = "SIP服务IP")
|
||||
private String serverIP;
|
||||
|
||||
/**
|
||||
* SIP服务端口
|
||||
*/
|
||||
@Schema(description = "SIP服务端口")
|
||||
private int serverPort;
|
||||
|
||||
/**
|
||||
* 设备国标编号
|
||||
*/
|
||||
@Schema(description = "11111")
|
||||
private String deviceGBId;
|
||||
|
||||
/**
|
||||
* 设备ip
|
||||
*/
|
||||
@Schema(description = "设备ip")
|
||||
private String deviceIp;
|
||||
|
||||
/**
|
||||
* 设备端口
|
||||
*/
|
||||
@Schema(description = "设备端口")
|
||||
private String devicePort;
|
||||
|
||||
/**
|
||||
* SIP认证用户名(默认使用设备国标编号)
|
||||
*/
|
||||
@Schema(description = "SIP认证用户名(默认使用设备国标编号)")
|
||||
private String username;
|
||||
|
||||
/**
|
||||
* SIP认证密码
|
||||
*/
|
||||
@Schema(description = "SIP认证密码")
|
||||
private String password;
|
||||
|
||||
/**
|
||||
* 注册周期 (秒)
|
||||
*/
|
||||
@Schema(description = "注册周期 (秒)")
|
||||
private String expires;
|
||||
|
||||
/**
|
||||
* 心跳周期(秒)
|
||||
*/
|
||||
@Schema(description = "心跳周期(秒)")
|
||||
private String keepTimeout;
|
||||
|
||||
/**
|
||||
* 传输协议
|
||||
* UDP/TCP
|
||||
*/
|
||||
@Schema(description = "传输协议")
|
||||
private String transport;
|
||||
|
||||
/**
|
||||
* 字符集
|
||||
*/
|
||||
@Schema(description = "字符集")
|
||||
private String characterSet;
|
||||
|
||||
/**
|
||||
* 允许云台控制
|
||||
*/
|
||||
@Schema(description = "允许云台控制")
|
||||
private boolean ptz;
|
||||
|
||||
/**
|
||||
* RTCP流保活
|
||||
* TODO 预留, 暂不实现
|
||||
*/
|
||||
@Schema(description = "RTCP流保活")
|
||||
private boolean rtcp;
|
||||
|
||||
/**
|
||||
* 在线状态
|
||||
*/
|
||||
@Schema(description = "在线状态")
|
||||
private boolean status;
|
||||
|
||||
/**
|
||||
* 在线状态
|
||||
*/
|
||||
@Schema(description = "在线状态")
|
||||
private int channelCount;
|
||||
|
||||
/**
|
||||
* 默认目录Id,自动添加的通道多放在这个目录下
|
||||
*/
|
||||
@Schema(description = "默认目录Id,自动添加的通道多放在这个目录下")
|
||||
private String catalogId;
|
||||
|
||||
/**
|
||||
* 已被订阅目录信息
|
||||
*/
|
||||
@Schema(description = "已被订阅目录信息")
|
||||
private boolean catalogSubscribe;
|
||||
|
||||
/**
|
||||
* 已被订阅报警信息
|
||||
*/
|
||||
@Schema(description = "已被订阅报警信息")
|
||||
private boolean alarmSubscribe;
|
||||
|
||||
/**
|
||||
* 已被订阅移动位置信息
|
||||
*/
|
||||
@Schema(description = "已被订阅移动位置信息")
|
||||
private boolean mobilePositionSubscribe;
|
||||
|
||||
/**
|
||||
* 点播未推流的设备时是否使用redis通知拉起
|
||||
*/
|
||||
@Schema(description = "点播未推流的设备时是否使用redis通知拉起")
|
||||
private boolean startOfflinePush;
|
||||
|
||||
/**
|
||||
* 目录分组-每次向上级发送通道信息时单个包携带的通道数量,取值1,2,4,8
|
||||
*/
|
||||
@Schema(description = "目录分组-每次向上级发送通道信息时单个包携带的通道数量,取值1,2,4,8")
|
||||
private int catalogGroup;
|
||||
|
||||
/**
|
||||
* 行政区划
|
||||
*/
|
||||
@Schema(description = "行政区划")
|
||||
private String administrativeDivision;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
@Schema(description = "更新时间")
|
||||
private String updateTime;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@Schema(description = "创建时间")
|
||||
private String createTime;
|
||||
|
||||
/**
|
||||
* 树类型 国标规定了两种树的展现方式 行政区划 CivilCode 和业务分组:BusinessGroup
|
||||
*/
|
||||
@Schema(description = "树类型 国标规定了两种树的展现方式 行政区划 CivilCode 和业务分组:BusinessGrou")
|
||||
private String treeType;
|
||||
|
||||
public Integer getId() {
|
||||
|
@ -1,27 +1,41 @@
|
||||
package com.genersoft.iot.vmp.gb28181.bean;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
/**
|
||||
* 国标级联-目录
|
||||
* @author lin
|
||||
*/
|
||||
@Schema(description = "目录信息")
|
||||
public class PlatformCatalog {
|
||||
@Schema(description = "ID")
|
||||
private String id;
|
||||
|
||||
@Schema(description = "名称")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "平台ID")
|
||||
private String platformId;
|
||||
|
||||
@Schema(description = "父级目录ID")
|
||||
private String parentId;
|
||||
|
||||
@Schema(description = "行政区划")
|
||||
private String civilCode;
|
||||
|
||||
@Schema(description = "目录分组")
|
||||
private String businessGroupId;
|
||||
|
||||
/**
|
||||
* 子节点数
|
||||
*/
|
||||
@Schema(description = "子节点数")
|
||||
private int childrenCount;
|
||||
|
||||
/**
|
||||
* 0 目录, 1 国标通道, 2 直播流
|
||||
*/
|
||||
@Schema(description = "类型:0 目录, 1 国标通道, 2 直播流")
|
||||
private int type;
|
||||
|
||||
public String getId() {
|
||||
|
@ -1,8 +1,16 @@
|
||||
package com.genersoft.iot.vmp.gb28181.bean;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
public class PlatformGbStream {
|
||||
|
||||
@Schema(description = "ID")
|
||||
private Integer gbStreamId;
|
||||
|
||||
@Schema(description = "平台ID")
|
||||
private String platformId;
|
||||
|
||||
@Schema(description = "目录ID")
|
||||
private String catalogId;
|
||||
|
||||
public Integer getGbStreamId() {
|
||||
|
@ -1,14 +1,20 @@
|
||||
package com.genersoft.iot.vmp.gb28181.bean;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
/**
|
||||
* 摄像机同步状态
|
||||
* @author lin
|
||||
*/
|
||||
@Schema(description = "摄像机同步状态")
|
||||
public class SyncStatus {
|
||||
@Schema(description = "总数")
|
||||
private int total;
|
||||
@Schema(description = "当前更新多少")
|
||||
private int current;
|
||||
@Schema(description = "错误描述")
|
||||
private String errorMsg;
|
||||
|
||||
@Schema(description = "是否同步中")
|
||||
private boolean syncIng;
|
||||
|
||||
public int getTotal() {
|
||||
|
@ -1,81 +0,0 @@
|
||||
package com.genersoft.iot.vmp.gb28181.event.offline;
|
||||
|
||||
import com.genersoft.iot.vmp.conf.RedisKeyExpirationEventMessageListener;
|
||||
import com.genersoft.iot.vmp.conf.UserSetting;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.Device;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform;
|
||||
import com.genersoft.iot.vmp.gb28181.event.SipSubscribe;
|
||||
import com.genersoft.iot.vmp.storager.IVideoManagerStorage;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.redis.connection.Message;
|
||||
import org.springframework.data.redis.listener.RedisMessageListenerContainer;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.genersoft.iot.vmp.common.VideoManagerConstants;
|
||||
import com.genersoft.iot.vmp.gb28181.event.EventPublisher;
|
||||
|
||||
/**
|
||||
* 设备心跳超时监听,借助redis过期特性,进行监听,监听到说明设备心跳超时,发送离线事件
|
||||
* @author swwheihei
|
||||
*/
|
||||
@Component
|
||||
public class KeepaliveTimeoutListenerForPlatform extends RedisKeyExpirationEventMessageListener {
|
||||
|
||||
private Logger logger = LoggerFactory.getLogger(KeepaliveTimeoutListenerForPlatform.class);
|
||||
|
||||
@Autowired
|
||||
private EventPublisher publisher;
|
||||
|
||||
@Autowired
|
||||
private UserSetting userSetting;
|
||||
|
||||
@Autowired
|
||||
private SipSubscribe sipSubscribe;
|
||||
|
||||
@Autowired
|
||||
private IVideoManagerStorage storager;
|
||||
|
||||
public KeepaliveTimeoutListenerForPlatform(RedisMessageListenerContainer listenerContainer, UserSetting userSetting) {
|
||||
super(listenerContainer, userSetting);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 监听失效的key
|
||||
* @param message
|
||||
* @param pattern
|
||||
*/
|
||||
@Override
|
||||
public void onMessage(Message message, byte[] pattern) {
|
||||
// 获取失效的key
|
||||
String expiredKey = message.toString();
|
||||
// 平台心跳到期,需要重发, 判断是否已经多次未收到心跳回复, 多次未收到,则重新发起注册, 注册尝试多次未得到回复,则认为平台离线
|
||||
String PLATFORM_KEEPLIVEKEY_PREFIX = VideoManagerConstants.PLATFORM_KEEPALIVE_PREFIX + userSetting.getServerId() + "_";
|
||||
String PLATFORM_REGISTER_PREFIX = VideoManagerConstants.PLATFORM_REGISTER_PREFIX + userSetting.getServerId() + "_";
|
||||
String REGISTER_INFO_PREFIX = VideoManagerConstants.PLATFORM_REGISTER_INFO_PREFIX + userSetting.getServerId() + "_";
|
||||
if (expiredKey.startsWith(PLATFORM_KEEPLIVEKEY_PREFIX)) {
|
||||
String platformGbId = expiredKey.substring(PLATFORM_KEEPLIVEKEY_PREFIX.length());
|
||||
ParentPlatform platform = storager.queryParentPlatByServerGBId(platformGbId);
|
||||
if (platform != null) {
|
||||
publisher.platformKeepaliveExpireEventPublish(platformGbId);
|
||||
}
|
||||
}else if (expiredKey.startsWith(PLATFORM_REGISTER_PREFIX)) {
|
||||
String platformGbId = expiredKey.substring(PLATFORM_REGISTER_PREFIX.length(),expiredKey.length());
|
||||
ParentPlatform platform = storager.queryParentPlatByServerGBId(platformGbId);
|
||||
if (platform != null) {
|
||||
publisher.platformRegisterCycleEventPublish(platformGbId);
|
||||
}
|
||||
}else if (expiredKey.startsWith(REGISTER_INFO_PREFIX)) {
|
||||
String callId = expiredKey.substring(REGISTER_INFO_PREFIX.length());
|
||||
if (sipSubscribe.getErrorSubscribe(callId) != null) {
|
||||
SipSubscribe.EventResult eventResult = new SipSubscribe.EventResult();
|
||||
eventResult.callId = callId;
|
||||
eventResult.msg = "注册超时";
|
||||
eventResult.type = "register timeout";
|
||||
sipSubscribe.getErrorSubscribe(callId).response(eventResult);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,27 +1,35 @@
|
||||
package com.genersoft.iot.vmp.gb28181.session;
|
||||
|
||||
import com.genersoft.iot.vmp.utils.ConfigConst;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import java.util.Set;
|
||||
|
||||
@Schema(description = "ssrc信息")
|
||||
public class SsrcConfig {
|
||||
|
||||
/**
|
||||
* zlm流媒体服务器Id
|
||||
*/
|
||||
@Schema(description = "流媒体服务器Id")
|
||||
private String mediaServerId;
|
||||
|
||||
@Schema(description = "SSRC前缀")
|
||||
private String ssrcPrefix;
|
||||
|
||||
/**
|
||||
* zlm流媒体服务器已用会话句柄
|
||||
*/
|
||||
@Schema(description = "zlm流媒体服务器已用会话句柄")
|
||||
private List<String> isUsed;
|
||||
|
||||
/**
|
||||
* zlm流媒体服务器可用会话句柄
|
||||
*/
|
||||
@Schema(description = "zlm流媒体服务器可用会话句柄")
|
||||
private List<String> notUsed;
|
||||
|
||||
public SsrcConfig() {
|
||||
|
@ -24,9 +24,6 @@ import org.springframework.util.StringUtils;
|
||||
@Component
|
||||
public class VideoStreamSessionManager {
|
||||
|
||||
@Autowired
|
||||
private RedisUtil redisUtil;
|
||||
|
||||
@Autowired
|
||||
private UserSetting userSetting;
|
||||
|
||||
@ -58,9 +55,9 @@ public class VideoStreamSessionManager {
|
||||
ssrcTransaction.setMediaServerId(mediaServerId);
|
||||
ssrcTransaction.setType(type);
|
||||
|
||||
redisUtil.set(VideoManagerConstants.MEDIA_TRANSACTION_USED_PREFIX + userSetting.getServerId()
|
||||
RedisUtil.set(VideoManagerConstants.MEDIA_TRANSACTION_USED_PREFIX + userSetting.getServerId()
|
||||
+ "_" + deviceId + "_" + channelId + "_" + callId + "_" + stream, ssrcTransaction);
|
||||
redisUtil.set(VideoManagerConstants.MEDIA_TRANSACTION_USED_PREFIX + userSetting.getServerId()
|
||||
RedisUtil.set(VideoManagerConstants.MEDIA_TRANSACTION_USED_PREFIX + userSetting.getServerId()
|
||||
+ "_" + deviceId + "_" + channelId + "_" + callId + "_" + stream, ssrcTransaction);
|
||||
}
|
||||
|
||||
@ -70,7 +67,7 @@ public class VideoStreamSessionManager {
|
||||
byte[] dialogByteArray = SerializeUtils.serialize(dialog);
|
||||
ssrcTransaction.setDialog(dialogByteArray);
|
||||
}
|
||||
redisUtil.set(VideoManagerConstants.MEDIA_TRANSACTION_USED_PREFIX + userSetting.getServerId()
|
||||
RedisUtil.set(VideoManagerConstants.MEDIA_TRANSACTION_USED_PREFIX + userSetting.getServerId()
|
||||
+ "_" + deviceId + "_" + channelId + "_" + ssrcTransaction.getCallId() + "_"
|
||||
+ ssrcTransaction.getStream(), ssrcTransaction);
|
||||
}
|
||||
@ -126,11 +123,11 @@ public class VideoStreamSessionManager {
|
||||
stream ="*";
|
||||
}
|
||||
String key = VideoManagerConstants.MEDIA_TRANSACTION_USED_PREFIX + userSetting.getServerId() + "_" + deviceId + "_" + channelId + "_" + callId+ "_" + stream;
|
||||
List<Object> scanResult = redisUtil.scan(key);
|
||||
List<Object> scanResult = RedisUtil.scan(key);
|
||||
if (scanResult.size() == 0) {
|
||||
return null;
|
||||
}
|
||||
return (SsrcTransaction)redisUtil.get((String) scanResult.get(0));
|
||||
return (SsrcTransaction)RedisUtil.get((String) scanResult.get(0));
|
||||
}
|
||||
|
||||
public List<SsrcTransaction> getSsrcTransactionForAll(String deviceId, String channelId, String callId, String stream){
|
||||
@ -147,13 +144,13 @@ public class VideoStreamSessionManager {
|
||||
stream ="*";
|
||||
}
|
||||
String key = VideoManagerConstants.MEDIA_TRANSACTION_USED_PREFIX + userSetting.getServerId() + "_" + deviceId + "_" + channelId + "_" + callId+ "_" + stream;
|
||||
List<Object> scanResult = redisUtil.scan(key);
|
||||
List<Object> scanResult = RedisUtil.scan(key);
|
||||
if (scanResult.size() == 0) {
|
||||
return null;
|
||||
}
|
||||
List<SsrcTransaction> result = new ArrayList<>();
|
||||
for (Object keyObj : scanResult) {
|
||||
result.add((SsrcTransaction)redisUtil.get((String) keyObj));
|
||||
result.add((SsrcTransaction)RedisUtil.get((String) keyObj));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@ -179,17 +176,17 @@ public class VideoStreamSessionManager {
|
||||
if (ssrcTransaction == null) {
|
||||
return;
|
||||
}
|
||||
redisUtil.del(VideoManagerConstants.MEDIA_TRANSACTION_USED_PREFIX + userSetting.getServerId() + "_"
|
||||
RedisUtil.del(VideoManagerConstants.MEDIA_TRANSACTION_USED_PREFIX + userSetting.getServerId() + "_"
|
||||
+ deviceId + "_" + channelId + "_" + ssrcTransaction.getCallId() + "_" + ssrcTransaction.getStream());
|
||||
}
|
||||
|
||||
|
||||
public List<SsrcTransaction> getAllSsrc() {
|
||||
List<Object> ssrcTransactionKeys = redisUtil.scan(String.format("%s_*_*_*_*", VideoManagerConstants.MEDIA_TRANSACTION_USED_PREFIX+ userSetting.getServerId()));
|
||||
List<Object> ssrcTransactionKeys = RedisUtil.scan(String.format("%s_*_*_*_*", VideoManagerConstants.MEDIA_TRANSACTION_USED_PREFIX+ userSetting.getServerId()));
|
||||
List<SsrcTransaction> result= new ArrayList<>();
|
||||
for (int i = 0; i < ssrcTransactionKeys.size(); i++) {
|
||||
String key = (String)ssrcTransactionKeys.get(i);
|
||||
SsrcTransaction ssrcTransaction = (SsrcTransaction)redisUtil.get(key);
|
||||
SsrcTransaction ssrcTransaction = (SsrcTransaction)RedisUtil.get(key);
|
||||
result.add(ssrcTransaction);
|
||||
}
|
||||
return result;
|
||||
|
@ -3,64 +3,93 @@ package com.genersoft.iot.vmp.media.zlm.dto;
|
||||
|
||||
import com.genersoft.iot.vmp.gb28181.session.SsrcConfig;
|
||||
import com.genersoft.iot.vmp.media.zlm.ZLMServerConfig;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
@Schema(description = "流媒体服务信息")
|
||||
public class MediaServerItem{
|
||||
|
||||
@Schema(description = "ID")
|
||||
private String id;
|
||||
|
||||
@Schema(description = "IP")
|
||||
private String ip;
|
||||
|
||||
@Schema(description = "hook使用的IP(zlm访问WVP使用的IP)")
|
||||
private String hookIp;
|
||||
|
||||
@Schema(description = "SDP IP")
|
||||
private String sdpIp;
|
||||
|
||||
@Schema(description = "流IP")
|
||||
private String streamIp;
|
||||
|
||||
@Schema(description = "HTTP端口")
|
||||
private int httpPort;
|
||||
|
||||
@Schema(description = "HTTPS端口")
|
||||
private int httpSSlPort;
|
||||
|
||||
@Schema(description = "RTMP端口")
|
||||
private int rtmpPort;
|
||||
|
||||
@Schema(description = "RTMPS端口")
|
||||
private int rtmpSSlPort;
|
||||
|
||||
@Schema(description = "RTP收流端口(单端口模式有用)")
|
||||
private int rtpProxyPort;
|
||||
|
||||
@Schema(description = "RTSP端口")
|
||||
private int rtspPort;
|
||||
|
||||
@Schema(description = "RTSPS端口")
|
||||
private int rtspSSLPort;
|
||||
|
||||
@Schema(description = "是否开启自动配置ZLM")
|
||||
private boolean autoConfig;
|
||||
|
||||
@Schema(description = "ZLM鉴权参数")
|
||||
private String secret;
|
||||
|
||||
@Schema(description = "某个流无人观看时,触发hook.on_stream_none_reader事件的最大等待时间,单位毫秒")
|
||||
private int streamNoneReaderDelayMS;
|
||||
|
||||
@Schema(description = "keepalive hook触发间隔,单位秒")
|
||||
private int hookAliveInterval;
|
||||
|
||||
@Schema(description = "是否使用多端口模式")
|
||||
private boolean rtpEnable;
|
||||
|
||||
@Schema(description = "状态")
|
||||
private boolean status;
|
||||
|
||||
@Schema(description = "多端口RTP收流端口范围")
|
||||
private String rtpPortRange;
|
||||
|
||||
@Schema(description = "RTP发流端口范围")
|
||||
private String sendRtpPortRange;
|
||||
|
||||
@Schema(description = "assist服务端口")
|
||||
private int recordAssistPort;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
private String createTime;
|
||||
|
||||
@Schema(description = "更新时间")
|
||||
private String updateTime;
|
||||
|
||||
@Schema(description = "上次心跳时间")
|
||||
private String lastKeepaliveTime;
|
||||
|
||||
@Schema(description = "是否是默认ZLM")
|
||||
private boolean defaultServer;
|
||||
|
||||
@Schema(description = "SSRC信息")
|
||||
private SsrcConfig ssrcConfig;
|
||||
|
||||
@Schema(description = "当前使用到的端口")
|
||||
private int currentPort;
|
||||
|
||||
|
||||
@ -68,6 +97,7 @@ public class MediaServerItem{
|
||||
* 每一台ZLM都有一套独立的SSRC列表
|
||||
* 在ApplicationCheckRunner里对mediaServerSsrcMap进行初始化
|
||||
*/
|
||||
@Schema(description = "ID")
|
||||
private HashMap<String, SsrcConfig> mediaServerSsrcMap;
|
||||
|
||||
public MediaServerItem() {
|
||||
|
@ -1,24 +1,45 @@
|
||||
package com.genersoft.iot.vmp.media.zlm.dto;
|
||||
|
||||
import com.genersoft.iot.vmp.gb28181.bean.GbStream;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
/**
|
||||
* @author lin
|
||||
*/
|
||||
@Schema(description = "拉流代理的信息")
|
||||
public class StreamProxyItem extends GbStream {
|
||||
|
||||
@Schema(description = "类型")
|
||||
private String type;
|
||||
@Schema(description = "应用名")
|
||||
private String app;
|
||||
@Schema(description = "流ID")
|
||||
private String stream;
|
||||
@Schema(description = "流媒体服务ID")
|
||||
private String mediaServerId;
|
||||
@Schema(description = "拉流地址")
|
||||
private String url;
|
||||
@Schema(description = "拉流地址")
|
||||
private String src_url;
|
||||
@Schema(description = "目标地址")
|
||||
private String dst_url;
|
||||
@Schema(description = "超时时间")
|
||||
private int timeout_ms;
|
||||
@Schema(description = "ffmpeg模板KEY")
|
||||
private String ffmpeg_cmd_key;
|
||||
@Schema(description = "rtsp拉流时,拉流方式,0:tcp,1:udp,2:组播")
|
||||
private String rtp_type;
|
||||
@Schema(description = "是否启用")
|
||||
private boolean enable;
|
||||
@Schema(description = "是否启用HLS")
|
||||
private boolean enable_hls;
|
||||
@Schema(description = "是否启用MP4")
|
||||
private boolean enable_mp4;
|
||||
private boolean enable_remove_none_reader; // 无人观看时删除
|
||||
@Schema(description = "是否 无人观看时删除")
|
||||
private boolean enable_remove_none_reader;
|
||||
@Schema(description = "上级平台国标ID")
|
||||
private String platformGbId;
|
||||
@Schema(description = "创建时间")
|
||||
private String createTime;
|
||||
|
||||
public String getType() {
|
||||
|
@ -2,37 +2,43 @@ package com.genersoft.iot.vmp.media.zlm.dto;
|
||||
|
||||
import com.genersoft.iot.vmp.gb28181.bean.GbStream;
|
||||
import com.genersoft.iot.vmp.utils.DateUtil;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.springframework.util.unit.DataUnit;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@Schema(description = "推流信息")
|
||||
public class StreamPushItem extends GbStream implements Comparable<StreamPushItem>{
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
@Schema(description = "id")
|
||||
private Integer id;
|
||||
|
||||
/**
|
||||
* 应用名
|
||||
*/
|
||||
@Schema(description = "应用名")
|
||||
private String app;
|
||||
|
||||
/**
|
||||
* 流id
|
||||
*/
|
||||
@Schema(description = "流id")
|
||||
private String stream;
|
||||
|
||||
/**
|
||||
* 观看总人数,包括hls/rtsp/rtmp/http-flv/ws-flv
|
||||
*/
|
||||
@Schema(description = "观看总人数")
|
||||
private String totalReaderCount;
|
||||
|
||||
/**
|
||||
* 协议 包括hls/rtsp/rtmp/http-flv/ws-flv
|
||||
*/
|
||||
@Schema(description = "协议 包括hls/rtsp/rtmp/http-flv/ws-flv")
|
||||
private List<MediaSchema> schemas;
|
||||
|
||||
/**
|
||||
@ -46,71 +52,85 @@ public class StreamPushItem extends GbStream implements Comparable<StreamPushIte
|
||||
* mp4_vod=6,
|
||||
* device_chn=7
|
||||
*/
|
||||
@Schema(description = "产生源类型")
|
||||
private int originType;
|
||||
|
||||
/**
|
||||
* 客户端和服务器网络信息,可能为null类型
|
||||
*/
|
||||
@Schema(description = "客户端和服务器网络信息,可能为null类型")
|
||||
private MediaItem.OriginSock originSock;
|
||||
|
||||
/**
|
||||
* 产生源类型的字符串描述
|
||||
*/
|
||||
@Schema(description = "产生源类型的字符串描述")
|
||||
private String originTypeStr;
|
||||
|
||||
/**
|
||||
* 产生源的url
|
||||
*/
|
||||
@Schema(description = "产生源的url")
|
||||
private String originUrl;
|
||||
|
||||
/**
|
||||
* 存活时间,单位秒
|
||||
*/
|
||||
@Schema(description = "存活时间,单位秒")
|
||||
private Long aliveSecond;
|
||||
|
||||
/**
|
||||
* 音视频轨道
|
||||
*/
|
||||
@Schema(description = "音视频轨道")
|
||||
private List<MediaItem.MediaTrack> tracks;
|
||||
|
||||
/**
|
||||
* 音视频轨道
|
||||
*/
|
||||
@Schema(description = "音视频轨道")
|
||||
private String vhost;
|
||||
|
||||
/**
|
||||
* 使用的流媒体ID
|
||||
*/
|
||||
@Schema(description = "使用的流媒体ID")
|
||||
private String mediaServerId;
|
||||
|
||||
/**
|
||||
* 使用的服务ID
|
||||
*/
|
||||
@Schema(description = "使用的服务ID")
|
||||
private String serverId;
|
||||
|
||||
/**
|
||||
* 推流时间
|
||||
*/
|
||||
@Schema(description = "推流时间")
|
||||
private String pushTime;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
@Schema(description = "更新时间")
|
||||
private String updateTime;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@Schema(description = "创建时间")
|
||||
private String createTime;
|
||||
|
||||
/**
|
||||
* 是否正在推流
|
||||
*/
|
||||
@Schema(description = "是否正在推流")
|
||||
private boolean pushIng;
|
||||
|
||||
/**
|
||||
* 是否自己平台的推流
|
||||
*/
|
||||
@Schema(description = "是否自己平台的推流")
|
||||
private boolean self;
|
||||
|
||||
|
||||
|
@ -8,7 +8,6 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import com.genersoft.iot.vmp.media.zlm.ZLMRunner;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@ -54,9 +53,6 @@ public class MediaServerServiceImpl implements IMediaServerService {
|
||||
@Autowired
|
||||
private SipConfig sipConfig;
|
||||
|
||||
@Autowired
|
||||
private ZLMRunner zlmRunner;
|
||||
|
||||
@Value("${server.ssl.enabled:false}")
|
||||
private boolean sslEnabled;
|
||||
|
||||
@ -84,8 +80,6 @@ public class MediaServerServiceImpl implements IMediaServerService {
|
||||
@Autowired
|
||||
private ZLMRTPServerFactory zlmrtpServerFactory;
|
||||
|
||||
@Autowired
|
||||
private RedisUtil redisUtil;
|
||||
|
||||
@Autowired
|
||||
private EventPublisher publisher;
|
||||
@ -104,12 +98,12 @@ public class MediaServerServiceImpl implements IMediaServerService {
|
||||
if (mediaServerItem.getSsrcConfig() == null) {
|
||||
SsrcConfig ssrcConfig = new SsrcConfig(mediaServerItem.getId(), null, sipConfig.getDomain());
|
||||
mediaServerItem.setSsrcConfig(ssrcConfig);
|
||||
redisUtil.set(VideoManagerConstants.MEDIA_SERVER_PREFIX + userSetting.getServerId() + "_" + mediaServerItem.getId(), mediaServerItem);
|
||||
RedisUtil.set(VideoManagerConstants.MEDIA_SERVER_PREFIX + userSetting.getServerId() + "_" + mediaServerItem.getId(), mediaServerItem);
|
||||
}
|
||||
// 查询redis是否存在此mediaServer
|
||||
String key = VideoManagerConstants.MEDIA_SERVER_PREFIX + userSetting.getServerId() + "_" + mediaServerItem.getId();
|
||||
if (!redisUtil.hasKey(key)) {
|
||||
redisUtil.set(key, mediaServerItem);
|
||||
if (!RedisUtil.hasKey(key)) {
|
||||
RedisUtil.set(key, mediaServerItem);
|
||||
}
|
||||
|
||||
}
|
||||
@ -151,7 +145,7 @@ public class MediaServerServiceImpl implements IMediaServerService {
|
||||
if (mediaServerItem.isRtpEnable()) {
|
||||
rtpServerPort = zlmrtpServerFactory.createRTPServer(mediaServerItem, streamId, ssrcCheck?Integer.parseInt(ssrc):0, port);
|
||||
}
|
||||
redisUtil.set(key, mediaServerItem);
|
||||
RedisUtil.set(key, mediaServerItem);
|
||||
return new SSRCInfo(rtpServerPort, ssrc, streamId);
|
||||
}
|
||||
}
|
||||
@ -184,7 +178,7 @@ public class MediaServerServiceImpl implements IMediaServerService {
|
||||
ssrcConfig.releaseSsrc(ssrc);
|
||||
mediaServerItem.setSsrcConfig(ssrcConfig);
|
||||
String key = VideoManagerConstants.MEDIA_SERVER_PREFIX + userSetting.getServerId() + "_" + mediaServerItem.getId();
|
||||
redisUtil.set(key, mediaServerItem);
|
||||
RedisUtil.set(key, mediaServerItem);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -193,7 +187,7 @@ public class MediaServerServiceImpl implements IMediaServerService {
|
||||
@Override
|
||||
public void clearRTPServer(MediaServerItem mediaServerItem) {
|
||||
mediaServerItem.setSsrcConfig(new SsrcConfig(mediaServerItem.getId(), null, sipConfig.getDomain()));
|
||||
redisUtil.zAdd(VideoManagerConstants.MEDIA_SERVERS_ONLINE_PREFIX + userSetting.getServerId(), mediaServerItem.getId(), 0);
|
||||
RedisUtil.zAdd(VideoManagerConstants.MEDIA_SERVERS_ONLINE_PREFIX + userSetting.getServerId(), mediaServerItem.getId(), 0);
|
||||
|
||||
}
|
||||
|
||||
@ -215,19 +209,19 @@ public class MediaServerServiceImpl implements IMediaServerService {
|
||||
);
|
||||
}
|
||||
String key = VideoManagerConstants.MEDIA_SERVER_PREFIX + userSetting.getServerId() + "_" + mediaServerItemInDataBase.getId();
|
||||
redisUtil.set(key, mediaServerItemInDataBase);
|
||||
RedisUtil.set(key, mediaServerItemInDataBase);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<MediaServerItem> getAll() {
|
||||
List<MediaServerItem> result = new ArrayList<>();
|
||||
List<Object> mediaServerKeys = redisUtil.scan(String.format("%S*", VideoManagerConstants.MEDIA_SERVER_PREFIX+ userSetting.getServerId() + "_" ));
|
||||
List<Object> mediaServerKeys = RedisUtil.scan(String.format("%S*", VideoManagerConstants.MEDIA_SERVER_PREFIX+ userSetting.getServerId() + "_" ));
|
||||
String onlineKey = VideoManagerConstants.MEDIA_SERVERS_ONLINE_PREFIX + userSetting.getServerId();
|
||||
for (Object mediaServerKey : mediaServerKeys) {
|
||||
String key = (String) mediaServerKey;
|
||||
MediaServerItem mediaServerItem = (MediaServerItem) redisUtil.get(key);
|
||||
MediaServerItem mediaServerItem = (MediaServerItem) RedisUtil.get(key);
|
||||
// 检查状态
|
||||
Double aDouble = redisUtil.zScore(onlineKey, mediaServerItem.getId());
|
||||
Double aDouble = RedisUtil.zScore(onlineKey, mediaServerItem.getId());
|
||||
if (aDouble != null) {
|
||||
mediaServerItem.setStatus(true);
|
||||
}
|
||||
@ -253,13 +247,13 @@ public class MediaServerServiceImpl implements IMediaServerService {
|
||||
@Override
|
||||
public List<MediaServerItem> getAllOnline() {
|
||||
String key = VideoManagerConstants.MEDIA_SERVERS_ONLINE_PREFIX + userSetting.getServerId();
|
||||
Set<String> mediaServerIdSet = redisUtil.zRevRange(key, 0, -1);
|
||||
Set<String> mediaServerIdSet = RedisUtil.zRevRange(key, 0, -1);
|
||||
|
||||
List<MediaServerItem> result = new ArrayList<>();
|
||||
if (mediaServerIdSet != null && mediaServerIdSet.size() > 0) {
|
||||
for (String mediaServerId : mediaServerIdSet) {
|
||||
String serverKey = VideoManagerConstants.MEDIA_SERVER_PREFIX + userSetting.getServerId() + "_" + mediaServerId;
|
||||
result.add((MediaServerItem) redisUtil.get(serverKey));
|
||||
result.add((MediaServerItem) RedisUtil.get(serverKey));
|
||||
}
|
||||
}
|
||||
Collections.reverse(result);
|
||||
@ -277,7 +271,7 @@ public class MediaServerServiceImpl implements IMediaServerService {
|
||||
return null;
|
||||
}
|
||||
String key = VideoManagerConstants.MEDIA_SERVER_PREFIX + userSetting.getServerId() + "_" + mediaServerId;
|
||||
return (MediaServerItem)redisUtil.get(key);
|
||||
return (MediaServerItem)RedisUtil.get(key);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -289,7 +283,7 @@ public class MediaServerServiceImpl implements IMediaServerService {
|
||||
@Override
|
||||
public void clearMediaServerForOnline() {
|
||||
String key = VideoManagerConstants.MEDIA_SERVERS_ONLINE_PREFIX + userSetting.getServerId();
|
||||
redisUtil.del(key);
|
||||
RedisUtil.del(key);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -397,14 +391,14 @@ public class MediaServerServiceImpl implements IMediaServerService {
|
||||
}
|
||||
mediaServerMapper.update(serverItem);
|
||||
String key = VideoManagerConstants.MEDIA_SERVER_PREFIX + userSetting.getServerId() + "_" + zlmServerConfig.getGeneralMediaServerId();
|
||||
if (redisUtil.get(key) == null) {
|
||||
if (RedisUtil.get(key) == null) {
|
||||
SsrcConfig ssrcConfig = new SsrcConfig(zlmServerConfig.getGeneralMediaServerId(), null, sipConfig.getDomain());
|
||||
serverItem.setSsrcConfig(ssrcConfig);
|
||||
}else {
|
||||
MediaServerItem mediaServerItemInRedis = (MediaServerItem)redisUtil.get(key);
|
||||
MediaServerItem mediaServerItemInRedis = (MediaServerItem)RedisUtil.get(key);
|
||||
serverItem.setSsrcConfig(mediaServerItemInRedis.getSsrcConfig());
|
||||
}
|
||||
redisUtil.set(key, serverItem);
|
||||
RedisUtil.set(key, serverItem);
|
||||
resetOnlineServerItem(serverItem);
|
||||
if (serverItem.isAutoConfig()) {
|
||||
setZLMConfig(serverItem, "0".equals(zlmServerConfig.getHookEnable()));
|
||||
@ -425,15 +419,15 @@ public class MediaServerServiceImpl implements IMediaServerService {
|
||||
// 更新缓存
|
||||
String key = VideoManagerConstants.MEDIA_SERVERS_ONLINE_PREFIX + userSetting.getServerId();
|
||||
// 使用zset的分数作为当前并发量, 默认值设置为0
|
||||
if (redisUtil.zScore(key, serverItem.getId()) == null) { // 不存在则设置默认值 已存在则重置
|
||||
redisUtil.zAdd(key, serverItem.getId(), 0L);
|
||||
if (RedisUtil.zScore(key, serverItem.getId()) == null) { // 不存在则设置默认值 已存在则重置
|
||||
RedisUtil.zAdd(key, serverItem.getId(), 0L);
|
||||
// 查询服务流数量
|
||||
zlmresTfulUtils.getMediaList(serverItem, null, null, "rtmp",(mediaList ->{
|
||||
Integer code = mediaList.getInteger("code");
|
||||
if (code == 0) {
|
||||
JSONArray data = mediaList.getJSONArray("data");
|
||||
if (data != null) {
|
||||
redisUtil.zAdd(key, serverItem.getId(), data.size());
|
||||
RedisUtil.zAdd(key, serverItem.getId(), data.size());
|
||||
}
|
||||
}
|
||||
}));
|
||||
@ -450,14 +444,14 @@ public class MediaServerServiceImpl implements IMediaServerService {
|
||||
return;
|
||||
}
|
||||
String key = VideoManagerConstants.MEDIA_SERVERS_ONLINE_PREFIX + userSetting.getServerId();
|
||||
redisUtil.zIncrScore(key, mediaServerId, 1);
|
||||
RedisUtil.zIncrScore(key, mediaServerId, 1);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeCount(String mediaServerId) {
|
||||
String key = VideoManagerConstants.MEDIA_SERVERS_ONLINE_PREFIX + userSetting.getServerId();
|
||||
redisUtil.zIncrScore(key, mediaServerId, - 1);
|
||||
RedisUtil.zIncrScore(key, mediaServerId, - 1);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -468,15 +462,15 @@ public class MediaServerServiceImpl implements IMediaServerService {
|
||||
public MediaServerItem getMediaServerForMinimumLoad() {
|
||||
String key = VideoManagerConstants.MEDIA_SERVERS_ONLINE_PREFIX + userSetting.getServerId();
|
||||
|
||||
if (redisUtil.zSize(key) == null || redisUtil.zSize(key) == 0) {
|
||||
if (redisUtil.zSize(key) == null || redisUtil.zSize(key) == 0) {
|
||||
if (RedisUtil.zSize(key) == null || RedisUtil.zSize(key) == 0) {
|
||||
if (RedisUtil.zSize(key) == null || RedisUtil.zSize(key) == 0) {
|
||||
logger.info("获取负载最低的节点时无在线节点");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
// 获取分数最低的,及并发最低的
|
||||
Set<Object> objects = redisUtil.ZRange(key, 0, -1);
|
||||
Set<Object> objects = RedisUtil.ZRange(key, 0, -1);
|
||||
ArrayList<Object> mediaServerObjectS = new ArrayList<>(objects);
|
||||
|
||||
String mediaServerId = (String)mediaServerObjectS.get(0);
|
||||
@ -619,9 +613,9 @@ public class MediaServerServiceImpl implements IMediaServerService {
|
||||
|
||||
@Override
|
||||
public void delete(String id) {
|
||||
redisUtil.zRemove(VideoManagerConstants.MEDIA_SERVERS_ONLINE_PREFIX + userSetting.getServerId(), id);
|
||||
RedisUtil.zRemove(VideoManagerConstants.MEDIA_SERVERS_ONLINE_PREFIX + userSetting.getServerId(), id);
|
||||
String key = VideoManagerConstants.MEDIA_SERVER_PREFIX + userSetting.getServerId() + "_" + id;
|
||||
redisUtil.del(key);
|
||||
RedisUtil.del(key);
|
||||
}
|
||||
@Override
|
||||
public void deleteDb(String id){
|
||||
@ -640,7 +634,7 @@ public class MediaServerServiceImpl implements IMediaServerService {
|
||||
}
|
||||
// zlm连接重试
|
||||
logger.warn("[更新ZLM 保活信息]失败,未找到流媒体信息,尝试重连zlm");
|
||||
reloadZlm();
|
||||
// reloadZlm();
|
||||
mediaServerItem = getOne(mediaServerId);
|
||||
if (mediaServerItem == null) {
|
||||
// zlm连接重试
|
||||
@ -650,7 +644,7 @@ public class MediaServerServiceImpl implements IMediaServerService {
|
||||
}
|
||||
String key = VideoManagerConstants.MEDIA_SERVER_KEEPALIVE_PREFIX + userSetting.getServerId() + "_" + mediaServerId;
|
||||
int hookAliveInterval = mediaServerItem.getHookAliveInterval() + 2;
|
||||
redisUtil.set(key, data, hookAliveInterval);
|
||||
RedisUtil.set(key, data, hookAliveInterval);
|
||||
}
|
||||
|
||||
private MediaServerItem getOneFromDatabase(String mediaServerId) {
|
||||
@ -672,13 +666,4 @@ public class MediaServerServiceImpl implements IMediaServerService {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void reloadZlm(){
|
||||
try {
|
||||
zlmRunner.run();
|
||||
Thread.sleep(500);//延迟0.5秒缓冲时间
|
||||
} catch (Exception e) {
|
||||
logger.warn("尝试重连zlm失败!",e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -66,8 +66,6 @@ public class RedisGbPlayMsgListener implements MessageListener {
|
||||
@Autowired
|
||||
private UserSetting userSetting;
|
||||
|
||||
@Autowired
|
||||
private RedisUtil redis;
|
||||
|
||||
@Autowired
|
||||
private ZLMMediaListManager zlmMediaListManager;
|
||||
@ -227,7 +225,7 @@ public class RedisGbPlayMsgListener implements MessageListener {
|
||||
WvpRedisMsg response = WvpRedisMsg.getResponseInstance(userSetting.getServerId(), toId,
|
||||
WvpRedisMsgCmd.REQUEST_PUSH_STREAM, serial, result);
|
||||
JSONObject jsonObject = (JSONObject)JSON.toJSON(response);
|
||||
redis.convertAndSend(WVP_PUSH_STREAM_KEY, jsonObject);
|
||||
RedisUtil.convertAndSend(WVP_PUSH_STREAM_KEY, jsonObject);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -246,7 +244,7 @@ public class RedisGbPlayMsgListener implements MessageListener {
|
||||
WvpRedisMsgCmd.GET_SEND_ITEM, serial, result);
|
||||
|
||||
JSONObject jsonObject = (JSONObject)JSON.toJSON(response);
|
||||
redis.convertAndSend(WVP_PUSH_STREAM_KEY, jsonObject);
|
||||
RedisUtil.convertAndSend(WVP_PUSH_STREAM_KEY, jsonObject);
|
||||
return;
|
||||
}
|
||||
// 确定流是否在线
|
||||
@ -269,7 +267,7 @@ public class RedisGbPlayMsgListener implements MessageListener {
|
||||
userSetting.getServerId(), toId, WvpRedisMsgCmd.GET_SEND_ITEM, serial, result
|
||||
);
|
||||
JSONObject jsonObject = (JSONObject)JSON.toJSON(response);
|
||||
redis.convertAndSend(WVP_PUSH_STREAM_KEY, jsonObject);
|
||||
RedisUtil.convertAndSend(WVP_PUSH_STREAM_KEY, jsonObject);
|
||||
}, userSetting.getPlatformPlayTimeout());
|
||||
|
||||
// 添加订阅
|
||||
@ -308,7 +306,7 @@ public class RedisGbPlayMsgListener implements MessageListener {
|
||||
userSetting.getServerId(), toId, WvpRedisMsgCmd.GET_SEND_ITEM, serial, result
|
||||
);
|
||||
JSONObject jsonObject = (JSONObject)JSON.toJSON(response);
|
||||
redis.convertAndSend(WVP_PUSH_STREAM_KEY, jsonObject);
|
||||
RedisUtil.convertAndSend(WVP_PUSH_STREAM_KEY, jsonObject);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -345,7 +343,7 @@ public class RedisGbPlayMsgListener implements MessageListener {
|
||||
wvpResult.setMsg("timeout");
|
||||
errorCallback.handler(wvpResult);
|
||||
}, userSetting.getPlatformPlayTimeout());
|
||||
redis.convertAndSend(WVP_PUSH_STREAM_KEY, jsonObject);
|
||||
RedisUtil.convertAndSend(WVP_PUSH_STREAM_KEY, jsonObject);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -370,6 +368,6 @@ public class RedisGbPlayMsgListener implements MessageListener {
|
||||
callbacksForStartSendRtpStream.remove(key);
|
||||
callbacksForError.remove(key);
|
||||
});
|
||||
redis.convertAndSend(WVP_PUSH_STREAM_KEY, jsonObject);
|
||||
RedisUtil.convertAndSend(WVP_PUSH_STREAM_KEY, jsonObject);
|
||||
}
|
||||
}
|
||||
|
@ -26,15 +26,6 @@ public class RedisStreamMsgListener implements MessageListener {
|
||||
|
||||
private final static Logger logger = LoggerFactory.getLogger(RedisStreamMsgListener.class);
|
||||
|
||||
@Autowired
|
||||
private ISIPCommander commander;
|
||||
|
||||
@Autowired
|
||||
private ISIPCommanderForPlatform commanderForPlatform;
|
||||
|
||||
@Autowired
|
||||
private IVideoManagerStorage storage;
|
||||
|
||||
@Autowired
|
||||
private UserSetting userSetting;
|
||||
|
||||
|
@ -22,7 +22,6 @@ import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
@ -32,9 +31,6 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage {
|
||||
|
||||
private final Logger logger = LoggerFactory.getLogger(RedisCatchStorageImpl.class);
|
||||
|
||||
@Autowired
|
||||
private RedisUtil redis;
|
||||
|
||||
@Autowired
|
||||
private DeviceChannelMapper deviceChannelMapper;
|
||||
|
||||
@ -45,9 +41,9 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage {
|
||||
public Long getCSEQ() {
|
||||
String key = VideoManagerConstants.SIP_CSEQ_PREFIX + userSetting.getServerId();
|
||||
|
||||
long result = redis.incr(key, 1L);
|
||||
long result = RedisUtil.incr(key, 1L);
|
||||
if (result > Integer.MAX_VALUE) {
|
||||
redis.set(key, 1);
|
||||
RedisUtil.set(key, 1);
|
||||
result = 1;
|
||||
}
|
||||
return result;
|
||||
@ -57,9 +53,9 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage {
|
||||
public Long getSN(String method) {
|
||||
String key = VideoManagerConstants.SIP_SN_PREFIX + userSetting.getServerId() + "_" + method;
|
||||
|
||||
long result = redis.incr(key, 1L);
|
||||
long result = RedisUtil.incr(key, 1L);
|
||||
if (result > Integer.MAX_VALUE) {
|
||||
redis.set(key, 1);
|
||||
RedisUtil.set(key, 1);
|
||||
result = 1;
|
||||
}
|
||||
return result;
|
||||
@ -68,20 +64,20 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage {
|
||||
@Override
|
||||
public void resetAllCSEQ() {
|
||||
String scanKey = VideoManagerConstants.SIP_CSEQ_PREFIX + userSetting.getServerId() + "_*";
|
||||
List<Object> keys = redis.scan(scanKey);
|
||||
List<Object> keys = RedisUtil.scan(scanKey);
|
||||
for (Object o : keys) {
|
||||
String key = (String) o;
|
||||
redis.set(key, 1);
|
||||
RedisUtil.set(key, 1);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void resetAllSN() {
|
||||
String scanKey = VideoManagerConstants.SIP_SN_PREFIX + userSetting.getServerId() + "_*";
|
||||
List<Object> keys = redis.scan(scanKey);
|
||||
List<Object> keys = RedisUtil.scan(scanKey);
|
||||
for (Object o : keys) {
|
||||
String key = (String) o;
|
||||
redis.set(key, 1);
|
||||
RedisUtil.set(key, 1);
|
||||
}
|
||||
}
|
||||
|
||||
@ -92,7 +88,7 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage {
|
||||
*/
|
||||
@Override
|
||||
public boolean startPlay(StreamInfo stream) {
|
||||
return redis.set(String.format("%S_%S_%s_%s_%s", VideoManagerConstants.PLAYER_PREFIX, userSetting.getServerId(),
|
||||
return RedisUtil.set(String.format("%S_%S_%s_%s_%s", VideoManagerConstants.PLAYER_PREFIX, userSetting.getServerId(),
|
||||
stream.getStream(), stream.getDeviceID(), stream.getChannelId()),
|
||||
stream);
|
||||
}
|
||||
@ -107,7 +103,7 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage {
|
||||
if (streamInfo == null) {
|
||||
return false;
|
||||
}
|
||||
return redis.del(String.format("%S_%s_%s_%s_%s", VideoManagerConstants.PLAYER_PREFIX,
|
||||
return RedisUtil.del(String.format("%S_%s_%s_%s_%s", VideoManagerConstants.PLAYER_PREFIX,
|
||||
userSetting.getServerId(),
|
||||
streamInfo.getStream(),
|
||||
streamInfo.getDeviceID(),
|
||||
@ -120,7 +116,7 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage {
|
||||
*/
|
||||
@Override
|
||||
public StreamInfo queryPlay(StreamInfo streamInfo) {
|
||||
return (StreamInfo)redis.get(String.format("%S_%s_%s_%s_%s",
|
||||
return (StreamInfo)RedisUtil.get(String.format("%S_%s_%s_%s_%s",
|
||||
VideoManagerConstants.PLAYER_PREFIX,
|
||||
userSetting.getServerId(),
|
||||
streamInfo.getStream(),
|
||||
@ -129,36 +125,36 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage {
|
||||
}
|
||||
@Override
|
||||
public StreamInfo queryPlayByStreamId(String streamId) {
|
||||
List<Object> playLeys = redis.scan(String.format("%S_%s_%s_*", VideoManagerConstants.PLAYER_PREFIX, userSetting.getServerId(), streamId));
|
||||
List<Object> playLeys = RedisUtil.scan(String.format("%S_%s_%s_*", VideoManagerConstants.PLAYER_PREFIX, userSetting.getServerId(), streamId));
|
||||
if (playLeys == null || playLeys.size() == 0) {
|
||||
return null;
|
||||
}
|
||||
return (StreamInfo)redis.get(playLeys.get(0).toString());
|
||||
return (StreamInfo)RedisUtil.get(playLeys.get(0).toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public StreamInfo queryPlayByDevice(String deviceId, String channelId) {
|
||||
List<Object> playLeys = redis.scan(String.format("%S_%s_*_%s_%s", VideoManagerConstants.PLAYER_PREFIX,
|
||||
List<Object> playLeys = RedisUtil.scan(String.format("%S_%s_*_%s_%s", VideoManagerConstants.PLAYER_PREFIX,
|
||||
userSetting.getServerId(),
|
||||
deviceId,
|
||||
channelId));
|
||||
if (playLeys == null || playLeys.size() == 0) {
|
||||
return null;
|
||||
}
|
||||
return (StreamInfo)redis.get(playLeys.get(0).toString());
|
||||
return (StreamInfo)RedisUtil.get(playLeys.get(0).toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, StreamInfo> queryPlayByDeviceId(String deviceId) {
|
||||
Map<String, StreamInfo> streamInfos = new HashMap<>();
|
||||
// List<Object> playLeys = redis.keys(String.format("%S_*_%S_*", VideoManagerConstants.PLAYER_PREFIX, deviceId));
|
||||
List<Object> players = redis.scan(String.format("%S_%s_*_%S_*", VideoManagerConstants.PLAYER_PREFIX, userSetting.getServerId(),deviceId));
|
||||
// List<Object> playLeys = RedisUtil.keys(String.format("%S_*_%S_*", VideoManagerConstants.PLAYER_PREFIX, deviceId));
|
||||
List<Object> players = RedisUtil.scan(String.format("%S_%s_*_%S_*", VideoManagerConstants.PLAYER_PREFIX, userSetting.getServerId(),deviceId));
|
||||
if (players.size() == 0) {
|
||||
return streamInfos;
|
||||
}
|
||||
for (Object player : players) {
|
||||
String key = (String) player;
|
||||
StreamInfo streamInfo = (StreamInfo) redis.get(key);
|
||||
StreamInfo streamInfo = (StreamInfo) RedisUtil.get(key);
|
||||
streamInfos.put(streamInfo.getDeviceID() + "_" + streamInfo.getChannelId(), streamInfo);
|
||||
}
|
||||
return streamInfos;
|
||||
@ -167,7 +163,7 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage {
|
||||
|
||||
@Override
|
||||
public boolean startPlayback(StreamInfo stream, String callId) {
|
||||
return redis.set(String.format("%S_%s_%s_%s_%s_%s", VideoManagerConstants.PLAY_BLACK_PREFIX,
|
||||
return RedisUtil.set(String.format("%S_%s_%s_%s_%s_%s", VideoManagerConstants.PLAY_BLACK_PREFIX,
|
||||
userSetting.getServerId(), stream.getDeviceID(), stream.getChannelId(), stream.getStream(), callId), stream);
|
||||
}
|
||||
|
||||
@ -175,10 +171,10 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage {
|
||||
public boolean startDownload(StreamInfo stream, String callId) {
|
||||
boolean result;
|
||||
if (stream.getProgress() == 1) {
|
||||
result = redis.set(String.format("%S_%s_%s_%s_%s_%s", VideoManagerConstants.DOWNLOAD_PREFIX,
|
||||
result = RedisUtil.set(String.format("%S_%s_%s_%s_%s_%s", VideoManagerConstants.DOWNLOAD_PREFIX,
|
||||
userSetting.getServerId(), stream.getDeviceID(), stream.getChannelId(), stream.getStream(), callId), stream);
|
||||
}else {
|
||||
result = redis.set(String.format("%S_%s_%s_%s_%s_%s", VideoManagerConstants.DOWNLOAD_PREFIX,
|
||||
result = RedisUtil.set(String.format("%S_%s_%s_%s_%s_%s", VideoManagerConstants.DOWNLOAD_PREFIX,
|
||||
userSetting.getServerId(), stream.getDeviceID(), stream.getChannelId(), stream.getStream(), callId), stream, 60*60);
|
||||
}
|
||||
return result;
|
||||
@ -210,10 +206,10 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage {
|
||||
stream,
|
||||
callId
|
||||
);
|
||||
List<Object> scan = redis.scan(key);
|
||||
List<Object> scan = RedisUtil.scan(key);
|
||||
if (scan.size() > 0) {
|
||||
for (Object keyObj : scan) {
|
||||
redis.del((String) keyObj);
|
||||
RedisUtil.del((String) keyObj);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
@ -246,10 +242,10 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage {
|
||||
stream,
|
||||
callId
|
||||
);
|
||||
List<Object> scan = redis.scan(key);
|
||||
List<Object> scan = RedisUtil.scan(key);
|
||||
if (scan.size() > 0) {
|
||||
for (Object keyObj : scan) {
|
||||
redis.del((String) keyObj);
|
||||
RedisUtil.del((String) keyObj);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
@ -279,9 +275,9 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage {
|
||||
stream,
|
||||
callId
|
||||
);
|
||||
List<Object> streamInfoScan = redis.scan(key);
|
||||
List<Object> streamInfoScan = RedisUtil.scan(key);
|
||||
if (streamInfoScan.size() > 0) {
|
||||
return (StreamInfo) redis.get((String) streamInfoScan.get(0));
|
||||
return (StreamInfo) RedisUtil.get((String) streamInfoScan.get(0));
|
||||
}else {
|
||||
return null;
|
||||
}
|
||||
@ -290,64 +286,64 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage {
|
||||
@Override
|
||||
public void updatePlatformCatchInfo(ParentPlatformCatch parentPlatformCatch) {
|
||||
String key = VideoManagerConstants.PLATFORM_CATCH_PREFIX + userSetting.getServerId() + "_" + parentPlatformCatch.getId();
|
||||
redis.set(key, parentPlatformCatch);
|
||||
RedisUtil.set(key, parentPlatformCatch);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updatePlatformKeepalive(ParentPlatform parentPlatform) {
|
||||
String key = VideoManagerConstants.PLATFORM_KEEPALIVE_PREFIX + userSetting.getServerId() + "_" + parentPlatform.getServerGBId();
|
||||
redis.set(key, "", Integer.parseInt(parentPlatform.getKeepTimeout()));
|
||||
RedisUtil.set(key, "", Integer.parseInt(parentPlatform.getKeepTimeout()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updatePlatformRegister(ParentPlatform parentPlatform) {
|
||||
String key = VideoManagerConstants.PLATFORM_REGISTER_PREFIX + userSetting.getServerId() + "_" + parentPlatform.getServerGBId();
|
||||
redis.set(key, "", Integer.parseInt(parentPlatform.getExpires()));
|
||||
RedisUtil.set(key, "", Integer.parseInt(parentPlatform.getExpires()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public ParentPlatformCatch queryPlatformCatchInfo(String platformGbId) {
|
||||
return (ParentPlatformCatch)redis.get(VideoManagerConstants.PLATFORM_CATCH_PREFIX + userSetting.getServerId() + "_" + platformGbId);
|
||||
return (ParentPlatformCatch)RedisUtil.get(VideoManagerConstants.PLATFORM_CATCH_PREFIX + userSetting.getServerId() + "_" + platformGbId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void delPlatformCatchInfo(String platformGbId) {
|
||||
redis.del(VideoManagerConstants.PLATFORM_CATCH_PREFIX + userSetting.getServerId() + "_" + platformGbId);
|
||||
RedisUtil.del(VideoManagerConstants.PLATFORM_CATCH_PREFIX + userSetting.getServerId() + "_" + platformGbId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void delPlatformKeepalive(String platformGbId) {
|
||||
redis.del(VideoManagerConstants.PLATFORM_KEEPALIVE_PREFIX + userSetting.getServerId() + "_" + platformGbId);
|
||||
RedisUtil.del(VideoManagerConstants.PLATFORM_KEEPALIVE_PREFIX + userSetting.getServerId() + "_" + platformGbId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void delPlatformRegister(String platformGbId) {
|
||||
redis.del(VideoManagerConstants.PLATFORM_REGISTER_PREFIX + userSetting.getServerId() + "_" + platformGbId);
|
||||
RedisUtil.del(VideoManagerConstants.PLATFORM_REGISTER_PREFIX + userSetting.getServerId() + "_" + platformGbId);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void updatePlatformRegisterInfo(String callId, String platformGbId) {
|
||||
String key = VideoManagerConstants.PLATFORM_REGISTER_INFO_PREFIX + userSetting.getServerId() + "_" + callId;
|
||||
redis.set(key, platformGbId, 30);
|
||||
RedisUtil.set(key, platformGbId, 30);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String queryPlatformRegisterInfo(String callId) {
|
||||
return (String)redis.get(VideoManagerConstants.PLATFORM_REGISTER_INFO_PREFIX + userSetting.getServerId() + "_" + callId);
|
||||
return (String)RedisUtil.get(VideoManagerConstants.PLATFORM_REGISTER_INFO_PREFIX + userSetting.getServerId() + "_" + callId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void delPlatformRegisterInfo(String callId) {
|
||||
redis.del(VideoManagerConstants.PLATFORM_REGISTER_INFO_PREFIX + userSetting.getServerId() + "_" + callId);
|
||||
RedisUtil.del(VideoManagerConstants.PLATFORM_REGISTER_INFO_PREFIX + userSetting.getServerId() + "_" + callId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cleanPlatformRegisterInfos() {
|
||||
List regInfos = redis.scan(VideoManagerConstants.PLATFORM_REGISTER_INFO_PREFIX + userSetting.getServerId() + "_" + "*");
|
||||
List regInfos = RedisUtil.scan(VideoManagerConstants.PLATFORM_REGISTER_INFO_PREFIX + userSetting.getServerId() + "_" + "*");
|
||||
for (Object key : regInfos) {
|
||||
redis.del(key.toString());
|
||||
RedisUtil.del(key.toString());
|
||||
}
|
||||
}
|
||||
|
||||
@ -356,7 +352,7 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage {
|
||||
String key = VideoManagerConstants.PLATFORM_SEND_RTP_INFO_PREFIX + userSetting.getServerId() + "_"
|
||||
+ sendRtpItem.getPlatformId() + "_" + sendRtpItem.getChannelId() + "_"
|
||||
+ sendRtpItem.getStreamId() + "_" + sendRtpItem.getCallId();
|
||||
redis.set(key, sendRtpItem);
|
||||
RedisUtil.set(key, sendRtpItem);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -375,9 +371,9 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage {
|
||||
}
|
||||
String key = VideoManagerConstants.PLATFORM_SEND_RTP_INFO_PREFIX + userSetting.getServerId() + "_" + platformGbId
|
||||
+ "_" + channelId + "_" + streamId + "_" + callId;
|
||||
List<Object> scan = redis.scan(key);
|
||||
List<Object> scan = RedisUtil.scan(key);
|
||||
if (scan.size() > 0) {
|
||||
return (SendRtpItem)redis.get((String)scan.get(0));
|
||||
return (SendRtpItem)RedisUtil.get((String)scan.get(0));
|
||||
}else {
|
||||
return null;
|
||||
}
|
||||
@ -389,12 +385,12 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage {
|
||||
platformGbId = "*";
|
||||
}
|
||||
String key = VideoManagerConstants.PLATFORM_SEND_RTP_INFO_PREFIX + userSetting.getServerId() + "_" + platformGbId + "_*" + "_*" + "_*";
|
||||
List<Object> queryResult = redis.scan(key);
|
||||
List<Object> queryResult = RedisUtil.scan(key);
|
||||
List<SendRtpItem> result= new ArrayList<>();
|
||||
|
||||
for (Object o : queryResult) {
|
||||
String keyItem = (String) o;
|
||||
result.add((SendRtpItem) redis.get(keyItem));
|
||||
result.add((SendRtpItem) RedisUtil.get(keyItem));
|
||||
}
|
||||
|
||||
return result;
|
||||
@ -415,10 +411,10 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage {
|
||||
}
|
||||
String key = VideoManagerConstants.PLATFORM_SEND_RTP_INFO_PREFIX + userSetting.getServerId() + "_" + platformGbId
|
||||
+ "_" + channelId + "_" + streamId + "_" + callId;
|
||||
List<Object> scan = redis.scan(key);
|
||||
List<Object> scan = RedisUtil.scan(key);
|
||||
if (scan.size() > 0) {
|
||||
for (Object keyStr : scan) {
|
||||
redis.del((String)keyStr);
|
||||
RedisUtil.del((String)keyStr);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -432,7 +428,7 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage {
|
||||
@Override
|
||||
public boolean isChannelSendingRTP(String channelId) {
|
||||
String key = VideoManagerConstants.PLATFORM_SEND_RTP_INFO_PREFIX + userSetting.getServerId() + "_" + "*_" + channelId + "*_" + "*_";
|
||||
List<Object> RtpStreams = redis.scan(key);
|
||||
List<Object> RtpStreams = RedisUtil.scan(key);
|
||||
if (RtpStreams.size() > 0) {
|
||||
return true;
|
||||
} else {
|
||||
@ -442,30 +438,30 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage {
|
||||
|
||||
@Override
|
||||
public void clearCatchByDeviceId(String deviceId) {
|
||||
List<Object> playLeys = redis.scan(String.format("%S_%s_*_%s_*", VideoManagerConstants.PLAYER_PREFIX,
|
||||
List<Object> playLeys = RedisUtil.scan(String.format("%S_%s_*_%s_*", VideoManagerConstants.PLAYER_PREFIX,
|
||||
userSetting.getServerId(),
|
||||
deviceId));
|
||||
if (playLeys.size() > 0) {
|
||||
for (Object key : playLeys) {
|
||||
redis.del(key.toString());
|
||||
RedisUtil.del(key.toString());
|
||||
}
|
||||
}
|
||||
|
||||
List<Object> playBackers = redis.scan(String.format("%S_%s_%s_*_*_*", VideoManagerConstants.PLAY_BLACK_PREFIX,
|
||||
List<Object> playBackers = RedisUtil.scan(String.format("%S_%s_%s_*_*_*", VideoManagerConstants.PLAY_BLACK_PREFIX,
|
||||
userSetting.getServerId(),
|
||||
deviceId));
|
||||
if (playBackers.size() > 0) {
|
||||
for (Object key : playBackers) {
|
||||
redis.del(key.toString());
|
||||
RedisUtil.del(key.toString());
|
||||
}
|
||||
}
|
||||
|
||||
List<Object> deviceCache = redis.scan(String.format("%S%s_%s", VideoManagerConstants.DEVICE_PREFIX,
|
||||
List<Object> deviceCache = RedisUtil.scan(String.format("%S%s_%s", VideoManagerConstants.DEVICE_PREFIX,
|
||||
userSetting.getServerId(),
|
||||
deviceId));
|
||||
if (deviceCache.size() > 0) {
|
||||
for (Object key : deviceCache) {
|
||||
redis.del(key.toString());
|
||||
RedisUtil.del(key.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -473,14 +469,14 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage {
|
||||
@Override
|
||||
public void updateWVPInfo(JSONObject jsonObject, int time) {
|
||||
String key = VideoManagerConstants.WVP_SERVER_PREFIX + userSetting.getServerId();
|
||||
redis.set(key, jsonObject, time);
|
||||
RedisUtil.set(key, jsonObject, time);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendStreamChangeMsg(String type, JSONObject jsonObject) {
|
||||
String key = VideoManagerConstants.WVP_MSG_STREAM_CHANGE_PREFIX + type;
|
||||
logger.info("[redis 流变化事件] {}: {}", key, jsonObject.toString());
|
||||
redis.convertAndSend(key, jsonObject);
|
||||
RedisUtil.convertAndSend(key, jsonObject);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -491,13 +487,13 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage {
|
||||
if (streamAuthorityInfo != null) {
|
||||
mediaItem.setCallId(streamAuthorityInfo.getCallId());
|
||||
}
|
||||
redis.set(key, mediaItem);
|
||||
RedisUtil.set(key, mediaItem);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeStream(String mediaServerId, String type, String app, String streamId) {
|
||||
String key = VideoManagerConstants.WVP_SERVER_STREAM_PREFIX + userSetting.getServerId() + "_" + type + "_" + app + "_" + streamId + "_" + mediaServerId;
|
||||
redis.del(key);
|
||||
RedisUtil.del(key);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -524,9 +520,9 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage {
|
||||
stream,
|
||||
callId
|
||||
);
|
||||
List<Object> streamInfoScan = redis.scan(key);
|
||||
List<Object> streamInfoScan = RedisUtil.scan(key);
|
||||
if (streamInfoScan.size() > 0) {
|
||||
return (StreamInfo) redis.get((String) streamInfoScan.get(0));
|
||||
return (StreamInfo) RedisUtil.get((String) streamInfoScan.get(0));
|
||||
}else {
|
||||
return null;
|
||||
}
|
||||
@ -535,16 +531,16 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage {
|
||||
@Override
|
||||
public ThirdPartyGB queryMemberNoGBId(String queryKey) {
|
||||
String key = VideoManagerConstants.WVP_STREAM_GB_ID_PREFIX + queryKey;
|
||||
JSONObject jsonObject = (JSONObject)redis.get(key);
|
||||
JSONObject jsonObject = (JSONObject)RedisUtil.get(key);
|
||||
return JSONObject.toJavaObject(jsonObject, ThirdPartyGB.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeStream(String mediaServerId, String type) {
|
||||
String key = VideoManagerConstants.WVP_SERVER_STREAM_PREFIX + userSetting.getServerId() + "_" + type + "_*_*_" + mediaServerId;
|
||||
List<Object> streams = redis.scan(key);
|
||||
List<Object> streams = RedisUtil.scan(key);
|
||||
for (Object stream : streams) {
|
||||
redis.del((String) stream);
|
||||
RedisUtil.del((String) stream);
|
||||
}
|
||||
}
|
||||
|
||||
@ -552,9 +548,9 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage {
|
||||
public List<MediaItem> getStreams(String mediaServerId, String type) {
|
||||
List<MediaItem> result = new ArrayList<>();
|
||||
String key = VideoManagerConstants.WVP_SERVER_STREAM_PREFIX + userSetting.getServerId() + "_" + type + "_*_*_" + mediaServerId;
|
||||
List<Object> streams = redis.scan(key);
|
||||
List<Object> streams = RedisUtil.scan(key);
|
||||
for (Object stream : streams) {
|
||||
MediaItem mediaItem = (MediaItem)redis.get((String) stream);
|
||||
MediaItem mediaItem = (MediaItem)RedisUtil.get((String) stream);
|
||||
result.add(mediaItem);
|
||||
}
|
||||
return result;
|
||||
@ -563,43 +559,43 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage {
|
||||
@Override
|
||||
public void updateDevice(Device device) {
|
||||
String key = VideoManagerConstants.DEVICE_PREFIX + userSetting.getServerId() + "_" + device.getDeviceId();
|
||||
redis.set(key, device);
|
||||
RedisUtil.set(key, device);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeDevice(String deviceId) {
|
||||
String key = VideoManagerConstants.DEVICE_PREFIX + userSetting.getServerId() + "_" + deviceId;
|
||||
redis.del(key);
|
||||
RedisUtil.del(key);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Device getDevice(String deviceId) {
|
||||
String key = VideoManagerConstants.DEVICE_PREFIX + userSetting.getServerId() + "_" + deviceId;
|
||||
return (Device)redis.get(key);
|
||||
return (Device)RedisUtil.get(key);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateGpsMsgInfo(GPSMsgInfo gpsMsgInfo) {
|
||||
String key = VideoManagerConstants.WVP_STREAM_GPS_MSG_PREFIX + userSetting.getServerId() + "_" + gpsMsgInfo.getId();
|
||||
redis.set(key, gpsMsgInfo, 60); // 默认GPS消息保存1分钟
|
||||
RedisUtil.set(key, gpsMsgInfo, 60); // 默认GPS消息保存1分钟
|
||||
}
|
||||
|
||||
@Override
|
||||
public GPSMsgInfo getGpsMsgInfo(String gbId) {
|
||||
String key = VideoManagerConstants.WVP_STREAM_GPS_MSG_PREFIX + userSetting.getServerId() + "_" + gbId;
|
||||
return (GPSMsgInfo)redis.get(key);
|
||||
return (GPSMsgInfo)RedisUtil.get(key);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<GPSMsgInfo> getAllGpsMsgInfo() {
|
||||
String scanKey = VideoManagerConstants.WVP_STREAM_GPS_MSG_PREFIX + userSetting.getServerId() + "_*";
|
||||
List<GPSMsgInfo> result = new ArrayList<>();
|
||||
List<Object> keys = redis.scan(scanKey);
|
||||
List<Object> keys = RedisUtil.scan(scanKey);
|
||||
for (Object o : keys) {
|
||||
String key = (String) o;
|
||||
GPSMsgInfo gpsMsgInfo = (GPSMsgInfo) redis.get(key);
|
||||
GPSMsgInfo gpsMsgInfo = (GPSMsgInfo) RedisUtil.get(key);
|
||||
if (!gpsMsgInfo.isStored()) { // 只取没有存过得
|
||||
result.add((GPSMsgInfo) redis.get(key));
|
||||
result.add((GPSMsgInfo) RedisUtil.get(key));
|
||||
}
|
||||
}
|
||||
|
||||
@ -609,19 +605,19 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage {
|
||||
@Override
|
||||
public void updateStreamAuthorityInfo(String app, String stream, StreamAuthorityInfo streamAuthorityInfo) {
|
||||
String key = VideoManagerConstants.MEDIA_STREAM_AUTHORITY + userSetting.getServerId() + "_" + app+ "_" + stream;
|
||||
redis.set(key, streamAuthorityInfo);
|
||||
RedisUtil.set(key, streamAuthorityInfo);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeStreamAuthorityInfo(String app, String stream) {
|
||||
String key = VideoManagerConstants.MEDIA_STREAM_AUTHORITY + userSetting.getServerId() + "_" + app+ "_" + stream ;
|
||||
redis.del(key);
|
||||
RedisUtil.del(key);
|
||||
}
|
||||
|
||||
@Override
|
||||
public StreamAuthorityInfo getStreamAuthorityInfo(String app, String stream) {
|
||||
String key = VideoManagerConstants.MEDIA_STREAM_AUTHORITY + userSetting.getServerId() + "_" + app+ "_" + stream ;
|
||||
return (StreamAuthorityInfo) redis.get(key);
|
||||
return (StreamAuthorityInfo) RedisUtil.get(key);
|
||||
|
||||
}
|
||||
|
||||
@ -631,10 +627,10 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage {
|
||||
String scanKey = VideoManagerConstants.WVP_SERVER_STREAM_PREFIX + userSetting.getServerId() + "_*_" + app + "_" + streamId + "_" + mediaServerId;
|
||||
|
||||
MediaItem result = null;
|
||||
List<Object> keys = redis.scan(scanKey);
|
||||
List<Object> keys = RedisUtil.scan(scanKey);
|
||||
if (keys.size() > 0) {
|
||||
String key = (String) keys.get(0);
|
||||
result = (MediaItem)redis.get(key);
|
||||
result = (MediaItem)RedisUtil.get(key);
|
||||
}
|
||||
|
||||
return result;
|
||||
@ -646,11 +642,11 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage {
|
||||
SystemInfoDto<Double> systemInfoDto = new SystemInfoDto<>();
|
||||
systemInfoDto.setTime(DateUtil.getNow());
|
||||
systemInfoDto.setData(cpuInfo);
|
||||
redis.lSet(key, systemInfoDto);
|
||||
RedisUtil.lSet(key, systemInfoDto);
|
||||
// 每秒一个,最多只存30个
|
||||
if (redis.lGetListSize(key) > 30) {
|
||||
for (int i = 0; i < redis.lGetListSize(key) - 30; i++) {
|
||||
redis.lLeftPop(key);
|
||||
if (RedisUtil.lGetListSize(key) > 30) {
|
||||
for (int i = 0; i < RedisUtil.lGetListSize(key) - 30; i++) {
|
||||
RedisUtil.lLeftPop(key);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -661,11 +657,11 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage {
|
||||
SystemInfoDto<Double> systemInfoDto = new SystemInfoDto<>();
|
||||
systemInfoDto.setTime(DateUtil.getNow());
|
||||
systemInfoDto.setData(memInfo);
|
||||
redis.lSet(key, systemInfoDto);
|
||||
RedisUtil.lSet(key, systemInfoDto);
|
||||
// 每秒一个,最多只存30个
|
||||
if (redis.lGetListSize(key) > 30) {
|
||||
for (int i = 0; i < redis.lGetListSize(key) - 30; i++) {
|
||||
redis.lLeftPop(key);
|
||||
if (RedisUtil.lGetListSize(key) > 30) {
|
||||
for (int i = 0; i < RedisUtil.lGetListSize(key) - 30; i++) {
|
||||
RedisUtil.lLeftPop(key);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -676,11 +672,11 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage {
|
||||
SystemInfoDto<Map<String, String>> systemInfoDto = new SystemInfoDto<>();
|
||||
systemInfoDto.setTime(DateUtil.getNow());
|
||||
systemInfoDto.setData(networkInterfaces);
|
||||
redis.lSet(key, systemInfoDto);
|
||||
RedisUtil.lSet(key, systemInfoDto);
|
||||
// 每秒一个,最多只存30个
|
||||
if (redis.lGetListSize(key) > 30) {
|
||||
for (int i = 0; i < redis.lGetListSize(key) - 30; i++) {
|
||||
redis.lLeftPop(key);
|
||||
if (RedisUtil.lGetListSize(key) > 30) {
|
||||
for (int i = 0; i < RedisUtil.lGetListSize(key) - 30; i++) {
|
||||
RedisUtil.lLeftPop(key);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -689,21 +685,21 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage {
|
||||
public void sendMobilePositionMsg(JSONObject jsonObject) {
|
||||
String key = VideoManagerConstants.VM_MSG_SUBSCRIBE_MOBILE_POSITION;
|
||||
logger.info("[redis发送通知]移动位置 {}: {}", key, jsonObject.toString());
|
||||
redis.convertAndSend(key, jsonObject);
|
||||
RedisUtil.convertAndSend(key, jsonObject);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendStreamPushRequestedMsg(MessageForPushChannel msg) {
|
||||
String key = VideoManagerConstants.VM_MSG_STREAM_PUSH_REQUESTED;
|
||||
logger.info("[redis发送通知]推流被请求 {}: {}/{}", key, msg.getApp(), msg.getStream());
|
||||
redis.convertAndSend(key, (JSONObject)JSON.toJSON(msg));
|
||||
RedisUtil.convertAndSend(key, (JSONObject)JSON.toJSON(msg));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendAlarmMsg(AlarmChannelMessage msg) {
|
||||
String key = VideoManagerConstants.VM_MSG_SUBSCRIBE_ALARM;
|
||||
logger.info("[redis发送通知] 报警{}: {}", key, JSON.toJSON(msg));
|
||||
redis.convertAndSend(key, (JSONObject)JSON.toJSON(msg));
|
||||
RedisUtil.convertAndSend(key, (JSONObject)JSON.toJSON(msg));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -718,6 +714,6 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage {
|
||||
logger.info("[redis通知]获取所有推流设备的状态");
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put(key, key);
|
||||
redis.convertAndSend(key, jsonObject);
|
||||
RedisUtil.convertAndSend(key, jsonObject);
|
||||
}
|
||||
}
|
||||
|
@ -4,6 +4,7 @@ import java.util.*;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.genersoft.iot.vmp.utils.SpringBeanFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.redis.core.*;
|
||||
import org.springframework.stereotype.Component;
|
||||
@ -14,12 +15,14 @@ import org.springframework.util.CollectionUtils;
|
||||
* @author: swwheihei
|
||||
* @date: 2020年5月6日 下午8:27:29
|
||||
*/
|
||||
@Component
|
||||
@SuppressWarnings(value = {"rawtypes", "unchecked"})
|
||||
public class RedisUtil {
|
||||
|
||||
@Autowired
|
||||
private RedisTemplate redisTemplate;
|
||||
private static RedisTemplate redisTemplate;
|
||||
|
||||
static {
|
||||
redisTemplate = (RedisTemplate)SpringBeanFactory.getBean("redisTemplate");
|
||||
}
|
||||
|
||||
/**
|
||||
* 指定缓存失效时间
|
||||
@ -27,7 +30,7 @@ public class RedisUtil {
|
||||
* @param time 时间(秒)
|
||||
* @return true / false
|
||||
*/
|
||||
public boolean expire(String key, long time) {
|
||||
public static boolean expire(String key, long time) {
|
||||
try {
|
||||
if (time > 0) {
|
||||
redisTemplate.expire(key, time, TimeUnit.SECONDS);
|
||||
@ -44,7 +47,7 @@ public class RedisUtil {
|
||||
* @param key 键
|
||||
* @return
|
||||
*/
|
||||
public long getExpire(String key) {
|
||||
public static long getExpire(String key) {
|
||||
return redisTemplate.getExpire(key, TimeUnit.SECONDS);
|
||||
}
|
||||
|
||||
@ -53,7 +56,7 @@ public class RedisUtil {
|
||||
* @param key 键
|
||||
* @return true / false
|
||||
*/
|
||||
public boolean hasKey(String key) {
|
||||
public static boolean hasKey(String key) {
|
||||
try {
|
||||
return redisTemplate.hasKey(key);
|
||||
} catch (Exception e) {
|
||||
@ -67,7 +70,7 @@ public class RedisUtil {
|
||||
* @SuppressWarnings("unchecked") 忽略类型转换警告
|
||||
* @param key 键(一个或者多个)
|
||||
*/
|
||||
public boolean del(String... key) {
|
||||
public static boolean del(String... key) {
|
||||
try {
|
||||
if (key != null && key.length > 0) {
|
||||
if (key.length == 1) {
|
||||
@ -91,7 +94,7 @@ public class RedisUtil {
|
||||
* @param key 键
|
||||
* @return 值
|
||||
*/
|
||||
public Object get(String key) {
|
||||
public static Object get(String key) {
|
||||
return key == null ? null : redisTemplate.opsForValue().get(key);
|
||||
}
|
||||
|
||||
@ -101,7 +104,7 @@ public class RedisUtil {
|
||||
* @param value 值
|
||||
* @return true / false
|
||||
*/
|
||||
public boolean set(String key, Object value) {
|
||||
public static boolean set(String key, Object value) {
|
||||
try {
|
||||
redisTemplate.opsForValue().set(key, value);
|
||||
return true;
|
||||
@ -118,7 +121,7 @@ public class RedisUtil {
|
||||
* @param time 时间(秒),如果 time < 0 则设置无限时间
|
||||
* @return true / false
|
||||
*/
|
||||
public boolean set(String key, Object value, long time) {
|
||||
public static boolean set(String key, Object value, long time) {
|
||||
try {
|
||||
if (time > 0) {
|
||||
redisTemplate.opsForValue().set(key, value, time, TimeUnit.SECONDS);
|
||||
@ -138,7 +141,7 @@ public class RedisUtil {
|
||||
* @param delta 递增大小
|
||||
* @return
|
||||
*/
|
||||
public long incr(String key, long delta) {
|
||||
public static long incr(String key, long delta) {
|
||||
if (delta < 0) {
|
||||
throw new RuntimeException("递增因子必须大于 0");
|
||||
}
|
||||
@ -151,7 +154,7 @@ public class RedisUtil {
|
||||
* @param delta 递减大小
|
||||
* @return
|
||||
*/
|
||||
public long decr(String key, long delta) {
|
||||
public static long decr(String key, long delta) {
|
||||
if (delta < 0) {
|
||||
throw new RuntimeException("递减因子必须大于 0");
|
||||
}
|
||||
@ -166,7 +169,7 @@ public class RedisUtil {
|
||||
* @param item 项(no null)
|
||||
* @return 值
|
||||
*/
|
||||
public Object hget(String key, String item) {
|
||||
public static Object hget(String key, String item) {
|
||||
return redisTemplate.opsForHash().get(key, item);
|
||||
}
|
||||
|
||||
@ -175,7 +178,7 @@ public class RedisUtil {
|
||||
* @param key 键(no null)
|
||||
* @return 对应的多个键值
|
||||
*/
|
||||
public Map<Object, Object> hmget(String key) {
|
||||
public static Map<Object, Object> hmget(String key) {
|
||||
return redisTemplate.opsForHash().entries(key);
|
||||
}
|
||||
|
||||
@ -185,7 +188,7 @@ public class RedisUtil {
|
||||
* @param map 值
|
||||
* @return true / false
|
||||
*/
|
||||
public boolean hmset(String key, Map<Object, Object> map) {
|
||||
public static boolean hmset(String key, Map<Object, Object> map) {
|
||||
try {
|
||||
redisTemplate.opsForHash().putAll(key, map);
|
||||
return true;
|
||||
@ -202,7 +205,7 @@ public class RedisUtil {
|
||||
* @param time 时间
|
||||
* @return true / false
|
||||
*/
|
||||
public boolean hmset(String key, Map<Object, Object> map, long time) {
|
||||
public static boolean hmset(String key, Map<Object, Object> map, long time) {
|
||||
try {
|
||||
redisTemplate.opsForHash().putAll(key, map);
|
||||
if (time > 0) {
|
||||
@ -222,7 +225,7 @@ public class RedisUtil {
|
||||
* @param value 值
|
||||
* @return true / false
|
||||
*/
|
||||
public boolean hset(String key, String item, Object value) {
|
||||
public static boolean hset(String key, String item, Object value) {
|
||||
try {
|
||||
redisTemplate.opsForHash().put(key, item, value);
|
||||
return true;
|
||||
@ -240,7 +243,7 @@ public class RedisUtil {
|
||||
* @param time 时间(如果原来的 Hash表 设置了时间,这里会覆盖)
|
||||
* @return true / false
|
||||
*/
|
||||
public boolean hset(String key, String item, Object value, long time) {
|
||||
public static boolean hset(String key, String item, Object value, long time) {
|
||||
try {
|
||||
redisTemplate.opsForHash().put(key, item, value);
|
||||
if (time > 0) {
|
||||
@ -258,7 +261,7 @@ public class RedisUtil {
|
||||
* @param key 键
|
||||
* @param item 项(可以多个,no null)
|
||||
*/
|
||||
public void hdel(String key, Object... item) {
|
||||
public static void hdel(String key, Object... item) {
|
||||
redisTemplate.opsForHash().delete(key, item);
|
||||
}
|
||||
|
||||
@ -268,7 +271,7 @@ public class RedisUtil {
|
||||
* @param item 值(no null)
|
||||
* @return true / false
|
||||
*/
|
||||
public boolean hHasKey(String key, String item) {
|
||||
public static boolean hHasKey(String key, String item) {
|
||||
return redisTemplate.opsForHash().hasKey(key, item);
|
||||
}
|
||||
|
||||
@ -279,7 +282,7 @@ public class RedisUtil {
|
||||
* @param by 递增大小 > 0
|
||||
* @return
|
||||
*/
|
||||
public Double hincr(String key, String item, Double by) {
|
||||
public static Double hincr(String key, String item, Double by) {
|
||||
return redisTemplate.opsForHash().increment(key, item, by);
|
||||
}
|
||||
|
||||
@ -290,7 +293,7 @@ public class RedisUtil {
|
||||
* @param by 递减大小
|
||||
* @return
|
||||
*/
|
||||
public Double hdecr(String key, String item, Double by) {
|
||||
public static Double hdecr(String key, String item, Double by) {
|
||||
return redisTemplate.opsForHash().increment(key, item, -by);
|
||||
}
|
||||
|
||||
@ -301,7 +304,7 @@ public class RedisUtil {
|
||||
* @param key 键
|
||||
* @return 值
|
||||
*/
|
||||
public Set<Object> sGet(String key) {
|
||||
public static Set<Object> sGet(String key) {
|
||||
try {
|
||||
return redisTemplate.opsForSet().members(key);
|
||||
} catch (Exception e) {
|
||||
@ -316,7 +319,7 @@ public class RedisUtil {
|
||||
* @param value 值
|
||||
* @return true / false
|
||||
*/
|
||||
public boolean sHasKey(String key, Object value) {
|
||||
public static boolean sHasKey(String key, Object value) {
|
||||
try {
|
||||
return redisTemplate.opsForSet().isMember(key, value);
|
||||
} catch (Exception e) {
|
||||
@ -331,7 +334,7 @@ public class RedisUtil {
|
||||
* @param values 值(可以多个)
|
||||
* @return 成功个数
|
||||
*/
|
||||
public long sSet(String key, Object... values) {
|
||||
public static long sSet(String key, Object... values) {
|
||||
try {
|
||||
return redisTemplate.opsForSet().add(key, values);
|
||||
} catch (Exception e) {
|
||||
@ -347,7 +350,7 @@ public class RedisUtil {
|
||||
* @param values 值(可以多个)
|
||||
* @return 成功放入个数
|
||||
*/
|
||||
public long sSet(String key, long time, Object... values) {
|
||||
public static long sSet(String key, long time, Object... values) {
|
||||
try {
|
||||
long count = redisTemplate.opsForSet().add(key, values);
|
||||
if (time > 0) {
|
||||
@ -365,7 +368,7 @@ public class RedisUtil {
|
||||
* @param key 键
|
||||
* @return 长度
|
||||
*/
|
||||
public long sGetSetSize(String key) {
|
||||
public static long sGetSetSize(String key) {
|
||||
try {
|
||||
return redisTemplate.opsForSet().size(key);
|
||||
} catch (Exception e) {
|
||||
@ -380,7 +383,7 @@ public class RedisUtil {
|
||||
* @param values 值
|
||||
* @return 成功移除个数
|
||||
*/
|
||||
public long setRemove(String key, Object... values) {
|
||||
public static long setRemove(String key, Object... values) {
|
||||
try {
|
||||
return redisTemplate.opsForSet().remove(key, values);
|
||||
} catch (Exception e) {
|
||||
@ -397,7 +400,7 @@ public class RedisUtil {
|
||||
* @param value
|
||||
* @param score
|
||||
*/
|
||||
public void zAdd(Object key, Object value, double score) {
|
||||
public static void zAdd(Object key, Object value, double score) {
|
||||
redisTemplate.opsForZSet().add(key, value, score);
|
||||
}
|
||||
|
||||
@ -407,7 +410,7 @@ public class RedisUtil {
|
||||
* @param key
|
||||
* @param value
|
||||
*/
|
||||
public void zRemove(Object key, Object value) {
|
||||
public static void zRemove(Object key, Object value) {
|
||||
redisTemplate.opsForZSet().remove(key, value);
|
||||
}
|
||||
|
||||
@ -418,7 +421,7 @@ public class RedisUtil {
|
||||
* @param value
|
||||
* @param delta -1 表示减 1 表示加1
|
||||
*/
|
||||
public Double zIncrScore(Object key, Object value, double delta) {
|
||||
public static Double zIncrScore(Object key, Object value, double delta) {
|
||||
return redisTemplate.opsForZSet().incrementScore(key, value, delta);
|
||||
}
|
||||
|
||||
@ -429,7 +432,7 @@ public class RedisUtil {
|
||||
* @param value
|
||||
* @return
|
||||
*/
|
||||
public Double zScore(Object key, Object value) {
|
||||
public static Double zScore(Object key, Object value) {
|
||||
return redisTemplate.opsForZSet().score(key, value);
|
||||
}
|
||||
|
||||
@ -440,7 +443,7 @@ public class RedisUtil {
|
||||
* @param value
|
||||
* @return
|
||||
*/
|
||||
public Long zRank(Object key, Object value) {
|
||||
public static Long zRank(Object key, Object value) {
|
||||
return redisTemplate.opsForZSet().rank(key, value);
|
||||
}
|
||||
|
||||
@ -450,7 +453,7 @@ public class RedisUtil {
|
||||
* @param key
|
||||
* @return
|
||||
*/
|
||||
public Long zSize(Object key) {
|
||||
public static Long zSize(Object key) {
|
||||
return redisTemplate.opsForZSet().zCard(key);
|
||||
}
|
||||
|
||||
@ -464,7 +467,7 @@ public class RedisUtil {
|
||||
* @param end
|
||||
* @return
|
||||
*/
|
||||
public Set<Object> ZRange(Object key, int start, int end) {
|
||||
public static Set<Object> ZRange(Object key, int start, int end) {
|
||||
return redisTemplate.opsForZSet().range(key, start, end);
|
||||
}
|
||||
/**
|
||||
@ -475,7 +478,7 @@ public class RedisUtil {
|
||||
* @param end
|
||||
* @return
|
||||
*/
|
||||
public Set<ZSetOperations.TypedTuple<String>> zRangeWithScore(Object key, int start, int end) {
|
||||
public static Set<ZSetOperations.TypedTuple<String>> zRangeWithScore(Object key, int start, int end) {
|
||||
return redisTemplate.opsForZSet().rangeWithScores(key, start, end);
|
||||
}
|
||||
/**
|
||||
@ -488,7 +491,7 @@ public class RedisUtil {
|
||||
* @param end
|
||||
* @return
|
||||
*/
|
||||
public Set<String> zRevRange(Object key, int start, int end) {
|
||||
public static Set<String> zRevRange(Object key, int start, int end) {
|
||||
return redisTemplate.opsForZSet().reverseRange(key, start, end);
|
||||
}
|
||||
/**
|
||||
@ -499,7 +502,7 @@ public class RedisUtil {
|
||||
* @param max
|
||||
* @return
|
||||
*/
|
||||
public Set<String> zSortRange(Object key, int min, int max) {
|
||||
public static Set<String> zSortRange(Object key, int min, int max) {
|
||||
return redisTemplate.opsForZSet().rangeByScore(key, min, max);
|
||||
}
|
||||
|
||||
@ -513,7 +516,7 @@ public class RedisUtil {
|
||||
* @param end 结束(0 到 -1 代表所有值)
|
||||
* @return
|
||||
*/
|
||||
public List<Object> lGet(String key, long start, long end) {
|
||||
public static List<Object> lGet(String key, long start, long end) {
|
||||
try {
|
||||
return redisTemplate.opsForList().range(key, start, end);
|
||||
} catch (Exception e) {
|
||||
@ -527,7 +530,7 @@ public class RedisUtil {
|
||||
* @param key 键
|
||||
* @return 长度
|
||||
*/
|
||||
public long lGetListSize(String key) {
|
||||
public static long lGetListSize(String key) {
|
||||
try {
|
||||
return redisTemplate.opsForList().size(key);
|
||||
} catch (Exception e) {
|
||||
@ -544,7 +547,7 @@ public class RedisUtil {
|
||||
* 当 index < 0 时 {-1:表尾, -2:倒数第二个元素}
|
||||
* @return 值
|
||||
*/
|
||||
public Object lGetIndex(String key, long index) {
|
||||
public static Object lGetIndex(String key, long index) {
|
||||
try {
|
||||
return redisTemplate.opsForList().index(key, index);
|
||||
} catch (Exception e) {
|
||||
@ -559,7 +562,7 @@ public class RedisUtil {
|
||||
* @param value 值
|
||||
* @return true / false
|
||||
*/
|
||||
public boolean lSet(String key, Object value) {
|
||||
public static boolean lSet(String key, Object value) {
|
||||
try {
|
||||
redisTemplate.opsForList().rightPush(key, value);
|
||||
return true;
|
||||
@ -576,7 +579,7 @@ public class RedisUtil {
|
||||
* @param time 时间
|
||||
* @return true / false
|
||||
*/
|
||||
public boolean lSet(String key, Object value, long time) {
|
||||
public static boolean lSet(String key, Object value, long time) {
|
||||
try {
|
||||
redisTemplate.opsForList().rightPush(key, value);
|
||||
if (time > 0) {
|
||||
@ -595,7 +598,7 @@ public class RedisUtil {
|
||||
* @param values 值
|
||||
* @return true / false
|
||||
*/
|
||||
public boolean lSetList(String key, List<Object> values) {
|
||||
public static boolean lSetList(String key, List<Object> values) {
|
||||
try {
|
||||
redisTemplate.opsForList().rightPushAll(key, values);
|
||||
return true;
|
||||
@ -612,7 +615,7 @@ public class RedisUtil {
|
||||
* @param time 时间
|
||||
* @return true / false
|
||||
*/
|
||||
public boolean lSetList(String key, List<Object> values, long time) {
|
||||
public static boolean lSetList(String key, List<Object> values, long time) {
|
||||
try {
|
||||
redisTemplate.opsForList().rightPushAll(key, values);
|
||||
if (time > 0) {
|
||||
@ -632,7 +635,7 @@ public class RedisUtil {
|
||||
* @param value 值
|
||||
* @return true / false
|
||||
*/
|
||||
public boolean lUpdateIndex(String key, long index, Object value) {
|
||||
public static boolean lUpdateIndex(String key, long index, Object value) {
|
||||
try {
|
||||
redisTemplate.opsForList().set(key, index, value);
|
||||
return true;
|
||||
@ -651,7 +654,7 @@ public class RedisUtil {
|
||||
* @param value
|
||||
* @return
|
||||
*/
|
||||
public long lRemove(String key, long count, Object value) {
|
||||
public static long lRemove(String key, long count, Object value) {
|
||||
try {
|
||||
return redisTemplate.opsForList().remove(key, count, value);
|
||||
} catch (Exception e) {
|
||||
@ -665,7 +668,7 @@ public class RedisUtil {
|
||||
* @param key 键
|
||||
* @return
|
||||
*/
|
||||
public Object lLeftPop(String key) {
|
||||
public static Object lLeftPop(String key) {
|
||||
return redisTemplate.opsForList().leftPop(key);
|
||||
}
|
||||
|
||||
@ -674,7 +677,7 @@ public class RedisUtil {
|
||||
* @param key 键
|
||||
* @return
|
||||
*/
|
||||
public Object lrightPop(String key) {
|
||||
public static Object lrightPop(String key) {
|
||||
return redisTemplate.opsForList().rightPop(key);
|
||||
}
|
||||
|
||||
@ -683,7 +686,7 @@ public class RedisUtil {
|
||||
* @param key 键
|
||||
* @return true / false
|
||||
*/
|
||||
public List<Object> keys(String key) {
|
||||
public static List<Object> keys(String key) {
|
||||
try {
|
||||
Set<String> set = redisTemplate.keys(key);
|
||||
return new ArrayList<>(set);
|
||||
@ -699,7 +702,7 @@ public class RedisUtil {
|
||||
* @param query 查询参数
|
||||
* @return
|
||||
*/
|
||||
// public List<Object> scan(String query) {
|
||||
// public static List<Object> scan(String query) {
|
||||
// List<Object> result = new ArrayList<>();
|
||||
// try {
|
||||
// Cursor<Map.Entry<Object,Object>> cursor = redisTemplate.opsForHash().scan("field",
|
||||
@ -723,33 +726,23 @@ public class RedisUtil {
|
||||
* @param query 查询参数
|
||||
* @return
|
||||
*/
|
||||
public List<Object> scan(String query) {
|
||||
Set<String> keys = (Set<String>) redisTemplate.execute((RedisCallback<Set<String>>) connection -> {
|
||||
Set<String> keysTmp = new HashSet<>();
|
||||
Cursor<byte[]> cursor = connection.scan(new ScanOptions.ScanOptionsBuilder().match(query).count(1000).build());
|
||||
while (cursor.hasNext()) {
|
||||
keysTmp.add(new String(cursor.next()));
|
||||
public static List<Object> scan(String query) {
|
||||
Set<String> resultKeys = (Set<String>) redisTemplate.execute((RedisCallback<Set<String>>) connection -> {
|
||||
ScanOptions scanOptions = ScanOptions.scanOptions().match("*" + query + "*").count(1000).build();
|
||||
Cursor<byte[]> scan = connection.scan(scanOptions);
|
||||
Set<String> keys = new HashSet<>();
|
||||
while (scan.hasNext()) {
|
||||
byte[] next = scan.next();
|
||||
keys.add(new String(next));
|
||||
}
|
||||
return keysTmp;
|
||||
return keys;
|
||||
});
|
||||
// Set<String> keys = (Set<String>) redisTemplate.execute(new RedisCallback<Set<String>>(){
|
||||
//
|
||||
// @Override
|
||||
// public Set<String> doInRedis(RedisConnection connection) throws DataAccessException {
|
||||
// Set<String> keysTmp = new HashSet<>();
|
||||
// Cursor<byte[]> cursor = connection.scan(new ScanOptions.ScanOptionsBuilder().match(query).count(1000).build());
|
||||
// while (cursor.hasNext()) {
|
||||
// keysTmp.add(new String(cursor.next()));
|
||||
// }
|
||||
// return keysTmp;
|
||||
// }
|
||||
// });
|
||||
|
||||
return new ArrayList<>(keys);
|
||||
return new ArrayList<>(resultKeys);
|
||||
}
|
||||
|
||||
// ============================== 消息发送与订阅 ==============================
|
||||
public void convertAndSend(String channel, JSONObject msg) {
|
||||
public static void convertAndSend(String channel, JSONObject msg) {
|
||||
// redisTemplate.convertAndSend(channel, msg);
|
||||
redisTemplate.convertAndSend(channel, msg);
|
||||
|
||||
|
@ -1,10 +1,16 @@
|
||||
package com.genersoft.iot.vmp.vmanager.bean;
|
||||
|
||||
import com.genersoft.iot.vmp.gb28181.bean.GbStream;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author lin
|
||||
*/
|
||||
@Schema(description = "多个推流信息")
|
||||
public class BatchGBStreamParam {
|
||||
@Schema(description = "推流信息列表")
|
||||
private List<GbStream> gbStreams;
|
||||
|
||||
public List<GbStream> getGbStreams() {
|
||||
|
@ -1,6 +1,9 @@
|
||||
package com.genersoft.iot.vmp.vmanager.bean;
|
||||
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
@Schema(description = "统一返回结果")
|
||||
public class WVPResult<T> {
|
||||
|
||||
public WVPResult() {
|
||||
@ -13,8 +16,11 @@ public class WVPResult<T> {
|
||||
}
|
||||
|
||||
|
||||
@Schema(description = "错误码,0为成功")
|
||||
private int code;
|
||||
@Schema(description = "描述,错误时描述错误原因")
|
||||
private String msg;
|
||||
@Schema(description = "数据")
|
||||
private T data;
|
||||
|
||||
private static final Integer SUCCESS = 200;
|
||||
|
@ -13,10 +13,9 @@ import com.genersoft.iot.vmp.storager.IVideoManagerStorage;
|
||||
import com.genersoft.iot.vmp.vmanager.bean.WVPResult;
|
||||
import com.github.pagehelper.util.StringUtil;
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@ -33,7 +32,7 @@ import org.springframework.web.context.request.async.DeferredResult;
|
||||
/**
|
||||
* 位置信息管理
|
||||
*/
|
||||
@Api(tags = "位置信息管理")
|
||||
@Tag(name = "位置信息管理")
|
||||
@CrossOrigin
|
||||
@RestController
|
||||
@RequestMapping("/api/position")
|
||||
@ -60,21 +59,16 @@ public class MobilePositionController {
|
||||
* @param end 结束时间
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation("查询历史轨迹")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "deviceId", value = "设备ID", required = true, dataTypeClass = String.class),
|
||||
@ApiImplicitParam(name = "channelId", value = "通道ID", required = false, dataTypeClass = String.class),
|
||||
@ApiImplicitParam(name = "start", value = "开始时间", required = false, dataTypeClass = String.class),
|
||||
@ApiImplicitParam(name = "end", value = "结束时间", required = false, dataTypeClass = String.class),
|
||||
})
|
||||
@Operation(summary = "查询历史轨迹")
|
||||
@Parameter(name = "deviceId", description = "设备国标编号", required = true)
|
||||
@Parameter(name = "channelId", description = "通道国标编号")
|
||||
@Parameter(name = "start", description = "开始时间")
|
||||
@Parameter(name = "end", description = "结束时间")
|
||||
@GetMapping("/history/{deviceId}")
|
||||
public ResponseEntity<WVPResult<List<MobilePosition>>> positions(@PathVariable String deviceId,
|
||||
@RequestParam(required = false) String channelId,
|
||||
@RequestParam(required = false) String start,
|
||||
@RequestParam(required = false) String end) {
|
||||
// if (logger.isDebugEnabled()) {
|
||||
// logger.debug("查询设备" + deviceId + "的历史轨迹");
|
||||
// }
|
||||
|
||||
if (StringUtil.isEmpty(start)) {
|
||||
start = null;
|
||||
@ -94,15 +88,10 @@ public class MobilePositionController {
|
||||
* @param deviceId 设备ID
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation("查询设备最新位置")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "deviceId", value = "设备ID", required = true, dataTypeClass = String.class),
|
||||
})
|
||||
@Operation(summary = "查询设备最新位置")
|
||||
@Parameter(name = "deviceId", description = "设备国标编号", required = true)
|
||||
@GetMapping("/latest/{deviceId}")
|
||||
public ResponseEntity<MobilePosition> latestPosition(@PathVariable String deviceId) {
|
||||
// if (logger.isDebugEnabled()) {
|
||||
// logger.debug("查询设备" + deviceId + "的最新位置");
|
||||
// }
|
||||
MobilePosition result = storager.queryLatestPosition(deviceId);
|
||||
return new ResponseEntity<>(result, HttpStatus.OK);
|
||||
}
|
||||
@ -112,10 +101,8 @@ public class MobilePositionController {
|
||||
* @param deviceId 设备ID
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation("获取移动位置信息")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "deviceId", value = "设备ID", required = true, dataTypeClass = String.class),
|
||||
})
|
||||
@Operation(summary = "获取移动位置信息")
|
||||
@Parameter(name = "deviceId", description = "设备国标编号", required = true)
|
||||
@GetMapping("/realtime/{deviceId}")
|
||||
public DeferredResult<ResponseEntity<MobilePosition>> realTimePosition(@PathVariable String deviceId) {
|
||||
Device device = storager.queryVideoDevice(deviceId);
|
||||
@ -149,12 +136,10 @@ public class MobilePositionController {
|
||||
* @param interval 上报时间间隔
|
||||
* @return true = 命令发送成功
|
||||
*/
|
||||
@ApiOperation("订阅位置信息")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "deviceId", value = "设备ID", required = true, dataTypeClass = String.class),
|
||||
@ApiImplicitParam(name = "expires", value = "订阅超时时间", dataTypeClass = String.class),
|
||||
@ApiImplicitParam(name = "interval", value = "上报时间间隔", dataTypeClass = String.class),
|
||||
})
|
||||
@Operation(summary = "订阅位置信息")
|
||||
@Parameter(name = "deviceId", description = "设备国标编号", required = true)
|
||||
@Parameter(name = "expires", description = "订阅超时时间", required = true)
|
||||
@Parameter(name = "interval", description = "上报时间间隔", required = true)
|
||||
@GetMapping("/subscribe/{deviceId}")
|
||||
public ResponseEntity<String> positionSubscribe(@PathVariable String deviceId,
|
||||
@RequestParam String expires,
|
||||
|
@ -1,10 +1,8 @@
|
||||
package com.genersoft.iot.vmp.vmanager.gb28181.SseController;
|
||||
|
||||
import com.genersoft.iot.vmp.gb28181.event.alarm.AlarmEventListener;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.CrossOrigin;
|
||||
@ -18,7 +16,7 @@ import org.springframework.web.servlet.mvc.method.annotation.SseEmitter;
|
||||
* @author: lawrencehj
|
||||
* @data: 2021-01-20
|
||||
*/
|
||||
@Api(tags = "SSE推送")
|
||||
@Tag(name = "SSE推送")
|
||||
@CrossOrigin
|
||||
@Controller
|
||||
@RequestMapping("/api")
|
||||
@ -26,10 +24,6 @@ public class SseController {
|
||||
@Autowired
|
||||
AlarmEventListener alarmEventListener;
|
||||
|
||||
@ApiOperation("浏览器推送")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "browserId", value = "浏览器ID", dataTypeClass = String.class),
|
||||
})
|
||||
@GetMapping("/emit")
|
||||
public SseEmitter emit(@RequestParam String browserId) {
|
||||
final SseEmitter sseEmitter = new SseEmitter(0L);
|
||||
|
@ -3,32 +3,27 @@ package com.genersoft.iot.vmp.vmanager.gb28181.alarm;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.Device;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.DeviceAlarm;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.SubscribeInfo;
|
||||
import com.genersoft.iot.vmp.gb28181.transmit.cmd.ISIPCommander;
|
||||
import com.genersoft.iot.vmp.gb28181.transmit.cmd.ISIPCommanderForPlatform;
|
||||
import com.genersoft.iot.vmp.service.IDeviceAlarmService;
|
||||
import com.genersoft.iot.vmp.service.IGbStreamService;
|
||||
import com.genersoft.iot.vmp.storager.IVideoManagerStorage;
|
||||
import com.genersoft.iot.vmp.utils.DateUtil;
|
||||
import com.genersoft.iot.vmp.vmanager.bean.WVPResult;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.models.auth.In;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.text.ParseException;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
@Api(tags = "报警信息管理")
|
||||
@Tag(name = "报警信息管理")
|
||||
@CrossOrigin
|
||||
@RestController
|
||||
@RequestMapping("/api/alarm")
|
||||
@ -46,68 +41,6 @@ public class AlarmController {
|
||||
@Autowired
|
||||
private IVideoManagerStorage storage;
|
||||
|
||||
/**
|
||||
* 分页查询报警
|
||||
*
|
||||
* @param deviceId 设备id
|
||||
* @param page 当前页
|
||||
* @param count 每页查询数量
|
||||
* @param alarmPriority 报警级别
|
||||
* @param alarmMethod 报警方式
|
||||
* @param alarmType 报警类型
|
||||
* @param startTime 开始时间
|
||||
* @param endTime 结束时间
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation("分页查询报警")
|
||||
@GetMapping("/all")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name="deviceId", value = "设备id", dataTypeClass = String.class),
|
||||
@ApiImplicitParam(name="page", value = "当前页", required = true ,dataTypeClass = Integer.class),
|
||||
@ApiImplicitParam(name="count", value = "每页查询数量", required = true ,dataTypeClass = Integer.class),
|
||||
@ApiImplicitParam(name="alarmPriority", value = "查询内容" ,dataTypeClass = String.class),
|
||||
@ApiImplicitParam(name="alarmMethod", value = "查询内容" ,dataTypeClass = String.class),
|
||||
@ApiImplicitParam(name="alarmMethod", value = "查询内容" ,dataTypeClass = String.class),
|
||||
@ApiImplicitParam(name="alarmType", value = "查询内容" ,dataTypeClass = String.class),
|
||||
@ApiImplicitParam(name="startTime", value = "开始时间" ,dataTypeClass = String.class),
|
||||
@ApiImplicitParam(name="endTime", value = "结束时间" ,dataTypeClass = String.class),
|
||||
})
|
||||
public ResponseEntity<PageInfo<DeviceAlarm>> getAll(
|
||||
@RequestParam int page,
|
||||
@RequestParam int count,
|
||||
@RequestParam(required = false) String deviceId,
|
||||
@RequestParam(required = false) String alarmPriority,
|
||||
@RequestParam(required = false) String alarmMethod,
|
||||
@RequestParam(required = false) String alarmType,
|
||||
@RequestParam(required = false) String startTime,
|
||||
@RequestParam(required = false) String endTime
|
||||
) {
|
||||
if (StringUtils.isEmpty(alarmPriority)) {
|
||||
alarmPriority = null;
|
||||
}
|
||||
if (StringUtils.isEmpty(alarmMethod)) {
|
||||
alarmMethod = null;
|
||||
}
|
||||
if (StringUtils.isEmpty(alarmType)) {
|
||||
alarmType = null;
|
||||
}
|
||||
if (StringUtils.isEmpty(startTime)) {
|
||||
startTime = null;
|
||||
}
|
||||
if (StringUtils.isEmpty(endTime)) {
|
||||
endTime = null;
|
||||
}
|
||||
|
||||
|
||||
if (!DateUtil.verification(startTime, DateUtil.formatter) || !DateUtil.verification(endTime, DateUtil.formatter)){
|
||||
return new ResponseEntity<>(null, HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
|
||||
PageInfo<DeviceAlarm> allAlarm = deviceAlarmService.getAllAlarm(page, count, deviceId, alarmPriority, alarmMethod,
|
||||
alarmType, startTime, endTime);
|
||||
return new ResponseEntity<>(allAlarm, HttpStatus.OK);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 删除报警
|
||||
@ -117,13 +50,11 @@ public class AlarmController {
|
||||
* @param time 结束时间(这个时间之前的报警会被删除)
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation("删除报警")
|
||||
@DeleteMapping("/delete")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name="id", value = "ID", required = false ,dataTypeClass = Integer.class),
|
||||
@ApiImplicitParam(name="deviceIds", value = "多个设备id,逗号分隔", required = false ,dataTypeClass = String.class),
|
||||
@ApiImplicitParam(name="time", value = "结束时间", required = false ,dataTypeClass = String.class),
|
||||
})
|
||||
@Operation(summary = "删除报警")
|
||||
@Parameter(name = "id", description = "ID")
|
||||
@Parameter(name = "deviceIds", description = "多个设备id,逗号分隔")
|
||||
@Parameter(name = "time", description = "结束时间")
|
||||
public ResponseEntity<WVPResult<String>> delete(
|
||||
@RequestParam(required = false) Integer id,
|
||||
@RequestParam(required = false) String deviceIds,
|
||||
@ -161,11 +92,9 @@ public class AlarmController {
|
||||
* @param deviceId 报警id
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation("测试向上级/设备发送模拟报警通知")
|
||||
@GetMapping("/test/notify/alarm")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name="deviceId", value = "deviceId", required = true ,dataTypeClass = Integer.class)
|
||||
})
|
||||
@Operation(summary = "测试向上级/设备发送模拟报警通知")
|
||||
@Parameter(name = "deviceId", description = "设备国标编号")
|
||||
public ResponseEntity<WVPResult<String>> delete(
|
||||
@RequestParam(required = false) String deviceId
|
||||
) {
|
||||
@ -201,5 +130,64 @@ public class AlarmController {
|
||||
return new ResponseEntity<WVPResult<String>>(wvpResult, HttpStatus.OK);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询报警
|
||||
*
|
||||
* @param deviceId 设备id
|
||||
* @param page 当前页
|
||||
* @param count 每页查询数量
|
||||
* @param alarmPriority 报警级别
|
||||
* @param alarmMethod 报警方式
|
||||
* @param alarmType 报警类型
|
||||
* @param startTime 开始时间
|
||||
* @param endTime 结束时间
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "分页查询报警")
|
||||
@Parameter(name = "page",description = "当前页",required = true)
|
||||
@Parameter(name = "count",description = "每页查询数量",required = true)
|
||||
@Parameter(name = "deviceId",description = "设备id")
|
||||
@Parameter(name = "alarmPriority",description = "查询内容")
|
||||
@Parameter(name = "alarmMethod",description = "查询内容")
|
||||
@Parameter(name = "alarmType",description = "每页查询数量")
|
||||
@Parameter(name = "startTime",description = "开始时间")
|
||||
@Parameter(name = "endTime",description = "结束时间")
|
||||
@GetMapping("/all")
|
||||
public ResponseEntity<PageInfo<DeviceAlarm>> getAll(
|
||||
@RequestParam int page,
|
||||
@RequestParam int count,
|
||||
@RequestParam(required = false) String deviceId,
|
||||
@RequestParam(required = false) String alarmPriority,
|
||||
@RequestParam(required = false) String alarmMethod,
|
||||
@RequestParam(required = false) String alarmType,
|
||||
@RequestParam(required = false) String startTime,
|
||||
@RequestParam(required = false) String endTime
|
||||
) {
|
||||
if (StringUtils.isEmpty(alarmPriority)) {
|
||||
alarmPriority = null;
|
||||
}
|
||||
if (StringUtils.isEmpty(alarmMethod)) {
|
||||
alarmMethod = null;
|
||||
}
|
||||
if (StringUtils.isEmpty(alarmType)) {
|
||||
alarmType = null;
|
||||
}
|
||||
if (StringUtils.isEmpty(startTime)) {
|
||||
startTime = null;
|
||||
}
|
||||
if (StringUtils.isEmpty(endTime)) {
|
||||
endTime = null;
|
||||
}
|
||||
|
||||
|
||||
if (!DateUtil.verification(startTime, DateUtil.formatter) || !DateUtil.verification(endTime, DateUtil.formatter)){
|
||||
return new ResponseEntity<>(null, HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
|
||||
PageInfo<DeviceAlarm> allAlarm = deviceAlarmService.getAllAlarm(page, count, deviceId, alarmPriority, alarmMethod,
|
||||
alarmType, startTime, endTime);
|
||||
return new ResponseEntity<>(allAlarm, HttpStatus.OK);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -14,10 +14,9 @@ import com.genersoft.iot.vmp.gb28181.transmit.callback.RequestMessage;
|
||||
import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommander;
|
||||
import com.genersoft.iot.vmp.storager.IVideoManagerStorage;
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@ -28,7 +27,7 @@ import org.springframework.web.context.request.async.DeferredResult;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
@Api(tags = "国标设备配置")
|
||||
@Tag(name = "国标设备配置")
|
||||
@CrossOrigin
|
||||
@RestController
|
||||
@RequestMapping("/api/device/config")
|
||||
@ -55,16 +54,14 @@ public class DeviceConfig {
|
||||
* @param heartBeatCount 心跳计数
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation("基本配置设置命令")
|
||||
@GetMapping("/basicParam/{deviceId}")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "deviceId", value ="设备ID" ,dataTypeClass = String.class),
|
||||
@ApiImplicitParam(name = "channelId", value ="通道ID",dataTypeClass = String.class ),
|
||||
@ApiImplicitParam(name = "name", value ="名称" ,dataTypeClass = String.class),
|
||||
@ApiImplicitParam(name = "expiration", value ="到期时间" ,dataTypeClass = String.class),
|
||||
@ApiImplicitParam(name = "heartBeatInterval", value ="心跳间隔" ,dataTypeClass = String.class),
|
||||
@ApiImplicitParam(name = "heartBeatCount", value ="心跳计数" ,dataTypeClass = String.class),
|
||||
})
|
||||
@Operation(summary = "基本配置设置命令")
|
||||
@Parameter(name = "deviceId", description = "设备国标编号", required = true)
|
||||
@Parameter(name = "channelId", description = "通道国标编号", required = true)
|
||||
@Parameter(name = "name", description = "名称")
|
||||
@Parameter(name = "expiration", description = "到期时间")
|
||||
@Parameter(name = "heartBeatInterval", description = "心跳间隔")
|
||||
@Parameter(name = "heartBeatCount", description = "心跳计数")
|
||||
public DeferredResult<ResponseEntity<String>> homePositionApi(@PathVariable String deviceId,
|
||||
String channelId,
|
||||
@RequestParam(required = false) String name,
|
||||
@ -109,12 +106,10 @@ public class DeviceConfig {
|
||||
* @param channelId 通道ID
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation("设备配置查询请求")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "deviceId", value ="设备ID" ,dataTypeClass = String.class),
|
||||
@ApiImplicitParam(name = "channelId", value ="通道ID" ,dataTypeClass = String.class),
|
||||
@ApiImplicitParam(name = "configType", value ="配置类型" ,dataTypeClass = String.class),
|
||||
})
|
||||
@Operation(summary = "设备配置查询请求")
|
||||
@Parameter(name = "deviceId", description = "设备国标编号", required = true)
|
||||
@Parameter(name = "channelId", description = "通道国标编号", required = true)
|
||||
@Parameter(name = "configType", description = "配置类型")
|
||||
@GetMapping("/query/{deviceId}/{configType}")
|
||||
public DeferredResult<ResponseEntity<String>> configDownloadApi(@PathVariable String deviceId,
|
||||
@PathVariable String configType,
|
||||
|
@ -14,10 +14,9 @@ import com.genersoft.iot.vmp.gb28181.transmit.callback.RequestMessage;
|
||||
import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommander;
|
||||
import com.genersoft.iot.vmp.storager.IVideoManagerStorage;
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@ -29,7 +28,7 @@ import org.springframework.web.context.request.async.DeferredResult;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
@Api(tags = "国标设备控制")
|
||||
@Tag(name = "国标设备控制")
|
||||
@CrossOrigin
|
||||
@RestController
|
||||
@RequestMapping("/api/device/control")
|
||||
@ -51,10 +50,12 @@ public class DeviceControl {
|
||||
*
|
||||
* @param deviceId 设备ID
|
||||
*/
|
||||
@ApiOperation("远程启动控制命令")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "deviceId", value ="设备ID", required = true, dataTypeClass = String.class),
|
||||
})
|
||||
// //@ApiOperation("远程启动控制命令")
|
||||
// @ApiImplicitParams({
|
||||
// @ApiImplicitParam(name = "deviceId", value ="设备ID", required = true, dataTypeClass = String.class),
|
||||
// })
|
||||
@Operation(summary = "远程启动控制命令")
|
||||
@Parameter(name = "deviceId", description = "设备国标编号", required = true)
|
||||
@GetMapping("/teleboot/{deviceId}")
|
||||
public ResponseEntity<String> teleBootApi(@PathVariable String deviceId) {
|
||||
if (logger.isDebugEnabled()) {
|
||||
@ -80,13 +81,10 @@ public class DeviceControl {
|
||||
* @param recordCmdStr Record:手动录像,StopRecord:停止手动录像
|
||||
* @param channelId 通道编码(可选)
|
||||
*/
|
||||
@ApiOperation("录像控制命令")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "deviceId", value ="设备ID", required = true, dataTypeClass = String.class),
|
||||
@ApiImplicitParam(name = "channelId", value ="通道编码" ,dataTypeClass = String.class),
|
||||
@ApiImplicitParam(name = "recordCmdStr", value ="命令, 可选值:Record(手动录像),StopRecord(停止手动录像)",
|
||||
required = true ,dataTypeClass = String.class),
|
||||
})
|
||||
@Operation(summary = "录像控制")
|
||||
@Parameter(name = "deviceId", description = "设备国标编号", required = true)
|
||||
@Parameter(name = "channelId", description = "通道国标编号", required = true)
|
||||
@Parameter(name = "recordCmdStr", description = "命令, 可选值:Record(手动录像),StopRecord(停止手动录像)", required = true)
|
||||
@GetMapping("/record/{deviceId}/{recordCmdStr}")
|
||||
public DeferredResult<ResponseEntity<String>> recordApi(@PathVariable String deviceId,
|
||||
@PathVariable String recordCmdStr, String channelId) {
|
||||
@ -127,13 +125,10 @@ public class DeviceControl {
|
||||
* @param deviceId 设备ID
|
||||
* @param guardCmdStr SetGuard:布防,ResetGuard:撤防
|
||||
*/
|
||||
@ApiOperation("布防/撤防命令")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "deviceId", value = "设备ID", required = true, dataTypeClass = String.class),
|
||||
@ApiImplicitParam(name = "channelId", value ="通道编码" ,dataTypeClass = String.class),
|
||||
@ApiImplicitParam(name = "guardCmdStr", value ="命令, 可选值:SetGuard(布防),ResetGuard(撤防)", required = true,
|
||||
dataTypeClass = String.class)
|
||||
})
|
||||
@Operation(summary = "布防/撤防命令")
|
||||
@Parameter(name = "deviceId", description = "设备国标编号", required = true)
|
||||
@Parameter(name = "channelId", description = "通道国标编号", required = true)
|
||||
@Parameter(name = "guardCmdStr", description = "命令, 可选值:SetGuard(布防),ResetGuard(撤防)", required = true)
|
||||
@GetMapping("/guard/{deviceId}/{guardCmdStr}")
|
||||
public DeferredResult<ResponseEntity<String>> guardApi(@PathVariable String deviceId, String channelId, @PathVariable String guardCmdStr) {
|
||||
if (logger.isDebugEnabled()) {
|
||||
@ -171,13 +166,11 @@ public class DeviceControl {
|
||||
* @param alarmMethod 报警方式(可选)
|
||||
* @param alarmType 报警类型(可选)
|
||||
*/
|
||||
@ApiOperation("报警复位")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "deviceId", value = "设备ID", required = true, dataTypeClass = String.class),
|
||||
@ApiImplicitParam(name = "channelId", value ="通道编码" ,dataTypeClass = String.class),
|
||||
@ApiImplicitParam(name = "alarmMethod", value ="报警方式", dataTypeClass = String.class),
|
||||
@ApiImplicitParam(name = "alarmType", value ="报警类型", dataTypeClass = String.class),
|
||||
})
|
||||
@Operation(summary = "报警复位")
|
||||
@Parameter(name = "deviceId", description = "设备国标编号", required = true)
|
||||
@Parameter(name = "channelId", description = "通道国标编号", required = true)
|
||||
@Parameter(name = "alarmMethod", description = "报警方式")
|
||||
@Parameter(name = "alarmType", description = "报警类型")
|
||||
@GetMapping("/reset_alarm/{deviceId}")
|
||||
public DeferredResult<ResponseEntity<String>> resetAlarmApi(@PathVariable String deviceId, String channelId,
|
||||
@RequestParam(required = false) String alarmMethod,
|
||||
@ -215,11 +208,9 @@ public class DeviceControl {
|
||||
* @param deviceId 设备ID
|
||||
* @param channelId 通道ID
|
||||
*/
|
||||
@ApiOperation("强制关键帧")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "deviceId", value = "设备ID", required = true, dataTypeClass = String.class),
|
||||
@ApiImplicitParam(name = "channelId", value ="通道ID", required = true, dataTypeClass = String.class),
|
||||
})
|
||||
@Operation(summary = "强制关键帧")
|
||||
@Parameter(name = "deviceId", description = "设备国标编号", required = true)
|
||||
@Parameter(name = "channelId", description = "通道国标编号")
|
||||
@GetMapping("/i_frame/{deviceId}")
|
||||
public ResponseEntity<String> iFrame(@PathVariable String deviceId,
|
||||
@RequestParam(required = false) String channelId) {
|
||||
@ -249,15 +240,12 @@ public class DeviceControl {
|
||||
* @param presetIndex 调用预置位编号(可选)
|
||||
* @param channelId 通道编码(可选)
|
||||
*/
|
||||
@ApiOperation("看守位控制")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "deviceId", value = "设备ID", required = true, dataTypeClass = String.class),
|
||||
@ApiImplicitParam(name = "channelId", value ="通道编码" ,dataTypeClass = String.class),
|
||||
@ApiImplicitParam(name = "enabled", value = "是否开启看守位 1:开启,0:关闭", required = true, dataTypeClass = String.class),
|
||||
@ApiImplicitParam(name = "resetTime", value = "自动归位时间间隔", dataTypeClass = String.class),
|
||||
@ApiImplicitParam(name = "presetIndex", value = "调用预置位编号", dataTypeClass = String.class),
|
||||
@ApiImplicitParam(name = "channelId", value ="通道ID", dataTypeClass = String.class),
|
||||
})
|
||||
@Operation(summary = "看守位控制")
|
||||
@Parameter(name = "deviceId", description = "设备国标编号", required = true)
|
||||
@Parameter(name = "channelId", description = "通道国标编号", required = true)
|
||||
@Parameter(name = "enabled", description = "是否开启看守位 1:开启,0:关闭", required = true)
|
||||
@Parameter(name = "presetIndex", description = "调用预置位编号")
|
||||
@Parameter(name = "resetTime", description = "自动归位时间间隔")
|
||||
@GetMapping("/home_position/{deviceId}/{enabled}")
|
||||
public DeferredResult<ResponseEntity<String>> homePositionApi(@PathVariable String deviceId,
|
||||
@PathVariable String enabled,
|
||||
@ -307,17 +295,14 @@ public class DeviceControl {
|
||||
* @param lengthy 拉框宽度像素值
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation("拉框放大")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "deviceId", value = "设备ID", required = true, dataTypeClass = String.class),
|
||||
@ApiImplicitParam(name = "channelId", value = "通道ID", dataTypeClass = String.class),
|
||||
@ApiImplicitParam(name = "length", value = "播放窗口长度像素值", required = true, dataTypeClass = Integer.class),
|
||||
@ApiImplicitParam(name = "width", value = "播放窗口宽度像素值", required = true, dataTypeClass = Integer.class),
|
||||
@ApiImplicitParam(name = "midpointx", value = "拉框中心的横轴坐标像素值", required = true, dataTypeClass = Integer.class),
|
||||
@ApiImplicitParam(name = "midpointy", value = "拉框中心的纵轴坐标像素值", required = true, dataTypeClass = Integer.class),
|
||||
@ApiImplicitParam(name = "lengthx", value = "拉框长度像素值", required = true, dataTypeClass = Integer.class),
|
||||
@ApiImplicitParam(name = "lengthy", value = "拉框宽度像素值", required = true, dataTypeClass = Integer.class),
|
||||
})
|
||||
@Operation(summary = "拉框放大")
|
||||
@Parameter(name = "deviceId", description = "设备国标编号", required = true)
|
||||
@Parameter(name = "channelId", description = "通道国标编号", required = true)
|
||||
@Parameter(name = "length", description = "播放窗口长度像素值", required = true)
|
||||
@Parameter(name = "midpointx", description = "拉框中心的横轴坐标像素值", required = true)
|
||||
@Parameter(name = "midpointy", description = "拉框中心的纵轴坐标像素值", required = true)
|
||||
@Parameter(name = "lengthx", description = "拉框长度像素值", required = true)
|
||||
@Parameter(name = "lengthy", description = "lengthy", required = true)
|
||||
@GetMapping("drag_zoom/zoom_in")
|
||||
public ResponseEntity<String> dragZoomIn(@RequestParam String deviceId,
|
||||
@RequestParam(required = false) String channelId,
|
||||
@ -356,17 +341,15 @@ public class DeviceControl {
|
||||
* @param lengthy 拉框宽度像素值
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation("拉框缩小")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "deviceId", value = "设备ID", required = true, dataTypeClass = String.class),
|
||||
@ApiImplicitParam(name = "channelId", value = "通道ID", dataTypeClass = String.class),
|
||||
@ApiImplicitParam(name = "length", value = "播放窗口长度像素值", required = true, dataTypeClass = Integer.class),
|
||||
@ApiImplicitParam(name = "width", value = "播放窗口宽度像素值", required = true, dataTypeClass = Integer.class),
|
||||
@ApiImplicitParam(name = "midpointx", value = "拉框中心的横轴坐标像素值", required = true, dataTypeClass = Integer.class),
|
||||
@ApiImplicitParam(name = "midpointy", value = "拉框中心的纵轴坐标像素值", required = true, dataTypeClass = Integer.class),
|
||||
@ApiImplicitParam(name = "lengthx", value = "拉框长度像素值", required = true, dataTypeClass = Integer.class),
|
||||
@ApiImplicitParam(name = "lengthy", value = "拉框宽度像素值", required = true, dataTypeClass = Integer.class),
|
||||
})
|
||||
@Operation(summary = "拉框放大")
|
||||
@Parameter(name = "deviceId", description = "设备国标编号", required = true)
|
||||
@Parameter(name = "channelId", description = "通道国标编号")
|
||||
@Parameter(name = "length", description = "播放窗口长度像素值", required = true)
|
||||
@Parameter(name = "width", description = "拉框中心的横轴坐标像素值", required = true)
|
||||
@Parameter(name = "midpointx", description = "拉框中心的横轴坐标像素值", required = true)
|
||||
@Parameter(name = "midpointy", description = "拉框中心的纵轴坐标像素值", required = true)
|
||||
@Parameter(name = "lengthx", description = "拉框长度像素值", required = true)
|
||||
@Parameter(name = "lengthy", description = "拉框宽度像素值", required = true)
|
||||
@GetMapping("/drag_zoom/zoom_out")
|
||||
public ResponseEntity<String> dragZoomOut(@RequestParam String deviceId,
|
||||
@RequestParam(required = false) String channelId,
|
||||
|
@ -19,10 +19,9 @@ import com.genersoft.iot.vmp.storager.IVideoManagerStorage;
|
||||
import com.genersoft.iot.vmp.vmanager.bean.BaseTree;
|
||||
import com.genersoft.iot.vmp.vmanager.bean.WVPResult;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.apache.commons.compress.utils.IOUtils;
|
||||
import org.apache.http.HttpResponse;
|
||||
import org.slf4j.Logger;
|
||||
@ -41,7 +40,7 @@ import java.io.*;
|
||||
import java.nio.file.Files;
|
||||
import java.util.*;
|
||||
|
||||
@Api(tags = "国标设备查询", value = "国标设备查询")
|
||||
@Tag(name = "国标设备查询", description = "国标设备查询")
|
||||
@SuppressWarnings("rawtypes")
|
||||
@CrossOrigin
|
||||
@RestController
|
||||
@ -79,17 +78,11 @@ public class DeviceQuery {
|
||||
* @param deviceId 国标ID
|
||||
* @return 国标设备
|
||||
*/
|
||||
@ApiOperation("使用ID查询国标设备")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "deviceId", value = "设备ID", required = true, dataTypeClass = String.class),
|
||||
})
|
||||
@Operation(summary = "查询国标设备")
|
||||
@Parameter(name = "deviceId", description = "设备国标编号", required = true)
|
||||
@GetMapping("/devices/{deviceId}")
|
||||
public ResponseEntity<Device> devices(@PathVariable String deviceId){
|
||||
|
||||
// if (logger.isDebugEnabled()) {
|
||||
// logger.debug("查询视频设备API调用,deviceId:" + deviceId);
|
||||
// }
|
||||
|
||||
Device device = storager.queryVideoDevice(deviceId);
|
||||
return new ResponseEntity<>(device,HttpStatus.OK);
|
||||
}
|
||||
@ -100,18 +93,12 @@ public class DeviceQuery {
|
||||
* @param count 每页查询数量
|
||||
* @return 分页国标列表
|
||||
*/
|
||||
@ApiOperation("分页查询国标设备")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "page", value = "当前页", required = true, dataTypeClass = Integer.class),
|
||||
@ApiImplicitParam(name = "count", value = "每页查询数量", required = true, dataTypeClass = Integer.class),
|
||||
})
|
||||
@Operation(summary = "分页查询国标设备")
|
||||
@Parameter(name = "page", description = "当前页", required = true)
|
||||
@Parameter(name = "count", description = "每页查询数量", required = true)
|
||||
@GetMapping("/devices")
|
||||
public PageInfo<Device> devices(int page, int count){
|
||||
|
||||
// if (logger.isDebugEnabled()) {
|
||||
// logger.debug("查询所有视频设备API调用");
|
||||
// }
|
||||
|
||||
return storager.queryVideoDeviceList(page, count);
|
||||
}
|
||||
|
||||
@ -124,28 +111,24 @@ public class DeviceQuery {
|
||||
* @param query 查询内容
|
||||
* @param online 是否在线 在线 true / 离线 false
|
||||
* @param channelType 设备 false/子目录 true
|
||||
* @param catalogUnderDevice 是否直属与设备的目录
|
||||
* @return 通道列表
|
||||
*/
|
||||
@ApiOperation("分页查询通道")
|
||||
@GetMapping("/devices/{deviceId}/channels")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name="deviceId", value = "设备id", required = true ,dataTypeClass = String.class),
|
||||
@ApiImplicitParam(name="page", value = "当前页", required = true ,dataTypeClass = Integer.class),
|
||||
@ApiImplicitParam(name="count", value = "每页查询数量", required = true ,dataTypeClass = Integer.class),
|
||||
@ApiImplicitParam(name="query", value = "查询内容" ,dataTypeClass = String.class),
|
||||
@ApiImplicitParam(name="online", value = "是否在线" ,dataTypeClass = Boolean.class),
|
||||
@ApiImplicitParam(name="channelType", value = "设备/子目录-> false/true" ,dataTypeClass = Boolean.class),
|
||||
@ApiImplicitParam(name="catalogUnderDevice", value = "是否直属与设备的目录" ,dataTypeClass = Boolean.class),
|
||||
})
|
||||
@Operation(summary = "分页查询通道")
|
||||
@Parameter(name = "deviceId", description = "设备国标编号", required = true)
|
||||
@Parameter(name = "page", description = "当前页", required = true)
|
||||
@Parameter(name = "count", description = "每页查询数量", required = true)
|
||||
@Parameter(name = "query", description = "查询内容")
|
||||
@Parameter(name = "online", description = "是否在线")
|
||||
@Parameter(name = "channelType", description = "设备/子目录-> false/true")
|
||||
@Parameter(name = "catalogUnderDevice", description = "是否直属与设备的目录")
|
||||
public ResponseEntity<PageInfo> channels(@PathVariable String deviceId,
|
||||
int page, int count,
|
||||
@RequestParam(required = false) String query,
|
||||
@RequestParam(required = false) Boolean online,
|
||||
@RequestParam(required = false) Boolean channelType,
|
||||
@RequestParam(required = false) Boolean catalogUnderDevice) {
|
||||
// if (logger.isDebugEnabled()) {
|
||||
// logger.debug("查询视频设备通道API调用");
|
||||
// }
|
||||
if (StringUtils.isEmpty(query)) {
|
||||
query = null;
|
||||
}
|
||||
@ -159,10 +142,8 @@ public class DeviceQuery {
|
||||
* @param deviceId 设备id
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation("同步设备通道")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name="deviceId", value = "设备id", required = true, dataTypeClass = String.class),
|
||||
})
|
||||
@Operation(summary = "同步设备通道")
|
||||
@Parameter(name = "deviceId", description = "设备国标编号", required = true)
|
||||
@PostMapping("/devices/{deviceId}/sync")
|
||||
public WVPResult<SyncStatus> devicesSync(@PathVariable String deviceId){
|
||||
|
||||
@ -192,10 +173,8 @@ public class DeviceQuery {
|
||||
* @param deviceId 设备id
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation("移除设备")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name="deviceId", value = "设备id", required = true, dataTypeClass = String.class),
|
||||
})
|
||||
@Operation(summary = "移除设备")
|
||||
@Parameter(name = "deviceId", description = "设备国标编号", required = true)
|
||||
@DeleteMapping("/devices/{deviceId}/delete")
|
||||
public ResponseEntity<String> delete(@PathVariable String deviceId){
|
||||
|
||||
@ -239,16 +218,14 @@ public class DeviceQuery {
|
||||
* @param channelType 通道类型
|
||||
* @return 子通道列表
|
||||
*/
|
||||
@ApiOperation("分页查询子目录通道")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name="deviceId", value = "设备id", required = true, dataTypeClass = String.class),
|
||||
@ApiImplicitParam(name="channelId", value = "通道id", required = true, dataTypeClass = String.class),
|
||||
@ApiImplicitParam(name="page", value = "当前页", required = true, dataTypeClass = Integer.class),
|
||||
@ApiImplicitParam(name="count", value = "每页条数", required = true, dataTypeClass = Integer.class),
|
||||
@ApiImplicitParam(name="query", value = "查询内容", dataTypeClass = String.class),
|
||||
@ApiImplicitParam(name="online", value = "是否在线", dataTypeClass = Boolean.class),
|
||||
@ApiImplicitParam(name="channelType", value = "通道类型, 子目录", dataTypeClass = Boolean.class),
|
||||
})
|
||||
@Operation(summary = "分页查询子目录通道")
|
||||
@Parameter(name = "deviceId", description = "设备国标编号", required = true)
|
||||
@Parameter(name = "channelId", description = "通道国标编号", required = true)
|
||||
@Parameter(name = "page", description = "当前页", required = true)
|
||||
@Parameter(name = "count", description = "每页查询数量", required = true)
|
||||
@Parameter(name = "query", description = "查询内容")
|
||||
@Parameter(name = "online", description = "是否在线")
|
||||
@Parameter(name = "channelType", description = "设备/子目录-> false/true")
|
||||
@GetMapping("/sub_channels/{deviceId}/{channelId}/channels")
|
||||
public ResponseEntity<PageInfo> subChannels(@PathVariable String deviceId,
|
||||
@PathVariable String channelId,
|
||||
@ -258,9 +235,6 @@ public class DeviceQuery {
|
||||
@RequestParam(required = false) Boolean online,
|
||||
@RequestParam(required = false) Boolean channelType){
|
||||
|
||||
// if (logger.isDebugEnabled()) {
|
||||
// logger.debug("查询所有视频通道API调用");
|
||||
// }
|
||||
DeviceChannel deviceChannel = storager.queryChannel(deviceId,channelId);
|
||||
if (deviceChannel == null) {
|
||||
PageInfo<DeviceChannel> deviceChannelPageResult = new PageInfo<>();
|
||||
@ -277,13 +251,11 @@ public class DeviceQuery {
|
||||
* @param channel 通道
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation("更新通道信息")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name="deviceId", value = "设备id", required = true, dataTypeClass = String.class),
|
||||
@ApiImplicitParam(name="channel", value = "通道", required = true, dataTypeClass = String.class),
|
||||
})
|
||||
@Operation(summary = "更新通道信息")
|
||||
@Parameter(name = "deviceId", description = "设备国标编号", required = true)
|
||||
@Parameter(name = "channel", description = "通道信息", required = true)
|
||||
@PostMapping("/channel/update/{deviceId}")
|
||||
public ResponseEntity<PageInfo> updateChannel(@PathVariable String deviceId,DeviceChannel channel){
|
||||
public ResponseEntity updateChannel(@PathVariable String deviceId,DeviceChannel channel){
|
||||
deviceChannelService.updateChannel(deviceId, channel);
|
||||
return new ResponseEntity<>(null,HttpStatus.OK);
|
||||
}
|
||||
@ -294,17 +266,14 @@ public class DeviceQuery {
|
||||
* @param streamMode 数据流传输模式
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation("修改数据流传输模式")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "deviceId", value = "设备id", required = true, dataTypeClass = String.class),
|
||||
@ApiImplicitParam(name = "streamMode", value = "数据流传输模式, 取值:" +
|
||||
"UDP(udp传输),TCP-ACTIVE(tcp主动模式,暂不支持),TCP-PASSIVE(tcp被动模式)", dataTypeClass = String.class),
|
||||
})
|
||||
@Operation(summary = "修改数据流传输模式")
|
||||
@Parameter(name = "deviceId", description = "设备国标编号", required = true)
|
||||
@Parameter(name = "streamMode", description = "数据流传输模式, 取值:" +
|
||||
"UDP(udp传输),TCP-ACTIVE(tcp主动模式,暂不支持),TCP-PASSIVE(tcp被动模式)", required = true)
|
||||
@PostMapping("/transport/{deviceId}/{streamMode}")
|
||||
public ResponseEntity<PageInfo> updateTransport(@PathVariable String deviceId, @PathVariable String streamMode){
|
||||
public ResponseEntity updateTransport(@PathVariable String deviceId, @PathVariable String streamMode){
|
||||
Device device = storager.queryVideoDevice(deviceId);
|
||||
device.setStreamMode(streamMode);
|
||||
// storager.updateDevice(device);
|
||||
deviceService.updateDevice(device);
|
||||
return new ResponseEntity<>(null,HttpStatus.OK);
|
||||
}
|
||||
@ -314,10 +283,8 @@ public class DeviceQuery {
|
||||
* @param device 设备信息
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation("更新设备信息")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "device", value = "设备信息", required = true, dataTypeClass = Device.class)
|
||||
})
|
||||
@Operation(summary = "更新设备信息")
|
||||
@Parameter(name = "device", description = "设备", required = true)
|
||||
@PostMapping("/device/update/")
|
||||
public ResponseEntity<WVPResult<String>> updateDevice(Device device){
|
||||
|
||||
@ -335,10 +302,8 @@ public class DeviceQuery {
|
||||
*
|
||||
* @param deviceId 设备id
|
||||
*/
|
||||
@ApiOperation("设备状态查询")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "deviceId", value = "设备id", required = true, dataTypeClass = String.class),
|
||||
})
|
||||
@Operation(summary = "设备状态查询")
|
||||
@Parameter(name = "deviceId", description = "设备国标编号", required = true)
|
||||
@GetMapping("/devices/{deviceId}/status")
|
||||
public DeferredResult<ResponseEntity<String>> deviceStatusApi(@PathVariable String deviceId) {
|
||||
if (logger.isDebugEnabled()) {
|
||||
@ -383,16 +348,14 @@ public class DeviceQuery {
|
||||
* @param endTime 报警发生终止时间(可选)
|
||||
* @return true = 命令发送成功
|
||||
*/
|
||||
@ApiOperation("设备报警查询")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "deviceId", value = "设备id", required = true, dataTypeClass = String.class),
|
||||
@ApiImplicitParam(name = "startPriority", value = "报警起始级别", dataTypeClass = String.class),
|
||||
@ApiImplicitParam(name = "endPriority", value = "报警终止级别", dataTypeClass = String.class),
|
||||
@ApiImplicitParam(name = "alarmMethod", value = "报警方式条件", dataTypeClass = String.class),
|
||||
@ApiImplicitParam(name = "alarmType", value = "报警类型", dataTypeClass = String.class),
|
||||
@ApiImplicitParam(name = "startTime", value = "报警发生起始时间", dataTypeClass = String.class),
|
||||
@ApiImplicitParam(name = "endTime", value = "报警发生终止时间", dataTypeClass = String.class),
|
||||
})
|
||||
@Operation(summary = "设备状态查询")
|
||||
@Parameter(name = "deviceId", description = "设备国标编号", required = true)
|
||||
@Parameter(name = "startPriority", description = "报警起始级别")
|
||||
@Parameter(name = "endPriority", description = "报警终止级别")
|
||||
@Parameter(name = "alarmMethod", description = "报警方式条件")
|
||||
@Parameter(name = "alarmType", description = "报警类型")
|
||||
@Parameter(name = "startTime", description = "报警发生起始时间")
|
||||
@Parameter(name = "endTime", description = "报警发生终止时间")
|
||||
@GetMapping("/alarm/{deviceId}")
|
||||
public DeferredResult<ResponseEntity<String>> alarmApi(@PathVariable String deviceId,
|
||||
@RequestParam(required = false) String startPriority,
|
||||
@ -430,7 +393,8 @@ public class DeviceQuery {
|
||||
|
||||
|
||||
@GetMapping("/{deviceId}/sync_status")
|
||||
@ApiOperation(value = "获取通道同步进度", notes = "获取通道同步进度")
|
||||
@Operation(summary = "获取通道同步进度")
|
||||
@Parameter(name = "deviceId", description = "设备国标编号", required = true)
|
||||
public WVPResult<SyncStatus> getSyncStatus(@PathVariable String deviceId) {
|
||||
SyncStatus channelSyncStatus = deviceService.getChannelSyncStatus(deviceId);
|
||||
WVPResult<SyncStatus> wvpResult = new WVPResult<>();
|
||||
@ -448,7 +412,8 @@ public class DeviceQuery {
|
||||
}
|
||||
|
||||
@GetMapping("/{deviceId}/subscribe_info")
|
||||
@ApiOperation(value = "获取设备的订阅状态", notes = "获取设备的订阅状态")
|
||||
@Operation(summary = "获取设备的订阅状态")
|
||||
@Parameter(name = "deviceId", description = "设备国标编号", required = true)
|
||||
public WVPResult<Map<String, String>> getSubscribeInfo(@PathVariable String deviceId) {
|
||||
Set<String> allKeys = dynamicTask.getAllKeys();
|
||||
Map<String, String> dialogStateMap = new HashMap<>();
|
||||
@ -473,7 +438,9 @@ public class DeviceQuery {
|
||||
}
|
||||
|
||||
@GetMapping("/snap/{deviceId}/{channelId}")
|
||||
@ApiOperation(value = "请求截图", notes = "请求截图")
|
||||
@Operation(summary = "请求截图")
|
||||
@Parameter(name = "deviceId", description = "设备国标编号", required = true)
|
||||
@Parameter(name = "channelId", description = "通道国标编号", required = true)
|
||||
public void getSnap(HttpServletResponse resp, @PathVariable String deviceId, @PathVariable String channelId) {
|
||||
|
||||
try {
|
||||
@ -493,16 +460,17 @@ public class DeviceQuery {
|
||||
* @param count 每页条数
|
||||
* @return 国标设备
|
||||
*/
|
||||
@ApiOperation("查询国标树")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "deviceId", value = "设备ID", required = true, dataTypeClass = String.class),
|
||||
@ApiImplicitParam(name = "parentId", value = "父ID", required = false, dataTypeClass = String.class),
|
||||
@ApiImplicitParam(name = "onlyCatalog", value = "只获取目录", required = false, dataTypeClass = Boolean.class),
|
||||
@ApiImplicitParam(name="page", value = "当前页", required = true, dataTypeClass = Integer.class),
|
||||
@ApiImplicitParam(name="count", value = "每页条数", required = true, dataTypeClass = Integer.class),
|
||||
})
|
||||
@Operation(summary = "查询国标树")
|
||||
@Parameter(name = "deviceId", description = "设备国标编号", required = true)
|
||||
@Parameter(name = "parentId", description = "父级国标编号")
|
||||
@Parameter(name = "onlyCatalog", description = "只获取目录")
|
||||
@Parameter(name = "page", description = "当前页", required = true)
|
||||
@Parameter(name = "count", description = "每页条数", required = true)
|
||||
@GetMapping("/tree/{deviceId}")
|
||||
public ResponseEntity<PageInfo> getTree(@PathVariable String deviceId, @RequestParam(required = false) String parentId, @RequestParam(required = false) Boolean onlyCatalog, int page, int count){
|
||||
public ResponseEntity<PageInfo> getTree(@PathVariable String deviceId,
|
||||
@RequestParam(required = false) String parentId,
|
||||
@RequestParam(required = false) Boolean onlyCatalog,
|
||||
int page, int count){
|
||||
|
||||
|
||||
if (page <= 0) {
|
||||
@ -543,13 +511,11 @@ public class DeviceQuery {
|
||||
* @param count 每页条数
|
||||
* @return 国标设备
|
||||
*/
|
||||
@ApiOperation("查询国标树下的通道")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "deviceId", value = "设备ID", required = true, dataTypeClass = String.class),
|
||||
@ApiImplicitParam(name = "parentId", value = "父ID", required = false, dataTypeClass = String.class),
|
||||
@ApiImplicitParam(name="page", value = "当前页", required = true, dataTypeClass = Integer.class),
|
||||
@ApiImplicitParam(name="count", value = "每页条数", required = true, dataTypeClass = Integer.class),
|
||||
})
|
||||
@Operation(summary = "查询国标树下的通道")
|
||||
@Parameter(name = "deviceId", description = "设备国标编号", required = true)
|
||||
@Parameter(name = "parentId", description = "父级国标编号")
|
||||
@Parameter(name = "page", description = "当前页", required = true)
|
||||
@Parameter(name = "count", description = "每页条数", required = true)
|
||||
@GetMapping("/tree/channel/{deviceId}")
|
||||
public ResponseEntity<PageInfo> getChannelInTreeNode(@PathVariable String deviceId, @RequestParam(required = false) String parentId, int page, int count){
|
||||
|
||||
|
@ -5,17 +5,16 @@ import com.genersoft.iot.vmp.storager.IVideoManagerStorage;
|
||||
import com.genersoft.iot.vmp.vmanager.gb28181.gbStream.bean.GbStreamParam;
|
||||
import com.genersoft.iot.vmp.service.IGbStreamService;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@Api(tags = "视频流关联到级联平台")
|
||||
@Tag(name = "视频流关联到级联平台")
|
||||
@CrossOrigin
|
||||
@RestController
|
||||
@RequestMapping("/api/gbStream")
|
||||
@ -37,16 +36,13 @@ public class GbStreamController {
|
||||
* @param platformId 平台ID
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation("查询国标通道")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "page", value = "当前页", required = true , dataTypeClass = Integer.class),
|
||||
@ApiImplicitParam(name = "count", value = "每页条数", required = true , dataTypeClass = Integer.class),
|
||||
@ApiImplicitParam(name = "platformId", value = "平台ID", required = true , dataTypeClass = String.class),
|
||||
@ApiImplicitParam(name = "catalogId", value = "目录ID", required = false , dataTypeClass = String.class),
|
||||
@ApiImplicitParam(name="query", value = "查询内容", required = false , dataTypeClass = String.class),
|
||||
@ApiImplicitParam(name="mediaServerId", value = "流媒体ID", required = false , dataTypeClass = String.class),
|
||||
|
||||
})
|
||||
@Operation(summary = "查询国标通道")
|
||||
@Parameter(name = "page", description = "当前页", required = true)
|
||||
@Parameter(name = "count", description = "每页条数", required = true)
|
||||
@Parameter(name = "platformId", description = "平台ID", required = true)
|
||||
@Parameter(name = "catalogId", description = "目录ID")
|
||||
@Parameter(name = "query", description = "查询内容")
|
||||
@Parameter(name = "mediaServerId", description = "流媒体ID")
|
||||
@GetMapping(value = "/list")
|
||||
@ResponseBody
|
||||
public PageInfo<GbStream> list(@RequestParam(required = true)Integer page,
|
||||
@ -76,11 +72,7 @@ public class GbStreamController {
|
||||
* @param gbStreamParam
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation("移除国标关联")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "gbStreamParam", value = "GbStreamParam", required = true,
|
||||
dataTypeClass = GbStreamParam.class),
|
||||
})
|
||||
@Operation(summary = "移除国标关联")
|
||||
@DeleteMapping(value = "/del")
|
||||
@ResponseBody
|
||||
public Object del(@RequestBody GbStreamParam gbStreamParam){
|
||||
@ -97,10 +89,7 @@ public class GbStreamController {
|
||||
* @param gbStreamParam
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation("保存国标关联")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "gbStreamParam", value = "GbStreamParam", required = true, dataTypeClass = GbStreamParam.class),
|
||||
})
|
||||
@Operation(summary = "保存国标关联")
|
||||
@PostMapping(value = "/add")
|
||||
@ResponseBody
|
||||
public Object add(@RequestBody GbStreamParam gbStreamParam){
|
||||
|
@ -1,15 +1,20 @@
|
||||
package com.genersoft.iot.vmp.vmanager.gb28181.gbStream.bean;
|
||||
|
||||
import com.genersoft.iot.vmp.gb28181.bean.GbStream;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Schema(description = "国标关联参数")
|
||||
public class GbStreamParam {
|
||||
|
||||
@Schema(description = "平台ID")
|
||||
private String platformId;
|
||||
|
||||
@Schema(description = "目录ID")
|
||||
private String catalogId;
|
||||
|
||||
@Schema(description = "流国标信息列表")
|
||||
private List<GbStream> gbStreams;
|
||||
|
||||
public String getPlatformId() {
|
||||
|
@ -3,19 +3,14 @@ package com.genersoft.iot.vmp.vmanager.gb28181.media;
|
||||
import com.genersoft.iot.vmp.common.StreamInfo;
|
||||
import com.genersoft.iot.vmp.conf.security.SecurityUtils;
|
||||
import com.genersoft.iot.vmp.conf.security.dto.LoginUser;
|
||||
import com.genersoft.iot.vmp.media.zlm.dto.OnPublishHookParam;
|
||||
import com.genersoft.iot.vmp.media.zlm.dto.StreamAuthorityInfo;
|
||||
import com.genersoft.iot.vmp.service.IMediaServerService;
|
||||
import com.genersoft.iot.vmp.service.IStreamProxyService;
|
||||
import com.genersoft.iot.vmp.service.IStreamPushService;
|
||||
import com.genersoft.iot.vmp.service.IMediaService;
|
||||
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
|
||||
import com.genersoft.iot.vmp.storager.IVideoManagerStorage;
|
||||
import com.genersoft.iot.vmp.vmanager.bean.WVPResult;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@ -25,7 +20,7 @@ import org.springframework.web.bind.annotation.*;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
|
||||
@Api(tags = "媒体流相关")
|
||||
@Tag(name = "媒体流相关")
|
||||
@Controller
|
||||
@CrossOrigin
|
||||
@RequestMapping(value = "/api/media")
|
||||
@ -48,12 +43,12 @@ public class MediaController {
|
||||
* @param stream 流id
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation("根据应用名和流id获取播放地址")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "app", value = "应用名", dataTypeClass = String.class),
|
||||
@ApiImplicitParam(name = "stream", value = "流id", dataTypeClass = String.class),
|
||||
@ApiImplicitParam(name = "mediaServerId", value = "媒体服务器id", dataTypeClass = String.class, required = false),
|
||||
})
|
||||
@Operation(summary = "根据应用名和流id获取播放地址")
|
||||
@Parameter(name = "app", description = "应用名", required = true)
|
||||
@Parameter(name = "stream", description = "流id", required = true)
|
||||
@Parameter(name = "mediaServerId", description = "媒体服务器id")
|
||||
@Parameter(name = "callId", description = "推流时携带的自定义鉴权ID")
|
||||
@Parameter(name = "useSourceIpAsStreamIp", description = "是否使用请求IP作为返回的地址IP")
|
||||
@GetMapping(value = "/stream_info_by_app_and_stream")
|
||||
@ResponseBody
|
||||
public WVPResult<StreamInfo> getStreamInfoByAppAndStream(HttpServletRequest request, @RequestParam String app,
|
||||
|
@ -18,10 +18,9 @@ import com.genersoft.iot.vmp.vmanager.bean.WVPResult;
|
||||
import com.genersoft.iot.vmp.vmanager.gb28181.platform.bean.ChannelReduce;
|
||||
import com.genersoft.iot.vmp.vmanager.gb28181.platform.bean.UpdateChannelParam;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@ -36,7 +35,7 @@ import java.util.List;
|
||||
/**
|
||||
* 级联平台管理
|
||||
*/
|
||||
@Api(tags = "级联平台管理")
|
||||
@Tag(name = "级联平台管理")
|
||||
@CrossOrigin
|
||||
@RestController
|
||||
@RequestMapping("/api/platform")
|
||||
@ -73,7 +72,7 @@ public class PlatformController {
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation("获取国标服务的配置")
|
||||
@Operation(summary = "获取国标服务的配置")
|
||||
@GetMapping("/server_config")
|
||||
public ResponseEntity<JSONObject> serverConfig() {
|
||||
JSONObject result = new JSONObject();
|
||||
@ -89,7 +88,8 @@ public class PlatformController {
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation("获取国标服务的配置")
|
||||
@Operation(summary = "获取级联服务器信息")
|
||||
@Parameter(name = "id", description = "平台国标编号", required = true)
|
||||
@GetMapping("/info/{id}")
|
||||
public ResponseEntity<WVPResult<ParentPlatform>> getPlatform(@PathVariable String id) {
|
||||
ParentPlatform parentPlatform = storager.queryParentPlatByServerGBId(id);
|
||||
@ -112,12 +112,10 @@ public class PlatformController {
|
||||
* @param count 每页条数
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation("分页查询级联平台")
|
||||
@GetMapping("/query/{count}/{page}")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "page", value = "当前页", dataTypeClass = Integer.class),
|
||||
@ApiImplicitParam(name = "count", value = "每页条数", dataTypeClass = Integer.class),
|
||||
})
|
||||
@Operation(summary = "分页查询级联平台")
|
||||
@Parameter(name = "page", description = "当前页", required = true)
|
||||
@Parameter(name = "count", description = "每页条数", required = true)
|
||||
public PageInfo<ParentPlatform> platforms(@PathVariable int page, @PathVariable int count) {
|
||||
|
||||
PageInfo<ParentPlatform> parentPlatformPageInfo = storager.queryParentPlatformList(page, count);
|
||||
@ -136,10 +134,7 @@ public class PlatformController {
|
||||
* @param parentPlatform
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation("添加上级平台信息")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "parentPlatform", value = "上级平台信息", dataTypeClass = ParentPlatform.class),
|
||||
})
|
||||
@Operation(summary = "添加上级平台信息")
|
||||
@PostMapping("/add")
|
||||
@ResponseBody
|
||||
public ResponseEntity<WVPResult<String>> addPlatform(@RequestBody ParentPlatform parentPlatform) {
|
||||
@ -211,10 +206,7 @@ public class PlatformController {
|
||||
* @param parentPlatform
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation("保存上级平台信息")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "parentPlatform", value = "上级平台信息", dataTypeClass = ParentPlatform.class),
|
||||
})
|
||||
@Operation(summary = "保存上级平台信息")
|
||||
@PostMapping("/save")
|
||||
@ResponseBody
|
||||
public ResponseEntity<WVPResult<String>> savePlatform(@RequestBody ParentPlatform parentPlatform) {
|
||||
@ -286,10 +278,8 @@ public class PlatformController {
|
||||
* @param serverGBId 上级平台国标ID
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation("删除上级平台")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "serverGBId", value = "上级平台国标ID", dataTypeClass = String.class),
|
||||
})
|
||||
@Operation(summary = "删除上级平台")
|
||||
@Parameter(name = "serverGBId", description = "上级平台的国标编号")
|
||||
@DeleteMapping("/delete/{serverGBId}")
|
||||
@ResponseBody
|
||||
public ResponseEntity<String> deletePlatform(@PathVariable String serverGBId) {
|
||||
@ -339,17 +329,12 @@ public class PlatformController {
|
||||
* @param serverGBId 上级平台国标ID
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation("查询上级平台是否存在")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "serverGBId", value = "上级平台国标ID", dataTypeClass = String.class),
|
||||
})
|
||||
@Operation(summary = "查询上级平台是否存在")
|
||||
@Parameter(name = "serverGBId", description = "上级平台的国标编号")
|
||||
@GetMapping("/exit/{serverGBId}")
|
||||
@ResponseBody
|
||||
public ResponseEntity<String> exitPlatform(@PathVariable String serverGBId) {
|
||||
|
||||
// if (logger.isDebugEnabled()) {
|
||||
// logger.debug("查询上级平台是否存在API调用:" + serverGBId);
|
||||
// }
|
||||
ParentPlatform parentPlatform = storager.queryParentPlatByServerGBId(serverGBId);
|
||||
return new ResponseEntity<>(String.valueOf(parentPlatform != null), HttpStatus.OK);
|
||||
}
|
||||
@ -365,16 +350,14 @@ public class PlatformController {
|
||||
* @param channelType 通道类型
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation("分页查询级联平台的所有所有通道")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "page", value = "当前页", dataTypeClass = Integer.class),
|
||||
@ApiImplicitParam(name = "count", value = "每页条数", dataTypeClass = Integer.class),
|
||||
@ApiImplicitParam(name = "platformId", value = "上级平台ID", dataTypeClass = String.class),
|
||||
@ApiImplicitParam(name = "catalogId", value = "目录ID", dataTypeClass = String.class),
|
||||
@ApiImplicitParam(name = "query", value = "查询内容", dataTypeClass = String.class),
|
||||
@ApiImplicitParam(name = "online", value = "是否在线", dataTypeClass = Boolean.class),
|
||||
@ApiImplicitParam(name = "channelType", value = "通道类型", dataTypeClass = Boolean.class),
|
||||
})
|
||||
@Operation(summary = "查询上级平台是否存在")
|
||||
@Parameter(name = "page", description = "当前页", required = true)
|
||||
@Parameter(name = "count", description = "每页条数", required = true)
|
||||
@Parameter(name = "platformId", description = "上级平台的国标编号")
|
||||
@Parameter(name = "catalogId", description = "目录ID")
|
||||
@Parameter(name = "query", description = "查询内容")
|
||||
@Parameter(name = "online", description = "是否在线")
|
||||
@Parameter(name = "channelType", description = "通道类型")
|
||||
@GetMapping("/channel_list")
|
||||
@ResponseBody
|
||||
public PageInfo<ChannelReduce> channelList(int page, int count,
|
||||
@ -384,9 +367,6 @@ public class PlatformController {
|
||||
@RequestParam(required = false) Boolean online,
|
||||
@RequestParam(required = false) Boolean channelType) {
|
||||
|
||||
// if (logger.isDebugEnabled()) {
|
||||
// logger.debug("查询所有所有通道API调用");
|
||||
// }
|
||||
if (StringUtils.isEmpty(platformId)) {
|
||||
platformId = null;
|
||||
}
|
||||
@ -407,10 +387,7 @@ public class PlatformController {
|
||||
* @param param 通道关联参数
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation("向上级平台添加国标通道")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "param", value = "通道关联参数", dataTypeClass = UpdateChannelParam.class),
|
||||
})
|
||||
@Operation(summary = "向上级平台添加国标通道")
|
||||
@PostMapping("/update_channel_for_gb")
|
||||
@ResponseBody
|
||||
public ResponseEntity<String> updateChannelForGB(@RequestBody UpdateChannelParam param) {
|
||||
@ -429,10 +406,7 @@ public class PlatformController {
|
||||
* @param param 通道关联参数
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation("从上级平台移除国标通道")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "param", value = "通道关联参数", dataTypeClass = UpdateChannelParam.class),
|
||||
})
|
||||
@Operation(summary = "从上级平台移除国标通道")
|
||||
@DeleteMapping("/del_channel_for_gb")
|
||||
@ResponseBody
|
||||
public ResponseEntity<String> delChannelForGB(@RequestBody UpdateChannelParam param) {
|
||||
@ -452,11 +426,9 @@ public class PlatformController {
|
||||
* @param parentId 目录父ID
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation("获取目录")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "platformId", value = "平台ID", dataTypeClass = String.class, required = true),
|
||||
@ApiImplicitParam(name = "parentId", value = "目录父ID", dataTypeClass = String.class, required = true),
|
||||
})
|
||||
@Operation(summary = "获取目录")
|
||||
@Parameter(name = "platformId", description = "上级平台的国标编号", required = true)
|
||||
@Parameter(name = "parentId", description = "父级目录的国标编号", required = true)
|
||||
@GetMapping("/catalog")
|
||||
@ResponseBody
|
||||
public ResponseEntity<WVPResult<List<PlatformCatalog>>> getCatalogByPlatform(String platformId, String parentId) {
|
||||
@ -472,11 +444,6 @@ public class PlatformController {
|
||||
parentId = platform.getDeviceGBId();
|
||||
}
|
||||
List<PlatformCatalog> platformCatalogList = storager.getChildrenCatalogByPlatform(platformId, parentId);
|
||||
// if (platform.getTreeType().equals(TreeType.BUSINESS_GROUP)) {
|
||||
// platformCatalogList = storager.getChildrenCatalogByPlatform(platformId, parentId);
|
||||
// }else {
|
||||
//
|
||||
// }
|
||||
|
||||
WVPResult<List<PlatformCatalog>> result = new WVPResult<>();
|
||||
result.setCode(0);
|
||||
@ -491,10 +458,7 @@ public class PlatformController {
|
||||
* @param platformCatalog 目录
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation("添加目录")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "platformCatalog", value = "目录信息", dataTypeClass = PlatformCatalog.class, required = true),
|
||||
})
|
||||
@Operation(summary = "添加目录")
|
||||
@PostMapping("/catalog/add")
|
||||
@ResponseBody
|
||||
public ResponseEntity<WVPResult<List<PlatformCatalog>>> addCatalog(@RequestBody PlatformCatalog platformCatalog) {
|
||||
@ -528,10 +492,7 @@ public class PlatformController {
|
||||
* @param platformCatalog 目录
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation("编辑目录")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "platformCatalog", value = "目录信息", dataTypeClass = PlatformCatalog.class, required = true),
|
||||
})
|
||||
@Operation(summary = "编辑目录")
|
||||
@PostMapping("/catalog/edit")
|
||||
@ResponseBody
|
||||
public ResponseEntity<WVPResult<List<PlatformCatalog>>> editCatalog(@RequestBody PlatformCatalog platformCatalog) {
|
||||
@ -561,12 +522,12 @@ public class PlatformController {
|
||||
* 删除目录
|
||||
*
|
||||
* @param id 目录Id
|
||||
* @param platformId 平台Id
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation("删除目录")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "id", value = "目录Id", dataTypeClass = String.class, required = true),
|
||||
})
|
||||
@Operation(summary = "删除目录")
|
||||
@Parameter(name = "id", description = "目录Id", required = true)
|
||||
@Parameter(name = "platformId", description = "平台Id", required = true)
|
||||
@DeleteMapping("/catalog/del")
|
||||
@ResponseBody
|
||||
public ResponseEntity<WVPResult<String>> delCatalog(String id, String platformId) {
|
||||
@ -609,10 +570,7 @@ public class PlatformController {
|
||||
* @param platformCatalog 关联的信息
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation("删除关联")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "platformCatalog", value = "关联的信息", dataTypeClass = PlatformCatalog.class, required = true),
|
||||
})
|
||||
@Operation(summary = "删除关联")
|
||||
@DeleteMapping("/catalog/relation/del")
|
||||
@ResponseBody
|
||||
public ResponseEntity<WVPResult<List<PlatformCatalog>>> delRelation(@RequestBody PlatformCatalog platformCatalog) {
|
||||
@ -641,11 +599,9 @@ public class PlatformController {
|
||||
* @param catalogId 目录Id
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation("修改默认目录")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "platformId", value = "平台Id", dataTypeClass = String.class, required = true),
|
||||
@ApiImplicitParam(name = "catalogId", value = "目录Id", dataTypeClass = String.class, required = true),
|
||||
})
|
||||
@Operation(summary = "修改默认目录")
|
||||
@Parameter(name = "catalogId", description = "目录Id", required = true)
|
||||
@Parameter(name = "platformId", description = "平台Id", required = true)
|
||||
@PostMapping("/catalog/default/update")
|
||||
@ResponseBody
|
||||
public ResponseEntity<WVPResult<String>> setDefaultCatalog(String platformId, String catalogId) {
|
||||
|
@ -1,55 +1,66 @@
|
||||
package com.genersoft.iot.vmp.vmanager.gb28181.platform.bean;
|
||||
|
||||
import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
/**
|
||||
* 精简的channel信息展示,主要是选择通道的时候展示列表使用
|
||||
*/
|
||||
@Schema(description = "精简的channel信息展示")
|
||||
public class ChannelReduce {
|
||||
|
||||
/**
|
||||
* deviceChannel的数据库自增ID
|
||||
*/
|
||||
@Schema(description = "deviceChannel的数据库自增ID")
|
||||
private int id;
|
||||
|
||||
/**
|
||||
* 通道id
|
||||
*/
|
||||
@Schema(description = "通道国标编号")
|
||||
private String channelId;
|
||||
|
||||
/**
|
||||
* 设备id
|
||||
*/
|
||||
@Schema(description = "设备国标编号")
|
||||
private String deviceId;
|
||||
|
||||
/**
|
||||
* 通道名
|
||||
*/
|
||||
@Schema(description = "通道名")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 生产厂商
|
||||
*/
|
||||
@Schema(description = "生产厂商")
|
||||
private String manufacturer;
|
||||
|
||||
/**
|
||||
* wan地址
|
||||
*/
|
||||
@Schema(description = "wan地址")
|
||||
private String hostAddress;
|
||||
|
||||
/**
|
||||
* 子节点数
|
||||
*/
|
||||
@Schema(description = "子节点数")
|
||||
private int subCount;
|
||||
|
||||
/**
|
||||
* 平台Id
|
||||
*/
|
||||
@Schema(description = "平台上级国标编号")
|
||||
private String platformId;
|
||||
|
||||
/**
|
||||
* 目录Id
|
||||
*/
|
||||
@Schema(description = "目录国标编号")
|
||||
private String catalogId;
|
||||
|
||||
public int getId() {
|
||||
|
@ -1,10 +1,23 @@
|
||||
package com.genersoft.iot.vmp.vmanager.gb28181.platform.bean;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 通道关联参数
|
||||
* @author lin
|
||||
*/
|
||||
@Schema(description = "通道关联参数")
|
||||
public class UpdateChannelParam {
|
||||
|
||||
@Schema(description = "上级平台的国标编号")
|
||||
private String platformId;
|
||||
|
||||
@Schema(description = "目录的国标编号")
|
||||
private String catalogId;
|
||||
|
||||
@Schema(description = "")
|
||||
private List<ChannelReduce> channelReduces;
|
||||
|
||||
public String getPlatformId() {
|
||||
|
@ -15,10 +15,10 @@ import com.genersoft.iot.vmp.vmanager.bean.WVPResult;
|
||||
import com.genersoft.iot.vmp.vmanager.gb28181.play.bean.PlayResult;
|
||||
import com.genersoft.iot.vmp.service.IMediaService;
|
||||
import com.genersoft.iot.vmp.service.IPlayService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@ -39,7 +39,7 @@ import org.springframework.web.context.request.async.DeferredResult;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
@Api(tags = "国标设备点播")
|
||||
@Tag(name = "国标设备点播")
|
||||
@CrossOrigin
|
||||
@RestController
|
||||
@RequestMapping("/api/play")
|
||||
@ -74,11 +74,9 @@ public class PlayController {
|
||||
@Autowired
|
||||
private IMediaServerService mediaServerService;
|
||||
|
||||
@ApiOperation("开始点播")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "deviceId", value = "设备ID", dataTypeClass = String.class),
|
||||
@ApiImplicitParam(name = "channelId", value = "通道ID", dataTypeClass = String.class),
|
||||
})
|
||||
@Operation(summary = "开始点播")
|
||||
@Parameter(name = "deviceId", description = "设备国标编号", required = true)
|
||||
@Parameter(name = "channelId", description = "通道国标编号", required = true)
|
||||
@GetMapping("/start/{deviceId}/{channelId}")
|
||||
public DeferredResult<ResponseEntity<String>> play(@PathVariable String deviceId,
|
||||
@PathVariable String channelId) {
|
||||
@ -91,11 +89,10 @@ public class PlayController {
|
||||
return playResult.getResult();
|
||||
}
|
||||
|
||||
@ApiOperation("停止点播")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "deviceId", value = "设备ID", dataTypeClass = String.class),
|
||||
@ApiImplicitParam(name = "channelId", value = "通道ID", dataTypeClass = String.class),
|
||||
})
|
||||
|
||||
@Operation(summary = "停止点播")
|
||||
@Parameter(name = "deviceId", description = "设备国标编号", required = true)
|
||||
@Parameter(name = "channelId", description = "通道国标编号", required = true)
|
||||
@GetMapping("/stop/{deviceId}/{channelId}")
|
||||
public DeferredResult<ResponseEntity<String>> playStop(@PathVariable String deviceId, @PathVariable String channelId) {
|
||||
|
||||
@ -164,10 +161,8 @@ public class PlayController {
|
||||
* @param streamId 流ID
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation("将不是h264的视频通过ffmpeg 转码为h264 + aac")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "streamId", value = "视频流ID", dataTypeClass = String.class),
|
||||
})
|
||||
@Operation(summary = "将不是h264的视频通过ffmpeg 转码为h264 + aac")
|
||||
@Parameter(name = "streamId", description = "视频流ID", required = true)
|
||||
@PostMapping("/convert/{streamId}")
|
||||
public ResponseEntity<String> playConvert(@PathVariable String streamId) {
|
||||
StreamInfo streamInfo = redisCatchStorage.queryPlayByStreamId(streamId);
|
||||
@ -211,10 +206,9 @@ public class PlayController {
|
||||
* @param key
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation("结束转码")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "key", value = "视频流key", dataTypeClass = String.class),
|
||||
})
|
||||
@Operation(summary = "结束转码")
|
||||
@Parameter(name = "key", description = "视频流key", required = true)
|
||||
@Parameter(name = "mediaServerId", description = "流媒体服务ID", required = true)
|
||||
@PostMapping("/convertStop/{key}")
|
||||
public ResponseEntity<String> playConvertStop(@PathVariable String key, String mediaServerId) {
|
||||
JSONObject result = new JSONObject();
|
||||
@ -250,10 +244,8 @@ public class PlayController {
|
||||
|
||||
}
|
||||
|
||||
@ApiOperation("语音广播命令")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "deviceId", value = "设备Id", dataTypeClass = String.class),
|
||||
})
|
||||
@Operation(summary = "语音广播命令")
|
||||
@Parameter(name = "deviceId", description = "设备国标编号", required = true)
|
||||
@GetMapping("/broadcast/{deviceId}")
|
||||
@PostMapping("/broadcast/{deviceId}")
|
||||
public DeferredResult<ResponseEntity<String>> broadcastApi(@PathVariable String deviceId) {
|
||||
@ -313,7 +305,7 @@ public class PlayController {
|
||||
return result;
|
||||
}
|
||||
|
||||
@ApiOperation("获取所有的ssrc")
|
||||
@Operation(summary = "获取所有的ssrc")
|
||||
@GetMapping("/ssrc")
|
||||
public WVPResult<JSONObject> getSSRC() {
|
||||
if (logger.isDebugEnabled()) {
|
||||
|
@ -2,14 +2,12 @@ package com.genersoft.iot.vmp.vmanager.gb28181.playback;
|
||||
|
||||
import com.genersoft.iot.vmp.common.StreamInfo;
|
||||
import com.genersoft.iot.vmp.gb28181.transmit.callback.DeferredResultHolder;
|
||||
//import com.genersoft.iot.vmp.media.zlm.ZLMRESTfulUtils;
|
||||
import com.genersoft.iot.vmp.service.IMediaServerService;
|
||||
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
|
||||
import com.genersoft.iot.vmp.service.IPlayService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@ -28,7 +26,7 @@ import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommander;
|
||||
import com.genersoft.iot.vmp.storager.IVideoManagerStorage;
|
||||
import org.springframework.web.context.request.async.DeferredResult;
|
||||
|
||||
@Api(tags = "视频回放")
|
||||
@Tag(name = "视频回放")
|
||||
@CrossOrigin
|
||||
@RestController
|
||||
@RequestMapping("/api/playback")
|
||||
@ -45,25 +43,17 @@ public class PlaybackController {
|
||||
@Autowired
|
||||
private IRedisCatchStorage redisCatchStorage;
|
||||
|
||||
// @Autowired
|
||||
// private ZLMRESTfulUtils zlmresTfulUtils;
|
||||
|
||||
@Autowired
|
||||
private IPlayService playService;
|
||||
|
||||
@Autowired
|
||||
private DeferredResultHolder resultHolder;
|
||||
|
||||
@Autowired
|
||||
private IMediaServerService mediaServerService;
|
||||
|
||||
@ApiOperation("开始视频回放")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "deviceId", value = "设备ID", dataTypeClass = String.class),
|
||||
@ApiImplicitParam(name = "channelId", value = "通道ID", dataTypeClass = String.class),
|
||||
@ApiImplicitParam(name = "startTime", value = "开始时间", dataTypeClass = String.class),
|
||||
@ApiImplicitParam(name = "endTime", value = "结束时间", dataTypeClass = String.class),
|
||||
})
|
||||
@Operation(summary = "开始视频回放")
|
||||
@Parameter(name = "deviceId", description = "设备国标编号", required = true)
|
||||
@Parameter(name = "channelId", description = "通道国标编号", required = true)
|
||||
@Parameter(name = "startTime", description = "开始时间", required = true)
|
||||
@Parameter(name = "endTime", description = "结束时间", required = true)
|
||||
@GetMapping("/start/{deviceId}/{channelId}")
|
||||
public DeferredResult<ResponseEntity<String>> play(@PathVariable String deviceId, @PathVariable String channelId,
|
||||
String startTime,String endTime) {
|
||||
@ -79,12 +69,11 @@ public class PlaybackController {
|
||||
return result;
|
||||
}
|
||||
|
||||
@ApiOperation("停止视频回放")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "deviceId", value = "设备ID", dataTypeClass = String.class),
|
||||
@ApiImplicitParam(name = "channelId", value = "通道ID", dataTypeClass = String.class),
|
||||
@ApiImplicitParam(name = "stream", value = "流ID", dataTypeClass = String.class),
|
||||
})
|
||||
|
||||
@Operation(summary = "停止视频回放")
|
||||
@Parameter(name = "deviceId", description = "设备国标编号", required = true)
|
||||
@Parameter(name = "channelId", description = "通道国标编号", required = true)
|
||||
@Parameter(name = "stream", description = "流ID", required = true)
|
||||
@GetMapping("/stop/{deviceId}/{channelId}/{stream}")
|
||||
public ResponseEntity<String> playStop(
|
||||
@PathVariable String deviceId,
|
||||
@ -111,10 +100,9 @@ public class PlaybackController {
|
||||
}
|
||||
}
|
||||
|
||||
@ApiOperation("回放暂停")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "streamId", value = "回放流ID", dataTypeClass = String.class),
|
||||
})
|
||||
|
||||
@Operation(summary = "回放暂停")
|
||||
@Parameter(name = "streamId", description = "回放流ID", required = true)
|
||||
@GetMapping("/pause/{streamId}")
|
||||
public ResponseEntity<String> playPause(@PathVariable String streamId) {
|
||||
logger.info("playPause: "+streamId);
|
||||
@ -131,10 +119,9 @@ public class PlaybackController {
|
||||
return new ResponseEntity<String>(json.toString(), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@ApiOperation("回放恢复")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "streamId", value = "回放流ID", dataTypeClass = String.class),
|
||||
})
|
||||
|
||||
@Operation(summary = "回放恢复")
|
||||
@Parameter(name = "streamId", description = "回放流ID", required = true)
|
||||
@GetMapping("/resume/{streamId}")
|
||||
public ResponseEntity<String> playResume(@PathVariable String streamId) {
|
||||
logger.info("playResume: "+streamId);
|
||||
@ -151,11 +138,10 @@ public class PlaybackController {
|
||||
return new ResponseEntity<String>(json.toString(), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@ApiOperation("回放拖动播放")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "streamId", value = "回放流ID", dataTypeClass = String.class),
|
||||
@ApiImplicitParam(name = "seekTime", value = "拖动偏移量,单位s", dataTypeClass = Long.class),
|
||||
})
|
||||
|
||||
@Operation(summary = "回放拖动播放")
|
||||
@Parameter(name = "streamId", description = "回放流ID", required = true)
|
||||
@Parameter(name = "seekTime", description = "拖动偏移量,单位s", required = true)
|
||||
@GetMapping("/seek/{streamId}/{seekTime}")
|
||||
public ResponseEntity<String> playSeek(@PathVariable String streamId, @PathVariable long seekTime) {
|
||||
logger.info("playSeek: "+streamId+", "+seekTime);
|
||||
@ -172,11 +158,9 @@ public class PlaybackController {
|
||||
return new ResponseEntity<String>(json.toString(), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@ApiOperation("回放倍速播放")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "streamId", value = "回放流ID", dataTypeClass = String.class),
|
||||
@ApiImplicitParam(name = "speed", value = "倍速0.25 0.5 1、2、4", dataTypeClass = Double.class),
|
||||
})
|
||||
@Operation(summary = "回放倍速播放")
|
||||
@Parameter(name = "streamId", description = "回放流ID", required = true)
|
||||
@Parameter(name = "speed", description = "倍速0.25 0.5 1、2、4", required = true)
|
||||
@GetMapping("/speed/{streamId}/{speed}")
|
||||
public ResponseEntity<String> playSpeed(@PathVariable String streamId, @PathVariable Double speed) {
|
||||
logger.info("playSpeed: "+streamId+", "+speed);
|
||||
|
@ -1,9 +1,9 @@
|
||||
package com.genersoft.iot.vmp.vmanager.gb28181.ptz;
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@ -21,7 +21,7 @@ import com.genersoft.iot.vmp.storager.IVideoManagerStorage;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
@Api(tags = "云台控制")
|
||||
@Tag(name = "云台控制")
|
||||
@CrossOrigin
|
||||
@RestController
|
||||
@RequestMapping("/api/ptz")
|
||||
@ -48,15 +48,14 @@ public class PtzController {
|
||||
* @param zoomSpeed 缩放速度
|
||||
* @return String 控制结果
|
||||
*/
|
||||
@ApiOperation("云台控制")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "deviceId", value = "设备ID", dataTypeClass = String.class),
|
||||
@ApiImplicitParam(name = "channelId", value = "通道ID", dataTypeClass = String.class),
|
||||
@ApiImplicitParam(name = "command", value = "控制指令,允许值: left, right, up, down, upleft, upright, downleft, downright, zoomin, zoomout, stop", dataTypeClass = String.class),
|
||||
@ApiImplicitParam(name = "horizonSpeed", value = "水平速度", dataTypeClass = Integer.class),
|
||||
@ApiImplicitParam(name = "verticalSpeed", value = "垂直速度", dataTypeClass = Integer.class),
|
||||
@ApiImplicitParam(name = "zoomSpeed", value = "缩放速度", dataTypeClass = Integer.class),
|
||||
})
|
||||
|
||||
@Operation(summary = "云台控制")
|
||||
@Parameter(name = "deviceId", description = "设备国标编号", required = true)
|
||||
@Parameter(name = "channelId", description = "通道国标编号", required = true)
|
||||
@Parameter(name = "command", description = "控制指令,允许值: left, right, up, down, upleft, upright, downleft, downright, zoomin, zoomout, stop", required = true)
|
||||
@Parameter(name = "horizonSpeed", description = "水平速度", required = true)
|
||||
@Parameter(name = "verticalSpeed", description = "垂直速度", required = true)
|
||||
@Parameter(name = "zoomSpeed", description = "缩放速度", required = true)
|
||||
@PostMapping("/control/{deviceId}/{channelId}")
|
||||
public ResponseEntity<String> ptz(@PathVariable String deviceId,@PathVariable String channelId, String command, int horizonSpeed, int verticalSpeed, int zoomSpeed){
|
||||
|
||||
@ -106,15 +105,14 @@ public class PtzController {
|
||||
return new ResponseEntity<String>("success",HttpStatus.OK);
|
||||
}
|
||||
|
||||
@ApiOperation("通用前端控制命令")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "deviceId", value = "设备ID", dataTypeClass = String.class),
|
||||
@ApiImplicitParam(name = "channelId", value = "通道ID", dataTypeClass = String.class),
|
||||
@ApiImplicitParam(name = "cmdCode", value = "指令码", dataTypeClass = Integer.class),
|
||||
@ApiImplicitParam(name = "parameter1", value = "数据一", dataTypeClass = Integer.class),
|
||||
@ApiImplicitParam(name = "parameter2", value = "数据二", dataTypeClass = Integer.class),
|
||||
@ApiImplicitParam(name = "combindCode2", value = "组合码二", dataTypeClass = Integer.class),
|
||||
})
|
||||
|
||||
@Operation(summary = "通用前端控制命令")
|
||||
@Parameter(name = "deviceId", description = "设备国标编号", required = true)
|
||||
@Parameter(name = "channelId", description = "通道国标编号", required = true)
|
||||
@Parameter(name = "cmdCode", description = "指令码", required = true)
|
||||
@Parameter(name = "parameter1", description = "数据一", required = true)
|
||||
@Parameter(name = "parameter2", description = "数据二", required = true)
|
||||
@Parameter(name = "combindCode2", description = "组合码二", required = true)
|
||||
@PostMapping("/front_end_command/{deviceId}/{channelId}")
|
||||
public ResponseEntity<String> frontEndCommand(@PathVariable String deviceId,@PathVariable String channelId,int cmdCode, int parameter1, int parameter2, int combindCode2){
|
||||
|
||||
@ -127,11 +125,10 @@ public class PtzController {
|
||||
return new ResponseEntity<String>("success",HttpStatus.OK);
|
||||
}
|
||||
|
||||
@ApiOperation("预置位查询")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "deviceId", value = "设备ID", dataTypeClass = String.class),
|
||||
@ApiImplicitParam(name = "channelId", value = "通道ID", dataTypeClass = String.class),
|
||||
})
|
||||
|
||||
@Operation(summary = "预置位查询")
|
||||
@Parameter(name = "deviceId", description = "设备国标编号", required = true)
|
||||
@Parameter(name = "channelId", description = "通道国标编号", required = true)
|
||||
@GetMapping("/preset/query/{deviceId}/{channelId}")
|
||||
public DeferredResult<ResponseEntity<String>> presetQueryApi(@PathVariable String deviceId, @PathVariable String channelId) {
|
||||
if (logger.isDebugEnabled()) {
|
||||
|
@ -7,10 +7,10 @@ import com.genersoft.iot.vmp.service.IMediaServerService;
|
||||
import com.genersoft.iot.vmp.service.IPlayService;
|
||||
import com.genersoft.iot.vmp.utils.DateUtil;
|
||||
import com.genersoft.iot.vmp.vmanager.bean.WVPResult;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@ -32,7 +32,7 @@ import com.genersoft.iot.vmp.storager.IVideoManagerStorage;
|
||||
import java.time.LocalDate;
|
||||
import java.util.UUID;
|
||||
|
||||
@Api(tags = "国标录像")
|
||||
@Tag(name = "国标录像")
|
||||
@CrossOrigin
|
||||
@RestController
|
||||
@RequestMapping("/api/gb_record")
|
||||
@ -52,16 +52,11 @@ public class GBRecordController {
|
||||
@Autowired
|
||||
private IPlayService playService;
|
||||
|
||||
@Autowired
|
||||
private IMediaServerService mediaServerService;
|
||||
|
||||
@ApiOperation("录像查询")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "deviceId", value = "设备ID", dataTypeClass = String.class),
|
||||
@ApiImplicitParam(name = "channelId", value = "通道ID", dataTypeClass = String.class),
|
||||
@ApiImplicitParam(name = "startTime", value = "开始时间", dataTypeClass = String.class),
|
||||
@ApiImplicitParam(name = "endTime", value = "结束时间", dataTypeClass = String.class),
|
||||
})
|
||||
@Operation(summary = "录像查询")
|
||||
@Parameter(name = "deviceId", description = "设备国标编号", required = true)
|
||||
@Parameter(name = "channelId", description = "通道国标编号", required = true)
|
||||
@Parameter(name = "startTime", description = "开始时间", required = true)
|
||||
@Parameter(name = "endTime", description = "结束时间", required = true)
|
||||
@GetMapping("/query/{deviceId}/{channelId}")
|
||||
public DeferredResult<ResponseEntity<WVPResult<RecordInfo>>> recordinfo(@PathVariable String deviceId, @PathVariable String channelId, String startTime, String endTime){
|
||||
|
||||
@ -116,14 +111,13 @@ public class GBRecordController {
|
||||
return result;
|
||||
}
|
||||
|
||||
@ApiOperation("开始历史媒体下载")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "deviceId", value = "设备ID", dataTypeClass = String.class),
|
||||
@ApiImplicitParam(name = "channelId", value = "通道ID", dataTypeClass = String.class),
|
||||
@ApiImplicitParam(name = "startTime", value = "开始时间", dataTypeClass = String.class),
|
||||
@ApiImplicitParam(name = "endTime", value = "结束时间", dataTypeClass = String.class),
|
||||
@ApiImplicitParam(name = "downloadSpeed", value = "下载倍速", dataTypeClass = String.class),
|
||||
})
|
||||
|
||||
@Operation(summary = "开始历史媒体下载")
|
||||
@Parameter(name = "deviceId", description = "设备国标编号", required = true)
|
||||
@Parameter(name = "channelId", description = "通道国标编号", required = true)
|
||||
@Parameter(name = "startTime", description = "开始时间", required = true)
|
||||
@Parameter(name = "endTime", description = "结束时间", required = true)
|
||||
@Parameter(name = "downloadSpeed", description = "下载倍速", required = true)
|
||||
@GetMapping("/download/start/{deviceId}/{channelId}")
|
||||
public DeferredResult<ResponseEntity<String>> download(@PathVariable String deviceId, @PathVariable String channelId,
|
||||
String startTime, String endTime, String downloadSpeed) {
|
||||
@ -184,12 +178,10 @@ public class GBRecordController {
|
||||
return result;
|
||||
}
|
||||
|
||||
@ApiOperation("停止历史媒体下载")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "deviceId", value = "设备ID", dataTypeClass = String.class),
|
||||
@ApiImplicitParam(name = "channelId", value = "通道ID", dataTypeClass = String.class),
|
||||
@ApiImplicitParam(name = "stream", value = "流ID", dataTypeClass = String.class),
|
||||
})
|
||||
@Operation(summary = "停止历史媒体下载")
|
||||
@Parameter(name = "deviceId", description = "设备国标编号", required = true)
|
||||
@Parameter(name = "channelId", description = "通道国标编号", required = true)
|
||||
@Parameter(name = "stream", description = "流ID", required = true)
|
||||
@GetMapping("/download/stop/{deviceId}/{channelId}/{stream}")
|
||||
public ResponseEntity<String> playStop(@PathVariable String deviceId, @PathVariable String channelId, @PathVariable String stream) {
|
||||
|
||||
@ -210,12 +202,10 @@ public class GBRecordController {
|
||||
}
|
||||
}
|
||||
|
||||
@ApiOperation("获取历史媒体下载进度")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "deviceId", value = "设备ID", dataTypeClass = String.class),
|
||||
@ApiImplicitParam(name = "channelId", value = "通道ID", dataTypeClass = String.class),
|
||||
@ApiImplicitParam(name = "stream", value = "流ID", dataTypeClass = String.class),
|
||||
})
|
||||
@Operation(summary = "获取历史媒体下载进度")
|
||||
@Parameter(name = "deviceId", description = "设备国标编号", required = true)
|
||||
@Parameter(name = "channelId", description = "通道国标编号", required = true)
|
||||
@Parameter(name = "stream", description = "流ID", required = true)
|
||||
@GetMapping("/download/progress/{deviceId}/{channelId}/{stream}")
|
||||
public ResponseEntity<StreamInfo> getProgress(@PathVariable String deviceId, @PathVariable String channelId, @PathVariable String stream) {
|
||||
|
||||
|
@ -6,10 +6,10 @@ import com.genersoft.iot.vmp.storager.dao.dto.LogDto;
|
||||
import com.genersoft.iot.vmp.utils.DateUtil;
|
||||
import com.genersoft.iot.vmp.vmanager.bean.WVPResult;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@ -20,7 +20,7 @@ import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.text.ParseException;
|
||||
|
||||
@Api(tags = "日志管理")
|
||||
@Tag(name = "日志管理")
|
||||
@CrossOrigin
|
||||
@RestController
|
||||
@RequestMapping("/api/log")
|
||||
@ -45,16 +45,14 @@ public class LogController {
|
||||
* @param endTime 结束时间
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation("分页查询报警")
|
||||
@GetMapping("/all")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name="query", value = "查询内容", dataTypeClass = String.class),
|
||||
@ApiImplicitParam(name="page", value = "当前页", required = true ,dataTypeClass = Integer.class),
|
||||
@ApiImplicitParam(name="count", value = "每页查询数量", required = true ,dataTypeClass = Integer.class),
|
||||
@ApiImplicitParam(name="type", value = "类型" ,dataTypeClass = String.class),
|
||||
@ApiImplicitParam(name="startTime", value = "查询内容" ,dataTypeClass = String.class),
|
||||
@ApiImplicitParam(name="endTime", value = "查询内容" ,dataTypeClass = String.class),
|
||||
})
|
||||
@Operation(summary = "分页查询报警")
|
||||
@Parameter(name = "query", description = "查询内容", required = true)
|
||||
@Parameter(name = "page", description = "当前页", required = true)
|
||||
@Parameter(name = "count", description = "每页查询数量", required = true)
|
||||
@Parameter(name = "type", description = "类型", required = true)
|
||||
@Parameter(name = "startTime", description = "开始时间", required = true)
|
||||
@Parameter(name = "endTime", description = "结束时间", required = true)
|
||||
public ResponseEntity<PageInfo<LogDto>> getAll(
|
||||
@RequestParam int page,
|
||||
@RequestParam int count,
|
||||
@ -88,9 +86,8 @@ public class LogController {
|
||||
* 清空日志
|
||||
*
|
||||
*/
|
||||
@ApiOperation("清空日志")
|
||||
@Operation(summary = "停止视频回放")
|
||||
@DeleteMapping("/clear")
|
||||
@ApiImplicitParams({})
|
||||
public ResponseEntity<WVPResult<String>> clear() {
|
||||
|
||||
int count = logService.clear();
|
||||
|
@ -13,7 +13,7 @@
|
||||
//import org.springframework.beans.factory.annotation.Autowired;
|
||||
//import org.springframework.web.bind.annotation.*;
|
||||
//
|
||||
//@Api(tags = "云端录像")
|
||||
//@Tag(name = "云端录像")
|
||||
//@CrossOrigin
|
||||
//@RestController
|
||||
//@RequestMapping("/api/record")
|
||||
@ -22,7 +22,7 @@
|
||||
// @Autowired
|
||||
// private IRecordInfoServer recordInfoServer;
|
||||
//
|
||||
// @ApiOperation("录像列表查询")
|
||||
// //@ApiOperation("录像列表查询")
|
||||
// @ApiImplicitParams({
|
||||
// @ApiImplicitParam(name="page", value = "当前页", required = true, dataTypeClass = Integer.class),
|
||||
// @ApiImplicitParam(name="count", value = "每页查询数量", required = true, dataTypeClass = Integer.class),
|
||||
@ -37,7 +37,7 @@
|
||||
// return recordList;
|
||||
// }
|
||||
//
|
||||
// @ApiOperation("获取录像详情")
|
||||
// //@ApiOperation("获取录像详情")
|
||||
// @ApiImplicitParams({
|
||||
// @ApiImplicitParam(name="recordInfo", value = "录像记录", required = true, dataTypeClass = RecordInfo.class)
|
||||
// })
|
||||
|
@ -15,10 +15,10 @@ import com.genersoft.iot.vmp.service.IMediaServerService;
|
||||
import com.genersoft.iot.vmp.utils.SpringBeanFactory;
|
||||
import com.genersoft.iot.vmp.vmanager.bean.WVPResult;
|
||||
import gov.nist.javax.sip.SipStackImpl;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.ConfigurableApplicationContext;
|
||||
@ -33,7 +33,7 @@ import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
@Api(tags = "服务控制")
|
||||
@Tag(name = "服务控制")
|
||||
@CrossOrigin
|
||||
@RestController
|
||||
@RequestMapping("/api/server")
|
||||
@ -61,10 +61,10 @@ public class ServerController {
|
||||
private int serverPort;
|
||||
|
||||
|
||||
@ApiOperation("流媒体服务列表")
|
||||
@GetMapping(value = "/media_server/list")
|
||||
@ResponseBody
|
||||
public WVPResult<List<MediaServerItem>> getMediaServerList(boolean detail){
|
||||
@Operation(summary = "流媒体服务列表")
|
||||
public WVPResult<List<MediaServerItem>> getMediaServerList() {
|
||||
WVPResult<List<MediaServerItem>> result = new WVPResult<>();
|
||||
result.setCode(0);
|
||||
result.setMsg("success");
|
||||
@ -72,9 +72,9 @@ public class ServerController {
|
||||
return result;
|
||||
}
|
||||
|
||||
@ApiOperation("在线流媒体服务列表")
|
||||
@GetMapping(value = "/media_server/online/list")
|
||||
@ResponseBody
|
||||
@Operation(summary = "在线流媒体服务列表")
|
||||
public WVPResult<List<MediaServerItem>> getOnlineMediaServerList() {
|
||||
WVPResult<List<MediaServerItem>> result = new WVPResult<>();
|
||||
result.setCode(0);
|
||||
@ -83,9 +83,10 @@ public class ServerController {
|
||||
return result;
|
||||
}
|
||||
|
||||
@ApiOperation("获取流媒体服务")
|
||||
@GetMapping(value = "/media_server/one/{id}")
|
||||
@ResponseBody
|
||||
@Operation(summary = "停止视频回放")
|
||||
@Parameter(name = "id", description = "流媒体服务ID", required = true)
|
||||
public WVPResult<MediaServerItem> getMediaServer(@PathVariable String id) {
|
||||
WVPResult<MediaServerItem> result = new WVPResult<>();
|
||||
result.setCode(0);
|
||||
@ -94,24 +95,19 @@ public class ServerController {
|
||||
return result;
|
||||
}
|
||||
|
||||
@ApiOperation("测试流媒体服务")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name="ip", value = "流媒体服务IP", dataTypeClass = String.class),
|
||||
@ApiImplicitParam(name="port", value = "流媒体服务HTT端口", dataTypeClass = Integer.class),
|
||||
@ApiImplicitParam(name="secret", value = "流媒体服务secret", dataTypeClass = String.class),
|
||||
})
|
||||
@Operation(summary = "测试流媒体服务")
|
||||
@Parameter(name = "ip", description = "流媒体服务IP", required = true)
|
||||
@Parameter(name = "port", description = "流媒体服务HTT端口", required = true)
|
||||
@Parameter(name = "secret", description = "流媒体服务secret", required = true)
|
||||
@GetMapping(value = "/media_server/check")
|
||||
@ResponseBody
|
||||
public WVPResult<MediaServerItem> checkMediaServer(@RequestParam String ip, @RequestParam int port, @RequestParam String secret) {
|
||||
return mediaServerService.checkMediaServer(ip, port, secret);
|
||||
}
|
||||
|
||||
@ApiOperation("测试流媒体录像管理服务")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name="ip", value = "流媒体服务IP", dataTypeClass = String.class),
|
||||
@ApiImplicitParam(name="port", value = "流媒体服务HTT端口", dataTypeClass = Integer.class),
|
||||
@ApiImplicitParam(name="secret", value = "流媒体服务secret", dataTypeClass = String.class),
|
||||
})
|
||||
@Operation(summary = "测试流媒体录像管理服务")
|
||||
@Parameter(name = "ip", description = "流媒体服务IP", required = true)
|
||||
@Parameter(name = "port", description = "流媒体服务HTT端口", required = true)
|
||||
@GetMapping(value = "/media_server/record/check")
|
||||
@ResponseBody
|
||||
public WVPResult<String> checkMediaRecordServer(@RequestParam String ip, @RequestParam int port) {
|
||||
@ -128,18 +124,15 @@ public class ServerController {
|
||||
return result;
|
||||
}
|
||||
|
||||
@ApiOperation("保存流媒体服务")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name="mediaServerItem", value = "流媒体信息", dataTypeClass = MediaServerItem.class)
|
||||
})
|
||||
@Operation(summary = "保存流媒体服务")
|
||||
@Parameter(name = "mediaServerItem", description = "流媒体信息", required = true)
|
||||
@PostMapping(value = "/media_server/save")
|
||||
@ResponseBody
|
||||
public WVPResult<String> saveMediaServer(@RequestBody MediaServerItem mediaServerItem) {
|
||||
MediaServerItem mediaServerItemInDatabase = mediaServerService.getOne(mediaServerItem.getId());
|
||||
|
||||
if (mediaServerItemInDatabase != null) {
|
||||
if (StringUtils.isEmpty(mediaServerItemInDatabase.getSendRtpPortRange())
|
||||
&& StringUtils.isEmpty(mediaServerItem.getSendRtpPortRange())){
|
||||
if (StringUtils.isEmpty(mediaServerItemInDatabase.getSendRtpPortRange()) && StringUtils.isEmpty(mediaServerItem.getSendRtpPortRange())) {
|
||||
mediaServerItem.setSendRtpPortRange("30000,30500");
|
||||
}
|
||||
mediaServerService.update(mediaServerItem);
|
||||
@ -156,10 +149,8 @@ public class ServerController {
|
||||
return result;
|
||||
}
|
||||
|
||||
@ApiOperation("移除流媒体服务")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name="id", value = "流媒体ID", dataTypeClass = String.class)
|
||||
})
|
||||
@Operation(summary = "移除流媒体服务")
|
||||
@Parameter(name = "id", description = "流媒体ID", required = true)
|
||||
@DeleteMapping(value = "/media_server/delete")
|
||||
@ResponseBody
|
||||
public WVPResult<String> deleteMediaServer(@RequestParam String id) {
|
||||
@ -179,8 +170,7 @@ public class ServerController {
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ApiOperation("重启服务")
|
||||
@Operation(summary = "重启服务")
|
||||
@GetMapping(value = "/restart")
|
||||
@ResponseBody
|
||||
public Object restart() {
|
||||
@ -213,7 +203,7 @@ public class ServerController {
|
||||
return "success";
|
||||
}
|
||||
|
||||
@ApiOperation("版本信息")
|
||||
@Operation(summary = "获取版本信息")
|
||||
@GetMapping(value = "/version")
|
||||
@ResponseBody
|
||||
public WVPResult<VersionPo> getVersion() {
|
||||
@ -224,11 +214,9 @@ public class ServerController {
|
||||
return result;
|
||||
}
|
||||
|
||||
@ApiOperation("配置信息")
|
||||
@GetMapping(value = "/config")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name="type", value = "配置类型(sip, base)", dataTypeClass = String.class),
|
||||
})
|
||||
@Operation(summary = "获取配置信息")
|
||||
@Parameter(name = "type", description = "配置类型(sip, base)", required = true)
|
||||
@ResponseBody
|
||||
public WVPResult<JSONObject> getVersion(String type) {
|
||||
WVPResult<JSONObject> result = new WVPResult<>();
|
||||
@ -256,9 +244,9 @@ public class ServerController {
|
||||
return result;
|
||||
}
|
||||
|
||||
@ApiOperation("获取当前所有hook")
|
||||
@GetMapping(value = "/hooks")
|
||||
@ResponseBody
|
||||
@Operation(summary = "获取当前所有hook")
|
||||
public WVPResult<List<IHookSubscribe>> getHooks() {
|
||||
WVPResult<List<IHookSubscribe>> result = new WVPResult<>();
|
||||
result.setCode(0);
|
||||
@ -268,7 +256,7 @@ public class ServerController {
|
||||
return result;
|
||||
}
|
||||
|
||||
// @ApiOperation("当前进行中的动态任务")
|
||||
// //@ApiOperation("当前进行中的动态任务")
|
||||
// @GetMapping(value = "/dynamicTask")
|
||||
// @ResponseBody
|
||||
// public WVPResult<JSONObject> getDynamicTask(){
|
||||
|
@ -10,10 +10,10 @@ import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
|
||||
import com.genersoft.iot.vmp.service.IStreamProxyService;
|
||||
import com.genersoft.iot.vmp.vmanager.bean.WVPResult;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.Parameters;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@ -25,7 +25,7 @@ import org.springframework.web.bind.annotation.*;
|
||||
/**
|
||||
* 拉流代理接口
|
||||
*/
|
||||
@Api(tags = "拉流代理")
|
||||
@Tag(name = "拉流代理", description = "")
|
||||
@Controller
|
||||
@CrossOrigin
|
||||
@RequestMapping(value = "/api/proxy")
|
||||
@ -44,13 +44,11 @@ public class StreamProxyController {
|
||||
private IStreamProxyService streamProxyService;
|
||||
|
||||
|
||||
@ApiOperation("分页查询流代理")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name="page", value = "当前页", required = true, dataTypeClass = Integer.class),
|
||||
@ApiImplicitParam(name="count", value = "每页查询数量", required = true, dataTypeClass = Integer.class),
|
||||
@ApiImplicitParam(name="query", value = "查询内容", dataTypeClass = String.class),
|
||||
@ApiImplicitParam(name="online", value = "是否在线", dataTypeClass = Boolean.class),
|
||||
})
|
||||
@Operation(summary = "分页查询流代理")
|
||||
@Parameter(name = "page", description = "当前页")
|
||||
@Parameter(name = "count", description = "每页查询数量")
|
||||
@Parameter(name = "query", description = "查询内容")
|
||||
@Parameter(name = "online", description = "是否在线")
|
||||
@GetMapping(value = "/list")
|
||||
@ResponseBody
|
||||
public PageInfo<StreamProxyItem> list(@RequestParam(required = false)Integer page,
|
||||
@ -61,9 +59,8 @@ public class StreamProxyController {
|
||||
return streamProxyService.getAll(page, count);
|
||||
}
|
||||
|
||||
@ApiOperation("保存代理")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "param", value = "代理参数", dataTypeClass = StreamProxyItem.class),
|
||||
@Operation(summary = "保存代理", parameters = {
|
||||
@Parameter(name = "param", description = "代理参数", required = true),
|
||||
})
|
||||
@PostMapping(value = "/save")
|
||||
@ResponseBody
|
||||
@ -82,12 +79,10 @@ public class StreamProxyController {
|
||||
return result;
|
||||
}
|
||||
|
||||
@ApiOperation("获取ffmpeg.cmd模板")
|
||||
@GetMapping(value = "/ffmpeg_cmd/list")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "mediaServerId", value = "流媒体ID", dataTypeClass = String.class),
|
||||
})
|
||||
@ResponseBody
|
||||
@Operation(summary = "获取ffmpeg.cmd模板")
|
||||
@Parameter(name = "mediaServerId", description = "流媒体ID", required = true)
|
||||
public WVPResult getFFmpegCMDs(@RequestParam String mediaServerId){
|
||||
logger.debug("获取节点[ {} ]ffmpeg.cmd模板", mediaServerId );
|
||||
|
||||
@ -100,13 +95,11 @@ public class StreamProxyController {
|
||||
return result;
|
||||
}
|
||||
|
||||
@ApiOperation("移除代理")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "app", value = "应用名", required = true, dataTypeClass = String.class),
|
||||
@ApiImplicitParam(name = "stream", value = "流ID", required = true, dataTypeClass = String.class),
|
||||
})
|
||||
@DeleteMapping(value = "/del")
|
||||
@ResponseBody
|
||||
@Operation(summary = "移除代理")
|
||||
@Parameter(name = "app", description = "应用名", required = true)
|
||||
@Parameter(name = "stream", description = "流id", required = true)
|
||||
public WVPResult del(@RequestParam String app, @RequestParam String stream){
|
||||
logger.info("移除代理: " + app + "/" + stream);
|
||||
WVPResult<Object> result = new WVPResult<>();
|
||||
@ -121,13 +114,11 @@ public class StreamProxyController {
|
||||
return result;
|
||||
}
|
||||
|
||||
@ApiOperation("启用代理")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "app", value = "应用名", dataTypeClass = String.class),
|
||||
@ApiImplicitParam(name = "stream", value = "流ID", dataTypeClass = String.class),
|
||||
})
|
||||
@GetMapping(value = "/start")
|
||||
@ResponseBody
|
||||
@Operation(summary = "启用代理")
|
||||
@Parameter(name = "app", description = "应用名", required = true)
|
||||
@Parameter(name = "stream", description = "流id", required = true)
|
||||
public Object start(String app, String stream){
|
||||
logger.info("启用代理: " + app + "/" + stream);
|
||||
boolean result = streamProxyService.start(app, stream);
|
||||
@ -137,13 +128,11 @@ public class StreamProxyController {
|
||||
return result?"success":"fail";
|
||||
}
|
||||
|
||||
@ApiOperation("停用代理")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "app", value = "应用名", dataTypeClass = String.class),
|
||||
@ApiImplicitParam(name = "stream", value = "流ID", dataTypeClass = String.class),
|
||||
})
|
||||
@GetMapping(value = "/stop")
|
||||
@ResponseBody
|
||||
@Operation(summary = "停用代理")
|
||||
@Parameter(name = "app", description = "应用名", required = true)
|
||||
@Parameter(name = "stream", description = "流id", required = true)
|
||||
public Object stop(String app, String stream){
|
||||
logger.info("停用代理: " + app + "/" + stream);
|
||||
boolean result = streamProxyService.stop(app, stream);
|
||||
|
@ -20,10 +20,10 @@ import com.genersoft.iot.vmp.vmanager.bean.BatchGBStreamParam;
|
||||
import com.genersoft.iot.vmp.vmanager.bean.StreamPushExcelDto;
|
||||
import com.genersoft.iot.vmp.vmanager.bean.WVPResult;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.apache.poi.sl.usermodel.Sheet;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
@ -44,7 +44,7 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
@Api(tags = "推流信息管理")
|
||||
@Tag(name = "推流信息管理")
|
||||
@Controller
|
||||
@CrossOrigin
|
||||
@RequestMapping(value = "/api/push")
|
||||
@ -67,16 +67,14 @@ public class StreamPushController {
|
||||
@Autowired
|
||||
private UserSetting userSetting;
|
||||
|
||||
@ApiOperation("推流列表查询")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name="page", value = "当前页", required = true, dataTypeClass = Integer.class),
|
||||
@ApiImplicitParam(name="count", value = "每页查询数量", required = true, dataTypeClass = Integer.class),
|
||||
@ApiImplicitParam(name="query", value = "查询内容", dataTypeClass = String.class),
|
||||
@ApiImplicitParam(name="pushing", value = "是否正在推流", dataTypeClass = Boolean.class),
|
||||
@ApiImplicitParam(name="mediaServerId", value = "流媒体ID", dataTypeClass = String.class),
|
||||
})
|
||||
@GetMapping(value = "/list")
|
||||
@ResponseBody
|
||||
@Operation(summary = "推流列表查询")
|
||||
@Parameter(name = "page", description = "当前页")
|
||||
@Parameter(name = "count", description = "每页查询数量")
|
||||
@Parameter(name = "query", description = "查询内容")
|
||||
@Parameter(name = "pushing", description = "是否正在推流")
|
||||
@Parameter(name = "mediaServerId", description = "流媒体ID")
|
||||
public PageInfo<StreamPushItem> list(@RequestParam(required = false)Integer page,
|
||||
@RequestParam(required = false)Integer count,
|
||||
@RequestParam(required = false)String query,
|
||||
@ -93,12 +91,9 @@ public class StreamPushController {
|
||||
return pushList;
|
||||
}
|
||||
|
||||
@ApiOperation("将推流添加到国标")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "stream", value = "直播流关联国标平台", dataTypeClass = GbStream.class),
|
||||
})
|
||||
@PostMapping(value = "/save_to_gb")
|
||||
@ResponseBody
|
||||
@Operation(summary = "将推流添加到国标")
|
||||
public Object saveToGB(@RequestBody GbStream stream){
|
||||
if (streamPushService.saveToGB(stream)){
|
||||
return "success";
|
||||
@ -108,12 +103,9 @@ public class StreamPushController {
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation("将推流移出到国标")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "stream", value = "直播流关联国标平台", dataTypeClass = GbStream.class),
|
||||
})
|
||||
@DeleteMapping(value = "/remove_form_gb")
|
||||
@ResponseBody
|
||||
@Operation(summary = "将推流移出到国标")
|
||||
public Object removeFormGB(@RequestBody GbStream stream){
|
||||
if (streamPushService.removeFromGB(stream)){
|
||||
return "success";
|
||||
@ -123,13 +115,11 @@ public class StreamPushController {
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation("中止一个推流")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "app", value = "应用名", required = true, dataTypeClass = String.class),
|
||||
@ApiImplicitParam(name = "streamId", value = "流ID", required = true, dataTypeClass = String.class),
|
||||
})
|
||||
@PostMapping(value = "/stop")
|
||||
@ResponseBody
|
||||
@Operation(summary = "中止一个推流")
|
||||
@Parameter(name = "app", description = "应用名", required = true)
|
||||
@Parameter(name = "stream", description = "流id", required = true)
|
||||
public Object stop(String app, String streamId){
|
||||
if (streamPushService.stop(app, streamId)){
|
||||
return "success";
|
||||
@ -138,13 +128,9 @@ public class StreamPushController {
|
||||
}
|
||||
}
|
||||
|
||||
@ApiOperation("中止多个推流")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "app", value = "应用名", required = true, dataTypeClass = String.class),
|
||||
@ApiImplicitParam(name = "streamId", value = "流ID", required = true, dataTypeClass = String.class),
|
||||
})
|
||||
@DeleteMapping(value = "/batchStop")
|
||||
@ResponseBody
|
||||
@Operation(summary = "中止多个推流")
|
||||
public Object batchStop(@RequestBody BatchGBStreamParam batchGBStreamParam){
|
||||
if (batchGBStreamParam.getGbStreams().size() == 0) {
|
||||
return "fail";
|
||||
@ -256,14 +242,12 @@ public class StreamPushController {
|
||||
* @param stream 流id
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation("获取推流播放地址")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "app", value = "应用名", dataTypeClass = String.class),
|
||||
@ApiImplicitParam(name = "stream", value = "流id", dataTypeClass = String.class),
|
||||
@ApiImplicitParam(name = "mediaServerId", value = "媒体服务器id", dataTypeClass = String.class, required = false),
|
||||
})
|
||||
@GetMapping(value = "/getPlayUrl")
|
||||
@ResponseBody
|
||||
@Operation(summary = "获取推流播放地址")
|
||||
@Parameter(name = "app", description = "应用名", required = true)
|
||||
@Parameter(name = "stream", description = "流id", required = true)
|
||||
@Parameter(name = "mediaServerId", description = "媒体服务器id")
|
||||
public WVPResult<StreamInfo> getPlayUrl(@RequestParam String app,@RequestParam String stream,
|
||||
@RequestParam(required = false) String mediaServerId){
|
||||
boolean authority = false;
|
||||
@ -297,12 +281,9 @@ public class StreamPushController {
|
||||
* @param stream 推流信息
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation("获取推流播放地址")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "stream", value = "推流信息", dataTypeClass = StreamPushItem.class),
|
||||
})
|
||||
@PostMapping(value = "/add")
|
||||
@ResponseBody
|
||||
@Operation(summary = "停止视频回放")
|
||||
public WVPResult<StreamInfo> add(@RequestBody StreamPushItem stream){
|
||||
if (StringUtils.isEmpty(stream.getGbId())) {
|
||||
|
||||
|
@ -5,10 +5,10 @@ import com.genersoft.iot.vmp.service.IRoleService;
|
||||
import com.genersoft.iot.vmp.storager.dao.dto.Role;
|
||||
import com.genersoft.iot.vmp.utils.DateUtil;
|
||||
import com.genersoft.iot.vmp.vmanager.bean.WVPResult;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
@ -16,7 +16,7 @@ import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Api(tags = "角色管理")
|
||||
@Tag(name = "角色管理")
|
||||
@CrossOrigin
|
||||
@RestController
|
||||
@RequestMapping("/api/role")
|
||||
@ -25,12 +25,10 @@ public class RoleController {
|
||||
@Autowired
|
||||
private IRoleService roleService;
|
||||
|
||||
@ApiOperation("添加角色")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "name", required = true, value = "角色名", dataTypeClass = String.class),
|
||||
@ApiImplicitParam(name = "authority", required = true, value = "权限(自行定义内容,目前未使用)", dataTypeClass = String.class),
|
||||
})
|
||||
@PostMapping("/add")
|
||||
@Operation(summary = "添加角色")
|
||||
@Parameter(name = "name", description = "角色名", required = true)
|
||||
@Parameter(name = "authority", description = "权限(自行定义内容,目前未使用)", required = true)
|
||||
public ResponseEntity<WVPResult<Integer>> add(@RequestParam String name,
|
||||
@RequestParam(required = false) String authority){
|
||||
WVPResult<Integer> result = new WVPResult<>();
|
||||
@ -57,11 +55,9 @@ public class RoleController {
|
||||
return new ResponseEntity<>(result, HttpStatus.OK);
|
||||
}
|
||||
|
||||
@ApiOperation("删除角色")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "id", required = true, value = "用户Id", dataTypeClass = Integer.class),
|
||||
})
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除角色")
|
||||
@Parameter(name = "id", description = "用户Id", required = true)
|
||||
public ResponseEntity<WVPResult<String>> delete(@RequestParam Integer id){
|
||||
// 获取当前登录用户id
|
||||
int currenRoleId = SecurityUtils.getUserInfo().getRole().getId();
|
||||
@ -79,9 +75,8 @@ public class RoleController {
|
||||
return new ResponseEntity<>(result, HttpStatus.OK);
|
||||
}
|
||||
|
||||
@ApiOperation("查询角色")
|
||||
@ApiImplicitParams({})
|
||||
@GetMapping("/all")
|
||||
@Operation(summary = "查询角色")
|
||||
public ResponseEntity<WVPResult<List<Role>>> all(){
|
||||
// 获取当前登录用户id
|
||||
List<Role> allRoles = roleService.getAll();
|
||||
|
@ -9,10 +9,10 @@ import com.genersoft.iot.vmp.storager.dao.dto.User;
|
||||
import com.genersoft.iot.vmp.utils.DateUtil;
|
||||
import com.genersoft.iot.vmp.vmanager.bean.WVPResult;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
@ -24,7 +24,7 @@ import org.springframework.web.bind.annotation.*;
|
||||
import javax.security.sasl.AuthenticationException;
|
||||
import java.util.List;
|
||||
|
||||
@Api(tags = "用户管理")
|
||||
@Tag(name = "用户管理")
|
||||
@CrossOrigin
|
||||
@RestController
|
||||
@RequestMapping("/api/user")
|
||||
@ -39,12 +39,10 @@ public class UserController {
|
||||
@Autowired
|
||||
private IRoleService roleService;
|
||||
|
||||
@ApiOperation("登录")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "username", required = true, value = "用户名", dataTypeClass = String.class),
|
||||
@ApiImplicitParam(name = "password", required = true, value = "密码(32位md5加密)", dataTypeClass = String.class),
|
||||
})
|
||||
@GetMapping("/login")
|
||||
@Operation(summary = "登录")
|
||||
@Parameter(name = "username", description = "用户名", required = true)
|
||||
@Parameter(name = "password", description = "密码(32位md5加密)", required = true)
|
||||
public WVPResult<LoginUser> login(@RequestParam String username, @RequestParam String password){
|
||||
LoginUser user = null;
|
||||
WVPResult<LoginUser> result = new WVPResult<>();
|
||||
@ -66,13 +64,11 @@ public class UserController {
|
||||
return result;
|
||||
}
|
||||
|
||||
@ApiOperation("修改密码")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "username", required = true, value = "用户名", dataTypeClass = String.class),
|
||||
@ApiImplicitParam(name = "oldpassword", required = true, value = "旧密码(已md5加密的密码)", dataTypeClass = String.class),
|
||||
@ApiImplicitParam(name = "password", required = true, value = "新密码(未md5加密的密码)", dataTypeClass = String.class),
|
||||
})
|
||||
@PostMapping("/changePassword")
|
||||
@Operation(summary = "修改密码")
|
||||
@Parameter(name = "username", description = "用户名", required = true)
|
||||
@Parameter(name = "oldpassword", description = "旧密码(已md5加密的密码)", required = true)
|
||||
@Parameter(name = "password", description = "新密码(未md5加密的密码)", required = true)
|
||||
public String changePassword(@RequestParam String oldPassword, @RequestParam String password){
|
||||
// 获取当前登录用户id
|
||||
LoginUser userInfo = SecurityUtils.getUserInfo();
|
||||
@ -97,13 +93,11 @@ public class UserController {
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation("添加用户")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "username", required = true, value = "用户名", dataTypeClass = String.class),
|
||||
@ApiImplicitParam(name = "password", required = true, value = "密码(未md5加密的密码)", dataTypeClass = String.class),
|
||||
@ApiImplicitParam(name = "roleId", required = true, value = "角色ID", dataTypeClass = String.class),
|
||||
})
|
||||
@PostMapping("/add")
|
||||
@Operation(summary = "停止视频回放")
|
||||
@Parameter(name = "username", description = "用户名", required = true)
|
||||
@Parameter(name = "password", description = "密码(未md5加密的密码)", required = true)
|
||||
@Parameter(name = "roleId", description = "角色ID", required = true)
|
||||
public ResponseEntity<WVPResult<Integer>> add(@RequestParam String username,
|
||||
@RequestParam String password,
|
||||
@RequestParam Integer roleId){
|
||||
@ -146,11 +140,9 @@ public class UserController {
|
||||
return new ResponseEntity<>(result, HttpStatus.OK);
|
||||
}
|
||||
|
||||
@ApiOperation("删除用户")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "id", required = true, value = "用户Id", dataTypeClass = Integer.class),
|
||||
})
|
||||
@DeleteMapping("/delete")
|
||||
@DeleteMapping("/删除用户")
|
||||
@Operation(summary = "停止视频回放")
|
||||
@Parameter(name = "id", description = "用户Id", required = true)
|
||||
public ResponseEntity<WVPResult<String>> delete(@RequestParam Integer id){
|
||||
// 获取当前登录用户id
|
||||
int currenRoleId = SecurityUtils.getUserInfo().getRole().getId();
|
||||
@ -168,9 +160,8 @@ public class UserController {
|
||||
return new ResponseEntity<>(result, HttpStatus.OK);
|
||||
}
|
||||
|
||||
@ApiOperation("查询用户")
|
||||
@ApiImplicitParams({})
|
||||
@GetMapping("/all")
|
||||
@Operation(summary = "查询用户")
|
||||
public ResponseEntity<WVPResult<List<User>>> all(){
|
||||
// 获取当前登录用户id
|
||||
List<User> allUsers = userService.getAllUsers();
|
||||
@ -188,22 +179,18 @@ public class UserController {
|
||||
* @param count 每页查询数量
|
||||
* @return 分页用户列表
|
||||
*/
|
||||
@ApiOperation("分页查询用户")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "page", value = "当前页", required = true, dataTypeClass = Integer.class),
|
||||
@ApiImplicitParam(name = "count", value = "每页查询数量", required = true, dataTypeClass = Integer.class),
|
||||
})
|
||||
@GetMapping("/users")
|
||||
@Operation(summary = "分页查询用户")
|
||||
@Parameter(name = "page", description = "当前页", required = true)
|
||||
@Parameter(name = "count", description = "每页查询数量", required = true)
|
||||
public PageInfo<User> users(int page, int count) {
|
||||
return userService.getUsers(page, count);
|
||||
}
|
||||
|
||||
@ApiOperation("修改pushkey")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "userId", required = true, value = "用户Id", dataTypeClass = Integer.class),
|
||||
@ApiImplicitParam(name = "pushKey", required = true, value = "新的pushKey", dataTypeClass = String.class),
|
||||
})
|
||||
@RequestMapping("/changePushKey")
|
||||
@Operation(summary = "修改pushkey")
|
||||
@Parameter(name = "userId", description = "用户Id", required = true)
|
||||
@Parameter(name = "pushKey", description = "新的pushKey", required = true)
|
||||
public ResponseEntity<WVPResult<String>> changePushKey(@RequestParam Integer userId,@RequestParam String pushKey) {
|
||||
// 获取当前登录用户id
|
||||
int currenRoleId = SecurityUtils.getUserInfo().getRole().getId();
|
||||
@ -221,13 +208,11 @@ public class UserController {
|
||||
return new ResponseEntity<>(result, HttpStatus.OK);
|
||||
}
|
||||
|
||||
@ApiOperation("管理员修改普通用户密码")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "adminId", required = true, value = "管理员id", dataTypeClass = String.class),
|
||||
@ApiImplicitParam(name = "userId", required = true, value = "用户id", dataTypeClass = String.class),
|
||||
@ApiImplicitParam(name = "password", required = true, value = "新密码(未md5加密的密码)", dataTypeClass = String.class),
|
||||
})
|
||||
@PostMapping("/changePasswordForAdmin")
|
||||
@Operation(summary = "管理员修改普通用户密码")
|
||||
@Parameter(name = "adminId", description = "管理员id", required = true)
|
||||
@Parameter(name = "userId", description = "用户id", required = true)
|
||||
@Parameter(name = "password", description = "新密码(未md5加密的密码)", required = true)
|
||||
public String changePasswordForAdmin(@RequestParam int userId, @RequestParam String password) {
|
||||
// 获取当前登录用户id
|
||||
LoginUser userInfo = SecurityUtils.getUserInfo();
|
||||
|
@ -187,7 +187,7 @@ user-settings:
|
||||
logInDatebase: true
|
||||
|
||||
# 在线文档: swagger-ui(生产环境建议关闭)
|
||||
swagger-ui:
|
||||
doc:
|
||||
enabled: true
|
||||
|
||||
# 版本信息, 不需修改
|
||||
|
@ -80,7 +80,7 @@ user-settings:
|
||||
auto-apply-play: true
|
||||
|
||||
# 在线文档: swagger-ui(生产环境建议关闭)
|
||||
swagger-ui:
|
||||
doc:
|
||||
enabled: true
|
||||
|
||||
# 版本信息, 不需修改
|
||||
|
@ -1,120 +0,0 @@
|
||||
package com.genersoft.iot.vmp.service.impl;
|
||||
|
||||
import com.genersoft.iot.vmp.gb28181.bean.DeviceAlarm;
|
||||
import com.genersoft.iot.vmp.service.IDeviceAlarmService;
|
||||
import com.genersoft.iot.vmp.utils.DateUtil;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.time.Instant;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.ZoneOffset;
|
||||
import java.time.temporal.TemporalAccessor;
|
||||
import java.util.Date;
|
||||
|
||||
|
||||
@SpringBootTest
|
||||
@RunWith(SpringRunner.class)
|
||||
class DeviceAlarmServiceImplTest {
|
||||
|
||||
@Resource
|
||||
private IDeviceAlarmService deviceAlarmService;
|
||||
|
||||
@org.junit.jupiter.api.Test
|
||||
void getAllAlarm() {
|
||||
// deviceAlarmService.getAllAlarm(0, 10000, "11111111111111111111",null,null,null, null, null);
|
||||
// System.out.println(deviceAlarmService.getAllAlarm(0, 10000, null, null, null, null,
|
||||
// null, null).getSize());
|
||||
//
|
||||
// System.out.println(deviceAlarmService.getAllAlarm(0, 10000, "11111111111111111111", null, null, null,
|
||||
// null, null).getSize());
|
||||
//
|
||||
// System.out.println(deviceAlarmService.getAllAlarm(0, 10000, "11111111111111111111", "1", null, null,
|
||||
// null, null).getSize());
|
||||
//
|
||||
// System.out.println(deviceAlarmService.getAllAlarm(0, 10000, "11111111111111111111", "2", null, null,
|
||||
// null, null).getSize());
|
||||
//
|
||||
// System.out.println(deviceAlarmService.getAllAlarm(0, 10000, "11111111111111111111", "3", null, null,
|
||||
// null, null).getSize());
|
||||
//
|
||||
// System.out.println(deviceAlarmService.getAllAlarm(0, 10000, "11111111111111111111", "4", null, null,
|
||||
// null, null).getSize());
|
||||
//
|
||||
// System.out.println(deviceAlarmService.getAllAlarm(0, 10000, "11111111111111111111", "5", null, null,
|
||||
// null, null).getSize());
|
||||
//
|
||||
// System.out.println(deviceAlarmService.getAllAlarm(0, 10000, "11111111111111111111", null, "1", null,
|
||||
// null, null).getSize());
|
||||
|
||||
// System.out.println(deviceAlarmService.getAllAlarm(0, 10000, "11111111111111111111", null, "1", null,
|
||||
// null, null).getSize());
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@org.junit.jupiter.api.Test
|
||||
void add() {
|
||||
for (int i = 0; i < 1000; i++) {
|
||||
DeviceAlarm deviceAlarm = new DeviceAlarm();
|
||||
deviceAlarm.setDeviceId("11111111111111111111");
|
||||
deviceAlarm.setAlarmDescription("test_" + i);
|
||||
|
||||
/**
|
||||
* 报警方式 , 1为电话报警, 2为设备报警, 3为短信报警, 4为 GPS报警, 5为视频报警, 6为设备故障报警,
|
||||
* * 7其他报警;可以为直接组合如12为电话报警或 设备报警-
|
||||
*/
|
||||
deviceAlarm.setAlarmMethod((int)(Math.random()*7 + 1) + "");
|
||||
Instant date = randomDate("2021-01-01 00:00:00", "2021-06-01 00:00:00");
|
||||
deviceAlarm.setAlarmTime(DateUtil.formatter.format(date));
|
||||
/**
|
||||
* 报警级别, 1为一级警情, 2为二级警情, 3为三级警情, 4为四级 警情-
|
||||
*/
|
||||
deviceAlarm.setAlarmPriority((int)(Math.random()*4 + 1) + "");
|
||||
deviceAlarm.setLongitude(116.325);
|
||||
deviceAlarm.setLatitude(39.562);
|
||||
deviceAlarmService.add(deviceAlarm);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@org.junit.jupiter.api.Test
|
||||
void clearAlarmBeforeTime() {
|
||||
deviceAlarmService.clearAlarmBeforeTime(null,null, null);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
private Instant randomDate(String beginDate, String endDate) {
|
||||
try {
|
||||
|
||||
//构造开始日期
|
||||
LocalDateTime start = LocalDateTime.parse(beginDate, DateUtil.formatter);
|
||||
|
||||
//构造结束日期
|
||||
LocalDateTime end = LocalDateTime.parse(endDate, DateUtil.formatter);
|
||||
//getTime()表示返回自 1970 年 1 月 1 日 00:00:00 GMT 以来此 Date 对象表示的毫秒数。
|
||||
if (start.isAfter(end)) {
|
||||
return null;
|
||||
}
|
||||
long date = random(start.toInstant(ZoneOffset.of("+8")).toEpochMilli(), end.toInstant(ZoneOffset.of("+8")).toEpochMilli());
|
||||
return Instant.ofEpochMilli(date);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private static long random(long begin, long end) {
|
||||
long rtn = begin + (long) (Math.random() * (end - begin));
|
||||
//如果返回的是开始时间和结束时间,则递归调用本函数查找随机值
|
||||
if (rtn == begin || rtn == end) {
|
||||
return random(begin, end);
|
||||
}
|
||||
return rtn;
|
||||
}
|
||||
}
|
@ -1,56 +0,0 @@
|
||||
package com.genersoft.iot.vmp.service.impl;
|
||||
|
||||
import com.genersoft.iot.vmp.service.IRoleService;
|
||||
import com.genersoft.iot.vmp.service.IUserService;
|
||||
import com.genersoft.iot.vmp.storager.dao.dto.Role;
|
||||
import com.genersoft.iot.vmp.storager.dao.dto.User;
|
||||
import com.genersoft.iot.vmp.utils.DateUtil;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@SpringBootTest
|
||||
@RunWith(SpringRunner.class)
|
||||
class RoleServiceImplTest {
|
||||
|
||||
@Resource
|
||||
private IRoleService roleService;
|
||||
|
||||
@org.junit.jupiter.api.Test
|
||||
void getAllUser() {
|
||||
List<Role> all = roleService.getAll();
|
||||
Role roleById = roleService.getRoleById(1);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@org.junit.jupiter.api.Test
|
||||
void add() {
|
||||
for (int i = 0; i < 10; i++) {
|
||||
Role role = new Role();
|
||||
role.setName("test+" + i);
|
||||
role.setAuthority("adadadda");
|
||||
role.setCreateTime(DateUtil.getNow());
|
||||
role.setUpdateTime(DateUtil.getNow());
|
||||
roleService.add(role);
|
||||
}
|
||||
}
|
||||
|
||||
@org.junit.jupiter.api.Test
|
||||
void delete() {
|
||||
roleService.delete(20);
|
||||
}
|
||||
|
||||
@org.junit.jupiter.api.Test
|
||||
void update() {
|
||||
Role role = new Role();
|
||||
role.setId(21);
|
||||
role.setName("TTTTTT");
|
||||
role.setAuthority("adadadda");
|
||||
roleService.update(role);
|
||||
}
|
||||
}
|
@ -1,66 +0,0 @@
|
||||
package com.genersoft.iot.vmp.service.impl;
|
||||
|
||||
import com.genersoft.iot.vmp.service.IUserService;
|
||||
import com.genersoft.iot.vmp.storager.dao.dto.Role;
|
||||
import com.genersoft.iot.vmp.storager.dao.dto.User;
|
||||
import com.genersoft.iot.vmp.utils.DateUtil;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@SpringBootTest
|
||||
@RunWith(SpringRunner.class)
|
||||
class UserServiceImplTest {
|
||||
|
||||
@Resource
|
||||
private IUserService userService;
|
||||
|
||||
|
||||
@org.junit.jupiter.api.Test
|
||||
void getAllUser() {
|
||||
List<User> allUsers = userService.getAllUsers();
|
||||
User admin = userService.getUser("admin", "21232f297a57a5a743894a0e4a801fc3");
|
||||
User admin1 = userService.getUserByUsername("admin");
|
||||
}
|
||||
|
||||
|
||||
@org.junit.jupiter.api.Test
|
||||
void add() {
|
||||
for (int i = 0; i < 10; i++) {
|
||||
User user = new User();
|
||||
user.setUsername("admin_" + i);
|
||||
user.setPassword("admin_password_" + i);
|
||||
|
||||
Role role = new Role();
|
||||
role.setId(1);
|
||||
user.setRole(role);
|
||||
user.setCreateTime(DateUtil.getNow());
|
||||
user.setUpdateTime(DateUtil.getNow());
|
||||
userService.addUser(user);
|
||||
}
|
||||
}
|
||||
|
||||
@org.junit.jupiter.api.Test
|
||||
void delete() {
|
||||
userService.deleteUser(1002);
|
||||
}
|
||||
|
||||
@org.junit.jupiter.api.Test
|
||||
void update() {
|
||||
User user = new User();
|
||||
user.setId(11);
|
||||
user.setUsername("update" );
|
||||
user.setPassword("update");
|
||||
Role role = new Role();
|
||||
role.setId(2);
|
||||
user.setRole(role);
|
||||
user.setUpdateTime(DateUtil.getNow());
|
||||
userService.updateUsers(user);
|
||||
}
|
||||
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user