Commit 1a9e49d9ff210e39f6297150db758906a4f02e6f
1 parent
8f77d0c2
依赖包版本升级
Showing
54 changed files
with
1151 additions
and
1487 deletions
pom.xml
| @@ -6,7 +6,7 @@ | @@ -6,7 +6,7 @@ | ||
| 6 | <parent> | 6 | <parent> |
| 7 | <groupId>org.springframework.boot</groupId> | 7 | <groupId>org.springframework.boot</groupId> |
| 8 | <artifactId>spring-boot-starter-parent</artifactId> | 8 | <artifactId>spring-boot-starter-parent</artifactId> |
| 9 | - <version>2.3.5.RELEASE</version> | 9 | + <version>2.7.2</version> |
| 10 | </parent> | 10 | </parent> |
| 11 | 11 | ||
| 12 | <groupId>com.genersoft</groupId> | 12 | <groupId>com.genersoft</groupId> |
| @@ -47,7 +47,6 @@ | @@ -47,7 +47,6 @@ | ||
| 47 | <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | 47 | <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> |
| 48 | <maven.build.timestamp.format>MMddHHmm</maven.build.timestamp.format> | 48 | <maven.build.timestamp.format>MMddHHmm</maven.build.timestamp.format> |
| 49 | <maven-jar-plugin.version>3.1.1</maven-jar-plugin.version> | 49 | <maven-jar-plugin.version>3.1.1</maven-jar-plugin.version> |
| 50 | - <jedis-version>3.1.0</jedis-version> | ||
| 51 | 50 | ||
| 52 | <!-- 依赖版本 --> | 51 | <!-- 依赖版本 --> |
| 53 | <snippetsDirectory>${project.build.directory}/generated-snippets</snippetsDirectory> | 52 | <snippetsDirectory>${project.build.directory}/generated-snippets</snippetsDirectory> |
| @@ -74,7 +73,7 @@ | @@ -74,7 +73,7 @@ | ||
| 74 | <dependency> | 73 | <dependency> |
| 75 | <groupId>org.mybatis.spring.boot</groupId> | 74 | <groupId>org.mybatis.spring.boot</groupId> |
| 76 | <artifactId>mybatis-spring-boot-starter</artifactId> | 75 | <artifactId>mybatis-spring-boot-starter</artifactId> |
| 77 | - <version>2.1.4</version> | 76 | + <version>2.2.2</version> |
| 78 | <exclusions> | 77 | <exclusions> |
| 79 | <exclusion> | 78 | <exclusion> |
| 80 | <groupId>com.zaxxer</groupId> | 79 | <groupId>com.zaxxer</groupId> |
| @@ -91,37 +90,36 @@ | @@ -91,37 +90,36 @@ | ||
| 91 | <dependency> | 90 | <dependency> |
| 92 | <groupId>com.alibaba</groupId> | 91 | <groupId>com.alibaba</groupId> |
| 93 | <artifactId>druid-spring-boot-starter</artifactId> | 92 | <artifactId>druid-spring-boot-starter</artifactId> |
| 94 | - <version>1.1.22</version> | 93 | + <version>1.2.11</version> |
| 95 | </dependency> | 94 | </dependency> |
| 96 | 95 | ||
| 97 | <!-- mysql数据库 --> | 96 | <!-- mysql数据库 --> |
| 98 | <dependency> | 97 | <dependency> |
| 99 | <groupId>mysql</groupId> | 98 | <groupId>mysql</groupId> |
| 100 | <artifactId>mysql-connector-java</artifactId> | 99 | <artifactId>mysql-connector-java</artifactId> |
| 101 | - <version>8.0.22</version> | 100 | + <version>8.0.30</version> |
| 102 | </dependency> | 101 | </dependency> |
| 103 | 102 | ||
| 104 | <!--Mybatis分页插件 --> | 103 | <!--Mybatis分页插件 --> |
| 105 | <dependency> | 104 | <dependency> |
| 106 | <groupId>com.github.pagehelper</groupId> | 105 | <groupId>com.github.pagehelper</groupId> |
| 107 | <artifactId>pagehelper-spring-boot-starter</artifactId> | 106 | <artifactId>pagehelper-spring-boot-starter</artifactId> |
| 108 | - <version>1.4.1</version> | 107 | + <version>1.4.3</version> |
| 109 | </dependency> | 108 | </dependency> |
| 110 | 109 | ||
| 111 | - <!--Swagger3 --> | ||
| 112 | <!--在线文档 --> | 110 | <!--在线文档 --> |
| 113 | <dependency> | 111 | <dependency> |
| 114 | - <groupId>io.springfox</groupId> | ||
| 115 | - <artifactId>springfox-boot-starter</artifactId> | ||
| 116 | - <version>3.0.0</version> | 112 | + <groupId>org.springdoc</groupId> |
| 113 | + <artifactId>springdoc-openapi-ui</artifactId> | ||
| 114 | + <version>1.6.10</version> | ||
| 117 | </dependency> | 115 | </dependency> |
| 116 | + | ||
| 118 | <dependency> | 117 | <dependency> |
| 119 | <groupId>com.github.xiaoymin</groupId> | 118 | <groupId>com.github.xiaoymin</groupId> |
| 120 | - <artifactId>knife4j-spring-boot-starter</artifactId> | ||
| 121 | - <version>3.0.2</version> | 119 | + <artifactId>knife4j-springdoc-ui</artifactId> |
| 120 | + <version>3.0.3</version> | ||
| 122 | </dependency> | 121 | </dependency> |
| 123 | 122 | ||
| 124 | - | ||
| 125 | <!--参数校验 --> | 123 | <!--参数校验 --> |
| 126 | <dependency> | 124 | <dependency> |
| 127 | <groupId>javax.validation</groupId> | 125 | <groupId>javax.validation</groupId> |
| @@ -145,7 +143,7 @@ | @@ -145,7 +143,7 @@ | ||
| 145 | <dependency> | 143 | <dependency> |
| 146 | <groupId>org.slf4j</groupId> | 144 | <groupId>org.slf4j</groupId> |
| 147 | <artifactId>log4j-over-slf4j</artifactId> | 145 | <artifactId>log4j-over-slf4j</artifactId> |
| 148 | - <version>1.7.35</version> | 146 | + <version>1.7.36</version> |
| 149 | </dependency> | 147 | </dependency> |
| 150 | 148 | ||
| 151 | <!-- xml解析库 --> | 149 | <!-- xml解析库 --> |
| @@ -167,14 +165,14 @@ | @@ -167,14 +165,14 @@ | ||
| 167 | <dependency> | 165 | <dependency> |
| 168 | <groupId>com.squareup.okhttp3</groupId> | 166 | <groupId>com.squareup.okhttp3</groupId> |
| 169 | <artifactId>okhttp</artifactId> | 167 | <artifactId>okhttp</artifactId> |
| 170 | - <version>4.9.0</version> | 168 | + <version>4.10.0</version> |
| 171 | </dependency> | 169 | </dependency> |
| 172 | 170 | ||
| 173 | <!-- okhttp 调试日志 --> | 171 | <!-- okhttp 调试日志 --> |
| 174 | <dependency> | 172 | <dependency> |
| 175 | <groupId>com.squareup.okhttp3</groupId> | 173 | <groupId>com.squareup.okhttp3</groupId> |
| 176 | <artifactId>logging-interceptor</artifactId> | 174 | <artifactId>logging-interceptor</artifactId> |
| 177 | - <version>4.9.0</version> | 175 | + <version>4.10.0</version> |
| 178 | </dependency> | 176 | </dependency> |
| 179 | 177 | ||
| 180 | 178 | ||
| @@ -183,7 +181,7 @@ | @@ -183,7 +181,7 @@ | ||
| 183 | <dependency> | 181 | <dependency> |
| 184 | <groupId>io.github.rburgst</groupId> | 182 | <groupId>io.github.rburgst</groupId> |
| 185 | <artifactId>okhttp-digest</artifactId> | 183 | <artifactId>okhttp-digest</artifactId> |
| 186 | - <version>2.5</version> | 184 | + <version>2.7</version> |
| 187 | </dependency> | 185 | </dependency> |
| 188 | 186 | ||
| 189 | <!-- https://mvnrepository.com/artifact/net.sf.kxml/kxml2 --> | 187 | <!-- https://mvnrepository.com/artifact/net.sf.kxml/kxml2 --> |
| @@ -197,21 +195,21 @@ | @@ -197,21 +195,21 @@ | ||
| 197 | <dependency> | 195 | <dependency> |
| 198 | <groupId>org.mitre.dsmiley.httpproxy</groupId> | 196 | <groupId>org.mitre.dsmiley.httpproxy</groupId> |
| 199 | <artifactId>smiley-http-proxy-servlet</artifactId> | 197 | <artifactId>smiley-http-proxy-servlet</artifactId> |
| 200 | - <version>1.12</version> | 198 | + <version>1.12.1</version> |
| 201 | </dependency> | 199 | </dependency> |
| 202 | 200 | ||
| 203 | <!--excel解析库--> | 201 | <!--excel解析库--> |
| 204 | <dependency> | 202 | <dependency> |
| 205 | <groupId>com.alibaba</groupId> | 203 | <groupId>com.alibaba</groupId> |
| 206 | <artifactId>easyexcel</artifactId> | 204 | <artifactId>easyexcel</artifactId> |
| 207 | - <version>3.0.4</version> | 205 | + <version>3.1.1</version> |
| 208 | </dependency> | 206 | </dependency> |
| 209 | 207 | ||
| 210 | <!-- 获取系统信息 --> | 208 | <!-- 获取系统信息 --> |
| 211 | <dependency> | 209 | <dependency> |
| 212 | <groupId>com.github.oshi</groupId> | 210 | <groupId>com.github.oshi</groupId> |
| 213 | <artifactId>oshi-core</artifactId> | 211 | <artifactId>oshi-core</artifactId> |
| 214 | - <version>6.1.0</version> | 212 | + <version>6.2.2</version> |
| 215 | </dependency> | 213 | </dependency> |
| 216 | 214 | ||
| 217 | <dependency> | 215 | <dependency> |
| @@ -231,7 +229,7 @@ | @@ -231,7 +229,7 @@ | ||
| 231 | <dependency> | 229 | <dependency> |
| 232 | <groupId>com.google.guava</groupId> | 230 | <groupId>com.google.guava</groupId> |
| 233 | <artifactId>guava</artifactId> | 231 | <artifactId>guava</artifactId> |
| 234 | - <version>31.0.1-jre</version> | 232 | + <version>31.1-jre</version> |
| 235 | </dependency> | 233 | </dependency> |
| 236 | 234 | ||
| 237 | 235 |
src/main/java/com/genersoft/iot/vmp/VManageBootstrap.java
| @@ -8,7 +8,6 @@ import org.springframework.boot.autoconfigure.SpringBootApplication; | @@ -8,7 +8,6 @@ import org.springframework.boot.autoconfigure.SpringBootApplication; | ||
| 8 | import org.springframework.boot.web.servlet.ServletComponentScan; | 8 | import org.springframework.boot.web.servlet.ServletComponentScan; |
| 9 | import org.springframework.context.ConfigurableApplicationContext; | 9 | import org.springframework.context.ConfigurableApplicationContext; |
| 10 | import org.springframework.scheduling.annotation.EnableScheduling; | 10 | import org.springframework.scheduling.annotation.EnableScheduling; |
| 11 | -import springfox.documentation.oas.annotations.EnableOpenApi; | ||
| 12 | 11 | ||
| 13 | /** | 12 | /** |
| 14 | * 启动类 | 13 | * 启动类 |
| @@ -16,7 +15,6 @@ import springfox.documentation.oas.annotations.EnableOpenApi; | @@ -16,7 +15,6 @@ import springfox.documentation.oas.annotations.EnableOpenApi; | ||
| 16 | @ServletComponentScan("com.genersoft.iot.vmp.conf") | 15 | @ServletComponentScan("com.genersoft.iot.vmp.conf") |
| 17 | @SpringBootApplication | 16 | @SpringBootApplication |
| 18 | @EnableScheduling | 17 | @EnableScheduling |
| 19 | -@EnableOpenApi | ||
| 20 | @EnableDruidSupport | 18 | @EnableDruidSupport |
| 21 | public class VManageBootstrap extends LogManager { | 19 | public class VManageBootstrap extends LogManager { |
| 22 | private static String[] args; | 20 | private static String[] args; |
src/main/java/com/genersoft/iot/vmp/common/StreamInfo.java
src/main/java/com/genersoft/iot/vmp/conf/DynamicTask.java
| @@ -9,6 +9,7 @@ import org.springframework.scheduling.annotation.Scheduled; | @@ -9,6 +9,7 @@ import org.springframework.scheduling.annotation.Scheduled; | ||
| 9 | import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler; | 9 | import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler; |
| 10 | import org.springframework.stereotype.Component; | 10 | import org.springframework.stereotype.Component; |
| 11 | 11 | ||
| 12 | +import javax.annotation.PostConstruct; | ||
| 12 | import java.time.Instant; | 13 | import java.time.Instant; |
| 13 | import java.util.Map; | 14 | import java.util.Map; |
| 14 | import java.util.Set; | 15 | import java.util.Set; |
| @@ -25,20 +26,18 @@ public class DynamicTask { | @@ -25,20 +26,18 @@ public class DynamicTask { | ||
| 25 | 26 | ||
| 26 | private final Logger logger = LoggerFactory.getLogger(DynamicTask.class); | 27 | private final Logger logger = LoggerFactory.getLogger(DynamicTask.class); |
| 27 | 28 | ||
| 28 | - @Autowired | ||
| 29 | private ThreadPoolTaskScheduler threadPoolTaskScheduler; | 29 | private ThreadPoolTaskScheduler threadPoolTaskScheduler; |
| 30 | 30 | ||
| 31 | private final Map<String, ScheduledFuture<?>> futureMap = new ConcurrentHashMap<>(); | 31 | private final Map<String, ScheduledFuture<?>> futureMap = new ConcurrentHashMap<>(); |
| 32 | private final Map<String, Runnable> runnableMap = new ConcurrentHashMap<>(); | 32 | private final Map<String, Runnable> runnableMap = new ConcurrentHashMap<>(); |
| 33 | 33 | ||
| 34 | - @Bean | ||
| 35 | - public ThreadPoolTaskScheduler threadPoolTaskScheduler() { | ||
| 36 | - ThreadPoolTaskScheduler schedulerPool = new ThreadPoolTaskScheduler(); | ||
| 37 | - schedulerPool.setPoolSize(300); | ||
| 38 | - schedulerPool.setWaitForTasksToCompleteOnShutdown(true); | ||
| 39 | - schedulerPool.setAwaitTerminationSeconds(10); | ||
| 40 | - return schedulerPool; | ||
| 41 | - | 34 | + @PostConstruct |
| 35 | + public void DynamicTask() { | ||
| 36 | + threadPoolTaskScheduler = new ThreadPoolTaskScheduler(); | ||
| 37 | + threadPoolTaskScheduler.setPoolSize(300); | ||
| 38 | + threadPoolTaskScheduler.setWaitForTasksToCompleteOnShutdown(true); | ||
| 39 | + threadPoolTaskScheduler.setAwaitTerminationSeconds(10); | ||
| 40 | + threadPoolTaskScheduler.initialize(); | ||
| 42 | } | 41 | } |
| 43 | 42 | ||
| 44 | /** | 43 | /** |
src/main/java/com/genersoft/iot/vmp/conf/RedisConfig.java renamed to src/main/java/com/genersoft/iot/vmp/conf/redis/RedisConfig.java
| 1 | -package com.genersoft.iot.vmp.conf; | ||
| 2 | - | ||
| 3 | -import com.alibaba.fastjson.parser.ParserConfig; | ||
| 4 | -import com.genersoft.iot.vmp.common.VideoManagerConstants; | ||
| 5 | -import com.genersoft.iot.vmp.service.impl.*; | ||
| 6 | -import org.apache.commons.lang3.StringUtils; | ||
| 7 | -import org.springframework.beans.factory.annotation.Autowired; | ||
| 8 | -import org.springframework.beans.factory.annotation.Value; | ||
| 9 | -import org.springframework.cache.annotation.CachingConfigurerSupport; | ||
| 10 | -import org.springframework.context.annotation.Bean; | ||
| 11 | -import org.springframework.context.annotation.Configuration; | ||
| 12 | -import org.springframework.data.redis.connection.RedisConnectionFactory; | ||
| 13 | -import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory; | ||
| 14 | -import org.springframework.data.redis.core.RedisTemplate; | ||
| 15 | -import org.springframework.data.redis.listener.PatternTopic; | ||
| 16 | -import org.springframework.data.redis.listener.RedisMessageListenerContainer; | ||
| 17 | -import org.springframework.data.redis.serializer.StringRedisSerializer; | ||
| 18 | - | ||
| 19 | -import com.genersoft.iot.vmp.utils.redis.FastJsonRedisSerializer; | ||
| 20 | - | ||
| 21 | - | ||
| 22 | -/** | ||
| 23 | - * @description:Redis中间件配置类,使用spring-data-redis集成,自动从application.yml中加载redis配置 | ||
| 24 | - * @author: swwheihei | ||
| 25 | - * @date: 2019年5月30日 上午10:58:25 | ||
| 26 | - * | ||
| 27 | - */ | ||
| 28 | -@Configuration | ||
| 29 | -public class RedisConfig extends CachingConfigurerSupport { | ||
| 30 | - | ||
| 31 | - @Autowired | ||
| 32 | - private RedisGpsMsgListener redisGPSMsgListener; | ||
| 33 | - | ||
| 34 | - @Autowired | ||
| 35 | - private RedisAlarmMsgListener redisAlarmMsgListener; | ||
| 36 | - | ||
| 37 | - @Autowired | ||
| 38 | - private RedisStreamMsgListener redisStreamMsgListener; | ||
| 39 | - | ||
| 40 | - @Autowired | ||
| 41 | - private RedisGbPlayMsgListener redisGbPlayMsgListener; | ||
| 42 | - | ||
| 43 | - @Autowired | ||
| 44 | - private RedisPushStreamStatusMsgListener redisPushStreamStatusMsgListener; | ||
| 45 | - | ||
| 46 | - @Autowired | ||
| 47 | - private RedisPushStreamListMsgListener redisPushStreamListMsgListener; | ||
| 48 | - | ||
| 49 | - @Bean | ||
| 50 | - public RedisTemplate<Object, Object> redisTemplate(RedisConnectionFactory redisConnectionFactory) { | ||
| 51 | - RedisTemplate<Object, Object> redisTemplate = new RedisTemplate<>(); | ||
| 52 | - // 使用fastJson序列化 | ||
| 53 | - FastJsonRedisSerializer fastJsonRedisSerializer = new FastJsonRedisSerializer(Object.class); | ||
| 54 | - // value值的序列化采用fastJsonRedisSerializer | ||
| 55 | - redisTemplate.setValueSerializer(fastJsonRedisSerializer); | ||
| 56 | - redisTemplate.setHashValueSerializer(fastJsonRedisSerializer); | ||
| 57 | - // 全局开启AutoType,不建议使用 | ||
| 58 | - ParserConfig.getGlobalInstance().setAutoTypeSupport(true); | ||
| 59 | - // 建议使用这种方式,小范围指定白名单,需要序列化的类 | ||
| 60 | -// ParserConfig.getGlobalInstance().addAccept("com.avatar"); | ||
| 61 | - // key的序列化采用StringRedisSerializer | ||
| 62 | - redisTemplate.setKeySerializer(new StringRedisSerializer()); | ||
| 63 | - redisTemplate.setHashKeySerializer(new StringRedisSerializer()); | ||
| 64 | - redisTemplate.setConnectionFactory(redisConnectionFactory); | ||
| 65 | - return redisTemplate; | ||
| 66 | - } | ||
| 67 | - | ||
| 68 | - | ||
| 69 | - /** | ||
| 70 | - * redis消息监听器容器 可以添加多个监听不同话题的redis监听器,只需要把消息监听器和相应的消息订阅处理器绑定,该消息监听器 | ||
| 71 | - * 通过反射技术调用消息订阅处理器的相关方法进行一些业务处理 | ||
| 72 | - * | ||
| 73 | - * @param connectionFactory | ||
| 74 | - * @return | ||
| 75 | - */ | ||
| 76 | - @Bean | ||
| 77 | - RedisMessageListenerContainer container(RedisConnectionFactory connectionFactory) { | ||
| 78 | - | ||
| 79 | - RedisMessageListenerContainer container = new RedisMessageListenerContainer(); | ||
| 80 | - container.setConnectionFactory(connectionFactory); | ||
| 81 | - container.addMessageListener(redisGPSMsgListener, new PatternTopic(VideoManagerConstants.VM_MSG_GPS)); | ||
| 82 | - container.addMessageListener(redisAlarmMsgListener, new PatternTopic(VideoManagerConstants.VM_MSG_SUBSCRIBE_ALARM_RECEIVE)); | ||
| 83 | - container.addMessageListener(redisStreamMsgListener, new PatternTopic(VideoManagerConstants.WVP_MSG_STREAM_CHANGE_PREFIX + "PUSH")); | ||
| 84 | - container.addMessageListener(redisGbPlayMsgListener, new PatternTopic(RedisGbPlayMsgListener.WVP_PUSH_STREAM_KEY)); | ||
| 85 | - container.addMessageListener(redisPushStreamStatusMsgListener, new PatternTopic(VideoManagerConstants.VM_MSG_PUSH_STREAM_STATUS_CHANGE)); | ||
| 86 | - container.addMessageListener(redisPushStreamListMsgListener, new PatternTopic(VideoManagerConstants.VM_MSG_PUSH_STREAM_LIST_CHANGE)); | ||
| 87 | - return container; | ||
| 88 | - } | ||
| 89 | - | ||
| 90 | -} | 1 | +package com.genersoft.iot.vmp.conf.redis; |
| 2 | + | ||
| 3 | + | ||
| 4 | +import com.alibaba.fastjson.parser.ParserConfig; | ||
| 5 | +import com.genersoft.iot.vmp.common.VideoManagerConstants; | ||
| 6 | +import com.genersoft.iot.vmp.service.impl.*; | ||
| 7 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 8 | +import org.springframework.cache.annotation.CachingConfigurerSupport; | ||
| 9 | +import org.springframework.context.annotation.Bean; | ||
| 10 | +import org.springframework.context.annotation.Configuration; | ||
| 11 | +import org.springframework.data.redis.connection.RedisConnectionFactory; | ||
| 12 | +import org.springframework.data.redis.core.RedisTemplate; | ||
| 13 | +import org.springframework.data.redis.listener.PatternTopic; | ||
| 14 | +import org.springframework.data.redis.listener.RedisMessageListenerContainer; | ||
| 15 | +import org.springframework.data.redis.serializer.RedisSerializer; | ||
| 16 | +import org.springframework.data.redis.serializer.StringRedisSerializer; | ||
| 17 | + | ||
| 18 | +import com.genersoft.iot.vmp.utils.redis.FastJsonRedisSerializer; | ||
| 19 | + | ||
| 20 | + | ||
| 21 | +/** | ||
| 22 | + * @description:Redis中间件配置类,使用spring-data-redis集成,自动从application.yml中加载redis配置 | ||
| 23 | + * @author: swwheihei | ||
| 24 | + * @date: 2019年5月30日 上午10:58:25 | ||
| 25 | + * | ||
| 26 | + */ | ||
| 27 | +@Configuration | ||
| 28 | +public class RedisConfig extends CachingConfigurerSupport { | ||
| 29 | + | ||
| 30 | + @Autowired | ||
| 31 | + private RedisGpsMsgListener redisGPSMsgListener; | ||
| 32 | + | ||
| 33 | + @Autowired | ||
| 34 | + private RedisAlarmMsgListener redisAlarmMsgListener; | ||
| 35 | + | ||
| 36 | + @Autowired | ||
| 37 | + private RedisStreamMsgListener redisStreamMsgListener; | ||
| 38 | + | ||
| 39 | + @Autowired | ||
| 40 | + private RedisGbPlayMsgListener redisGbPlayMsgListener; | ||
| 41 | + | ||
| 42 | + @Autowired | ||
| 43 | + private RedisPushStreamStatusMsgListener redisPushStreamStatusMsgListener; | ||
| 44 | + | ||
| 45 | + @Autowired | ||
| 46 | + private RedisPushStreamListMsgListener redisPushStreamListMsgListener; | ||
| 47 | + | ||
| 48 | + @Bean | ||
| 49 | + public RedisTemplate<Object, Object> redisTemplate(RedisConnectionFactory redisConnectionFactory) { | ||
| 50 | + RedisTemplate<Object, Object> redisTemplate = new RedisTemplate<>(); | ||
| 51 | + // 使用fastJson序列化 | ||
| 52 | + FastJsonRedisSerializer fastJsonRedisSerializer = new FastJsonRedisSerializer(Object.class); | ||
| 53 | + // value值的序列化采用fastJsonRedisSerializer | ||
| 54 | + redisTemplate.setValueSerializer(fastJsonRedisSerializer); | ||
| 55 | + redisTemplate.setHashValueSerializer(fastJsonRedisSerializer); | ||
| 56 | + // 全局开启AutoType,不建议使用 | ||
| 57 | + ParserConfig.getGlobalInstance().setAutoTypeSupport(true); | ||
| 58 | + // key的序列化采用StringRedisSerializer | ||
| 59 | + redisTemplate.setKeySerializer(new StringRedisSerializer()); | ||
| 60 | + redisTemplate.setHashKeySerializer(new StringRedisSerializer()); | ||
| 61 | + redisTemplate.setConnectionFactory(redisConnectionFactory); | ||
| 62 | + return redisTemplate; | ||
| 63 | + } | ||
| 64 | + | ||
| 65 | + | ||
| 66 | + /** | ||
| 67 | + * redis消息监听器容器 可以添加多个监听不同话题的redis监听器,只需要把消息监听器和相应的消息订阅处理器绑定,该消息监听器 | ||
| 68 | + * 通过反射技术调用消息订阅处理器的相关方法进行一些业务处理 | ||
| 69 | + * | ||
| 70 | + * @param connectionFactory | ||
| 71 | + * @return | ||
| 72 | + */ | ||
| 73 | + @Bean | ||
| 74 | + RedisMessageListenerContainer container(RedisConnectionFactory connectionFactory) { | ||
| 75 | + | ||
| 76 | + RedisMessageListenerContainer container = new RedisMessageListenerContainer(); | ||
| 77 | + container.setConnectionFactory(connectionFactory); | ||
| 78 | + container.addMessageListener(redisGPSMsgListener, new PatternTopic(VideoManagerConstants.VM_MSG_GPS)); | ||
| 79 | + container.addMessageListener(redisAlarmMsgListener, new PatternTopic(VideoManagerConstants.VM_MSG_SUBSCRIBE_ALARM_RECEIVE)); | ||
| 80 | + container.addMessageListener(redisStreamMsgListener, new PatternTopic(VideoManagerConstants.WVP_MSG_STREAM_CHANGE_PREFIX + "PUSH")); | ||
| 81 | + container.addMessageListener(redisGbPlayMsgListener, new PatternTopic(RedisGbPlayMsgListener.WVP_PUSH_STREAM_KEY)); | ||
| 82 | + container.addMessageListener(redisPushStreamStatusMsgListener, new PatternTopic(VideoManagerConstants.VM_MSG_PUSH_STREAM_STATUS_CHANGE)); | ||
| 83 | + container.addMessageListener(redisPushStreamListMsgListener, new PatternTopic(VideoManagerConstants.VM_MSG_PUSH_STREAM_LIST_CHANGE)); | ||
| 84 | + return container; | ||
| 85 | + } | ||
| 86 | + | ||
| 87 | +} |
src/main/java/com/genersoft/iot/vmp/gb28181/bean/Device.java
| 1 | package com.genersoft.iot.vmp.gb28181.bean; | 1 | package com.genersoft.iot.vmp.gb28181.bean; |
| 2 | 2 | ||
| 3 | 3 | ||
| 4 | +import io.swagger.v3.oas.annotations.media.Schema; | ||
| 5 | + | ||
| 4 | /** | 6 | /** |
| 5 | * 国标设备/平台 | 7 | * 国标设备/平台 |
| 6 | * @author lin | 8 | * @author lin |
| 7 | */ | 9 | */ |
| 10 | +@Schema(description = "国标设备/平台") | ||
| 8 | public class Device { | 11 | public class Device { |
| 9 | 12 | ||
| 10 | /** | 13 | /** |
| 11 | - * 设备Id | 14 | + * 设备国标编号 |
| 12 | */ | 15 | */ |
| 16 | + @Schema(description = "设备国标编号") | ||
| 13 | private String deviceId; | 17 | private String deviceId; |
| 14 | 18 | ||
| 15 | /** | 19 | /** |
| 16 | * 设备名 | 20 | * 设备名 |
| 17 | */ | 21 | */ |
| 22 | + @Schema(description = "名称") | ||
| 18 | private String name; | 23 | private String name; |
| 19 | 24 | ||
| 20 | /** | 25 | /** |
| 21 | * 生产厂商 | 26 | * 生产厂商 |
| 22 | */ | 27 | */ |
| 28 | + @Schema(description = "生产厂商") | ||
| 23 | private String manufacturer; | 29 | private String manufacturer; |
| 24 | 30 | ||
| 25 | /** | 31 | /** |
| 26 | * 型号 | 32 | * 型号 |
| 27 | */ | 33 | */ |
| 34 | + @Schema(description = "型号") | ||
| 28 | private String model; | 35 | private String model; |
| 29 | 36 | ||
| 30 | /** | 37 | /** |
| 31 | * 固件版本 | 38 | * 固件版本 |
| 32 | */ | 39 | */ |
| 40 | + @Schema(description = "固件版本") | ||
| 33 | private String firmware; | 41 | private String firmware; |
| 34 | 42 | ||
| 35 | /** | 43 | /** |
| 36 | * 传输协议 | 44 | * 传输协议 |
| 37 | * UDP/TCP | 45 | * UDP/TCP |
| 38 | */ | 46 | */ |
| 47 | + @Schema(description = "传输协议(UDP/TCP)") | ||
| 39 | private String transport; | 48 | private String transport; |
| 40 | 49 | ||
| 41 | /** | 50 | /** |
| @@ -44,103 +53,123 @@ public class Device { | @@ -44,103 +53,123 @@ public class Device { | ||
| 44 | * TCP-ACTIVE:tcp主动模式 | 53 | * TCP-ACTIVE:tcp主动模式 |
| 45 | * TCP-PASSIVE:tcp被动模式 | 54 | * TCP-PASSIVE:tcp被动模式 |
| 46 | */ | 55 | */ |
| 56 | + @Schema(description = "数据流传输模式") | ||
| 47 | private String streamMode; | 57 | private String streamMode; |
| 48 | 58 | ||
| 49 | /** | 59 | /** |
| 50 | * wan地址_ip | 60 | * wan地址_ip |
| 51 | */ | 61 | */ |
| 62 | + @Schema(description = "IP") | ||
| 52 | private String ip; | 63 | private String ip; |
| 53 | 64 | ||
| 54 | /** | 65 | /** |
| 55 | * wan地址_port | 66 | * wan地址_port |
| 56 | */ | 67 | */ |
| 68 | + @Schema(description = "端口") | ||
| 57 | private int port; | 69 | private int port; |
| 58 | 70 | ||
| 59 | /** | 71 | /** |
| 60 | * wan地址 | 72 | * wan地址 |
| 61 | */ | 73 | */ |
| 74 | + @Schema(description = "wan地址") | ||
| 62 | private String hostAddress; | 75 | private String hostAddress; |
| 63 | 76 | ||
| 64 | /** | 77 | /** |
| 65 | * 在线 | 78 | * 在线 |
| 66 | */ | 79 | */ |
| 80 | + @Schema(description = "是否在线,1为在线,0为离线") | ||
| 67 | private int online; | 81 | private int online; |
| 68 | 82 | ||
| 69 | 83 | ||
| 70 | /** | 84 | /** |
| 71 | * 注册时间 | 85 | * 注册时间 |
| 72 | */ | 86 | */ |
| 87 | + @Schema(description = "注册时间") | ||
| 73 | private String registerTime; | 88 | private String registerTime; |
| 74 | 89 | ||
| 75 | 90 | ||
| 76 | /** | 91 | /** |
| 77 | * 心跳时间 | 92 | * 心跳时间 |
| 78 | */ | 93 | */ |
| 94 | + @Schema(description = "心跳时间") | ||
| 79 | private String keepaliveTime; | 95 | private String keepaliveTime; |
| 80 | 96 | ||
| 81 | /** | 97 | /** |
| 82 | * 通道个数 | 98 | * 通道个数 |
| 83 | */ | 99 | */ |
| 100 | + @Schema(description = "通道个数") | ||
| 84 | private int channelCount; | 101 | private int channelCount; |
| 85 | 102 | ||
| 86 | /** | 103 | /** |
| 87 | * 注册有效期 | 104 | * 注册有效期 |
| 88 | */ | 105 | */ |
| 106 | + @Schema(description = "注册有效期") | ||
| 89 | private int expires; | 107 | private int expires; |
| 90 | 108 | ||
| 91 | /** | 109 | /** |
| 92 | * 创建时间 | 110 | * 创建时间 |
| 93 | */ | 111 | */ |
| 112 | + @Schema(description = "创建时间") | ||
| 94 | private String createTime; | 113 | private String createTime; |
| 95 | 114 | ||
| 96 | /** | 115 | /** |
| 97 | * 更新时间 | 116 | * 更新时间 |
| 98 | */ | 117 | */ |
| 118 | + @Schema(description = "更新时间") | ||
| 99 | private String updateTime; | 119 | private String updateTime; |
| 100 | 120 | ||
| 101 | /** | 121 | /** |
| 102 | * 设备使用的媒体id, 默认为null | 122 | * 设备使用的媒体id, 默认为null |
| 103 | */ | 123 | */ |
| 124 | + @Schema(description = "设备使用的媒体id, 默认为null") | ||
| 104 | private String mediaServerId; | 125 | private String mediaServerId; |
| 105 | 126 | ||
| 106 | /** | 127 | /** |
| 107 | * 字符集, 支持 UTF-8 与 GB2312 | 128 | * 字符集, 支持 UTF-8 与 GB2312 |
| 108 | */ | 129 | */ |
| 130 | + @Schema(description = "符集, 支持 UTF-8 与 GB2312") | ||
| 109 | private String charset ; | 131 | private String charset ; |
| 110 | 132 | ||
| 111 | /** | 133 | /** |
| 112 | * 目录订阅周期,0为不订阅 | 134 | * 目录订阅周期,0为不订阅 |
| 113 | */ | 135 | */ |
| 136 | + @Schema(description = "目录订阅周期,0为不订阅") | ||
| 114 | private int subscribeCycleForCatalog; | 137 | private int subscribeCycleForCatalog; |
| 115 | 138 | ||
| 116 | /** | 139 | /** |
| 117 | * 移动设备位置订阅周期,0为不订阅 | 140 | * 移动设备位置订阅周期,0为不订阅 |
| 118 | */ | 141 | */ |
| 142 | + @Schema(description = "移动设备位置订阅周期,0为不订阅") | ||
| 119 | private int subscribeCycleForMobilePosition; | 143 | private int subscribeCycleForMobilePosition; |
| 120 | 144 | ||
| 121 | /** | 145 | /** |
| 122 | * 移动设备位置信息上报时间间隔,单位:秒,默认值5 | 146 | * 移动设备位置信息上报时间间隔,单位:秒,默认值5 |
| 123 | */ | 147 | */ |
| 148 | + @Schema(description = "移动设备位置信息上报时间间隔,单位:秒,默认值5") | ||
| 124 | private int mobilePositionSubmissionInterval = 5; | 149 | private int mobilePositionSubmissionInterval = 5; |
| 125 | 150 | ||
| 126 | /** | 151 | /** |
| 127 | * 报警订阅周期,0为不订阅 | 152 | * 报警订阅周期,0为不订阅 |
| 128 | */ | 153 | */ |
| 154 | + @Schema(description = "报警心跳时间订阅周期,0为不订阅") | ||
| 129 | private int subscribeCycleForAlarm; | 155 | private int subscribeCycleForAlarm; |
| 130 | 156 | ||
| 131 | /** | 157 | /** |
| 132 | * 是否开启ssrc校验,默认关闭,开启可以防止串流 | 158 | * 是否开启ssrc校验,默认关闭,开启可以防止串流 |
| 133 | */ | 159 | */ |
| 160 | + @Schema(description = "是否开启ssrc校验,默认关闭,开启可以防止串流") | ||
| 134 | private boolean ssrcCheck = true; | 161 | private boolean ssrcCheck = true; |
| 135 | 162 | ||
| 136 | /** | 163 | /** |
| 137 | - * 地理坐标系, 目前支持 WGS84,GCJ02 TODO CGCS2000 | 164 | + * 地理坐标系, 目前支持 WGS84,GCJ02 |
| 138 | */ | 165 | */ |
| 166 | + @Schema(description = "地理坐标系, 目前支持 WGS84,GCJ02") | ||
| 139 | private String geoCoordSys; | 167 | private String geoCoordSys; |
| 140 | 168 | ||
| 141 | /** | 169 | /** |
| 142 | * 树类型 国标规定了两种树的展现方式 行政区划:CivilCode 和业务分组:BusinessGroup | 170 | * 树类型 国标规定了两种树的展现方式 行政区划:CivilCode 和业务分组:BusinessGroup |
| 143 | */ | 171 | */ |
| 172 | + @Schema(description = "树类型 国标规定了两种树的展现方式 行政区划:CivilCode 和业务分组:BusinessGroup") | ||
| 144 | private String treeType; | 173 | private String treeType; |
| 145 | 174 | ||
| 146 | 175 |
src/main/java/com/genersoft/iot/vmp/gb28181/bean/DeviceAlarm.java
| 1 | package com.genersoft.iot.vmp.gb28181.bean; | 1 | package com.genersoft.iot.vmp.gb28181.bean; |
| 2 | 2 | ||
| 3 | +import io.swagger.v3.oas.annotations.media.Schema; | ||
| 3 | 4 | ||
| 5 | +/** | ||
| 6 | + * @author lin | ||
| 7 | + */ | ||
| 8 | +@Schema(description = "报警信息") | ||
| 4 | public class DeviceAlarm { | 9 | public class DeviceAlarm { |
| 5 | 10 | ||
| 6 | /** | 11 | /** |
| 7 | * 数据库id | 12 | * 数据库id |
| 8 | */ | 13 | */ |
| 14 | + @Schema(description = "数据库id") | ||
| 9 | private String id; | 15 | private String id; |
| 10 | 16 | ||
| 11 | /** | 17 | /** |
| 12 | * 设备Id | 18 | * 设备Id |
| 13 | */ | 19 | */ |
| 20 | + @Schema(description = "设备的国标编号") | ||
| 14 | private String deviceId; | 21 | private String deviceId; |
| 15 | 22 | ||
| 16 | /** | 23 | /** |
| 17 | * 通道Id | 24 | * 通道Id |
| 18 | */ | 25 | */ |
| 26 | + @Schema(description = "通道的国标编号") | ||
| 19 | private String channelId; | 27 | private String channelId; |
| 20 | 28 | ||
| 21 | /** | 29 | /** |
| 22 | - * 报警级别, 1为一级警情, 2为二级警情, 3为三级警情, 4为四级 警情- | 30 | + * 报警级别, 1为一级警情, 2为二级警情, 3为三级警情, 4为四级警情 |
| 23 | */ | 31 | */ |
| 32 | + @Schema(description = "报警级别, 1为一级警情, 2为二级警情, 3为三级警情, 4为四级警情") | ||
| 24 | private String alarmPriority; | 33 | private String alarmPriority; |
| 25 | 34 | ||
| 26 | /** | 35 | /** |
| 27 | * 报警方式 , 1为电话报警, 2为设备报警, 3为短信报警, 4为 GPS报警, 5为视频报警, 6为设备故障报警, | 36 | * 报警方式 , 1为电话报警, 2为设备报警, 3为短信报警, 4为 GPS报警, 5为视频报警, 6为设备故障报警, |
| 28 | * 7其他报警;可以为直接组合如12为电话报警或 设备报警- | 37 | * 7其他报警;可以为直接组合如12为电话报警或 设备报警- |
| 29 | */ | 38 | */ |
| 39 | + @Schema(description = "报警方式 , 1为电话报警, 2为设备报警, 3为短信报警, 4为 GPS报警, 5为视频报警, 6为设备故障报警,\n" + | ||
| 40 | + "\t * 7其他报警;可以为直接组合如12为电话报警或设备报警") | ||
| 30 | private String alarmMethod; | 41 | private String alarmMethod; |
| 31 | 42 | ||
| 32 | /** | 43 | /** |
| 33 | * 报警时间 | 44 | * 报警时间 |
| 34 | */ | 45 | */ |
| 46 | + @Schema(description = "报警时间") | ||
| 35 | private String alarmTime; | 47 | private String alarmTime; |
| 36 | 48 | ||
| 37 | /** | 49 | /** |
| 38 | * 报警内容描述 | 50 | * 报警内容描述 |
| 39 | */ | 51 | */ |
| 52 | + @Schema(description = "报警内容描述") | ||
| 40 | private String alarmDescription; | 53 | private String alarmDescription; |
| 41 | 54 | ||
| 42 | /** | 55 | /** |
| 43 | * 经度 | 56 | * 经度 |
| 44 | */ | 57 | */ |
| 58 | + @Schema(description = "经度") | ||
| 45 | private double longitude; | 59 | private double longitude; |
| 46 | 60 | ||
| 47 | /** | 61 | /** |
| 48 | * 纬度 | 62 | * 纬度 |
| 49 | */ | 63 | */ |
| 64 | + @Schema(description = "纬度") | ||
| 50 | private double latitude; | 65 | private double latitude; |
| 51 | 66 | ||
| 52 | /** | 67 | /** |
| @@ -75,8 +90,10 @@ public class DeviceAlarm { | @@ -75,8 +90,10 @@ public class DeviceAlarm { | ||
| 75 | * 1-存储设备磁盘故障报警; | 90 | * 1-存储设备磁盘故障报警; |
| 76 | * 2-存储设备风扇故障报警。 | 91 | * 2-存储设备风扇故障报警。 |
| 77 | */ | 92 | */ |
| 93 | + @Schema(description = "报警类型") | ||
| 78 | private String alarmType; | 94 | private String alarmType; |
| 79 | 95 | ||
| 96 | + @Schema(description = "创建时间") | ||
| 80 | private String createTime; | 97 | private String createTime; |
| 81 | 98 | ||
| 82 | 99 |
src/main/java/com/genersoft/iot/vmp/gb28181/bean/DeviceChannel.java
| 1 | package com.genersoft.iot.vmp.gb28181.bean; | 1 | package com.genersoft.iot.vmp.gb28181.bean; |
| 2 | 2 | ||
| 3 | +import io.swagger.v3.oas.annotations.media.Schema; | ||
| 4 | + | ||
| 5 | +@Schema(description = "通道信息") | ||
| 3 | public class DeviceChannel { | 6 | public class DeviceChannel { |
| 4 | 7 | ||
| 5 | 8 | ||
| 6 | /** | 9 | /** |
| 7 | * 数据库自增ID | 10 | * 数据库自增ID |
| 8 | */ | 11 | */ |
| 12 | + @Schema(description = "数据库自增ID") | ||
| 9 | private int id; | 13 | private int id; |
| 10 | 14 | ||
| 11 | /** | 15 | /** |
| 12 | - * 通道id | 16 | + * 通道国标编号 |
| 13 | */ | 17 | */ |
| 18 | + @Schema(description = "通道国标编号") | ||
| 14 | private String channelId; | 19 | private String channelId; |
| 15 | 20 | ||
| 16 | /** | 21 | /** |
| 17 | - * 设备id | 22 | + * 设备国标编号 |
| 18 | */ | 23 | */ |
| 24 | + @Schema(description = "设备国标编号") | ||
| 19 | private String deviceId; | 25 | private String deviceId; |
| 20 | 26 | ||
| 21 | /** | 27 | /** |
| 22 | * 通道名 | 28 | * 通道名 |
| 23 | */ | 29 | */ |
| 30 | + @Schema(description = "名称") | ||
| 24 | private String name; | 31 | private String name; |
| 25 | 32 | ||
| 26 | /** | 33 | /** |
| 27 | * 生产厂商 | 34 | * 生产厂商 |
| 28 | */ | 35 | */ |
| 36 | + @Schema(description = "生产厂商") | ||
| 29 | private String manufacture; | 37 | private String manufacture; |
| 30 | 38 | ||
| 31 | /** | 39 | /** |
| 32 | * 型号 | 40 | * 型号 |
| 33 | */ | 41 | */ |
| 42 | + @Schema(description = "型号") | ||
| 34 | private String model; | 43 | private String model; |
| 35 | 44 | ||
| 36 | /** | 45 | /** |
| 37 | * 设备归属 | 46 | * 设备归属 |
| 38 | */ | 47 | */ |
| 48 | + @Schema(description = "设备归属") | ||
| 39 | private String owner; | 49 | private String owner; |
| 40 | 50 | ||
| 41 | /** | 51 | /** |
| 42 | * 行政区域 | 52 | * 行政区域 |
| 43 | */ | 53 | */ |
| 54 | + @Schema(description = "行政区域") | ||
| 44 | private String civilCode; | 55 | private String civilCode; |
| 45 | 56 | ||
| 46 | /** | 57 | /** |
| 47 | * 警区 | 58 | * 警区 |
| 48 | */ | 59 | */ |
| 60 | + @Schema(description = "警区") | ||
| 49 | private String block; | 61 | private String block; |
| 50 | 62 | ||
| 51 | /** | 63 | /** |
| 52 | * 安装地址 | 64 | * 安装地址 |
| 53 | */ | 65 | */ |
| 66 | + @Schema(description = "安装地址") | ||
| 54 | private String address; | 67 | private String address; |
| 55 | 68 | ||
| 56 | /** | 69 | /** |
| 57 | * 是否有子设备 1有, 0没有 | 70 | * 是否有子设备 1有, 0没有 |
| 58 | */ | 71 | */ |
| 72 | + @Schema(description = "是否有子设备 1有, 0没有") | ||
| 59 | private int parental; | 73 | private int parental; |
| 60 | 74 | ||
| 61 | /** | 75 | /** |
| 62 | * 父级id | 76 | * 父级id |
| 63 | */ | 77 | */ |
| 78 | + @Schema(description = "父级id") | ||
| 64 | private String parentId; | 79 | private String parentId; |
| 65 | 80 | ||
| 66 | /** | 81 | /** |
| 67 | * 信令安全模式 缺省为0; 0:不采用; 2: S/MIME签名方式; 3: S/ MIME加密签名同时采用方式; 4:数字摘要方式 | 82 | * 信令安全模式 缺省为0; 0:不采用; 2: S/MIME签名方式; 3: S/ MIME加密签名同时采用方式; 4:数字摘要方式 |
| 68 | */ | 83 | */ |
| 84 | + @Schema(description = "信令安全模式 缺省为0; 0:不采用; 2: S/MIME签名方式; 3: S/ MIME加密签名同时采用方式; 4:数字摘要方式") | ||
| 69 | private int safetyWay; | 85 | private int safetyWay; |
| 70 | 86 | ||
| 71 | /** | 87 | /** |
| 72 | * 注册方式 缺省为1;1:符合IETFRFC3261标准的认证注册模 式; 2:基于口令的双向认证注册模式; 3:基于数字证书的双向认证注册模式 | 88 | * 注册方式 缺省为1;1:符合IETFRFC3261标准的认证注册模 式; 2:基于口令的双向认证注册模式; 3:基于数字证书的双向认证注册模式 |
| 73 | */ | 89 | */ |
| 90 | + @Schema(description = "注册方式 缺省为1;1:符合IETFRFC3261标准的认证注册模 式; 2:基于口令的双向认证注册模式; 3:基于数字证书的双向认证注册模式") | ||
| 74 | private int registerWay; | 91 | private int registerWay; |
| 75 | 92 | ||
| 76 | /** | 93 | /** |
| 77 | * 证书序列号 | 94 | * 证书序列号 |
| 78 | */ | 95 | */ |
| 96 | + @Schema(description = "证书序列号") | ||
| 79 | private String certNum; | 97 | private String certNum; |
| 80 | 98 | ||
| 81 | /** | 99 | /** |
| 82 | * 证书有效标识 缺省为0;证书有效标识:0:无效1: 有效 | 100 | * 证书有效标识 缺省为0;证书有效标识:0:无效1: 有效 |
| 83 | */ | 101 | */ |
| 102 | + @Schema(description = "证书有效标识 缺省为0;证书有效标识:0:无效1: 有效") | ||
| 84 | private int certifiable; | 103 | private int certifiable; |
| 85 | 104 | ||
| 86 | /** | 105 | /** |
| 87 | * 证书无效原因码 | 106 | * 证书无效原因码 |
| 88 | */ | 107 | */ |
| 108 | + @Schema(description = "证书无效原因码") | ||
| 89 | private int errCode; | 109 | private int errCode; |
| 90 | 110 | ||
| 91 | /** | 111 | /** |
| 92 | * 证书终止有效期 | 112 | * 证书终止有效期 |
| 93 | */ | 113 | */ |
| 114 | + @Schema(description = "证书终止有效期") | ||
| 94 | private String endTime; | 115 | private String endTime; |
| 95 | 116 | ||
| 96 | /** | 117 | /** |
| 97 | * 保密属性 缺省为0; 0:不涉密, 1:涉密 | 118 | * 保密属性 缺省为0; 0:不涉密, 1:涉密 |
| 98 | */ | 119 | */ |
| 120 | + @Schema(description = "保密属性 缺省为0; 0:不涉密, 1:涉密") | ||
| 99 | private String secrecy; | 121 | private String secrecy; |
| 100 | 122 | ||
| 101 | /** | 123 | /** |
| 102 | * IP地址 | 124 | * IP地址 |
| 103 | */ | 125 | */ |
| 126 | + @Schema(description = "IP地址") | ||
| 104 | private String ipAddress; | 127 | private String ipAddress; |
| 105 | 128 | ||
| 106 | /** | 129 | /** |
| 107 | * 端口号 | 130 | * 端口号 |
| 108 | */ | 131 | */ |
| 132 | + @Schema(description = "端口号") | ||
| 109 | private int port; | 133 | private int port; |
| 110 | 134 | ||
| 111 | /** | 135 | /** |
| 112 | * 密码 | 136 | * 密码 |
| 113 | */ | 137 | */ |
| 138 | + @Schema(description = "密码") | ||
| 114 | private String password; | 139 | private String password; |
| 115 | 140 | ||
| 116 | /** | 141 | /** |
| 117 | * 云台类型 | 142 | * 云台类型 |
| 118 | */ | 143 | */ |
| 144 | + @Schema(description = "云台类型") | ||
| 119 | private int PTZType; | 145 | private int PTZType; |
| 120 | 146 | ||
| 121 | /** | 147 | /** |
| 122 | * 云台类型描述字符串 | 148 | * 云台类型描述字符串 |
| 123 | */ | 149 | */ |
| 150 | + @Schema(description = "云台类型描述字符串") | ||
| 124 | private String PTZTypeText; | 151 | private String PTZTypeText; |
| 125 | 152 | ||
| 126 | /** | 153 | /** |
| 127 | * 创建时间 | 154 | * 创建时间 |
| 128 | */ | 155 | */ |
| 156 | + @Schema(description = "创建时间") | ||
| 129 | private String createTime; | 157 | private String createTime; |
| 130 | 158 | ||
| 131 | /** | 159 | /** |
| 132 | * 更新时间 | 160 | * 更新时间 |
| 133 | */ | 161 | */ |
| 162 | + @Schema(description = "更新时间") | ||
| 134 | private String updateTime; | 163 | private String updateTime; |
| 135 | 164 | ||
| 136 | /** | 165 | /** |
| @@ -142,66 +171,79 @@ public class DeviceChannel { | @@ -142,66 +171,79 @@ public class DeviceChannel { | ||
| 142 | * <Status>OFF</Status> | 171 | * <Status>OFF</Status> |
| 143 | * 遇到过NVR下的IPC下发信令可以推流, 但是 Status 响应 OFF | 172 | * 遇到过NVR下的IPC下发信令可以推流, 但是 Status 响应 OFF |
| 144 | */ | 173 | */ |
| 174 | + @Schema(description = "在线/离线, 1在线,0离线") | ||
| 145 | private int status; | 175 | private int status; |
| 146 | 176 | ||
| 147 | /** | 177 | /** |
| 148 | * 经度 | 178 | * 经度 |
| 149 | */ | 179 | */ |
| 180 | + @Schema(description = "经度") | ||
| 150 | private double longitude; | 181 | private double longitude; |
| 151 | 182 | ||
| 152 | /** | 183 | /** |
| 153 | * 纬度 | 184 | * 纬度 |
| 154 | */ | 185 | */ |
| 186 | + @Schema(description = "纬度") | ||
| 155 | private double latitude; | 187 | private double latitude; |
| 156 | 188 | ||
| 157 | /** | 189 | /** |
| 158 | * 经度 GCJ02 | 190 | * 经度 GCJ02 |
| 159 | */ | 191 | */ |
| 192 | + @Schema(description = "GCJ02坐标系经度") | ||
| 160 | private double longitudeGcj02; | 193 | private double longitudeGcj02; |
| 161 | 194 | ||
| 162 | /** | 195 | /** |
| 163 | * 纬度 GCJ02 | 196 | * 纬度 GCJ02 |
| 164 | */ | 197 | */ |
| 198 | + @Schema(description = "GCJ02坐标系纬度") | ||
| 165 | private double latitudeGcj02; | 199 | private double latitudeGcj02; |
| 166 | 200 | ||
| 167 | /** | 201 | /** |
| 168 | * 经度 WGS84 | 202 | * 经度 WGS84 |
| 169 | */ | 203 | */ |
| 204 | + @Schema(description = "WGS84坐标系经度") | ||
| 170 | private double longitudeWgs84; | 205 | private double longitudeWgs84; |
| 171 | 206 | ||
| 172 | /** | 207 | /** |
| 173 | * 纬度 WGS84 | 208 | * 纬度 WGS84 |
| 174 | */ | 209 | */ |
| 210 | + @Schema(description = "WGS84坐标系纬度") | ||
| 175 | private double latitudeWgs84; | 211 | private double latitudeWgs84; |
| 176 | 212 | ||
| 177 | /** | 213 | /** |
| 178 | * 子设备数 | 214 | * 子设备数 |
| 179 | */ | 215 | */ |
| 216 | + @Schema(description = "子设备数") | ||
| 180 | private int subCount; | 217 | private int subCount; |
| 181 | 218 | ||
| 182 | /** | 219 | /** |
| 183 | * 流唯一编号,存在表示正在直播 | 220 | * 流唯一编号,存在表示正在直播 |
| 184 | */ | 221 | */ |
| 222 | + @Schema(description = "流唯一编号,存在表示正在直播") | ||
| 185 | private String streamId; | 223 | private String streamId; |
| 186 | 224 | ||
| 187 | /** | 225 | /** |
| 188 | * 是否含有音频 | 226 | * 是否含有音频 |
| 189 | */ | 227 | */ |
| 228 | + @Schema(description = "是否含有音频") | ||
| 190 | private boolean hasAudio; | 229 | private boolean hasAudio; |
| 191 | 230 | ||
| 192 | /** | 231 | /** |
| 193 | * 标记通道的类型,0->国标通道 1->直播流通道 2->业务分组/虚拟组织/行政区划 | 232 | * 标记通道的类型,0->国标通道 1->直播流通道 2->业务分组/虚拟组织/行政区划 |
| 194 | */ | 233 | */ |
| 234 | + @Schema(description = "标记通道的类型,0->国标通道 1->直播流通道 2->业务分组/虚拟组织/行政区划") | ||
| 195 | private int channelType; | 235 | private int channelType; |
| 196 | 236 | ||
| 197 | /** | 237 | /** |
| 198 | * 业务分组 | 238 | * 业务分组 |
| 199 | */ | 239 | */ |
| 240 | + @Schema(description = "业务分组") | ||
| 200 | private String businessGroupId; | 241 | private String businessGroupId; |
| 201 | 242 | ||
| 202 | /** | 243 | /** |
| 203 | * GPS的更新时间 | 244 | * GPS的更新时间 |
| 204 | */ | 245 | */ |
| 246 | + @Schema(description = "GPS的更新时间") | ||
| 205 | private String gpsTime; | 247 | private String gpsTime; |
| 206 | 248 | ||
| 207 | public int getId() { | 249 | public int getId() { |
src/main/java/com/genersoft/iot/vmp/gb28181/bean/GbStream.java
| 1 | package com.genersoft.iot.vmp.gb28181.bean; | 1 | package com.genersoft.iot.vmp.gb28181.bean; |
| 2 | 2 | ||
| 3 | +import io.swagger.v3.oas.annotations.media.Schema; | ||
| 4 | + | ||
| 3 | /** | 5 | /** |
| 4 | * 直播流关联国标上级平台 | 6 | * 直播流关联国标上级平台 |
| 7 | + * @author lin | ||
| 5 | */ | 8 | */ |
| 9 | +@Schema(description = "直播流关联国标上级平台") | ||
| 6 | public class GbStream extends PlatformGbStream{ | 10 | public class GbStream extends PlatformGbStream{ |
| 7 | 11 | ||
| 12 | + @Schema(description = "ID") | ||
| 8 | private Integer gbStreamId; | 13 | private Integer gbStreamId; |
| 14 | + @Schema(description = "应用名") | ||
| 9 | private String app; | 15 | private String app; |
| 16 | + @Schema(description = "流ID") | ||
| 10 | private String stream; | 17 | private String stream; |
| 18 | + @Schema(description = "国标ID") | ||
| 11 | private String gbId; | 19 | private String gbId; |
| 20 | + @Schema(description = "名称") | ||
| 12 | private String name; | 21 | private String name; |
| 22 | + @Schema(description = "流媒体ID") | ||
| 13 | private String mediaServerId; | 23 | private String mediaServerId; |
| 24 | + @Schema(description = "经度") | ||
| 14 | private double longitude; | 25 | private double longitude; |
| 26 | + @Schema(description = "纬度") | ||
| 15 | private double latitude; | 27 | private double latitude; |
| 28 | + @Schema(description = "流类型(拉流/推流)") | ||
| 16 | private String streamType; | 29 | private String streamType; |
| 30 | + @Schema(description = "状态") | ||
| 17 | private boolean status; | 31 | private boolean status; |
| 18 | 32 | ||
| 33 | + @Schema(description = "创建时间") | ||
| 19 | public String createTime; | 34 | public String createTime; |
| 20 | 35 | ||
| 21 | @Override | 36 | @Override |
src/main/java/com/genersoft/iot/vmp/gb28181/bean/ParentPlatform.java
| 1 | package com.genersoft.iot.vmp.gb28181.bean; | 1 | package com.genersoft.iot.vmp.gb28181.bean; |
| 2 | 2 | ||
| 3 | +import io.swagger.v3.oas.annotations.media.Schema; | ||
| 4 | + | ||
| 5 | +/** | ||
| 6 | + * @author lin | ||
| 7 | + */ | ||
| 8 | +@Schema(description = "平台信息") | ||
| 3 | public class ParentPlatform { | 9 | public class ParentPlatform { |
| 4 | 10 | ||
| 5 | /** | 11 | /** |
| 6 | * id | 12 | * id |
| 7 | */ | 13 | */ |
| 14 | + @Schema(description = "ID(数据库中)") | ||
| 8 | private Integer id; | 15 | private Integer id; |
| 9 | 16 | ||
| 10 | /** | 17 | /** |
| 11 | * 是否启用 | 18 | * 是否启用 |
| 12 | */ | 19 | */ |
| 20 | + @Schema(description = "是否启用") | ||
| 13 | private boolean enable; | 21 | private boolean enable; |
| 14 | 22 | ||
| 15 | /** | 23 | /** |
| 16 | * 名称 | 24 | * 名称 |
| 17 | */ | 25 | */ |
| 26 | + @Schema(description = "名称") | ||
| 18 | private String name; | 27 | private String name; |
| 19 | 28 | ||
| 20 | /** | 29 | /** |
| 21 | * SIP服务国标编码 | 30 | * SIP服务国标编码 |
| 22 | */ | 31 | */ |
| 32 | + @Schema(description = "SIP服务国标编码") | ||
| 23 | private String serverGBId; | 33 | private String serverGBId; |
| 24 | 34 | ||
| 25 | /** | 35 | /** |
| 26 | * SIP服务国标域 | 36 | * SIP服务国标域 |
| 27 | */ | 37 | */ |
| 38 | + @Schema(description = "SIP服务国标域") | ||
| 28 | private String serverGBDomain; | 39 | private String serverGBDomain; |
| 29 | 40 | ||
| 30 | /** | 41 | /** |
| 31 | * SIP服务IP | 42 | * SIP服务IP |
| 32 | */ | 43 | */ |
| 44 | + @Schema(description = "SIP服务IP") | ||
| 33 | private String serverIP; | 45 | private String serverIP; |
| 34 | 46 | ||
| 35 | /** | 47 | /** |
| 36 | * SIP服务端口 | 48 | * SIP服务端口 |
| 37 | */ | 49 | */ |
| 50 | + @Schema(description = "SIP服务端口") | ||
| 38 | private int serverPort; | 51 | private int serverPort; |
| 39 | 52 | ||
| 40 | /** | 53 | /** |
| 41 | * 设备国标编号 | 54 | * 设备国标编号 |
| 42 | */ | 55 | */ |
| 56 | + @Schema(description = "11111") | ||
| 43 | private String deviceGBId; | 57 | private String deviceGBId; |
| 44 | 58 | ||
| 45 | /** | 59 | /** |
| 46 | * 设备ip | 60 | * 设备ip |
| 47 | */ | 61 | */ |
| 62 | + @Schema(description = "设备ip") | ||
| 48 | private String deviceIp; | 63 | private String deviceIp; |
| 49 | 64 | ||
| 50 | /** | 65 | /** |
| 51 | * 设备端口 | 66 | * 设备端口 |
| 52 | */ | 67 | */ |
| 68 | + @Schema(description = "设备端口") | ||
| 53 | private String devicePort; | 69 | private String devicePort; |
| 54 | 70 | ||
| 55 | /** | 71 | /** |
| 56 | * SIP认证用户名(默认使用设备国标编号) | 72 | * SIP认证用户名(默认使用设备国标编号) |
| 57 | */ | 73 | */ |
| 74 | + @Schema(description = "SIP认证用户名(默认使用设备国标编号)") | ||
| 58 | private String username; | 75 | private String username; |
| 59 | 76 | ||
| 60 | /** | 77 | /** |
| 61 | * SIP认证密码 | 78 | * SIP认证密码 |
| 62 | */ | 79 | */ |
| 80 | + @Schema(description = "SIP认证密码") | ||
| 63 | private String password; | 81 | private String password; |
| 64 | 82 | ||
| 65 | /** | 83 | /** |
| 66 | * 注册周期 (秒) | 84 | * 注册周期 (秒) |
| 67 | */ | 85 | */ |
| 86 | + @Schema(description = "注册周期 (秒)") | ||
| 68 | private String expires; | 87 | private String expires; |
| 69 | 88 | ||
| 70 | /** | 89 | /** |
| 71 | * 心跳周期(秒) | 90 | * 心跳周期(秒) |
| 72 | */ | 91 | */ |
| 92 | + @Schema(description = "心跳周期(秒)") | ||
| 73 | private String keepTimeout; | 93 | private String keepTimeout; |
| 74 | 94 | ||
| 75 | /** | 95 | /** |
| 76 | * 传输协议 | 96 | * 传输协议 |
| 77 | * UDP/TCP | 97 | * UDP/TCP |
| 78 | */ | 98 | */ |
| 99 | + @Schema(description = "传输协议") | ||
| 79 | private String transport; | 100 | private String transport; |
| 80 | 101 | ||
| 81 | /** | 102 | /** |
| 82 | * 字符集 | 103 | * 字符集 |
| 83 | */ | 104 | */ |
| 105 | + @Schema(description = "字符集") | ||
| 84 | private String characterSet; | 106 | private String characterSet; |
| 85 | 107 | ||
| 86 | /** | 108 | /** |
| 87 | * 允许云台控制 | 109 | * 允许云台控制 |
| 88 | */ | 110 | */ |
| 111 | + @Schema(description = "允许云台控制") | ||
| 89 | private boolean ptz; | 112 | private boolean ptz; |
| 90 | 113 | ||
| 91 | /** | 114 | /** |
| 92 | * RTCP流保活 | 115 | * RTCP流保活 |
| 93 | * TODO 预留, 暂不实现 | 116 | * TODO 预留, 暂不实现 |
| 94 | */ | 117 | */ |
| 118 | + @Schema(description = "RTCP流保活") | ||
| 95 | private boolean rtcp; | 119 | private boolean rtcp; |
| 96 | 120 | ||
| 97 | /** | 121 | /** |
| 98 | * 在线状态 | 122 | * 在线状态 |
| 99 | */ | 123 | */ |
| 124 | + @Schema(description = "在线状态") | ||
| 100 | private boolean status; | 125 | private boolean status; |
| 101 | 126 | ||
| 102 | /** | 127 | /** |
| 103 | * 在线状态 | 128 | * 在线状态 |
| 104 | */ | 129 | */ |
| 130 | + @Schema(description = "在线状态") | ||
| 105 | private int channelCount; | 131 | private int channelCount; |
| 106 | 132 | ||
| 107 | /** | 133 | /** |
| 108 | * 默认目录Id,自动添加的通道多放在这个目录下 | 134 | * 默认目录Id,自动添加的通道多放在这个目录下 |
| 109 | */ | 135 | */ |
| 136 | + @Schema(description = "默认目录Id,自动添加的通道多放在这个目录下") | ||
| 110 | private String catalogId; | 137 | private String catalogId; |
| 111 | 138 | ||
| 112 | /** | 139 | /** |
| 113 | * 已被订阅目录信息 | 140 | * 已被订阅目录信息 |
| 114 | */ | 141 | */ |
| 142 | + @Schema(description = "已被订阅目录信息") | ||
| 115 | private boolean catalogSubscribe; | 143 | private boolean catalogSubscribe; |
| 116 | 144 | ||
| 117 | /** | 145 | /** |
| 118 | * 已被订阅报警信息 | 146 | * 已被订阅报警信息 |
| 119 | */ | 147 | */ |
| 148 | + @Schema(description = "已被订阅报警信息") | ||
| 120 | private boolean alarmSubscribe; | 149 | private boolean alarmSubscribe; |
| 121 | 150 | ||
| 122 | /** | 151 | /** |
| 123 | * 已被订阅移动位置信息 | 152 | * 已被订阅移动位置信息 |
| 124 | */ | 153 | */ |
| 154 | + @Schema(description = "已被订阅移动位置信息") | ||
| 125 | private boolean mobilePositionSubscribe; | 155 | private boolean mobilePositionSubscribe; |
| 126 | 156 | ||
| 127 | /** | 157 | /** |
| 128 | * 点播未推流的设备时是否使用redis通知拉起 | 158 | * 点播未推流的设备时是否使用redis通知拉起 |
| 129 | */ | 159 | */ |
| 160 | + @Schema(description = "点播未推流的设备时是否使用redis通知拉起") | ||
| 130 | private boolean startOfflinePush; | 161 | private boolean startOfflinePush; |
| 131 | 162 | ||
| 132 | /** | 163 | /** |
| 133 | * 目录分组-每次向上级发送通道信息时单个包携带的通道数量,取值1,2,4,8 | 164 | * 目录分组-每次向上级发送通道信息时单个包携带的通道数量,取值1,2,4,8 |
| 134 | */ | 165 | */ |
| 166 | + @Schema(description = "目录分组-每次向上级发送通道信息时单个包携带的通道数量,取值1,2,4,8") | ||
| 135 | private int catalogGroup; | 167 | private int catalogGroup; |
| 136 | 168 | ||
| 137 | /** | 169 | /** |
| 138 | * 行政区划 | 170 | * 行政区划 |
| 139 | */ | 171 | */ |
| 172 | + @Schema(description = "行政区划") | ||
| 140 | private String administrativeDivision; | 173 | private String administrativeDivision; |
| 141 | 174 | ||
| 142 | /** | 175 | /** |
| 143 | * 更新时间 | 176 | * 更新时间 |
| 144 | */ | 177 | */ |
| 178 | + @Schema(description = "更新时间") | ||
| 145 | private String updateTime; | 179 | private String updateTime; |
| 146 | 180 | ||
| 147 | /** | 181 | /** |
| 148 | * 创建时间 | 182 | * 创建时间 |
| 149 | */ | 183 | */ |
| 184 | + @Schema(description = "创建时间") | ||
| 150 | private String createTime; | 185 | private String createTime; |
| 151 | 186 | ||
| 152 | /** | 187 | /** |
| 153 | * 树类型 国标规定了两种树的展现方式 行政区划 CivilCode 和业务分组:BusinessGroup | 188 | * 树类型 国标规定了两种树的展现方式 行政区划 CivilCode 和业务分组:BusinessGroup |
| 154 | */ | 189 | */ |
| 190 | + @Schema(description = "树类型 国标规定了两种树的展现方式 行政区划 CivilCode 和业务分组:BusinessGrou") | ||
| 155 | private String treeType; | 191 | private String treeType; |
| 156 | 192 | ||
| 157 | public Integer getId() { | 193 | public Integer getId() { |
src/main/java/com/genersoft/iot/vmp/gb28181/bean/PlatformCatalog.java
| 1 | package com.genersoft.iot.vmp.gb28181.bean; | 1 | package com.genersoft.iot.vmp.gb28181.bean; |
| 2 | 2 | ||
| 3 | +import io.swagger.v3.oas.annotations.media.Schema; | ||
| 4 | + | ||
| 3 | /** | 5 | /** |
| 4 | * 国标级联-目录 | 6 | * 国标级联-目录 |
| 5 | * @author lin | 7 | * @author lin |
| 6 | */ | 8 | */ |
| 9 | +@Schema(description = "目录信息") | ||
| 7 | public class PlatformCatalog { | 10 | public class PlatformCatalog { |
| 11 | + @Schema(description = "ID") | ||
| 8 | private String id; | 12 | private String id; |
| 13 | + | ||
| 14 | + @Schema(description = "名称") | ||
| 9 | private String name; | 15 | private String name; |
| 16 | + | ||
| 17 | + @Schema(description = "平台ID") | ||
| 10 | private String platformId; | 18 | private String platformId; |
| 19 | + | ||
| 20 | + @Schema(description = "父级目录ID") | ||
| 11 | private String parentId; | 21 | private String parentId; |
| 12 | 22 | ||
| 23 | + @Schema(description = "行政区划") | ||
| 13 | private String civilCode; | 24 | private String civilCode; |
| 14 | 25 | ||
| 26 | + @Schema(description = "目录分组") | ||
| 15 | private String businessGroupId; | 27 | private String businessGroupId; |
| 16 | 28 | ||
| 17 | /** | 29 | /** |
| 18 | * 子节点数 | 30 | * 子节点数 |
| 19 | */ | 31 | */ |
| 32 | + @Schema(description = "子节点数") | ||
| 20 | private int childrenCount; | 33 | private int childrenCount; |
| 21 | 34 | ||
| 22 | /** | 35 | /** |
| 23 | * 0 目录, 1 国标通道, 2 直播流 | 36 | * 0 目录, 1 国标通道, 2 直播流 |
| 24 | */ | 37 | */ |
| 38 | + @Schema(description = "类型:0 目录, 1 国标通道, 2 直播流") | ||
| 25 | private int type; | 39 | private int type; |
| 26 | 40 | ||
| 27 | public String getId() { | 41 | public String getId() { |
src/main/java/com/genersoft/iot/vmp/gb28181/bean/PlatformGbStream.java
| 1 | package com.genersoft.iot.vmp.gb28181.bean; | 1 | package com.genersoft.iot.vmp.gb28181.bean; |
| 2 | 2 | ||
| 3 | +import io.swagger.v3.oas.annotations.media.Schema; | ||
| 4 | + | ||
| 3 | public class PlatformGbStream { | 5 | public class PlatformGbStream { |
| 6 | + | ||
| 7 | + @Schema(description = "ID") | ||
| 4 | private Integer gbStreamId; | 8 | private Integer gbStreamId; |
| 9 | + | ||
| 10 | + @Schema(description = "平台ID") | ||
| 5 | private String platformId; | 11 | private String platformId; |
| 12 | + | ||
| 13 | + @Schema(description = "目录ID") | ||
| 6 | private String catalogId; | 14 | private String catalogId; |
| 7 | 15 | ||
| 8 | public Integer getGbStreamId() { | 16 | public Integer getGbStreamId() { |
src/main/java/com/genersoft/iot/vmp/gb28181/bean/SyncStatus.java
| 1 | package com.genersoft.iot.vmp.gb28181.bean; | 1 | package com.genersoft.iot.vmp.gb28181.bean; |
| 2 | 2 | ||
| 3 | +import io.swagger.v3.oas.annotations.media.Schema; | ||
| 4 | + | ||
| 3 | /** | 5 | /** |
| 4 | * 摄像机同步状态 | 6 | * 摄像机同步状态 |
| 5 | * @author lin | 7 | * @author lin |
| 6 | */ | 8 | */ |
| 9 | +@Schema(description = "摄像机同步状态") | ||
| 7 | public class SyncStatus { | 10 | public class SyncStatus { |
| 11 | + @Schema(description = "总数") | ||
| 8 | private int total; | 12 | private int total; |
| 13 | + @Schema(description = "当前更新多少") | ||
| 9 | private int current; | 14 | private int current; |
| 15 | + @Schema(description = "错误描述") | ||
| 10 | private String errorMsg; | 16 | private String errorMsg; |
| 11 | - | 17 | + @Schema(description = "是否同步中") |
| 12 | private boolean syncIng; | 18 | private boolean syncIng; |
| 13 | 19 | ||
| 14 | public int getTotal() { | 20 | public int getTotal() { |
src/main/java/com/genersoft/iot/vmp/gb28181/event/offline/KeepaliveTimeoutListenerForPlatform.java deleted
100644 → 0
| 1 | -package com.genersoft.iot.vmp.gb28181.event.offline; | ||
| 2 | - | ||
| 3 | -import com.genersoft.iot.vmp.conf.RedisKeyExpirationEventMessageListener; | ||
| 4 | -import com.genersoft.iot.vmp.conf.UserSetting; | ||
| 5 | -import com.genersoft.iot.vmp.gb28181.bean.Device; | ||
| 6 | -import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform; | ||
| 7 | -import com.genersoft.iot.vmp.gb28181.event.SipSubscribe; | ||
| 8 | -import com.genersoft.iot.vmp.storager.IVideoManagerStorage; | ||
| 9 | -import org.slf4j.Logger; | ||
| 10 | -import org.slf4j.LoggerFactory; | ||
| 11 | -import org.springframework.beans.factory.annotation.Autowired; | ||
| 12 | -import org.springframework.data.redis.connection.Message; | ||
| 13 | -import org.springframework.data.redis.listener.RedisMessageListenerContainer; | ||
| 14 | -import org.springframework.stereotype.Component; | ||
| 15 | - | ||
| 16 | -import com.genersoft.iot.vmp.common.VideoManagerConstants; | ||
| 17 | -import com.genersoft.iot.vmp.gb28181.event.EventPublisher; | ||
| 18 | - | ||
| 19 | -/** | ||
| 20 | - * 设备心跳超时监听,借助redis过期特性,进行监听,监听到说明设备心跳超时,发送离线事件 | ||
| 21 | - * @author swwheihei | ||
| 22 | - */ | ||
| 23 | -@Component | ||
| 24 | -public class KeepaliveTimeoutListenerForPlatform extends RedisKeyExpirationEventMessageListener { | ||
| 25 | - | ||
| 26 | - private Logger logger = LoggerFactory.getLogger(KeepaliveTimeoutListenerForPlatform.class); | ||
| 27 | - | ||
| 28 | - @Autowired | ||
| 29 | - private EventPublisher publisher; | ||
| 30 | - | ||
| 31 | - @Autowired | ||
| 32 | - private UserSetting userSetting; | ||
| 33 | - | ||
| 34 | - @Autowired | ||
| 35 | - private SipSubscribe sipSubscribe; | ||
| 36 | - | ||
| 37 | - @Autowired | ||
| 38 | - private IVideoManagerStorage storager; | ||
| 39 | - | ||
| 40 | - public KeepaliveTimeoutListenerForPlatform(RedisMessageListenerContainer listenerContainer, UserSetting userSetting) { | ||
| 41 | - super(listenerContainer, userSetting); | ||
| 42 | - } | ||
| 43 | - | ||
| 44 | - | ||
| 45 | - /** | ||
| 46 | - * 监听失效的key | ||
| 47 | - * @param message | ||
| 48 | - * @param pattern | ||
| 49 | - */ | ||
| 50 | - @Override | ||
| 51 | - public void onMessage(Message message, byte[] pattern) { | ||
| 52 | - // 获取失效的key | ||
| 53 | - String expiredKey = message.toString(); | ||
| 54 | - // 平台心跳到期,需要重发, 判断是否已经多次未收到心跳回复, 多次未收到,则重新发起注册, 注册尝试多次未得到回复,则认为平台离线 | ||
| 55 | - String PLATFORM_KEEPLIVEKEY_PREFIX = VideoManagerConstants.PLATFORM_KEEPALIVE_PREFIX + userSetting.getServerId() + "_"; | ||
| 56 | - String PLATFORM_REGISTER_PREFIX = VideoManagerConstants.PLATFORM_REGISTER_PREFIX + userSetting.getServerId() + "_"; | ||
| 57 | - String REGISTER_INFO_PREFIX = VideoManagerConstants.PLATFORM_REGISTER_INFO_PREFIX + userSetting.getServerId() + "_"; | ||
| 58 | - if (expiredKey.startsWith(PLATFORM_KEEPLIVEKEY_PREFIX)) { | ||
| 59 | - String platformGbId = expiredKey.substring(PLATFORM_KEEPLIVEKEY_PREFIX.length()); | ||
| 60 | - ParentPlatform platform = storager.queryParentPlatByServerGBId(platformGbId); | ||
| 61 | - if (platform != null) { | ||
| 62 | - publisher.platformKeepaliveExpireEventPublish(platformGbId); | ||
| 63 | - } | ||
| 64 | - }else if (expiredKey.startsWith(PLATFORM_REGISTER_PREFIX)) { | ||
| 65 | - String platformGbId = expiredKey.substring(PLATFORM_REGISTER_PREFIX.length(),expiredKey.length()); | ||
| 66 | - ParentPlatform platform = storager.queryParentPlatByServerGBId(platformGbId); | ||
| 67 | - if (platform != null) { | ||
| 68 | - publisher.platformRegisterCycleEventPublish(platformGbId); | ||
| 69 | - } | ||
| 70 | - }else if (expiredKey.startsWith(REGISTER_INFO_PREFIX)) { | ||
| 71 | - String callId = expiredKey.substring(REGISTER_INFO_PREFIX.length()); | ||
| 72 | - if (sipSubscribe.getErrorSubscribe(callId) != null) { | ||
| 73 | - SipSubscribe.EventResult eventResult = new SipSubscribe.EventResult(); | ||
| 74 | - eventResult.callId = callId; | ||
| 75 | - eventResult.msg = "注册超时"; | ||
| 76 | - eventResult.type = "register timeout"; | ||
| 77 | - sipSubscribe.getErrorSubscribe(callId).response(eventResult); | ||
| 78 | - } | ||
| 79 | - } | ||
| 80 | - } | ||
| 81 | -} |
src/main/java/com/genersoft/iot/vmp/gb28181/session/SsrcConfig.java
| 1 | package com.genersoft.iot.vmp.gb28181.session; | 1 | package com.genersoft.iot.vmp.gb28181.session; |
| 2 | 2 | ||
| 3 | import com.genersoft.iot.vmp.utils.ConfigConst; | 3 | import com.genersoft.iot.vmp.utils.ConfigConst; |
| 4 | +import io.swagger.v3.oas.annotations.media.Schema; | ||
| 4 | 5 | ||
| 5 | import java.util.ArrayList; | 6 | import java.util.ArrayList; |
| 6 | import java.util.List; | 7 | import java.util.List; |
| 7 | import java.util.Random; | 8 | import java.util.Random; |
| 8 | import java.util.Set; | 9 | import java.util.Set; |
| 9 | 10 | ||
| 11 | +@Schema(description = "ssrc信息") | ||
| 10 | public class SsrcConfig { | 12 | public class SsrcConfig { |
| 11 | 13 | ||
| 12 | /** | 14 | /** |
| 13 | * zlm流媒体服务器Id | 15 | * zlm流媒体服务器Id |
| 14 | */ | 16 | */ |
| 17 | + @Schema(description = "流媒体服务器Id") | ||
| 15 | private String mediaServerId; | 18 | private String mediaServerId; |
| 16 | 19 | ||
| 20 | + @Schema(description = "SSRC前缀") | ||
| 17 | private String ssrcPrefix; | 21 | private String ssrcPrefix; |
| 22 | + | ||
| 18 | /** | 23 | /** |
| 19 | * zlm流媒体服务器已用会话句柄 | 24 | * zlm流媒体服务器已用会话句柄 |
| 20 | */ | 25 | */ |
| 26 | + @Schema(description = "zlm流媒体服务器已用会话句柄") | ||
| 21 | private List<String> isUsed; | 27 | private List<String> isUsed; |
| 28 | + | ||
| 22 | /** | 29 | /** |
| 23 | * zlm流媒体服务器可用会话句柄 | 30 | * zlm流媒体服务器可用会话句柄 |
| 24 | */ | 31 | */ |
| 32 | + @Schema(description = "zlm流媒体服务器可用会话句柄") | ||
| 25 | private List<String> notUsed; | 33 | private List<String> notUsed; |
| 26 | 34 | ||
| 27 | public SsrcConfig() { | 35 | public SsrcConfig() { |
src/main/java/com/genersoft/iot/vmp/gb28181/session/VideoStreamSessionManager.java
| @@ -25,9 +25,6 @@ import org.springframework.util.StringUtils; | @@ -25,9 +25,6 @@ import org.springframework.util.StringUtils; | ||
| 25 | public class VideoStreamSessionManager { | 25 | public class VideoStreamSessionManager { |
| 26 | 26 | ||
| 27 | @Autowired | 27 | @Autowired |
| 28 | - private RedisUtil redisUtil; | ||
| 29 | - | ||
| 30 | - @Autowired | ||
| 31 | private UserSetting userSetting; | 28 | private UserSetting userSetting; |
| 32 | 29 | ||
| 33 | public enum SessionType { | 30 | public enum SessionType { |
| @@ -58,9 +55,9 @@ public class VideoStreamSessionManager { | @@ -58,9 +55,9 @@ public class VideoStreamSessionManager { | ||
| 58 | ssrcTransaction.setMediaServerId(mediaServerId); | 55 | ssrcTransaction.setMediaServerId(mediaServerId); |
| 59 | ssrcTransaction.setType(type); | 56 | ssrcTransaction.setType(type); |
| 60 | 57 | ||
| 61 | - redisUtil.set(VideoManagerConstants.MEDIA_TRANSACTION_USED_PREFIX + userSetting.getServerId() | 58 | + RedisUtil.set(VideoManagerConstants.MEDIA_TRANSACTION_USED_PREFIX + userSetting.getServerId() |
| 62 | + "_" + deviceId + "_" + channelId + "_" + callId + "_" + stream, ssrcTransaction); | 59 | + "_" + deviceId + "_" + channelId + "_" + callId + "_" + stream, ssrcTransaction); |
| 63 | - redisUtil.set(VideoManagerConstants.MEDIA_TRANSACTION_USED_PREFIX + userSetting.getServerId() | 60 | + RedisUtil.set(VideoManagerConstants.MEDIA_TRANSACTION_USED_PREFIX + userSetting.getServerId() |
| 64 | + "_" + deviceId + "_" + channelId + "_" + callId + "_" + stream, ssrcTransaction); | 61 | + "_" + deviceId + "_" + channelId + "_" + callId + "_" + stream, ssrcTransaction); |
| 65 | } | 62 | } |
| 66 | 63 | ||
| @@ -70,7 +67,7 @@ public class VideoStreamSessionManager { | @@ -70,7 +67,7 @@ public class VideoStreamSessionManager { | ||
| 70 | byte[] dialogByteArray = SerializeUtils.serialize(dialog); | 67 | byte[] dialogByteArray = SerializeUtils.serialize(dialog); |
| 71 | ssrcTransaction.setDialog(dialogByteArray); | 68 | ssrcTransaction.setDialog(dialogByteArray); |
| 72 | } | 69 | } |
| 73 | - redisUtil.set(VideoManagerConstants.MEDIA_TRANSACTION_USED_PREFIX + userSetting.getServerId() | 70 | + RedisUtil.set(VideoManagerConstants.MEDIA_TRANSACTION_USED_PREFIX + userSetting.getServerId() |
| 74 | + "_" + deviceId + "_" + channelId + "_" + ssrcTransaction.getCallId() + "_" | 71 | + "_" + deviceId + "_" + channelId + "_" + ssrcTransaction.getCallId() + "_" |
| 75 | + ssrcTransaction.getStream(), ssrcTransaction); | 72 | + ssrcTransaction.getStream(), ssrcTransaction); |
| 76 | } | 73 | } |
| @@ -126,11 +123,11 @@ public class VideoStreamSessionManager { | @@ -126,11 +123,11 @@ public class VideoStreamSessionManager { | ||
| 126 | stream ="*"; | 123 | stream ="*"; |
| 127 | } | 124 | } |
| 128 | String key = VideoManagerConstants.MEDIA_TRANSACTION_USED_PREFIX + userSetting.getServerId() + "_" + deviceId + "_" + channelId + "_" + callId+ "_" + stream; | 125 | String key = VideoManagerConstants.MEDIA_TRANSACTION_USED_PREFIX + userSetting.getServerId() + "_" + deviceId + "_" + channelId + "_" + callId+ "_" + stream; |
| 129 | - List<Object> scanResult = redisUtil.scan(key); | 126 | + List<Object> scanResult = RedisUtil.scan(key); |
| 130 | if (scanResult.size() == 0) { | 127 | if (scanResult.size() == 0) { |
| 131 | return null; | 128 | return null; |
| 132 | } | 129 | } |
| 133 | - return (SsrcTransaction)redisUtil.get((String) scanResult.get(0)); | 130 | + return (SsrcTransaction)RedisUtil.get((String) scanResult.get(0)); |
| 134 | } | 131 | } |
| 135 | 132 | ||
| 136 | public List<SsrcTransaction> getSsrcTransactionForAll(String deviceId, String channelId, String callId, String stream){ | 133 | public List<SsrcTransaction> getSsrcTransactionForAll(String deviceId, String channelId, String callId, String stream){ |
| @@ -147,13 +144,13 @@ public class VideoStreamSessionManager { | @@ -147,13 +144,13 @@ public class VideoStreamSessionManager { | ||
| 147 | stream ="*"; | 144 | stream ="*"; |
| 148 | } | 145 | } |
| 149 | String key = VideoManagerConstants.MEDIA_TRANSACTION_USED_PREFIX + userSetting.getServerId() + "_" + deviceId + "_" + channelId + "_" + callId+ "_" + stream; | 146 | String key = VideoManagerConstants.MEDIA_TRANSACTION_USED_PREFIX + userSetting.getServerId() + "_" + deviceId + "_" + channelId + "_" + callId+ "_" + stream; |
| 150 | - List<Object> scanResult = redisUtil.scan(key); | 147 | + List<Object> scanResult = RedisUtil.scan(key); |
| 151 | if (scanResult.size() == 0) { | 148 | if (scanResult.size() == 0) { |
| 152 | return null; | 149 | return null; |
| 153 | } | 150 | } |
| 154 | List<SsrcTransaction> result = new ArrayList<>(); | 151 | List<SsrcTransaction> result = new ArrayList<>(); |
| 155 | for (Object keyObj : scanResult) { | 152 | for (Object keyObj : scanResult) { |
| 156 | - result.add((SsrcTransaction)redisUtil.get((String) keyObj)); | 153 | + result.add((SsrcTransaction)RedisUtil.get((String) keyObj)); |
| 157 | } | 154 | } |
| 158 | return result; | 155 | return result; |
| 159 | } | 156 | } |
| @@ -179,17 +176,17 @@ public class VideoStreamSessionManager { | @@ -179,17 +176,17 @@ public class VideoStreamSessionManager { | ||
| 179 | if (ssrcTransaction == null) { | 176 | if (ssrcTransaction == null) { |
| 180 | return; | 177 | return; |
| 181 | } | 178 | } |
| 182 | - redisUtil.del(VideoManagerConstants.MEDIA_TRANSACTION_USED_PREFIX + userSetting.getServerId() + "_" | 179 | + RedisUtil.del(VideoManagerConstants.MEDIA_TRANSACTION_USED_PREFIX + userSetting.getServerId() + "_" |
| 183 | + deviceId + "_" + channelId + "_" + ssrcTransaction.getCallId() + "_" + ssrcTransaction.getStream()); | 180 | + deviceId + "_" + channelId + "_" + ssrcTransaction.getCallId() + "_" + ssrcTransaction.getStream()); |
| 184 | } | 181 | } |
| 185 | 182 | ||
| 186 | 183 | ||
| 187 | public List<SsrcTransaction> getAllSsrc() { | 184 | public List<SsrcTransaction> getAllSsrc() { |
| 188 | - List<Object> ssrcTransactionKeys = redisUtil.scan(String.format("%s_*_*_*_*", VideoManagerConstants.MEDIA_TRANSACTION_USED_PREFIX+ userSetting.getServerId())); | 185 | + List<Object> ssrcTransactionKeys = RedisUtil.scan(String.format("%s_*_*_*_*", VideoManagerConstants.MEDIA_TRANSACTION_USED_PREFIX+ userSetting.getServerId())); |
| 189 | List<SsrcTransaction> result= new ArrayList<>(); | 186 | List<SsrcTransaction> result= new ArrayList<>(); |
| 190 | for (int i = 0; i < ssrcTransactionKeys.size(); i++) { | 187 | for (int i = 0; i < ssrcTransactionKeys.size(); i++) { |
| 191 | String key = (String)ssrcTransactionKeys.get(i); | 188 | String key = (String)ssrcTransactionKeys.get(i); |
| 192 | - SsrcTransaction ssrcTransaction = (SsrcTransaction)redisUtil.get(key); | 189 | + SsrcTransaction ssrcTransaction = (SsrcTransaction)RedisUtil.get(key); |
| 193 | result.add(ssrcTransaction); | 190 | result.add(ssrcTransaction); |
| 194 | } | 191 | } |
| 195 | return result; | 192 | return result; |
src/main/java/com/genersoft/iot/vmp/media/zlm/dto/MediaServerItem.java
| @@ -3,64 +3,93 @@ package com.genersoft.iot.vmp.media.zlm.dto; | @@ -3,64 +3,93 @@ package com.genersoft.iot.vmp.media.zlm.dto; | ||
| 3 | 3 | ||
| 4 | import com.genersoft.iot.vmp.gb28181.session.SsrcConfig; | 4 | import com.genersoft.iot.vmp.gb28181.session.SsrcConfig; |
| 5 | import com.genersoft.iot.vmp.media.zlm.ZLMServerConfig; | 5 | import com.genersoft.iot.vmp.media.zlm.ZLMServerConfig; |
| 6 | +import io.swagger.v3.oas.annotations.media.Schema; | ||
| 6 | import org.springframework.util.StringUtils; | 7 | import org.springframework.util.StringUtils; |
| 7 | 8 | ||
| 8 | import java.util.HashMap; | 9 | import java.util.HashMap; |
| 9 | 10 | ||
| 11 | +@Schema(description = "流媒体服务信息") | ||
| 10 | public class MediaServerItem{ | 12 | public class MediaServerItem{ |
| 11 | 13 | ||
| 14 | + @Schema(description = "ID") | ||
| 12 | private String id; | 15 | private String id; |
| 13 | 16 | ||
| 17 | + @Schema(description = "IP") | ||
| 14 | private String ip; | 18 | private String ip; |
| 15 | 19 | ||
| 20 | + @Schema(description = "hook使用的IP(zlm访问WVP使用的IP)") | ||
| 16 | private String hookIp; | 21 | private String hookIp; |
| 17 | 22 | ||
| 23 | + @Schema(description = "SDP IP") | ||
| 18 | private String sdpIp; | 24 | private String sdpIp; |
| 19 | 25 | ||
| 26 | + @Schema(description = "流IP") | ||
| 20 | private String streamIp; | 27 | private String streamIp; |
| 21 | 28 | ||
| 29 | + @Schema(description = "HTTP端口") | ||
| 22 | private int httpPort; | 30 | private int httpPort; |
| 23 | 31 | ||
| 32 | + @Schema(description = "HTTPS端口") | ||
| 24 | private int httpSSlPort; | 33 | private int httpSSlPort; |
| 25 | 34 | ||
| 35 | + @Schema(description = "RTMP端口") | ||
| 26 | private int rtmpPort; | 36 | private int rtmpPort; |
| 27 | 37 | ||
| 38 | + @Schema(description = "RTMPS端口") | ||
| 28 | private int rtmpSSlPort; | 39 | private int rtmpSSlPort; |
| 29 | 40 | ||
| 41 | + @Schema(description = "RTP收流端口(单端口模式有用)") | ||
| 30 | private int rtpProxyPort; | 42 | private int rtpProxyPort; |
| 31 | 43 | ||
| 44 | + @Schema(description = "RTSP端口") | ||
| 32 | private int rtspPort; | 45 | private int rtspPort; |
| 33 | 46 | ||
| 47 | + @Schema(description = "RTSPS端口") | ||
| 34 | private int rtspSSLPort; | 48 | private int rtspSSLPort; |
| 35 | 49 | ||
| 50 | + @Schema(description = "是否开启自动配置ZLM") | ||
| 36 | private boolean autoConfig; | 51 | private boolean autoConfig; |
| 37 | 52 | ||
| 53 | + @Schema(description = "ZLM鉴权参数") | ||
| 38 | private String secret; | 54 | private String secret; |
| 39 | 55 | ||
| 56 | + @Schema(description = "某个流无人观看时,触发hook.on_stream_none_reader事件的最大等待时间,单位毫秒") | ||
| 40 | private int streamNoneReaderDelayMS; | 57 | private int streamNoneReaderDelayMS; |
| 41 | 58 | ||
| 59 | + @Schema(description = "keepalive hook触发间隔,单位秒") | ||
| 42 | private int hookAliveInterval; | 60 | private int hookAliveInterval; |
| 43 | 61 | ||
| 62 | + @Schema(description = "是否使用多端口模式") | ||
| 44 | private boolean rtpEnable; | 63 | private boolean rtpEnable; |
| 45 | 64 | ||
| 65 | + @Schema(description = "状态") | ||
| 46 | private boolean status; | 66 | private boolean status; |
| 47 | 67 | ||
| 68 | + @Schema(description = "多端口RTP收流端口范围") | ||
| 48 | private String rtpPortRange; | 69 | private String rtpPortRange; |
| 49 | 70 | ||
| 71 | + @Schema(description = "RTP发流端口范围") | ||
| 50 | private String sendRtpPortRange; | 72 | private String sendRtpPortRange; |
| 51 | 73 | ||
| 74 | + @Schema(description = "assist服务端口") | ||
| 52 | private int recordAssistPort; | 75 | private int recordAssistPort; |
| 53 | 76 | ||
| 77 | + @Schema(description = "创建时间") | ||
| 54 | private String createTime; | 78 | private String createTime; |
| 55 | 79 | ||
| 80 | + @Schema(description = "更新时间") | ||
| 56 | private String updateTime; | 81 | private String updateTime; |
| 57 | 82 | ||
| 83 | + @Schema(description = "上次心跳时间") | ||
| 58 | private String lastKeepaliveTime; | 84 | private String lastKeepaliveTime; |
| 59 | 85 | ||
| 86 | + @Schema(description = "是否是默认ZLM") | ||
| 60 | private boolean defaultServer; | 87 | private boolean defaultServer; |
| 61 | 88 | ||
| 89 | + @Schema(description = "SSRC信息") | ||
| 62 | private SsrcConfig ssrcConfig; | 90 | private SsrcConfig ssrcConfig; |
| 63 | 91 | ||
| 92 | + @Schema(description = "当前使用到的端口") | ||
| 64 | private int currentPort; | 93 | private int currentPort; |
| 65 | 94 | ||
| 66 | 95 | ||
| @@ -68,6 +97,7 @@ public class MediaServerItem{ | @@ -68,6 +97,7 @@ public class MediaServerItem{ | ||
| 68 | * 每一台ZLM都有一套独立的SSRC列表 | 97 | * 每一台ZLM都有一套独立的SSRC列表 |
| 69 | * 在ApplicationCheckRunner里对mediaServerSsrcMap进行初始化 | 98 | * 在ApplicationCheckRunner里对mediaServerSsrcMap进行初始化 |
| 70 | */ | 99 | */ |
| 100 | + @Schema(description = "ID") | ||
| 71 | private HashMap<String, SsrcConfig> mediaServerSsrcMap; | 101 | private HashMap<String, SsrcConfig> mediaServerSsrcMap; |
| 72 | 102 | ||
| 73 | public MediaServerItem() { | 103 | public MediaServerItem() { |
src/main/java/com/genersoft/iot/vmp/media/zlm/dto/StreamProxyItem.java
| 1 | package com.genersoft.iot.vmp.media.zlm.dto; | 1 | package com.genersoft.iot.vmp.media.zlm.dto; |
| 2 | 2 | ||
| 3 | import com.genersoft.iot.vmp.gb28181.bean.GbStream; | 3 | import com.genersoft.iot.vmp.gb28181.bean.GbStream; |
| 4 | +import io.swagger.v3.oas.annotations.media.Schema; | ||
| 4 | 5 | ||
| 6 | +/** | ||
| 7 | + * @author lin | ||
| 8 | + */ | ||
| 9 | +@Schema(description = "拉流代理的信息") | ||
| 5 | public class StreamProxyItem extends GbStream { | 10 | public class StreamProxyItem extends GbStream { |
| 6 | 11 | ||
| 12 | + @Schema(description = "类型") | ||
| 7 | private String type; | 13 | private String type; |
| 14 | + @Schema(description = "应用名") | ||
| 8 | private String app; | 15 | private String app; |
| 16 | + @Schema(description = "流ID") | ||
| 9 | private String stream; | 17 | private String stream; |
| 18 | + @Schema(description = "流媒体服务ID") | ||
| 10 | private String mediaServerId; | 19 | private String mediaServerId; |
| 20 | + @Schema(description = "拉流地址") | ||
| 11 | private String url; | 21 | private String url; |
| 22 | + @Schema(description = "拉流地址") | ||
| 12 | private String src_url; | 23 | private String src_url; |
| 24 | + @Schema(description = "目标地址") | ||
| 13 | private String dst_url; | 25 | private String dst_url; |
| 26 | + @Schema(description = "超时时间") | ||
| 14 | private int timeout_ms; | 27 | private int timeout_ms; |
| 28 | + @Schema(description = "ffmpeg模板KEY") | ||
| 15 | private String ffmpeg_cmd_key; | 29 | private String ffmpeg_cmd_key; |
| 30 | + @Schema(description = "rtsp拉流时,拉流方式,0:tcp,1:udp,2:组播") | ||
| 16 | private String rtp_type; | 31 | private String rtp_type; |
| 32 | + @Schema(description = "是否启用") | ||
| 17 | private boolean enable; | 33 | private boolean enable; |
| 34 | + @Schema(description = "是否启用HLS") | ||
| 18 | private boolean enable_hls; | 35 | private boolean enable_hls; |
| 36 | + @Schema(description = "是否启用MP4") | ||
| 19 | private boolean enable_mp4; | 37 | private boolean enable_mp4; |
| 20 | - private boolean enable_remove_none_reader; // 无人观看时删除 | 38 | + @Schema(description = "是否 无人观看时删除") |
| 39 | + private boolean enable_remove_none_reader; | ||
| 40 | + @Schema(description = "上级平台国标ID") | ||
| 21 | private String platformGbId; | 41 | private String platformGbId; |
| 42 | + @Schema(description = "创建时间") | ||
| 22 | private String createTime; | 43 | private String createTime; |
| 23 | 44 | ||
| 24 | public String getType() { | 45 | public String getType() { |
src/main/java/com/genersoft/iot/vmp/media/zlm/dto/StreamPushItem.java
| @@ -2,37 +2,43 @@ package com.genersoft.iot.vmp.media.zlm.dto; | @@ -2,37 +2,43 @@ package com.genersoft.iot.vmp.media.zlm.dto; | ||
| 2 | 2 | ||
| 3 | import com.genersoft.iot.vmp.gb28181.bean.GbStream; | 3 | import com.genersoft.iot.vmp.gb28181.bean.GbStream; |
| 4 | import com.genersoft.iot.vmp.utils.DateUtil; | 4 | import com.genersoft.iot.vmp.utils.DateUtil; |
| 5 | +import io.swagger.v3.oas.annotations.media.Schema; | ||
| 5 | import org.jetbrains.annotations.NotNull; | 6 | import org.jetbrains.annotations.NotNull; |
| 6 | import org.springframework.util.unit.DataUnit; | 7 | import org.springframework.util.unit.DataUnit; |
| 7 | 8 | ||
| 8 | import java.util.List; | 9 | import java.util.List; |
| 9 | 10 | ||
| 10 | - | 11 | +@Schema(description = "推流信息") |
| 11 | public class StreamPushItem extends GbStream implements Comparable<StreamPushItem>{ | 12 | public class StreamPushItem extends GbStream implements Comparable<StreamPushItem>{ |
| 12 | 13 | ||
| 13 | /** | 14 | /** |
| 14 | * id | 15 | * id |
| 15 | */ | 16 | */ |
| 17 | + @Schema(description = "id") | ||
| 16 | private Integer id; | 18 | private Integer id; |
| 17 | 19 | ||
| 18 | /** | 20 | /** |
| 19 | * 应用名 | 21 | * 应用名 |
| 20 | */ | 22 | */ |
| 23 | + @Schema(description = "应用名") | ||
| 21 | private String app; | 24 | private String app; |
| 22 | 25 | ||
| 23 | /** | 26 | /** |
| 24 | * 流id | 27 | * 流id |
| 25 | */ | 28 | */ |
| 29 | + @Schema(description = "流id") | ||
| 26 | private String stream; | 30 | private String stream; |
| 27 | 31 | ||
| 28 | /** | 32 | /** |
| 29 | * 观看总人数,包括hls/rtsp/rtmp/http-flv/ws-flv | 33 | * 观看总人数,包括hls/rtsp/rtmp/http-flv/ws-flv |
| 30 | */ | 34 | */ |
| 35 | + @Schema(description = "观看总人数") | ||
| 31 | private String totalReaderCount; | 36 | private String totalReaderCount; |
| 32 | 37 | ||
| 33 | /** | 38 | /** |
| 34 | * 协议 包括hls/rtsp/rtmp/http-flv/ws-flv | 39 | * 协议 包括hls/rtsp/rtmp/http-flv/ws-flv |
| 35 | */ | 40 | */ |
| 41 | + @Schema(description = "协议 包括hls/rtsp/rtmp/http-flv/ws-flv") | ||
| 36 | private List<MediaSchema> schemas; | 42 | private List<MediaSchema> schemas; |
| 37 | 43 | ||
| 38 | /** | 44 | /** |
| @@ -46,71 +52,85 @@ public class StreamPushItem extends GbStream implements Comparable<StreamPushIte | @@ -46,71 +52,85 @@ public class StreamPushItem extends GbStream implements Comparable<StreamPushIte | ||
| 46 | * mp4_vod=6, | 52 | * mp4_vod=6, |
| 47 | * device_chn=7 | 53 | * device_chn=7 |
| 48 | */ | 54 | */ |
| 55 | + @Schema(description = "产生源类型") | ||
| 49 | private int originType; | 56 | private int originType; |
| 50 | 57 | ||
| 51 | /** | 58 | /** |
| 52 | * 客户端和服务器网络信息,可能为null类型 | 59 | * 客户端和服务器网络信息,可能为null类型 |
| 53 | */ | 60 | */ |
| 61 | + @Schema(description = "客户端和服务器网络信息,可能为null类型") | ||
| 54 | private MediaItem.OriginSock originSock; | 62 | private MediaItem.OriginSock originSock; |
| 55 | 63 | ||
| 56 | /** | 64 | /** |
| 57 | * 产生源类型的字符串描述 | 65 | * 产生源类型的字符串描述 |
| 58 | */ | 66 | */ |
| 67 | + @Schema(description = "产生源类型的字符串描述") | ||
| 59 | private String originTypeStr; | 68 | private String originTypeStr; |
| 60 | 69 | ||
| 61 | /** | 70 | /** |
| 62 | * 产生源的url | 71 | * 产生源的url |
| 63 | */ | 72 | */ |
| 73 | + @Schema(description = "产生源的url") | ||
| 64 | private String originUrl; | 74 | private String originUrl; |
| 65 | 75 | ||
| 66 | /** | 76 | /** |
| 67 | * 存活时间,单位秒 | 77 | * 存活时间,单位秒 |
| 68 | */ | 78 | */ |
| 79 | + @Schema(description = "存活时间,单位秒") | ||
| 69 | private Long aliveSecond; | 80 | private Long aliveSecond; |
| 70 | 81 | ||
| 71 | /** | 82 | /** |
| 72 | * 音视频轨道 | 83 | * 音视频轨道 |
| 73 | */ | 84 | */ |
| 85 | + @Schema(description = "音视频轨道") | ||
| 74 | private List<MediaItem.MediaTrack> tracks; | 86 | private List<MediaItem.MediaTrack> tracks; |
| 75 | 87 | ||
| 76 | /** | 88 | /** |
| 77 | * 音视频轨道 | 89 | * 音视频轨道 |
| 78 | */ | 90 | */ |
| 91 | + @Schema(description = "音视频轨道") | ||
| 79 | private String vhost; | 92 | private String vhost; |
| 80 | 93 | ||
| 81 | /** | 94 | /** |
| 82 | * 使用的流媒体ID | 95 | * 使用的流媒体ID |
| 83 | */ | 96 | */ |
| 97 | + @Schema(description = "使用的流媒体ID") | ||
| 84 | private String mediaServerId; | 98 | private String mediaServerId; |
| 85 | 99 | ||
| 86 | /** | 100 | /** |
| 87 | * 使用的服务ID | 101 | * 使用的服务ID |
| 88 | */ | 102 | */ |
| 103 | + @Schema(description = "使用的服务ID") | ||
| 89 | private String serverId; | 104 | private String serverId; |
| 90 | 105 | ||
| 91 | /** | 106 | /** |
| 92 | * 推流时间 | 107 | * 推流时间 |
| 93 | */ | 108 | */ |
| 109 | + @Schema(description = "推流时间") | ||
| 94 | private String pushTime; | 110 | private String pushTime; |
| 95 | 111 | ||
| 96 | /** | 112 | /** |
| 97 | * 更新时间 | 113 | * 更新时间 |
| 98 | */ | 114 | */ |
| 115 | + @Schema(description = "更新时间") | ||
| 99 | private String updateTime; | 116 | private String updateTime; |
| 100 | 117 | ||
| 101 | /** | 118 | /** |
| 102 | * 创建时间 | 119 | * 创建时间 |
| 103 | */ | 120 | */ |
| 121 | + @Schema(description = "创建时间") | ||
| 104 | private String createTime; | 122 | private String createTime; |
| 105 | 123 | ||
| 106 | /** | 124 | /** |
| 107 | * 是否正在推流 | 125 | * 是否正在推流 |
| 108 | */ | 126 | */ |
| 127 | + @Schema(description = "是否正在推流") | ||
| 109 | private boolean pushIng; | 128 | private boolean pushIng; |
| 110 | 129 | ||
| 111 | /** | 130 | /** |
| 112 | * 是否自己平台的推流 | 131 | * 是否自己平台的推流 |
| 113 | */ | 132 | */ |
| 133 | + @Schema(description = "是否自己平台的推流") | ||
| 114 | private boolean self; | 134 | private boolean self; |
| 115 | 135 | ||
| 116 | 136 |
src/main/java/com/genersoft/iot/vmp/service/impl/MediaServerServiceImpl.java
| @@ -8,7 +8,6 @@ import java.util.List; | @@ -8,7 +8,6 @@ import java.util.List; | ||
| 8 | import java.util.Map; | 8 | import java.util.Map; |
| 9 | import java.util.Set; | 9 | import java.util.Set; |
| 10 | 10 | ||
| 11 | -import com.genersoft.iot.vmp.media.zlm.ZLMRunner; | ||
| 12 | import org.slf4j.Logger; | 11 | import org.slf4j.Logger; |
| 13 | import org.slf4j.LoggerFactory; | 12 | import org.slf4j.LoggerFactory; |
| 14 | import org.springframework.beans.factory.annotation.Autowired; | 13 | import org.springframework.beans.factory.annotation.Autowired; |
| @@ -54,9 +53,6 @@ public class MediaServerServiceImpl implements IMediaServerService { | @@ -54,9 +53,6 @@ public class MediaServerServiceImpl implements IMediaServerService { | ||
| 54 | @Autowired | 53 | @Autowired |
| 55 | private SipConfig sipConfig; | 54 | private SipConfig sipConfig; |
| 56 | 55 | ||
| 57 | - @Autowired | ||
| 58 | - private ZLMRunner zlmRunner; | ||
| 59 | - | ||
| 60 | @Value("${server.ssl.enabled:false}") | 56 | @Value("${server.ssl.enabled:false}") |
| 61 | private boolean sslEnabled; | 57 | private boolean sslEnabled; |
| 62 | 58 | ||
| @@ -84,8 +80,6 @@ public class MediaServerServiceImpl implements IMediaServerService { | @@ -84,8 +80,6 @@ public class MediaServerServiceImpl implements IMediaServerService { | ||
| 84 | @Autowired | 80 | @Autowired |
| 85 | private ZLMRTPServerFactory zlmrtpServerFactory; | 81 | private ZLMRTPServerFactory zlmrtpServerFactory; |
| 86 | 82 | ||
| 87 | - @Autowired | ||
| 88 | - private RedisUtil redisUtil; | ||
| 89 | 83 | ||
| 90 | @Autowired | 84 | @Autowired |
| 91 | private EventPublisher publisher; | 85 | private EventPublisher publisher; |
| @@ -104,12 +98,12 @@ public class MediaServerServiceImpl implements IMediaServerService { | @@ -104,12 +98,12 @@ public class MediaServerServiceImpl implements IMediaServerService { | ||
| 104 | if (mediaServerItem.getSsrcConfig() == null) { | 98 | if (mediaServerItem.getSsrcConfig() == null) { |
| 105 | SsrcConfig ssrcConfig = new SsrcConfig(mediaServerItem.getId(), null, sipConfig.getDomain()); | 99 | SsrcConfig ssrcConfig = new SsrcConfig(mediaServerItem.getId(), null, sipConfig.getDomain()); |
| 106 | mediaServerItem.setSsrcConfig(ssrcConfig); | 100 | mediaServerItem.setSsrcConfig(ssrcConfig); |
| 107 | - redisUtil.set(VideoManagerConstants.MEDIA_SERVER_PREFIX + userSetting.getServerId() + "_" + mediaServerItem.getId(), mediaServerItem); | 101 | + RedisUtil.set(VideoManagerConstants.MEDIA_SERVER_PREFIX + userSetting.getServerId() + "_" + mediaServerItem.getId(), mediaServerItem); |
| 108 | } | 102 | } |
| 109 | // 查询redis是否存在此mediaServer | 103 | // 查询redis是否存在此mediaServer |
| 110 | String key = VideoManagerConstants.MEDIA_SERVER_PREFIX + userSetting.getServerId() + "_" + mediaServerItem.getId(); | 104 | String key = VideoManagerConstants.MEDIA_SERVER_PREFIX + userSetting.getServerId() + "_" + mediaServerItem.getId(); |
| 111 | - if (!redisUtil.hasKey(key)) { | ||
| 112 | - redisUtil.set(key, mediaServerItem); | 105 | + if (!RedisUtil.hasKey(key)) { |
| 106 | + RedisUtil.set(key, mediaServerItem); | ||
| 113 | } | 107 | } |
| 114 | 108 | ||
| 115 | } | 109 | } |
| @@ -151,7 +145,7 @@ public class MediaServerServiceImpl implements IMediaServerService { | @@ -151,7 +145,7 @@ public class MediaServerServiceImpl implements IMediaServerService { | ||
| 151 | if (mediaServerItem.isRtpEnable()) { | 145 | if (mediaServerItem.isRtpEnable()) { |
| 152 | rtpServerPort = zlmrtpServerFactory.createRTPServer(mediaServerItem, streamId, ssrcCheck?Integer.parseInt(ssrc):0, port); | 146 | rtpServerPort = zlmrtpServerFactory.createRTPServer(mediaServerItem, streamId, ssrcCheck?Integer.parseInt(ssrc):0, port); |
| 153 | } | 147 | } |
| 154 | - redisUtil.set(key, mediaServerItem); | 148 | + RedisUtil.set(key, mediaServerItem); |
| 155 | return new SSRCInfo(rtpServerPort, ssrc, streamId); | 149 | return new SSRCInfo(rtpServerPort, ssrc, streamId); |
| 156 | } | 150 | } |
| 157 | } | 151 | } |
| @@ -184,7 +178,7 @@ public class MediaServerServiceImpl implements IMediaServerService { | @@ -184,7 +178,7 @@ public class MediaServerServiceImpl implements IMediaServerService { | ||
| 184 | ssrcConfig.releaseSsrc(ssrc); | 178 | ssrcConfig.releaseSsrc(ssrc); |
| 185 | mediaServerItem.setSsrcConfig(ssrcConfig); | 179 | mediaServerItem.setSsrcConfig(ssrcConfig); |
| 186 | String key = VideoManagerConstants.MEDIA_SERVER_PREFIX + userSetting.getServerId() + "_" + mediaServerItem.getId(); | 180 | String key = VideoManagerConstants.MEDIA_SERVER_PREFIX + userSetting.getServerId() + "_" + mediaServerItem.getId(); |
| 187 | - redisUtil.set(key, mediaServerItem); | 181 | + RedisUtil.set(key, mediaServerItem); |
| 188 | } | 182 | } |
| 189 | 183 | ||
| 190 | /** | 184 | /** |
| @@ -193,7 +187,7 @@ public class MediaServerServiceImpl implements IMediaServerService { | @@ -193,7 +187,7 @@ public class MediaServerServiceImpl implements IMediaServerService { | ||
| 193 | @Override | 187 | @Override |
| 194 | public void clearRTPServer(MediaServerItem mediaServerItem) { | 188 | public void clearRTPServer(MediaServerItem mediaServerItem) { |
| 195 | mediaServerItem.setSsrcConfig(new SsrcConfig(mediaServerItem.getId(), null, sipConfig.getDomain())); | 189 | mediaServerItem.setSsrcConfig(new SsrcConfig(mediaServerItem.getId(), null, sipConfig.getDomain())); |
| 196 | - redisUtil.zAdd(VideoManagerConstants.MEDIA_SERVERS_ONLINE_PREFIX + userSetting.getServerId(), mediaServerItem.getId(), 0); | 190 | + RedisUtil.zAdd(VideoManagerConstants.MEDIA_SERVERS_ONLINE_PREFIX + userSetting.getServerId(), mediaServerItem.getId(), 0); |
| 197 | 191 | ||
| 198 | } | 192 | } |
| 199 | 193 | ||
| @@ -215,19 +209,19 @@ public class MediaServerServiceImpl implements IMediaServerService { | @@ -215,19 +209,19 @@ public class MediaServerServiceImpl implements IMediaServerService { | ||
| 215 | ); | 209 | ); |
| 216 | } | 210 | } |
| 217 | String key = VideoManagerConstants.MEDIA_SERVER_PREFIX + userSetting.getServerId() + "_" + mediaServerItemInDataBase.getId(); | 211 | String key = VideoManagerConstants.MEDIA_SERVER_PREFIX + userSetting.getServerId() + "_" + mediaServerItemInDataBase.getId(); |
| 218 | - redisUtil.set(key, mediaServerItemInDataBase); | 212 | + RedisUtil.set(key, mediaServerItemInDataBase); |
| 219 | } | 213 | } |
| 220 | 214 | ||
| 221 | @Override | 215 | @Override |
| 222 | public List<MediaServerItem> getAll() { | 216 | public List<MediaServerItem> getAll() { |
| 223 | List<MediaServerItem> result = new ArrayList<>(); | 217 | List<MediaServerItem> result = new ArrayList<>(); |
| 224 | - List<Object> mediaServerKeys = redisUtil.scan(String.format("%S*", VideoManagerConstants.MEDIA_SERVER_PREFIX+ userSetting.getServerId() + "_" )); | 218 | + List<Object> mediaServerKeys = RedisUtil.scan(String.format("%S*", VideoManagerConstants.MEDIA_SERVER_PREFIX+ userSetting.getServerId() + "_" )); |
| 225 | String onlineKey = VideoManagerConstants.MEDIA_SERVERS_ONLINE_PREFIX + userSetting.getServerId(); | 219 | String onlineKey = VideoManagerConstants.MEDIA_SERVERS_ONLINE_PREFIX + userSetting.getServerId(); |
| 226 | for (Object mediaServerKey : mediaServerKeys) { | 220 | for (Object mediaServerKey : mediaServerKeys) { |
| 227 | String key = (String) mediaServerKey; | 221 | String key = (String) mediaServerKey; |
| 228 | - MediaServerItem mediaServerItem = (MediaServerItem) redisUtil.get(key); | 222 | + MediaServerItem mediaServerItem = (MediaServerItem) RedisUtil.get(key); |
| 229 | // 检查状态 | 223 | // 检查状态 |
| 230 | - Double aDouble = redisUtil.zScore(onlineKey, mediaServerItem.getId()); | 224 | + Double aDouble = RedisUtil.zScore(onlineKey, mediaServerItem.getId()); |
| 231 | if (aDouble != null) { | 225 | if (aDouble != null) { |
| 232 | mediaServerItem.setStatus(true); | 226 | mediaServerItem.setStatus(true); |
| 233 | } | 227 | } |
| @@ -253,13 +247,13 @@ public class MediaServerServiceImpl implements IMediaServerService { | @@ -253,13 +247,13 @@ public class MediaServerServiceImpl implements IMediaServerService { | ||
| 253 | @Override | 247 | @Override |
| 254 | public List<MediaServerItem> getAllOnline() { | 248 | public List<MediaServerItem> getAllOnline() { |
| 255 | String key = VideoManagerConstants.MEDIA_SERVERS_ONLINE_PREFIX + userSetting.getServerId(); | 249 | String key = VideoManagerConstants.MEDIA_SERVERS_ONLINE_PREFIX + userSetting.getServerId(); |
| 256 | - Set<String> mediaServerIdSet = redisUtil.zRevRange(key, 0, -1); | 250 | + Set<String> mediaServerIdSet = RedisUtil.zRevRange(key, 0, -1); |
| 257 | 251 | ||
| 258 | List<MediaServerItem> result = new ArrayList<>(); | 252 | List<MediaServerItem> result = new ArrayList<>(); |
| 259 | if (mediaServerIdSet != null && mediaServerIdSet.size() > 0) { | 253 | if (mediaServerIdSet != null && mediaServerIdSet.size() > 0) { |
| 260 | for (String mediaServerId : mediaServerIdSet) { | 254 | for (String mediaServerId : mediaServerIdSet) { |
| 261 | String serverKey = VideoManagerConstants.MEDIA_SERVER_PREFIX + userSetting.getServerId() + "_" + mediaServerId; | 255 | String serverKey = VideoManagerConstants.MEDIA_SERVER_PREFIX + userSetting.getServerId() + "_" + mediaServerId; |
| 262 | - result.add((MediaServerItem) redisUtil.get(serverKey)); | 256 | + result.add((MediaServerItem) RedisUtil.get(serverKey)); |
| 263 | } | 257 | } |
| 264 | } | 258 | } |
| 265 | Collections.reverse(result); | 259 | Collections.reverse(result); |
| @@ -277,7 +271,7 @@ public class MediaServerServiceImpl implements IMediaServerService { | @@ -277,7 +271,7 @@ public class MediaServerServiceImpl implements IMediaServerService { | ||
| 277 | return null; | 271 | return null; |
| 278 | } | 272 | } |
| 279 | String key = VideoManagerConstants.MEDIA_SERVER_PREFIX + userSetting.getServerId() + "_" + mediaServerId; | 273 | String key = VideoManagerConstants.MEDIA_SERVER_PREFIX + userSetting.getServerId() + "_" + mediaServerId; |
| 280 | - return (MediaServerItem)redisUtil.get(key); | 274 | + return (MediaServerItem)RedisUtil.get(key); |
| 281 | } | 275 | } |
| 282 | 276 | ||
| 283 | @Override | 277 | @Override |
| @@ -289,7 +283,7 @@ public class MediaServerServiceImpl implements IMediaServerService { | @@ -289,7 +283,7 @@ public class MediaServerServiceImpl implements IMediaServerService { | ||
| 289 | @Override | 283 | @Override |
| 290 | public void clearMediaServerForOnline() { | 284 | public void clearMediaServerForOnline() { |
| 291 | String key = VideoManagerConstants.MEDIA_SERVERS_ONLINE_PREFIX + userSetting.getServerId(); | 285 | String key = VideoManagerConstants.MEDIA_SERVERS_ONLINE_PREFIX + userSetting.getServerId(); |
| 292 | - redisUtil.del(key); | 286 | + RedisUtil.del(key); |
| 293 | } | 287 | } |
| 294 | 288 | ||
| 295 | @Override | 289 | @Override |
| @@ -397,14 +391,14 @@ public class MediaServerServiceImpl implements IMediaServerService { | @@ -397,14 +391,14 @@ public class MediaServerServiceImpl implements IMediaServerService { | ||
| 397 | } | 391 | } |
| 398 | mediaServerMapper.update(serverItem); | 392 | mediaServerMapper.update(serverItem); |
| 399 | String key = VideoManagerConstants.MEDIA_SERVER_PREFIX + userSetting.getServerId() + "_" + zlmServerConfig.getGeneralMediaServerId(); | 393 | String key = VideoManagerConstants.MEDIA_SERVER_PREFIX + userSetting.getServerId() + "_" + zlmServerConfig.getGeneralMediaServerId(); |
| 400 | - if (redisUtil.get(key) == null) { | 394 | + if (RedisUtil.get(key) == null) { |
| 401 | SsrcConfig ssrcConfig = new SsrcConfig(zlmServerConfig.getGeneralMediaServerId(), null, sipConfig.getDomain()); | 395 | SsrcConfig ssrcConfig = new SsrcConfig(zlmServerConfig.getGeneralMediaServerId(), null, sipConfig.getDomain()); |
| 402 | serverItem.setSsrcConfig(ssrcConfig); | 396 | serverItem.setSsrcConfig(ssrcConfig); |
| 403 | }else { | 397 | }else { |
| 404 | - MediaServerItem mediaServerItemInRedis = (MediaServerItem)redisUtil.get(key); | 398 | + MediaServerItem mediaServerItemInRedis = (MediaServerItem)RedisUtil.get(key); |
| 405 | serverItem.setSsrcConfig(mediaServerItemInRedis.getSsrcConfig()); | 399 | serverItem.setSsrcConfig(mediaServerItemInRedis.getSsrcConfig()); |
| 406 | } | 400 | } |
| 407 | - redisUtil.set(key, serverItem); | 401 | + RedisUtil.set(key, serverItem); |
| 408 | resetOnlineServerItem(serverItem); | 402 | resetOnlineServerItem(serverItem); |
| 409 | if (serverItem.isAutoConfig()) { | 403 | if (serverItem.isAutoConfig()) { |
| 410 | setZLMConfig(serverItem, "0".equals(zlmServerConfig.getHookEnable())); | 404 | setZLMConfig(serverItem, "0".equals(zlmServerConfig.getHookEnable())); |
| @@ -425,15 +419,15 @@ public class MediaServerServiceImpl implements IMediaServerService { | @@ -425,15 +419,15 @@ public class MediaServerServiceImpl implements IMediaServerService { | ||
| 425 | // 更新缓存 | 419 | // 更新缓存 |
| 426 | String key = VideoManagerConstants.MEDIA_SERVERS_ONLINE_PREFIX + userSetting.getServerId(); | 420 | String key = VideoManagerConstants.MEDIA_SERVERS_ONLINE_PREFIX + userSetting.getServerId(); |
| 427 | // 使用zset的分数作为当前并发量, 默认值设置为0 | 421 | // 使用zset的分数作为当前并发量, 默认值设置为0 |
| 428 | - if (redisUtil.zScore(key, serverItem.getId()) == null) { // 不存在则设置默认值 已存在则重置 | ||
| 429 | - redisUtil.zAdd(key, serverItem.getId(), 0L); | 422 | + if (RedisUtil.zScore(key, serverItem.getId()) == null) { // 不存在则设置默认值 已存在则重置 |
| 423 | + RedisUtil.zAdd(key, serverItem.getId(), 0L); | ||
| 430 | // 查询服务流数量 | 424 | // 查询服务流数量 |
| 431 | zlmresTfulUtils.getMediaList(serverItem, null, null, "rtmp",(mediaList ->{ | 425 | zlmresTfulUtils.getMediaList(serverItem, null, null, "rtmp",(mediaList ->{ |
| 432 | Integer code = mediaList.getInteger("code"); | 426 | Integer code = mediaList.getInteger("code"); |
| 433 | if (code == 0) { | 427 | if (code == 0) { |
| 434 | JSONArray data = mediaList.getJSONArray("data"); | 428 | JSONArray data = mediaList.getJSONArray("data"); |
| 435 | if (data != null) { | 429 | if (data != null) { |
| 436 | - redisUtil.zAdd(key, serverItem.getId(), data.size()); | 430 | + RedisUtil.zAdd(key, serverItem.getId(), data.size()); |
| 437 | } | 431 | } |
| 438 | } | 432 | } |
| 439 | })); | 433 | })); |
| @@ -450,14 +444,14 @@ public class MediaServerServiceImpl implements IMediaServerService { | @@ -450,14 +444,14 @@ public class MediaServerServiceImpl implements IMediaServerService { | ||
| 450 | return; | 444 | return; |
| 451 | } | 445 | } |
| 452 | String key = VideoManagerConstants.MEDIA_SERVERS_ONLINE_PREFIX + userSetting.getServerId(); | 446 | String key = VideoManagerConstants.MEDIA_SERVERS_ONLINE_PREFIX + userSetting.getServerId(); |
| 453 | - redisUtil.zIncrScore(key, mediaServerId, 1); | 447 | + RedisUtil.zIncrScore(key, mediaServerId, 1); |
| 454 | 448 | ||
| 455 | } | 449 | } |
| 456 | 450 | ||
| 457 | @Override | 451 | @Override |
| 458 | public void removeCount(String mediaServerId) { | 452 | public void removeCount(String mediaServerId) { |
| 459 | String key = VideoManagerConstants.MEDIA_SERVERS_ONLINE_PREFIX + userSetting.getServerId(); | 453 | String key = VideoManagerConstants.MEDIA_SERVERS_ONLINE_PREFIX + userSetting.getServerId(); |
| 460 | - redisUtil.zIncrScore(key, mediaServerId, - 1); | 454 | + RedisUtil.zIncrScore(key, mediaServerId, - 1); |
| 461 | } | 455 | } |
| 462 | 456 | ||
| 463 | /** | 457 | /** |
| @@ -468,15 +462,15 @@ public class MediaServerServiceImpl implements IMediaServerService { | @@ -468,15 +462,15 @@ public class MediaServerServiceImpl implements IMediaServerService { | ||
| 468 | public MediaServerItem getMediaServerForMinimumLoad() { | 462 | public MediaServerItem getMediaServerForMinimumLoad() { |
| 469 | String key = VideoManagerConstants.MEDIA_SERVERS_ONLINE_PREFIX + userSetting.getServerId(); | 463 | String key = VideoManagerConstants.MEDIA_SERVERS_ONLINE_PREFIX + userSetting.getServerId(); |
| 470 | 464 | ||
| 471 | - if (redisUtil.zSize(key) == null || redisUtil.zSize(key) == 0) { | ||
| 472 | - if (redisUtil.zSize(key) == null || redisUtil.zSize(key) == 0) { | 465 | + if (RedisUtil.zSize(key) == null || RedisUtil.zSize(key) == 0) { |
| 466 | + if (RedisUtil.zSize(key) == null || RedisUtil.zSize(key) == 0) { | ||
| 473 | logger.info("获取负载最低的节点时无在线节点"); | 467 | logger.info("获取负载最低的节点时无在线节点"); |
| 474 | return null; | 468 | return null; |
| 475 | } | 469 | } |
| 476 | } | 470 | } |
| 477 | 471 | ||
| 478 | // 获取分数最低的,及并发最低的 | 472 | // 获取分数最低的,及并发最低的 |
| 479 | - Set<Object> objects = redisUtil.ZRange(key, 0, -1); | 473 | + Set<Object> objects = RedisUtil.ZRange(key, 0, -1); |
| 480 | ArrayList<Object> mediaServerObjectS = new ArrayList<>(objects); | 474 | ArrayList<Object> mediaServerObjectS = new ArrayList<>(objects); |
| 481 | 475 | ||
| 482 | String mediaServerId = (String)mediaServerObjectS.get(0); | 476 | String mediaServerId = (String)mediaServerObjectS.get(0); |
| @@ -619,9 +613,9 @@ public class MediaServerServiceImpl implements IMediaServerService { | @@ -619,9 +613,9 @@ public class MediaServerServiceImpl implements IMediaServerService { | ||
| 619 | 613 | ||
| 620 | @Override | 614 | @Override |
| 621 | public void delete(String id) { | 615 | public void delete(String id) { |
| 622 | - redisUtil.zRemove(VideoManagerConstants.MEDIA_SERVERS_ONLINE_PREFIX + userSetting.getServerId(), id); | 616 | + RedisUtil.zRemove(VideoManagerConstants.MEDIA_SERVERS_ONLINE_PREFIX + userSetting.getServerId(), id); |
| 623 | String key = VideoManagerConstants.MEDIA_SERVER_PREFIX + userSetting.getServerId() + "_" + id; | 617 | String key = VideoManagerConstants.MEDIA_SERVER_PREFIX + userSetting.getServerId() + "_" + id; |
| 624 | - redisUtil.del(key); | 618 | + RedisUtil.del(key); |
| 625 | } | 619 | } |
| 626 | @Override | 620 | @Override |
| 627 | public void deleteDb(String id){ | 621 | public void deleteDb(String id){ |
| @@ -640,7 +634,7 @@ public class MediaServerServiceImpl implements IMediaServerService { | @@ -640,7 +634,7 @@ public class MediaServerServiceImpl implements IMediaServerService { | ||
| 640 | } | 634 | } |
| 641 | // zlm连接重试 | 635 | // zlm连接重试 |
| 642 | logger.warn("[更新ZLM 保活信息]失败,未找到流媒体信息,尝试重连zlm"); | 636 | logger.warn("[更新ZLM 保活信息]失败,未找到流媒体信息,尝试重连zlm"); |
| 643 | - reloadZlm(); | 637 | +// reloadZlm(); |
| 644 | mediaServerItem = getOne(mediaServerId); | 638 | mediaServerItem = getOne(mediaServerId); |
| 645 | if (mediaServerItem == null) { | 639 | if (mediaServerItem == null) { |
| 646 | // zlm连接重试 | 640 | // zlm连接重试 |
| @@ -650,7 +644,7 @@ public class MediaServerServiceImpl implements IMediaServerService { | @@ -650,7 +644,7 @@ public class MediaServerServiceImpl implements IMediaServerService { | ||
| 650 | } | 644 | } |
| 651 | String key = VideoManagerConstants.MEDIA_SERVER_KEEPALIVE_PREFIX + userSetting.getServerId() + "_" + mediaServerId; | 645 | String key = VideoManagerConstants.MEDIA_SERVER_KEEPALIVE_PREFIX + userSetting.getServerId() + "_" + mediaServerId; |
| 652 | int hookAliveInterval = mediaServerItem.getHookAliveInterval() + 2; | 646 | int hookAliveInterval = mediaServerItem.getHookAliveInterval() + 2; |
| 653 | - redisUtil.set(key, data, hookAliveInterval); | 647 | + RedisUtil.set(key, data, hookAliveInterval); |
| 654 | } | 648 | } |
| 655 | 649 | ||
| 656 | private MediaServerItem getOneFromDatabase(String mediaServerId) { | 650 | private MediaServerItem getOneFromDatabase(String mediaServerId) { |
| @@ -672,13 +666,4 @@ public class MediaServerServiceImpl implements IMediaServerService { | @@ -672,13 +666,4 @@ public class MediaServerServiceImpl implements IMediaServerService { | ||
| 672 | } | 666 | } |
| 673 | } | 667 | } |
| 674 | } | 668 | } |
| 675 | - | ||
| 676 | - public void reloadZlm(){ | ||
| 677 | - try { | ||
| 678 | - zlmRunner.run(); | ||
| 679 | - Thread.sleep(500);//延迟0.5秒缓冲时间 | ||
| 680 | - } catch (Exception e) { | ||
| 681 | - logger.warn("尝试重连zlm失败!",e); | ||
| 682 | - } | ||
| 683 | - } | ||
| 684 | } | 669 | } |
src/main/java/com/genersoft/iot/vmp/service/impl/RedisGbPlayMsgListener.java
| @@ -66,8 +66,6 @@ public class RedisGbPlayMsgListener implements MessageListener { | @@ -66,8 +66,6 @@ public class RedisGbPlayMsgListener implements MessageListener { | ||
| 66 | @Autowired | 66 | @Autowired |
| 67 | private UserSetting userSetting; | 67 | private UserSetting userSetting; |
| 68 | 68 | ||
| 69 | - @Autowired | ||
| 70 | - private RedisUtil redis; | ||
| 71 | 69 | ||
| 72 | @Autowired | 70 | @Autowired |
| 73 | private ZLMMediaListManager zlmMediaListManager; | 71 | private ZLMMediaListManager zlmMediaListManager; |
| @@ -227,7 +225,7 @@ public class RedisGbPlayMsgListener implements MessageListener { | @@ -227,7 +225,7 @@ public class RedisGbPlayMsgListener implements MessageListener { | ||
| 227 | WvpRedisMsg response = WvpRedisMsg.getResponseInstance(userSetting.getServerId(), toId, | 225 | WvpRedisMsg response = WvpRedisMsg.getResponseInstance(userSetting.getServerId(), toId, |
| 228 | WvpRedisMsgCmd.REQUEST_PUSH_STREAM, serial, result); | 226 | WvpRedisMsgCmd.REQUEST_PUSH_STREAM, serial, result); |
| 229 | JSONObject jsonObject = (JSONObject)JSON.toJSON(response); | 227 | JSONObject jsonObject = (JSONObject)JSON.toJSON(response); |
| 230 | - redis.convertAndSend(WVP_PUSH_STREAM_KEY, jsonObject); | 228 | + RedisUtil.convertAndSend(WVP_PUSH_STREAM_KEY, jsonObject); |
| 231 | } | 229 | } |
| 232 | 230 | ||
| 233 | /** | 231 | /** |
| @@ -246,7 +244,7 @@ public class RedisGbPlayMsgListener implements MessageListener { | @@ -246,7 +244,7 @@ public class RedisGbPlayMsgListener implements MessageListener { | ||
| 246 | WvpRedisMsgCmd.GET_SEND_ITEM, serial, result); | 244 | WvpRedisMsgCmd.GET_SEND_ITEM, serial, result); |
| 247 | 245 | ||
| 248 | JSONObject jsonObject = (JSONObject)JSON.toJSON(response); | 246 | JSONObject jsonObject = (JSONObject)JSON.toJSON(response); |
| 249 | - redis.convertAndSend(WVP_PUSH_STREAM_KEY, jsonObject); | 247 | + RedisUtil.convertAndSend(WVP_PUSH_STREAM_KEY, jsonObject); |
| 250 | return; | 248 | return; |
| 251 | } | 249 | } |
| 252 | // 确定流是否在线 | 250 | // 确定流是否在线 |
| @@ -269,7 +267,7 @@ public class RedisGbPlayMsgListener implements MessageListener { | @@ -269,7 +267,7 @@ public class RedisGbPlayMsgListener implements MessageListener { | ||
| 269 | userSetting.getServerId(), toId, WvpRedisMsgCmd.GET_SEND_ITEM, serial, result | 267 | userSetting.getServerId(), toId, WvpRedisMsgCmd.GET_SEND_ITEM, serial, result |
| 270 | ); | 268 | ); |
| 271 | JSONObject jsonObject = (JSONObject)JSON.toJSON(response); | 269 | JSONObject jsonObject = (JSONObject)JSON.toJSON(response); |
| 272 | - redis.convertAndSend(WVP_PUSH_STREAM_KEY, jsonObject); | 270 | + RedisUtil.convertAndSend(WVP_PUSH_STREAM_KEY, jsonObject); |
| 273 | }, userSetting.getPlatformPlayTimeout()); | 271 | }, userSetting.getPlatformPlayTimeout()); |
| 274 | 272 | ||
| 275 | // 添加订阅 | 273 | // 添加订阅 |
| @@ -308,7 +306,7 @@ public class RedisGbPlayMsgListener implements MessageListener { | @@ -308,7 +306,7 @@ public class RedisGbPlayMsgListener implements MessageListener { | ||
| 308 | userSetting.getServerId(), toId, WvpRedisMsgCmd.GET_SEND_ITEM, serial, result | 306 | userSetting.getServerId(), toId, WvpRedisMsgCmd.GET_SEND_ITEM, serial, result |
| 309 | ); | 307 | ); |
| 310 | JSONObject jsonObject = (JSONObject)JSON.toJSON(response); | 308 | JSONObject jsonObject = (JSONObject)JSON.toJSON(response); |
| 311 | - redis.convertAndSend(WVP_PUSH_STREAM_KEY, jsonObject); | 309 | + RedisUtil.convertAndSend(WVP_PUSH_STREAM_KEY, jsonObject); |
| 312 | } | 310 | } |
| 313 | 311 | ||
| 314 | /** | 312 | /** |
| @@ -345,7 +343,7 @@ public class RedisGbPlayMsgListener implements MessageListener { | @@ -345,7 +343,7 @@ public class RedisGbPlayMsgListener implements MessageListener { | ||
| 345 | wvpResult.setMsg("timeout"); | 343 | wvpResult.setMsg("timeout"); |
| 346 | errorCallback.handler(wvpResult); | 344 | errorCallback.handler(wvpResult); |
| 347 | }, userSetting.getPlatformPlayTimeout()); | 345 | }, userSetting.getPlatformPlayTimeout()); |
| 348 | - redis.convertAndSend(WVP_PUSH_STREAM_KEY, jsonObject); | 346 | + RedisUtil.convertAndSend(WVP_PUSH_STREAM_KEY, jsonObject); |
| 349 | } | 347 | } |
| 350 | 348 | ||
| 351 | /** | 349 | /** |
| @@ -370,6 +368,6 @@ public class RedisGbPlayMsgListener implements MessageListener { | @@ -370,6 +368,6 @@ public class RedisGbPlayMsgListener implements MessageListener { | ||
| 370 | callbacksForStartSendRtpStream.remove(key); | 368 | callbacksForStartSendRtpStream.remove(key); |
| 371 | callbacksForError.remove(key); | 369 | callbacksForError.remove(key); |
| 372 | }); | 370 | }); |
| 373 | - redis.convertAndSend(WVP_PUSH_STREAM_KEY, jsonObject); | 371 | + RedisUtil.convertAndSend(WVP_PUSH_STREAM_KEY, jsonObject); |
| 374 | } | 372 | } |
| 375 | } | 373 | } |
src/main/java/com/genersoft/iot/vmp/service/impl/RedisStreamMsgListener.java
| @@ -27,15 +27,6 @@ public class RedisStreamMsgListener implements MessageListener { | @@ -27,15 +27,6 @@ public class RedisStreamMsgListener implements MessageListener { | ||
| 27 | private final static Logger logger = LoggerFactory.getLogger(RedisStreamMsgListener.class); | 27 | private final static Logger logger = LoggerFactory.getLogger(RedisStreamMsgListener.class); |
| 28 | 28 | ||
| 29 | @Autowired | 29 | @Autowired |
| 30 | - private ISIPCommander commander; | ||
| 31 | - | ||
| 32 | - @Autowired | ||
| 33 | - private ISIPCommanderForPlatform commanderForPlatform; | ||
| 34 | - | ||
| 35 | - @Autowired | ||
| 36 | - private IVideoManagerStorage storage; | ||
| 37 | - | ||
| 38 | - @Autowired | ||
| 39 | private UserSetting userSetting; | 30 | private UserSetting userSetting; |
| 40 | 31 | ||
| 41 | @Autowired | 32 | @Autowired |
src/main/java/com/genersoft/iot/vmp/storager/impl/RedisCatchStorageImpl.java
| @@ -22,7 +22,6 @@ import org.slf4j.Logger; | @@ -22,7 +22,6 @@ import org.slf4j.Logger; | ||
| 22 | import org.slf4j.LoggerFactory; | 22 | import org.slf4j.LoggerFactory; |
| 23 | import org.springframework.beans.factory.annotation.Autowired; | 23 | import org.springframework.beans.factory.annotation.Autowired; |
| 24 | import org.springframework.stereotype.Component; | 24 | import org.springframework.stereotype.Component; |
| 25 | -import org.springframework.util.StringUtils; | ||
| 26 | 25 | ||
| 27 | import java.util.*; | 26 | import java.util.*; |
| 28 | 27 | ||
| @@ -33,9 +32,6 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { | @@ -33,9 +32,6 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { | ||
| 33 | private final Logger logger = LoggerFactory.getLogger(RedisCatchStorageImpl.class); | 32 | private final Logger logger = LoggerFactory.getLogger(RedisCatchStorageImpl.class); |
| 34 | 33 | ||
| 35 | @Autowired | 34 | @Autowired |
| 36 | - private RedisUtil redis; | ||
| 37 | - | ||
| 38 | - @Autowired | ||
| 39 | private DeviceChannelMapper deviceChannelMapper; | 35 | private DeviceChannelMapper deviceChannelMapper; |
| 40 | 36 | ||
| 41 | @Autowired | 37 | @Autowired |
| @@ -45,9 +41,9 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { | @@ -45,9 +41,9 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { | ||
| 45 | public Long getCSEQ() { | 41 | public Long getCSEQ() { |
| 46 | String key = VideoManagerConstants.SIP_CSEQ_PREFIX + userSetting.getServerId(); | 42 | String key = VideoManagerConstants.SIP_CSEQ_PREFIX + userSetting.getServerId(); |
| 47 | 43 | ||
| 48 | - long result = redis.incr(key, 1L); | 44 | + long result = RedisUtil.incr(key, 1L); |
| 49 | if (result > Integer.MAX_VALUE) { | 45 | if (result > Integer.MAX_VALUE) { |
| 50 | - redis.set(key, 1); | 46 | + RedisUtil.set(key, 1); |
| 51 | result = 1; | 47 | result = 1; |
| 52 | } | 48 | } |
| 53 | return result; | 49 | return result; |
| @@ -57,9 +53,9 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { | @@ -57,9 +53,9 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { | ||
| 57 | public Long getSN(String method) { | 53 | public Long getSN(String method) { |
| 58 | String key = VideoManagerConstants.SIP_SN_PREFIX + userSetting.getServerId() + "_" + method; | 54 | String key = VideoManagerConstants.SIP_SN_PREFIX + userSetting.getServerId() + "_" + method; |
| 59 | 55 | ||
| 60 | - long result = redis.incr(key, 1L); | 56 | + long result = RedisUtil.incr(key, 1L); |
| 61 | if (result > Integer.MAX_VALUE) { | 57 | if (result > Integer.MAX_VALUE) { |
| 62 | - redis.set(key, 1); | 58 | + RedisUtil.set(key, 1); |
| 63 | result = 1; | 59 | result = 1; |
| 64 | } | 60 | } |
| 65 | return result; | 61 | return result; |
| @@ -68,20 +64,20 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { | @@ -68,20 +64,20 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { | ||
| 68 | @Override | 64 | @Override |
| 69 | public void resetAllCSEQ() { | 65 | public void resetAllCSEQ() { |
| 70 | String scanKey = VideoManagerConstants.SIP_CSEQ_PREFIX + userSetting.getServerId() + "_*"; | 66 | String scanKey = VideoManagerConstants.SIP_CSEQ_PREFIX + userSetting.getServerId() + "_*"; |
| 71 | - List<Object> keys = redis.scan(scanKey); | 67 | + List<Object> keys = RedisUtil.scan(scanKey); |
| 72 | for (Object o : keys) { | 68 | for (Object o : keys) { |
| 73 | String key = (String) o; | 69 | String key = (String) o; |
| 74 | - redis.set(key, 1); | 70 | + RedisUtil.set(key, 1); |
| 75 | } | 71 | } |
| 76 | } | 72 | } |
| 77 | 73 | ||
| 78 | @Override | 74 | @Override |
| 79 | public void resetAllSN() { | 75 | public void resetAllSN() { |
| 80 | String scanKey = VideoManagerConstants.SIP_SN_PREFIX + userSetting.getServerId() + "_*"; | 76 | String scanKey = VideoManagerConstants.SIP_SN_PREFIX + userSetting.getServerId() + "_*"; |
| 81 | - List<Object> keys = redis.scan(scanKey); | 77 | + List<Object> keys = RedisUtil.scan(scanKey); |
| 82 | for (Object o : keys) { | 78 | for (Object o : keys) { |
| 83 | String key = (String) o; | 79 | String key = (String) o; |
| 84 | - redis.set(key, 1); | 80 | + RedisUtil.set(key, 1); |
| 85 | } | 81 | } |
| 86 | } | 82 | } |
| 87 | 83 | ||
| @@ -92,7 +88,7 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { | @@ -92,7 +88,7 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { | ||
| 92 | */ | 88 | */ |
| 93 | @Override | 89 | @Override |
| 94 | public boolean startPlay(StreamInfo stream) { | 90 | public boolean startPlay(StreamInfo stream) { |
| 95 | - return redis.set(String.format("%S_%S_%s_%s_%s", VideoManagerConstants.PLAYER_PREFIX, userSetting.getServerId(), | 91 | + return RedisUtil.set(String.format("%S_%S_%s_%s_%s", VideoManagerConstants.PLAYER_PREFIX, userSetting.getServerId(), |
| 96 | stream.getStream(), stream.getDeviceID(), stream.getChannelId()), | 92 | stream.getStream(), stream.getDeviceID(), stream.getChannelId()), |
| 97 | stream); | 93 | stream); |
| 98 | } | 94 | } |
| @@ -107,7 +103,7 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { | @@ -107,7 +103,7 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { | ||
| 107 | if (streamInfo == null) { | 103 | if (streamInfo == null) { |
| 108 | return false; | 104 | return false; |
| 109 | } | 105 | } |
| 110 | - return redis.del(String.format("%S_%s_%s_%s_%s", VideoManagerConstants.PLAYER_PREFIX, | 106 | + return RedisUtil.del(String.format("%S_%s_%s_%s_%s", VideoManagerConstants.PLAYER_PREFIX, |
| 111 | userSetting.getServerId(), | 107 | userSetting.getServerId(), |
| 112 | streamInfo.getStream(), | 108 | streamInfo.getStream(), |
| 113 | streamInfo.getDeviceID(), | 109 | streamInfo.getDeviceID(), |
| @@ -120,7 +116,7 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { | @@ -120,7 +116,7 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { | ||
| 120 | */ | 116 | */ |
| 121 | @Override | 117 | @Override |
| 122 | public StreamInfo queryPlay(StreamInfo streamInfo) { | 118 | public StreamInfo queryPlay(StreamInfo streamInfo) { |
| 123 | - return (StreamInfo)redis.get(String.format("%S_%s_%s_%s_%s", | 119 | + return (StreamInfo)RedisUtil.get(String.format("%S_%s_%s_%s_%s", |
| 124 | VideoManagerConstants.PLAYER_PREFIX, | 120 | VideoManagerConstants.PLAYER_PREFIX, |
| 125 | userSetting.getServerId(), | 121 | userSetting.getServerId(), |
| 126 | streamInfo.getStream(), | 122 | streamInfo.getStream(), |
| @@ -129,36 +125,36 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { | @@ -129,36 +125,36 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { | ||
| 129 | } | 125 | } |
| 130 | @Override | 126 | @Override |
| 131 | public StreamInfo queryPlayByStreamId(String streamId) { | 127 | public StreamInfo queryPlayByStreamId(String streamId) { |
| 132 | - List<Object> playLeys = redis.scan(String.format("%S_%s_%s_*", VideoManagerConstants.PLAYER_PREFIX, userSetting.getServerId(), streamId)); | 128 | + List<Object> playLeys = RedisUtil.scan(String.format("%S_%s_%s_*", VideoManagerConstants.PLAYER_PREFIX, userSetting.getServerId(), streamId)); |
| 133 | if (playLeys == null || playLeys.size() == 0) { | 129 | if (playLeys == null || playLeys.size() == 0) { |
| 134 | return null; | 130 | return null; |
| 135 | } | 131 | } |
| 136 | - return (StreamInfo)redis.get(playLeys.get(0).toString()); | 132 | + return (StreamInfo)RedisUtil.get(playLeys.get(0).toString()); |
| 137 | } | 133 | } |
| 138 | 134 | ||
| 139 | @Override | 135 | @Override |
| 140 | public StreamInfo queryPlayByDevice(String deviceId, String channelId) { | 136 | public StreamInfo queryPlayByDevice(String deviceId, String channelId) { |
| 141 | - List<Object> playLeys = redis.scan(String.format("%S_%s_*_%s_%s", VideoManagerConstants.PLAYER_PREFIX, | 137 | + List<Object> playLeys = RedisUtil.scan(String.format("%S_%s_*_%s_%s", VideoManagerConstants.PLAYER_PREFIX, |
| 142 | userSetting.getServerId(), | 138 | userSetting.getServerId(), |
| 143 | deviceId, | 139 | deviceId, |
| 144 | channelId)); | 140 | channelId)); |
| 145 | if (playLeys == null || playLeys.size() == 0) { | 141 | if (playLeys == null || playLeys.size() == 0) { |
| 146 | return null; | 142 | return null; |
| 147 | } | 143 | } |
| 148 | - return (StreamInfo)redis.get(playLeys.get(0).toString()); | 144 | + return (StreamInfo)RedisUtil.get(playLeys.get(0).toString()); |
| 149 | } | 145 | } |
| 150 | 146 | ||
| 151 | @Override | 147 | @Override |
| 152 | public Map<String, StreamInfo> queryPlayByDeviceId(String deviceId) { | 148 | public Map<String, StreamInfo> queryPlayByDeviceId(String deviceId) { |
| 153 | Map<String, StreamInfo> streamInfos = new HashMap<>(); | 149 | Map<String, StreamInfo> streamInfos = new HashMap<>(); |
| 154 | -// List<Object> playLeys = redis.keys(String.format("%S_*_%S_*", VideoManagerConstants.PLAYER_PREFIX, deviceId)); | ||
| 155 | - List<Object> players = redis.scan(String.format("%S_%s_*_%S_*", VideoManagerConstants.PLAYER_PREFIX, userSetting.getServerId(),deviceId)); | 150 | +// List<Object> playLeys = RedisUtil.keys(String.format("%S_*_%S_*", VideoManagerConstants.PLAYER_PREFIX, deviceId)); |
| 151 | + List<Object> players = RedisUtil.scan(String.format("%S_%s_*_%S_*", VideoManagerConstants.PLAYER_PREFIX, userSetting.getServerId(),deviceId)); | ||
| 156 | if (players.size() == 0) { | 152 | if (players.size() == 0) { |
| 157 | return streamInfos; | 153 | return streamInfos; |
| 158 | } | 154 | } |
| 159 | for (Object player : players) { | 155 | for (Object player : players) { |
| 160 | String key = (String) player; | 156 | String key = (String) player; |
| 161 | - StreamInfo streamInfo = (StreamInfo) redis.get(key); | 157 | + StreamInfo streamInfo = (StreamInfo) RedisUtil.get(key); |
| 162 | streamInfos.put(streamInfo.getDeviceID() + "_" + streamInfo.getChannelId(), streamInfo); | 158 | streamInfos.put(streamInfo.getDeviceID() + "_" + streamInfo.getChannelId(), streamInfo); |
| 163 | } | 159 | } |
| 164 | return streamInfos; | 160 | return streamInfos; |
| @@ -167,7 +163,7 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { | @@ -167,7 +163,7 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { | ||
| 167 | 163 | ||
| 168 | @Override | 164 | @Override |
| 169 | public boolean startPlayback(StreamInfo stream, String callId) { | 165 | public boolean startPlayback(StreamInfo stream, String callId) { |
| 170 | - return redis.set(String.format("%S_%s_%s_%s_%s_%s", VideoManagerConstants.PLAY_BLACK_PREFIX, | 166 | + return RedisUtil.set(String.format("%S_%s_%s_%s_%s_%s", VideoManagerConstants.PLAY_BLACK_PREFIX, |
| 171 | userSetting.getServerId(), stream.getDeviceID(), stream.getChannelId(), stream.getStream(), callId), stream); | 167 | userSetting.getServerId(), stream.getDeviceID(), stream.getChannelId(), stream.getStream(), callId), stream); |
| 172 | } | 168 | } |
| 173 | 169 | ||
| @@ -175,10 +171,10 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { | @@ -175,10 +171,10 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { | ||
| 175 | public boolean startDownload(StreamInfo stream, String callId) { | 171 | public boolean startDownload(StreamInfo stream, String callId) { |
| 176 | boolean result; | 172 | boolean result; |
| 177 | if (stream.getProgress() == 1) { | 173 | if (stream.getProgress() == 1) { |
| 178 | - result = redis.set(String.format("%S_%s_%s_%s_%s_%s", VideoManagerConstants.DOWNLOAD_PREFIX, | 174 | + result = RedisUtil.set(String.format("%S_%s_%s_%s_%s_%s", VideoManagerConstants.DOWNLOAD_PREFIX, |
| 179 | userSetting.getServerId(), stream.getDeviceID(), stream.getChannelId(), stream.getStream(), callId), stream); | 175 | userSetting.getServerId(), stream.getDeviceID(), stream.getChannelId(), stream.getStream(), callId), stream); |
| 180 | }else { | 176 | }else { |
| 181 | - result = redis.set(String.format("%S_%s_%s_%s_%s_%s", VideoManagerConstants.DOWNLOAD_PREFIX, | 177 | + result = RedisUtil.set(String.format("%S_%s_%s_%s_%s_%s", VideoManagerConstants.DOWNLOAD_PREFIX, |
| 182 | userSetting.getServerId(), stream.getDeviceID(), stream.getChannelId(), stream.getStream(), callId), stream, 60*60); | 178 | userSetting.getServerId(), stream.getDeviceID(), stream.getChannelId(), stream.getStream(), callId), stream, 60*60); |
| 183 | } | 179 | } |
| 184 | return result; | 180 | return result; |
| @@ -210,10 +206,10 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { | @@ -210,10 +206,10 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { | ||
| 210 | stream, | 206 | stream, |
| 211 | callId | 207 | callId |
| 212 | ); | 208 | ); |
| 213 | - List<Object> scan = redis.scan(key); | 209 | + List<Object> scan = RedisUtil.scan(key); |
| 214 | if (scan.size() > 0) { | 210 | if (scan.size() > 0) { |
| 215 | for (Object keyObj : scan) { | 211 | for (Object keyObj : scan) { |
| 216 | - redis.del((String) keyObj); | 212 | + RedisUtil.del((String) keyObj); |
| 217 | } | 213 | } |
| 218 | } | 214 | } |
| 219 | return true; | 215 | return true; |
| @@ -246,10 +242,10 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { | @@ -246,10 +242,10 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { | ||
| 246 | stream, | 242 | stream, |
| 247 | callId | 243 | callId |
| 248 | ); | 244 | ); |
| 249 | - List<Object> scan = redis.scan(key); | 245 | + List<Object> scan = RedisUtil.scan(key); |
| 250 | if (scan.size() > 0) { | 246 | if (scan.size() > 0) { |
| 251 | for (Object keyObj : scan) { | 247 | for (Object keyObj : scan) { |
| 252 | - redis.del((String) keyObj); | 248 | + RedisUtil.del((String) keyObj); |
| 253 | } | 249 | } |
| 254 | } | 250 | } |
| 255 | return true; | 251 | return true; |
| @@ -279,9 +275,9 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { | @@ -279,9 +275,9 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { | ||
| 279 | stream, | 275 | stream, |
| 280 | callId | 276 | callId |
| 281 | ); | 277 | ); |
| 282 | - List<Object> streamInfoScan = redis.scan(key); | 278 | + List<Object> streamInfoScan = RedisUtil.scan(key); |
| 283 | if (streamInfoScan.size() > 0) { | 279 | if (streamInfoScan.size() > 0) { |
| 284 | - return (StreamInfo) redis.get((String) streamInfoScan.get(0)); | 280 | + return (StreamInfo) RedisUtil.get((String) streamInfoScan.get(0)); |
| 285 | }else { | 281 | }else { |
| 286 | return null; | 282 | return null; |
| 287 | } | 283 | } |
| @@ -290,64 +286,64 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { | @@ -290,64 +286,64 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { | ||
| 290 | @Override | 286 | @Override |
| 291 | public void updatePlatformCatchInfo(ParentPlatformCatch parentPlatformCatch) { | 287 | public void updatePlatformCatchInfo(ParentPlatformCatch parentPlatformCatch) { |
| 292 | String key = VideoManagerConstants.PLATFORM_CATCH_PREFIX + userSetting.getServerId() + "_" + parentPlatformCatch.getId(); | 288 | String key = VideoManagerConstants.PLATFORM_CATCH_PREFIX + userSetting.getServerId() + "_" + parentPlatformCatch.getId(); |
| 293 | - redis.set(key, parentPlatformCatch); | 289 | + RedisUtil.set(key, parentPlatformCatch); |
| 294 | } | 290 | } |
| 295 | 291 | ||
| 296 | @Override | 292 | @Override |
| 297 | public void updatePlatformKeepalive(ParentPlatform parentPlatform) { | 293 | public void updatePlatformKeepalive(ParentPlatform parentPlatform) { |
| 298 | String key = VideoManagerConstants.PLATFORM_KEEPALIVE_PREFIX + userSetting.getServerId() + "_" + parentPlatform.getServerGBId(); | 294 | String key = VideoManagerConstants.PLATFORM_KEEPALIVE_PREFIX + userSetting.getServerId() + "_" + parentPlatform.getServerGBId(); |
| 299 | - redis.set(key, "", Integer.parseInt(parentPlatform.getKeepTimeout())); | 295 | + RedisUtil.set(key, "", Integer.parseInt(parentPlatform.getKeepTimeout())); |
| 300 | } | 296 | } |
| 301 | 297 | ||
| 302 | @Override | 298 | @Override |
| 303 | public void updatePlatformRegister(ParentPlatform parentPlatform) { | 299 | public void updatePlatformRegister(ParentPlatform parentPlatform) { |
| 304 | String key = VideoManagerConstants.PLATFORM_REGISTER_PREFIX + userSetting.getServerId() + "_" + parentPlatform.getServerGBId(); | 300 | String key = VideoManagerConstants.PLATFORM_REGISTER_PREFIX + userSetting.getServerId() + "_" + parentPlatform.getServerGBId(); |
| 305 | - redis.set(key, "", Integer.parseInt(parentPlatform.getExpires())); | 301 | + RedisUtil.set(key, "", Integer.parseInt(parentPlatform.getExpires())); |
| 306 | } | 302 | } |
| 307 | 303 | ||
| 308 | @Override | 304 | @Override |
| 309 | public ParentPlatformCatch queryPlatformCatchInfo(String platformGbId) { | 305 | public ParentPlatformCatch queryPlatformCatchInfo(String platformGbId) { |
| 310 | - return (ParentPlatformCatch)redis.get(VideoManagerConstants.PLATFORM_CATCH_PREFIX + userSetting.getServerId() + "_" + platformGbId); | 306 | + return (ParentPlatformCatch)RedisUtil.get(VideoManagerConstants.PLATFORM_CATCH_PREFIX + userSetting.getServerId() + "_" + platformGbId); |
| 311 | } | 307 | } |
| 312 | 308 | ||
| 313 | @Override | 309 | @Override |
| 314 | public void delPlatformCatchInfo(String platformGbId) { | 310 | public void delPlatformCatchInfo(String platformGbId) { |
| 315 | - redis.del(VideoManagerConstants.PLATFORM_CATCH_PREFIX + userSetting.getServerId() + "_" + platformGbId); | 311 | + RedisUtil.del(VideoManagerConstants.PLATFORM_CATCH_PREFIX + userSetting.getServerId() + "_" + platformGbId); |
| 316 | } | 312 | } |
| 317 | 313 | ||
| 318 | @Override | 314 | @Override |
| 319 | public void delPlatformKeepalive(String platformGbId) { | 315 | public void delPlatformKeepalive(String platformGbId) { |
| 320 | - redis.del(VideoManagerConstants.PLATFORM_KEEPALIVE_PREFIX + userSetting.getServerId() + "_" + platformGbId); | 316 | + RedisUtil.del(VideoManagerConstants.PLATFORM_KEEPALIVE_PREFIX + userSetting.getServerId() + "_" + platformGbId); |
| 321 | } | 317 | } |
| 322 | 318 | ||
| 323 | @Override | 319 | @Override |
| 324 | public void delPlatformRegister(String platformGbId) { | 320 | public void delPlatformRegister(String platformGbId) { |
| 325 | - redis.del(VideoManagerConstants.PLATFORM_REGISTER_PREFIX + userSetting.getServerId() + "_" + platformGbId); | 321 | + RedisUtil.del(VideoManagerConstants.PLATFORM_REGISTER_PREFIX + userSetting.getServerId() + "_" + platformGbId); |
| 326 | } | 322 | } |
| 327 | 323 | ||
| 328 | 324 | ||
| 329 | @Override | 325 | @Override |
| 330 | public void updatePlatformRegisterInfo(String callId, String platformGbId) { | 326 | public void updatePlatformRegisterInfo(String callId, String platformGbId) { |
| 331 | String key = VideoManagerConstants.PLATFORM_REGISTER_INFO_PREFIX + userSetting.getServerId() + "_" + callId; | 327 | String key = VideoManagerConstants.PLATFORM_REGISTER_INFO_PREFIX + userSetting.getServerId() + "_" + callId; |
| 332 | - redis.set(key, platformGbId, 30); | 328 | + RedisUtil.set(key, platformGbId, 30); |
| 333 | } | 329 | } |
| 334 | 330 | ||
| 335 | 331 | ||
| 336 | @Override | 332 | @Override |
| 337 | public String queryPlatformRegisterInfo(String callId) { | 333 | public String queryPlatformRegisterInfo(String callId) { |
| 338 | - return (String)redis.get(VideoManagerConstants.PLATFORM_REGISTER_INFO_PREFIX + userSetting.getServerId() + "_" + callId); | 334 | + return (String)RedisUtil.get(VideoManagerConstants.PLATFORM_REGISTER_INFO_PREFIX + userSetting.getServerId() + "_" + callId); |
| 339 | } | 335 | } |
| 340 | 336 | ||
| 341 | @Override | 337 | @Override |
| 342 | public void delPlatformRegisterInfo(String callId) { | 338 | public void delPlatformRegisterInfo(String callId) { |
| 343 | - redis.del(VideoManagerConstants.PLATFORM_REGISTER_INFO_PREFIX + userSetting.getServerId() + "_" + callId); | 339 | + RedisUtil.del(VideoManagerConstants.PLATFORM_REGISTER_INFO_PREFIX + userSetting.getServerId() + "_" + callId); |
| 344 | } | 340 | } |
| 345 | 341 | ||
| 346 | @Override | 342 | @Override |
| 347 | public void cleanPlatformRegisterInfos() { | 343 | public void cleanPlatformRegisterInfos() { |
| 348 | - List regInfos = redis.scan(VideoManagerConstants.PLATFORM_REGISTER_INFO_PREFIX + userSetting.getServerId() + "_" + "*"); | 344 | + List regInfos = RedisUtil.scan(VideoManagerConstants.PLATFORM_REGISTER_INFO_PREFIX + userSetting.getServerId() + "_" + "*"); |
| 349 | for (Object key : regInfos) { | 345 | for (Object key : regInfos) { |
| 350 | - redis.del(key.toString()); | 346 | + RedisUtil.del(key.toString()); |
| 351 | } | 347 | } |
| 352 | } | 348 | } |
| 353 | 349 | ||
| @@ -356,7 +352,7 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { | @@ -356,7 +352,7 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { | ||
| 356 | String key = VideoManagerConstants.PLATFORM_SEND_RTP_INFO_PREFIX + userSetting.getServerId() + "_" | 352 | String key = VideoManagerConstants.PLATFORM_SEND_RTP_INFO_PREFIX + userSetting.getServerId() + "_" |
| 357 | + sendRtpItem.getPlatformId() + "_" + sendRtpItem.getChannelId() + "_" | 353 | + sendRtpItem.getPlatformId() + "_" + sendRtpItem.getChannelId() + "_" |
| 358 | + sendRtpItem.getStreamId() + "_" + sendRtpItem.getCallId(); | 354 | + sendRtpItem.getStreamId() + "_" + sendRtpItem.getCallId(); |
| 359 | - redis.set(key, sendRtpItem); | 355 | + RedisUtil.set(key, sendRtpItem); |
| 360 | } | 356 | } |
| 361 | 357 | ||
| 362 | @Override | 358 | @Override |
| @@ -375,9 +371,9 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { | @@ -375,9 +371,9 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { | ||
| 375 | } | 371 | } |
| 376 | String key = VideoManagerConstants.PLATFORM_SEND_RTP_INFO_PREFIX + userSetting.getServerId() + "_" + platformGbId | 372 | String key = VideoManagerConstants.PLATFORM_SEND_RTP_INFO_PREFIX + userSetting.getServerId() + "_" + platformGbId |
| 377 | + "_" + channelId + "_" + streamId + "_" + callId; | 373 | + "_" + channelId + "_" + streamId + "_" + callId; |
| 378 | - List<Object> scan = redis.scan(key); | 374 | + List<Object> scan = RedisUtil.scan(key); |
| 379 | if (scan.size() > 0) { | 375 | if (scan.size() > 0) { |
| 380 | - return (SendRtpItem)redis.get((String)scan.get(0)); | 376 | + return (SendRtpItem)RedisUtil.get((String)scan.get(0)); |
| 381 | }else { | 377 | }else { |
| 382 | return null; | 378 | return null; |
| 383 | } | 379 | } |
| @@ -389,12 +385,12 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { | @@ -389,12 +385,12 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { | ||
| 389 | platformGbId = "*"; | 385 | platformGbId = "*"; |
| 390 | } | 386 | } |
| 391 | String key = VideoManagerConstants.PLATFORM_SEND_RTP_INFO_PREFIX + userSetting.getServerId() + "_" + platformGbId + "_*" + "_*" + "_*"; | 387 | String key = VideoManagerConstants.PLATFORM_SEND_RTP_INFO_PREFIX + userSetting.getServerId() + "_" + platformGbId + "_*" + "_*" + "_*"; |
| 392 | - List<Object> queryResult = redis.scan(key); | 388 | + List<Object> queryResult = RedisUtil.scan(key); |
| 393 | List<SendRtpItem> result= new ArrayList<>(); | 389 | List<SendRtpItem> result= new ArrayList<>(); |
| 394 | 390 | ||
| 395 | for (Object o : queryResult) { | 391 | for (Object o : queryResult) { |
| 396 | String keyItem = (String) o; | 392 | String keyItem = (String) o; |
| 397 | - result.add((SendRtpItem) redis.get(keyItem)); | 393 | + result.add((SendRtpItem) RedisUtil.get(keyItem)); |
| 398 | } | 394 | } |
| 399 | 395 | ||
| 400 | return result; | 396 | return result; |
| @@ -415,10 +411,10 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { | @@ -415,10 +411,10 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { | ||
| 415 | } | 411 | } |
| 416 | String key = VideoManagerConstants.PLATFORM_SEND_RTP_INFO_PREFIX + userSetting.getServerId() + "_" + platformGbId | 412 | String key = VideoManagerConstants.PLATFORM_SEND_RTP_INFO_PREFIX + userSetting.getServerId() + "_" + platformGbId |
| 417 | + "_" + channelId + "_" + streamId + "_" + callId; | 413 | + "_" + channelId + "_" + streamId + "_" + callId; |
| 418 | - List<Object> scan = redis.scan(key); | 414 | + List<Object> scan = RedisUtil.scan(key); |
| 419 | if (scan.size() > 0) { | 415 | if (scan.size() > 0) { |
| 420 | for (Object keyStr : scan) { | 416 | for (Object keyStr : scan) { |
| 421 | - redis.del((String)keyStr); | 417 | + RedisUtil.del((String)keyStr); |
| 422 | } | 418 | } |
| 423 | } | 419 | } |
| 424 | } | 420 | } |
| @@ -432,7 +428,7 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { | @@ -432,7 +428,7 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { | ||
| 432 | @Override | 428 | @Override |
| 433 | public boolean isChannelSendingRTP(String channelId) { | 429 | public boolean isChannelSendingRTP(String channelId) { |
| 434 | String key = VideoManagerConstants.PLATFORM_SEND_RTP_INFO_PREFIX + userSetting.getServerId() + "_" + "*_" + channelId + "*_" + "*_"; | 430 | String key = VideoManagerConstants.PLATFORM_SEND_RTP_INFO_PREFIX + userSetting.getServerId() + "_" + "*_" + channelId + "*_" + "*_"; |
| 435 | - List<Object> RtpStreams = redis.scan(key); | 431 | + List<Object> RtpStreams = RedisUtil.scan(key); |
| 436 | if (RtpStreams.size() > 0) { | 432 | if (RtpStreams.size() > 0) { |
| 437 | return true; | 433 | return true; |
| 438 | } else { | 434 | } else { |
| @@ -442,30 +438,30 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { | @@ -442,30 +438,30 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { | ||
| 442 | 438 | ||
| 443 | @Override | 439 | @Override |
| 444 | public void clearCatchByDeviceId(String deviceId) { | 440 | public void clearCatchByDeviceId(String deviceId) { |
| 445 | - List<Object> playLeys = redis.scan(String.format("%S_%s_*_%s_*", VideoManagerConstants.PLAYER_PREFIX, | 441 | + List<Object> playLeys = RedisUtil.scan(String.format("%S_%s_*_%s_*", VideoManagerConstants.PLAYER_PREFIX, |
| 446 | userSetting.getServerId(), | 442 | userSetting.getServerId(), |
| 447 | deviceId)); | 443 | deviceId)); |
| 448 | if (playLeys.size() > 0) { | 444 | if (playLeys.size() > 0) { |
| 449 | for (Object key : playLeys) { | 445 | for (Object key : playLeys) { |
| 450 | - redis.del(key.toString()); | 446 | + RedisUtil.del(key.toString()); |
| 451 | } | 447 | } |
| 452 | } | 448 | } |
| 453 | 449 | ||
| 454 | - List<Object> playBackers = redis.scan(String.format("%S_%s_%s_*_*_*", VideoManagerConstants.PLAY_BLACK_PREFIX, | 450 | + List<Object> playBackers = RedisUtil.scan(String.format("%S_%s_%s_*_*_*", VideoManagerConstants.PLAY_BLACK_PREFIX, |
| 455 | userSetting.getServerId(), | 451 | userSetting.getServerId(), |
| 456 | deviceId)); | 452 | deviceId)); |
| 457 | if (playBackers.size() > 0) { | 453 | if (playBackers.size() > 0) { |
| 458 | for (Object key : playBackers) { | 454 | for (Object key : playBackers) { |
| 459 | - redis.del(key.toString()); | 455 | + RedisUtil.del(key.toString()); |
| 460 | } | 456 | } |
| 461 | } | 457 | } |
| 462 | 458 | ||
| 463 | - List<Object> deviceCache = redis.scan(String.format("%S%s_%s", VideoManagerConstants.DEVICE_PREFIX, | 459 | + List<Object> deviceCache = RedisUtil.scan(String.format("%S%s_%s", VideoManagerConstants.DEVICE_PREFIX, |
| 464 | userSetting.getServerId(), | 460 | userSetting.getServerId(), |
| 465 | deviceId)); | 461 | deviceId)); |
| 466 | if (deviceCache.size() > 0) { | 462 | if (deviceCache.size() > 0) { |
| 467 | for (Object key : deviceCache) { | 463 | for (Object key : deviceCache) { |
| 468 | - redis.del(key.toString()); | 464 | + RedisUtil.del(key.toString()); |
| 469 | } | 465 | } |
| 470 | } | 466 | } |
| 471 | } | 467 | } |
| @@ -473,14 +469,14 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { | @@ -473,14 +469,14 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { | ||
| 473 | @Override | 469 | @Override |
| 474 | public void updateWVPInfo(JSONObject jsonObject, int time) { | 470 | public void updateWVPInfo(JSONObject jsonObject, int time) { |
| 475 | String key = VideoManagerConstants.WVP_SERVER_PREFIX + userSetting.getServerId(); | 471 | String key = VideoManagerConstants.WVP_SERVER_PREFIX + userSetting.getServerId(); |
| 476 | - redis.set(key, jsonObject, time); | 472 | + RedisUtil.set(key, jsonObject, time); |
| 477 | } | 473 | } |
| 478 | 474 | ||
| 479 | @Override | 475 | @Override |
| 480 | public void sendStreamChangeMsg(String type, JSONObject jsonObject) { | 476 | public void sendStreamChangeMsg(String type, JSONObject jsonObject) { |
| 481 | String key = VideoManagerConstants.WVP_MSG_STREAM_CHANGE_PREFIX + type; | 477 | String key = VideoManagerConstants.WVP_MSG_STREAM_CHANGE_PREFIX + type; |
| 482 | logger.info("[redis 流变化事件] {}: {}", key, jsonObject.toString()); | 478 | logger.info("[redis 流变化事件] {}: {}", key, jsonObject.toString()); |
| 483 | - redis.convertAndSend(key, jsonObject); | 479 | + RedisUtil.convertAndSend(key, jsonObject); |
| 484 | } | 480 | } |
| 485 | 481 | ||
| 486 | @Override | 482 | @Override |
| @@ -491,13 +487,13 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { | @@ -491,13 +487,13 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { | ||
| 491 | if (streamAuthorityInfo != null) { | 487 | if (streamAuthorityInfo != null) { |
| 492 | mediaItem.setCallId(streamAuthorityInfo.getCallId()); | 488 | mediaItem.setCallId(streamAuthorityInfo.getCallId()); |
| 493 | } | 489 | } |
| 494 | - redis.set(key, mediaItem); | 490 | + RedisUtil.set(key, mediaItem); |
| 495 | } | 491 | } |
| 496 | 492 | ||
| 497 | @Override | 493 | @Override |
| 498 | public void removeStream(String mediaServerId, String type, String app, String streamId) { | 494 | public void removeStream(String mediaServerId, String type, String app, String streamId) { |
| 499 | String key = VideoManagerConstants.WVP_SERVER_STREAM_PREFIX + userSetting.getServerId() + "_" + type + "_" + app + "_" + streamId + "_" + mediaServerId; | 495 | String key = VideoManagerConstants.WVP_SERVER_STREAM_PREFIX + userSetting.getServerId() + "_" + type + "_" + app + "_" + streamId + "_" + mediaServerId; |
| 500 | - redis.del(key); | 496 | + RedisUtil.del(key); |
| 501 | } | 497 | } |
| 502 | 498 | ||
| 503 | @Override | 499 | @Override |
| @@ -524,9 +520,9 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { | @@ -524,9 +520,9 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { | ||
| 524 | stream, | 520 | stream, |
| 525 | callId | 521 | callId |
| 526 | ); | 522 | ); |
| 527 | - List<Object> streamInfoScan = redis.scan(key); | 523 | + List<Object> streamInfoScan = RedisUtil.scan(key); |
| 528 | if (streamInfoScan.size() > 0) { | 524 | if (streamInfoScan.size() > 0) { |
| 529 | - return (StreamInfo) redis.get((String) streamInfoScan.get(0)); | 525 | + return (StreamInfo) RedisUtil.get((String) streamInfoScan.get(0)); |
| 530 | }else { | 526 | }else { |
| 531 | return null; | 527 | return null; |
| 532 | } | 528 | } |
| @@ -535,16 +531,16 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { | @@ -535,16 +531,16 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { | ||
| 535 | @Override | 531 | @Override |
| 536 | public ThirdPartyGB queryMemberNoGBId(String queryKey) { | 532 | public ThirdPartyGB queryMemberNoGBId(String queryKey) { |
| 537 | String key = VideoManagerConstants.WVP_STREAM_GB_ID_PREFIX + queryKey; | 533 | String key = VideoManagerConstants.WVP_STREAM_GB_ID_PREFIX + queryKey; |
| 538 | - JSONObject jsonObject = (JSONObject)redis.get(key); | 534 | + JSONObject jsonObject = (JSONObject)RedisUtil.get(key); |
| 539 | return JSONObject.toJavaObject(jsonObject, ThirdPartyGB.class); | 535 | return JSONObject.toJavaObject(jsonObject, ThirdPartyGB.class); |
| 540 | } | 536 | } |
| 541 | 537 | ||
| 542 | @Override | 538 | @Override |
| 543 | public void removeStream(String mediaServerId, String type) { | 539 | public void removeStream(String mediaServerId, String type) { |
| 544 | String key = VideoManagerConstants.WVP_SERVER_STREAM_PREFIX + userSetting.getServerId() + "_" + type + "_*_*_" + mediaServerId; | 540 | String key = VideoManagerConstants.WVP_SERVER_STREAM_PREFIX + userSetting.getServerId() + "_" + type + "_*_*_" + mediaServerId; |
| 545 | - List<Object> streams = redis.scan(key); | 541 | + List<Object> streams = RedisUtil.scan(key); |
| 546 | for (Object stream : streams) { | 542 | for (Object stream : streams) { |
| 547 | - redis.del((String) stream); | 543 | + RedisUtil.del((String) stream); |
| 548 | } | 544 | } |
| 549 | } | 545 | } |
| 550 | 546 | ||
| @@ -552,9 +548,9 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { | @@ -552,9 +548,9 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { | ||
| 552 | public List<MediaItem> getStreams(String mediaServerId, String type) { | 548 | public List<MediaItem> getStreams(String mediaServerId, String type) { |
| 553 | List<MediaItem> result = new ArrayList<>(); | 549 | List<MediaItem> result = new ArrayList<>(); |
| 554 | String key = VideoManagerConstants.WVP_SERVER_STREAM_PREFIX + userSetting.getServerId() + "_" + type + "_*_*_" + mediaServerId; | 550 | String key = VideoManagerConstants.WVP_SERVER_STREAM_PREFIX + userSetting.getServerId() + "_" + type + "_*_*_" + mediaServerId; |
| 555 | - List<Object> streams = redis.scan(key); | 551 | + List<Object> streams = RedisUtil.scan(key); |
| 556 | for (Object stream : streams) { | 552 | for (Object stream : streams) { |
| 557 | - MediaItem mediaItem = (MediaItem)redis.get((String) stream); | 553 | + MediaItem mediaItem = (MediaItem)RedisUtil.get((String) stream); |
| 558 | result.add(mediaItem); | 554 | result.add(mediaItem); |
| 559 | } | 555 | } |
| 560 | return result; | 556 | return result; |
| @@ -563,43 +559,43 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { | @@ -563,43 +559,43 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { | ||
| 563 | @Override | 559 | @Override |
| 564 | public void updateDevice(Device device) { | 560 | public void updateDevice(Device device) { |
| 565 | String key = VideoManagerConstants.DEVICE_PREFIX + userSetting.getServerId() + "_" + device.getDeviceId(); | 561 | String key = VideoManagerConstants.DEVICE_PREFIX + userSetting.getServerId() + "_" + device.getDeviceId(); |
| 566 | - redis.set(key, device); | 562 | + RedisUtil.set(key, device); |
| 567 | } | 563 | } |
| 568 | 564 | ||
| 569 | @Override | 565 | @Override |
| 570 | public void removeDevice(String deviceId) { | 566 | public void removeDevice(String deviceId) { |
| 571 | String key = VideoManagerConstants.DEVICE_PREFIX + userSetting.getServerId() + "_" + deviceId; | 567 | String key = VideoManagerConstants.DEVICE_PREFIX + userSetting.getServerId() + "_" + deviceId; |
| 572 | - redis.del(key); | 568 | + RedisUtil.del(key); |
| 573 | } | 569 | } |
| 574 | 570 | ||
| 575 | @Override | 571 | @Override |
| 576 | public Device getDevice(String deviceId) { | 572 | public Device getDevice(String deviceId) { |
| 577 | String key = VideoManagerConstants.DEVICE_PREFIX + userSetting.getServerId() + "_" + deviceId; | 573 | String key = VideoManagerConstants.DEVICE_PREFIX + userSetting.getServerId() + "_" + deviceId; |
| 578 | - return (Device)redis.get(key); | 574 | + return (Device)RedisUtil.get(key); |
| 579 | } | 575 | } |
| 580 | 576 | ||
| 581 | @Override | 577 | @Override |
| 582 | public void updateGpsMsgInfo(GPSMsgInfo gpsMsgInfo) { | 578 | public void updateGpsMsgInfo(GPSMsgInfo gpsMsgInfo) { |
| 583 | String key = VideoManagerConstants.WVP_STREAM_GPS_MSG_PREFIX + userSetting.getServerId() + "_" + gpsMsgInfo.getId(); | 579 | String key = VideoManagerConstants.WVP_STREAM_GPS_MSG_PREFIX + userSetting.getServerId() + "_" + gpsMsgInfo.getId(); |
| 584 | - redis.set(key, gpsMsgInfo, 60); // 默认GPS消息保存1分钟 | 580 | + RedisUtil.set(key, gpsMsgInfo, 60); // 默认GPS消息保存1分钟 |
| 585 | } | 581 | } |
| 586 | 582 | ||
| 587 | @Override | 583 | @Override |
| 588 | public GPSMsgInfo getGpsMsgInfo(String gbId) { | 584 | public GPSMsgInfo getGpsMsgInfo(String gbId) { |
| 589 | String key = VideoManagerConstants.WVP_STREAM_GPS_MSG_PREFIX + userSetting.getServerId() + "_" + gbId; | 585 | String key = VideoManagerConstants.WVP_STREAM_GPS_MSG_PREFIX + userSetting.getServerId() + "_" + gbId; |
| 590 | - return (GPSMsgInfo)redis.get(key); | 586 | + return (GPSMsgInfo)RedisUtil.get(key); |
| 591 | } | 587 | } |
| 592 | 588 | ||
| 593 | @Override | 589 | @Override |
| 594 | public List<GPSMsgInfo> getAllGpsMsgInfo() { | 590 | public List<GPSMsgInfo> getAllGpsMsgInfo() { |
| 595 | String scanKey = VideoManagerConstants.WVP_STREAM_GPS_MSG_PREFIX + userSetting.getServerId() + "_*"; | 591 | String scanKey = VideoManagerConstants.WVP_STREAM_GPS_MSG_PREFIX + userSetting.getServerId() + "_*"; |
| 596 | List<GPSMsgInfo> result = new ArrayList<>(); | 592 | List<GPSMsgInfo> result = new ArrayList<>(); |
| 597 | - List<Object> keys = redis.scan(scanKey); | 593 | + List<Object> keys = RedisUtil.scan(scanKey); |
| 598 | for (Object o : keys) { | 594 | for (Object o : keys) { |
| 599 | String key = (String) o; | 595 | String key = (String) o; |
| 600 | - GPSMsgInfo gpsMsgInfo = (GPSMsgInfo) redis.get(key); | 596 | + GPSMsgInfo gpsMsgInfo = (GPSMsgInfo) RedisUtil.get(key); |
| 601 | if (!gpsMsgInfo.isStored()) { // 只取没有存过得 | 597 | if (!gpsMsgInfo.isStored()) { // 只取没有存过得 |
| 602 | - result.add((GPSMsgInfo) redis.get(key)); | 598 | + result.add((GPSMsgInfo) RedisUtil.get(key)); |
| 603 | } | 599 | } |
| 604 | } | 600 | } |
| 605 | 601 | ||
| @@ -609,19 +605,19 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { | @@ -609,19 +605,19 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { | ||
| 609 | @Override | 605 | @Override |
| 610 | public void updateStreamAuthorityInfo(String app, String stream, StreamAuthorityInfo streamAuthorityInfo) { | 606 | public void updateStreamAuthorityInfo(String app, String stream, StreamAuthorityInfo streamAuthorityInfo) { |
| 611 | String key = VideoManagerConstants.MEDIA_STREAM_AUTHORITY + userSetting.getServerId() + "_" + app+ "_" + stream; | 607 | String key = VideoManagerConstants.MEDIA_STREAM_AUTHORITY + userSetting.getServerId() + "_" + app+ "_" + stream; |
| 612 | - redis.set(key, streamAuthorityInfo); | 608 | + RedisUtil.set(key, streamAuthorityInfo); |
| 613 | } | 609 | } |
| 614 | 610 | ||
| 615 | @Override | 611 | @Override |
| 616 | public void removeStreamAuthorityInfo(String app, String stream) { | 612 | public void removeStreamAuthorityInfo(String app, String stream) { |
| 617 | String key = VideoManagerConstants.MEDIA_STREAM_AUTHORITY + userSetting.getServerId() + "_" + app+ "_" + stream ; | 613 | String key = VideoManagerConstants.MEDIA_STREAM_AUTHORITY + userSetting.getServerId() + "_" + app+ "_" + stream ; |
| 618 | - redis.del(key); | 614 | + RedisUtil.del(key); |
| 619 | } | 615 | } |
| 620 | 616 | ||
| 621 | @Override | 617 | @Override |
| 622 | public StreamAuthorityInfo getStreamAuthorityInfo(String app, String stream) { | 618 | public StreamAuthorityInfo getStreamAuthorityInfo(String app, String stream) { |
| 623 | String key = VideoManagerConstants.MEDIA_STREAM_AUTHORITY + userSetting.getServerId() + "_" + app+ "_" + stream ; | 619 | String key = VideoManagerConstants.MEDIA_STREAM_AUTHORITY + userSetting.getServerId() + "_" + app+ "_" + stream ; |
| 624 | - return (StreamAuthorityInfo) redis.get(key); | 620 | + return (StreamAuthorityInfo) RedisUtil.get(key); |
| 625 | 621 | ||
| 626 | } | 622 | } |
| 627 | 623 | ||
| @@ -631,10 +627,10 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { | @@ -631,10 +627,10 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { | ||
| 631 | String scanKey = VideoManagerConstants.WVP_SERVER_STREAM_PREFIX + userSetting.getServerId() + "_*_" + app + "_" + streamId + "_" + mediaServerId; | 627 | String scanKey = VideoManagerConstants.WVP_SERVER_STREAM_PREFIX + userSetting.getServerId() + "_*_" + app + "_" + streamId + "_" + mediaServerId; |
| 632 | 628 | ||
| 633 | MediaItem result = null; | 629 | MediaItem result = null; |
| 634 | - List<Object> keys = redis.scan(scanKey); | 630 | + List<Object> keys = RedisUtil.scan(scanKey); |
| 635 | if (keys.size() > 0) { | 631 | if (keys.size() > 0) { |
| 636 | String key = (String) keys.get(0); | 632 | String key = (String) keys.get(0); |
| 637 | - result = (MediaItem)redis.get(key); | 633 | + result = (MediaItem)RedisUtil.get(key); |
| 638 | } | 634 | } |
| 639 | 635 | ||
| 640 | return result; | 636 | return result; |
| @@ -646,11 +642,11 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { | @@ -646,11 +642,11 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { | ||
| 646 | SystemInfoDto<Double> systemInfoDto = new SystemInfoDto<>(); | 642 | SystemInfoDto<Double> systemInfoDto = new SystemInfoDto<>(); |
| 647 | systemInfoDto.setTime(DateUtil.getNow()); | 643 | systemInfoDto.setTime(DateUtil.getNow()); |
| 648 | systemInfoDto.setData(cpuInfo); | 644 | systemInfoDto.setData(cpuInfo); |
| 649 | - redis.lSet(key, systemInfoDto); | 645 | + RedisUtil.lSet(key, systemInfoDto); |
| 650 | // 每秒一个,最多只存30个 | 646 | // 每秒一个,最多只存30个 |
| 651 | - if (redis.lGetListSize(key) > 30) { | ||
| 652 | - for (int i = 0; i < redis.lGetListSize(key) - 30; i++) { | ||
| 653 | - redis.lLeftPop(key); | 647 | + if (RedisUtil.lGetListSize(key) > 30) { |
| 648 | + for (int i = 0; i < RedisUtil.lGetListSize(key) - 30; i++) { | ||
| 649 | + RedisUtil.lLeftPop(key); | ||
| 654 | } | 650 | } |
| 655 | } | 651 | } |
| 656 | } | 652 | } |
| @@ -661,11 +657,11 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { | @@ -661,11 +657,11 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { | ||
| 661 | SystemInfoDto<Double> systemInfoDto = new SystemInfoDto<>(); | 657 | SystemInfoDto<Double> systemInfoDto = new SystemInfoDto<>(); |
| 662 | systemInfoDto.setTime(DateUtil.getNow()); | 658 | systemInfoDto.setTime(DateUtil.getNow()); |
| 663 | systemInfoDto.setData(memInfo); | 659 | systemInfoDto.setData(memInfo); |
| 664 | - redis.lSet(key, systemInfoDto); | 660 | + RedisUtil.lSet(key, systemInfoDto); |
| 665 | // 每秒一个,最多只存30个 | 661 | // 每秒一个,最多只存30个 |
| 666 | - if (redis.lGetListSize(key) > 30) { | ||
| 667 | - for (int i = 0; i < redis.lGetListSize(key) - 30; i++) { | ||
| 668 | - redis.lLeftPop(key); | 662 | + if (RedisUtil.lGetListSize(key) > 30) { |
| 663 | + for (int i = 0; i < RedisUtil.lGetListSize(key) - 30; i++) { | ||
| 664 | + RedisUtil.lLeftPop(key); | ||
| 669 | } | 665 | } |
| 670 | } | 666 | } |
| 671 | } | 667 | } |
| @@ -676,11 +672,11 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { | @@ -676,11 +672,11 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { | ||
| 676 | SystemInfoDto<Map<String, String>> systemInfoDto = new SystemInfoDto<>(); | 672 | SystemInfoDto<Map<String, String>> systemInfoDto = new SystemInfoDto<>(); |
| 677 | systemInfoDto.setTime(DateUtil.getNow()); | 673 | systemInfoDto.setTime(DateUtil.getNow()); |
| 678 | systemInfoDto.setData(networkInterfaces); | 674 | systemInfoDto.setData(networkInterfaces); |
| 679 | - redis.lSet(key, systemInfoDto); | 675 | + RedisUtil.lSet(key, systemInfoDto); |
| 680 | // 每秒一个,最多只存30个 | 676 | // 每秒一个,最多只存30个 |
| 681 | - if (redis.lGetListSize(key) > 30) { | ||
| 682 | - for (int i = 0; i < redis.lGetListSize(key) - 30; i++) { | ||
| 683 | - redis.lLeftPop(key); | 677 | + if (RedisUtil.lGetListSize(key) > 30) { |
| 678 | + for (int i = 0; i < RedisUtil.lGetListSize(key) - 30; i++) { | ||
| 679 | + RedisUtil.lLeftPop(key); | ||
| 684 | } | 680 | } |
| 685 | } | 681 | } |
| 686 | } | 682 | } |
| @@ -689,21 +685,21 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { | @@ -689,21 +685,21 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { | ||
| 689 | public void sendMobilePositionMsg(JSONObject jsonObject) { | 685 | public void sendMobilePositionMsg(JSONObject jsonObject) { |
| 690 | String key = VideoManagerConstants.VM_MSG_SUBSCRIBE_MOBILE_POSITION; | 686 | String key = VideoManagerConstants.VM_MSG_SUBSCRIBE_MOBILE_POSITION; |
| 691 | logger.info("[redis发送通知]移动位置 {}: {}", key, jsonObject.toString()); | 687 | logger.info("[redis发送通知]移动位置 {}: {}", key, jsonObject.toString()); |
| 692 | - redis.convertAndSend(key, jsonObject); | 688 | + RedisUtil.convertAndSend(key, jsonObject); |
| 693 | } | 689 | } |
| 694 | 690 | ||
| 695 | @Override | 691 | @Override |
| 696 | public void sendStreamPushRequestedMsg(MessageForPushChannel msg) { | 692 | public void sendStreamPushRequestedMsg(MessageForPushChannel msg) { |
| 697 | String key = VideoManagerConstants.VM_MSG_STREAM_PUSH_REQUESTED; | 693 | String key = VideoManagerConstants.VM_MSG_STREAM_PUSH_REQUESTED; |
| 698 | logger.info("[redis发送通知]推流被请求 {}: {}/{}", key, msg.getApp(), msg.getStream()); | 694 | logger.info("[redis发送通知]推流被请求 {}: {}/{}", key, msg.getApp(), msg.getStream()); |
| 699 | - redis.convertAndSend(key, (JSONObject)JSON.toJSON(msg)); | 695 | + RedisUtil.convertAndSend(key, (JSONObject)JSON.toJSON(msg)); |
| 700 | } | 696 | } |
| 701 | 697 | ||
| 702 | @Override | 698 | @Override |
| 703 | public void sendAlarmMsg(AlarmChannelMessage msg) { | 699 | public void sendAlarmMsg(AlarmChannelMessage msg) { |
| 704 | String key = VideoManagerConstants.VM_MSG_SUBSCRIBE_ALARM; | 700 | String key = VideoManagerConstants.VM_MSG_SUBSCRIBE_ALARM; |
| 705 | logger.info("[redis发送通知] 报警{}: {}", key, JSON.toJSON(msg)); | 701 | logger.info("[redis发送通知] 报警{}: {}", key, JSON.toJSON(msg)); |
| 706 | - redis.convertAndSend(key, (JSONObject)JSON.toJSON(msg)); | 702 | + RedisUtil.convertAndSend(key, (JSONObject)JSON.toJSON(msg)); |
| 707 | } | 703 | } |
| 708 | 704 | ||
| 709 | @Override | 705 | @Override |
| @@ -718,6 +714,6 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { | @@ -718,6 +714,6 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { | ||
| 718 | logger.info("[redis通知]获取所有推流设备的状态"); | 714 | logger.info("[redis通知]获取所有推流设备的状态"); |
| 719 | JSONObject jsonObject = new JSONObject(); | 715 | JSONObject jsonObject = new JSONObject(); |
| 720 | jsonObject.put(key, key); | 716 | jsonObject.put(key, key); |
| 721 | - redis.convertAndSend(key, jsonObject); | 717 | + RedisUtil.convertAndSend(key, jsonObject); |
| 722 | } | 718 | } |
| 723 | } | 719 | } |
src/main/java/com/genersoft/iot/vmp/utils/redis/RedisUtil.java
| @@ -4,6 +4,7 @@ import java.util.*; | @@ -4,6 +4,7 @@ import java.util.*; | ||
| 4 | import java.util.concurrent.TimeUnit; | 4 | import java.util.concurrent.TimeUnit; |
| 5 | 5 | ||
| 6 | import com.alibaba.fastjson.JSONObject; | 6 | import com.alibaba.fastjson.JSONObject; |
| 7 | +import com.genersoft.iot.vmp.utils.SpringBeanFactory; | ||
| 7 | import org.springframework.beans.factory.annotation.Autowired; | 8 | import org.springframework.beans.factory.annotation.Autowired; |
| 8 | import org.springframework.data.redis.core.*; | 9 | import org.springframework.data.redis.core.*; |
| 9 | import org.springframework.stereotype.Component; | 10 | import org.springframework.stereotype.Component; |
| @@ -14,12 +15,14 @@ import org.springframework.util.CollectionUtils; | @@ -14,12 +15,14 @@ import org.springframework.util.CollectionUtils; | ||
| 14 | * @author: swwheihei | 15 | * @author: swwheihei |
| 15 | * @date: 2020年5月6日 下午8:27:29 | 16 | * @date: 2020年5月6日 下午8:27:29 |
| 16 | */ | 17 | */ |
| 17 | -@Component | ||
| 18 | @SuppressWarnings(value = {"rawtypes", "unchecked"}) | 18 | @SuppressWarnings(value = {"rawtypes", "unchecked"}) |
| 19 | public class RedisUtil { | 19 | public class RedisUtil { |
| 20 | 20 | ||
| 21 | - @Autowired | ||
| 22 | - private RedisTemplate redisTemplate; | 21 | + private static RedisTemplate redisTemplate; |
| 22 | + | ||
| 23 | + static { | ||
| 24 | + redisTemplate = (RedisTemplate)SpringBeanFactory.getBean("redisTemplate"); | ||
| 25 | + } | ||
| 23 | 26 | ||
| 24 | /** | 27 | /** |
| 25 | * 指定缓存失效时间 | 28 | * 指定缓存失效时间 |
| @@ -27,7 +30,7 @@ public class RedisUtil { | @@ -27,7 +30,7 @@ public class RedisUtil { | ||
| 27 | * @param time 时间(秒) | 30 | * @param time 时间(秒) |
| 28 | * @return true / false | 31 | * @return true / false |
| 29 | */ | 32 | */ |
| 30 | - public boolean expire(String key, long time) { | 33 | + public static boolean expire(String key, long time) { |
| 31 | try { | 34 | try { |
| 32 | if (time > 0) { | 35 | if (time > 0) { |
| 33 | redisTemplate.expire(key, time, TimeUnit.SECONDS); | 36 | redisTemplate.expire(key, time, TimeUnit.SECONDS); |
| @@ -44,7 +47,7 @@ public class RedisUtil { | @@ -44,7 +47,7 @@ public class RedisUtil { | ||
| 44 | * @param key 键 | 47 | * @param key 键 |
| 45 | * @return | 48 | * @return |
| 46 | */ | 49 | */ |
| 47 | - public long getExpire(String key) { | 50 | + public static long getExpire(String key) { |
| 48 | return redisTemplate.getExpire(key, TimeUnit.SECONDS); | 51 | return redisTemplate.getExpire(key, TimeUnit.SECONDS); |
| 49 | } | 52 | } |
| 50 | 53 | ||
| @@ -53,7 +56,7 @@ public class RedisUtil { | @@ -53,7 +56,7 @@ public class RedisUtil { | ||
| 53 | * @param key 键 | 56 | * @param key 键 |
| 54 | * @return true / false | 57 | * @return true / false |
| 55 | */ | 58 | */ |
| 56 | - public boolean hasKey(String key) { | 59 | + public static boolean hasKey(String key) { |
| 57 | try { | 60 | try { |
| 58 | return redisTemplate.hasKey(key); | 61 | return redisTemplate.hasKey(key); |
| 59 | } catch (Exception e) { | 62 | } catch (Exception e) { |
| @@ -67,7 +70,7 @@ public class RedisUtil { | @@ -67,7 +70,7 @@ public class RedisUtil { | ||
| 67 | * @SuppressWarnings("unchecked") 忽略类型转换警告 | 70 | * @SuppressWarnings("unchecked") 忽略类型转换警告 |
| 68 | * @param key 键(一个或者多个) | 71 | * @param key 键(一个或者多个) |
| 69 | */ | 72 | */ |
| 70 | - public boolean del(String... key) { | 73 | + public static boolean del(String... key) { |
| 71 | try { | 74 | try { |
| 72 | if (key != null && key.length > 0) { | 75 | if (key != null && key.length > 0) { |
| 73 | if (key.length == 1) { | 76 | if (key.length == 1) { |
| @@ -91,7 +94,7 @@ public class RedisUtil { | @@ -91,7 +94,7 @@ public class RedisUtil { | ||
| 91 | * @param key 键 | 94 | * @param key 键 |
| 92 | * @return 值 | 95 | * @return 值 |
| 93 | */ | 96 | */ |
| 94 | - public Object get(String key) { | 97 | + public static Object get(String key) { |
| 95 | return key == null ? null : redisTemplate.opsForValue().get(key); | 98 | return key == null ? null : redisTemplate.opsForValue().get(key); |
| 96 | } | 99 | } |
| 97 | 100 | ||
| @@ -101,7 +104,7 @@ public class RedisUtil { | @@ -101,7 +104,7 @@ public class RedisUtil { | ||
| 101 | * @param value 值 | 104 | * @param value 值 |
| 102 | * @return true / false | 105 | * @return true / false |
| 103 | */ | 106 | */ |
| 104 | - public boolean set(String key, Object value) { | 107 | + public static boolean set(String key, Object value) { |
| 105 | try { | 108 | try { |
| 106 | redisTemplate.opsForValue().set(key, value); | 109 | redisTemplate.opsForValue().set(key, value); |
| 107 | return true; | 110 | return true; |
| @@ -118,7 +121,7 @@ public class RedisUtil { | @@ -118,7 +121,7 @@ public class RedisUtil { | ||
| 118 | * @param time 时间(秒),如果 time < 0 则设置无限时间 | 121 | * @param time 时间(秒),如果 time < 0 则设置无限时间 |
| 119 | * @return true / false | 122 | * @return true / false |
| 120 | */ | 123 | */ |
| 121 | - public boolean set(String key, Object value, long time) { | 124 | + public static boolean set(String key, Object value, long time) { |
| 122 | try { | 125 | try { |
| 123 | if (time > 0) { | 126 | if (time > 0) { |
| 124 | redisTemplate.opsForValue().set(key, value, time, TimeUnit.SECONDS); | 127 | redisTemplate.opsForValue().set(key, value, time, TimeUnit.SECONDS); |
| @@ -138,7 +141,7 @@ public class RedisUtil { | @@ -138,7 +141,7 @@ public class RedisUtil { | ||
| 138 | * @param delta 递增大小 | 141 | * @param delta 递增大小 |
| 139 | * @return | 142 | * @return |
| 140 | */ | 143 | */ |
| 141 | - public long incr(String key, long delta) { | 144 | + public static long incr(String key, long delta) { |
| 142 | if (delta < 0) { | 145 | if (delta < 0) { |
| 143 | throw new RuntimeException("递增因子必须大于 0"); | 146 | throw new RuntimeException("递增因子必须大于 0"); |
| 144 | } | 147 | } |
| @@ -151,7 +154,7 @@ public class RedisUtil { | @@ -151,7 +154,7 @@ public class RedisUtil { | ||
| 151 | * @param delta 递减大小 | 154 | * @param delta 递减大小 |
| 152 | * @return | 155 | * @return |
| 153 | */ | 156 | */ |
| 154 | - public long decr(String key, long delta) { | 157 | + public static long decr(String key, long delta) { |
| 155 | if (delta < 0) { | 158 | if (delta < 0) { |
| 156 | throw new RuntimeException("递减因子必须大于 0"); | 159 | throw new RuntimeException("递减因子必须大于 0"); |
| 157 | } | 160 | } |
| @@ -166,7 +169,7 @@ public class RedisUtil { | @@ -166,7 +169,7 @@ public class RedisUtil { | ||
| 166 | * @param item 项(no null) | 169 | * @param item 项(no null) |
| 167 | * @return 值 | 170 | * @return 值 |
| 168 | */ | 171 | */ |
| 169 | - public Object hget(String key, String item) { | 172 | + public static Object hget(String key, String item) { |
| 170 | return redisTemplate.opsForHash().get(key, item); | 173 | return redisTemplate.opsForHash().get(key, item); |
| 171 | } | 174 | } |
| 172 | 175 | ||
| @@ -175,7 +178,7 @@ public class RedisUtil { | @@ -175,7 +178,7 @@ public class RedisUtil { | ||
| 175 | * @param key 键(no null) | 178 | * @param key 键(no null) |
| 176 | * @return 对应的多个键值 | 179 | * @return 对应的多个键值 |
| 177 | */ | 180 | */ |
| 178 | - public Map<Object, Object> hmget(String key) { | 181 | + public static Map<Object, Object> hmget(String key) { |
| 179 | return redisTemplate.opsForHash().entries(key); | 182 | return redisTemplate.opsForHash().entries(key); |
| 180 | } | 183 | } |
| 181 | 184 | ||
| @@ -185,7 +188,7 @@ public class RedisUtil { | @@ -185,7 +188,7 @@ public class RedisUtil { | ||
| 185 | * @param map 值 | 188 | * @param map 值 |
| 186 | * @return true / false | 189 | * @return true / false |
| 187 | */ | 190 | */ |
| 188 | - public boolean hmset(String key, Map<Object, Object> map) { | 191 | + public static boolean hmset(String key, Map<Object, Object> map) { |
| 189 | try { | 192 | try { |
| 190 | redisTemplate.opsForHash().putAll(key, map); | 193 | redisTemplate.opsForHash().putAll(key, map); |
| 191 | return true; | 194 | return true; |
| @@ -202,7 +205,7 @@ public class RedisUtil { | @@ -202,7 +205,7 @@ public class RedisUtil { | ||
| 202 | * @param time 时间 | 205 | * @param time 时间 |
| 203 | * @return true / false | 206 | * @return true / false |
| 204 | */ | 207 | */ |
| 205 | - public boolean hmset(String key, Map<Object, Object> map, long time) { | 208 | + public static boolean hmset(String key, Map<Object, Object> map, long time) { |
| 206 | try { | 209 | try { |
| 207 | redisTemplate.opsForHash().putAll(key, map); | 210 | redisTemplate.opsForHash().putAll(key, map); |
| 208 | if (time > 0) { | 211 | if (time > 0) { |
| @@ -222,7 +225,7 @@ public class RedisUtil { | @@ -222,7 +225,7 @@ public class RedisUtil { | ||
| 222 | * @param value 值 | 225 | * @param value 值 |
| 223 | * @return true / false | 226 | * @return true / false |
| 224 | */ | 227 | */ |
| 225 | - public boolean hset(String key, String item, Object value) { | 228 | + public static boolean hset(String key, String item, Object value) { |
| 226 | try { | 229 | try { |
| 227 | redisTemplate.opsForHash().put(key, item, value); | 230 | redisTemplate.opsForHash().put(key, item, value); |
| 228 | return true; | 231 | return true; |
| @@ -240,7 +243,7 @@ public class RedisUtil { | @@ -240,7 +243,7 @@ public class RedisUtil { | ||
| 240 | * @param time 时间(如果原来的 Hash表 设置了时间,这里会覆盖) | 243 | * @param time 时间(如果原来的 Hash表 设置了时间,这里会覆盖) |
| 241 | * @return true / false | 244 | * @return true / false |
| 242 | */ | 245 | */ |
| 243 | - public boolean hset(String key, String item, Object value, long time) { | 246 | + public static boolean hset(String key, String item, Object value, long time) { |
| 244 | try { | 247 | try { |
| 245 | redisTemplate.opsForHash().put(key, item, value); | 248 | redisTemplate.opsForHash().put(key, item, value); |
| 246 | if (time > 0) { | 249 | if (time > 0) { |
| @@ -258,7 +261,7 @@ public class RedisUtil { | @@ -258,7 +261,7 @@ public class RedisUtil { | ||
| 258 | * @param key 键 | 261 | * @param key 键 |
| 259 | * @param item 项(可以多个,no null) | 262 | * @param item 项(可以多个,no null) |
| 260 | */ | 263 | */ |
| 261 | - public void hdel(String key, Object... item) { | 264 | + public static void hdel(String key, Object... item) { |
| 262 | redisTemplate.opsForHash().delete(key, item); | 265 | redisTemplate.opsForHash().delete(key, item); |
| 263 | } | 266 | } |
| 264 | 267 | ||
| @@ -268,7 +271,7 @@ public class RedisUtil { | @@ -268,7 +271,7 @@ public class RedisUtil { | ||
| 268 | * @param item 值(no null) | 271 | * @param item 值(no null) |
| 269 | * @return true / false | 272 | * @return true / false |
| 270 | */ | 273 | */ |
| 271 | - public boolean hHasKey(String key, String item) { | 274 | + public static boolean hHasKey(String key, String item) { |
| 272 | return redisTemplate.opsForHash().hasKey(key, item); | 275 | return redisTemplate.opsForHash().hasKey(key, item); |
| 273 | } | 276 | } |
| 274 | 277 | ||
| @@ -279,7 +282,7 @@ public class RedisUtil { | @@ -279,7 +282,7 @@ public class RedisUtil { | ||
| 279 | * @param by 递增大小 > 0 | 282 | * @param by 递增大小 > 0 |
| 280 | * @return | 283 | * @return |
| 281 | */ | 284 | */ |
| 282 | - public Double hincr(String key, String item, Double by) { | 285 | + public static Double hincr(String key, String item, Double by) { |
| 283 | return redisTemplate.opsForHash().increment(key, item, by); | 286 | return redisTemplate.opsForHash().increment(key, item, by); |
| 284 | } | 287 | } |
| 285 | 288 | ||
| @@ -290,7 +293,7 @@ public class RedisUtil { | @@ -290,7 +293,7 @@ public class RedisUtil { | ||
| 290 | * @param by 递减大小 | 293 | * @param by 递减大小 |
| 291 | * @return | 294 | * @return |
| 292 | */ | 295 | */ |
| 293 | - public Double hdecr(String key, String item, Double by) { | 296 | + public static Double hdecr(String key, String item, Double by) { |
| 294 | return redisTemplate.opsForHash().increment(key, item, -by); | 297 | return redisTemplate.opsForHash().increment(key, item, -by); |
| 295 | } | 298 | } |
| 296 | 299 | ||
| @@ -301,7 +304,7 @@ public class RedisUtil { | @@ -301,7 +304,7 @@ public class RedisUtil { | ||
| 301 | * @param key 键 | 304 | * @param key 键 |
| 302 | * @return 值 | 305 | * @return 值 |
| 303 | */ | 306 | */ |
| 304 | - public Set<Object> sGet(String key) { | 307 | + public static Set<Object> sGet(String key) { |
| 305 | try { | 308 | try { |
| 306 | return redisTemplate.opsForSet().members(key); | 309 | return redisTemplate.opsForSet().members(key); |
| 307 | } catch (Exception e) { | 310 | } catch (Exception e) { |
| @@ -316,7 +319,7 @@ public class RedisUtil { | @@ -316,7 +319,7 @@ public class RedisUtil { | ||
| 316 | * @param value 值 | 319 | * @param value 值 |
| 317 | * @return true / false | 320 | * @return true / false |
| 318 | */ | 321 | */ |
| 319 | - public boolean sHasKey(String key, Object value) { | 322 | + public static boolean sHasKey(String key, Object value) { |
| 320 | try { | 323 | try { |
| 321 | return redisTemplate.opsForSet().isMember(key, value); | 324 | return redisTemplate.opsForSet().isMember(key, value); |
| 322 | } catch (Exception e) { | 325 | } catch (Exception e) { |
| @@ -331,7 +334,7 @@ public class RedisUtil { | @@ -331,7 +334,7 @@ public class RedisUtil { | ||
| 331 | * @param values 值(可以多个) | 334 | * @param values 值(可以多个) |
| 332 | * @return 成功个数 | 335 | * @return 成功个数 |
| 333 | */ | 336 | */ |
| 334 | - public long sSet(String key, Object... values) { | 337 | + public static long sSet(String key, Object... values) { |
| 335 | try { | 338 | try { |
| 336 | return redisTemplate.opsForSet().add(key, values); | 339 | return redisTemplate.opsForSet().add(key, values); |
| 337 | } catch (Exception e) { | 340 | } catch (Exception e) { |
| @@ -347,7 +350,7 @@ public class RedisUtil { | @@ -347,7 +350,7 @@ public class RedisUtil { | ||
| 347 | * @param values 值(可以多个) | 350 | * @param values 值(可以多个) |
| 348 | * @return 成功放入个数 | 351 | * @return 成功放入个数 |
| 349 | */ | 352 | */ |
| 350 | - public long sSet(String key, long time, Object... values) { | 353 | + public static long sSet(String key, long time, Object... values) { |
| 351 | try { | 354 | try { |
| 352 | long count = redisTemplate.opsForSet().add(key, values); | 355 | long count = redisTemplate.opsForSet().add(key, values); |
| 353 | if (time > 0) { | 356 | if (time > 0) { |
| @@ -365,7 +368,7 @@ public class RedisUtil { | @@ -365,7 +368,7 @@ public class RedisUtil { | ||
| 365 | * @param key 键 | 368 | * @param key 键 |
| 366 | * @return 长度 | 369 | * @return 长度 |
| 367 | */ | 370 | */ |
| 368 | - public long sGetSetSize(String key) { | 371 | + public static long sGetSetSize(String key) { |
| 369 | try { | 372 | try { |
| 370 | return redisTemplate.opsForSet().size(key); | 373 | return redisTemplate.opsForSet().size(key); |
| 371 | } catch (Exception e) { | 374 | } catch (Exception e) { |
| @@ -380,7 +383,7 @@ public class RedisUtil { | @@ -380,7 +383,7 @@ public class RedisUtil { | ||
| 380 | * @param values 值 | 383 | * @param values 值 |
| 381 | * @return 成功移除个数 | 384 | * @return 成功移除个数 |
| 382 | */ | 385 | */ |
| 383 | - public long setRemove(String key, Object... values) { | 386 | + public static long setRemove(String key, Object... values) { |
| 384 | try { | 387 | try { |
| 385 | return redisTemplate.opsForSet().remove(key, values); | 388 | return redisTemplate.opsForSet().remove(key, values); |
| 386 | } catch (Exception e) { | 389 | } catch (Exception e) { |
| @@ -397,7 +400,7 @@ public class RedisUtil { | @@ -397,7 +400,7 @@ public class RedisUtil { | ||
| 397 | * @param value | 400 | * @param value |
| 398 | * @param score | 401 | * @param score |
| 399 | */ | 402 | */ |
| 400 | - public void zAdd(Object key, Object value, double score) { | 403 | + public static void zAdd(Object key, Object value, double score) { |
| 401 | redisTemplate.opsForZSet().add(key, value, score); | 404 | redisTemplate.opsForZSet().add(key, value, score); |
| 402 | } | 405 | } |
| 403 | 406 | ||
| @@ -407,7 +410,7 @@ public class RedisUtil { | @@ -407,7 +410,7 @@ public class RedisUtil { | ||
| 407 | * @param key | 410 | * @param key |
| 408 | * @param value | 411 | * @param value |
| 409 | */ | 412 | */ |
| 410 | - public void zRemove(Object key, Object value) { | 413 | + public static void zRemove(Object key, Object value) { |
| 411 | redisTemplate.opsForZSet().remove(key, value); | 414 | redisTemplate.opsForZSet().remove(key, value); |
| 412 | } | 415 | } |
| 413 | 416 | ||
| @@ -418,7 +421,7 @@ public class RedisUtil { | @@ -418,7 +421,7 @@ public class RedisUtil { | ||
| 418 | * @param value | 421 | * @param value |
| 419 | * @param delta -1 表示减 1 表示加1 | 422 | * @param delta -1 表示减 1 表示加1 |
| 420 | */ | 423 | */ |
| 421 | - public Double zIncrScore(Object key, Object value, double delta) { | 424 | + public static Double zIncrScore(Object key, Object value, double delta) { |
| 422 | return redisTemplate.opsForZSet().incrementScore(key, value, delta); | 425 | return redisTemplate.opsForZSet().incrementScore(key, value, delta); |
| 423 | } | 426 | } |
| 424 | 427 | ||
| @@ -429,7 +432,7 @@ public class RedisUtil { | @@ -429,7 +432,7 @@ public class RedisUtil { | ||
| 429 | * @param value | 432 | * @param value |
| 430 | * @return | 433 | * @return |
| 431 | */ | 434 | */ |
| 432 | - public Double zScore(Object key, Object value) { | 435 | + public static Double zScore(Object key, Object value) { |
| 433 | return redisTemplate.opsForZSet().score(key, value); | 436 | return redisTemplate.opsForZSet().score(key, value); |
| 434 | } | 437 | } |
| 435 | 438 | ||
| @@ -440,7 +443,7 @@ public class RedisUtil { | @@ -440,7 +443,7 @@ public class RedisUtil { | ||
| 440 | * @param value | 443 | * @param value |
| 441 | * @return | 444 | * @return |
| 442 | */ | 445 | */ |
| 443 | - public Long zRank(Object key, Object value) { | 446 | + public static Long zRank(Object key, Object value) { |
| 444 | return redisTemplate.opsForZSet().rank(key, value); | 447 | return redisTemplate.opsForZSet().rank(key, value); |
| 445 | } | 448 | } |
| 446 | 449 | ||
| @@ -450,7 +453,7 @@ public class RedisUtil { | @@ -450,7 +453,7 @@ public class RedisUtil { | ||
| 450 | * @param key | 453 | * @param key |
| 451 | * @return | 454 | * @return |
| 452 | */ | 455 | */ |
| 453 | - public Long zSize(Object key) { | 456 | + public static Long zSize(Object key) { |
| 454 | return redisTemplate.opsForZSet().zCard(key); | 457 | return redisTemplate.opsForZSet().zCard(key); |
| 455 | } | 458 | } |
| 456 | 459 | ||
| @@ -464,7 +467,7 @@ public class RedisUtil { | @@ -464,7 +467,7 @@ public class RedisUtil { | ||
| 464 | * @param end | 467 | * @param end |
| 465 | * @return | 468 | * @return |
| 466 | */ | 469 | */ |
| 467 | - public Set<Object> ZRange(Object key, int start, int end) { | 470 | + public static Set<Object> ZRange(Object key, int start, int end) { |
| 468 | return redisTemplate.opsForZSet().range(key, start, end); | 471 | return redisTemplate.opsForZSet().range(key, start, end); |
| 469 | } | 472 | } |
| 470 | /** | 473 | /** |
| @@ -475,7 +478,7 @@ public class RedisUtil { | @@ -475,7 +478,7 @@ public class RedisUtil { | ||
| 475 | * @param end | 478 | * @param end |
| 476 | * @return | 479 | * @return |
| 477 | */ | 480 | */ |
| 478 | - public Set<ZSetOperations.TypedTuple<String>> zRangeWithScore(Object key, int start, int end) { | 481 | + public static Set<ZSetOperations.TypedTuple<String>> zRangeWithScore(Object key, int start, int end) { |
| 479 | return redisTemplate.opsForZSet().rangeWithScores(key, start, end); | 482 | return redisTemplate.opsForZSet().rangeWithScores(key, start, end); |
| 480 | } | 483 | } |
| 481 | /** | 484 | /** |
| @@ -488,7 +491,7 @@ public class RedisUtil { | @@ -488,7 +491,7 @@ public class RedisUtil { | ||
| 488 | * @param end | 491 | * @param end |
| 489 | * @return | 492 | * @return |
| 490 | */ | 493 | */ |
| 491 | - public Set<String> zRevRange(Object key, int start, int end) { | 494 | + public static Set<String> zRevRange(Object key, int start, int end) { |
| 492 | return redisTemplate.opsForZSet().reverseRange(key, start, end); | 495 | return redisTemplate.opsForZSet().reverseRange(key, start, end); |
| 493 | } | 496 | } |
| 494 | /** | 497 | /** |
| @@ -499,7 +502,7 @@ public class RedisUtil { | @@ -499,7 +502,7 @@ public class RedisUtil { | ||
| 499 | * @param max | 502 | * @param max |
| 500 | * @return | 503 | * @return |
| 501 | */ | 504 | */ |
| 502 | - public Set<String> zSortRange(Object key, int min, int max) { | 505 | + public static Set<String> zSortRange(Object key, int min, int max) { |
| 503 | return redisTemplate.opsForZSet().rangeByScore(key, min, max); | 506 | return redisTemplate.opsForZSet().rangeByScore(key, min, max); |
| 504 | } | 507 | } |
| 505 | 508 | ||
| @@ -513,7 +516,7 @@ public class RedisUtil { | @@ -513,7 +516,7 @@ public class RedisUtil { | ||
| 513 | * @param end 结束(0 到 -1 代表所有值) | 516 | * @param end 结束(0 到 -1 代表所有值) |
| 514 | * @return | 517 | * @return |
| 515 | */ | 518 | */ |
| 516 | - public List<Object> lGet(String key, long start, long end) { | 519 | + public static List<Object> lGet(String key, long start, long end) { |
| 517 | try { | 520 | try { |
| 518 | return redisTemplate.opsForList().range(key, start, end); | 521 | return redisTemplate.opsForList().range(key, start, end); |
| 519 | } catch (Exception e) { | 522 | } catch (Exception e) { |
| @@ -527,7 +530,7 @@ public class RedisUtil { | @@ -527,7 +530,7 @@ public class RedisUtil { | ||
| 527 | * @param key 键 | 530 | * @param key 键 |
| 528 | * @return 长度 | 531 | * @return 长度 |
| 529 | */ | 532 | */ |
| 530 | - public long lGetListSize(String key) { | 533 | + public static long lGetListSize(String key) { |
| 531 | try { | 534 | try { |
| 532 | return redisTemplate.opsForList().size(key); | 535 | return redisTemplate.opsForList().size(key); |
| 533 | } catch (Exception e) { | 536 | } catch (Exception e) { |
| @@ -544,7 +547,7 @@ public class RedisUtil { | @@ -544,7 +547,7 @@ public class RedisUtil { | ||
| 544 | * 当 index < 0 时 {-1:表尾, -2:倒数第二个元素} | 547 | * 当 index < 0 时 {-1:表尾, -2:倒数第二个元素} |
| 545 | * @return 值 | 548 | * @return 值 |
| 546 | */ | 549 | */ |
| 547 | - public Object lGetIndex(String key, long index) { | 550 | + public static Object lGetIndex(String key, long index) { |
| 548 | try { | 551 | try { |
| 549 | return redisTemplate.opsForList().index(key, index); | 552 | return redisTemplate.opsForList().index(key, index); |
| 550 | } catch (Exception e) { | 553 | } catch (Exception e) { |
| @@ -559,7 +562,7 @@ public class RedisUtil { | @@ -559,7 +562,7 @@ public class RedisUtil { | ||
| 559 | * @param value 值 | 562 | * @param value 值 |
| 560 | * @return true / false | 563 | * @return true / false |
| 561 | */ | 564 | */ |
| 562 | - public boolean lSet(String key, Object value) { | 565 | + public static boolean lSet(String key, Object value) { |
| 563 | try { | 566 | try { |
| 564 | redisTemplate.opsForList().rightPush(key, value); | 567 | redisTemplate.opsForList().rightPush(key, value); |
| 565 | return true; | 568 | return true; |
| @@ -576,7 +579,7 @@ public class RedisUtil { | @@ -576,7 +579,7 @@ public class RedisUtil { | ||
| 576 | * @param time 时间 | 579 | * @param time 时间 |
| 577 | * @return true / false | 580 | * @return true / false |
| 578 | */ | 581 | */ |
| 579 | - public boolean lSet(String key, Object value, long time) { | 582 | + public static boolean lSet(String key, Object value, long time) { |
| 580 | try { | 583 | try { |
| 581 | redisTemplate.opsForList().rightPush(key, value); | 584 | redisTemplate.opsForList().rightPush(key, value); |
| 582 | if (time > 0) { | 585 | if (time > 0) { |
| @@ -595,7 +598,7 @@ public class RedisUtil { | @@ -595,7 +598,7 @@ public class RedisUtil { | ||
| 595 | * @param values 值 | 598 | * @param values 值 |
| 596 | * @return true / false | 599 | * @return true / false |
| 597 | */ | 600 | */ |
| 598 | - public boolean lSetList(String key, List<Object> values) { | 601 | + public static boolean lSetList(String key, List<Object> values) { |
| 599 | try { | 602 | try { |
| 600 | redisTemplate.opsForList().rightPushAll(key, values); | 603 | redisTemplate.opsForList().rightPushAll(key, values); |
| 601 | return true; | 604 | return true; |
| @@ -612,7 +615,7 @@ public class RedisUtil { | @@ -612,7 +615,7 @@ public class RedisUtil { | ||
| 612 | * @param time 时间 | 615 | * @param time 时间 |
| 613 | * @return true / false | 616 | * @return true / false |
| 614 | */ | 617 | */ |
| 615 | - public boolean lSetList(String key, List<Object> values, long time) { | 618 | + public static boolean lSetList(String key, List<Object> values, long time) { |
| 616 | try { | 619 | try { |
| 617 | redisTemplate.opsForList().rightPushAll(key, values); | 620 | redisTemplate.opsForList().rightPushAll(key, values); |
| 618 | if (time > 0) { | 621 | if (time > 0) { |
| @@ -632,7 +635,7 @@ public class RedisUtil { | @@ -632,7 +635,7 @@ public class RedisUtil { | ||
| 632 | * @param value 值 | 635 | * @param value 值 |
| 633 | * @return true / false | 636 | * @return true / false |
| 634 | */ | 637 | */ |
| 635 | - public boolean lUpdateIndex(String key, long index, Object value) { | 638 | + public static boolean lUpdateIndex(String key, long index, Object value) { |
| 636 | try { | 639 | try { |
| 637 | redisTemplate.opsForList().set(key, index, value); | 640 | redisTemplate.opsForList().set(key, index, value); |
| 638 | return true; | 641 | return true; |
| @@ -651,7 +654,7 @@ public class RedisUtil { | @@ -651,7 +654,7 @@ public class RedisUtil { | ||
| 651 | * @param value | 654 | * @param value |
| 652 | * @return | 655 | * @return |
| 653 | */ | 656 | */ |
| 654 | - public long lRemove(String key, long count, Object value) { | 657 | + public static long lRemove(String key, long count, Object value) { |
| 655 | try { | 658 | try { |
| 656 | return redisTemplate.opsForList().remove(key, count, value); | 659 | return redisTemplate.opsForList().remove(key, count, value); |
| 657 | } catch (Exception e) { | 660 | } catch (Exception e) { |
| @@ -665,7 +668,7 @@ public class RedisUtil { | @@ -665,7 +668,7 @@ public class RedisUtil { | ||
| 665 | * @param key 键 | 668 | * @param key 键 |
| 666 | * @return | 669 | * @return |
| 667 | */ | 670 | */ |
| 668 | - public Object lLeftPop(String key) { | 671 | + public static Object lLeftPop(String key) { |
| 669 | return redisTemplate.opsForList().leftPop(key); | 672 | return redisTemplate.opsForList().leftPop(key); |
| 670 | } | 673 | } |
| 671 | 674 | ||
| @@ -674,7 +677,7 @@ public class RedisUtil { | @@ -674,7 +677,7 @@ public class RedisUtil { | ||
| 674 | * @param key 键 | 677 | * @param key 键 |
| 675 | * @return | 678 | * @return |
| 676 | */ | 679 | */ |
| 677 | - public Object lrightPop(String key) { | 680 | + public static Object lrightPop(String key) { |
| 678 | return redisTemplate.opsForList().rightPop(key); | 681 | return redisTemplate.opsForList().rightPop(key); |
| 679 | } | 682 | } |
| 680 | 683 | ||
| @@ -683,7 +686,7 @@ public class RedisUtil { | @@ -683,7 +686,7 @@ public class RedisUtil { | ||
| 683 | * @param key 键 | 686 | * @param key 键 |
| 684 | * @return true / false | 687 | * @return true / false |
| 685 | */ | 688 | */ |
| 686 | - public List<Object> keys(String key) { | 689 | + public static List<Object> keys(String key) { |
| 687 | try { | 690 | try { |
| 688 | Set<String> set = redisTemplate.keys(key); | 691 | Set<String> set = redisTemplate.keys(key); |
| 689 | return new ArrayList<>(set); | 692 | return new ArrayList<>(set); |
| @@ -699,7 +702,7 @@ public class RedisUtil { | @@ -699,7 +702,7 @@ public class RedisUtil { | ||
| 699 | * @param query 查询参数 | 702 | * @param query 查询参数 |
| 700 | * @return | 703 | * @return |
| 701 | */ | 704 | */ |
| 702 | -// public List<Object> scan(String query) { | 705 | +// public static List<Object> scan(String query) { |
| 703 | // List<Object> result = new ArrayList<>(); | 706 | // List<Object> result = new ArrayList<>(); |
| 704 | // try { | 707 | // try { |
| 705 | // Cursor<Map.Entry<Object,Object>> cursor = redisTemplate.opsForHash().scan("field", | 708 | // Cursor<Map.Entry<Object,Object>> cursor = redisTemplate.opsForHash().scan("field", |
| @@ -723,33 +726,23 @@ public class RedisUtil { | @@ -723,33 +726,23 @@ public class RedisUtil { | ||
| 723 | * @param query 查询参数 | 726 | * @param query 查询参数 |
| 724 | * @return | 727 | * @return |
| 725 | */ | 728 | */ |
| 726 | - public List<Object> scan(String query) { | ||
| 727 | - Set<String> keys = (Set<String>) redisTemplate.execute((RedisCallback<Set<String>>) connection -> { | ||
| 728 | - Set<String> keysTmp = new HashSet<>(); | ||
| 729 | - Cursor<byte[]> cursor = connection.scan(new ScanOptions.ScanOptionsBuilder().match(query).count(1000).build()); | ||
| 730 | - while (cursor.hasNext()) { | ||
| 731 | - keysTmp.add(new String(cursor.next())); | 729 | + public static List<Object> scan(String query) { |
| 730 | + Set<String> resultKeys = (Set<String>) redisTemplate.execute((RedisCallback<Set<String>>) connection -> { | ||
| 731 | + ScanOptions scanOptions = ScanOptions.scanOptions().match("*" + query + "*").count(1000).build(); | ||
| 732 | + Cursor<byte[]> scan = connection.scan(scanOptions); | ||
| 733 | + Set<String> keys = new HashSet<>(); | ||
| 734 | + while (scan.hasNext()) { | ||
| 735 | + byte[] next = scan.next(); | ||
| 736 | + keys.add(new String(next)); | ||
| 732 | } | 737 | } |
| 733 | - return keysTmp; | 738 | + return keys; |
| 734 | }); | 739 | }); |
| 735 | -// Set<String> keys = (Set<String>) redisTemplate.execute(new RedisCallback<Set<String>>(){ | ||
| 736 | -// | ||
| 737 | -// @Override | ||
| 738 | -// public Set<String> doInRedis(RedisConnection connection) throws DataAccessException { | ||
| 739 | -// Set<String> keysTmp = new HashSet<>(); | ||
| 740 | -// Cursor<byte[]> cursor = connection.scan(new ScanOptions.ScanOptionsBuilder().match(query).count(1000).build()); | ||
| 741 | -// while (cursor.hasNext()) { | ||
| 742 | -// keysTmp.add(new String(cursor.next())); | ||
| 743 | -// } | ||
| 744 | -// return keysTmp; | ||
| 745 | -// } | ||
| 746 | -// }); | ||
| 747 | 740 | ||
| 748 | - return new ArrayList<>(keys); | 741 | + return new ArrayList<>(resultKeys); |
| 749 | } | 742 | } |
| 750 | 743 | ||
| 751 | // ============================== 消息发送与订阅 ============================== | 744 | // ============================== 消息发送与订阅 ============================== |
| 752 | - public void convertAndSend(String channel, JSONObject msg) { | 745 | + public static void convertAndSend(String channel, JSONObject msg) { |
| 753 | // redisTemplate.convertAndSend(channel, msg); | 746 | // redisTemplate.convertAndSend(channel, msg); |
| 754 | redisTemplate.convertAndSend(channel, msg); | 747 | redisTemplate.convertAndSend(channel, msg); |
| 755 | 748 |
src/main/java/com/genersoft/iot/vmp/vmanager/bean/BatchGBStreamParam.java
| 1 | package com.genersoft.iot.vmp.vmanager.bean; | 1 | package com.genersoft.iot.vmp.vmanager.bean; |
| 2 | 2 | ||
| 3 | import com.genersoft.iot.vmp.gb28181.bean.GbStream; | 3 | import com.genersoft.iot.vmp.gb28181.bean.GbStream; |
| 4 | +import io.swagger.v3.oas.annotations.media.Schema; | ||
| 4 | 5 | ||
| 5 | import java.util.List; | 6 | import java.util.List; |
| 6 | 7 | ||
| 8 | +/** | ||
| 9 | + * @author lin | ||
| 10 | + */ | ||
| 11 | +@Schema(description = "多个推流信息") | ||
| 7 | public class BatchGBStreamParam { | 12 | public class BatchGBStreamParam { |
| 13 | + @Schema(description = "推流信息列表") | ||
| 8 | private List<GbStream> gbStreams; | 14 | private List<GbStream> gbStreams; |
| 9 | 15 | ||
| 10 | public List<GbStream> getGbStreams() { | 16 | public List<GbStream> getGbStreams() { |
src/main/java/com/genersoft/iot/vmp/vmanager/bean/WVPResult.java
| 1 | package com.genersoft.iot.vmp.vmanager.bean; | 1 | package com.genersoft.iot.vmp.vmanager.bean; |
| 2 | 2 | ||
| 3 | 3 | ||
| 4 | +import io.swagger.v3.oas.annotations.media.Schema; | ||
| 5 | + | ||
| 6 | +@Schema(description = "统一返回结果") | ||
| 4 | public class WVPResult<T> { | 7 | public class WVPResult<T> { |
| 5 | 8 | ||
| 6 | public WVPResult() { | 9 | public WVPResult() { |
| @@ -13,8 +16,11 @@ public class WVPResult<T> { | @@ -13,8 +16,11 @@ public class WVPResult<T> { | ||
| 13 | } | 16 | } |
| 14 | 17 | ||
| 15 | 18 | ||
| 19 | + @Schema(description = "错误码,0为成功") | ||
| 16 | private int code; | 20 | private int code; |
| 21 | + @Schema(description = "描述,错误时描述错误原因") | ||
| 17 | private String msg; | 22 | private String msg; |
| 23 | + @Schema(description = "数据") | ||
| 18 | private T data; | 24 | private T data; |
| 19 | 25 | ||
| 20 | private static final Integer SUCCESS = 200; | 26 | private static final Integer SUCCESS = 200; |
src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/MobilePosition/MobilePositionController.java
| @@ -13,10 +13,9 @@ import com.genersoft.iot.vmp.storager.IVideoManagerStorage; | @@ -13,10 +13,9 @@ import com.genersoft.iot.vmp.storager.IVideoManagerStorage; | ||
| 13 | import com.genersoft.iot.vmp.vmanager.bean.WVPResult; | 13 | import com.genersoft.iot.vmp.vmanager.bean.WVPResult; |
| 14 | import com.github.pagehelper.util.StringUtil; | 14 | import com.github.pagehelper.util.StringUtil; |
| 15 | 15 | ||
| 16 | -import io.swagger.annotations.Api; | ||
| 17 | -import io.swagger.annotations.ApiImplicitParam; | ||
| 18 | -import io.swagger.annotations.ApiImplicitParams; | ||
| 19 | -import io.swagger.annotations.ApiOperation; | 16 | +import io.swagger.v3.oas.annotations.Operation; |
| 17 | +import io.swagger.v3.oas.annotations.Parameter; | ||
| 18 | +import io.swagger.v3.oas.annotations.tags.Tag; | ||
| 20 | import org.slf4j.Logger; | 19 | import org.slf4j.Logger; |
| 21 | import org.slf4j.LoggerFactory; | 20 | import org.slf4j.LoggerFactory; |
| 22 | import org.springframework.beans.factory.annotation.Autowired; | 21 | import org.springframework.beans.factory.annotation.Autowired; |
| @@ -33,7 +32,7 @@ import org.springframework.web.context.request.async.DeferredResult; | @@ -33,7 +32,7 @@ import org.springframework.web.context.request.async.DeferredResult; | ||
| 33 | /** | 32 | /** |
| 34 | * 位置信息管理 | 33 | * 位置信息管理 |
| 35 | */ | 34 | */ |
| 36 | -@Api(tags = "位置信息管理") | 35 | +@Tag(name = "位置信息管理") |
| 37 | @CrossOrigin | 36 | @CrossOrigin |
| 38 | @RestController | 37 | @RestController |
| 39 | @RequestMapping("/api/position") | 38 | @RequestMapping("/api/position") |
| @@ -54,27 +53,22 @@ public class MobilePositionController { | @@ -54,27 +53,22 @@ public class MobilePositionController { | ||
| 54 | private IDeviceService deviceService; | 53 | private IDeviceService deviceService; |
| 55 | 54 | ||
| 56 | /** | 55 | /** |
| 57 | - * 查询历史轨迹 | 56 | + * 查询历史轨迹 |
| 58 | * @param deviceId 设备ID | 57 | * @param deviceId 设备ID |
| 59 | * @param start 开始时间 | 58 | * @param start 开始时间 |
| 60 | * @param end 结束时间 | 59 | * @param end 结束时间 |
| 61 | * @return | 60 | * @return |
| 62 | */ | 61 | */ |
| 63 | - @ApiOperation("查询历史轨迹") | ||
| 64 | - @ApiImplicitParams({ | ||
| 65 | - @ApiImplicitParam(name = "deviceId", value = "设备ID", required = true, dataTypeClass = String.class), | ||
| 66 | - @ApiImplicitParam(name = "channelId", value = "通道ID", required = false, dataTypeClass = String.class), | ||
| 67 | - @ApiImplicitParam(name = "start", value = "开始时间", required = false, dataTypeClass = String.class), | ||
| 68 | - @ApiImplicitParam(name = "end", value = "结束时间", required = false, dataTypeClass = String.class), | ||
| 69 | - }) | 62 | + @Operation(summary = "查询历史轨迹") |
| 63 | + @Parameter(name = "deviceId", description = "设备国标编号", required = true) | ||
| 64 | + @Parameter(name = "channelId", description = "通道国标编号") | ||
| 65 | + @Parameter(name = "start", description = "开始时间") | ||
| 66 | + @Parameter(name = "end", description = "结束时间") | ||
| 70 | @GetMapping("/history/{deviceId}") | 67 | @GetMapping("/history/{deviceId}") |
| 71 | public ResponseEntity<WVPResult<List<MobilePosition>>> positions(@PathVariable String deviceId, | 68 | public ResponseEntity<WVPResult<List<MobilePosition>>> positions(@PathVariable String deviceId, |
| 72 | @RequestParam(required = false) String channelId, | 69 | @RequestParam(required = false) String channelId, |
| 73 | @RequestParam(required = false) String start, | 70 | @RequestParam(required = false) String start, |
| 74 | @RequestParam(required = false) String end) { | 71 | @RequestParam(required = false) String end) { |
| 75 | -// if (logger.isDebugEnabled()) { | ||
| 76 | -// logger.debug("查询设备" + deviceId + "的历史轨迹"); | ||
| 77 | -// } | ||
| 78 | 72 | ||
| 79 | if (StringUtil.isEmpty(start)) { | 73 | if (StringUtil.isEmpty(start)) { |
| 80 | start = null; | 74 | start = null; |
| @@ -94,15 +88,10 @@ public class MobilePositionController { | @@ -94,15 +88,10 @@ public class MobilePositionController { | ||
| 94 | * @param deviceId 设备ID | 88 | * @param deviceId 设备ID |
| 95 | * @return | 89 | * @return |
| 96 | */ | 90 | */ |
| 97 | - @ApiOperation("查询设备最新位置") | ||
| 98 | - @ApiImplicitParams({ | ||
| 99 | - @ApiImplicitParam(name = "deviceId", value = "设备ID", required = true, dataTypeClass = String.class), | ||
| 100 | - }) | 91 | + @Operation(summary = "查询设备最新位置") |
| 92 | + @Parameter(name = "deviceId", description = "设备国标编号", required = true) | ||
| 101 | @GetMapping("/latest/{deviceId}") | 93 | @GetMapping("/latest/{deviceId}") |
| 102 | public ResponseEntity<MobilePosition> latestPosition(@PathVariable String deviceId) { | 94 | public ResponseEntity<MobilePosition> latestPosition(@PathVariable String deviceId) { |
| 103 | -// if (logger.isDebugEnabled()) { | ||
| 104 | -// logger.debug("查询设备" + deviceId + "的最新位置"); | ||
| 105 | -// } | ||
| 106 | MobilePosition result = storager.queryLatestPosition(deviceId); | 95 | MobilePosition result = storager.queryLatestPosition(deviceId); |
| 107 | return new ResponseEntity<>(result, HttpStatus.OK); | 96 | return new ResponseEntity<>(result, HttpStatus.OK); |
| 108 | } | 97 | } |
| @@ -112,10 +101,8 @@ public class MobilePositionController { | @@ -112,10 +101,8 @@ public class MobilePositionController { | ||
| 112 | * @param deviceId 设备ID | 101 | * @param deviceId 设备ID |
| 113 | * @return | 102 | * @return |
| 114 | */ | 103 | */ |
| 115 | - @ApiOperation("获取移动位置信息") | ||
| 116 | - @ApiImplicitParams({ | ||
| 117 | - @ApiImplicitParam(name = "deviceId", value = "设备ID", required = true, dataTypeClass = String.class), | ||
| 118 | - }) | 104 | + @Operation(summary = "获取移动位置信息") |
| 105 | + @Parameter(name = "deviceId", description = "设备国标编号", required = true) | ||
| 119 | @GetMapping("/realtime/{deviceId}") | 106 | @GetMapping("/realtime/{deviceId}") |
| 120 | public DeferredResult<ResponseEntity<MobilePosition>> realTimePosition(@PathVariable String deviceId) { | 107 | public DeferredResult<ResponseEntity<MobilePosition>> realTimePosition(@PathVariable String deviceId) { |
| 121 | Device device = storager.queryVideoDevice(deviceId); | 108 | Device device = storager.queryVideoDevice(deviceId); |
| @@ -149,12 +136,10 @@ public class MobilePositionController { | @@ -149,12 +136,10 @@ public class MobilePositionController { | ||
| 149 | * @param interval 上报时间间隔 | 136 | * @param interval 上报时间间隔 |
| 150 | * @return true = 命令发送成功 | 137 | * @return true = 命令发送成功 |
| 151 | */ | 138 | */ |
| 152 | - @ApiOperation("订阅位置信息") | ||
| 153 | - @ApiImplicitParams({ | ||
| 154 | - @ApiImplicitParam(name = "deviceId", value = "设备ID", required = true, dataTypeClass = String.class), | ||
| 155 | - @ApiImplicitParam(name = "expires", value = "订阅超时时间", dataTypeClass = String.class), | ||
| 156 | - @ApiImplicitParam(name = "interval", value = "上报时间间隔", dataTypeClass = String.class), | ||
| 157 | - }) | 139 | + @Operation(summary = "订阅位置信息") |
| 140 | + @Parameter(name = "deviceId", description = "设备国标编号", required = true) | ||
| 141 | + @Parameter(name = "expires", description = "订阅超时时间", required = true) | ||
| 142 | + @Parameter(name = "interval", description = "上报时间间隔", required = true) | ||
| 158 | @GetMapping("/subscribe/{deviceId}") | 143 | @GetMapping("/subscribe/{deviceId}") |
| 159 | public ResponseEntity<String> positionSubscribe(@PathVariable String deviceId, | 144 | public ResponseEntity<String> positionSubscribe(@PathVariable String deviceId, |
| 160 | @RequestParam String expires, | 145 | @RequestParam String expires, |
src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/SseController/SseController.java
| 1 | package com.genersoft.iot.vmp.vmanager.gb28181.SseController; | 1 | package com.genersoft.iot.vmp.vmanager.gb28181.SseController; |
| 2 | 2 | ||
| 3 | import com.genersoft.iot.vmp.gb28181.event.alarm.AlarmEventListener; | 3 | import com.genersoft.iot.vmp.gb28181.event.alarm.AlarmEventListener; |
| 4 | -import io.swagger.annotations.Api; | ||
| 5 | -import io.swagger.annotations.ApiImplicitParam; | ||
| 6 | -import io.swagger.annotations.ApiImplicitParams; | ||
| 7 | -import io.swagger.annotations.ApiOperation; | 4 | + |
| 5 | +import io.swagger.v3.oas.annotations.tags.Tag; | ||
| 8 | import org.springframework.beans.factory.annotation.Autowired; | 6 | import org.springframework.beans.factory.annotation.Autowired; |
| 9 | import org.springframework.stereotype.Controller; | 7 | import org.springframework.stereotype.Controller; |
| 10 | import org.springframework.web.bind.annotation.CrossOrigin; | 8 | import org.springframework.web.bind.annotation.CrossOrigin; |
| @@ -18,7 +16,7 @@ import org.springframework.web.servlet.mvc.method.annotation.SseEmitter; | @@ -18,7 +16,7 @@ import org.springframework.web.servlet.mvc.method.annotation.SseEmitter; | ||
| 18 | * @author: lawrencehj | 16 | * @author: lawrencehj |
| 19 | * @data: 2021-01-20 | 17 | * @data: 2021-01-20 |
| 20 | */ | 18 | */ |
| 21 | -@Api(tags = "SSE推送") | 19 | +@Tag(name = "SSE推送") |
| 22 | @CrossOrigin | 20 | @CrossOrigin |
| 23 | @Controller | 21 | @Controller |
| 24 | @RequestMapping("/api") | 22 | @RequestMapping("/api") |
| @@ -26,10 +24,6 @@ public class SseController { | @@ -26,10 +24,6 @@ public class SseController { | ||
| 26 | @Autowired | 24 | @Autowired |
| 27 | AlarmEventListener alarmEventListener; | 25 | AlarmEventListener alarmEventListener; |
| 28 | 26 | ||
| 29 | - @ApiOperation("浏览器推送") | ||
| 30 | - @ApiImplicitParams({ | ||
| 31 | - @ApiImplicitParam(name = "browserId", value = "浏览器ID", dataTypeClass = String.class), | ||
| 32 | - }) | ||
| 33 | @GetMapping("/emit") | 27 | @GetMapping("/emit") |
| 34 | public SseEmitter emit(@RequestParam String browserId) { | 28 | public SseEmitter emit(@RequestParam String browserId) { |
| 35 | final SseEmitter sseEmitter = new SseEmitter(0L); | 29 | final SseEmitter sseEmitter = new SseEmitter(0L); |
src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/alarm/AlarmController.java
| @@ -3,32 +3,27 @@ package com.genersoft.iot.vmp.vmanager.gb28181.alarm; | @@ -3,32 +3,27 @@ package com.genersoft.iot.vmp.vmanager.gb28181.alarm; | ||
| 3 | import com.genersoft.iot.vmp.gb28181.bean.Device; | 3 | import com.genersoft.iot.vmp.gb28181.bean.Device; |
| 4 | import com.genersoft.iot.vmp.gb28181.bean.DeviceAlarm; | 4 | import com.genersoft.iot.vmp.gb28181.bean.DeviceAlarm; |
| 5 | import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform; | 5 | import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform; |
| 6 | -import com.genersoft.iot.vmp.gb28181.bean.SubscribeInfo; | ||
| 7 | import com.genersoft.iot.vmp.gb28181.transmit.cmd.ISIPCommander; | 6 | import com.genersoft.iot.vmp.gb28181.transmit.cmd.ISIPCommander; |
| 8 | import com.genersoft.iot.vmp.gb28181.transmit.cmd.ISIPCommanderForPlatform; | 7 | import com.genersoft.iot.vmp.gb28181.transmit.cmd.ISIPCommanderForPlatform; |
| 9 | import com.genersoft.iot.vmp.service.IDeviceAlarmService; | 8 | import com.genersoft.iot.vmp.service.IDeviceAlarmService; |
| 10 | -import com.genersoft.iot.vmp.service.IGbStreamService; | ||
| 11 | import com.genersoft.iot.vmp.storager.IVideoManagerStorage; | 9 | import com.genersoft.iot.vmp.storager.IVideoManagerStorage; |
| 12 | import com.genersoft.iot.vmp.utils.DateUtil; | 10 | import com.genersoft.iot.vmp.utils.DateUtil; |
| 13 | import com.genersoft.iot.vmp.vmanager.bean.WVPResult; | 11 | import com.genersoft.iot.vmp.vmanager.bean.WVPResult; |
| 14 | import com.github.pagehelper.PageInfo; | 12 | import com.github.pagehelper.PageInfo; |
| 15 | -import io.swagger.annotations.Api; | ||
| 16 | -import io.swagger.annotations.ApiImplicitParam; | ||
| 17 | -import io.swagger.annotations.ApiImplicitParams; | ||
| 18 | -import io.swagger.annotations.ApiOperation; | ||
| 19 | -import io.swagger.models.auth.In; | 13 | +import io.swagger.v3.oas.annotations.Operation; |
| 14 | +import io.swagger.v3.oas.annotations.Parameter; | ||
| 15 | +import io.swagger.v3.oas.annotations.tags.Tag; | ||
| 20 | import org.springframework.beans.factory.annotation.Autowired; | 16 | import org.springframework.beans.factory.annotation.Autowired; |
| 21 | import org.springframework.http.HttpStatus; | 17 | import org.springframework.http.HttpStatus; |
| 22 | import org.springframework.http.ResponseEntity; | 18 | import org.springframework.http.ResponseEntity; |
| 23 | import org.springframework.util.StringUtils; | 19 | import org.springframework.util.StringUtils; |
| 24 | import org.springframework.web.bind.annotation.*; | 20 | import org.springframework.web.bind.annotation.*; |
| 25 | 21 | ||
| 26 | -import java.text.ParseException; | ||
| 27 | import java.time.LocalDateTime; | 22 | import java.time.LocalDateTime; |
| 28 | import java.util.Arrays; | 23 | import java.util.Arrays; |
| 29 | import java.util.List; | 24 | import java.util.List; |
| 30 | 25 | ||
| 31 | -@Api(tags = "报警信息管理") | 26 | +@Tag(name = "报警信息管理") |
| 32 | @CrossOrigin | 27 | @CrossOrigin |
| 33 | @RestController | 28 | @RestController |
| 34 | @RequestMapping("/api/alarm") | 29 | @RequestMapping("/api/alarm") |
| @@ -46,68 +41,6 @@ public class AlarmController { | @@ -46,68 +41,6 @@ public class AlarmController { | ||
| 46 | @Autowired | 41 | @Autowired |
| 47 | private IVideoManagerStorage storage; | 42 | private IVideoManagerStorage storage; |
| 48 | 43 | ||
| 49 | - /** | ||
| 50 | - * 分页查询报警 | ||
| 51 | - * | ||
| 52 | - * @param deviceId 设备id | ||
| 53 | - * @param page 当前页 | ||
| 54 | - * @param count 每页查询数量 | ||
| 55 | - * @param alarmPriority 报警级别 | ||
| 56 | - * @param alarmMethod 报警方式 | ||
| 57 | - * @param alarmType 报警类型 | ||
| 58 | - * @param startTime 开始时间 | ||
| 59 | - * @param endTime 结束时间 | ||
| 60 | - * @return | ||
| 61 | - */ | ||
| 62 | - @ApiOperation("分页查询报警") | ||
| 63 | - @GetMapping("/all") | ||
| 64 | - @ApiImplicitParams({ | ||
| 65 | - @ApiImplicitParam(name="deviceId", value = "设备id", dataTypeClass = String.class), | ||
| 66 | - @ApiImplicitParam(name="page", value = "当前页", required = true ,dataTypeClass = Integer.class), | ||
| 67 | - @ApiImplicitParam(name="count", value = "每页查询数量", required = true ,dataTypeClass = Integer.class), | ||
| 68 | - @ApiImplicitParam(name="alarmPriority", value = "查询内容" ,dataTypeClass = String.class), | ||
| 69 | - @ApiImplicitParam(name="alarmMethod", value = "查询内容" ,dataTypeClass = String.class), | ||
| 70 | - @ApiImplicitParam(name="alarmMethod", value = "查询内容" ,dataTypeClass = String.class), | ||
| 71 | - @ApiImplicitParam(name="alarmType", value = "查询内容" ,dataTypeClass = String.class), | ||
| 72 | - @ApiImplicitParam(name="startTime", value = "开始时间" ,dataTypeClass = String.class), | ||
| 73 | - @ApiImplicitParam(name="endTime", value = "结束时间" ,dataTypeClass = String.class), | ||
| 74 | - }) | ||
| 75 | - public ResponseEntity<PageInfo<DeviceAlarm>> getAll( | ||
| 76 | - @RequestParam int page, | ||
| 77 | - @RequestParam int count, | ||
| 78 | - @RequestParam(required = false) String deviceId, | ||
| 79 | - @RequestParam(required = false) String alarmPriority, | ||
| 80 | - @RequestParam(required = false) String alarmMethod, | ||
| 81 | - @RequestParam(required = false) String alarmType, | ||
| 82 | - @RequestParam(required = false) String startTime, | ||
| 83 | - @RequestParam(required = false) String endTime | ||
| 84 | - ) { | ||
| 85 | - if (StringUtils.isEmpty(alarmPriority)) { | ||
| 86 | - alarmPriority = null; | ||
| 87 | - } | ||
| 88 | - if (StringUtils.isEmpty(alarmMethod)) { | ||
| 89 | - alarmMethod = null; | ||
| 90 | - } | ||
| 91 | - if (StringUtils.isEmpty(alarmType)) { | ||
| 92 | - alarmType = null; | ||
| 93 | - } | ||
| 94 | - if (StringUtils.isEmpty(startTime)) { | ||
| 95 | - startTime = null; | ||
| 96 | - } | ||
| 97 | - if (StringUtils.isEmpty(endTime)) { | ||
| 98 | - endTime = null; | ||
| 99 | - } | ||
| 100 | - | ||
| 101 | - | ||
| 102 | - if (!DateUtil.verification(startTime, DateUtil.formatter) || !DateUtil.verification(endTime, DateUtil.formatter)){ | ||
| 103 | - return new ResponseEntity<>(null, HttpStatus.BAD_REQUEST); | ||
| 104 | - } | ||
| 105 | - | ||
| 106 | - PageInfo<DeviceAlarm> allAlarm = deviceAlarmService.getAllAlarm(page, count, deviceId, alarmPriority, alarmMethod, | ||
| 107 | - alarmType, startTime, endTime); | ||
| 108 | - return new ResponseEntity<>(allAlarm, HttpStatus.OK); | ||
| 109 | - } | ||
| 110 | - | ||
| 111 | 44 | ||
| 112 | /** | 45 | /** |
| 113 | * 删除报警 | 46 | * 删除报警 |
| @@ -117,17 +50,15 @@ public class AlarmController { | @@ -117,17 +50,15 @@ public class AlarmController { | ||
| 117 | * @param time 结束时间(这个时间之前的报警会被删除) | 50 | * @param time 结束时间(这个时间之前的报警会被删除) |
| 118 | * @return | 51 | * @return |
| 119 | */ | 52 | */ |
| 120 | - @ApiOperation("删除报警") | ||
| 121 | @DeleteMapping("/delete") | 53 | @DeleteMapping("/delete") |
| 122 | - @ApiImplicitParams({ | ||
| 123 | - @ApiImplicitParam(name="id", value = "ID", required = false ,dataTypeClass = Integer.class), | ||
| 124 | - @ApiImplicitParam(name="deviceIds", value = "多个设备id,逗号分隔", required = false ,dataTypeClass = String.class), | ||
| 125 | - @ApiImplicitParam(name="time", value = "结束时间", required = false ,dataTypeClass = String.class), | ||
| 126 | - }) | 54 | + @Operation(summary = "删除报警") |
| 55 | + @Parameter(name = "id", description = "ID") | ||
| 56 | + @Parameter(name = "deviceIds", description = "多个设备id,逗号分隔") | ||
| 57 | + @Parameter(name = "time", description = "结束时间") | ||
| 127 | public ResponseEntity<WVPResult<String>> delete( | 58 | public ResponseEntity<WVPResult<String>> delete( |
| 128 | - @RequestParam(required = false) Integer id, | ||
| 129 | - @RequestParam(required = false) String deviceIds, | ||
| 130 | - @RequestParam(required = false) String time | 59 | + @RequestParam(required = false) Integer id, |
| 60 | + @RequestParam(required = false) String deviceIds, | ||
| 61 | + @RequestParam(required = false) String time | ||
| 131 | ) { | 62 | ) { |
| 132 | if (StringUtils.isEmpty(id)) { | 63 | if (StringUtils.isEmpty(id)) { |
| 133 | id = null; | 64 | id = null; |
| @@ -161,11 +92,9 @@ public class AlarmController { | @@ -161,11 +92,9 @@ public class AlarmController { | ||
| 161 | * @param deviceId 报警id | 92 | * @param deviceId 报警id |
| 162 | * @return | 93 | * @return |
| 163 | */ | 94 | */ |
| 164 | - @ApiOperation("测试向上级/设备发送模拟报警通知") | ||
| 165 | @GetMapping("/test/notify/alarm") | 95 | @GetMapping("/test/notify/alarm") |
| 166 | - @ApiImplicitParams({ | ||
| 167 | - @ApiImplicitParam(name="deviceId", value = "deviceId", required = true ,dataTypeClass = Integer.class) | ||
| 168 | - }) | 96 | + @Operation(summary = "测试向上级/设备发送模拟报警通知") |
| 97 | + @Parameter(name = "deviceId", description = "设备国标编号") | ||
| 169 | public ResponseEntity<WVPResult<String>> delete( | 98 | public ResponseEntity<WVPResult<String>> delete( |
| 170 | @RequestParam(required = false) String deviceId | 99 | @RequestParam(required = false) String deviceId |
| 171 | ) { | 100 | ) { |
| @@ -201,5 +130,64 @@ public class AlarmController { | @@ -201,5 +130,64 @@ public class AlarmController { | ||
| 201 | return new ResponseEntity<WVPResult<String>>(wvpResult, HttpStatus.OK); | 130 | return new ResponseEntity<WVPResult<String>>(wvpResult, HttpStatus.OK); |
| 202 | } | 131 | } |
| 203 | 132 | ||
| 133 | + /** | ||
| 134 | + * 分页查询报警 | ||
| 135 | + * | ||
| 136 | + * @param deviceId 设备id | ||
| 137 | + * @param page 当前页 | ||
| 138 | + * @param count 每页查询数量 | ||
| 139 | + * @param alarmPriority 报警级别 | ||
| 140 | + * @param alarmMethod 报警方式 | ||
| 141 | + * @param alarmType 报警类型 | ||
| 142 | + * @param startTime 开始时间 | ||
| 143 | + * @param endTime 结束时间 | ||
| 144 | + * @return | ||
| 145 | + */ | ||
| 146 | + @Operation(summary = "分页查询报警") | ||
| 147 | + @Parameter(name = "page",description = "当前页",required = true) | ||
| 148 | + @Parameter(name = "count",description = "每页查询数量",required = true) | ||
| 149 | + @Parameter(name = "deviceId",description = "设备id") | ||
| 150 | + @Parameter(name = "alarmPriority",description = "查询内容") | ||
| 151 | + @Parameter(name = "alarmMethod",description = "查询内容") | ||
| 152 | + @Parameter(name = "alarmType",description = "每页查询数量") | ||
| 153 | + @Parameter(name = "startTime",description = "开始时间") | ||
| 154 | + @Parameter(name = "endTime",description = "结束时间") | ||
| 155 | + @GetMapping("/all") | ||
| 156 | + public ResponseEntity<PageInfo<DeviceAlarm>> getAll( | ||
| 157 | + @RequestParam int page, | ||
| 158 | + @RequestParam int count, | ||
| 159 | + @RequestParam(required = false) String deviceId, | ||
| 160 | + @RequestParam(required = false) String alarmPriority, | ||
| 161 | + @RequestParam(required = false) String alarmMethod, | ||
| 162 | + @RequestParam(required = false) String alarmType, | ||
| 163 | + @RequestParam(required = false) String startTime, | ||
| 164 | + @RequestParam(required = false) String endTime | ||
| 165 | + ) { | ||
| 166 | + if (StringUtils.isEmpty(alarmPriority)) { | ||
| 167 | + alarmPriority = null; | ||
| 168 | + } | ||
| 169 | + if (StringUtils.isEmpty(alarmMethod)) { | ||
| 170 | + alarmMethod = null; | ||
| 171 | + } | ||
| 172 | + if (StringUtils.isEmpty(alarmType)) { | ||
| 173 | + alarmType = null; | ||
| 174 | + } | ||
| 175 | + if (StringUtils.isEmpty(startTime)) { | ||
| 176 | + startTime = null; | ||
| 177 | + } | ||
| 178 | + if (StringUtils.isEmpty(endTime)) { | ||
| 179 | + endTime = null; | ||
| 180 | + } | ||
| 181 | + | ||
| 182 | + | ||
| 183 | + if (!DateUtil.verification(startTime, DateUtil.formatter) || !DateUtil.verification(endTime, DateUtil.formatter)){ | ||
| 184 | + return new ResponseEntity<>(null, HttpStatus.BAD_REQUEST); | ||
| 185 | + } | ||
| 186 | + | ||
| 187 | + PageInfo<DeviceAlarm> allAlarm = deviceAlarmService.getAllAlarm(page, count, deviceId, alarmPriority, alarmMethod, | ||
| 188 | + alarmType, startTime, endTime); | ||
| 189 | + return new ResponseEntity<>(allAlarm, HttpStatus.OK); | ||
| 190 | + } | ||
| 191 | + | ||
| 204 | 192 | ||
| 205 | } | 193 | } |
src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/device/DeviceConfig.java
| @@ -14,10 +14,9 @@ import com.genersoft.iot.vmp.gb28181.transmit.callback.RequestMessage; | @@ -14,10 +14,9 @@ import com.genersoft.iot.vmp.gb28181.transmit.callback.RequestMessage; | ||
| 14 | import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommander; | 14 | import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommander; |
| 15 | import com.genersoft.iot.vmp.storager.IVideoManagerStorage; | 15 | import com.genersoft.iot.vmp.storager.IVideoManagerStorage; |
| 16 | 16 | ||
| 17 | -import io.swagger.annotations.Api; | ||
| 18 | -import io.swagger.annotations.ApiImplicitParam; | ||
| 19 | -import io.swagger.annotations.ApiImplicitParams; | ||
| 20 | -import io.swagger.annotations.ApiOperation; | 17 | +import io.swagger.v3.oas.annotations.Operation; |
| 18 | +import io.swagger.v3.oas.annotations.Parameter; | ||
| 19 | +import io.swagger.v3.oas.annotations.tags.Tag; | ||
| 21 | import org.slf4j.Logger; | 20 | import org.slf4j.Logger; |
| 22 | import org.slf4j.LoggerFactory; | 21 | import org.slf4j.LoggerFactory; |
| 23 | import org.springframework.beans.factory.annotation.Autowired; | 22 | import org.springframework.beans.factory.annotation.Autowired; |
| @@ -28,7 +27,7 @@ import org.springframework.web.context.request.async.DeferredResult; | @@ -28,7 +27,7 @@ import org.springframework.web.context.request.async.DeferredResult; | ||
| 28 | 27 | ||
| 29 | import java.util.UUID; | 28 | import java.util.UUID; |
| 30 | 29 | ||
| 31 | -@Api(tags = "国标设备配置") | 30 | +@Tag(name = "国标设备配置") |
| 32 | @CrossOrigin | 31 | @CrossOrigin |
| 33 | @RestController | 32 | @RestController |
| 34 | @RequestMapping("/api/device/config") | 33 | @RequestMapping("/api/device/config") |
| @@ -55,16 +54,14 @@ public class DeviceConfig { | @@ -55,16 +54,14 @@ public class DeviceConfig { | ||
| 55 | * @param heartBeatCount 心跳计数 | 54 | * @param heartBeatCount 心跳计数 |
| 56 | * @return | 55 | * @return |
| 57 | */ | 56 | */ |
| 58 | - @ApiOperation("基本配置设置命令") | ||
| 59 | @GetMapping("/basicParam/{deviceId}") | 57 | @GetMapping("/basicParam/{deviceId}") |
| 60 | - @ApiImplicitParams({ | ||
| 61 | - @ApiImplicitParam(name = "deviceId", value ="设备ID" ,dataTypeClass = String.class), | ||
| 62 | - @ApiImplicitParam(name = "channelId", value ="通道ID",dataTypeClass = String.class ), | ||
| 63 | - @ApiImplicitParam(name = "name", value ="名称" ,dataTypeClass = String.class), | ||
| 64 | - @ApiImplicitParam(name = "expiration", value ="到期时间" ,dataTypeClass = String.class), | ||
| 65 | - @ApiImplicitParam(name = "heartBeatInterval", value ="心跳间隔" ,dataTypeClass = String.class), | ||
| 66 | - @ApiImplicitParam(name = "heartBeatCount", value ="心跳计数" ,dataTypeClass = String.class), | ||
| 67 | - }) | 58 | + @Operation(summary = "基本配置设置命令") |
| 59 | + @Parameter(name = "deviceId", description = "设备国标编号", required = true) | ||
| 60 | + @Parameter(name = "channelId", description = "通道国标编号", required = true) | ||
| 61 | + @Parameter(name = "name", description = "名称") | ||
| 62 | + @Parameter(name = "expiration", description = "到期时间") | ||
| 63 | + @Parameter(name = "heartBeatInterval", description = "心跳间隔") | ||
| 64 | + @Parameter(name = "heartBeatCount", description = "心跳计数") | ||
| 68 | public DeferredResult<ResponseEntity<String>> homePositionApi(@PathVariable String deviceId, | 65 | public DeferredResult<ResponseEntity<String>> homePositionApi(@PathVariable String deviceId, |
| 69 | String channelId, | 66 | String channelId, |
| 70 | @RequestParam(required = false) String name, | 67 | @RequestParam(required = false) String name, |
| @@ -109,12 +106,10 @@ public class DeviceConfig { | @@ -109,12 +106,10 @@ public class DeviceConfig { | ||
| 109 | * @param channelId 通道ID | 106 | * @param channelId 通道ID |
| 110 | * @return | 107 | * @return |
| 111 | */ | 108 | */ |
| 112 | - @ApiOperation("设备配置查询请求") | ||
| 113 | - @ApiImplicitParams({ | ||
| 114 | - @ApiImplicitParam(name = "deviceId", value ="设备ID" ,dataTypeClass = String.class), | ||
| 115 | - @ApiImplicitParam(name = "channelId", value ="通道ID" ,dataTypeClass = String.class), | ||
| 116 | - @ApiImplicitParam(name = "configType", value ="配置类型" ,dataTypeClass = String.class), | ||
| 117 | - }) | 109 | + @Operation(summary = "设备配置查询请求") |
| 110 | + @Parameter(name = "deviceId", description = "设备国标编号", required = true) | ||
| 111 | + @Parameter(name = "channelId", description = "通道国标编号", required = true) | ||
| 112 | + @Parameter(name = "configType", description = "配置类型") | ||
| 118 | @GetMapping("/query/{deviceId}/{configType}") | 113 | @GetMapping("/query/{deviceId}/{configType}") |
| 119 | public DeferredResult<ResponseEntity<String>> configDownloadApi(@PathVariable String deviceId, | 114 | public DeferredResult<ResponseEntity<String>> configDownloadApi(@PathVariable String deviceId, |
| 120 | @PathVariable String configType, | 115 | @PathVariable String configType, |
src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/device/DeviceControl.java
| @@ -14,10 +14,9 @@ import com.genersoft.iot.vmp.gb28181.transmit.callback.RequestMessage; | @@ -14,10 +14,9 @@ import com.genersoft.iot.vmp.gb28181.transmit.callback.RequestMessage; | ||
| 14 | import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommander; | 14 | import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommander; |
| 15 | import com.genersoft.iot.vmp.storager.IVideoManagerStorage; | 15 | import com.genersoft.iot.vmp.storager.IVideoManagerStorage; |
| 16 | 16 | ||
| 17 | -import io.swagger.annotations.Api; | ||
| 18 | -import io.swagger.annotations.ApiImplicitParam; | ||
| 19 | -import io.swagger.annotations.ApiImplicitParams; | ||
| 20 | -import io.swagger.annotations.ApiOperation; | 17 | +import io.swagger.v3.oas.annotations.Operation; |
| 18 | +import io.swagger.v3.oas.annotations.Parameter; | ||
| 19 | +import io.swagger.v3.oas.annotations.tags.Tag; | ||
| 21 | import org.slf4j.Logger; | 20 | import org.slf4j.Logger; |
| 22 | import org.slf4j.LoggerFactory; | 21 | import org.slf4j.LoggerFactory; |
| 23 | import org.springframework.beans.factory.annotation.Autowired; | 22 | import org.springframework.beans.factory.annotation.Autowired; |
| @@ -29,7 +28,7 @@ import org.springframework.web.context.request.async.DeferredResult; | @@ -29,7 +28,7 @@ import org.springframework.web.context.request.async.DeferredResult; | ||
| 29 | 28 | ||
| 30 | import java.util.UUID; | 29 | import java.util.UUID; |
| 31 | 30 | ||
| 32 | -@Api(tags = "国标设备控制") | 31 | +@Tag(name = "国标设备控制") |
| 33 | @CrossOrigin | 32 | @CrossOrigin |
| 34 | @RestController | 33 | @RestController |
| 35 | @RequestMapping("/api/device/control") | 34 | @RequestMapping("/api/device/control") |
| @@ -51,10 +50,12 @@ public class DeviceControl { | @@ -51,10 +50,12 @@ public class DeviceControl { | ||
| 51 | * | 50 | * |
| 52 | * @param deviceId 设备ID | 51 | * @param deviceId 设备ID |
| 53 | */ | 52 | */ |
| 54 | - @ApiOperation("远程启动控制命令") | ||
| 55 | - @ApiImplicitParams({ | ||
| 56 | - @ApiImplicitParam(name = "deviceId", value ="设备ID", required = true, dataTypeClass = String.class), | ||
| 57 | - }) | 53 | +// //@ApiOperation("远程启动控制命令") |
| 54 | +// @ApiImplicitParams({ | ||
| 55 | +// @ApiImplicitParam(name = "deviceId", value ="设备ID", required = true, dataTypeClass = String.class), | ||
| 56 | +// }) | ||
| 57 | + @Operation(summary = "远程启动控制命令") | ||
| 58 | + @Parameter(name = "deviceId", description = "设备国标编号", required = true) | ||
| 58 | @GetMapping("/teleboot/{deviceId}") | 59 | @GetMapping("/teleboot/{deviceId}") |
| 59 | public ResponseEntity<String> teleBootApi(@PathVariable String deviceId) { | 60 | public ResponseEntity<String> teleBootApi(@PathVariable String deviceId) { |
| 60 | if (logger.isDebugEnabled()) { | 61 | if (logger.isDebugEnabled()) { |
| @@ -80,13 +81,10 @@ public class DeviceControl { | @@ -80,13 +81,10 @@ public class DeviceControl { | ||
| 80 | * @param recordCmdStr Record:手动录像,StopRecord:停止手动录像 | 81 | * @param recordCmdStr Record:手动录像,StopRecord:停止手动录像 |
| 81 | * @param channelId 通道编码(可选) | 82 | * @param channelId 通道编码(可选) |
| 82 | */ | 83 | */ |
| 83 | - @ApiOperation("录像控制命令") | ||
| 84 | - @ApiImplicitParams({ | ||
| 85 | - @ApiImplicitParam(name = "deviceId", value ="设备ID", required = true, dataTypeClass = String.class), | ||
| 86 | - @ApiImplicitParam(name = "channelId", value ="通道编码" ,dataTypeClass = String.class), | ||
| 87 | - @ApiImplicitParam(name = "recordCmdStr", value ="命令, 可选值:Record(手动录像),StopRecord(停止手动录像)", | ||
| 88 | - required = true ,dataTypeClass = String.class), | ||
| 89 | - }) | 84 | + @Operation(summary = "录像控制") |
| 85 | + @Parameter(name = "deviceId", description = "设备国标编号", required = true) | ||
| 86 | + @Parameter(name = "channelId", description = "通道国标编号", required = true) | ||
| 87 | + @Parameter(name = "recordCmdStr", description = "命令, 可选值:Record(手动录像),StopRecord(停止手动录像)", required = true) | ||
| 90 | @GetMapping("/record/{deviceId}/{recordCmdStr}") | 88 | @GetMapping("/record/{deviceId}/{recordCmdStr}") |
| 91 | public DeferredResult<ResponseEntity<String>> recordApi(@PathVariable String deviceId, | 89 | public DeferredResult<ResponseEntity<String>> recordApi(@PathVariable String deviceId, |
| 92 | @PathVariable String recordCmdStr, String channelId) { | 90 | @PathVariable String recordCmdStr, String channelId) { |
| @@ -127,13 +125,10 @@ public class DeviceControl { | @@ -127,13 +125,10 @@ public class DeviceControl { | ||
| 127 | * @param deviceId 设备ID | 125 | * @param deviceId 设备ID |
| 128 | * @param guardCmdStr SetGuard:布防,ResetGuard:撤防 | 126 | * @param guardCmdStr SetGuard:布防,ResetGuard:撤防 |
| 129 | */ | 127 | */ |
| 130 | - @ApiOperation("布防/撤防命令") | ||
| 131 | - @ApiImplicitParams({ | ||
| 132 | - @ApiImplicitParam(name = "deviceId", value = "设备ID", required = true, dataTypeClass = String.class), | ||
| 133 | - @ApiImplicitParam(name = "channelId", value ="通道编码" ,dataTypeClass = String.class), | ||
| 134 | - @ApiImplicitParam(name = "guardCmdStr", value ="命令, 可选值:SetGuard(布防),ResetGuard(撤防)", required = true, | ||
| 135 | - dataTypeClass = String.class) | ||
| 136 | - }) | 128 | + @Operation(summary = "布防/撤防命令") |
| 129 | + @Parameter(name = "deviceId", description = "设备国标编号", required = true) | ||
| 130 | + @Parameter(name = "channelId", description = "通道国标编号", required = true) | ||
| 131 | + @Parameter(name = "guardCmdStr", description = "命令, 可选值:SetGuard(布防),ResetGuard(撤防)", required = true) | ||
| 137 | @GetMapping("/guard/{deviceId}/{guardCmdStr}") | 132 | @GetMapping("/guard/{deviceId}/{guardCmdStr}") |
| 138 | public DeferredResult<ResponseEntity<String>> guardApi(@PathVariable String deviceId, String channelId, @PathVariable String guardCmdStr) { | 133 | public DeferredResult<ResponseEntity<String>> guardApi(@PathVariable String deviceId, String channelId, @PathVariable String guardCmdStr) { |
| 139 | if (logger.isDebugEnabled()) { | 134 | if (logger.isDebugEnabled()) { |
| @@ -171,13 +166,11 @@ public class DeviceControl { | @@ -171,13 +166,11 @@ public class DeviceControl { | ||
| 171 | * @param alarmMethod 报警方式(可选) | 166 | * @param alarmMethod 报警方式(可选) |
| 172 | * @param alarmType 报警类型(可选) | 167 | * @param alarmType 报警类型(可选) |
| 173 | */ | 168 | */ |
| 174 | - @ApiOperation("报警复位") | ||
| 175 | - @ApiImplicitParams({ | ||
| 176 | - @ApiImplicitParam(name = "deviceId", value = "设备ID", required = true, dataTypeClass = String.class), | ||
| 177 | - @ApiImplicitParam(name = "channelId", value ="通道编码" ,dataTypeClass = String.class), | ||
| 178 | - @ApiImplicitParam(name = "alarmMethod", value ="报警方式", dataTypeClass = String.class), | ||
| 179 | - @ApiImplicitParam(name = "alarmType", value ="报警类型", dataTypeClass = String.class), | ||
| 180 | - }) | 169 | + @Operation(summary = "报警复位") |
| 170 | + @Parameter(name = "deviceId", description = "设备国标编号", required = true) | ||
| 171 | + @Parameter(name = "channelId", description = "通道国标编号", required = true) | ||
| 172 | + @Parameter(name = "alarmMethod", description = "报警方式") | ||
| 173 | + @Parameter(name = "alarmType", description = "报警类型") | ||
| 181 | @GetMapping("/reset_alarm/{deviceId}") | 174 | @GetMapping("/reset_alarm/{deviceId}") |
| 182 | public DeferredResult<ResponseEntity<String>> resetAlarmApi(@PathVariable String deviceId, String channelId, | 175 | public DeferredResult<ResponseEntity<String>> resetAlarmApi(@PathVariable String deviceId, String channelId, |
| 183 | @RequestParam(required = false) String alarmMethod, | 176 | @RequestParam(required = false) String alarmMethod, |
| @@ -215,11 +208,9 @@ public class DeviceControl { | @@ -215,11 +208,9 @@ public class DeviceControl { | ||
| 215 | * @param deviceId 设备ID | 208 | * @param deviceId 设备ID |
| 216 | * @param channelId 通道ID | 209 | * @param channelId 通道ID |
| 217 | */ | 210 | */ |
| 218 | - @ApiOperation("强制关键帧") | ||
| 219 | - @ApiImplicitParams({ | ||
| 220 | - @ApiImplicitParam(name = "deviceId", value = "设备ID", required = true, dataTypeClass = String.class), | ||
| 221 | - @ApiImplicitParam(name = "channelId", value ="通道ID", required = true, dataTypeClass = String.class), | ||
| 222 | - }) | 211 | + @Operation(summary = "强制关键帧") |
| 212 | + @Parameter(name = "deviceId", description = "设备国标编号", required = true) | ||
| 213 | + @Parameter(name = "channelId", description = "通道国标编号") | ||
| 223 | @GetMapping("/i_frame/{deviceId}") | 214 | @GetMapping("/i_frame/{deviceId}") |
| 224 | public ResponseEntity<String> iFrame(@PathVariable String deviceId, | 215 | public ResponseEntity<String> iFrame(@PathVariable String deviceId, |
| 225 | @RequestParam(required = false) String channelId) { | 216 | @RequestParam(required = false) String channelId) { |
| @@ -249,15 +240,12 @@ public class DeviceControl { | @@ -249,15 +240,12 @@ public class DeviceControl { | ||
| 249 | * @param presetIndex 调用预置位编号(可选) | 240 | * @param presetIndex 调用预置位编号(可选) |
| 250 | * @param channelId 通道编码(可选) | 241 | * @param channelId 通道编码(可选) |
| 251 | */ | 242 | */ |
| 252 | - @ApiOperation("看守位控制") | ||
| 253 | - @ApiImplicitParams({ | ||
| 254 | - @ApiImplicitParam(name = "deviceId", value = "设备ID", required = true, dataTypeClass = String.class), | ||
| 255 | - @ApiImplicitParam(name = "channelId", value ="通道编码" ,dataTypeClass = String.class), | ||
| 256 | - @ApiImplicitParam(name = "enabled", value = "是否开启看守位 1:开启,0:关闭", required = true, dataTypeClass = String.class), | ||
| 257 | - @ApiImplicitParam(name = "resetTime", value = "自动归位时间间隔", dataTypeClass = String.class), | ||
| 258 | - @ApiImplicitParam(name = "presetIndex", value = "调用预置位编号", dataTypeClass = String.class), | ||
| 259 | - @ApiImplicitParam(name = "channelId", value ="通道ID", dataTypeClass = String.class), | ||
| 260 | - }) | 243 | + @Operation(summary = "看守位控制") |
| 244 | + @Parameter(name = "deviceId", description = "设备国标编号", required = true) | ||
| 245 | + @Parameter(name = "channelId", description = "通道国标编号", required = true) | ||
| 246 | + @Parameter(name = "enabled", description = "是否开启看守位 1:开启,0:关闭", required = true) | ||
| 247 | + @Parameter(name = "presetIndex", description = "调用预置位编号") | ||
| 248 | + @Parameter(name = "resetTime", description = "自动归位时间间隔") | ||
| 261 | @GetMapping("/home_position/{deviceId}/{enabled}") | 249 | @GetMapping("/home_position/{deviceId}/{enabled}") |
| 262 | public DeferredResult<ResponseEntity<String>> homePositionApi(@PathVariable String deviceId, | 250 | public DeferredResult<ResponseEntity<String>> homePositionApi(@PathVariable String deviceId, |
| 263 | @PathVariable String enabled, | 251 | @PathVariable String enabled, |
| @@ -307,17 +295,14 @@ public class DeviceControl { | @@ -307,17 +295,14 @@ public class DeviceControl { | ||
| 307 | * @param lengthy 拉框宽度像素值 | 295 | * @param lengthy 拉框宽度像素值 |
| 308 | * @return | 296 | * @return |
| 309 | */ | 297 | */ |
| 310 | - @ApiOperation("拉框放大") | ||
| 311 | - @ApiImplicitParams({ | ||
| 312 | - @ApiImplicitParam(name = "deviceId", value = "设备ID", required = true, dataTypeClass = String.class), | ||
| 313 | - @ApiImplicitParam(name = "channelId", value = "通道ID", dataTypeClass = String.class), | ||
| 314 | - @ApiImplicitParam(name = "length", value = "播放窗口长度像素值", required = true, dataTypeClass = Integer.class), | ||
| 315 | - @ApiImplicitParam(name = "width", value = "播放窗口宽度像素值", required = true, dataTypeClass = Integer.class), | ||
| 316 | - @ApiImplicitParam(name = "midpointx", value = "拉框中心的横轴坐标像素值", required = true, dataTypeClass = Integer.class), | ||
| 317 | - @ApiImplicitParam(name = "midpointy", value = "拉框中心的纵轴坐标像素值", required = true, dataTypeClass = Integer.class), | ||
| 318 | - @ApiImplicitParam(name = "lengthx", value = "拉框长度像素值", required = true, dataTypeClass = Integer.class), | ||
| 319 | - @ApiImplicitParam(name = "lengthy", value = "拉框宽度像素值", required = true, dataTypeClass = Integer.class), | ||
| 320 | - }) | 298 | + @Operation(summary = "拉框放大") |
| 299 | + @Parameter(name = "deviceId", description = "设备国标编号", required = true) | ||
| 300 | + @Parameter(name = "channelId", description = "通道国标编号", required = true) | ||
| 301 | + @Parameter(name = "length", description = "播放窗口长度像素值", required = true) | ||
| 302 | + @Parameter(name = "midpointx", description = "拉框中心的横轴坐标像素值", required = true) | ||
| 303 | + @Parameter(name = "midpointy", description = "拉框中心的纵轴坐标像素值", required = true) | ||
| 304 | + @Parameter(name = "lengthx", description = "拉框长度像素值", required = true) | ||
| 305 | + @Parameter(name = "lengthy", description = "lengthy", required = true) | ||
| 321 | @GetMapping("drag_zoom/zoom_in") | 306 | @GetMapping("drag_zoom/zoom_in") |
| 322 | public ResponseEntity<String> dragZoomIn(@RequestParam String deviceId, | 307 | public ResponseEntity<String> dragZoomIn(@RequestParam String deviceId, |
| 323 | @RequestParam(required = false) String channelId, | 308 | @RequestParam(required = false) String channelId, |
| @@ -356,17 +341,15 @@ public class DeviceControl { | @@ -356,17 +341,15 @@ public class DeviceControl { | ||
| 356 | * @param lengthy 拉框宽度像素值 | 341 | * @param lengthy 拉框宽度像素值 |
| 357 | * @return | 342 | * @return |
| 358 | */ | 343 | */ |
| 359 | - @ApiOperation("拉框缩小") | ||
| 360 | - @ApiImplicitParams({ | ||
| 361 | - @ApiImplicitParam(name = "deviceId", value = "设备ID", required = true, dataTypeClass = String.class), | ||
| 362 | - @ApiImplicitParam(name = "channelId", value = "通道ID", dataTypeClass = String.class), | ||
| 363 | - @ApiImplicitParam(name = "length", value = "播放窗口长度像素值", required = true, dataTypeClass = Integer.class), | ||
| 364 | - @ApiImplicitParam(name = "width", value = "播放窗口宽度像素值", required = true, dataTypeClass = Integer.class), | ||
| 365 | - @ApiImplicitParam(name = "midpointx", value = "拉框中心的横轴坐标像素值", required = true, dataTypeClass = Integer.class), | ||
| 366 | - @ApiImplicitParam(name = "midpointy", value = "拉框中心的纵轴坐标像素值", required = true, dataTypeClass = Integer.class), | ||
| 367 | - @ApiImplicitParam(name = "lengthx", value = "拉框长度像素值", required = true, dataTypeClass = Integer.class), | ||
| 368 | - @ApiImplicitParam(name = "lengthy", value = "拉框宽度像素值", required = true, dataTypeClass = Integer.class), | ||
| 369 | - }) | 344 | + @Operation(summary = "拉框放大") |
| 345 | + @Parameter(name = "deviceId", description = "设备国标编号", required = true) | ||
| 346 | + @Parameter(name = "channelId", description = "通道国标编号") | ||
| 347 | + @Parameter(name = "length", description = "播放窗口长度像素值", required = true) | ||
| 348 | + @Parameter(name = "width", description = "拉框中心的横轴坐标像素值", required = true) | ||
| 349 | + @Parameter(name = "midpointx", description = "拉框中心的横轴坐标像素值", required = true) | ||
| 350 | + @Parameter(name = "midpointy", description = "拉框中心的纵轴坐标像素值", required = true) | ||
| 351 | + @Parameter(name = "lengthx", description = "拉框长度像素值", required = true) | ||
| 352 | + @Parameter(name = "lengthy", description = "拉框宽度像素值", required = true) | ||
| 370 | @GetMapping("/drag_zoom/zoom_out") | 353 | @GetMapping("/drag_zoom/zoom_out") |
| 371 | public ResponseEntity<String> dragZoomOut(@RequestParam String deviceId, | 354 | public ResponseEntity<String> dragZoomOut(@RequestParam String deviceId, |
| 372 | @RequestParam(required = false) String channelId, | 355 | @RequestParam(required = false) String channelId, |
src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/device/DeviceQuery.java
| @@ -19,10 +19,9 @@ import com.genersoft.iot.vmp.storager.IVideoManagerStorage; | @@ -19,10 +19,9 @@ import com.genersoft.iot.vmp.storager.IVideoManagerStorage; | ||
| 19 | import com.genersoft.iot.vmp.vmanager.bean.BaseTree; | 19 | import com.genersoft.iot.vmp.vmanager.bean.BaseTree; |
| 20 | import com.genersoft.iot.vmp.vmanager.bean.WVPResult; | 20 | import com.genersoft.iot.vmp.vmanager.bean.WVPResult; |
| 21 | import com.github.pagehelper.PageInfo; | 21 | import com.github.pagehelper.PageInfo; |
| 22 | -import io.swagger.annotations.Api; | ||
| 23 | -import io.swagger.annotations.ApiImplicitParam; | ||
| 24 | -import io.swagger.annotations.ApiImplicitParams; | ||
| 25 | -import io.swagger.annotations.ApiOperation; | 22 | +import io.swagger.v3.oas.annotations.Operation; |
| 23 | +import io.swagger.v3.oas.annotations.Parameter; | ||
| 24 | +import io.swagger.v3.oas.annotations.tags.Tag; | ||
| 26 | import org.apache.commons.compress.utils.IOUtils; | 25 | import org.apache.commons.compress.utils.IOUtils; |
| 27 | import org.apache.http.HttpResponse; | 26 | import org.apache.http.HttpResponse; |
| 28 | import org.slf4j.Logger; | 27 | import org.slf4j.Logger; |
| @@ -41,7 +40,7 @@ import java.io.*; | @@ -41,7 +40,7 @@ import java.io.*; | ||
| 41 | import java.nio.file.Files; | 40 | import java.nio.file.Files; |
| 42 | import java.util.*; | 41 | import java.util.*; |
| 43 | 42 | ||
| 44 | -@Api(tags = "国标设备查询", value = "国标设备查询") | 43 | +@Tag(name = "国标设备查询", description = "国标设备查询") |
| 45 | @SuppressWarnings("rawtypes") | 44 | @SuppressWarnings("rawtypes") |
| 46 | @CrossOrigin | 45 | @CrossOrigin |
| 47 | @RestController | 46 | @RestController |
| @@ -79,17 +78,11 @@ public class DeviceQuery { | @@ -79,17 +78,11 @@ public class DeviceQuery { | ||
| 79 | * @param deviceId 国标ID | 78 | * @param deviceId 国标ID |
| 80 | * @return 国标设备 | 79 | * @return 国标设备 |
| 81 | */ | 80 | */ |
| 82 | - @ApiOperation("使用ID查询国标设备") | ||
| 83 | - @ApiImplicitParams({ | ||
| 84 | - @ApiImplicitParam(name = "deviceId", value = "设备ID", required = true, dataTypeClass = String.class), | ||
| 85 | - }) | 81 | + @Operation(summary = "查询国标设备") |
| 82 | + @Parameter(name = "deviceId", description = "设备国标编号", required = true) | ||
| 86 | @GetMapping("/devices/{deviceId}") | 83 | @GetMapping("/devices/{deviceId}") |
| 87 | public ResponseEntity<Device> devices(@PathVariable String deviceId){ | 84 | public ResponseEntity<Device> devices(@PathVariable String deviceId){ |
| 88 | 85 | ||
| 89 | -// if (logger.isDebugEnabled()) { | ||
| 90 | -// logger.debug("查询视频设备API调用,deviceId:" + deviceId); | ||
| 91 | -// } | ||
| 92 | - | ||
| 93 | Device device = storager.queryVideoDevice(deviceId); | 86 | Device device = storager.queryVideoDevice(deviceId); |
| 94 | return new ResponseEntity<>(device,HttpStatus.OK); | 87 | return new ResponseEntity<>(device,HttpStatus.OK); |
| 95 | } | 88 | } |
| @@ -100,18 +93,12 @@ public class DeviceQuery { | @@ -100,18 +93,12 @@ public class DeviceQuery { | ||
| 100 | * @param count 每页查询数量 | 93 | * @param count 每页查询数量 |
| 101 | * @return 分页国标列表 | 94 | * @return 分页国标列表 |
| 102 | */ | 95 | */ |
| 103 | - @ApiOperation("分页查询国标设备") | ||
| 104 | - @ApiImplicitParams({ | ||
| 105 | - @ApiImplicitParam(name = "page", value = "当前页", required = true, dataTypeClass = Integer.class), | ||
| 106 | - @ApiImplicitParam(name = "count", value = "每页查询数量", required = true, dataTypeClass = Integer.class), | ||
| 107 | - }) | 96 | + @Operation(summary = "分页查询国标设备") |
| 97 | + @Parameter(name = "page", description = "当前页", required = true) | ||
| 98 | + @Parameter(name = "count", description = "每页查询数量", required = true) | ||
| 108 | @GetMapping("/devices") | 99 | @GetMapping("/devices") |
| 109 | public PageInfo<Device> devices(int page, int count){ | 100 | public PageInfo<Device> devices(int page, int count){ |
| 110 | 101 | ||
| 111 | -// if (logger.isDebugEnabled()) { | ||
| 112 | -// logger.debug("查询所有视频设备API调用"); | ||
| 113 | -// } | ||
| 114 | - | ||
| 115 | return storager.queryVideoDeviceList(page, count); | 102 | return storager.queryVideoDeviceList(page, count); |
| 116 | } | 103 | } |
| 117 | 104 | ||
| @@ -124,28 +111,24 @@ public class DeviceQuery { | @@ -124,28 +111,24 @@ public class DeviceQuery { | ||
| 124 | * @param query 查询内容 | 111 | * @param query 查询内容 |
| 125 | * @param online 是否在线 在线 true / 离线 false | 112 | * @param online 是否在线 在线 true / 离线 false |
| 126 | * @param channelType 设备 false/子目录 true | 113 | * @param channelType 设备 false/子目录 true |
| 114 | + * @param catalogUnderDevice 是否直属与设备的目录 | ||
| 127 | * @return 通道列表 | 115 | * @return 通道列表 |
| 128 | */ | 116 | */ |
| 129 | - @ApiOperation("分页查询通道") | ||
| 130 | @GetMapping("/devices/{deviceId}/channels") | 117 | @GetMapping("/devices/{deviceId}/channels") |
| 131 | - @ApiImplicitParams({ | ||
| 132 | - @ApiImplicitParam(name="deviceId", value = "设备id", required = true ,dataTypeClass = String.class), | ||
| 133 | - @ApiImplicitParam(name="page", value = "当前页", required = true ,dataTypeClass = Integer.class), | ||
| 134 | - @ApiImplicitParam(name="count", value = "每页查询数量", required = true ,dataTypeClass = Integer.class), | ||
| 135 | - @ApiImplicitParam(name="query", value = "查询内容" ,dataTypeClass = String.class), | ||
| 136 | - @ApiImplicitParam(name="online", value = "是否在线" ,dataTypeClass = Boolean.class), | ||
| 137 | - @ApiImplicitParam(name="channelType", value = "设备/子目录-> false/true" ,dataTypeClass = Boolean.class), | ||
| 138 | - @ApiImplicitParam(name="catalogUnderDevice", value = "是否直属与设备的目录" ,dataTypeClass = Boolean.class), | ||
| 139 | - }) | 118 | + @Operation(summary = "分页查询通道") |
| 119 | + @Parameter(name = "deviceId", description = "设备国标编号", required = true) | ||
| 120 | + @Parameter(name = "page", description = "当前页", required = true) | ||
| 121 | + @Parameter(name = "count", description = "每页查询数量", required = true) | ||
| 122 | + @Parameter(name = "query", description = "查询内容") | ||
| 123 | + @Parameter(name = "online", description = "是否在线") | ||
| 124 | + @Parameter(name = "channelType", description = "设备/子目录-> false/true") | ||
| 125 | + @Parameter(name = "catalogUnderDevice", description = "是否直属与设备的目录") | ||
| 140 | public ResponseEntity<PageInfo> channels(@PathVariable String deviceId, | 126 | public ResponseEntity<PageInfo> channels(@PathVariable String deviceId, |
| 141 | int page, int count, | 127 | int page, int count, |
| 142 | @RequestParam(required = false) String query, | 128 | @RequestParam(required = false) String query, |
| 143 | @RequestParam(required = false) Boolean online, | 129 | @RequestParam(required = false) Boolean online, |
| 144 | @RequestParam(required = false) Boolean channelType, | 130 | @RequestParam(required = false) Boolean channelType, |
| 145 | @RequestParam(required = false) Boolean catalogUnderDevice) { | 131 | @RequestParam(required = false) Boolean catalogUnderDevice) { |
| 146 | -// if (logger.isDebugEnabled()) { | ||
| 147 | -// logger.debug("查询视频设备通道API调用"); | ||
| 148 | -// } | ||
| 149 | if (StringUtils.isEmpty(query)) { | 132 | if (StringUtils.isEmpty(query)) { |
| 150 | query = null; | 133 | query = null; |
| 151 | } | 134 | } |
| @@ -159,10 +142,8 @@ public class DeviceQuery { | @@ -159,10 +142,8 @@ public class DeviceQuery { | ||
| 159 | * @param deviceId 设备id | 142 | * @param deviceId 设备id |
| 160 | * @return | 143 | * @return |
| 161 | */ | 144 | */ |
| 162 | - @ApiOperation("同步设备通道") | ||
| 163 | - @ApiImplicitParams({ | ||
| 164 | - @ApiImplicitParam(name="deviceId", value = "设备id", required = true, dataTypeClass = String.class), | ||
| 165 | - }) | 145 | + @Operation(summary = "同步设备通道") |
| 146 | + @Parameter(name = "deviceId", description = "设备国标编号", required = true) | ||
| 166 | @PostMapping("/devices/{deviceId}/sync") | 147 | @PostMapping("/devices/{deviceId}/sync") |
| 167 | public WVPResult<SyncStatus> devicesSync(@PathVariable String deviceId){ | 148 | public WVPResult<SyncStatus> devicesSync(@PathVariable String deviceId){ |
| 168 | 149 | ||
| @@ -192,10 +173,8 @@ public class DeviceQuery { | @@ -192,10 +173,8 @@ public class DeviceQuery { | ||
| 192 | * @param deviceId 设备id | 173 | * @param deviceId 设备id |
| 193 | * @return | 174 | * @return |
| 194 | */ | 175 | */ |
| 195 | - @ApiOperation("移除设备") | ||
| 196 | - @ApiImplicitParams({ | ||
| 197 | - @ApiImplicitParam(name="deviceId", value = "设备id", required = true, dataTypeClass = String.class), | ||
| 198 | - }) | 176 | + @Operation(summary = "移除设备") |
| 177 | + @Parameter(name = "deviceId", description = "设备国标编号", required = true) | ||
| 199 | @DeleteMapping("/devices/{deviceId}/delete") | 178 | @DeleteMapping("/devices/{deviceId}/delete") |
| 200 | public ResponseEntity<String> delete(@PathVariable String deviceId){ | 179 | public ResponseEntity<String> delete(@PathVariable String deviceId){ |
| 201 | 180 | ||
| @@ -239,16 +218,14 @@ public class DeviceQuery { | @@ -239,16 +218,14 @@ public class DeviceQuery { | ||
| 239 | * @param channelType 通道类型 | 218 | * @param channelType 通道类型 |
| 240 | * @return 子通道列表 | 219 | * @return 子通道列表 |
| 241 | */ | 220 | */ |
| 242 | - @ApiOperation("分页查询子目录通道") | ||
| 243 | - @ApiImplicitParams({ | ||
| 244 | - @ApiImplicitParam(name="deviceId", value = "设备id", required = true, dataTypeClass = String.class), | ||
| 245 | - @ApiImplicitParam(name="channelId", value = "通道id", required = true, dataTypeClass = String.class), | ||
| 246 | - @ApiImplicitParam(name="page", value = "当前页", required = true, dataTypeClass = Integer.class), | ||
| 247 | - @ApiImplicitParam(name="count", value = "每页条数", required = true, dataTypeClass = Integer.class), | ||
| 248 | - @ApiImplicitParam(name="query", value = "查询内容", dataTypeClass = String.class), | ||
| 249 | - @ApiImplicitParam(name="online", value = "是否在线", dataTypeClass = Boolean.class), | ||
| 250 | - @ApiImplicitParam(name="channelType", value = "通道类型, 子目录", dataTypeClass = Boolean.class), | ||
| 251 | - }) | 221 | + @Operation(summary = "分页查询子目录通道") |
| 222 | + @Parameter(name = "deviceId", description = "设备国标编号", required = true) | ||
| 223 | + @Parameter(name = "channelId", description = "通道国标编号", required = true) | ||
| 224 | + @Parameter(name = "page", description = "当前页", required = true) | ||
| 225 | + @Parameter(name = "count", description = "每页查询数量", required = true) | ||
| 226 | + @Parameter(name = "query", description = "查询内容") | ||
| 227 | + @Parameter(name = "online", description = "是否在线") | ||
| 228 | + @Parameter(name = "channelType", description = "设备/子目录-> false/true") | ||
| 252 | @GetMapping("/sub_channels/{deviceId}/{channelId}/channels") | 229 | @GetMapping("/sub_channels/{deviceId}/{channelId}/channels") |
| 253 | public ResponseEntity<PageInfo> subChannels(@PathVariable String deviceId, | 230 | public ResponseEntity<PageInfo> subChannels(@PathVariable String deviceId, |
| 254 | @PathVariable String channelId, | 231 | @PathVariable String channelId, |
| @@ -258,9 +235,6 @@ public class DeviceQuery { | @@ -258,9 +235,6 @@ public class DeviceQuery { | ||
| 258 | @RequestParam(required = false) Boolean online, | 235 | @RequestParam(required = false) Boolean online, |
| 259 | @RequestParam(required = false) Boolean channelType){ | 236 | @RequestParam(required = false) Boolean channelType){ |
| 260 | 237 | ||
| 261 | -// if (logger.isDebugEnabled()) { | ||
| 262 | -// logger.debug("查询所有视频通道API调用"); | ||
| 263 | -// } | ||
| 264 | DeviceChannel deviceChannel = storager.queryChannel(deviceId,channelId); | 238 | DeviceChannel deviceChannel = storager.queryChannel(deviceId,channelId); |
| 265 | if (deviceChannel == null) { | 239 | if (deviceChannel == null) { |
| 266 | PageInfo<DeviceChannel> deviceChannelPageResult = new PageInfo<>(); | 240 | PageInfo<DeviceChannel> deviceChannelPageResult = new PageInfo<>(); |
| @@ -277,13 +251,11 @@ public class DeviceQuery { | @@ -277,13 +251,11 @@ public class DeviceQuery { | ||
| 277 | * @param channel 通道 | 251 | * @param channel 通道 |
| 278 | * @return | 252 | * @return |
| 279 | */ | 253 | */ |
| 280 | - @ApiOperation("更新通道信息") | ||
| 281 | - @ApiImplicitParams({ | ||
| 282 | - @ApiImplicitParam(name="deviceId", value = "设备id", required = true, dataTypeClass = String.class), | ||
| 283 | - @ApiImplicitParam(name="channel", value = "通道", required = true, dataTypeClass = String.class), | ||
| 284 | - }) | 254 | + @Operation(summary = "更新通道信息") |
| 255 | + @Parameter(name = "deviceId", description = "设备国标编号", required = true) | ||
| 256 | + @Parameter(name = "channel", description = "通道信息", required = true) | ||
| 285 | @PostMapping("/channel/update/{deviceId}") | 257 | @PostMapping("/channel/update/{deviceId}") |
| 286 | - public ResponseEntity<PageInfo> updateChannel(@PathVariable String deviceId,DeviceChannel channel){ | 258 | + public ResponseEntity updateChannel(@PathVariable String deviceId,DeviceChannel channel){ |
| 287 | deviceChannelService.updateChannel(deviceId, channel); | 259 | deviceChannelService.updateChannel(deviceId, channel); |
| 288 | return new ResponseEntity<>(null,HttpStatus.OK); | 260 | return new ResponseEntity<>(null,HttpStatus.OK); |
| 289 | } | 261 | } |
| @@ -294,17 +266,14 @@ public class DeviceQuery { | @@ -294,17 +266,14 @@ public class DeviceQuery { | ||
| 294 | * @param streamMode 数据流传输模式 | 266 | * @param streamMode 数据流传输模式 |
| 295 | * @return | 267 | * @return |
| 296 | */ | 268 | */ |
| 297 | - @ApiOperation("修改数据流传输模式") | ||
| 298 | - @ApiImplicitParams({ | ||
| 299 | - @ApiImplicitParam(name = "deviceId", value = "设备id", required = true, dataTypeClass = String.class), | ||
| 300 | - @ApiImplicitParam(name = "streamMode", value = "数据流传输模式, 取值:" + | ||
| 301 | - "UDP(udp传输),TCP-ACTIVE(tcp主动模式,暂不支持),TCP-PASSIVE(tcp被动模式)", dataTypeClass = String.class), | ||
| 302 | - }) | 269 | + @Operation(summary = "修改数据流传输模式") |
| 270 | + @Parameter(name = "deviceId", description = "设备国标编号", required = true) | ||
| 271 | + @Parameter(name = "streamMode", description = "数据流传输模式, 取值:" + | ||
| 272 | + "UDP(udp传输),TCP-ACTIVE(tcp主动模式,暂不支持),TCP-PASSIVE(tcp被动模式)", required = true) | ||
| 303 | @PostMapping("/transport/{deviceId}/{streamMode}") | 273 | @PostMapping("/transport/{deviceId}/{streamMode}") |
| 304 | - public ResponseEntity<PageInfo> updateTransport(@PathVariable String deviceId, @PathVariable String streamMode){ | 274 | + public ResponseEntity updateTransport(@PathVariable String deviceId, @PathVariable String streamMode){ |
| 305 | Device device = storager.queryVideoDevice(deviceId); | 275 | Device device = storager.queryVideoDevice(deviceId); |
| 306 | device.setStreamMode(streamMode); | 276 | device.setStreamMode(streamMode); |
| 307 | -// storager.updateDevice(device); | ||
| 308 | deviceService.updateDevice(device); | 277 | deviceService.updateDevice(device); |
| 309 | return new ResponseEntity<>(null,HttpStatus.OK); | 278 | return new ResponseEntity<>(null,HttpStatus.OK); |
| 310 | } | 279 | } |
| @@ -314,10 +283,8 @@ public class DeviceQuery { | @@ -314,10 +283,8 @@ public class DeviceQuery { | ||
| 314 | * @param device 设备信息 | 283 | * @param device 设备信息 |
| 315 | * @return | 284 | * @return |
| 316 | */ | 285 | */ |
| 317 | - @ApiOperation("更新设备信息") | ||
| 318 | - @ApiImplicitParams({ | ||
| 319 | - @ApiImplicitParam(name = "device", value = "设备信息", required = true, dataTypeClass = Device.class) | ||
| 320 | - }) | 286 | + @Operation(summary = "更新设备信息") |
| 287 | + @Parameter(name = "device", description = "设备", required = true) | ||
| 321 | @PostMapping("/device/update/") | 288 | @PostMapping("/device/update/") |
| 322 | public ResponseEntity<WVPResult<String>> updateDevice(Device device){ | 289 | public ResponseEntity<WVPResult<String>> updateDevice(Device device){ |
| 323 | 290 | ||
| @@ -335,10 +302,8 @@ public class DeviceQuery { | @@ -335,10 +302,8 @@ public class DeviceQuery { | ||
| 335 | * | 302 | * |
| 336 | * @param deviceId 设备id | 303 | * @param deviceId 设备id |
| 337 | */ | 304 | */ |
| 338 | - @ApiOperation("设备状态查询") | ||
| 339 | - @ApiImplicitParams({ | ||
| 340 | - @ApiImplicitParam(name = "deviceId", value = "设备id", required = true, dataTypeClass = String.class), | ||
| 341 | - }) | 305 | + @Operation(summary = "设备状态查询") |
| 306 | + @Parameter(name = "deviceId", description = "设备国标编号", required = true) | ||
| 342 | @GetMapping("/devices/{deviceId}/status") | 307 | @GetMapping("/devices/{deviceId}/status") |
| 343 | public DeferredResult<ResponseEntity<String>> deviceStatusApi(@PathVariable String deviceId) { | 308 | public DeferredResult<ResponseEntity<String>> deviceStatusApi(@PathVariable String deviceId) { |
| 344 | if (logger.isDebugEnabled()) { | 309 | if (logger.isDebugEnabled()) { |
| @@ -383,16 +348,14 @@ public class DeviceQuery { | @@ -383,16 +348,14 @@ public class DeviceQuery { | ||
| 383 | * @param endTime 报警发生终止时间(可选) | 348 | * @param endTime 报警发生终止时间(可选) |
| 384 | * @return true = 命令发送成功 | 349 | * @return true = 命令发送成功 |
| 385 | */ | 350 | */ |
| 386 | - @ApiOperation("设备报警查询") | ||
| 387 | - @ApiImplicitParams({ | ||
| 388 | - @ApiImplicitParam(name = "deviceId", value = "设备id", required = true, dataTypeClass = String.class), | ||
| 389 | - @ApiImplicitParam(name = "startPriority", value = "报警起始级别", dataTypeClass = String.class), | ||
| 390 | - @ApiImplicitParam(name = "endPriority", value = "报警终止级别", dataTypeClass = String.class), | ||
| 391 | - @ApiImplicitParam(name = "alarmMethod", value = "报警方式条件", dataTypeClass = String.class), | ||
| 392 | - @ApiImplicitParam(name = "alarmType", value = "报警类型", dataTypeClass = String.class), | ||
| 393 | - @ApiImplicitParam(name = "startTime", value = "报警发生起始时间", dataTypeClass = String.class), | ||
| 394 | - @ApiImplicitParam(name = "endTime", value = "报警发生终止时间", dataTypeClass = String.class), | ||
| 395 | - }) | 351 | + @Operation(summary = "设备状态查询") |
| 352 | + @Parameter(name = "deviceId", description = "设备国标编号", required = true) | ||
| 353 | + @Parameter(name = "startPriority", description = "报警起始级别") | ||
| 354 | + @Parameter(name = "endPriority", description = "报警终止级别") | ||
| 355 | + @Parameter(name = "alarmMethod", description = "报警方式条件") | ||
| 356 | + @Parameter(name = "alarmType", description = "报警类型") | ||
| 357 | + @Parameter(name = "startTime", description = "报警发生起始时间") | ||
| 358 | + @Parameter(name = "endTime", description = "报警发生终止时间") | ||
| 396 | @GetMapping("/alarm/{deviceId}") | 359 | @GetMapping("/alarm/{deviceId}") |
| 397 | public DeferredResult<ResponseEntity<String>> alarmApi(@PathVariable String deviceId, | 360 | public DeferredResult<ResponseEntity<String>> alarmApi(@PathVariable String deviceId, |
| 398 | @RequestParam(required = false) String startPriority, | 361 | @RequestParam(required = false) String startPriority, |
| @@ -430,7 +393,8 @@ public class DeviceQuery { | @@ -430,7 +393,8 @@ public class DeviceQuery { | ||
| 430 | 393 | ||
| 431 | 394 | ||
| 432 | @GetMapping("/{deviceId}/sync_status") | 395 | @GetMapping("/{deviceId}/sync_status") |
| 433 | - @ApiOperation(value = "获取通道同步进度", notes = "获取通道同步进度") | 396 | + @Operation(summary = "获取通道同步进度") |
| 397 | + @Parameter(name = "deviceId", description = "设备国标编号", required = true) | ||
| 434 | public WVPResult<SyncStatus> getSyncStatus(@PathVariable String deviceId) { | 398 | public WVPResult<SyncStatus> getSyncStatus(@PathVariable String deviceId) { |
| 435 | SyncStatus channelSyncStatus = deviceService.getChannelSyncStatus(deviceId); | 399 | SyncStatus channelSyncStatus = deviceService.getChannelSyncStatus(deviceId); |
| 436 | WVPResult<SyncStatus> wvpResult = new WVPResult<>(); | 400 | WVPResult<SyncStatus> wvpResult = new WVPResult<>(); |
| @@ -448,7 +412,8 @@ public class DeviceQuery { | @@ -448,7 +412,8 @@ public class DeviceQuery { | ||
| 448 | } | 412 | } |
| 449 | 413 | ||
| 450 | @GetMapping("/{deviceId}/subscribe_info") | 414 | @GetMapping("/{deviceId}/subscribe_info") |
| 451 | - @ApiOperation(value = "获取设备的订阅状态", notes = "获取设备的订阅状态") | 415 | + @Operation(summary = "获取设备的订阅状态") |
| 416 | + @Parameter(name = "deviceId", description = "设备国标编号", required = true) | ||
| 452 | public WVPResult<Map<String, String>> getSubscribeInfo(@PathVariable String deviceId) { | 417 | public WVPResult<Map<String, String>> getSubscribeInfo(@PathVariable String deviceId) { |
| 453 | Set<String> allKeys = dynamicTask.getAllKeys(); | 418 | Set<String> allKeys = dynamicTask.getAllKeys(); |
| 454 | Map<String, String> dialogStateMap = new HashMap<>(); | 419 | Map<String, String> dialogStateMap = new HashMap<>(); |
| @@ -473,7 +438,9 @@ public class DeviceQuery { | @@ -473,7 +438,9 @@ public class DeviceQuery { | ||
| 473 | } | 438 | } |
| 474 | 439 | ||
| 475 | @GetMapping("/snap/{deviceId}/{channelId}") | 440 | @GetMapping("/snap/{deviceId}/{channelId}") |
| 476 | - @ApiOperation(value = "请求截图", notes = "请求截图") | 441 | + @Operation(summary = "请求截图") |
| 442 | + @Parameter(name = "deviceId", description = "设备国标编号", required = true) | ||
| 443 | + @Parameter(name = "channelId", description = "通道国标编号", required = true) | ||
| 477 | public void getSnap(HttpServletResponse resp, @PathVariable String deviceId, @PathVariable String channelId) { | 444 | public void getSnap(HttpServletResponse resp, @PathVariable String deviceId, @PathVariable String channelId) { |
| 478 | 445 | ||
| 479 | try { | 446 | try { |
| @@ -493,16 +460,17 @@ public class DeviceQuery { | @@ -493,16 +460,17 @@ public class DeviceQuery { | ||
| 493 | * @param count 每页条数 | 460 | * @param count 每页条数 |
| 494 | * @return 国标设备 | 461 | * @return 国标设备 |
| 495 | */ | 462 | */ |
| 496 | - @ApiOperation("查询国标树") | ||
| 497 | - @ApiImplicitParams({ | ||
| 498 | - @ApiImplicitParam(name = "deviceId", value = "设备ID", required = true, dataTypeClass = String.class), | ||
| 499 | - @ApiImplicitParam(name = "parentId", value = "父ID", required = false, dataTypeClass = String.class), | ||
| 500 | - @ApiImplicitParam(name = "onlyCatalog", value = "只获取目录", required = false, dataTypeClass = Boolean.class), | ||
| 501 | - @ApiImplicitParam(name="page", value = "当前页", required = true, dataTypeClass = Integer.class), | ||
| 502 | - @ApiImplicitParam(name="count", value = "每页条数", required = true, dataTypeClass = Integer.class), | ||
| 503 | - }) | 463 | + @Operation(summary = "查询国标树") |
| 464 | + @Parameter(name = "deviceId", description = "设备国标编号", required = true) | ||
| 465 | + @Parameter(name = "parentId", description = "父级国标编号") | ||
| 466 | + @Parameter(name = "onlyCatalog", description = "只获取目录") | ||
| 467 | + @Parameter(name = "page", description = "当前页", required = true) | ||
| 468 | + @Parameter(name = "count", description = "每页条数", required = true) | ||
| 504 | @GetMapping("/tree/{deviceId}") | 469 | @GetMapping("/tree/{deviceId}") |
| 505 | - public ResponseEntity<PageInfo> getTree(@PathVariable String deviceId, @RequestParam(required = false) String parentId, @RequestParam(required = false) Boolean onlyCatalog, int page, int count){ | 470 | + public ResponseEntity<PageInfo> getTree(@PathVariable String deviceId, |
| 471 | + @RequestParam(required = false) String parentId, | ||
| 472 | + @RequestParam(required = false) Boolean onlyCatalog, | ||
| 473 | + int page, int count){ | ||
| 506 | 474 | ||
| 507 | 475 | ||
| 508 | if (page <= 0) { | 476 | if (page <= 0) { |
| @@ -543,13 +511,11 @@ public class DeviceQuery { | @@ -543,13 +511,11 @@ public class DeviceQuery { | ||
| 543 | * @param count 每页条数 | 511 | * @param count 每页条数 |
| 544 | * @return 国标设备 | 512 | * @return 国标设备 |
| 545 | */ | 513 | */ |
| 546 | - @ApiOperation("查询国标树下的通道") | ||
| 547 | - @ApiImplicitParams({ | ||
| 548 | - @ApiImplicitParam(name = "deviceId", value = "设备ID", required = true, dataTypeClass = String.class), | ||
| 549 | - @ApiImplicitParam(name = "parentId", value = "父ID", required = false, dataTypeClass = String.class), | ||
| 550 | - @ApiImplicitParam(name="page", value = "当前页", required = true, dataTypeClass = Integer.class), | ||
| 551 | - @ApiImplicitParam(name="count", value = "每页条数", required = true, dataTypeClass = Integer.class), | ||
| 552 | - }) | 514 | + @Operation(summary = "查询国标树下的通道") |
| 515 | + @Parameter(name = "deviceId", description = "设备国标编号", required = true) | ||
| 516 | + @Parameter(name = "parentId", description = "父级国标编号") | ||
| 517 | + @Parameter(name = "page", description = "当前页", required = true) | ||
| 518 | + @Parameter(name = "count", description = "每页条数", required = true) | ||
| 553 | @GetMapping("/tree/channel/{deviceId}") | 519 | @GetMapping("/tree/channel/{deviceId}") |
| 554 | public ResponseEntity<PageInfo> getChannelInTreeNode(@PathVariable String deviceId, @RequestParam(required = false) String parentId, int page, int count){ | 520 | public ResponseEntity<PageInfo> getChannelInTreeNode(@PathVariable String deviceId, @RequestParam(required = false) String parentId, int page, int count){ |
| 555 | 521 |
src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/gbStream/GbStreamController.java
| @@ -5,17 +5,16 @@ import com.genersoft.iot.vmp.storager.IVideoManagerStorage; | @@ -5,17 +5,16 @@ import com.genersoft.iot.vmp.storager.IVideoManagerStorage; | ||
| 5 | import com.genersoft.iot.vmp.vmanager.gb28181.gbStream.bean.GbStreamParam; | 5 | import com.genersoft.iot.vmp.vmanager.gb28181.gbStream.bean.GbStreamParam; |
| 6 | import com.genersoft.iot.vmp.service.IGbStreamService; | 6 | import com.genersoft.iot.vmp.service.IGbStreamService; |
| 7 | import com.github.pagehelper.PageInfo; | 7 | import com.github.pagehelper.PageInfo; |
| 8 | -import io.swagger.annotations.Api; | ||
| 9 | -import io.swagger.annotations.ApiImplicitParam; | ||
| 10 | -import io.swagger.annotations.ApiImplicitParams; | ||
| 11 | -import io.swagger.annotations.ApiOperation; | 8 | +import io.swagger.v3.oas.annotations.Operation; |
| 9 | +import io.swagger.v3.oas.annotations.Parameter; | ||
| 10 | +import io.swagger.v3.oas.annotations.tags.Tag; | ||
| 12 | import org.slf4j.Logger; | 11 | import org.slf4j.Logger; |
| 13 | import org.slf4j.LoggerFactory; | 12 | import org.slf4j.LoggerFactory; |
| 14 | import org.springframework.beans.factory.annotation.Autowired; | 13 | import org.springframework.beans.factory.annotation.Autowired; |
| 15 | import org.springframework.util.StringUtils; | 14 | import org.springframework.util.StringUtils; |
| 16 | import org.springframework.web.bind.annotation.*; | 15 | import org.springframework.web.bind.annotation.*; |
| 17 | 16 | ||
| 18 | -@Api(tags = "视频流关联到级联平台") | 17 | +@Tag(name = "视频流关联到级联平台") |
| 19 | @CrossOrigin | 18 | @CrossOrigin |
| 20 | @RestController | 19 | @RestController |
| 21 | @RequestMapping("/api/gbStream") | 20 | @RequestMapping("/api/gbStream") |
| @@ -37,16 +36,13 @@ public class GbStreamController { | @@ -37,16 +36,13 @@ public class GbStreamController { | ||
| 37 | * @param platformId 平台ID | 36 | * @param platformId 平台ID |
| 38 | * @return | 37 | * @return |
| 39 | */ | 38 | */ |
| 40 | - @ApiOperation("查询国标通道") | ||
| 41 | - @ApiImplicitParams({ | ||
| 42 | - @ApiImplicitParam(name = "page", value = "当前页", required = true , dataTypeClass = Integer.class), | ||
| 43 | - @ApiImplicitParam(name = "count", value = "每页条数", required = true , dataTypeClass = Integer.class), | ||
| 44 | - @ApiImplicitParam(name = "platformId", value = "平台ID", required = true , dataTypeClass = String.class), | ||
| 45 | - @ApiImplicitParam(name = "catalogId", value = "目录ID", required = false , dataTypeClass = String.class), | ||
| 46 | - @ApiImplicitParam(name="query", value = "查询内容", required = false , dataTypeClass = String.class), | ||
| 47 | - @ApiImplicitParam(name="mediaServerId", value = "流媒体ID", required = false , dataTypeClass = String.class), | ||
| 48 | - | ||
| 49 | - }) | 39 | + @Operation(summary = "查询国标通道") |
| 40 | + @Parameter(name = "page", description = "当前页", required = true) | ||
| 41 | + @Parameter(name = "count", description = "每页条数", required = true) | ||
| 42 | + @Parameter(name = "platformId", description = "平台ID", required = true) | ||
| 43 | + @Parameter(name = "catalogId", description = "目录ID") | ||
| 44 | + @Parameter(name = "query", description = "查询内容") | ||
| 45 | + @Parameter(name = "mediaServerId", description = "流媒体ID") | ||
| 50 | @GetMapping(value = "/list") | 46 | @GetMapping(value = "/list") |
| 51 | @ResponseBody | 47 | @ResponseBody |
| 52 | public PageInfo<GbStream> list(@RequestParam(required = true)Integer page, | 48 | public PageInfo<GbStream> list(@RequestParam(required = true)Integer page, |
| @@ -76,11 +72,7 @@ public class GbStreamController { | @@ -76,11 +72,7 @@ public class GbStreamController { | ||
| 76 | * @param gbStreamParam | 72 | * @param gbStreamParam |
| 77 | * @return | 73 | * @return |
| 78 | */ | 74 | */ |
| 79 | - @ApiOperation("移除国标关联") | ||
| 80 | - @ApiImplicitParams({ | ||
| 81 | - @ApiImplicitParam(name = "gbStreamParam", value = "GbStreamParam", required = true, | ||
| 82 | - dataTypeClass = GbStreamParam.class), | ||
| 83 | - }) | 75 | + @Operation(summary = "移除国标关联") |
| 84 | @DeleteMapping(value = "/del") | 76 | @DeleteMapping(value = "/del") |
| 85 | @ResponseBody | 77 | @ResponseBody |
| 86 | public Object del(@RequestBody GbStreamParam gbStreamParam){ | 78 | public Object del(@RequestBody GbStreamParam gbStreamParam){ |
| @@ -97,10 +89,7 @@ public class GbStreamController { | @@ -97,10 +89,7 @@ public class GbStreamController { | ||
| 97 | * @param gbStreamParam | 89 | * @param gbStreamParam |
| 98 | * @return | 90 | * @return |
| 99 | */ | 91 | */ |
| 100 | - @ApiOperation("保存国标关联") | ||
| 101 | - @ApiImplicitParams({ | ||
| 102 | - @ApiImplicitParam(name = "gbStreamParam", value = "GbStreamParam", required = true, dataTypeClass = GbStreamParam.class), | ||
| 103 | - }) | 92 | + @Operation(summary = "保存国标关联") |
| 104 | @PostMapping(value = "/add") | 93 | @PostMapping(value = "/add") |
| 105 | @ResponseBody | 94 | @ResponseBody |
| 106 | public Object add(@RequestBody GbStreamParam gbStreamParam){ | 95 | public Object add(@RequestBody GbStreamParam gbStreamParam){ |
src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/gbStream/bean/GbStreamParam.java
| 1 | package com.genersoft.iot.vmp.vmanager.gb28181.gbStream.bean; | 1 | package com.genersoft.iot.vmp.vmanager.gb28181.gbStream.bean; |
| 2 | 2 | ||
| 3 | import com.genersoft.iot.vmp.gb28181.bean.GbStream; | 3 | import com.genersoft.iot.vmp.gb28181.bean.GbStream; |
| 4 | +import io.swagger.v3.oas.annotations.media.Schema; | ||
| 4 | 5 | ||
| 5 | import java.util.List; | 6 | import java.util.List; |
| 6 | 7 | ||
| 8 | +@Schema(description = "国标关联参数") | ||
| 7 | public class GbStreamParam { | 9 | public class GbStreamParam { |
| 8 | 10 | ||
| 11 | + @Schema(description = "平台ID") | ||
| 9 | private String platformId; | 12 | private String platformId; |
| 10 | 13 | ||
| 14 | + @Schema(description = "目录ID") | ||
| 11 | private String catalogId; | 15 | private String catalogId; |
| 12 | 16 | ||
| 17 | + @Schema(description = "流国标信息列表") | ||
| 13 | private List<GbStream> gbStreams; | 18 | private List<GbStream> gbStreams; |
| 14 | 19 | ||
| 15 | public String getPlatformId() { | 20 | public String getPlatformId() { |
src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/media/MediaController.java
| @@ -3,19 +3,14 @@ package com.genersoft.iot.vmp.vmanager.gb28181.media; | @@ -3,19 +3,14 @@ package com.genersoft.iot.vmp.vmanager.gb28181.media; | ||
| 3 | import com.genersoft.iot.vmp.common.StreamInfo; | 3 | import com.genersoft.iot.vmp.common.StreamInfo; |
| 4 | import com.genersoft.iot.vmp.conf.security.SecurityUtils; | 4 | import com.genersoft.iot.vmp.conf.security.SecurityUtils; |
| 5 | import com.genersoft.iot.vmp.conf.security.dto.LoginUser; | 5 | import com.genersoft.iot.vmp.conf.security.dto.LoginUser; |
| 6 | -import com.genersoft.iot.vmp.media.zlm.dto.OnPublishHookParam; | ||
| 7 | import com.genersoft.iot.vmp.media.zlm.dto.StreamAuthorityInfo; | 6 | import com.genersoft.iot.vmp.media.zlm.dto.StreamAuthorityInfo; |
| 8 | -import com.genersoft.iot.vmp.service.IMediaServerService; | ||
| 9 | import com.genersoft.iot.vmp.service.IStreamProxyService; | 7 | import com.genersoft.iot.vmp.service.IStreamProxyService; |
| 10 | -import com.genersoft.iot.vmp.service.IStreamPushService; | ||
| 11 | import com.genersoft.iot.vmp.service.IMediaService; | 8 | import com.genersoft.iot.vmp.service.IMediaService; |
| 12 | import com.genersoft.iot.vmp.storager.IRedisCatchStorage; | 9 | import com.genersoft.iot.vmp.storager.IRedisCatchStorage; |
| 13 | -import com.genersoft.iot.vmp.storager.IVideoManagerStorage; | ||
| 14 | import com.genersoft.iot.vmp.vmanager.bean.WVPResult; | 10 | import com.genersoft.iot.vmp.vmanager.bean.WVPResult; |
| 15 | -import io.swagger.annotations.Api; | ||
| 16 | -import io.swagger.annotations.ApiImplicitParam; | ||
| 17 | -import io.swagger.annotations.ApiImplicitParams; | ||
| 18 | -import io.swagger.annotations.ApiOperation; | 11 | +import io.swagger.v3.oas.annotations.Operation; |
| 12 | +import io.swagger.v3.oas.annotations.Parameter; | ||
| 13 | +import io.swagger.v3.oas.annotations.tags.Tag; | ||
| 19 | import org.slf4j.Logger; | 14 | import org.slf4j.Logger; |
| 20 | import org.slf4j.LoggerFactory; | 15 | import org.slf4j.LoggerFactory; |
| 21 | import org.springframework.beans.factory.annotation.Autowired; | 16 | import org.springframework.beans.factory.annotation.Autowired; |
| @@ -25,7 +20,7 @@ import org.springframework.web.bind.annotation.*; | @@ -25,7 +20,7 @@ import org.springframework.web.bind.annotation.*; | ||
| 25 | import javax.servlet.http.HttpServletRequest; | 20 | import javax.servlet.http.HttpServletRequest; |
| 26 | 21 | ||
| 27 | 22 | ||
| 28 | -@Api(tags = "媒体流相关") | 23 | +@Tag(name = "媒体流相关") |
| 29 | @Controller | 24 | @Controller |
| 30 | @CrossOrigin | 25 | @CrossOrigin |
| 31 | @RequestMapping(value = "/api/media") | 26 | @RequestMapping(value = "/api/media") |
| @@ -48,12 +43,12 @@ public class MediaController { | @@ -48,12 +43,12 @@ public class MediaController { | ||
| 48 | * @param stream 流id | 43 | * @param stream 流id |
| 49 | * @return | 44 | * @return |
| 50 | */ | 45 | */ |
| 51 | - @ApiOperation("根据应用名和流id获取播放地址") | ||
| 52 | - @ApiImplicitParams({ | ||
| 53 | - @ApiImplicitParam(name = "app", value = "应用名", dataTypeClass = String.class), | ||
| 54 | - @ApiImplicitParam(name = "stream", value = "流id", dataTypeClass = String.class), | ||
| 55 | - @ApiImplicitParam(name = "mediaServerId", value = "媒体服务器id", dataTypeClass = String.class, required = false), | ||
| 56 | - }) | 46 | + @Operation(summary = "根据应用名和流id获取播放地址") |
| 47 | + @Parameter(name = "app", description = "应用名", required = true) | ||
| 48 | + @Parameter(name = "stream", description = "流id", required = true) | ||
| 49 | + @Parameter(name = "mediaServerId", description = "媒体服务器id") | ||
| 50 | + @Parameter(name = "callId", description = "推流时携带的自定义鉴权ID") | ||
| 51 | + @Parameter(name = "useSourceIpAsStreamIp", description = "是否使用请求IP作为返回的地址IP") | ||
| 57 | @GetMapping(value = "/stream_info_by_app_and_stream") | 52 | @GetMapping(value = "/stream_info_by_app_and_stream") |
| 58 | @ResponseBody | 53 | @ResponseBody |
| 59 | public WVPResult<StreamInfo> getStreamInfoByAppAndStream(HttpServletRequest request, @RequestParam String app, | 54 | public WVPResult<StreamInfo> getStreamInfoByAppAndStream(HttpServletRequest request, @RequestParam String app, |
src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/platform/PlatformController.java
| @@ -18,10 +18,9 @@ import com.genersoft.iot.vmp.vmanager.bean.WVPResult; | @@ -18,10 +18,9 @@ import com.genersoft.iot.vmp.vmanager.bean.WVPResult; | ||
| 18 | import com.genersoft.iot.vmp.vmanager.gb28181.platform.bean.ChannelReduce; | 18 | import com.genersoft.iot.vmp.vmanager.gb28181.platform.bean.ChannelReduce; |
| 19 | import com.genersoft.iot.vmp.vmanager.gb28181.platform.bean.UpdateChannelParam; | 19 | import com.genersoft.iot.vmp.vmanager.gb28181.platform.bean.UpdateChannelParam; |
| 20 | import com.github.pagehelper.PageInfo; | 20 | import com.github.pagehelper.PageInfo; |
| 21 | -import io.swagger.annotations.Api; | ||
| 22 | -import io.swagger.annotations.ApiImplicitParam; | ||
| 23 | -import io.swagger.annotations.ApiImplicitParams; | ||
| 24 | -import io.swagger.annotations.ApiOperation; | 21 | +import io.swagger.v3.oas.annotations.Operation; |
| 22 | +import io.swagger.v3.oas.annotations.Parameter; | ||
| 23 | +import io.swagger.v3.oas.annotations.tags.Tag; | ||
| 25 | import org.slf4j.Logger; | 24 | import org.slf4j.Logger; |
| 26 | import org.slf4j.LoggerFactory; | 25 | import org.slf4j.LoggerFactory; |
| 27 | import org.springframework.beans.factory.annotation.Autowired; | 26 | import org.springframework.beans.factory.annotation.Autowired; |
| @@ -36,7 +35,7 @@ import java.util.List; | @@ -36,7 +35,7 @@ import java.util.List; | ||
| 36 | /** | 35 | /** |
| 37 | * 级联平台管理 | 36 | * 级联平台管理 |
| 38 | */ | 37 | */ |
| 39 | -@Api(tags = "级联平台管理") | 38 | +@Tag(name = "级联平台管理") |
| 40 | @CrossOrigin | 39 | @CrossOrigin |
| 41 | @RestController | 40 | @RestController |
| 42 | @RequestMapping("/api/platform") | 41 | @RequestMapping("/api/platform") |
| @@ -73,7 +72,7 @@ public class PlatformController { | @@ -73,7 +72,7 @@ public class PlatformController { | ||
| 73 | * | 72 | * |
| 74 | * @return | 73 | * @return |
| 75 | */ | 74 | */ |
| 76 | - @ApiOperation("获取国标服务的配置") | 75 | + @Operation(summary = "获取国标服务的配置") |
| 77 | @GetMapping("/server_config") | 76 | @GetMapping("/server_config") |
| 78 | public ResponseEntity<JSONObject> serverConfig() { | 77 | public ResponseEntity<JSONObject> serverConfig() { |
| 79 | JSONObject result = new JSONObject(); | 78 | JSONObject result = new JSONObject(); |
| @@ -89,7 +88,8 @@ public class PlatformController { | @@ -89,7 +88,8 @@ public class PlatformController { | ||
| 89 | * | 88 | * |
| 90 | * @return | 89 | * @return |
| 91 | */ | 90 | */ |
| 92 | - @ApiOperation("获取国标服务的配置") | 91 | + @Operation(summary = "获取级联服务器信息") |
| 92 | + @Parameter(name = "id", description = "平台国标编号", required = true) | ||
| 93 | @GetMapping("/info/{id}") | 93 | @GetMapping("/info/{id}") |
| 94 | public ResponseEntity<WVPResult<ParentPlatform>> getPlatform(@PathVariable String id) { | 94 | public ResponseEntity<WVPResult<ParentPlatform>> getPlatform(@PathVariable String id) { |
| 95 | ParentPlatform parentPlatform = storager.queryParentPlatByServerGBId(id); | 95 | ParentPlatform parentPlatform = storager.queryParentPlatByServerGBId(id); |
| @@ -112,12 +112,10 @@ public class PlatformController { | @@ -112,12 +112,10 @@ public class PlatformController { | ||
| 112 | * @param count 每页条数 | 112 | * @param count 每页条数 |
| 113 | * @return | 113 | * @return |
| 114 | */ | 114 | */ |
| 115 | - @ApiOperation("分页查询级联平台") | ||
| 116 | @GetMapping("/query/{count}/{page}") | 115 | @GetMapping("/query/{count}/{page}") |
| 117 | - @ApiImplicitParams({ | ||
| 118 | - @ApiImplicitParam(name = "page", value = "当前页", dataTypeClass = Integer.class), | ||
| 119 | - @ApiImplicitParam(name = "count", value = "每页条数", dataTypeClass = Integer.class), | ||
| 120 | - }) | 116 | + @Operation(summary = "分页查询级联平台") |
| 117 | + @Parameter(name = "page", description = "当前页", required = true) | ||
| 118 | + @Parameter(name = "count", description = "每页条数", required = true) | ||
| 121 | public PageInfo<ParentPlatform> platforms(@PathVariable int page, @PathVariable int count) { | 119 | public PageInfo<ParentPlatform> platforms(@PathVariable int page, @PathVariable int count) { |
| 122 | 120 | ||
| 123 | PageInfo<ParentPlatform> parentPlatformPageInfo = storager.queryParentPlatformList(page, count); | 121 | PageInfo<ParentPlatform> parentPlatformPageInfo = storager.queryParentPlatformList(page, count); |
| @@ -136,10 +134,7 @@ public class PlatformController { | @@ -136,10 +134,7 @@ public class PlatformController { | ||
| 136 | * @param parentPlatform | 134 | * @param parentPlatform |
| 137 | * @return | 135 | * @return |
| 138 | */ | 136 | */ |
| 139 | - @ApiOperation("添加上级平台信息") | ||
| 140 | - @ApiImplicitParams({ | ||
| 141 | - @ApiImplicitParam(name = "parentPlatform", value = "上级平台信息", dataTypeClass = ParentPlatform.class), | ||
| 142 | - }) | 137 | + @Operation(summary = "添加上级平台信息") |
| 143 | @PostMapping("/add") | 138 | @PostMapping("/add") |
| 144 | @ResponseBody | 139 | @ResponseBody |
| 145 | public ResponseEntity<WVPResult<String>> addPlatform(@RequestBody ParentPlatform parentPlatform) { | 140 | public ResponseEntity<WVPResult<String>> addPlatform(@RequestBody ParentPlatform parentPlatform) { |
| @@ -211,10 +206,7 @@ public class PlatformController { | @@ -211,10 +206,7 @@ public class PlatformController { | ||
| 211 | * @param parentPlatform | 206 | * @param parentPlatform |
| 212 | * @return | 207 | * @return |
| 213 | */ | 208 | */ |
| 214 | - @ApiOperation("保存上级平台信息") | ||
| 215 | - @ApiImplicitParams({ | ||
| 216 | - @ApiImplicitParam(name = "parentPlatform", value = "上级平台信息", dataTypeClass = ParentPlatform.class), | ||
| 217 | - }) | 209 | + @Operation(summary = "保存上级平台信息") |
| 218 | @PostMapping("/save") | 210 | @PostMapping("/save") |
| 219 | @ResponseBody | 211 | @ResponseBody |
| 220 | public ResponseEntity<WVPResult<String>> savePlatform(@RequestBody ParentPlatform parentPlatform) { | 212 | public ResponseEntity<WVPResult<String>> savePlatform(@RequestBody ParentPlatform parentPlatform) { |
| @@ -286,10 +278,8 @@ public class PlatformController { | @@ -286,10 +278,8 @@ public class PlatformController { | ||
| 286 | * @param serverGBId 上级平台国标ID | 278 | * @param serverGBId 上级平台国标ID |
| 287 | * @return | 279 | * @return |
| 288 | */ | 280 | */ |
| 289 | - @ApiOperation("删除上级平台") | ||
| 290 | - @ApiImplicitParams({ | ||
| 291 | - @ApiImplicitParam(name = "serverGBId", value = "上级平台国标ID", dataTypeClass = String.class), | ||
| 292 | - }) | 281 | + @Operation(summary = "删除上级平台") |
| 282 | + @Parameter(name = "serverGBId", description = "上级平台的国标编号") | ||
| 293 | @DeleteMapping("/delete/{serverGBId}") | 283 | @DeleteMapping("/delete/{serverGBId}") |
| 294 | @ResponseBody | 284 | @ResponseBody |
| 295 | public ResponseEntity<String> deletePlatform(@PathVariable String serverGBId) { | 285 | public ResponseEntity<String> deletePlatform(@PathVariable String serverGBId) { |
| @@ -339,17 +329,12 @@ public class PlatformController { | @@ -339,17 +329,12 @@ public class PlatformController { | ||
| 339 | * @param serverGBId 上级平台国标ID | 329 | * @param serverGBId 上级平台国标ID |
| 340 | * @return | 330 | * @return |
| 341 | */ | 331 | */ |
| 342 | - @ApiOperation("查询上级平台是否存在") | ||
| 343 | - @ApiImplicitParams({ | ||
| 344 | - @ApiImplicitParam(name = "serverGBId", value = "上级平台国标ID", dataTypeClass = String.class), | ||
| 345 | - }) | 332 | + @Operation(summary = "查询上级平台是否存在") |
| 333 | + @Parameter(name = "serverGBId", description = "上级平台的国标编号") | ||
| 346 | @GetMapping("/exit/{serverGBId}") | 334 | @GetMapping("/exit/{serverGBId}") |
| 347 | @ResponseBody | 335 | @ResponseBody |
| 348 | public ResponseEntity<String> exitPlatform(@PathVariable String serverGBId) { | 336 | public ResponseEntity<String> exitPlatform(@PathVariable String serverGBId) { |
| 349 | 337 | ||
| 350 | -// if (logger.isDebugEnabled()) { | ||
| 351 | -// logger.debug("查询上级平台是否存在API调用:" + serverGBId); | ||
| 352 | -// } | ||
| 353 | ParentPlatform parentPlatform = storager.queryParentPlatByServerGBId(serverGBId); | 338 | ParentPlatform parentPlatform = storager.queryParentPlatByServerGBId(serverGBId); |
| 354 | return new ResponseEntity<>(String.valueOf(parentPlatform != null), HttpStatus.OK); | 339 | return new ResponseEntity<>(String.valueOf(parentPlatform != null), HttpStatus.OK); |
| 355 | } | 340 | } |
| @@ -365,16 +350,14 @@ public class PlatformController { | @@ -365,16 +350,14 @@ public class PlatformController { | ||
| 365 | * @param channelType 通道类型 | 350 | * @param channelType 通道类型 |
| 366 | * @return | 351 | * @return |
| 367 | */ | 352 | */ |
| 368 | - @ApiOperation("分页查询级联平台的所有所有通道") | ||
| 369 | - @ApiImplicitParams({ | ||
| 370 | - @ApiImplicitParam(name = "page", value = "当前页", dataTypeClass = Integer.class), | ||
| 371 | - @ApiImplicitParam(name = "count", value = "每页条数", dataTypeClass = Integer.class), | ||
| 372 | - @ApiImplicitParam(name = "platformId", value = "上级平台ID", dataTypeClass = String.class), | ||
| 373 | - @ApiImplicitParam(name = "catalogId", value = "目录ID", dataTypeClass = String.class), | ||
| 374 | - @ApiImplicitParam(name = "query", value = "查询内容", dataTypeClass = String.class), | ||
| 375 | - @ApiImplicitParam(name = "online", value = "是否在线", dataTypeClass = Boolean.class), | ||
| 376 | - @ApiImplicitParam(name = "channelType", value = "通道类型", dataTypeClass = Boolean.class), | ||
| 377 | - }) | 353 | + @Operation(summary = "查询上级平台是否存在") |
| 354 | + @Parameter(name = "page", description = "当前页", required = true) | ||
| 355 | + @Parameter(name = "count", description = "每页条数", required = true) | ||
| 356 | + @Parameter(name = "platformId", description = "上级平台的国标编号") | ||
| 357 | + @Parameter(name = "catalogId", description = "目录ID") | ||
| 358 | + @Parameter(name = "query", description = "查询内容") | ||
| 359 | + @Parameter(name = "online", description = "是否在线") | ||
| 360 | + @Parameter(name = "channelType", description = "通道类型") | ||
| 378 | @GetMapping("/channel_list") | 361 | @GetMapping("/channel_list") |
| 379 | @ResponseBody | 362 | @ResponseBody |
| 380 | public PageInfo<ChannelReduce> channelList(int page, int count, | 363 | public PageInfo<ChannelReduce> channelList(int page, int count, |
| @@ -384,9 +367,6 @@ public class PlatformController { | @@ -384,9 +367,6 @@ public class PlatformController { | ||
| 384 | @RequestParam(required = false) Boolean online, | 367 | @RequestParam(required = false) Boolean online, |
| 385 | @RequestParam(required = false) Boolean channelType) { | 368 | @RequestParam(required = false) Boolean channelType) { |
| 386 | 369 | ||
| 387 | -// if (logger.isDebugEnabled()) { | ||
| 388 | -// logger.debug("查询所有所有通道API调用"); | ||
| 389 | -// } | ||
| 390 | if (StringUtils.isEmpty(platformId)) { | 370 | if (StringUtils.isEmpty(platformId)) { |
| 391 | platformId = null; | 371 | platformId = null; |
| 392 | } | 372 | } |
| @@ -407,10 +387,7 @@ public class PlatformController { | @@ -407,10 +387,7 @@ public class PlatformController { | ||
| 407 | * @param param 通道关联参数 | 387 | * @param param 通道关联参数 |
| 408 | * @return | 388 | * @return |
| 409 | */ | 389 | */ |
| 410 | - @ApiOperation("向上级平台添加国标通道") | ||
| 411 | - @ApiImplicitParams({ | ||
| 412 | - @ApiImplicitParam(name = "param", value = "通道关联参数", dataTypeClass = UpdateChannelParam.class), | ||
| 413 | - }) | 390 | + @Operation(summary = "向上级平台添加国标通道") |
| 414 | @PostMapping("/update_channel_for_gb") | 391 | @PostMapping("/update_channel_for_gb") |
| 415 | @ResponseBody | 392 | @ResponseBody |
| 416 | public ResponseEntity<String> updateChannelForGB(@RequestBody UpdateChannelParam param) { | 393 | public ResponseEntity<String> updateChannelForGB(@RequestBody UpdateChannelParam param) { |
| @@ -429,10 +406,7 @@ public class PlatformController { | @@ -429,10 +406,7 @@ public class PlatformController { | ||
| 429 | * @param param 通道关联参数 | 406 | * @param param 通道关联参数 |
| 430 | * @return | 407 | * @return |
| 431 | */ | 408 | */ |
| 432 | - @ApiOperation("从上级平台移除国标通道") | ||
| 433 | - @ApiImplicitParams({ | ||
| 434 | - @ApiImplicitParam(name = "param", value = "通道关联参数", dataTypeClass = UpdateChannelParam.class), | ||
| 435 | - }) | 409 | + @Operation(summary = "从上级平台移除国标通道") |
| 436 | @DeleteMapping("/del_channel_for_gb") | 410 | @DeleteMapping("/del_channel_for_gb") |
| 437 | @ResponseBody | 411 | @ResponseBody |
| 438 | public ResponseEntity<String> delChannelForGB(@RequestBody UpdateChannelParam param) { | 412 | public ResponseEntity<String> delChannelForGB(@RequestBody UpdateChannelParam param) { |
| @@ -452,11 +426,9 @@ public class PlatformController { | @@ -452,11 +426,9 @@ public class PlatformController { | ||
| 452 | * @param parentId 目录父ID | 426 | * @param parentId 目录父ID |
| 453 | * @return | 427 | * @return |
| 454 | */ | 428 | */ |
| 455 | - @ApiOperation("获取目录") | ||
| 456 | - @ApiImplicitParams({ | ||
| 457 | - @ApiImplicitParam(name = "platformId", value = "平台ID", dataTypeClass = String.class, required = true), | ||
| 458 | - @ApiImplicitParam(name = "parentId", value = "目录父ID", dataTypeClass = String.class, required = true), | ||
| 459 | - }) | 429 | + @Operation(summary = "获取目录") |
| 430 | + @Parameter(name = "platformId", description = "上级平台的国标编号", required = true) | ||
| 431 | + @Parameter(name = "parentId", description = "父级目录的国标编号", required = true) | ||
| 460 | @GetMapping("/catalog") | 432 | @GetMapping("/catalog") |
| 461 | @ResponseBody | 433 | @ResponseBody |
| 462 | public ResponseEntity<WVPResult<List<PlatformCatalog>>> getCatalogByPlatform(String platformId, String parentId) { | 434 | public ResponseEntity<WVPResult<List<PlatformCatalog>>> getCatalogByPlatform(String platformId, String parentId) { |
| @@ -472,11 +444,6 @@ public class PlatformController { | @@ -472,11 +444,6 @@ public class PlatformController { | ||
| 472 | parentId = platform.getDeviceGBId(); | 444 | parentId = platform.getDeviceGBId(); |
| 473 | } | 445 | } |
| 474 | List<PlatformCatalog> platformCatalogList = storager.getChildrenCatalogByPlatform(platformId, parentId); | 446 | List<PlatformCatalog> platformCatalogList = storager.getChildrenCatalogByPlatform(platformId, parentId); |
| 475 | -// if (platform.getTreeType().equals(TreeType.BUSINESS_GROUP)) { | ||
| 476 | -// platformCatalogList = storager.getChildrenCatalogByPlatform(platformId, parentId); | ||
| 477 | -// }else { | ||
| 478 | -// | ||
| 479 | -// } | ||
| 480 | 447 | ||
| 481 | WVPResult<List<PlatformCatalog>> result = new WVPResult<>(); | 448 | WVPResult<List<PlatformCatalog>> result = new WVPResult<>(); |
| 482 | result.setCode(0); | 449 | result.setCode(0); |
| @@ -491,10 +458,7 @@ public class PlatformController { | @@ -491,10 +458,7 @@ public class PlatformController { | ||
| 491 | * @param platformCatalog 目录 | 458 | * @param platformCatalog 目录 |
| 492 | * @return | 459 | * @return |
| 493 | */ | 460 | */ |
| 494 | - @ApiOperation("添加目录") | ||
| 495 | - @ApiImplicitParams({ | ||
| 496 | - @ApiImplicitParam(name = "platformCatalog", value = "目录信息", dataTypeClass = PlatformCatalog.class, required = true), | ||
| 497 | - }) | 461 | + @Operation(summary = "添加目录") |
| 498 | @PostMapping("/catalog/add") | 462 | @PostMapping("/catalog/add") |
| 499 | @ResponseBody | 463 | @ResponseBody |
| 500 | public ResponseEntity<WVPResult<List<PlatformCatalog>>> addCatalog(@RequestBody PlatformCatalog platformCatalog) { | 464 | public ResponseEntity<WVPResult<List<PlatformCatalog>>> addCatalog(@RequestBody PlatformCatalog platformCatalog) { |
| @@ -528,10 +492,7 @@ public class PlatformController { | @@ -528,10 +492,7 @@ public class PlatformController { | ||
| 528 | * @param platformCatalog 目录 | 492 | * @param platformCatalog 目录 |
| 529 | * @return | 493 | * @return |
| 530 | */ | 494 | */ |
| 531 | - @ApiOperation("编辑目录") | ||
| 532 | - @ApiImplicitParams({ | ||
| 533 | - @ApiImplicitParam(name = "platformCatalog", value = "目录信息", dataTypeClass = PlatformCatalog.class, required = true), | ||
| 534 | - }) | 495 | + @Operation(summary = "编辑目录") |
| 535 | @PostMapping("/catalog/edit") | 496 | @PostMapping("/catalog/edit") |
| 536 | @ResponseBody | 497 | @ResponseBody |
| 537 | public ResponseEntity<WVPResult<List<PlatformCatalog>>> editCatalog(@RequestBody PlatformCatalog platformCatalog) { | 498 | public ResponseEntity<WVPResult<List<PlatformCatalog>>> editCatalog(@RequestBody PlatformCatalog platformCatalog) { |
| @@ -561,12 +522,12 @@ public class PlatformController { | @@ -561,12 +522,12 @@ public class PlatformController { | ||
| 561 | * 删除目录 | 522 | * 删除目录 |
| 562 | * | 523 | * |
| 563 | * @param id 目录Id | 524 | * @param id 目录Id |
| 525 | + * @param platformId 平台Id | ||
| 564 | * @return | 526 | * @return |
| 565 | */ | 527 | */ |
| 566 | - @ApiOperation("删除目录") | ||
| 567 | - @ApiImplicitParams({ | ||
| 568 | - @ApiImplicitParam(name = "id", value = "目录Id", dataTypeClass = String.class, required = true), | ||
| 569 | - }) | 528 | + @Operation(summary = "删除目录") |
| 529 | + @Parameter(name = "id", description = "目录Id", required = true) | ||
| 530 | + @Parameter(name = "platformId", description = "平台Id", required = true) | ||
| 570 | @DeleteMapping("/catalog/del") | 531 | @DeleteMapping("/catalog/del") |
| 571 | @ResponseBody | 532 | @ResponseBody |
| 572 | public ResponseEntity<WVPResult<String>> delCatalog(String id, String platformId) { | 533 | public ResponseEntity<WVPResult<String>> delCatalog(String id, String platformId) { |
| @@ -609,10 +570,7 @@ public class PlatformController { | @@ -609,10 +570,7 @@ public class PlatformController { | ||
| 609 | * @param platformCatalog 关联的信息 | 570 | * @param platformCatalog 关联的信息 |
| 610 | * @return | 571 | * @return |
| 611 | */ | 572 | */ |
| 612 | - @ApiOperation("删除关联") | ||
| 613 | - @ApiImplicitParams({ | ||
| 614 | - @ApiImplicitParam(name = "platformCatalog", value = "关联的信息", dataTypeClass = PlatformCatalog.class, required = true), | ||
| 615 | - }) | 573 | + @Operation(summary = "删除关联") |
| 616 | @DeleteMapping("/catalog/relation/del") | 574 | @DeleteMapping("/catalog/relation/del") |
| 617 | @ResponseBody | 575 | @ResponseBody |
| 618 | public ResponseEntity<WVPResult<List<PlatformCatalog>>> delRelation(@RequestBody PlatformCatalog platformCatalog) { | 576 | public ResponseEntity<WVPResult<List<PlatformCatalog>>> delRelation(@RequestBody PlatformCatalog platformCatalog) { |
| @@ -641,11 +599,9 @@ public class PlatformController { | @@ -641,11 +599,9 @@ public class PlatformController { | ||
| 641 | * @param catalogId 目录Id | 599 | * @param catalogId 目录Id |
| 642 | * @return | 600 | * @return |
| 643 | */ | 601 | */ |
| 644 | - @ApiOperation("修改默认目录") | ||
| 645 | - @ApiImplicitParams({ | ||
| 646 | - @ApiImplicitParam(name = "platformId", value = "平台Id", dataTypeClass = String.class, required = true), | ||
| 647 | - @ApiImplicitParam(name = "catalogId", value = "目录Id", dataTypeClass = String.class, required = true), | ||
| 648 | - }) | 602 | + @Operation(summary = "修改默认目录") |
| 603 | + @Parameter(name = "catalogId", description = "目录Id", required = true) | ||
| 604 | + @Parameter(name = "platformId", description = "平台Id", required = true) | ||
| 649 | @PostMapping("/catalog/default/update") | 605 | @PostMapping("/catalog/default/update") |
| 650 | @ResponseBody | 606 | @ResponseBody |
| 651 | public ResponseEntity<WVPResult<String>> setDefaultCatalog(String platformId, String catalogId) { | 607 | public ResponseEntity<WVPResult<String>> setDefaultCatalog(String platformId, String catalogId) { |
src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/platform/bean/ChannelReduce.java
| 1 | package com.genersoft.iot.vmp.vmanager.gb28181.platform.bean; | 1 | package com.genersoft.iot.vmp.vmanager.gb28181.platform.bean; |
| 2 | 2 | ||
| 3 | import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel; | 3 | import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel; |
| 4 | +import io.swagger.v3.oas.annotations.media.Schema; | ||
| 4 | 5 | ||
| 5 | /** | 6 | /** |
| 6 | * 精简的channel信息展示,主要是选择通道的时候展示列表使用 | 7 | * 精简的channel信息展示,主要是选择通道的时候展示列表使用 |
| 7 | */ | 8 | */ |
| 9 | +@Schema(description = "精简的channel信息展示") | ||
| 8 | public class ChannelReduce { | 10 | public class ChannelReduce { |
| 9 | 11 | ||
| 10 | /** | 12 | /** |
| 11 | * deviceChannel的数据库自增ID | 13 | * deviceChannel的数据库自增ID |
| 12 | */ | 14 | */ |
| 15 | + @Schema(description = "deviceChannel的数据库自增ID") | ||
| 13 | private int id; | 16 | private int id; |
| 14 | 17 | ||
| 15 | /** | 18 | /** |
| 16 | * 通道id | 19 | * 通道id |
| 17 | */ | 20 | */ |
| 21 | + @Schema(description = "通道国标编号") | ||
| 18 | private String channelId; | 22 | private String channelId; |
| 19 | 23 | ||
| 20 | /** | 24 | /** |
| 21 | * 设备id | 25 | * 设备id |
| 22 | */ | 26 | */ |
| 27 | + @Schema(description = "设备国标编号") | ||
| 23 | private String deviceId; | 28 | private String deviceId; |
| 24 | 29 | ||
| 25 | /** | 30 | /** |
| 26 | * 通道名 | 31 | * 通道名 |
| 27 | */ | 32 | */ |
| 33 | + @Schema(description = "通道名") | ||
| 28 | private String name; | 34 | private String name; |
| 29 | 35 | ||
| 30 | /** | 36 | /** |
| 31 | * 生产厂商 | 37 | * 生产厂商 |
| 32 | */ | 38 | */ |
| 39 | + @Schema(description = "生产厂商") | ||
| 33 | private String manufacturer; | 40 | private String manufacturer; |
| 34 | 41 | ||
| 35 | /** | 42 | /** |
| 36 | * wan地址 | 43 | * wan地址 |
| 37 | */ | 44 | */ |
| 45 | + @Schema(description = "wan地址") | ||
| 38 | private String hostAddress; | 46 | private String hostAddress; |
| 39 | 47 | ||
| 40 | /** | 48 | /** |
| 41 | * 子节点数 | 49 | * 子节点数 |
| 42 | */ | 50 | */ |
| 51 | + @Schema(description = "子节点数") | ||
| 43 | private int subCount; | 52 | private int subCount; |
| 44 | 53 | ||
| 45 | /** | 54 | /** |
| 46 | * 平台Id | 55 | * 平台Id |
| 47 | */ | 56 | */ |
| 57 | + @Schema(description = "平台上级国标编号") | ||
| 48 | private String platformId; | 58 | private String platformId; |
| 49 | 59 | ||
| 50 | /** | 60 | /** |
| 51 | * 目录Id | 61 | * 目录Id |
| 52 | */ | 62 | */ |
| 63 | + @Schema(description = "目录国标编号") | ||
| 53 | private String catalogId; | 64 | private String catalogId; |
| 54 | 65 | ||
| 55 | public int getId() { | 66 | public int getId() { |
src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/platform/bean/UpdateChannelParam.java
| 1 | package com.genersoft.iot.vmp.vmanager.gb28181.platform.bean; | 1 | package com.genersoft.iot.vmp.vmanager.gb28181.platform.bean; |
| 2 | 2 | ||
| 3 | +import io.swagger.v3.oas.annotations.media.Schema; | ||
| 4 | + | ||
| 3 | import java.util.List; | 5 | import java.util.List; |
| 4 | 6 | ||
| 7 | +/** | ||
| 8 | + * 通道关联参数 | ||
| 9 | + * @author lin | ||
| 10 | + */ | ||
| 11 | +@Schema(description = "通道关联参数") | ||
| 5 | public class UpdateChannelParam { | 12 | public class UpdateChannelParam { |
| 13 | + | ||
| 14 | + @Schema(description = "上级平台的国标编号") | ||
| 6 | private String platformId; | 15 | private String platformId; |
| 16 | + | ||
| 17 | + @Schema(description = "目录的国标编号") | ||
| 7 | private String catalogId; | 18 | private String catalogId; |
| 19 | + | ||
| 20 | + @Schema(description = "") | ||
| 8 | private List<ChannelReduce> channelReduces; | 21 | private List<ChannelReduce> channelReduces; |
| 9 | 22 | ||
| 10 | public String getPlatformId() { | 23 | public String getPlatformId() { |
src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/play/PlayController.java
| @@ -15,10 +15,10 @@ import com.genersoft.iot.vmp.vmanager.bean.WVPResult; | @@ -15,10 +15,10 @@ import com.genersoft.iot.vmp.vmanager.bean.WVPResult; | ||
| 15 | import com.genersoft.iot.vmp.vmanager.gb28181.play.bean.PlayResult; | 15 | import com.genersoft.iot.vmp.vmanager.gb28181.play.bean.PlayResult; |
| 16 | import com.genersoft.iot.vmp.service.IMediaService; | 16 | import com.genersoft.iot.vmp.service.IMediaService; |
| 17 | import com.genersoft.iot.vmp.service.IPlayService; | 17 | import com.genersoft.iot.vmp.service.IPlayService; |
| 18 | -import io.swagger.annotations.Api; | ||
| 19 | -import io.swagger.annotations.ApiImplicitParam; | ||
| 20 | -import io.swagger.annotations.ApiImplicitParams; | ||
| 21 | -import io.swagger.annotations.ApiOperation; | 18 | + |
| 19 | +import io.swagger.v3.oas.annotations.Operation; | ||
| 20 | +import io.swagger.v3.oas.annotations.Parameter; | ||
| 21 | +import io.swagger.v3.oas.annotations.tags.Tag; | ||
| 22 | import org.slf4j.Logger; | 22 | import org.slf4j.Logger; |
| 23 | import org.slf4j.LoggerFactory; | 23 | import org.slf4j.LoggerFactory; |
| 24 | import org.springframework.beans.factory.annotation.Autowired; | 24 | import org.springframework.beans.factory.annotation.Autowired; |
| @@ -39,7 +39,7 @@ import org.springframework.web.context.request.async.DeferredResult; | @@ -39,7 +39,7 @@ import org.springframework.web.context.request.async.DeferredResult; | ||
| 39 | import java.util.List; | 39 | import java.util.List; |
| 40 | import java.util.UUID; | 40 | import java.util.UUID; |
| 41 | 41 | ||
| 42 | -@Api(tags = "国标设备点播") | 42 | +@Tag(name = "国标设备点播") |
| 43 | @CrossOrigin | 43 | @CrossOrigin |
| 44 | @RestController | 44 | @RestController |
| 45 | @RequestMapping("/api/play") | 45 | @RequestMapping("/api/play") |
| @@ -74,11 +74,9 @@ public class PlayController { | @@ -74,11 +74,9 @@ public class PlayController { | ||
| 74 | @Autowired | 74 | @Autowired |
| 75 | private IMediaServerService mediaServerService; | 75 | private IMediaServerService mediaServerService; |
| 76 | 76 | ||
| 77 | - @ApiOperation("开始点播") | ||
| 78 | - @ApiImplicitParams({ | ||
| 79 | - @ApiImplicitParam(name = "deviceId", value = "设备ID", dataTypeClass = String.class), | ||
| 80 | - @ApiImplicitParam(name = "channelId", value = "通道ID", dataTypeClass = String.class), | ||
| 81 | - }) | 77 | + @Operation(summary = "开始点播") |
| 78 | + @Parameter(name = "deviceId", description = "设备国标编号", required = true) | ||
| 79 | + @Parameter(name = "channelId", description = "通道国标编号", required = true) | ||
| 82 | @GetMapping("/start/{deviceId}/{channelId}") | 80 | @GetMapping("/start/{deviceId}/{channelId}") |
| 83 | public DeferredResult<ResponseEntity<String>> play(@PathVariable String deviceId, | 81 | public DeferredResult<ResponseEntity<String>> play(@PathVariable String deviceId, |
| 84 | @PathVariable String channelId) { | 82 | @PathVariable String channelId) { |
| @@ -91,11 +89,10 @@ public class PlayController { | @@ -91,11 +89,10 @@ public class PlayController { | ||
| 91 | return playResult.getResult(); | 89 | return playResult.getResult(); |
| 92 | } | 90 | } |
| 93 | 91 | ||
| 94 | - @ApiOperation("停止点播") | ||
| 95 | - @ApiImplicitParams({ | ||
| 96 | - @ApiImplicitParam(name = "deviceId", value = "设备ID", dataTypeClass = String.class), | ||
| 97 | - @ApiImplicitParam(name = "channelId", value = "通道ID", dataTypeClass = String.class), | ||
| 98 | - }) | 92 | + |
| 93 | + @Operation(summary = "停止点播") | ||
| 94 | + @Parameter(name = "deviceId", description = "设备国标编号", required = true) | ||
| 95 | + @Parameter(name = "channelId", description = "通道国标编号", required = true) | ||
| 99 | @GetMapping("/stop/{deviceId}/{channelId}") | 96 | @GetMapping("/stop/{deviceId}/{channelId}") |
| 100 | public DeferredResult<ResponseEntity<String>> playStop(@PathVariable String deviceId, @PathVariable String channelId) { | 97 | public DeferredResult<ResponseEntity<String>> playStop(@PathVariable String deviceId, @PathVariable String channelId) { |
| 101 | 98 | ||
| @@ -164,10 +161,8 @@ public class PlayController { | @@ -164,10 +161,8 @@ public class PlayController { | ||
| 164 | * @param streamId 流ID | 161 | * @param streamId 流ID |
| 165 | * @return | 162 | * @return |
| 166 | */ | 163 | */ |
| 167 | - @ApiOperation("将不是h264的视频通过ffmpeg 转码为h264 + aac") | ||
| 168 | - @ApiImplicitParams({ | ||
| 169 | - @ApiImplicitParam(name = "streamId", value = "视频流ID", dataTypeClass = String.class), | ||
| 170 | - }) | 164 | + @Operation(summary = "将不是h264的视频通过ffmpeg 转码为h264 + aac") |
| 165 | + @Parameter(name = "streamId", description = "视频流ID", required = true) | ||
| 171 | @PostMapping("/convert/{streamId}") | 166 | @PostMapping("/convert/{streamId}") |
| 172 | public ResponseEntity<String> playConvert(@PathVariable String streamId) { | 167 | public ResponseEntity<String> playConvert(@PathVariable String streamId) { |
| 173 | StreamInfo streamInfo = redisCatchStorage.queryPlayByStreamId(streamId); | 168 | StreamInfo streamInfo = redisCatchStorage.queryPlayByStreamId(streamId); |
| @@ -211,10 +206,9 @@ public class PlayController { | @@ -211,10 +206,9 @@ public class PlayController { | ||
| 211 | * @param key | 206 | * @param key |
| 212 | * @return | 207 | * @return |
| 213 | */ | 208 | */ |
| 214 | - @ApiOperation("结束转码") | ||
| 215 | - @ApiImplicitParams({ | ||
| 216 | - @ApiImplicitParam(name = "key", value = "视频流key", dataTypeClass = String.class), | ||
| 217 | - }) | 209 | + @Operation(summary = "结束转码") |
| 210 | + @Parameter(name = "key", description = "视频流key", required = true) | ||
| 211 | + @Parameter(name = "mediaServerId", description = "流媒体服务ID", required = true) | ||
| 218 | @PostMapping("/convertStop/{key}") | 212 | @PostMapping("/convertStop/{key}") |
| 219 | public ResponseEntity<String> playConvertStop(@PathVariable String key, String mediaServerId) { | 213 | public ResponseEntity<String> playConvertStop(@PathVariable String key, String mediaServerId) { |
| 220 | JSONObject result = new JSONObject(); | 214 | JSONObject result = new JSONObject(); |
| @@ -250,10 +244,8 @@ public class PlayController { | @@ -250,10 +244,8 @@ public class PlayController { | ||
| 250 | 244 | ||
| 251 | } | 245 | } |
| 252 | 246 | ||
| 253 | - @ApiOperation("语音广播命令") | ||
| 254 | - @ApiImplicitParams({ | ||
| 255 | - @ApiImplicitParam(name = "deviceId", value = "设备Id", dataTypeClass = String.class), | ||
| 256 | - }) | 247 | + @Operation(summary = "语音广播命令") |
| 248 | + @Parameter(name = "deviceId", description = "设备国标编号", required = true) | ||
| 257 | @GetMapping("/broadcast/{deviceId}") | 249 | @GetMapping("/broadcast/{deviceId}") |
| 258 | @PostMapping("/broadcast/{deviceId}") | 250 | @PostMapping("/broadcast/{deviceId}") |
| 259 | public DeferredResult<ResponseEntity<String>> broadcastApi(@PathVariable String deviceId) { | 251 | public DeferredResult<ResponseEntity<String>> broadcastApi(@PathVariable String deviceId) { |
| @@ -313,7 +305,7 @@ public class PlayController { | @@ -313,7 +305,7 @@ public class PlayController { | ||
| 313 | return result; | 305 | return result; |
| 314 | } | 306 | } |
| 315 | 307 | ||
| 316 | - @ApiOperation("获取所有的ssrc") | 308 | + @Operation(summary = "获取所有的ssrc") |
| 317 | @GetMapping("/ssrc") | 309 | @GetMapping("/ssrc") |
| 318 | public WVPResult<JSONObject> getSSRC() { | 310 | public WVPResult<JSONObject> getSSRC() { |
| 319 | if (logger.isDebugEnabled()) { | 311 | if (logger.isDebugEnabled()) { |
src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/playback/PlaybackController.java
| @@ -2,14 +2,12 @@ package com.genersoft.iot.vmp.vmanager.gb28181.playback; | @@ -2,14 +2,12 @@ package com.genersoft.iot.vmp.vmanager.gb28181.playback; | ||
| 2 | 2 | ||
| 3 | import com.genersoft.iot.vmp.common.StreamInfo; | 3 | import com.genersoft.iot.vmp.common.StreamInfo; |
| 4 | import com.genersoft.iot.vmp.gb28181.transmit.callback.DeferredResultHolder; | 4 | import com.genersoft.iot.vmp.gb28181.transmit.callback.DeferredResultHolder; |
| 5 | -//import com.genersoft.iot.vmp.media.zlm.ZLMRESTfulUtils; | ||
| 6 | import com.genersoft.iot.vmp.service.IMediaServerService; | 5 | import com.genersoft.iot.vmp.service.IMediaServerService; |
| 7 | import com.genersoft.iot.vmp.storager.IRedisCatchStorage; | 6 | import com.genersoft.iot.vmp.storager.IRedisCatchStorage; |
| 8 | import com.genersoft.iot.vmp.service.IPlayService; | 7 | import com.genersoft.iot.vmp.service.IPlayService; |
| 9 | -import io.swagger.annotations.Api; | ||
| 10 | -import io.swagger.annotations.ApiImplicitParam; | ||
| 11 | -import io.swagger.annotations.ApiImplicitParams; | ||
| 12 | -import io.swagger.annotations.ApiOperation; | 8 | +import io.swagger.v3.oas.annotations.Operation; |
| 9 | +import io.swagger.v3.oas.annotations.Parameter; | ||
| 10 | +import io.swagger.v3.oas.annotations.tags.Tag; | ||
| 13 | import org.slf4j.Logger; | 11 | import org.slf4j.Logger; |
| 14 | import org.slf4j.LoggerFactory; | 12 | import org.slf4j.LoggerFactory; |
| 15 | import org.springframework.beans.factory.annotation.Autowired; | 13 | import org.springframework.beans.factory.annotation.Autowired; |
| @@ -28,7 +26,7 @@ import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommander; | @@ -28,7 +26,7 @@ import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommander; | ||
| 28 | import com.genersoft.iot.vmp.storager.IVideoManagerStorage; | 26 | import com.genersoft.iot.vmp.storager.IVideoManagerStorage; |
| 29 | import org.springframework.web.context.request.async.DeferredResult; | 27 | import org.springframework.web.context.request.async.DeferredResult; |
| 30 | 28 | ||
| 31 | -@Api(tags = "视频回放") | 29 | +@Tag(name = "视频回放") |
| 32 | @CrossOrigin | 30 | @CrossOrigin |
| 33 | @RestController | 31 | @RestController |
| 34 | @RequestMapping("/api/playback") | 32 | @RequestMapping("/api/playback") |
| @@ -45,25 +43,17 @@ public class PlaybackController { | @@ -45,25 +43,17 @@ public class PlaybackController { | ||
| 45 | @Autowired | 43 | @Autowired |
| 46 | private IRedisCatchStorage redisCatchStorage; | 44 | private IRedisCatchStorage redisCatchStorage; |
| 47 | 45 | ||
| 48 | - // @Autowired | ||
| 49 | - // private ZLMRESTfulUtils zlmresTfulUtils; | ||
| 50 | - | ||
| 51 | @Autowired | 46 | @Autowired |
| 52 | private IPlayService playService; | 47 | private IPlayService playService; |
| 53 | 48 | ||
| 54 | @Autowired | 49 | @Autowired |
| 55 | private DeferredResultHolder resultHolder; | 50 | private DeferredResultHolder resultHolder; |
| 56 | 51 | ||
| 57 | - @Autowired | ||
| 58 | - private IMediaServerService mediaServerService; | ||
| 59 | - | ||
| 60 | - @ApiOperation("开始视频回放") | ||
| 61 | - @ApiImplicitParams({ | ||
| 62 | - @ApiImplicitParam(name = "deviceId", value = "设备ID", dataTypeClass = String.class), | ||
| 63 | - @ApiImplicitParam(name = "channelId", value = "通道ID", dataTypeClass = String.class), | ||
| 64 | - @ApiImplicitParam(name = "startTime", value = "开始时间", dataTypeClass = String.class), | ||
| 65 | - @ApiImplicitParam(name = "endTime", value = "结束时间", dataTypeClass = String.class), | ||
| 66 | - }) | 52 | + @Operation(summary = "开始视频回放") |
| 53 | + @Parameter(name = "deviceId", description = "设备国标编号", required = true) | ||
| 54 | + @Parameter(name = "channelId", description = "通道国标编号", required = true) | ||
| 55 | + @Parameter(name = "startTime", description = "开始时间", required = true) | ||
| 56 | + @Parameter(name = "endTime", description = "结束时间", required = true) | ||
| 67 | @GetMapping("/start/{deviceId}/{channelId}") | 57 | @GetMapping("/start/{deviceId}/{channelId}") |
| 68 | public DeferredResult<ResponseEntity<String>> play(@PathVariable String deviceId, @PathVariable String channelId, | 58 | public DeferredResult<ResponseEntity<String>> play(@PathVariable String deviceId, @PathVariable String channelId, |
| 69 | String startTime,String endTime) { | 59 | String startTime,String endTime) { |
| @@ -79,12 +69,11 @@ public class PlaybackController { | @@ -79,12 +69,11 @@ public class PlaybackController { | ||
| 79 | return result; | 69 | return result; |
| 80 | } | 70 | } |
| 81 | 71 | ||
| 82 | - @ApiOperation("停止视频回放") | ||
| 83 | - @ApiImplicitParams({ | ||
| 84 | - @ApiImplicitParam(name = "deviceId", value = "设备ID", dataTypeClass = String.class), | ||
| 85 | - @ApiImplicitParam(name = "channelId", value = "通道ID", dataTypeClass = String.class), | ||
| 86 | - @ApiImplicitParam(name = "stream", value = "流ID", dataTypeClass = String.class), | ||
| 87 | - }) | 72 | + |
| 73 | + @Operation(summary = "停止视频回放") | ||
| 74 | + @Parameter(name = "deviceId", description = "设备国标编号", required = true) | ||
| 75 | + @Parameter(name = "channelId", description = "通道国标编号", required = true) | ||
| 76 | + @Parameter(name = "stream", description = "流ID", required = true) | ||
| 88 | @GetMapping("/stop/{deviceId}/{channelId}/{stream}") | 77 | @GetMapping("/stop/{deviceId}/{channelId}/{stream}") |
| 89 | public ResponseEntity<String> playStop( | 78 | public ResponseEntity<String> playStop( |
| 90 | @PathVariable String deviceId, | 79 | @PathVariable String deviceId, |
| @@ -111,10 +100,9 @@ public class PlaybackController { | @@ -111,10 +100,9 @@ public class PlaybackController { | ||
| 111 | } | 100 | } |
| 112 | } | 101 | } |
| 113 | 102 | ||
| 114 | - @ApiOperation("回放暂停") | ||
| 115 | - @ApiImplicitParams({ | ||
| 116 | - @ApiImplicitParam(name = "streamId", value = "回放流ID", dataTypeClass = String.class), | ||
| 117 | - }) | 103 | + |
| 104 | + @Operation(summary = "回放暂停") | ||
| 105 | + @Parameter(name = "streamId", description = "回放流ID", required = true) | ||
| 118 | @GetMapping("/pause/{streamId}") | 106 | @GetMapping("/pause/{streamId}") |
| 119 | public ResponseEntity<String> playPause(@PathVariable String streamId) { | 107 | public ResponseEntity<String> playPause(@PathVariable String streamId) { |
| 120 | logger.info("playPause: "+streamId); | 108 | logger.info("playPause: "+streamId); |
| @@ -131,10 +119,9 @@ public class PlaybackController { | @@ -131,10 +119,9 @@ public class PlaybackController { | ||
| 131 | return new ResponseEntity<String>(json.toString(), HttpStatus.OK); | 119 | return new ResponseEntity<String>(json.toString(), HttpStatus.OK); |
| 132 | } | 120 | } |
| 133 | 121 | ||
| 134 | - @ApiOperation("回放恢复") | ||
| 135 | - @ApiImplicitParams({ | ||
| 136 | - @ApiImplicitParam(name = "streamId", value = "回放流ID", dataTypeClass = String.class), | ||
| 137 | - }) | 122 | + |
| 123 | + @Operation(summary = "回放恢复") | ||
| 124 | + @Parameter(name = "streamId", description = "回放流ID", required = true) | ||
| 138 | @GetMapping("/resume/{streamId}") | 125 | @GetMapping("/resume/{streamId}") |
| 139 | public ResponseEntity<String> playResume(@PathVariable String streamId) { | 126 | public ResponseEntity<String> playResume(@PathVariable String streamId) { |
| 140 | logger.info("playResume: "+streamId); | 127 | logger.info("playResume: "+streamId); |
| @@ -151,11 +138,10 @@ public class PlaybackController { | @@ -151,11 +138,10 @@ public class PlaybackController { | ||
| 151 | return new ResponseEntity<String>(json.toString(), HttpStatus.OK); | 138 | return new ResponseEntity<String>(json.toString(), HttpStatus.OK); |
| 152 | } | 139 | } |
| 153 | 140 | ||
| 154 | - @ApiOperation("回放拖动播放") | ||
| 155 | - @ApiImplicitParams({ | ||
| 156 | - @ApiImplicitParam(name = "streamId", value = "回放流ID", dataTypeClass = String.class), | ||
| 157 | - @ApiImplicitParam(name = "seekTime", value = "拖动偏移量,单位s", dataTypeClass = Long.class), | ||
| 158 | - }) | 141 | + |
| 142 | + @Operation(summary = "回放拖动播放") | ||
| 143 | + @Parameter(name = "streamId", description = "回放流ID", required = true) | ||
| 144 | + @Parameter(name = "seekTime", description = "拖动偏移量,单位s", required = true) | ||
| 159 | @GetMapping("/seek/{streamId}/{seekTime}") | 145 | @GetMapping("/seek/{streamId}/{seekTime}") |
| 160 | public ResponseEntity<String> playSeek(@PathVariable String streamId, @PathVariable long seekTime) { | 146 | public ResponseEntity<String> playSeek(@PathVariable String streamId, @PathVariable long seekTime) { |
| 161 | logger.info("playSeek: "+streamId+", "+seekTime); | 147 | logger.info("playSeek: "+streamId+", "+seekTime); |
| @@ -172,11 +158,9 @@ public class PlaybackController { | @@ -172,11 +158,9 @@ public class PlaybackController { | ||
| 172 | return new ResponseEntity<String>(json.toString(), HttpStatus.OK); | 158 | return new ResponseEntity<String>(json.toString(), HttpStatus.OK); |
| 173 | } | 159 | } |
| 174 | 160 | ||
| 175 | - @ApiOperation("回放倍速播放") | ||
| 176 | - @ApiImplicitParams({ | ||
| 177 | - @ApiImplicitParam(name = "streamId", value = "回放流ID", dataTypeClass = String.class), | ||
| 178 | - @ApiImplicitParam(name = "speed", value = "倍速0.25 0.5 1、2、4", dataTypeClass = Double.class), | ||
| 179 | - }) | 161 | + @Operation(summary = "回放倍速播放") |
| 162 | + @Parameter(name = "streamId", description = "回放流ID", required = true) | ||
| 163 | + @Parameter(name = "speed", description = "倍速0.25 0.5 1、2、4", required = true) | ||
| 180 | @GetMapping("/speed/{streamId}/{speed}") | 164 | @GetMapping("/speed/{streamId}/{speed}") |
| 181 | public ResponseEntity<String> playSpeed(@PathVariable String streamId, @PathVariable Double speed) { | 165 | public ResponseEntity<String> playSpeed(@PathVariable String streamId, @PathVariable Double speed) { |
| 182 | logger.info("playSpeed: "+streamId+", "+speed); | 166 | logger.info("playSpeed: "+streamId+", "+speed); |
src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/ptz/PtzController.java
| 1 | package com.genersoft.iot.vmp.vmanager.gb28181.ptz; | 1 | package com.genersoft.iot.vmp.vmanager.gb28181.ptz; |
| 2 | 2 | ||
| 3 | -import io.swagger.annotations.Api; | ||
| 4 | -import io.swagger.annotations.ApiImplicitParam; | ||
| 5 | -import io.swagger.annotations.ApiImplicitParams; | ||
| 6 | -import io.swagger.annotations.ApiOperation; | 3 | + |
| 4 | +import io.swagger.v3.oas.annotations.Operation; | ||
| 5 | +import io.swagger.v3.oas.annotations.Parameter; | ||
| 6 | +import io.swagger.v3.oas.annotations.tags.Tag; | ||
| 7 | import org.slf4j.Logger; | 7 | import org.slf4j.Logger; |
| 8 | import org.slf4j.LoggerFactory; | 8 | import org.slf4j.LoggerFactory; |
| 9 | import org.springframework.beans.factory.annotation.Autowired; | 9 | import org.springframework.beans.factory.annotation.Autowired; |
| @@ -21,7 +21,7 @@ import com.genersoft.iot.vmp.storager.IVideoManagerStorage; | @@ -21,7 +21,7 @@ import com.genersoft.iot.vmp.storager.IVideoManagerStorage; | ||
| 21 | 21 | ||
| 22 | import java.util.UUID; | 22 | import java.util.UUID; |
| 23 | 23 | ||
| 24 | -@Api(tags = "云台控制") | 24 | +@Tag(name = "云台控制") |
| 25 | @CrossOrigin | 25 | @CrossOrigin |
| 26 | @RestController | 26 | @RestController |
| 27 | @RequestMapping("/api/ptz") | 27 | @RequestMapping("/api/ptz") |
| @@ -48,15 +48,14 @@ public class PtzController { | @@ -48,15 +48,14 @@ public class PtzController { | ||
| 48 | * @param zoomSpeed 缩放速度 | 48 | * @param zoomSpeed 缩放速度 |
| 49 | * @return String 控制结果 | 49 | * @return String 控制结果 |
| 50 | */ | 50 | */ |
| 51 | - @ApiOperation("云台控制") | ||
| 52 | - @ApiImplicitParams({ | ||
| 53 | - @ApiImplicitParam(name = "deviceId", value = "设备ID", dataTypeClass = String.class), | ||
| 54 | - @ApiImplicitParam(name = "channelId", value = "通道ID", dataTypeClass = String.class), | ||
| 55 | - @ApiImplicitParam(name = "command", value = "控制指令,允许值: left, right, up, down, upleft, upright, downleft, downright, zoomin, zoomout, stop", dataTypeClass = String.class), | ||
| 56 | - @ApiImplicitParam(name = "horizonSpeed", value = "水平速度", dataTypeClass = Integer.class), | ||
| 57 | - @ApiImplicitParam(name = "verticalSpeed", value = "垂直速度", dataTypeClass = Integer.class), | ||
| 58 | - @ApiImplicitParam(name = "zoomSpeed", value = "缩放速度", dataTypeClass = Integer.class), | ||
| 59 | - }) | 51 | + |
| 52 | + @Operation(summary = "云台控制") | ||
| 53 | + @Parameter(name = "deviceId", description = "设备国标编号", required = true) | ||
| 54 | + @Parameter(name = "channelId", description = "通道国标编号", required = true) | ||
| 55 | + @Parameter(name = "command", description = "控制指令,允许值: left, right, up, down, upleft, upright, downleft, downright, zoomin, zoomout, stop", required = true) | ||
| 56 | + @Parameter(name = "horizonSpeed", description = "水平速度", required = true) | ||
| 57 | + @Parameter(name = "verticalSpeed", description = "垂直速度", required = true) | ||
| 58 | + @Parameter(name = "zoomSpeed", description = "缩放速度", required = true) | ||
| 60 | @PostMapping("/control/{deviceId}/{channelId}") | 59 | @PostMapping("/control/{deviceId}/{channelId}") |
| 61 | public ResponseEntity<String> ptz(@PathVariable String deviceId,@PathVariable String channelId, String command, int horizonSpeed, int verticalSpeed, int zoomSpeed){ | 60 | public ResponseEntity<String> ptz(@PathVariable String deviceId,@PathVariable String channelId, String command, int horizonSpeed, int verticalSpeed, int zoomSpeed){ |
| 62 | 61 | ||
| @@ -106,15 +105,14 @@ public class PtzController { | @@ -106,15 +105,14 @@ public class PtzController { | ||
| 106 | return new ResponseEntity<String>("success",HttpStatus.OK); | 105 | return new ResponseEntity<String>("success",HttpStatus.OK); |
| 107 | } | 106 | } |
| 108 | 107 | ||
| 109 | - @ApiOperation("通用前端控制命令") | ||
| 110 | - @ApiImplicitParams({ | ||
| 111 | - @ApiImplicitParam(name = "deviceId", value = "设备ID", dataTypeClass = String.class), | ||
| 112 | - @ApiImplicitParam(name = "channelId", value = "通道ID", dataTypeClass = String.class), | ||
| 113 | - @ApiImplicitParam(name = "cmdCode", value = "指令码", dataTypeClass = Integer.class), | ||
| 114 | - @ApiImplicitParam(name = "parameter1", value = "数据一", dataTypeClass = Integer.class), | ||
| 115 | - @ApiImplicitParam(name = "parameter2", value = "数据二", dataTypeClass = Integer.class), | ||
| 116 | - @ApiImplicitParam(name = "combindCode2", value = "组合码二", dataTypeClass = Integer.class), | ||
| 117 | - }) | 108 | + |
| 109 | + @Operation(summary = "通用前端控制命令") | ||
| 110 | + @Parameter(name = "deviceId", description = "设备国标编号", required = true) | ||
| 111 | + @Parameter(name = "channelId", description = "通道国标编号", required = true) | ||
| 112 | + @Parameter(name = "cmdCode", description = "指令码", required = true) | ||
| 113 | + @Parameter(name = "parameter1", description = "数据一", required = true) | ||
| 114 | + @Parameter(name = "parameter2", description = "数据二", required = true) | ||
| 115 | + @Parameter(name = "combindCode2", description = "组合码二", required = true) | ||
| 118 | @PostMapping("/front_end_command/{deviceId}/{channelId}") | 116 | @PostMapping("/front_end_command/{deviceId}/{channelId}") |
| 119 | public ResponseEntity<String> frontEndCommand(@PathVariable String deviceId,@PathVariable String channelId,int cmdCode, int parameter1, int parameter2, int combindCode2){ | 117 | public ResponseEntity<String> frontEndCommand(@PathVariable String deviceId,@PathVariable String channelId,int cmdCode, int parameter1, int parameter2, int combindCode2){ |
| 120 | 118 | ||
| @@ -127,11 +125,10 @@ public class PtzController { | @@ -127,11 +125,10 @@ public class PtzController { | ||
| 127 | return new ResponseEntity<String>("success",HttpStatus.OK); | 125 | return new ResponseEntity<String>("success",HttpStatus.OK); |
| 128 | } | 126 | } |
| 129 | 127 | ||
| 130 | - @ApiOperation("预置位查询") | ||
| 131 | - @ApiImplicitParams({ | ||
| 132 | - @ApiImplicitParam(name = "deviceId", value = "设备ID", dataTypeClass = String.class), | ||
| 133 | - @ApiImplicitParam(name = "channelId", value = "通道ID", dataTypeClass = String.class), | ||
| 134 | - }) | 128 | + |
| 129 | + @Operation(summary = "预置位查询") | ||
| 130 | + @Parameter(name = "deviceId", description = "设备国标编号", required = true) | ||
| 131 | + @Parameter(name = "channelId", description = "通道国标编号", required = true) | ||
| 135 | @GetMapping("/preset/query/{deviceId}/{channelId}") | 132 | @GetMapping("/preset/query/{deviceId}/{channelId}") |
| 136 | public DeferredResult<ResponseEntity<String>> presetQueryApi(@PathVariable String deviceId, @PathVariable String channelId) { | 133 | public DeferredResult<ResponseEntity<String>> presetQueryApi(@PathVariable String deviceId, @PathVariable String channelId) { |
| 137 | if (logger.isDebugEnabled()) { | 134 | if (logger.isDebugEnabled()) { |
src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/record/GBRecordController.java
| @@ -7,10 +7,10 @@ import com.genersoft.iot.vmp.service.IMediaServerService; | @@ -7,10 +7,10 @@ import com.genersoft.iot.vmp.service.IMediaServerService; | ||
| 7 | import com.genersoft.iot.vmp.service.IPlayService; | 7 | import com.genersoft.iot.vmp.service.IPlayService; |
| 8 | import com.genersoft.iot.vmp.utils.DateUtil; | 8 | import com.genersoft.iot.vmp.utils.DateUtil; |
| 9 | import com.genersoft.iot.vmp.vmanager.bean.WVPResult; | 9 | import com.genersoft.iot.vmp.vmanager.bean.WVPResult; |
| 10 | -import io.swagger.annotations.Api; | ||
| 11 | -import io.swagger.annotations.ApiImplicitParam; | ||
| 12 | -import io.swagger.annotations.ApiImplicitParams; | ||
| 13 | -import io.swagger.annotations.ApiOperation; | 10 | + |
| 11 | +import io.swagger.v3.oas.annotations.Operation; | ||
| 12 | +import io.swagger.v3.oas.annotations.Parameter; | ||
| 13 | +import io.swagger.v3.oas.annotations.tags.Tag; | ||
| 14 | import org.slf4j.Logger; | 14 | import org.slf4j.Logger; |
| 15 | import org.slf4j.LoggerFactory; | 15 | import org.slf4j.LoggerFactory; |
| 16 | import org.springframework.beans.factory.annotation.Autowired; | 16 | import org.springframework.beans.factory.annotation.Autowired; |
| @@ -32,7 +32,7 @@ import com.genersoft.iot.vmp.storager.IVideoManagerStorage; | @@ -32,7 +32,7 @@ import com.genersoft.iot.vmp.storager.IVideoManagerStorage; | ||
| 32 | import java.time.LocalDate; | 32 | import java.time.LocalDate; |
| 33 | import java.util.UUID; | 33 | import java.util.UUID; |
| 34 | 34 | ||
| 35 | -@Api(tags = "国标录像") | 35 | +@Tag(name = "国标录像") |
| 36 | @CrossOrigin | 36 | @CrossOrigin |
| 37 | @RestController | 37 | @RestController |
| 38 | @RequestMapping("/api/gb_record") | 38 | @RequestMapping("/api/gb_record") |
| @@ -52,16 +52,11 @@ public class GBRecordController { | @@ -52,16 +52,11 @@ public class GBRecordController { | ||
| 52 | @Autowired | 52 | @Autowired |
| 53 | private IPlayService playService; | 53 | private IPlayService playService; |
| 54 | 54 | ||
| 55 | - @Autowired | ||
| 56 | - private IMediaServerService mediaServerService; | ||
| 57 | - | ||
| 58 | - @ApiOperation("录像查询") | ||
| 59 | - @ApiImplicitParams({ | ||
| 60 | - @ApiImplicitParam(name = "deviceId", value = "设备ID", dataTypeClass = String.class), | ||
| 61 | - @ApiImplicitParam(name = "channelId", value = "通道ID", dataTypeClass = String.class), | ||
| 62 | - @ApiImplicitParam(name = "startTime", value = "开始时间", dataTypeClass = String.class), | ||
| 63 | - @ApiImplicitParam(name = "endTime", value = "结束时间", dataTypeClass = String.class), | ||
| 64 | - }) | 55 | + @Operation(summary = "录像查询") |
| 56 | + @Parameter(name = "deviceId", description = "设备国标编号", required = true) | ||
| 57 | + @Parameter(name = "channelId", description = "通道国标编号", required = true) | ||
| 58 | + @Parameter(name = "startTime", description = "开始时间", required = true) | ||
| 59 | + @Parameter(name = "endTime", description = "结束时间", required = true) | ||
| 65 | @GetMapping("/query/{deviceId}/{channelId}") | 60 | @GetMapping("/query/{deviceId}/{channelId}") |
| 66 | public DeferredResult<ResponseEntity<WVPResult<RecordInfo>>> recordinfo(@PathVariable String deviceId, @PathVariable String channelId, String startTime, String endTime){ | 61 | public DeferredResult<ResponseEntity<WVPResult<RecordInfo>>> recordinfo(@PathVariable String deviceId, @PathVariable String channelId, String startTime, String endTime){ |
| 67 | 62 | ||
| @@ -116,14 +111,13 @@ public class GBRecordController { | @@ -116,14 +111,13 @@ public class GBRecordController { | ||
| 116 | return result; | 111 | return result; |
| 117 | } | 112 | } |
| 118 | 113 | ||
| 119 | - @ApiOperation("开始历史媒体下载") | ||
| 120 | - @ApiImplicitParams({ | ||
| 121 | - @ApiImplicitParam(name = "deviceId", value = "设备ID", dataTypeClass = String.class), | ||
| 122 | - @ApiImplicitParam(name = "channelId", value = "通道ID", dataTypeClass = String.class), | ||
| 123 | - @ApiImplicitParam(name = "startTime", value = "开始时间", dataTypeClass = String.class), | ||
| 124 | - @ApiImplicitParam(name = "endTime", value = "结束时间", dataTypeClass = String.class), | ||
| 125 | - @ApiImplicitParam(name = "downloadSpeed", value = "下载倍速", dataTypeClass = String.class), | ||
| 126 | - }) | 114 | + |
| 115 | + @Operation(summary = "开始历史媒体下载") | ||
| 116 | + @Parameter(name = "deviceId", description = "设备国标编号", required = true) | ||
| 117 | + @Parameter(name = "channelId", description = "通道国标编号", required = true) | ||
| 118 | + @Parameter(name = "startTime", description = "开始时间", required = true) | ||
| 119 | + @Parameter(name = "endTime", description = "结束时间", required = true) | ||
| 120 | + @Parameter(name = "downloadSpeed", description = "下载倍速", required = true) | ||
| 127 | @GetMapping("/download/start/{deviceId}/{channelId}") | 121 | @GetMapping("/download/start/{deviceId}/{channelId}") |
| 128 | public DeferredResult<ResponseEntity<String>> download(@PathVariable String deviceId, @PathVariable String channelId, | 122 | public DeferredResult<ResponseEntity<String>> download(@PathVariable String deviceId, @PathVariable String channelId, |
| 129 | String startTime, String endTime, String downloadSpeed) { | 123 | String startTime, String endTime, String downloadSpeed) { |
| @@ -184,12 +178,10 @@ public class GBRecordController { | @@ -184,12 +178,10 @@ public class GBRecordController { | ||
| 184 | return result; | 178 | return result; |
| 185 | } | 179 | } |
| 186 | 180 | ||
| 187 | - @ApiOperation("停止历史媒体下载") | ||
| 188 | - @ApiImplicitParams({ | ||
| 189 | - @ApiImplicitParam(name = "deviceId", value = "设备ID", dataTypeClass = String.class), | ||
| 190 | - @ApiImplicitParam(name = "channelId", value = "通道ID", dataTypeClass = String.class), | ||
| 191 | - @ApiImplicitParam(name = "stream", value = "流ID", dataTypeClass = String.class), | ||
| 192 | - }) | 181 | + @Operation(summary = "停止历史媒体下载") |
| 182 | + @Parameter(name = "deviceId", description = "设备国标编号", required = true) | ||
| 183 | + @Parameter(name = "channelId", description = "通道国标编号", required = true) | ||
| 184 | + @Parameter(name = "stream", description = "流ID", required = true) | ||
| 193 | @GetMapping("/download/stop/{deviceId}/{channelId}/{stream}") | 185 | @GetMapping("/download/stop/{deviceId}/{channelId}/{stream}") |
| 194 | public ResponseEntity<String> playStop(@PathVariable String deviceId, @PathVariable String channelId, @PathVariable String stream) { | 186 | public ResponseEntity<String> playStop(@PathVariable String deviceId, @PathVariable String channelId, @PathVariable String stream) { |
| 195 | 187 | ||
| @@ -210,12 +202,10 @@ public class GBRecordController { | @@ -210,12 +202,10 @@ public class GBRecordController { | ||
| 210 | } | 202 | } |
| 211 | } | 203 | } |
| 212 | 204 | ||
| 213 | - @ApiOperation("获取历史媒体下载进度") | ||
| 214 | - @ApiImplicitParams({ | ||
| 215 | - @ApiImplicitParam(name = "deviceId", value = "设备ID", dataTypeClass = String.class), | ||
| 216 | - @ApiImplicitParam(name = "channelId", value = "通道ID", dataTypeClass = String.class), | ||
| 217 | - @ApiImplicitParam(name = "stream", value = "流ID", dataTypeClass = String.class), | ||
| 218 | - }) | 205 | + @Operation(summary = "获取历史媒体下载进度") |
| 206 | + @Parameter(name = "deviceId", description = "设备国标编号", required = true) | ||
| 207 | + @Parameter(name = "channelId", description = "通道国标编号", required = true) | ||
| 208 | + @Parameter(name = "stream", description = "流ID", required = true) | ||
| 219 | @GetMapping("/download/progress/{deviceId}/{channelId}/{stream}") | 209 | @GetMapping("/download/progress/{deviceId}/{channelId}/{stream}") |
| 220 | public ResponseEntity<StreamInfo> getProgress(@PathVariable String deviceId, @PathVariable String channelId, @PathVariable String stream) { | 210 | public ResponseEntity<StreamInfo> getProgress(@PathVariable String deviceId, @PathVariable String channelId, @PathVariable String stream) { |
| 221 | 211 |
src/main/java/com/genersoft/iot/vmp/vmanager/log/LogController.java
| @@ -6,10 +6,10 @@ import com.genersoft.iot.vmp.storager.dao.dto.LogDto; | @@ -6,10 +6,10 @@ import com.genersoft.iot.vmp.storager.dao.dto.LogDto; | ||
| 6 | import com.genersoft.iot.vmp.utils.DateUtil; | 6 | import com.genersoft.iot.vmp.utils.DateUtil; |
| 7 | import com.genersoft.iot.vmp.vmanager.bean.WVPResult; | 7 | import com.genersoft.iot.vmp.vmanager.bean.WVPResult; |
| 8 | import com.github.pagehelper.PageInfo; | 8 | import com.github.pagehelper.PageInfo; |
| 9 | -import io.swagger.annotations.Api; | ||
| 10 | -import io.swagger.annotations.ApiImplicitParam; | ||
| 11 | -import io.swagger.annotations.ApiImplicitParams; | ||
| 12 | -import io.swagger.annotations.ApiOperation; | 9 | + |
| 10 | +import io.swagger.v3.oas.annotations.Operation; | ||
| 11 | +import io.swagger.v3.oas.annotations.Parameter; | ||
| 12 | +import io.swagger.v3.oas.annotations.tags.Tag; | ||
| 13 | import org.slf4j.Logger; | 13 | import org.slf4j.Logger; |
| 14 | import org.slf4j.LoggerFactory; | 14 | import org.slf4j.LoggerFactory; |
| 15 | import org.springframework.beans.factory.annotation.Autowired; | 15 | import org.springframework.beans.factory.annotation.Autowired; |
| @@ -20,7 +20,7 @@ import org.springframework.web.bind.annotation.*; | @@ -20,7 +20,7 @@ import org.springframework.web.bind.annotation.*; | ||
| 20 | 20 | ||
| 21 | import java.text.ParseException; | 21 | import java.text.ParseException; |
| 22 | 22 | ||
| 23 | -@Api(tags = "日志管理") | 23 | +@Tag(name = "日志管理") |
| 24 | @CrossOrigin | 24 | @CrossOrigin |
| 25 | @RestController | 25 | @RestController |
| 26 | @RequestMapping("/api/log") | 26 | @RequestMapping("/api/log") |
| @@ -45,16 +45,14 @@ public class LogController { | @@ -45,16 +45,14 @@ public class LogController { | ||
| 45 | * @param endTime 结束时间 | 45 | * @param endTime 结束时间 |
| 46 | * @return | 46 | * @return |
| 47 | */ | 47 | */ |
| 48 | - @ApiOperation("分页查询报警") | ||
| 49 | @GetMapping("/all") | 48 | @GetMapping("/all") |
| 50 | - @ApiImplicitParams({ | ||
| 51 | - @ApiImplicitParam(name="query", value = "查询内容", dataTypeClass = String.class), | ||
| 52 | - @ApiImplicitParam(name="page", value = "当前页", required = true ,dataTypeClass = Integer.class), | ||
| 53 | - @ApiImplicitParam(name="count", value = "每页查询数量", required = true ,dataTypeClass = Integer.class), | ||
| 54 | - @ApiImplicitParam(name="type", value = "类型" ,dataTypeClass = String.class), | ||
| 55 | - @ApiImplicitParam(name="startTime", value = "查询内容" ,dataTypeClass = String.class), | ||
| 56 | - @ApiImplicitParam(name="endTime", value = "查询内容" ,dataTypeClass = String.class), | ||
| 57 | - }) | 49 | + @Operation(summary = "分页查询报警") |
| 50 | + @Parameter(name = "query", description = "查询内容", required = true) | ||
| 51 | + @Parameter(name = "page", description = "当前页", required = true) | ||
| 52 | + @Parameter(name = "count", description = "每页查询数量", required = true) | ||
| 53 | + @Parameter(name = "type", description = "类型", required = true) | ||
| 54 | + @Parameter(name = "startTime", description = "开始时间", required = true) | ||
| 55 | + @Parameter(name = "endTime", description = "结束时间", required = true) | ||
| 58 | public ResponseEntity<PageInfo<LogDto>> getAll( | 56 | public ResponseEntity<PageInfo<LogDto>> getAll( |
| 59 | @RequestParam int page, | 57 | @RequestParam int page, |
| 60 | @RequestParam int count, | 58 | @RequestParam int count, |
| @@ -88,9 +86,8 @@ public class LogController { | @@ -88,9 +86,8 @@ public class LogController { | ||
| 88 | * 清空日志 | 86 | * 清空日志 |
| 89 | * | 87 | * |
| 90 | */ | 88 | */ |
| 91 | - @ApiOperation("清空日志") | 89 | + @Operation(summary = "停止视频回放") |
| 92 | @DeleteMapping("/clear") | 90 | @DeleteMapping("/clear") |
| 93 | - @ApiImplicitParams({}) | ||
| 94 | public ResponseEntity<WVPResult<String>> clear() { | 91 | public ResponseEntity<WVPResult<String>> clear() { |
| 95 | 92 | ||
| 96 | int count = logService.clear(); | 93 | int count = logService.clear(); |
src/main/java/com/genersoft/iot/vmp/vmanager/record/RecordController.java
| @@ -13,7 +13,7 @@ | @@ -13,7 +13,7 @@ | ||
| 13 | //import org.springframework.beans.factory.annotation.Autowired; | 13 | //import org.springframework.beans.factory.annotation.Autowired; |
| 14 | //import org.springframework.web.bind.annotation.*; | 14 | //import org.springframework.web.bind.annotation.*; |
| 15 | // | 15 | // |
| 16 | -//@Api(tags = "云端录像") | 16 | +//@Tag(name = "云端录像") |
| 17 | //@CrossOrigin | 17 | //@CrossOrigin |
| 18 | //@RestController | 18 | //@RestController |
| 19 | //@RequestMapping("/api/record") | 19 | //@RequestMapping("/api/record") |
| @@ -22,7 +22,7 @@ | @@ -22,7 +22,7 @@ | ||
| 22 | // @Autowired | 22 | // @Autowired |
| 23 | // private IRecordInfoServer recordInfoServer; | 23 | // private IRecordInfoServer recordInfoServer; |
| 24 | // | 24 | // |
| 25 | -// @ApiOperation("录像列表查询") | 25 | +// //@ApiOperation("录像列表查询") |
| 26 | // @ApiImplicitParams({ | 26 | // @ApiImplicitParams({ |
| 27 | // @ApiImplicitParam(name="page", value = "当前页", required = true, dataTypeClass = Integer.class), | 27 | // @ApiImplicitParam(name="page", value = "当前页", required = true, dataTypeClass = Integer.class), |
| 28 | // @ApiImplicitParam(name="count", value = "每页查询数量", required = true, dataTypeClass = Integer.class), | 28 | // @ApiImplicitParam(name="count", value = "每页查询数量", required = true, dataTypeClass = Integer.class), |
| @@ -37,7 +37,7 @@ | @@ -37,7 +37,7 @@ | ||
| 37 | // return recordList; | 37 | // return recordList; |
| 38 | // } | 38 | // } |
| 39 | // | 39 | // |
| 40 | -// @ApiOperation("获取录像详情") | 40 | +// //@ApiOperation("获取录像详情") |
| 41 | // @ApiImplicitParams({ | 41 | // @ApiImplicitParams({ |
| 42 | // @ApiImplicitParam(name="recordInfo", value = "录像记录", required = true, dataTypeClass = RecordInfo.class) | 42 | // @ApiImplicitParam(name="recordInfo", value = "录像记录", required = true, dataTypeClass = RecordInfo.class) |
| 43 | // }) | 43 | // }) |
src/main/java/com/genersoft/iot/vmp/vmanager/server/ServerController.java
| @@ -15,10 +15,10 @@ import com.genersoft.iot.vmp.service.IMediaServerService; | @@ -15,10 +15,10 @@ import com.genersoft.iot.vmp.service.IMediaServerService; | ||
| 15 | import com.genersoft.iot.vmp.utils.SpringBeanFactory; | 15 | import com.genersoft.iot.vmp.utils.SpringBeanFactory; |
| 16 | import com.genersoft.iot.vmp.vmanager.bean.WVPResult; | 16 | import com.genersoft.iot.vmp.vmanager.bean.WVPResult; |
| 17 | import gov.nist.javax.sip.SipStackImpl; | 17 | import gov.nist.javax.sip.SipStackImpl; |
| 18 | -import io.swagger.annotations.Api; | ||
| 19 | -import io.swagger.annotations.ApiImplicitParam; | ||
| 20 | -import io.swagger.annotations.ApiImplicitParams; | ||
| 21 | -import io.swagger.annotations.ApiOperation; | 18 | + |
| 19 | +import io.swagger.v3.oas.annotations.Operation; | ||
| 20 | +import io.swagger.v3.oas.annotations.Parameter; | ||
| 21 | +import io.swagger.v3.oas.annotations.tags.Tag; | ||
| 22 | import org.springframework.beans.factory.annotation.Autowired; | 22 | import org.springframework.beans.factory.annotation.Autowired; |
| 23 | import org.springframework.beans.factory.annotation.Value; | 23 | import org.springframework.beans.factory.annotation.Value; |
| 24 | import org.springframework.context.ConfigurableApplicationContext; | 24 | import org.springframework.context.ConfigurableApplicationContext; |
| @@ -33,7 +33,7 @@ import java.util.List; | @@ -33,7 +33,7 @@ import java.util.List; | ||
| 33 | import java.util.Set; | 33 | import java.util.Set; |
| 34 | 34 | ||
| 35 | @SuppressWarnings("rawtypes") | 35 | @SuppressWarnings("rawtypes") |
| 36 | -@Api(tags = "服务控制") | 36 | +@Tag(name = "服务控制") |
| 37 | @CrossOrigin | 37 | @CrossOrigin |
| 38 | @RestController | 38 | @RestController |
| 39 | @RequestMapping("/api/server") | 39 | @RequestMapping("/api/server") |
| @@ -61,10 +61,10 @@ public class ServerController { | @@ -61,10 +61,10 @@ public class ServerController { | ||
| 61 | private int serverPort; | 61 | private int serverPort; |
| 62 | 62 | ||
| 63 | 63 | ||
| 64 | - @ApiOperation("流媒体服务列表") | ||
| 65 | @GetMapping(value = "/media_server/list") | 64 | @GetMapping(value = "/media_server/list") |
| 66 | @ResponseBody | 65 | @ResponseBody |
| 67 | - public WVPResult<List<MediaServerItem>> getMediaServerList(boolean detail){ | 66 | + @Operation(summary = "流媒体服务列表") |
| 67 | + public WVPResult<List<MediaServerItem>> getMediaServerList() { | ||
| 68 | WVPResult<List<MediaServerItem>> result = new WVPResult<>(); | 68 | WVPResult<List<MediaServerItem>> result = new WVPResult<>(); |
| 69 | result.setCode(0); | 69 | result.setCode(0); |
| 70 | result.setMsg("success"); | 70 | result.setMsg("success"); |
| @@ -72,10 +72,10 @@ public class ServerController { | @@ -72,10 +72,10 @@ public class ServerController { | ||
| 72 | return result; | 72 | return result; |
| 73 | } | 73 | } |
| 74 | 74 | ||
| 75 | - @ApiOperation("在线流媒体服务列表") | ||
| 76 | @GetMapping(value = "/media_server/online/list") | 75 | @GetMapping(value = "/media_server/online/list") |
| 77 | @ResponseBody | 76 | @ResponseBody |
| 78 | - public WVPResult<List<MediaServerItem>> getOnlineMediaServerList(){ | 77 | + @Operation(summary = "在线流媒体服务列表") |
| 78 | + public WVPResult<List<MediaServerItem>> getOnlineMediaServerList() { | ||
| 79 | WVPResult<List<MediaServerItem>> result = new WVPResult<>(); | 79 | WVPResult<List<MediaServerItem>> result = new WVPResult<>(); |
| 80 | result.setCode(0); | 80 | result.setCode(0); |
| 81 | result.setMsg("success"); | 81 | result.setMsg("success"); |
| @@ -83,10 +83,11 @@ public class ServerController { | @@ -83,10 +83,11 @@ public class ServerController { | ||
| 83 | return result; | 83 | return result; |
| 84 | } | 84 | } |
| 85 | 85 | ||
| 86 | - @ApiOperation("获取流媒体服务") | ||
| 87 | @GetMapping(value = "/media_server/one/{id}") | 86 | @GetMapping(value = "/media_server/one/{id}") |
| 88 | @ResponseBody | 87 | @ResponseBody |
| 89 | - public WVPResult<MediaServerItem> getMediaServer(@PathVariable String id){ | 88 | + @Operation(summary = "停止视频回放") |
| 89 | + @Parameter(name = "id", description = "流媒体服务ID", required = true) | ||
| 90 | + public WVPResult<MediaServerItem> getMediaServer(@PathVariable String id) { | ||
| 90 | WVPResult<MediaServerItem> result = new WVPResult<>(); | 91 | WVPResult<MediaServerItem> result = new WVPResult<>(); |
| 91 | result.setCode(0); | 92 | result.setCode(0); |
| 92 | result.setMsg("success"); | 93 | result.setMsg("success"); |
| @@ -94,57 +95,49 @@ public class ServerController { | @@ -94,57 +95,49 @@ public class ServerController { | ||
| 94 | return result; | 95 | return result; |
| 95 | } | 96 | } |
| 96 | 97 | ||
| 97 | - @ApiOperation("测试流媒体服务") | ||
| 98 | - @ApiImplicitParams({ | ||
| 99 | - @ApiImplicitParam(name="ip", value = "流媒体服务IP", dataTypeClass = String.class), | ||
| 100 | - @ApiImplicitParam(name="port", value = "流媒体服务HTT端口", dataTypeClass = Integer.class), | ||
| 101 | - @ApiImplicitParam(name="secret", value = "流媒体服务secret", dataTypeClass = String.class), | ||
| 102 | - }) | 98 | + @Operation(summary = "测试流媒体服务") |
| 99 | + @Parameter(name = "ip", description = "流媒体服务IP", required = true) | ||
| 100 | + @Parameter(name = "port", description = "流媒体服务HTT端口", required = true) | ||
| 101 | + @Parameter(name = "secret", description = "流媒体服务secret", required = true) | ||
| 103 | @GetMapping(value = "/media_server/check") | 102 | @GetMapping(value = "/media_server/check") |
| 104 | @ResponseBody | 103 | @ResponseBody |
| 105 | - public WVPResult<MediaServerItem> checkMediaServer(@RequestParam String ip, @RequestParam int port, @RequestParam String secret){ | 104 | + public WVPResult<MediaServerItem> checkMediaServer(@RequestParam String ip, @RequestParam int port, @RequestParam String secret) { |
| 106 | return mediaServerService.checkMediaServer(ip, port, secret); | 105 | return mediaServerService.checkMediaServer(ip, port, secret); |
| 107 | } | 106 | } |
| 108 | 107 | ||
| 109 | - @ApiOperation("测试流媒体录像管理服务") | ||
| 110 | - @ApiImplicitParams({ | ||
| 111 | - @ApiImplicitParam(name="ip", value = "流媒体服务IP", dataTypeClass = String.class), | ||
| 112 | - @ApiImplicitParam(name="port", value = "流媒体服务HTT端口", dataTypeClass = Integer.class), | ||
| 113 | - @ApiImplicitParam(name="secret", value = "流媒体服务secret", dataTypeClass = String.class), | ||
| 114 | - }) | 108 | + @Operation(summary = "测试流媒体录像管理服务") |
| 109 | + @Parameter(name = "ip", description = "流媒体服务IP", required = true) | ||
| 110 | + @Parameter(name = "port", description = "流媒体服务HTT端口", required = true) | ||
| 115 | @GetMapping(value = "/media_server/record/check") | 111 | @GetMapping(value = "/media_server/record/check") |
| 116 | @ResponseBody | 112 | @ResponseBody |
| 117 | - public WVPResult<String> checkMediaRecordServer(@RequestParam String ip, @RequestParam int port){ | 113 | + public WVPResult<String> checkMediaRecordServer(@RequestParam String ip, @RequestParam int port) { |
| 118 | boolean checkResult = mediaServerService.checkMediaRecordServer(ip, port); | 114 | boolean checkResult = mediaServerService.checkMediaRecordServer(ip, port); |
| 119 | WVPResult<String> result = new WVPResult<>(); | 115 | WVPResult<String> result = new WVPResult<>(); |
| 120 | if (checkResult) { | 116 | if (checkResult) { |
| 121 | result.setCode(0); | 117 | result.setCode(0); |
| 122 | result.setMsg("success"); | 118 | result.setMsg("success"); |
| 123 | 119 | ||
| 124 | - }else { | 120 | + } else { |
| 125 | result.setCode(-1); | 121 | result.setCode(-1); |
| 126 | result.setMsg("连接失败"); | 122 | result.setMsg("连接失败"); |
| 127 | } | 123 | } |
| 128 | return result; | 124 | return result; |
| 129 | } | 125 | } |
| 130 | 126 | ||
| 131 | - @ApiOperation("保存流媒体服务") | ||
| 132 | - @ApiImplicitParams({ | ||
| 133 | - @ApiImplicitParam(name="mediaServerItem", value = "流媒体信息", dataTypeClass = MediaServerItem.class) | ||
| 134 | - }) | 127 | + @Operation(summary = "保存流媒体服务") |
| 128 | + @Parameter(name = "mediaServerItem", description = "流媒体信息", required = true) | ||
| 135 | @PostMapping(value = "/media_server/save") | 129 | @PostMapping(value = "/media_server/save") |
| 136 | @ResponseBody | 130 | @ResponseBody |
| 137 | - public WVPResult<String> saveMediaServer(@RequestBody MediaServerItem mediaServerItem){ | 131 | + public WVPResult<String> saveMediaServer(@RequestBody MediaServerItem mediaServerItem) { |
| 138 | MediaServerItem mediaServerItemInDatabase = mediaServerService.getOne(mediaServerItem.getId()); | 132 | MediaServerItem mediaServerItemInDatabase = mediaServerService.getOne(mediaServerItem.getId()); |
| 139 | 133 | ||
| 140 | if (mediaServerItemInDatabase != null) { | 134 | if (mediaServerItemInDatabase != null) { |
| 141 | - if (StringUtils.isEmpty(mediaServerItemInDatabase.getSendRtpPortRange()) | ||
| 142 | - && StringUtils.isEmpty(mediaServerItem.getSendRtpPortRange())){ | 135 | + if (StringUtils.isEmpty(mediaServerItemInDatabase.getSendRtpPortRange()) && StringUtils.isEmpty(mediaServerItem.getSendRtpPortRange())) { |
| 143 | mediaServerItem.setSendRtpPortRange("30000,30500"); | 136 | mediaServerItem.setSendRtpPortRange("30000,30500"); |
| 144 | } | 137 | } |
| 145 | - mediaServerService.update(mediaServerItem); | ||
| 146 | - }else { | ||
| 147 | - if (StringUtils.isEmpty(mediaServerItem.getSendRtpPortRange())){ | 138 | + mediaServerService.update(mediaServerItem); |
| 139 | + } else { | ||
| 140 | + if (StringUtils.isEmpty(mediaServerItem.getSendRtpPortRange())) { | ||
| 148 | mediaServerItem.setSendRtpPortRange("30000,30500"); | 141 | mediaServerItem.setSendRtpPortRange("30000,30500"); |
| 149 | } | 142 | } |
| 150 | return mediaServerService.add(mediaServerItem); | 143 | return mediaServerService.add(mediaServerItem); |
| @@ -156,17 +149,15 @@ public class ServerController { | @@ -156,17 +149,15 @@ public class ServerController { | ||
| 156 | return result; | 149 | return result; |
| 157 | } | 150 | } |
| 158 | 151 | ||
| 159 | - @ApiOperation("移除流媒体服务") | ||
| 160 | - @ApiImplicitParams({ | ||
| 161 | - @ApiImplicitParam(name="id", value = "流媒体ID", dataTypeClass = String.class) | ||
| 162 | - }) | 152 | + @Operation(summary = "移除流媒体服务") |
| 153 | + @Parameter(name = "id", description = "流媒体ID", required = true) | ||
| 163 | @DeleteMapping(value = "/media_server/delete") | 154 | @DeleteMapping(value = "/media_server/delete") |
| 164 | @ResponseBody | 155 | @ResponseBody |
| 165 | - public WVPResult<String> deleteMediaServer(@RequestParam String id){ | 156 | + public WVPResult<String> deleteMediaServer(@RequestParam String id) { |
| 166 | if (mediaServerService.getOne(id) != null) { | 157 | if (mediaServerService.getOne(id) != null) { |
| 167 | mediaServerService.delete(id); | 158 | mediaServerService.delete(id); |
| 168 | mediaServerService.deleteDb(id); | 159 | mediaServerService.deleteDb(id); |
| 169 | - }else { | 160 | + } else { |
| 170 | WVPResult<String> result = new WVPResult<>(); | 161 | WVPResult<String> result = new WVPResult<>(); |
| 171 | result.setCode(-1); | 162 | result.setCode(-1); |
| 172 | result.setMsg("未找到此节点"); | 163 | result.setMsg("未找到此节点"); |
| @@ -179,18 +170,17 @@ public class ServerController { | @@ -179,18 +170,17 @@ public class ServerController { | ||
| 179 | } | 170 | } |
| 180 | 171 | ||
| 181 | 172 | ||
| 182 | - | ||
| 183 | - @ApiOperation("重启服务") | 173 | + @Operation(summary = "重启服务") |
| 184 | @GetMapping(value = "/restart") | 174 | @GetMapping(value = "/restart") |
| 185 | @ResponseBody | 175 | @ResponseBody |
| 186 | - public Object restart(){ | 176 | + public Object restart() { |
| 187 | Thread restartThread = new Thread(new Runnable() { | 177 | Thread restartThread = new Thread(new Runnable() { |
| 188 | @Override | 178 | @Override |
| 189 | public void run() { | 179 | public void run() { |
| 190 | try { | 180 | try { |
| 191 | Thread.sleep(3000); | 181 | Thread.sleep(3000); |
| 192 | SipProvider up = (SipProvider) SpringBeanFactory.getBean("udpSipProvider"); | 182 | SipProvider up = (SipProvider) SpringBeanFactory.getBean("udpSipProvider"); |
| 193 | - SipStackImpl stack = (SipStackImpl)up.getSipStack(); | 183 | + SipStackImpl stack = (SipStackImpl) up.getSipStack(); |
| 194 | stack.stop(); | 184 | stack.stop(); |
| 195 | Iterator listener = stack.getListeningPoints(); | 185 | Iterator listener = stack.getListeningPoints(); |
| 196 | while (listener.hasNext()) { | 186 | while (listener.hasNext()) { |
| @@ -213,10 +203,10 @@ public class ServerController { | @@ -213,10 +203,10 @@ public class ServerController { | ||
| 213 | return "success"; | 203 | return "success"; |
| 214 | } | 204 | } |
| 215 | 205 | ||
| 216 | - @ApiOperation("版本信息") | 206 | + @Operation(summary = "获取版本信息") |
| 217 | @GetMapping(value = "/version") | 207 | @GetMapping(value = "/version") |
| 218 | @ResponseBody | 208 | @ResponseBody |
| 219 | - public WVPResult<VersionPo> getVersion(){ | 209 | + public WVPResult<VersionPo> getVersion() { |
| 220 | WVPResult<VersionPo> result = new WVPResult<>(); | 210 | WVPResult<VersionPo> result = new WVPResult<>(); |
| 221 | result.setCode(0); | 211 | result.setCode(0); |
| 222 | result.setMsg("success"); | 212 | result.setMsg("success"); |
| @@ -224,13 +214,11 @@ public class ServerController { | @@ -224,13 +214,11 @@ public class ServerController { | ||
| 224 | return result; | 214 | return result; |
| 225 | } | 215 | } |
| 226 | 216 | ||
| 227 | - @ApiOperation("配置信息") | ||
| 228 | @GetMapping(value = "/config") | 217 | @GetMapping(value = "/config") |
| 229 | - @ApiImplicitParams({ | ||
| 230 | - @ApiImplicitParam(name="type", value = "配置类型(sip, base)", dataTypeClass = String.class), | ||
| 231 | - }) | 218 | + @Operation(summary = "获取配置信息") |
| 219 | + @Parameter(name = "type", description = "配置类型(sip, base)", required = true) | ||
| 232 | @ResponseBody | 220 | @ResponseBody |
| 233 | - public WVPResult<JSONObject> getVersion(String type){ | 221 | + public WVPResult<JSONObject> getVersion(String type) { |
| 234 | WVPResult<JSONObject> result = new WVPResult<>(); | 222 | WVPResult<JSONObject> result = new WVPResult<>(); |
| 235 | result.setCode(0); | 223 | result.setCode(0); |
| 236 | result.setMsg("success"); | 224 | result.setMsg("success"); |
| @@ -240,8 +228,8 @@ public class ServerController { | @@ -240,8 +228,8 @@ public class ServerController { | ||
| 240 | if (StringUtils.isEmpty(type)) { | 228 | if (StringUtils.isEmpty(type)) { |
| 241 | jsonObject.put("sip", JSON.toJSON(sipConfig)); | 229 | jsonObject.put("sip", JSON.toJSON(sipConfig)); |
| 242 | jsonObject.put("base", JSON.toJSON(userSetting)); | 230 | jsonObject.put("base", JSON.toJSON(userSetting)); |
| 243 | - }else { | ||
| 244 | - switch (type){ | 231 | + } else { |
| 232 | + switch (type) { | ||
| 245 | case "sip": | 233 | case "sip": |
| 246 | jsonObject.put("sip", sipConfig); | 234 | jsonObject.put("sip", sipConfig); |
| 247 | break; | 235 | break; |
| @@ -256,10 +244,10 @@ public class ServerController { | @@ -256,10 +244,10 @@ public class ServerController { | ||
| 256 | return result; | 244 | return result; |
| 257 | } | 245 | } |
| 258 | 246 | ||
| 259 | - @ApiOperation("获取当前所有hook") | ||
| 260 | @GetMapping(value = "/hooks") | 247 | @GetMapping(value = "/hooks") |
| 261 | @ResponseBody | 248 | @ResponseBody |
| 262 | - public WVPResult<List<IHookSubscribe>> getHooks(){ | 249 | + @Operation(summary = "获取当前所有hook") |
| 250 | + public WVPResult<List<IHookSubscribe>> getHooks() { | ||
| 263 | WVPResult<List<IHookSubscribe>> result = new WVPResult<>(); | 251 | WVPResult<List<IHookSubscribe>> result = new WVPResult<>(); |
| 264 | result.setCode(0); | 252 | result.setCode(0); |
| 265 | result.setMsg("success"); | 253 | result.setMsg("success"); |
| @@ -268,7 +256,7 @@ public class ServerController { | @@ -268,7 +256,7 @@ public class ServerController { | ||
| 268 | return result; | 256 | return result; |
| 269 | } | 257 | } |
| 270 | 258 | ||
| 271 | -// @ApiOperation("当前进行中的动态任务") | 259 | +// //@ApiOperation("当前进行中的动态任务") |
| 272 | // @GetMapping(value = "/dynamicTask") | 260 | // @GetMapping(value = "/dynamicTask") |
| 273 | // @ResponseBody | 261 | // @ResponseBody |
| 274 | // public WVPResult<JSONObject> getDynamicTask(){ | 262 | // public WVPResult<JSONObject> getDynamicTask(){ |
src/main/java/com/genersoft/iot/vmp/vmanager/streamProxy/StreamProxyController.java
| @@ -10,10 +10,10 @@ import com.genersoft.iot.vmp.storager.IRedisCatchStorage; | @@ -10,10 +10,10 @@ import com.genersoft.iot.vmp.storager.IRedisCatchStorage; | ||
| 10 | import com.genersoft.iot.vmp.service.IStreamProxyService; | 10 | import com.genersoft.iot.vmp.service.IStreamProxyService; |
| 11 | import com.genersoft.iot.vmp.vmanager.bean.WVPResult; | 11 | import com.genersoft.iot.vmp.vmanager.bean.WVPResult; |
| 12 | import com.github.pagehelper.PageInfo; | 12 | import com.github.pagehelper.PageInfo; |
| 13 | -import io.swagger.annotations.Api; | ||
| 14 | -import io.swagger.annotations.ApiImplicitParam; | ||
| 15 | -import io.swagger.annotations.ApiImplicitParams; | ||
| 16 | -import io.swagger.annotations.ApiOperation; | 13 | +import io.swagger.v3.oas.annotations.Operation; |
| 14 | +import io.swagger.v3.oas.annotations.Parameter; | ||
| 15 | +import io.swagger.v3.oas.annotations.Parameters; | ||
| 16 | +import io.swagger.v3.oas.annotations.tags.Tag; | ||
| 17 | import org.slf4j.Logger; | 17 | import org.slf4j.Logger; |
| 18 | import org.slf4j.LoggerFactory; | 18 | import org.slf4j.LoggerFactory; |
| 19 | import org.springframework.beans.factory.annotation.Autowired; | 19 | import org.springframework.beans.factory.annotation.Autowired; |
| @@ -25,7 +25,7 @@ import org.springframework.web.bind.annotation.*; | @@ -25,7 +25,7 @@ import org.springframework.web.bind.annotation.*; | ||
| 25 | /** | 25 | /** |
| 26 | * 拉流代理接口 | 26 | * 拉流代理接口 |
| 27 | */ | 27 | */ |
| 28 | -@Api(tags = "拉流代理") | 28 | +@Tag(name = "拉流代理", description = "") |
| 29 | @Controller | 29 | @Controller |
| 30 | @CrossOrigin | 30 | @CrossOrigin |
| 31 | @RequestMapping(value = "/api/proxy") | 31 | @RequestMapping(value = "/api/proxy") |
| @@ -44,13 +44,11 @@ public class StreamProxyController { | @@ -44,13 +44,11 @@ public class StreamProxyController { | ||
| 44 | private IStreamProxyService streamProxyService; | 44 | private IStreamProxyService streamProxyService; |
| 45 | 45 | ||
| 46 | 46 | ||
| 47 | - @ApiOperation("分页查询流代理") | ||
| 48 | - @ApiImplicitParams({ | ||
| 49 | - @ApiImplicitParam(name="page", value = "当前页", required = true, dataTypeClass = Integer.class), | ||
| 50 | - @ApiImplicitParam(name="count", value = "每页查询数量", required = true, dataTypeClass = Integer.class), | ||
| 51 | - @ApiImplicitParam(name="query", value = "查询内容", dataTypeClass = String.class), | ||
| 52 | - @ApiImplicitParam(name="online", value = "是否在线", dataTypeClass = Boolean.class), | ||
| 53 | - }) | 47 | + @Operation(summary = "分页查询流代理") |
| 48 | + @Parameter(name = "page", description = "当前页") | ||
| 49 | + @Parameter(name = "count", description = "每页查询数量") | ||
| 50 | + @Parameter(name = "query", description = "查询内容") | ||
| 51 | + @Parameter(name = "online", description = "是否在线") | ||
| 54 | @GetMapping(value = "/list") | 52 | @GetMapping(value = "/list") |
| 55 | @ResponseBody | 53 | @ResponseBody |
| 56 | public PageInfo<StreamProxyItem> list(@RequestParam(required = false)Integer page, | 54 | public PageInfo<StreamProxyItem> list(@RequestParam(required = false)Integer page, |
| @@ -61,9 +59,8 @@ public class StreamProxyController { | @@ -61,9 +59,8 @@ public class StreamProxyController { | ||
| 61 | return streamProxyService.getAll(page, count); | 59 | return streamProxyService.getAll(page, count); |
| 62 | } | 60 | } |
| 63 | 61 | ||
| 64 | - @ApiOperation("保存代理") | ||
| 65 | - @ApiImplicitParams({ | ||
| 66 | - @ApiImplicitParam(name = "param", value = "代理参数", dataTypeClass = StreamProxyItem.class), | 62 | + @Operation(summary = "保存代理", parameters = { |
| 63 | + @Parameter(name = "param", description = "代理参数", required = true), | ||
| 67 | }) | 64 | }) |
| 68 | @PostMapping(value = "/save") | 65 | @PostMapping(value = "/save") |
| 69 | @ResponseBody | 66 | @ResponseBody |
| @@ -82,12 +79,10 @@ public class StreamProxyController { | @@ -82,12 +79,10 @@ public class StreamProxyController { | ||
| 82 | return result; | 79 | return result; |
| 83 | } | 80 | } |
| 84 | 81 | ||
| 85 | - @ApiOperation("获取ffmpeg.cmd模板") | ||
| 86 | @GetMapping(value = "/ffmpeg_cmd/list") | 82 | @GetMapping(value = "/ffmpeg_cmd/list") |
| 87 | - @ApiImplicitParams({ | ||
| 88 | - @ApiImplicitParam(name = "mediaServerId", value = "流媒体ID", dataTypeClass = String.class), | ||
| 89 | - }) | ||
| 90 | @ResponseBody | 83 | @ResponseBody |
| 84 | + @Operation(summary = "获取ffmpeg.cmd模板") | ||
| 85 | + @Parameter(name = "mediaServerId", description = "流媒体ID", required = true) | ||
| 91 | public WVPResult getFFmpegCMDs(@RequestParam String mediaServerId){ | 86 | public WVPResult getFFmpegCMDs(@RequestParam String mediaServerId){ |
| 92 | logger.debug("获取节点[ {} ]ffmpeg.cmd模板", mediaServerId ); | 87 | logger.debug("获取节点[ {} ]ffmpeg.cmd模板", mediaServerId ); |
| 93 | 88 | ||
| @@ -100,13 +95,11 @@ public class StreamProxyController { | @@ -100,13 +95,11 @@ public class StreamProxyController { | ||
| 100 | return result; | 95 | return result; |
| 101 | } | 96 | } |
| 102 | 97 | ||
| 103 | - @ApiOperation("移除代理") | ||
| 104 | - @ApiImplicitParams({ | ||
| 105 | - @ApiImplicitParam(name = "app", value = "应用名", required = true, dataTypeClass = String.class), | ||
| 106 | - @ApiImplicitParam(name = "stream", value = "流ID", required = true, dataTypeClass = String.class), | ||
| 107 | - }) | ||
| 108 | @DeleteMapping(value = "/del") | 98 | @DeleteMapping(value = "/del") |
| 109 | @ResponseBody | 99 | @ResponseBody |
| 100 | + @Operation(summary = "移除代理") | ||
| 101 | + @Parameter(name = "app", description = "应用名", required = true) | ||
| 102 | + @Parameter(name = "stream", description = "流id", required = true) | ||
| 110 | public WVPResult del(@RequestParam String app, @RequestParam String stream){ | 103 | public WVPResult del(@RequestParam String app, @RequestParam String stream){ |
| 111 | logger.info("移除代理: " + app + "/" + stream); | 104 | logger.info("移除代理: " + app + "/" + stream); |
| 112 | WVPResult<Object> result = new WVPResult<>(); | 105 | WVPResult<Object> result = new WVPResult<>(); |
| @@ -121,13 +114,11 @@ public class StreamProxyController { | @@ -121,13 +114,11 @@ public class StreamProxyController { | ||
| 121 | return result; | 114 | return result; |
| 122 | } | 115 | } |
| 123 | 116 | ||
| 124 | - @ApiOperation("启用代理") | ||
| 125 | - @ApiImplicitParams({ | ||
| 126 | - @ApiImplicitParam(name = "app", value = "应用名", dataTypeClass = String.class), | ||
| 127 | - @ApiImplicitParam(name = "stream", value = "流ID", dataTypeClass = String.class), | ||
| 128 | - }) | ||
| 129 | @GetMapping(value = "/start") | 117 | @GetMapping(value = "/start") |
| 130 | @ResponseBody | 118 | @ResponseBody |
| 119 | + @Operation(summary = "启用代理") | ||
| 120 | + @Parameter(name = "app", description = "应用名", required = true) | ||
| 121 | + @Parameter(name = "stream", description = "流id", required = true) | ||
| 131 | public Object start(String app, String stream){ | 122 | public Object start(String app, String stream){ |
| 132 | logger.info("启用代理: " + app + "/" + stream); | 123 | logger.info("启用代理: " + app + "/" + stream); |
| 133 | boolean result = streamProxyService.start(app, stream); | 124 | boolean result = streamProxyService.start(app, stream); |
| @@ -137,13 +128,11 @@ public class StreamProxyController { | @@ -137,13 +128,11 @@ public class StreamProxyController { | ||
| 137 | return result?"success":"fail"; | 128 | return result?"success":"fail"; |
| 138 | } | 129 | } |
| 139 | 130 | ||
| 140 | - @ApiOperation("停用代理") | ||
| 141 | - @ApiImplicitParams({ | ||
| 142 | - @ApiImplicitParam(name = "app", value = "应用名", dataTypeClass = String.class), | ||
| 143 | - @ApiImplicitParam(name = "stream", value = "流ID", dataTypeClass = String.class), | ||
| 144 | - }) | ||
| 145 | @GetMapping(value = "/stop") | 131 | @GetMapping(value = "/stop") |
| 146 | @ResponseBody | 132 | @ResponseBody |
| 133 | + @Operation(summary = "停用代理") | ||
| 134 | + @Parameter(name = "app", description = "应用名", required = true) | ||
| 135 | + @Parameter(name = "stream", description = "流id", required = true) | ||
| 147 | public Object stop(String app, String stream){ | 136 | public Object stop(String app, String stream){ |
| 148 | logger.info("停用代理: " + app + "/" + stream); | 137 | logger.info("停用代理: " + app + "/" + stream); |
| 149 | boolean result = streamProxyService.stop(app, stream); | 138 | boolean result = streamProxyService.stop(app, stream); |
src/main/java/com/genersoft/iot/vmp/vmanager/streamPush/StreamPushController.java
| @@ -20,10 +20,10 @@ import com.genersoft.iot.vmp.vmanager.bean.BatchGBStreamParam; | @@ -20,10 +20,10 @@ import com.genersoft.iot.vmp.vmanager.bean.BatchGBStreamParam; | ||
| 20 | import com.genersoft.iot.vmp.vmanager.bean.StreamPushExcelDto; | 20 | import com.genersoft.iot.vmp.vmanager.bean.StreamPushExcelDto; |
| 21 | import com.genersoft.iot.vmp.vmanager.bean.WVPResult; | 21 | import com.genersoft.iot.vmp.vmanager.bean.WVPResult; |
| 22 | import com.github.pagehelper.PageInfo; | 22 | import com.github.pagehelper.PageInfo; |
| 23 | -import io.swagger.annotations.Api; | ||
| 24 | -import io.swagger.annotations.ApiImplicitParam; | ||
| 25 | -import io.swagger.annotations.ApiImplicitParams; | ||
| 26 | -import io.swagger.annotations.ApiOperation; | 23 | + |
| 24 | +import io.swagger.v3.oas.annotations.Operation; | ||
| 25 | +import io.swagger.v3.oas.annotations.Parameter; | ||
| 26 | +import io.swagger.v3.oas.annotations.tags.Tag; | ||
| 27 | import org.apache.poi.sl.usermodel.Sheet; | 27 | import org.apache.poi.sl.usermodel.Sheet; |
| 28 | import org.slf4j.Logger; | 28 | import org.slf4j.Logger; |
| 29 | import org.slf4j.LoggerFactory; | 29 | import org.slf4j.LoggerFactory; |
| @@ -44,7 +44,7 @@ import java.util.List; | @@ -44,7 +44,7 @@ import java.util.List; | ||
| 44 | import java.util.Map; | 44 | import java.util.Map; |
| 45 | import java.util.UUID; | 45 | import java.util.UUID; |
| 46 | 46 | ||
| 47 | -@Api(tags = "推流信息管理") | 47 | +@Tag(name = "推流信息管理") |
| 48 | @Controller | 48 | @Controller |
| 49 | @CrossOrigin | 49 | @CrossOrigin |
| 50 | @RequestMapping(value = "/api/push") | 50 | @RequestMapping(value = "/api/push") |
| @@ -67,16 +67,14 @@ public class StreamPushController { | @@ -67,16 +67,14 @@ public class StreamPushController { | ||
| 67 | @Autowired | 67 | @Autowired |
| 68 | private UserSetting userSetting; | 68 | private UserSetting userSetting; |
| 69 | 69 | ||
| 70 | - @ApiOperation("推流列表查询") | ||
| 71 | - @ApiImplicitParams({ | ||
| 72 | - @ApiImplicitParam(name="page", value = "当前页", required = true, dataTypeClass = Integer.class), | ||
| 73 | - @ApiImplicitParam(name="count", value = "每页查询数量", required = true, dataTypeClass = Integer.class), | ||
| 74 | - @ApiImplicitParam(name="query", value = "查询内容", dataTypeClass = String.class), | ||
| 75 | - @ApiImplicitParam(name="pushing", value = "是否正在推流", dataTypeClass = Boolean.class), | ||
| 76 | - @ApiImplicitParam(name="mediaServerId", value = "流媒体ID", dataTypeClass = String.class), | ||
| 77 | - }) | ||
| 78 | @GetMapping(value = "/list") | 70 | @GetMapping(value = "/list") |
| 79 | @ResponseBody | 71 | @ResponseBody |
| 72 | + @Operation(summary = "推流列表查询") | ||
| 73 | + @Parameter(name = "page", description = "当前页") | ||
| 74 | + @Parameter(name = "count", description = "每页查询数量") | ||
| 75 | + @Parameter(name = "query", description = "查询内容") | ||
| 76 | + @Parameter(name = "pushing", description = "是否正在推流") | ||
| 77 | + @Parameter(name = "mediaServerId", description = "流媒体ID") | ||
| 80 | public PageInfo<StreamPushItem> list(@RequestParam(required = false)Integer page, | 78 | public PageInfo<StreamPushItem> list(@RequestParam(required = false)Integer page, |
| 81 | @RequestParam(required = false)Integer count, | 79 | @RequestParam(required = false)Integer count, |
| 82 | @RequestParam(required = false)String query, | 80 | @RequestParam(required = false)String query, |
| @@ -93,12 +91,9 @@ public class StreamPushController { | @@ -93,12 +91,9 @@ public class StreamPushController { | ||
| 93 | return pushList; | 91 | return pushList; |
| 94 | } | 92 | } |
| 95 | 93 | ||
| 96 | - @ApiOperation("将推流添加到国标") | ||
| 97 | - @ApiImplicitParams({ | ||
| 98 | - @ApiImplicitParam(name = "stream", value = "直播流关联国标平台", dataTypeClass = GbStream.class), | ||
| 99 | - }) | ||
| 100 | @PostMapping(value = "/save_to_gb") | 94 | @PostMapping(value = "/save_to_gb") |
| 101 | @ResponseBody | 95 | @ResponseBody |
| 96 | + @Operation(summary = "将推流添加到国标") | ||
| 102 | public Object saveToGB(@RequestBody GbStream stream){ | 97 | public Object saveToGB(@RequestBody GbStream stream){ |
| 103 | if (streamPushService.saveToGB(stream)){ | 98 | if (streamPushService.saveToGB(stream)){ |
| 104 | return "success"; | 99 | return "success"; |
| @@ -108,12 +103,9 @@ public class StreamPushController { | @@ -108,12 +103,9 @@ public class StreamPushController { | ||
| 108 | } | 103 | } |
| 109 | 104 | ||
| 110 | 105 | ||
| 111 | - @ApiOperation("将推流移出到国标") | ||
| 112 | - @ApiImplicitParams({ | ||
| 113 | - @ApiImplicitParam(name = "stream", value = "直播流关联国标平台", dataTypeClass = GbStream.class), | ||
| 114 | - }) | ||
| 115 | @DeleteMapping(value = "/remove_form_gb") | 106 | @DeleteMapping(value = "/remove_form_gb") |
| 116 | @ResponseBody | 107 | @ResponseBody |
| 108 | + @Operation(summary = "将推流移出到国标") | ||
| 117 | public Object removeFormGB(@RequestBody GbStream stream){ | 109 | public Object removeFormGB(@RequestBody GbStream stream){ |
| 118 | if (streamPushService.removeFromGB(stream)){ | 110 | if (streamPushService.removeFromGB(stream)){ |
| 119 | return "success"; | 111 | return "success"; |
| @@ -123,13 +115,11 @@ public class StreamPushController { | @@ -123,13 +115,11 @@ public class StreamPushController { | ||
| 123 | } | 115 | } |
| 124 | 116 | ||
| 125 | 117 | ||
| 126 | - @ApiOperation("中止一个推流") | ||
| 127 | - @ApiImplicitParams({ | ||
| 128 | - @ApiImplicitParam(name = "app", value = "应用名", required = true, dataTypeClass = String.class), | ||
| 129 | - @ApiImplicitParam(name = "streamId", value = "流ID", required = true, dataTypeClass = String.class), | ||
| 130 | - }) | ||
| 131 | @PostMapping(value = "/stop") | 118 | @PostMapping(value = "/stop") |
| 132 | @ResponseBody | 119 | @ResponseBody |
| 120 | + @Operation(summary = "中止一个推流") | ||
| 121 | + @Parameter(name = "app", description = "应用名", required = true) | ||
| 122 | + @Parameter(name = "stream", description = "流id", required = true) | ||
| 133 | public Object stop(String app, String streamId){ | 123 | public Object stop(String app, String streamId){ |
| 134 | if (streamPushService.stop(app, streamId)){ | 124 | if (streamPushService.stop(app, streamId)){ |
| 135 | return "success"; | 125 | return "success"; |
| @@ -138,13 +128,9 @@ public class StreamPushController { | @@ -138,13 +128,9 @@ public class StreamPushController { | ||
| 138 | } | 128 | } |
| 139 | } | 129 | } |
| 140 | 130 | ||
| 141 | - @ApiOperation("中止多个推流") | ||
| 142 | - @ApiImplicitParams({ | ||
| 143 | - @ApiImplicitParam(name = "app", value = "应用名", required = true, dataTypeClass = String.class), | ||
| 144 | - @ApiImplicitParam(name = "streamId", value = "流ID", required = true, dataTypeClass = String.class), | ||
| 145 | - }) | ||
| 146 | @DeleteMapping(value = "/batchStop") | 131 | @DeleteMapping(value = "/batchStop") |
| 147 | @ResponseBody | 132 | @ResponseBody |
| 133 | + @Operation(summary = "中止多个推流") | ||
| 148 | public Object batchStop(@RequestBody BatchGBStreamParam batchGBStreamParam){ | 134 | public Object batchStop(@RequestBody BatchGBStreamParam batchGBStreamParam){ |
| 149 | if (batchGBStreamParam.getGbStreams().size() == 0) { | 135 | if (batchGBStreamParam.getGbStreams().size() == 0) { |
| 150 | return "fail"; | 136 | return "fail"; |
| @@ -256,14 +242,12 @@ public class StreamPushController { | @@ -256,14 +242,12 @@ public class StreamPushController { | ||
| 256 | * @param stream 流id | 242 | * @param stream 流id |
| 257 | * @return | 243 | * @return |
| 258 | */ | 244 | */ |
| 259 | - @ApiOperation("获取推流播放地址") | ||
| 260 | - @ApiImplicitParams({ | ||
| 261 | - @ApiImplicitParam(name = "app", value = "应用名", dataTypeClass = String.class), | ||
| 262 | - @ApiImplicitParam(name = "stream", value = "流id", dataTypeClass = String.class), | ||
| 263 | - @ApiImplicitParam(name = "mediaServerId", value = "媒体服务器id", dataTypeClass = String.class, required = false), | ||
| 264 | - }) | ||
| 265 | @GetMapping(value = "/getPlayUrl") | 245 | @GetMapping(value = "/getPlayUrl") |
| 266 | @ResponseBody | 246 | @ResponseBody |
| 247 | + @Operation(summary = "获取推流播放地址") | ||
| 248 | + @Parameter(name = "app", description = "应用名", required = true) | ||
| 249 | + @Parameter(name = "stream", description = "流id", required = true) | ||
| 250 | + @Parameter(name = "mediaServerId", description = "媒体服务器id") | ||
| 267 | public WVPResult<StreamInfo> getPlayUrl(@RequestParam String app,@RequestParam String stream, | 251 | public WVPResult<StreamInfo> getPlayUrl(@RequestParam String app,@RequestParam String stream, |
| 268 | @RequestParam(required = false) String mediaServerId){ | 252 | @RequestParam(required = false) String mediaServerId){ |
| 269 | boolean authority = false; | 253 | boolean authority = false; |
| @@ -297,12 +281,9 @@ public class StreamPushController { | @@ -297,12 +281,9 @@ public class StreamPushController { | ||
| 297 | * @param stream 推流信息 | 281 | * @param stream 推流信息 |
| 298 | * @return | 282 | * @return |
| 299 | */ | 283 | */ |
| 300 | - @ApiOperation("获取推流播放地址") | ||
| 301 | - @ApiImplicitParams({ | ||
| 302 | - @ApiImplicitParam(name = "stream", value = "推流信息", dataTypeClass = StreamPushItem.class), | ||
| 303 | - }) | ||
| 304 | @PostMapping(value = "/add") | 284 | @PostMapping(value = "/add") |
| 305 | @ResponseBody | 285 | @ResponseBody |
| 286 | + @Operation(summary = "停止视频回放") | ||
| 306 | public WVPResult<StreamInfo> add(@RequestBody StreamPushItem stream){ | 287 | public WVPResult<StreamInfo> add(@RequestBody StreamPushItem stream){ |
| 307 | if (StringUtils.isEmpty(stream.getGbId())) { | 288 | if (StringUtils.isEmpty(stream.getGbId())) { |
| 308 | 289 |
src/main/java/com/genersoft/iot/vmp/vmanager/user/RoleController.java
| @@ -5,10 +5,10 @@ import com.genersoft.iot.vmp.service.IRoleService; | @@ -5,10 +5,10 @@ import com.genersoft.iot.vmp.service.IRoleService; | ||
| 5 | import com.genersoft.iot.vmp.storager.dao.dto.Role; | 5 | import com.genersoft.iot.vmp.storager.dao.dto.Role; |
| 6 | import com.genersoft.iot.vmp.utils.DateUtil; | 6 | import com.genersoft.iot.vmp.utils.DateUtil; |
| 7 | import com.genersoft.iot.vmp.vmanager.bean.WVPResult; | 7 | import com.genersoft.iot.vmp.vmanager.bean.WVPResult; |
| 8 | -import io.swagger.annotations.Api; | ||
| 9 | -import io.swagger.annotations.ApiImplicitParam; | ||
| 10 | -import io.swagger.annotations.ApiImplicitParams; | ||
| 11 | -import io.swagger.annotations.ApiOperation; | 8 | + |
| 9 | +import io.swagger.v3.oas.annotations.Operation; | ||
| 10 | +import io.swagger.v3.oas.annotations.Parameter; | ||
| 11 | +import io.swagger.v3.oas.annotations.tags.Tag; | ||
| 12 | import org.springframework.beans.factory.annotation.Autowired; | 12 | import org.springframework.beans.factory.annotation.Autowired; |
| 13 | import org.springframework.http.HttpStatus; | 13 | import org.springframework.http.HttpStatus; |
| 14 | import org.springframework.http.ResponseEntity; | 14 | import org.springframework.http.ResponseEntity; |
| @@ -16,7 +16,7 @@ import org.springframework.web.bind.annotation.*; | @@ -16,7 +16,7 @@ import org.springframework.web.bind.annotation.*; | ||
| 16 | 16 | ||
| 17 | import java.util.List; | 17 | import java.util.List; |
| 18 | 18 | ||
| 19 | -@Api(tags = "角色管理") | 19 | +@Tag(name = "角色管理") |
| 20 | @CrossOrigin | 20 | @CrossOrigin |
| 21 | @RestController | 21 | @RestController |
| 22 | @RequestMapping("/api/role") | 22 | @RequestMapping("/api/role") |
| @@ -25,12 +25,10 @@ public class RoleController { | @@ -25,12 +25,10 @@ public class RoleController { | ||
| 25 | @Autowired | 25 | @Autowired |
| 26 | private IRoleService roleService; | 26 | private IRoleService roleService; |
| 27 | 27 | ||
| 28 | - @ApiOperation("添加角色") | ||
| 29 | - @ApiImplicitParams({ | ||
| 30 | - @ApiImplicitParam(name = "name", required = true, value = "角色名", dataTypeClass = String.class), | ||
| 31 | - @ApiImplicitParam(name = "authority", required = true, value = "权限(自行定义内容,目前未使用)", dataTypeClass = String.class), | ||
| 32 | - }) | ||
| 33 | @PostMapping("/add") | 28 | @PostMapping("/add") |
| 29 | + @Operation(summary = "添加角色") | ||
| 30 | + @Parameter(name = "name", description = "角色名", required = true) | ||
| 31 | + @Parameter(name = "authority", description = "权限(自行定义内容,目前未使用)", required = true) | ||
| 34 | public ResponseEntity<WVPResult<Integer>> add(@RequestParam String name, | 32 | public ResponseEntity<WVPResult<Integer>> add(@RequestParam String name, |
| 35 | @RequestParam(required = false) String authority){ | 33 | @RequestParam(required = false) String authority){ |
| 36 | WVPResult<Integer> result = new WVPResult<>(); | 34 | WVPResult<Integer> result = new WVPResult<>(); |
| @@ -57,11 +55,9 @@ public class RoleController { | @@ -57,11 +55,9 @@ public class RoleController { | ||
| 57 | return new ResponseEntity<>(result, HttpStatus.OK); | 55 | return new ResponseEntity<>(result, HttpStatus.OK); |
| 58 | } | 56 | } |
| 59 | 57 | ||
| 60 | - @ApiOperation("删除角色") | ||
| 61 | - @ApiImplicitParams({ | ||
| 62 | - @ApiImplicitParam(name = "id", required = true, value = "用户Id", dataTypeClass = Integer.class), | ||
| 63 | - }) | ||
| 64 | @DeleteMapping("/delete") | 58 | @DeleteMapping("/delete") |
| 59 | + @Operation(summary = "删除角色") | ||
| 60 | + @Parameter(name = "id", description = "用户Id", required = true) | ||
| 65 | public ResponseEntity<WVPResult<String>> delete(@RequestParam Integer id){ | 61 | public ResponseEntity<WVPResult<String>> delete(@RequestParam Integer id){ |
| 66 | // 获取当前登录用户id | 62 | // 获取当前登录用户id |
| 67 | int currenRoleId = SecurityUtils.getUserInfo().getRole().getId(); | 63 | int currenRoleId = SecurityUtils.getUserInfo().getRole().getId(); |
| @@ -79,9 +75,8 @@ public class RoleController { | @@ -79,9 +75,8 @@ public class RoleController { | ||
| 79 | return new ResponseEntity<>(result, HttpStatus.OK); | 75 | return new ResponseEntity<>(result, HttpStatus.OK); |
| 80 | } | 76 | } |
| 81 | 77 | ||
| 82 | - @ApiOperation("查询角色") | ||
| 83 | - @ApiImplicitParams({}) | ||
| 84 | @GetMapping("/all") | 78 | @GetMapping("/all") |
| 79 | + @Operation(summary = "查询角色") | ||
| 85 | public ResponseEntity<WVPResult<List<Role>>> all(){ | 80 | public ResponseEntity<WVPResult<List<Role>>> all(){ |
| 86 | // 获取当前登录用户id | 81 | // 获取当前登录用户id |
| 87 | List<Role> allRoles = roleService.getAll(); | 82 | List<Role> allRoles = roleService.getAll(); |
src/main/java/com/genersoft/iot/vmp/vmanager/user/UserController.java
| @@ -9,10 +9,10 @@ import com.genersoft.iot.vmp.storager.dao.dto.User; | @@ -9,10 +9,10 @@ import com.genersoft.iot.vmp.storager.dao.dto.User; | ||
| 9 | import com.genersoft.iot.vmp.utils.DateUtil; | 9 | import com.genersoft.iot.vmp.utils.DateUtil; |
| 10 | import com.genersoft.iot.vmp.vmanager.bean.WVPResult; | 10 | import com.genersoft.iot.vmp.vmanager.bean.WVPResult; |
| 11 | import com.github.pagehelper.PageInfo; | 11 | import com.github.pagehelper.PageInfo; |
| 12 | -import io.swagger.annotations.Api; | ||
| 13 | -import io.swagger.annotations.ApiImplicitParam; | ||
| 14 | -import io.swagger.annotations.ApiImplicitParams; | ||
| 15 | -import io.swagger.annotations.ApiOperation; | 12 | + |
| 13 | +import io.swagger.v3.oas.annotations.Operation; | ||
| 14 | +import io.swagger.v3.oas.annotations.Parameter; | ||
| 15 | +import io.swagger.v3.oas.annotations.tags.Tag; | ||
| 16 | import org.springframework.beans.factory.annotation.Autowired; | 16 | import org.springframework.beans.factory.annotation.Autowired; |
| 17 | import org.springframework.http.HttpStatus; | 17 | import org.springframework.http.HttpStatus; |
| 18 | import org.springframework.http.ResponseEntity; | 18 | import org.springframework.http.ResponseEntity; |
| @@ -24,7 +24,7 @@ import org.springframework.web.bind.annotation.*; | @@ -24,7 +24,7 @@ import org.springframework.web.bind.annotation.*; | ||
| 24 | import javax.security.sasl.AuthenticationException; | 24 | import javax.security.sasl.AuthenticationException; |
| 25 | import java.util.List; | 25 | import java.util.List; |
| 26 | 26 | ||
| 27 | -@Api(tags = "用户管理") | 27 | +@Tag(name = "用户管理") |
| 28 | @CrossOrigin | 28 | @CrossOrigin |
| 29 | @RestController | 29 | @RestController |
| 30 | @RequestMapping("/api/user") | 30 | @RequestMapping("/api/user") |
| @@ -39,12 +39,10 @@ public class UserController { | @@ -39,12 +39,10 @@ public class UserController { | ||
| 39 | @Autowired | 39 | @Autowired |
| 40 | private IRoleService roleService; | 40 | private IRoleService roleService; |
| 41 | 41 | ||
| 42 | - @ApiOperation("登录") | ||
| 43 | - @ApiImplicitParams({ | ||
| 44 | - @ApiImplicitParam(name = "username", required = true, value = "用户名", dataTypeClass = String.class), | ||
| 45 | - @ApiImplicitParam(name = "password", required = true, value = "密码(32位md5加密)", dataTypeClass = String.class), | ||
| 46 | - }) | ||
| 47 | @GetMapping("/login") | 42 | @GetMapping("/login") |
| 43 | + @Operation(summary = "登录") | ||
| 44 | + @Parameter(name = "username", description = "用户名", required = true) | ||
| 45 | + @Parameter(name = "password", description = "密码(32位md5加密)", required = true) | ||
| 48 | public WVPResult<LoginUser> login(@RequestParam String username, @RequestParam String password){ | 46 | public WVPResult<LoginUser> login(@RequestParam String username, @RequestParam String password){ |
| 49 | LoginUser user = null; | 47 | LoginUser user = null; |
| 50 | WVPResult<LoginUser> result = new WVPResult<>(); | 48 | WVPResult<LoginUser> result = new WVPResult<>(); |
| @@ -66,13 +64,11 @@ public class UserController { | @@ -66,13 +64,11 @@ public class UserController { | ||
| 66 | return result; | 64 | return result; |
| 67 | } | 65 | } |
| 68 | 66 | ||
| 69 | - @ApiOperation("修改密码") | ||
| 70 | - @ApiImplicitParams({ | ||
| 71 | - @ApiImplicitParam(name = "username", required = true, value = "用户名", dataTypeClass = String.class), | ||
| 72 | - @ApiImplicitParam(name = "oldpassword", required = true, value = "旧密码(已md5加密的密码)", dataTypeClass = String.class), | ||
| 73 | - @ApiImplicitParam(name = "password", required = true, value = "新密码(未md5加密的密码)", dataTypeClass = String.class), | ||
| 74 | - }) | ||
| 75 | @PostMapping("/changePassword") | 67 | @PostMapping("/changePassword") |
| 68 | + @Operation(summary = "修改密码") | ||
| 69 | + @Parameter(name = "username", description = "用户名", required = true) | ||
| 70 | + @Parameter(name = "oldpassword", description = "旧密码(已md5加密的密码)", required = true) | ||
| 71 | + @Parameter(name = "password", description = "新密码(未md5加密的密码)", required = true) | ||
| 76 | public String changePassword(@RequestParam String oldPassword, @RequestParam String password){ | 72 | public String changePassword(@RequestParam String oldPassword, @RequestParam String password){ |
| 77 | // 获取当前登录用户id | 73 | // 获取当前登录用户id |
| 78 | LoginUser userInfo = SecurityUtils.getUserInfo(); | 74 | LoginUser userInfo = SecurityUtils.getUserInfo(); |
| @@ -97,13 +93,11 @@ public class UserController { | @@ -97,13 +93,11 @@ public class UserController { | ||
| 97 | } | 93 | } |
| 98 | 94 | ||
| 99 | 95 | ||
| 100 | - @ApiOperation("添加用户") | ||
| 101 | - @ApiImplicitParams({ | ||
| 102 | - @ApiImplicitParam(name = "username", required = true, value = "用户名", dataTypeClass = String.class), | ||
| 103 | - @ApiImplicitParam(name = "password", required = true, value = "密码(未md5加密的密码)", dataTypeClass = String.class), | ||
| 104 | - @ApiImplicitParam(name = "roleId", required = true, value = "角色ID", dataTypeClass = String.class), | ||
| 105 | - }) | ||
| 106 | @PostMapping("/add") | 96 | @PostMapping("/add") |
| 97 | + @Operation(summary = "停止视频回放") | ||
| 98 | + @Parameter(name = "username", description = "用户名", required = true) | ||
| 99 | + @Parameter(name = "password", description = "密码(未md5加密的密码)", required = true) | ||
| 100 | + @Parameter(name = "roleId", description = "角色ID", required = true) | ||
| 107 | public ResponseEntity<WVPResult<Integer>> add(@RequestParam String username, | 101 | public ResponseEntity<WVPResult<Integer>> add(@RequestParam String username, |
| 108 | @RequestParam String password, | 102 | @RequestParam String password, |
| 109 | @RequestParam Integer roleId){ | 103 | @RequestParam Integer roleId){ |
| @@ -146,11 +140,9 @@ public class UserController { | @@ -146,11 +140,9 @@ public class UserController { | ||
| 146 | return new ResponseEntity<>(result, HttpStatus.OK); | 140 | return new ResponseEntity<>(result, HttpStatus.OK); |
| 147 | } | 141 | } |
| 148 | 142 | ||
| 149 | - @ApiOperation("删除用户") | ||
| 150 | - @ApiImplicitParams({ | ||
| 151 | - @ApiImplicitParam(name = "id", required = true, value = "用户Id", dataTypeClass = Integer.class), | ||
| 152 | - }) | ||
| 153 | - @DeleteMapping("/delete") | 143 | + @DeleteMapping("/删除用户") |
| 144 | + @Operation(summary = "停止视频回放") | ||
| 145 | + @Parameter(name = "id", description = "用户Id", required = true) | ||
| 154 | public ResponseEntity<WVPResult<String>> delete(@RequestParam Integer id){ | 146 | public ResponseEntity<WVPResult<String>> delete(@RequestParam Integer id){ |
| 155 | // 获取当前登录用户id | 147 | // 获取当前登录用户id |
| 156 | int currenRoleId = SecurityUtils.getUserInfo().getRole().getId(); | 148 | int currenRoleId = SecurityUtils.getUserInfo().getRole().getId(); |
| @@ -168,9 +160,8 @@ public class UserController { | @@ -168,9 +160,8 @@ public class UserController { | ||
| 168 | return new ResponseEntity<>(result, HttpStatus.OK); | 160 | return new ResponseEntity<>(result, HttpStatus.OK); |
| 169 | } | 161 | } |
| 170 | 162 | ||
| 171 | - @ApiOperation("查询用户") | ||
| 172 | - @ApiImplicitParams({}) | ||
| 173 | @GetMapping("/all") | 163 | @GetMapping("/all") |
| 164 | + @Operation(summary = "查询用户") | ||
| 174 | public ResponseEntity<WVPResult<List<User>>> all(){ | 165 | public ResponseEntity<WVPResult<List<User>>> all(){ |
| 175 | // 获取当前登录用户id | 166 | // 获取当前登录用户id |
| 176 | List<User> allUsers = userService.getAllUsers(); | 167 | List<User> allUsers = userService.getAllUsers(); |
| @@ -188,22 +179,18 @@ public class UserController { | @@ -188,22 +179,18 @@ public class UserController { | ||
| 188 | * @param count 每页查询数量 | 179 | * @param count 每页查询数量 |
| 189 | * @return 分页用户列表 | 180 | * @return 分页用户列表 |
| 190 | */ | 181 | */ |
| 191 | - @ApiOperation("分页查询用户") | ||
| 192 | - @ApiImplicitParams({ | ||
| 193 | - @ApiImplicitParam(name = "page", value = "当前页", required = true, dataTypeClass = Integer.class), | ||
| 194 | - @ApiImplicitParam(name = "count", value = "每页查询数量", required = true, dataTypeClass = Integer.class), | ||
| 195 | - }) | ||
| 196 | @GetMapping("/users") | 182 | @GetMapping("/users") |
| 183 | + @Operation(summary = "分页查询用户") | ||
| 184 | + @Parameter(name = "page", description = "当前页", required = true) | ||
| 185 | + @Parameter(name = "count", description = "每页查询数量", required = true) | ||
| 197 | public PageInfo<User> users(int page, int count) { | 186 | public PageInfo<User> users(int page, int count) { |
| 198 | return userService.getUsers(page, count); | 187 | return userService.getUsers(page, count); |
| 199 | } | 188 | } |
| 200 | 189 | ||
| 201 | - @ApiOperation("修改pushkey") | ||
| 202 | - @ApiImplicitParams({ | ||
| 203 | - @ApiImplicitParam(name = "userId", required = true, value = "用户Id", dataTypeClass = Integer.class), | ||
| 204 | - @ApiImplicitParam(name = "pushKey", required = true, value = "新的pushKey", dataTypeClass = String.class), | ||
| 205 | - }) | ||
| 206 | @RequestMapping("/changePushKey") | 190 | @RequestMapping("/changePushKey") |
| 191 | + @Operation(summary = "修改pushkey") | ||
| 192 | + @Parameter(name = "userId", description = "用户Id", required = true) | ||
| 193 | + @Parameter(name = "pushKey", description = "新的pushKey", required = true) | ||
| 207 | public ResponseEntity<WVPResult<String>> changePushKey(@RequestParam Integer userId,@RequestParam String pushKey) { | 194 | public ResponseEntity<WVPResult<String>> changePushKey(@RequestParam Integer userId,@RequestParam String pushKey) { |
| 208 | // 获取当前登录用户id | 195 | // 获取当前登录用户id |
| 209 | int currenRoleId = SecurityUtils.getUserInfo().getRole().getId(); | 196 | int currenRoleId = SecurityUtils.getUserInfo().getRole().getId(); |
| @@ -221,13 +208,11 @@ public class UserController { | @@ -221,13 +208,11 @@ public class UserController { | ||
| 221 | return new ResponseEntity<>(result, HttpStatus.OK); | 208 | return new ResponseEntity<>(result, HttpStatus.OK); |
| 222 | } | 209 | } |
| 223 | 210 | ||
| 224 | - @ApiOperation("管理员修改普通用户密码") | ||
| 225 | - @ApiImplicitParams({ | ||
| 226 | - @ApiImplicitParam(name = "adminId", required = true, value = "管理员id", dataTypeClass = String.class), | ||
| 227 | - @ApiImplicitParam(name = "userId", required = true, value = "用户id", dataTypeClass = String.class), | ||
| 228 | - @ApiImplicitParam(name = "password", required = true, value = "新密码(未md5加密的密码)", dataTypeClass = String.class), | ||
| 229 | - }) | ||
| 230 | @PostMapping("/changePasswordForAdmin") | 211 | @PostMapping("/changePasswordForAdmin") |
| 212 | + @Operation(summary = "管理员修改普通用户密码") | ||
| 213 | + @Parameter(name = "adminId", description = "管理员id", required = true) | ||
| 214 | + @Parameter(name = "userId", description = "用户id", required = true) | ||
| 215 | + @Parameter(name = "password", description = "新密码(未md5加密的密码)", required = true) | ||
| 231 | public String changePasswordForAdmin(@RequestParam int userId, @RequestParam String password) { | 216 | public String changePasswordForAdmin(@RequestParam int userId, @RequestParam String password) { |
| 232 | // 获取当前登录用户id | 217 | // 获取当前登录用户id |
| 233 | LoginUser userInfo = SecurityUtils.getUserInfo(); | 218 | LoginUser userInfo = SecurityUtils.getUserInfo(); |
src/main/resources/all-application.yml
src/main/resources/application-docker.yml
src/test/java/com/genersoft/iot/vmp/service/impl/DeviceAlarmServiceImplTest.java deleted
100644 → 0
| 1 | -package com.genersoft.iot.vmp.service.impl; | ||
| 2 | - | ||
| 3 | -import com.genersoft.iot.vmp.gb28181.bean.DeviceAlarm; | ||
| 4 | -import com.genersoft.iot.vmp.service.IDeviceAlarmService; | ||
| 5 | -import com.genersoft.iot.vmp.utils.DateUtil; | ||
| 6 | -import org.junit.runner.RunWith; | ||
| 7 | -import org.springframework.boot.test.context.SpringBootTest; | ||
| 8 | -import org.springframework.test.context.junit4.SpringRunner; | ||
| 9 | - | ||
| 10 | -import javax.annotation.Resource; | ||
| 11 | -import java.time.Instant; | ||
| 12 | -import java.time.LocalDateTime; | ||
| 13 | -import java.time.ZoneOffset; | ||
| 14 | -import java.time.temporal.TemporalAccessor; | ||
| 15 | -import java.util.Date; | ||
| 16 | - | ||
| 17 | - | ||
| 18 | -@SpringBootTest | ||
| 19 | -@RunWith(SpringRunner.class) | ||
| 20 | -class DeviceAlarmServiceImplTest { | ||
| 21 | - | ||
| 22 | - @Resource | ||
| 23 | - private IDeviceAlarmService deviceAlarmService; | ||
| 24 | - | ||
| 25 | - @org.junit.jupiter.api.Test | ||
| 26 | - void getAllAlarm() { | ||
| 27 | -// deviceAlarmService.getAllAlarm(0, 10000, "11111111111111111111",null,null,null, null, null); | ||
| 28 | -// System.out.println(deviceAlarmService.getAllAlarm(0, 10000, null, null, null, null, | ||
| 29 | -// null, null).getSize()); | ||
| 30 | -// | ||
| 31 | -// System.out.println(deviceAlarmService.getAllAlarm(0, 10000, "11111111111111111111", null, null, null, | ||
| 32 | -// null, null).getSize()); | ||
| 33 | -// | ||
| 34 | -// System.out.println(deviceAlarmService.getAllAlarm(0, 10000, "11111111111111111111", "1", null, null, | ||
| 35 | -// null, null).getSize()); | ||
| 36 | -// | ||
| 37 | -// System.out.println(deviceAlarmService.getAllAlarm(0, 10000, "11111111111111111111", "2", null, null, | ||
| 38 | -// null, null).getSize()); | ||
| 39 | -// | ||
| 40 | -// System.out.println(deviceAlarmService.getAllAlarm(0, 10000, "11111111111111111111", "3", null, null, | ||
| 41 | -// null, null).getSize()); | ||
| 42 | -// | ||
| 43 | -// System.out.println(deviceAlarmService.getAllAlarm(0, 10000, "11111111111111111111", "4", null, null, | ||
| 44 | -// null, null).getSize()); | ||
| 45 | -// | ||
| 46 | -// System.out.println(deviceAlarmService.getAllAlarm(0, 10000, "11111111111111111111", "5", null, null, | ||
| 47 | -// null, null).getSize()); | ||
| 48 | -// | ||
| 49 | -// System.out.println(deviceAlarmService.getAllAlarm(0, 10000, "11111111111111111111", null, "1", null, | ||
| 50 | -// null, null).getSize()); | ||
| 51 | - | ||
| 52 | -// System.out.println(deviceAlarmService.getAllAlarm(0, 10000, "11111111111111111111", null, "1", null, | ||
| 53 | -// null, null).getSize()); | ||
| 54 | - | ||
| 55 | - | ||
| 56 | - } | ||
| 57 | - | ||
| 58 | - | ||
| 59 | - @org.junit.jupiter.api.Test | ||
| 60 | - void add() { | ||
| 61 | - for (int i = 0; i < 1000; i++) { | ||
| 62 | - DeviceAlarm deviceAlarm = new DeviceAlarm(); | ||
| 63 | - deviceAlarm.setDeviceId("11111111111111111111"); | ||
| 64 | - deviceAlarm.setAlarmDescription("test_" + i); | ||
| 65 | - | ||
| 66 | - /** | ||
| 67 | - * 报警方式 , 1为电话报警, 2为设备报警, 3为短信报警, 4为 GPS报警, 5为视频报警, 6为设备故障报警, | ||
| 68 | - * * 7其他报警;可以为直接组合如12为电话报警或 设备报警- | ||
| 69 | - */ | ||
| 70 | - deviceAlarm.setAlarmMethod((int)(Math.random()*7 + 1) + ""); | ||
| 71 | - Instant date = randomDate("2021-01-01 00:00:00", "2021-06-01 00:00:00"); | ||
| 72 | - deviceAlarm.setAlarmTime(DateUtil.formatter.format(date)); | ||
| 73 | - /** | ||
| 74 | - * 报警级别, 1为一级警情, 2为二级警情, 3为三级警情, 4为四级 警情- | ||
| 75 | - */ | ||
| 76 | - deviceAlarm.setAlarmPriority((int)(Math.random()*4 + 1) + ""); | ||
| 77 | - deviceAlarm.setLongitude(116.325); | ||
| 78 | - deviceAlarm.setLatitude(39.562); | ||
| 79 | - deviceAlarmService.add(deviceAlarm); | ||
| 80 | - } | ||
| 81 | - | ||
| 82 | - } | ||
| 83 | - | ||
| 84 | - @org.junit.jupiter.api.Test | ||
| 85 | - void clearAlarmBeforeTime() { | ||
| 86 | - deviceAlarmService.clearAlarmBeforeTime(null,null, null); | ||
| 87 | - } | ||
| 88 | - | ||
| 89 | - | ||
| 90 | - | ||
| 91 | - | ||
| 92 | - private Instant randomDate(String beginDate, String endDate) { | ||
| 93 | - try { | ||
| 94 | - | ||
| 95 | - //构造开始日期 | ||
| 96 | - LocalDateTime start = LocalDateTime.parse(beginDate, DateUtil.formatter); | ||
| 97 | - | ||
| 98 | - //构造结束日期 | ||
| 99 | - LocalDateTime end = LocalDateTime.parse(endDate, DateUtil.formatter); | ||
| 100 | - //getTime()表示返回自 1970 年 1 月 1 日 00:00:00 GMT 以来此 Date 对象表示的毫秒数。 | ||
| 101 | - if (start.isAfter(end)) { | ||
| 102 | - return null; | ||
| 103 | - } | ||
| 104 | - long date = random(start.toInstant(ZoneOffset.of("+8")).toEpochMilli(), end.toInstant(ZoneOffset.of("+8")).toEpochMilli()); | ||
| 105 | - return Instant.ofEpochMilli(date); | ||
| 106 | - } catch (Exception e) { | ||
| 107 | - e.printStackTrace(); | ||
| 108 | - } | ||
| 109 | - return null; | ||
| 110 | - } | ||
| 111 | - | ||
| 112 | - private static long random(long begin, long end) { | ||
| 113 | - long rtn = begin + (long) (Math.random() * (end - begin)); | ||
| 114 | - //如果返回的是开始时间和结束时间,则递归调用本函数查找随机值 | ||
| 115 | - if (rtn == begin || rtn == end) { | ||
| 116 | - return random(begin, end); | ||
| 117 | - } | ||
| 118 | - return rtn; | ||
| 119 | - } | ||
| 120 | -} | ||
| 121 | \ No newline at end of file | 0 | \ No newline at end of file |
src/test/java/com/genersoft/iot/vmp/service/impl/RoleServiceImplTest.java deleted
100644 → 0
| 1 | -package com.genersoft.iot.vmp.service.impl; | ||
| 2 | - | ||
| 3 | -import com.genersoft.iot.vmp.service.IRoleService; | ||
| 4 | -import com.genersoft.iot.vmp.service.IUserService; | ||
| 5 | -import com.genersoft.iot.vmp.storager.dao.dto.Role; | ||
| 6 | -import com.genersoft.iot.vmp.storager.dao.dto.User; | ||
| 7 | -import com.genersoft.iot.vmp.utils.DateUtil; | ||
| 8 | -import org.junit.runner.RunWith; | ||
| 9 | -import org.springframework.boot.test.context.SpringBootTest; | ||
| 10 | -import org.springframework.test.context.junit4.SpringRunner; | ||
| 11 | - | ||
| 12 | -import javax.annotation.Resource; | ||
| 13 | -import java.util.List; | ||
| 14 | - | ||
| 15 | - | ||
| 16 | -@SpringBootTest | ||
| 17 | -@RunWith(SpringRunner.class) | ||
| 18 | -class RoleServiceImplTest { | ||
| 19 | - | ||
| 20 | - @Resource | ||
| 21 | - private IRoleService roleService; | ||
| 22 | - | ||
| 23 | - @org.junit.jupiter.api.Test | ||
| 24 | - void getAllUser() { | ||
| 25 | - List<Role> all = roleService.getAll(); | ||
| 26 | - Role roleById = roleService.getRoleById(1); | ||
| 27 | - | ||
| 28 | - } | ||
| 29 | - | ||
| 30 | - | ||
| 31 | - @org.junit.jupiter.api.Test | ||
| 32 | - void add() { | ||
| 33 | - for (int i = 0; i < 10; i++) { | ||
| 34 | - Role role = new Role(); | ||
| 35 | - role.setName("test+" + i); | ||
| 36 | - role.setAuthority("adadadda"); | ||
| 37 | - role.setCreateTime(DateUtil.getNow()); | ||
| 38 | - role.setUpdateTime(DateUtil.getNow()); | ||
| 39 | - roleService.add(role); | ||
| 40 | - } | ||
| 41 | - } | ||
| 42 | - | ||
| 43 | - @org.junit.jupiter.api.Test | ||
| 44 | - void delete() { | ||
| 45 | - roleService.delete(20); | ||
| 46 | - } | ||
| 47 | - | ||
| 48 | - @org.junit.jupiter.api.Test | ||
| 49 | - void update() { | ||
| 50 | - Role role = new Role(); | ||
| 51 | - role.setId(21); | ||
| 52 | - role.setName("TTTTTT"); | ||
| 53 | - role.setAuthority("adadadda"); | ||
| 54 | - roleService.update(role); | ||
| 55 | - } | ||
| 56 | -} | ||
| 57 | \ No newline at end of file | 0 | \ No newline at end of file |
src/test/java/com/genersoft/iot/vmp/service/impl/UserServiceImplTest.java deleted
100644 → 0
| 1 | -package com.genersoft.iot.vmp.service.impl; | ||
| 2 | - | ||
| 3 | -import com.genersoft.iot.vmp.service.IUserService; | ||
| 4 | -import com.genersoft.iot.vmp.storager.dao.dto.Role; | ||
| 5 | -import com.genersoft.iot.vmp.storager.dao.dto.User; | ||
| 6 | -import com.genersoft.iot.vmp.utils.DateUtil; | ||
| 7 | -import org.junit.runner.RunWith; | ||
| 8 | -import org.springframework.boot.test.context.SpringBootTest; | ||
| 9 | -import org.springframework.test.context.junit4.SpringRunner; | ||
| 10 | - | ||
| 11 | -import javax.annotation.Resource; | ||
| 12 | -import java.util.List; | ||
| 13 | - | ||
| 14 | - | ||
| 15 | -@SpringBootTest | ||
| 16 | -@RunWith(SpringRunner.class) | ||
| 17 | -class UserServiceImplTest { | ||
| 18 | - | ||
| 19 | - @Resource | ||
| 20 | - private IUserService userService; | ||
| 21 | - | ||
| 22 | - | ||
| 23 | - @org.junit.jupiter.api.Test | ||
| 24 | - void getAllUser() { | ||
| 25 | - List<User> allUsers = userService.getAllUsers(); | ||
| 26 | - User admin = userService.getUser("admin", "21232f297a57a5a743894a0e4a801fc3"); | ||
| 27 | - User admin1 = userService.getUserByUsername("admin"); | ||
| 28 | - } | ||
| 29 | - | ||
| 30 | - | ||
| 31 | - @org.junit.jupiter.api.Test | ||
| 32 | - void add() { | ||
| 33 | - for (int i = 0; i < 10; i++) { | ||
| 34 | - User user = new User(); | ||
| 35 | - user.setUsername("admin_" + i); | ||
| 36 | - user.setPassword("admin_password_" + i); | ||
| 37 | - | ||
| 38 | - Role role = new Role(); | ||
| 39 | - role.setId(1); | ||
| 40 | - user.setRole(role); | ||
| 41 | - user.setCreateTime(DateUtil.getNow()); | ||
| 42 | - user.setUpdateTime(DateUtil.getNow()); | ||
| 43 | - userService.addUser(user); | ||
| 44 | - } | ||
| 45 | - } | ||
| 46 | - | ||
| 47 | - @org.junit.jupiter.api.Test | ||
| 48 | - void delete() { | ||
| 49 | - userService.deleteUser(1002); | ||
| 50 | - } | ||
| 51 | - | ||
| 52 | - @org.junit.jupiter.api.Test | ||
| 53 | - void update() { | ||
| 54 | - User user = new User(); | ||
| 55 | - user.setId(11); | ||
| 56 | - user.setUsername("update" ); | ||
| 57 | - user.setPassword("update"); | ||
| 58 | - Role role = new Role(); | ||
| 59 | - role.setId(2); | ||
| 60 | - user.setRole(role); | ||
| 61 | - user.setUpdateTime(DateUtil.getNow()); | ||
| 62 | - userService.updateUsers(user); | ||
| 63 | - } | ||
| 64 | - | ||
| 65 | - | ||
| 66 | -} | ||
| 67 | \ No newline at end of file | 0 | \ No newline at end of file |