Commit 1a9e49d9ff210e39f6297150db758906a4f02e6f

Authored by 648540858
1 parent 8f77d0c2

依赖包版本升级

Showing 54 changed files with 1151 additions and 1487 deletions
... ... @@ -6,7 +6,7 @@
6 6 <parent>
7 7 <groupId>org.springframework.boot</groupId>
8 8 <artifactId>spring-boot-starter-parent</artifactId>
9   - <version>2.3.5.RELEASE</version>
  9 + <version>2.7.2</version>
10 10 </parent>
11 11  
12 12 <groupId>com.genersoft</groupId>
... ... @@ -47,7 +47,6 @@
47 47 <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
48 48 <maven.build.timestamp.format>MMddHHmm</maven.build.timestamp.format>
49 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 52 <snippetsDirectory>${project.build.directory}/generated-snippets</snippetsDirectory>
... ... @@ -74,7 +73,7 @@
74 73 <dependency>
75 74 <groupId>org.mybatis.spring.boot</groupId>
76 75 <artifactId>mybatis-spring-boot-starter</artifactId>
77   - <version>2.1.4</version>
  76 + <version>2.2.2</version>
78 77 <exclusions>
79 78 <exclusion>
80 79 <groupId>com.zaxxer</groupId>
... ... @@ -91,37 +90,36 @@
91 90 <dependency>
92 91 <groupId>com.alibaba</groupId>
93 92 <artifactId>druid-spring-boot-starter</artifactId>
94   - <version>1.1.22</version>
  93 + <version>1.2.11</version>
95 94 </dependency>
96 95  
97 96 <!-- mysql数据库 -->
98 97 <dependency>
99 98 <groupId>mysql</groupId>
100 99 <artifactId>mysql-connector-java</artifactId>
101   - <version>8.0.22</version>
  100 + <version>8.0.30</version>
102 101 </dependency>
103 102  
104 103 <!--Mybatis分页插件 -->
105 104 <dependency>
106 105 <groupId>com.github.pagehelper</groupId>
107 106 <artifactId>pagehelper-spring-boot-starter</artifactId>
108   - <version>1.4.1</version>
  107 + <version>1.4.3</version>
109 108 </dependency>
110 109  
111   - <!--Swagger3 -->
112 110 <!--在线文档 -->
113 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 115 </dependency>
  116 +
118 117 <dependency>
119 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 121 </dependency>
123 122  
124   -
125 123 <!--参数校验 -->
126 124 <dependency>
127 125 <groupId>javax.validation</groupId>
... ... @@ -145,7 +143,7 @@
145 143 <dependency>
146 144 <groupId>org.slf4j</groupId>
147 145 <artifactId>log4j-over-slf4j</artifactId>
148   - <version>1.7.35</version>
  146 + <version>1.7.36</version>
149 147 </dependency>
150 148  
151 149 <!-- xml解析库 -->
... ... @@ -167,14 +165,14 @@
167 165 <dependency>
168 166 <groupId>com.squareup.okhttp3</groupId>
169 167 <artifactId>okhttp</artifactId>
170   - <version>4.9.0</version>
  168 + <version>4.10.0</version>
171 169 </dependency>
172 170  
173 171 <!-- okhttp 调试日志 -->
174 172 <dependency>
175 173 <groupId>com.squareup.okhttp3</groupId>
176 174 <artifactId>logging-interceptor</artifactId>
177   - <version>4.9.0</version>
  175 + <version>4.10.0</version>
178 176 </dependency>
179 177  
180 178  
... ... @@ -183,7 +181,7 @@
183 181 <dependency>
184 182 <groupId>io.github.rburgst</groupId>
185 183 <artifactId>okhttp-digest</artifactId>
186   - <version>2.5</version>
  184 + <version>2.7</version>
187 185 </dependency>
188 186  
189 187 <!-- https://mvnrepository.com/artifact/net.sf.kxml/kxml2 -->
... ... @@ -197,21 +195,21 @@
197 195 <dependency>
198 196 <groupId>org.mitre.dsmiley.httpproxy</groupId>
199 197 <artifactId>smiley-http-proxy-servlet</artifactId>
200   - <version>1.12</version>
  198 + <version>1.12.1</version>
201 199 </dependency>
202 200  
203 201 <!--excel解析库-->
204 202 <dependency>
205 203 <groupId>com.alibaba</groupId>
206 204 <artifactId>easyexcel</artifactId>
207   - <version>3.0.4</version>
  205 + <version>3.1.1</version>
208 206 </dependency>
209 207  
210 208 <!-- 获取系统信息 -->
211 209 <dependency>
212 210 <groupId>com.github.oshi</groupId>
213 211 <artifactId>oshi-core</artifactId>
214   - <version>6.1.0</version>
  212 + <version>6.2.2</version>
215 213 </dependency>
216 214  
217 215 <dependency>
... ... @@ -231,7 +229,7 @@
231 229 <dependency>
232 230 <groupId>com.google.guava</groupId>
233 231 <artifactId>guava</artifactId>
234   - <version>31.0.1-jre</version>
  232 + <version>31.1-jre</version>
235 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 8 import org.springframework.boot.web.servlet.ServletComponentScan;
9 9 import org.springframework.context.ConfigurableApplicationContext;
10 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 15 @ServletComponentScan("com.genersoft.iot.vmp.conf")
17 16 @SpringBootApplication
18 17 @EnableScheduling
19   -@EnableOpenApi
20 18 @EnableDruidSupport
21 19 public class VManageBootstrap extends LogManager {
22 20 private static String[] args;
... ...
src/main/java/com/genersoft/iot/vmp/common/StreamInfo.java
1 1 package com.genersoft.iot.vmp.common;
2 2  
3   -import com.alibaba.fastjson.JSONArray;
4 3  
5 4 public class StreamInfo {
6 5  
... ...
src/main/java/com/genersoft/iot/vmp/conf/DynamicTask.java
... ... @@ -9,6 +9,7 @@ import org.springframework.scheduling.annotation.Scheduled;
9 9 import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler;
10 10 import org.springframework.stereotype.Component;
11 11  
  12 +import javax.annotation.PostConstruct;
12 13 import java.time.Instant;
13 14 import java.util.Map;
14 15 import java.util.Set;
... ... @@ -25,20 +26,18 @@ public class DynamicTask {
25 26  
26 27 private final Logger logger = LoggerFactory.getLogger(DynamicTask.class);
27 28  
28   - @Autowired
29 29 private ThreadPoolTaskScheduler threadPoolTaskScheduler;
30 30  
31 31 private final Map<String, ScheduledFuture<?>> futureMap = new ConcurrentHashMap<>();
32 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 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 8 * @author lin
7 9 */
  10 +@Schema(description = "国标设备/平台")
8 11 public class Device {
9 12  
10 13 /**
11   - * 设备Id
  14 + * 设备国标编号
12 15 */
  16 + @Schema(description = "设备国标编号")
13 17 private String deviceId;
14 18  
15 19 /**
16 20 * 设备名
17 21 */
  22 + @Schema(description = "名称")
18 23 private String name;
19 24  
20 25 /**
21 26 * 生产厂商
22 27 */
  28 + @Schema(description = "生产厂商")
23 29 private String manufacturer;
24 30  
25 31 /**
26 32 * 型号
27 33 */
  34 + @Schema(description = "型号")
28 35 private String model;
29 36  
30 37 /**
31 38 * 固件版本
32 39 */
  40 + @Schema(description = "固件版本")
33 41 private String firmware;
34 42  
35 43 /**
36 44 * 传输协议
37 45 * UDP/TCP
38 46 */
  47 + @Schema(description = "传输协议(UDP/TCP)")
39 48 private String transport;
40 49  
41 50 /**
... ... @@ -44,103 +53,123 @@ public class Device {
44 53 * TCP-ACTIVE:tcp主动模式
45 54 * TCP-PASSIVE:tcp被动模式
46 55 */
  56 + @Schema(description = "数据流传输模式")
47 57 private String streamMode;
48 58  
49 59 /**
50 60 * wan地址_ip
51 61 */
  62 + @Schema(description = "IP")
52 63 private String ip;
53 64  
54 65 /**
55 66 * wan地址_port
56 67 */
  68 + @Schema(description = "端口")
57 69 private int port;
58 70  
59 71 /**
60 72 * wan地址
61 73 */
  74 + @Schema(description = "wan地址")
62 75 private String hostAddress;
63 76  
64 77 /**
65 78 * 在线
66 79 */
  80 + @Schema(description = "是否在线,1为在线,0为离线")
67 81 private int online;
68 82  
69 83  
70 84 /**
71 85 * 注册时间
72 86 */
  87 + @Schema(description = "注册时间")
73 88 private String registerTime;
74 89  
75 90  
76 91 /**
77 92 * 心跳时间
78 93 */
  94 + @Schema(description = "心跳时间")
79 95 private String keepaliveTime;
80 96  
81 97 /**
82 98 * 通道个数
83 99 */
  100 + @Schema(description = "通道个数")
84 101 private int channelCount;
85 102  
86 103 /**
87 104 * 注册有效期
88 105 */
  106 + @Schema(description = "注册有效期")
89 107 private int expires;
90 108  
91 109 /**
92 110 * 创建时间
93 111 */
  112 + @Schema(description = "创建时间")
94 113 private String createTime;
95 114  
96 115 /**
97 116 * 更新时间
98 117 */
  118 + @Schema(description = "更新时间")
99 119 private String updateTime;
100 120  
101 121 /**
102 122 * 设备使用的媒体id, 默认为null
103 123 */
  124 + @Schema(description = "设备使用的媒体id, 默认为null")
104 125 private String mediaServerId;
105 126  
106 127 /**
107 128 * 字符集, 支持 UTF-8 与 GB2312
108 129 */
  130 + @Schema(description = "符集, 支持 UTF-8 与 GB2312")
109 131 private String charset ;
110 132  
111 133 /**
112 134 * 目录订阅周期,0为不订阅
113 135 */
  136 + @Schema(description = "目录订阅周期,0为不订阅")
114 137 private int subscribeCycleForCatalog;
115 138  
116 139 /**
117 140 * 移动设备位置订阅周期,0为不订阅
118 141 */
  142 + @Schema(description = "移动设备位置订阅周期,0为不订阅")
119 143 private int subscribeCycleForMobilePosition;
120 144  
121 145 /**
122 146 * 移动设备位置信息上报时间间隔,单位:秒,默认值5
123 147 */
  148 + @Schema(description = "移动设备位置信息上报时间间隔,单位:秒,默认值5")
124 149 private int mobilePositionSubmissionInterval = 5;
125 150  
126 151 /**
127 152 * 报警订阅周期,0为不订阅
128 153 */
  154 + @Schema(description = "报警心跳时间订阅周期,0为不订阅")
129 155 private int subscribeCycleForAlarm;
130 156  
131 157 /**
132 158 * 是否开启ssrc校验,默认关闭,开启可以防止串流
133 159 */
  160 + @Schema(description = "是否开启ssrc校验,默认关闭,开启可以防止串流")
134 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 167 private String geoCoordSys;
140 168  
141 169 /**
142 170 * 树类型 国标规定了两种树的展现方式 行政区划:CivilCode 和业务分组:BusinessGroup
143 171 */
  172 + @Schema(description = "树类型 国标规定了两种树的展现方式 行政区划:CivilCode 和业务分组:BusinessGroup")
144 173 private String treeType;
145 174  
146 175  
... ...
src/main/java/com/genersoft/iot/vmp/gb28181/bean/DeviceAlarm.java
1 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 9 public class DeviceAlarm {
5 10  
6 11 /**
7 12 * 数据库id
8 13 */
  14 + @Schema(description = "数据库id")
9 15 private String id;
10 16  
11 17 /**
12 18 * 设备Id
13 19 */
  20 + @Schema(description = "设备的国标编号")
14 21 private String deviceId;
15 22  
16 23 /**
17 24 * 通道Id
18 25 */
  26 + @Schema(description = "通道的国标编号")
19 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 33 private String alarmPriority;
25 34  
26 35 /**
27 36 * 报警方式 , 1为电话报警, 2为设备报警, 3为短信报警, 4为 GPS报警, 5为视频报警, 6为设备故障报警,
28 37 * 7其他报警;可以为直接组合如12为电话报警或 设备报警-
29 38 */
  39 + @Schema(description = "报警方式 , 1为电话报警, 2为设备报警, 3为短信报警, 4为 GPS报警, 5为视频报警, 6为设备故障报警,\n" +
  40 + "\t * 7其他报警;可以为直接组合如12为电话报警或设备报警")
30 41 private String alarmMethod;
31 42  
32 43 /**
33 44 * 报警时间
34 45 */
  46 + @Schema(description = "报警时间")
35 47 private String alarmTime;
36 48  
37 49 /**
38 50 * 报警内容描述
39 51 */
  52 + @Schema(description = "报警内容描述")
40 53 private String alarmDescription;
41 54  
42 55 /**
43 56 * 经度
44 57 */
  58 + @Schema(description = "经度")
45 59 private double longitude;
46 60  
47 61 /**
48 62 * 纬度
49 63 */
  64 + @Schema(description = "纬度")
50 65 private double latitude;
51 66  
52 67 /**
... ... @@ -75,8 +90,10 @@ public class DeviceAlarm {
75 90 * 1-存储设备磁盘故障报警;
76 91 * 2-存储设备风扇故障报警。
77 92 */
  93 + @Schema(description = "报警类型")
78 94 private String alarmType;
79 95  
  96 + @Schema(description = "创建时间")
80 97 private String createTime;
81 98  
82 99  
... ...
src/main/java/com/genersoft/iot/vmp/gb28181/bean/DeviceChannel.java
1 1 package com.genersoft.iot.vmp.gb28181.bean;
2 2  
  3 +import io.swagger.v3.oas.annotations.media.Schema;
  4 +
  5 +@Schema(description = "通道信息")
3 6 public class DeviceChannel {
4 7  
5 8  
6 9 /**
7 10 * 数据库自增ID
8 11 */
  12 + @Schema(description = "数据库自增ID")
9 13 private int id;
10 14  
11 15 /**
12   - * 通道id
  16 + * 通道国标编号
13 17 */
  18 + @Schema(description = "通道国标编号")
14 19 private String channelId;
15 20  
16 21 /**
17   - * 设备id
  22 + * 设备国标编号
18 23 */
  24 + @Schema(description = "设备国标编号")
19 25 private String deviceId;
20 26  
21 27 /**
22 28 * 通道名
23 29 */
  30 + @Schema(description = "名称")
24 31 private String name;
25 32  
26 33 /**
27 34 * 生产厂商
28 35 */
  36 + @Schema(description = "生产厂商")
29 37 private String manufacture;
30 38  
31 39 /**
32 40 * 型号
33 41 */
  42 + @Schema(description = "型号")
34 43 private String model;
35 44  
36 45 /**
37 46 * 设备归属
38 47 */
  48 + @Schema(description = "设备归属")
39 49 private String owner;
40 50  
41 51 /**
42 52 * 行政区域
43 53 */
  54 + @Schema(description = "行政区域")
44 55 private String civilCode;
45 56  
46 57 /**
47 58 * 警区
48 59 */
  60 + @Schema(description = "警区")
49 61 private String block;
50 62  
51 63 /**
52 64 * 安装地址
53 65 */
  66 + @Schema(description = "安装地址")
54 67 private String address;
55 68  
56 69 /**
57 70 * 是否有子设备 1有, 0没有
58 71 */
  72 + @Schema(description = "是否有子设备 1有, 0没有")
59 73 private int parental;
60 74  
61 75 /**
62 76 * 父级id
63 77 */
  78 + @Schema(description = "父级id")
64 79 private String parentId;
65 80  
66 81 /**
67 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 85 private int safetyWay;
70 86  
71 87 /**
72 88 * 注册方式 缺省为1;1:符合IETFRFC3261标准的认证注册模 式; 2:基于口令的双向认证注册模式; 3:基于数字证书的双向认证注册模式
73 89 */
  90 + @Schema(description = "注册方式 缺省为1;1:符合IETFRFC3261标准的认证注册模 式; 2:基于口令的双向认证注册模式; 3:基于数字证书的双向认证注册模式")
74 91 private int registerWay;
75 92  
76 93 /**
77 94 * 证书序列号
78 95 */
  96 + @Schema(description = "证书序列号")
79 97 private String certNum;
80 98  
81 99 /**
82 100 * 证书有效标识 缺省为0;证书有效标识:0:无效1: 有效
83 101 */
  102 + @Schema(description = "证书有效标识 缺省为0;证书有效标识:0:无效1: 有效")
84 103 private int certifiable;
85 104  
86 105 /**
87 106 * 证书无效原因码
88 107 */
  108 + @Schema(description = "证书无效原因码")
89 109 private int errCode;
90 110  
91 111 /**
92 112 * 证书终止有效期
93 113 */
  114 + @Schema(description = "证书终止有效期")
94 115 private String endTime;
95 116  
96 117 /**
97 118 * 保密属性 缺省为0; 0:不涉密, 1:涉密
98 119 */
  120 + @Schema(description = "保密属性 缺省为0; 0:不涉密, 1:涉密")
99 121 private String secrecy;
100 122  
101 123 /**
102 124 * IP地址
103 125 */
  126 + @Schema(description = "IP地址")
104 127 private String ipAddress;
105 128  
106 129 /**
107 130 * 端口号
108 131 */
  132 + @Schema(description = "端口号")
109 133 private int port;
110 134  
111 135 /**
112 136 * 密码
113 137 */
  138 + @Schema(description = "密码")
114 139 private String password;
115 140  
116 141 /**
117 142 * 云台类型
118 143 */
  144 + @Schema(description = "云台类型")
119 145 private int PTZType;
120 146  
121 147 /**
122 148 * 云台类型描述字符串
123 149 */
  150 + @Schema(description = "云台类型描述字符串")
124 151 private String PTZTypeText;
125 152  
126 153 /**
127 154 * 创建时间
128 155 */
  156 + @Schema(description = "创建时间")
129 157 private String createTime;
130 158  
131 159 /**
132 160 * 更新时间
133 161 */
  162 + @Schema(description = "更新时间")
134 163 private String updateTime;
135 164  
136 165 /**
... ... @@ -142,66 +171,79 @@ public class DeviceChannel {
142 171 * <Status>OFF</Status>
143 172 * 遇到过NVR下的IPC下发信令可以推流, 但是 Status 响应 OFF
144 173 */
  174 + @Schema(description = "在线/离线, 1在线,0离线")
145 175 private int status;
146 176  
147 177 /**
148 178 * 经度
149 179 */
  180 + @Schema(description = "经度")
150 181 private double longitude;
151 182  
152 183 /**
153 184 * 纬度
154 185 */
  186 + @Schema(description = "纬度")
155 187 private double latitude;
156 188  
157 189 /**
158 190 * 经度 GCJ02
159 191 */
  192 + @Schema(description = "GCJ02坐标系经度")
160 193 private double longitudeGcj02;
161 194  
162 195 /**
163 196 * 纬度 GCJ02
164 197 */
  198 + @Schema(description = "GCJ02坐标系纬度")
165 199 private double latitudeGcj02;
166 200  
167 201 /**
168 202 * 经度 WGS84
169 203 */
  204 + @Schema(description = "WGS84坐标系经度")
170 205 private double longitudeWgs84;
171 206  
172 207 /**
173 208 * 纬度 WGS84
174 209 */
  210 + @Schema(description = "WGS84坐标系纬度")
175 211 private double latitudeWgs84;
176 212  
177 213 /**
178 214 * 子设备数
179 215 */
  216 + @Schema(description = "子设备数")
180 217 private int subCount;
181 218  
182 219 /**
183 220 * 流唯一编号,存在表示正在直播
184 221 */
  222 + @Schema(description = "流唯一编号,存在表示正在直播")
185 223 private String streamId;
186 224  
187 225 /**
188 226 * 是否含有音频
189 227 */
  228 + @Schema(description = "是否含有音频")
190 229 private boolean hasAudio;
191 230  
192 231 /**
193 232 * 标记通道的类型,0->国标通道 1->直播流通道 2->业务分组/虚拟组织/行政区划
194 233 */
  234 + @Schema(description = "标记通道的类型,0->国标通道 1->直播流通道 2->业务分组/虚拟组织/行政区划")
195 235 private int channelType;
196 236  
197 237 /**
198 238 * 业务分组
199 239 */
  240 + @Schema(description = "业务分组")
200 241 private String businessGroupId;
201 242  
202 243 /**
203 244 * GPS的更新时间
204 245 */
  246 + @Schema(description = "GPS的更新时间")
205 247 private String gpsTime;
206 248  
207 249 public int getId() {
... ...
src/main/java/com/genersoft/iot/vmp/gb28181/bean/GbStream.java
1 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 10 public class GbStream extends PlatformGbStream{
7 11  
  12 + @Schema(description = "ID")
8 13 private Integer gbStreamId;
  14 + @Schema(description = "应用名")
9 15 private String app;
  16 + @Schema(description = "流ID")
10 17 private String stream;
  18 + @Schema(description = "国标ID")
11 19 private String gbId;
  20 + @Schema(description = "名称")
12 21 private String name;
  22 + @Schema(description = "流媒体ID")
13 23 private String mediaServerId;
  24 + @Schema(description = "经度")
14 25 private double longitude;
  26 + @Schema(description = "纬度")
15 27 private double latitude;
  28 + @Schema(description = "流类型(拉流/推流)")
16 29 private String streamType;
  30 + @Schema(description = "状态")
17 31 private boolean status;
18 32  
  33 + @Schema(description = "创建时间")
19 34 public String createTime;
20 35  
21 36 @Override
... ...
src/main/java/com/genersoft/iot/vmp/gb28181/bean/ParentPlatform.java
1 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 9 public class ParentPlatform {
4 10  
5 11 /**
6 12 * id
7 13 */
  14 + @Schema(description = "ID(数据库中)")
8 15 private Integer id;
9 16  
10 17 /**
11 18 * 是否启用
12 19 */
  20 + @Schema(description = "是否启用")
13 21 private boolean enable;
14 22  
15 23 /**
16 24 * 名称
17 25 */
  26 + @Schema(description = "名称")
18 27 private String name;
19 28  
20 29 /**
21 30 * SIP服务国标编码
22 31 */
  32 + @Schema(description = "SIP服务国标编码")
23 33 private String serverGBId;
24 34  
25 35 /**
26 36 * SIP服务国标域
27 37 */
  38 + @Schema(description = "SIP服务国标域")
28 39 private String serverGBDomain;
29 40  
30 41 /**
31 42 * SIP服务IP
32 43 */
  44 + @Schema(description = "SIP服务IP")
33 45 private String serverIP;
34 46  
35 47 /**
36 48 * SIP服务端口
37 49 */
  50 + @Schema(description = "SIP服务端口")
38 51 private int serverPort;
39 52  
40 53 /**
41 54 * 设备国标编号
42 55 */
  56 + @Schema(description = "11111")
43 57 private String deviceGBId;
44 58  
45 59 /**
46 60 * 设备ip
47 61 */
  62 + @Schema(description = "设备ip")
48 63 private String deviceIp;
49 64  
50 65 /**
51 66 * 设备端口
52 67 */
  68 + @Schema(description = "设备端口")
53 69 private String devicePort;
54 70  
55 71 /**
56 72 * SIP认证用户名(默认使用设备国标编号)
57 73 */
  74 + @Schema(description = "SIP认证用户名(默认使用设备国标编号)")
58 75 private String username;
59 76  
60 77 /**
61 78 * SIP认证密码
62 79 */
  80 + @Schema(description = "SIP认证密码")
63 81 private String password;
64 82  
65 83 /**
66 84 * 注册周期 (秒)
67 85 */
  86 + @Schema(description = "注册周期 (秒)")
68 87 private String expires;
69 88  
70 89 /**
71 90 * 心跳周期(秒)
72 91 */
  92 + @Schema(description = "心跳周期(秒)")
73 93 private String keepTimeout;
74 94  
75 95 /**
76 96 * 传输协议
77 97 * UDP/TCP
78 98 */
  99 + @Schema(description = "传输协议")
79 100 private String transport;
80 101  
81 102 /**
82 103 * 字符集
83 104 */
  105 + @Schema(description = "字符集")
84 106 private String characterSet;
85 107  
86 108 /**
87 109 * 允许云台控制
88 110 */
  111 + @Schema(description = "允许云台控制")
89 112 private boolean ptz;
90 113  
91 114 /**
92 115 * RTCP流保活
93 116 * TODO 预留, 暂不实现
94 117 */
  118 + @Schema(description = "RTCP流保活")
95 119 private boolean rtcp;
96 120  
97 121 /**
98 122 * 在线状态
99 123 */
  124 + @Schema(description = "在线状态")
100 125 private boolean status;
101 126  
102 127 /**
103 128 * 在线状态
104 129 */
  130 + @Schema(description = "在线状态")
105 131 private int channelCount;
106 132  
107 133 /**
108 134 * 默认目录Id,自动添加的通道多放在这个目录下
109 135 */
  136 + @Schema(description = "默认目录Id,自动添加的通道多放在这个目录下")
110 137 private String catalogId;
111 138  
112 139 /**
113 140 * 已被订阅目录信息
114 141 */
  142 + @Schema(description = "已被订阅目录信息")
115 143 private boolean catalogSubscribe;
116 144  
117 145 /**
118 146 * 已被订阅报警信息
119 147 */
  148 + @Schema(description = "已被订阅报警信息")
120 149 private boolean alarmSubscribe;
121 150  
122 151 /**
123 152 * 已被订阅移动位置信息
124 153 */
  154 + @Schema(description = "已被订阅移动位置信息")
125 155 private boolean mobilePositionSubscribe;
126 156  
127 157 /**
128 158 * 点播未推流的设备时是否使用redis通知拉起
129 159 */
  160 + @Schema(description = "点播未推流的设备时是否使用redis通知拉起")
130 161 private boolean startOfflinePush;
131 162  
132 163 /**
133 164 * 目录分组-每次向上级发送通道信息时单个包携带的通道数量,取值1,2,4,8
134 165 */
  166 + @Schema(description = "目录分组-每次向上级发送通道信息时单个包携带的通道数量,取值1,2,4,8")
135 167 private int catalogGroup;
136 168  
137 169 /**
138 170 * 行政区划
139 171 */
  172 + @Schema(description = "行政区划")
140 173 private String administrativeDivision;
141 174  
142 175 /**
143 176 * 更新时间
144 177 */
  178 + @Schema(description = "更新时间")
145 179 private String updateTime;
146 180  
147 181 /**
148 182 * 创建时间
149 183 */
  184 + @Schema(description = "创建时间")
150 185 private String createTime;
151 186  
152 187 /**
153 188 * 树类型 国标规定了两种树的展现方式 行政区划 CivilCode 和业务分组:BusinessGroup
154 189 */
  190 + @Schema(description = "树类型 国标规定了两种树的展现方式 行政区划 CivilCode 和业务分组:BusinessGrou")
155 191 private String treeType;
156 192  
157 193 public Integer getId() {
... ...
src/main/java/com/genersoft/iot/vmp/gb28181/bean/PlatformCatalog.java
1 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 7 * @author lin
6 8 */
  9 +@Schema(description = "目录信息")
7 10 public class PlatformCatalog {
  11 + @Schema(description = "ID")
8 12 private String id;
  13 +
  14 + @Schema(description = "名称")
9 15 private String name;
  16 +
  17 + @Schema(description = "平台ID")
10 18 private String platformId;
  19 +
  20 + @Schema(description = "父级目录ID")
11 21 private String parentId;
12 22  
  23 + @Schema(description = "行政区划")
13 24 private String civilCode;
14 25  
  26 + @Schema(description = "目录分组")
15 27 private String businessGroupId;
16 28  
17 29 /**
18 30 * 子节点数
19 31 */
  32 + @Schema(description = "子节点数")
20 33 private int childrenCount;
21 34  
22 35 /**
23 36 * 0 目录, 1 国标通道, 2 直播流
24 37 */
  38 + @Schema(description = "类型:0 目录, 1 国标通道, 2 直播流")
25 39 private int type;
26 40  
27 41 public String getId() {
... ...
src/main/java/com/genersoft/iot/vmp/gb28181/bean/PlatformGbStream.java
1 1 package com.genersoft.iot.vmp.gb28181.bean;
2 2  
  3 +import io.swagger.v3.oas.annotations.media.Schema;
  4 +
3 5 public class PlatformGbStream {
  6 +
  7 + @Schema(description = "ID")
4 8 private Integer gbStreamId;
  9 +
  10 + @Schema(description = "平台ID")
5 11 private String platformId;
  12 +
  13 + @Schema(description = "目录ID")
6 14 private String catalogId;
7 15  
8 16 public Integer getGbStreamId() {
... ...
src/main/java/com/genersoft/iot/vmp/gb28181/bean/SyncStatus.java
1 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 7 * @author lin
6 8 */
  9 +@Schema(description = "摄像机同步状态")
7 10 public class SyncStatus {
  11 + @Schema(description = "总数")
8 12 private int total;
  13 + @Schema(description = "当前更新多少")
9 14 private int current;
  15 + @Schema(description = "错误描述")
10 16 private String errorMsg;
11   -
  17 + @Schema(description = "是否同步中")
12 18 private boolean syncIng;
13 19  
14 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 1 package com.genersoft.iot.vmp.gb28181.session;
2 2  
3 3 import com.genersoft.iot.vmp.utils.ConfigConst;
  4 +import io.swagger.v3.oas.annotations.media.Schema;
4 5  
5 6 import java.util.ArrayList;
6 7 import java.util.List;
7 8 import java.util.Random;
8 9 import java.util.Set;
9 10  
  11 +@Schema(description = "ssrc信息")
10 12 public class SsrcConfig {
11 13  
12 14 /**
13 15 * zlm流媒体服务器Id
14 16 */
  17 + @Schema(description = "流媒体服务器Id")
15 18 private String mediaServerId;
16 19  
  20 + @Schema(description = "SSRC前缀")
17 21 private String ssrcPrefix;
  22 +
18 23 /**
19 24 * zlm流媒体服务器已用会话句柄
20 25 */
  26 + @Schema(description = "zlm流媒体服务器已用会话句柄")
21 27 private List<String> isUsed;
  28 +
22 29 /**
23 30 * zlm流媒体服务器可用会话句柄
24 31 */
  32 + @Schema(description = "zlm流媒体服务器可用会话句柄")
25 33 private List<String> notUsed;
26 34  
27 35 public SsrcConfig() {
... ...
src/main/java/com/genersoft/iot/vmp/gb28181/session/VideoStreamSessionManager.java
... ... @@ -25,9 +25,6 @@ import org.springframework.util.StringUtils;
25 25 public class VideoStreamSessionManager {
26 26  
27 27 @Autowired
28   - private RedisUtil redisUtil;
29   -
30   - @Autowired
31 28 private UserSetting userSetting;
32 29  
33 30 public enum SessionType {
... ... @@ -58,9 +55,9 @@ public class VideoStreamSessionManager {
58 55 ssrcTransaction.setMediaServerId(mediaServerId);
59 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 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 61 + "_" + deviceId + "_" + channelId + "_" + callId + "_" + stream, ssrcTransaction);
65 62 }
66 63  
... ... @@ -70,7 +67,7 @@ public class VideoStreamSessionManager {
70 67 byte[] dialogByteArray = SerializeUtils.serialize(dialog);
71 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 71 + "_" + deviceId + "_" + channelId + "_" + ssrcTransaction.getCallId() + "_"
75 72 + ssrcTransaction.getStream(), ssrcTransaction);
76 73 }
... ... @@ -126,11 +123,11 @@ public class VideoStreamSessionManager {
126 123 stream ="*";
127 124 }
128 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 127 if (scanResult.size() == 0) {
131 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 133 public List<SsrcTransaction> getSsrcTransactionForAll(String deviceId, String channelId, String callId, String stream){
... ... @@ -147,13 +144,13 @@ public class VideoStreamSessionManager {
147 144 stream ="*";
148 145 }
149 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 148 if (scanResult.size() == 0) {
152 149 return null;
153 150 }
154 151 List<SsrcTransaction> result = new ArrayList<>();
155 152 for (Object keyObj : scanResult) {
156   - result.add((SsrcTransaction)redisUtil.get((String) keyObj));
  153 + result.add((SsrcTransaction)RedisUtil.get((String) keyObj));
157 154 }
158 155 return result;
159 156 }
... ... @@ -179,17 +176,17 @@ public class VideoStreamSessionManager {
179 176 if (ssrcTransaction == null) {
180 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 180 + deviceId + "_" + channelId + "_" + ssrcTransaction.getCallId() + "_" + ssrcTransaction.getStream());
184 181 }
185 182  
186 183  
187 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 186 List<SsrcTransaction> result= new ArrayList<>();
190 187 for (int i = 0; i < ssrcTransactionKeys.size(); i++) {
191 188 String key = (String)ssrcTransactionKeys.get(i);
192   - SsrcTransaction ssrcTransaction = (SsrcTransaction)redisUtil.get(key);
  189 + SsrcTransaction ssrcTransaction = (SsrcTransaction)RedisUtil.get(key);
193 190 result.add(ssrcTransaction);
194 191 }
195 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 3  
4 4 import com.genersoft.iot.vmp.gb28181.session.SsrcConfig;
5 5 import com.genersoft.iot.vmp.media.zlm.ZLMServerConfig;
  6 +import io.swagger.v3.oas.annotations.media.Schema;
6 7 import org.springframework.util.StringUtils;
7 8  
8 9 import java.util.HashMap;
9 10  
  11 +@Schema(description = "流媒体服务信息")
10 12 public class MediaServerItem{
11 13  
  14 + @Schema(description = "ID")
12 15 private String id;
13 16  
  17 + @Schema(description = "IP")
14 18 private String ip;
15 19  
  20 + @Schema(description = "hook使用的IP(zlm访问WVP使用的IP)")
16 21 private String hookIp;
17 22  
  23 + @Schema(description = "SDP IP")
18 24 private String sdpIp;
19 25  
  26 + @Schema(description = "流IP")
20 27 private String streamIp;
21 28  
  29 + @Schema(description = "HTTP端口")
22 30 private int httpPort;
23 31  
  32 + @Schema(description = "HTTPS端口")
24 33 private int httpSSlPort;
25 34  
  35 + @Schema(description = "RTMP端口")
26 36 private int rtmpPort;
27 37  
  38 + @Schema(description = "RTMPS端口")
28 39 private int rtmpSSlPort;
29 40  
  41 + @Schema(description = "RTP收流端口(单端口模式有用)")
30 42 private int rtpProxyPort;
31 43  
  44 + @Schema(description = "RTSP端口")
32 45 private int rtspPort;
33 46  
  47 + @Schema(description = "RTSPS端口")
34 48 private int rtspSSLPort;
35 49  
  50 + @Schema(description = "是否开启自动配置ZLM")
36 51 private boolean autoConfig;
37 52  
  53 + @Schema(description = "ZLM鉴权参数")
38 54 private String secret;
39 55  
  56 + @Schema(description = "某个流无人观看时,触发hook.on_stream_none_reader事件的最大等待时间,单位毫秒")
40 57 private int streamNoneReaderDelayMS;
41 58  
  59 + @Schema(description = "keepalive hook触发间隔,单位秒")
42 60 private int hookAliveInterval;
43 61  
  62 + @Schema(description = "是否使用多端口模式")
44 63 private boolean rtpEnable;
45 64  
  65 + @Schema(description = "状态")
46 66 private boolean status;
47 67  
  68 + @Schema(description = "多端口RTP收流端口范围")
48 69 private String rtpPortRange;
49 70  
  71 + @Schema(description = "RTP发流端口范围")
50 72 private String sendRtpPortRange;
51 73  
  74 + @Schema(description = "assist服务端口")
52 75 private int recordAssistPort;
53 76  
  77 + @Schema(description = "创建时间")
54 78 private String createTime;
55 79  
  80 + @Schema(description = "更新时间")
56 81 private String updateTime;
57 82  
  83 + @Schema(description = "上次心跳时间")
58 84 private String lastKeepaliveTime;
59 85  
  86 + @Schema(description = "是否是默认ZLM")
60 87 private boolean defaultServer;
61 88  
  89 + @Schema(description = "SSRC信息")
62 90 private SsrcConfig ssrcConfig;
63 91  
  92 + @Schema(description = "当前使用到的端口")
64 93 private int currentPort;
65 94  
66 95  
... ... @@ -68,6 +97,7 @@ public class MediaServerItem{
68 97 * 每一台ZLM都有一套独立的SSRC列表
69 98 * 在ApplicationCheckRunner里对mediaServerSsrcMap进行初始化
70 99 */
  100 + @Schema(description = "ID")
71 101 private HashMap<String, SsrcConfig> mediaServerSsrcMap;
72 102  
73 103 public MediaServerItem() {
... ...
src/main/java/com/genersoft/iot/vmp/media/zlm/dto/StreamProxyItem.java
1 1 package com.genersoft.iot.vmp.media.zlm.dto;
2 2  
3 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 10 public class StreamProxyItem extends GbStream {
6 11  
  12 + @Schema(description = "类型")
7 13 private String type;
  14 + @Schema(description = "应用名")
8 15 private String app;
  16 + @Schema(description = "流ID")
9 17 private String stream;
  18 + @Schema(description = "流媒体服务ID")
10 19 private String mediaServerId;
  20 + @Schema(description = "拉流地址")
11 21 private String url;
  22 + @Schema(description = "拉流地址")
12 23 private String src_url;
  24 + @Schema(description = "目标地址")
13 25 private String dst_url;
  26 + @Schema(description = "超时时间")
14 27 private int timeout_ms;
  28 + @Schema(description = "ffmpeg模板KEY")
15 29 private String ffmpeg_cmd_key;
  30 + @Schema(description = "rtsp拉流时,拉流方式,0:tcp,1:udp,2:组播")
16 31 private String rtp_type;
  32 + @Schema(description = "是否启用")
17 33 private boolean enable;
  34 + @Schema(description = "是否启用HLS")
18 35 private boolean enable_hls;
  36 + @Schema(description = "是否启用MP4")
19 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 41 private String platformGbId;
  42 + @Schema(description = "创建时间")
22 43 private String createTime;
23 44  
24 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 2  
3 3 import com.genersoft.iot.vmp.gb28181.bean.GbStream;
4 4 import com.genersoft.iot.vmp.utils.DateUtil;
  5 +import io.swagger.v3.oas.annotations.media.Schema;
5 6 import org.jetbrains.annotations.NotNull;
6 7 import org.springframework.util.unit.DataUnit;
7 8  
8 9 import java.util.List;
9 10  
10   -
  11 +@Schema(description = "推流信息")
11 12 public class StreamPushItem extends GbStream implements Comparable<StreamPushItem>{
12 13  
13 14 /**
14 15 * id
15 16 */
  17 + @Schema(description = "id")
16 18 private Integer id;
17 19  
18 20 /**
19 21 * 应用名
20 22 */
  23 + @Schema(description = "应用名")
21 24 private String app;
22 25  
23 26 /**
24 27 * 流id
25 28 */
  29 + @Schema(description = "流id")
26 30 private String stream;
27 31  
28 32 /**
29 33 * 观看总人数,包括hls/rtsp/rtmp/http-flv/ws-flv
30 34 */
  35 + @Schema(description = "观看总人数")
31 36 private String totalReaderCount;
32 37  
33 38 /**
34 39 * 协议 包括hls/rtsp/rtmp/http-flv/ws-flv
35 40 */
  41 + @Schema(description = "协议 包括hls/rtsp/rtmp/http-flv/ws-flv")
36 42 private List<MediaSchema> schemas;
37 43  
38 44 /**
... ... @@ -46,71 +52,85 @@ public class StreamPushItem extends GbStream implements Comparable&lt;StreamPushIte
46 52 * mp4_vod=6,
47 53 * device_chn=7
48 54 */
  55 + @Schema(description = "产生源类型")
49 56 private int originType;
50 57  
51 58 /**
52 59 * 客户端和服务器网络信息,可能为null类型
53 60 */
  61 + @Schema(description = "客户端和服务器网络信息,可能为null类型")
54 62 private MediaItem.OriginSock originSock;
55 63  
56 64 /**
57 65 * 产生源类型的字符串描述
58 66 */
  67 + @Schema(description = "产生源类型的字符串描述")
59 68 private String originTypeStr;
60 69  
61 70 /**
62 71 * 产生源的url
63 72 */
  73 + @Schema(description = "产生源的url")
64 74 private String originUrl;
65 75  
66 76 /**
67 77 * 存活时间,单位秒
68 78 */
  79 + @Schema(description = "存活时间,单位秒")
69 80 private Long aliveSecond;
70 81  
71 82 /**
72 83 * 音视频轨道
73 84 */
  85 + @Schema(description = "音视频轨道")
74 86 private List<MediaItem.MediaTrack> tracks;
75 87  
76 88 /**
77 89 * 音视频轨道
78 90 */
  91 + @Schema(description = "音视频轨道")
79 92 private String vhost;
80 93  
81 94 /**
82 95 * 使用的流媒体ID
83 96 */
  97 + @Schema(description = "使用的流媒体ID")
84 98 private String mediaServerId;
85 99  
86 100 /**
87 101 * 使用的服务ID
88 102 */
  103 + @Schema(description = "使用的服务ID")
89 104 private String serverId;
90 105  
91 106 /**
92 107 * 推流时间
93 108 */
  109 + @Schema(description = "推流时间")
94 110 private String pushTime;
95 111  
96 112 /**
97 113 * 更新时间
98 114 */
  115 + @Schema(description = "更新时间")
99 116 private String updateTime;
100 117  
101 118 /**
102 119 * 创建时间
103 120 */
  121 + @Schema(description = "创建时间")
104 122 private String createTime;
105 123  
106 124 /**
107 125 * 是否正在推流
108 126 */
  127 + @Schema(description = "是否正在推流")
109 128 private boolean pushIng;
110 129  
111 130 /**
112 131 * 是否自己平台的推流
113 132 */
  133 + @Schema(description = "是否自己平台的推流")
114 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 8 import java.util.Map;
9 9 import java.util.Set;
10 10  
11   -import com.genersoft.iot.vmp.media.zlm.ZLMRunner;
12 11 import org.slf4j.Logger;
13 12 import org.slf4j.LoggerFactory;
14 13 import org.springframework.beans.factory.annotation.Autowired;
... ... @@ -54,9 +53,6 @@ public class MediaServerServiceImpl implements IMediaServerService {
54 53 @Autowired
55 54 private SipConfig sipConfig;
56 55  
57   - @Autowired
58   - private ZLMRunner zlmRunner;
59   -
60 56 @Value("${server.ssl.enabled:false}")
61 57 private boolean sslEnabled;
62 58  
... ... @@ -84,8 +80,6 @@ public class MediaServerServiceImpl implements IMediaServerService {
84 80 @Autowired
85 81 private ZLMRTPServerFactory zlmrtpServerFactory;
86 82  
87   - @Autowired
88   - private RedisUtil redisUtil;
89 83  
90 84 @Autowired
91 85 private EventPublisher publisher;
... ... @@ -104,12 +98,12 @@ public class MediaServerServiceImpl implements IMediaServerService {
104 98 if (mediaServerItem.getSsrcConfig() == null) {
105 99 SsrcConfig ssrcConfig = new SsrcConfig(mediaServerItem.getId(), null, sipConfig.getDomain());
106 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 103 // 查询redis是否存在此mediaServer
110 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 145 if (mediaServerItem.isRtpEnable()) {
152 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 149 return new SSRCInfo(rtpServerPort, ssrc, streamId);
156 150 }
157 151 }
... ... @@ -184,7 +178,7 @@ public class MediaServerServiceImpl implements IMediaServerService {
184 178 ssrcConfig.releaseSsrc(ssrc);
185 179 mediaServerItem.setSsrcConfig(ssrcConfig);
186 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 187 @Override
194 188 public void clearRTPServer(MediaServerItem mediaServerItem) {
195 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 209 );
216 210 }
217 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 215 @Override
222 216 public List<MediaServerItem> getAll() {
223 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 219 String onlineKey = VideoManagerConstants.MEDIA_SERVERS_ONLINE_PREFIX + userSetting.getServerId();
226 220 for (Object mediaServerKey : mediaServerKeys) {
227 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 225 if (aDouble != null) {
232 226 mediaServerItem.setStatus(true);
233 227 }
... ... @@ -253,13 +247,13 @@ public class MediaServerServiceImpl implements IMediaServerService {
253 247 @Override
254 248 public List<MediaServerItem> getAllOnline() {
255 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 252 List<MediaServerItem> result = new ArrayList<>();
259 253 if (mediaServerIdSet != null && mediaServerIdSet.size() > 0) {
260 254 for (String mediaServerId : mediaServerIdSet) {
261 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 259 Collections.reverse(result);
... ... @@ -277,7 +271,7 @@ public class MediaServerServiceImpl implements IMediaServerService {
277 271 return null;
278 272 }
279 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 277 @Override
... ... @@ -289,7 +283,7 @@ public class MediaServerServiceImpl implements IMediaServerService {
289 283 @Override
290 284 public void clearMediaServerForOnline() {
291 285 String key = VideoManagerConstants.MEDIA_SERVERS_ONLINE_PREFIX + userSetting.getServerId();
292   - redisUtil.del(key);
  286 + RedisUtil.del(key);
293 287 }
294 288  
295 289 @Override
... ... @@ -397,14 +391,14 @@ public class MediaServerServiceImpl implements IMediaServerService {
397 391 }
398 392 mediaServerMapper.update(serverItem);
399 393 String key = VideoManagerConstants.MEDIA_SERVER_PREFIX + userSetting.getServerId() + "_" + zlmServerConfig.getGeneralMediaServerId();
400   - if (redisUtil.get(key) == null) {
  394 + if (RedisUtil.get(key) == null) {
401 395 SsrcConfig ssrcConfig = new SsrcConfig(zlmServerConfig.getGeneralMediaServerId(), null, sipConfig.getDomain());
402 396 serverItem.setSsrcConfig(ssrcConfig);
403 397 }else {
404   - MediaServerItem mediaServerItemInRedis = (MediaServerItem)redisUtil.get(key);
  398 + MediaServerItem mediaServerItemInRedis = (MediaServerItem)RedisUtil.get(key);
405 399 serverItem.setSsrcConfig(mediaServerItemInRedis.getSsrcConfig());
406 400 }
407   - redisUtil.set(key, serverItem);
  401 + RedisUtil.set(key, serverItem);
408 402 resetOnlineServerItem(serverItem);
409 403 if (serverItem.isAutoConfig()) {
410 404 setZLMConfig(serverItem, "0".equals(zlmServerConfig.getHookEnable()));
... ... @@ -425,15 +419,15 @@ public class MediaServerServiceImpl implements IMediaServerService {
425 419 // 更新缓存
426 420 String key = VideoManagerConstants.MEDIA_SERVERS_ONLINE_PREFIX + userSetting.getServerId();
427 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 425 zlmresTfulUtils.getMediaList(serverItem, null, null, "rtmp",(mediaList ->{
432 426 Integer code = mediaList.getInteger("code");
433 427 if (code == 0) {
434 428 JSONArray data = mediaList.getJSONArray("data");
435 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 444 return;
451 445 }
452 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 451 @Override
458 452 public void removeCount(String mediaServerId) {
459 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 462 public MediaServerItem getMediaServerForMinimumLoad() {
469 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 467 logger.info("获取负载最低的节点时无在线节点");
474 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 474 ArrayList<Object> mediaServerObjectS = new ArrayList<>(objects);
481 475  
482 476 String mediaServerId = (String)mediaServerObjectS.get(0);
... ... @@ -619,9 +613,9 @@ public class MediaServerServiceImpl implements IMediaServerService {
619 613  
620 614 @Override
621 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 617 String key = VideoManagerConstants.MEDIA_SERVER_PREFIX + userSetting.getServerId() + "_" + id;
624   - redisUtil.del(key);
  618 + RedisUtil.del(key);
625 619 }
626 620 @Override
627 621 public void deleteDb(String id){
... ... @@ -640,7 +634,7 @@ public class MediaServerServiceImpl implements IMediaServerService {
640 634 }
641 635 // zlm连接重试
642 636 logger.warn("[更新ZLM 保活信息]失败,未找到流媒体信息,尝试重连zlm");
643   - reloadZlm();
  637 +// reloadZlm();
644 638 mediaServerItem = getOne(mediaServerId);
645 639 if (mediaServerItem == null) {
646 640 // zlm连接重试
... ... @@ -650,7 +644,7 @@ public class MediaServerServiceImpl implements IMediaServerService {
650 644 }
651 645 String key = VideoManagerConstants.MEDIA_SERVER_KEEPALIVE_PREFIX + userSetting.getServerId() + "_" + mediaServerId;
652 646 int hookAliveInterval = mediaServerItem.getHookAliveInterval() + 2;
653   - redisUtil.set(key, data, hookAliveInterval);
  647 + RedisUtil.set(key, data, hookAliveInterval);
654 648 }
655 649  
656 650 private MediaServerItem getOneFromDatabase(String mediaServerId) {
... ... @@ -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 66 @Autowired
67 67 private UserSetting userSetting;
68 68  
69   - @Autowired
70   - private RedisUtil redis;
71 69  
72 70 @Autowired
73 71 private ZLMMediaListManager zlmMediaListManager;
... ... @@ -227,7 +225,7 @@ public class RedisGbPlayMsgListener implements MessageListener {
227 225 WvpRedisMsg response = WvpRedisMsg.getResponseInstance(userSetting.getServerId(), toId,
228 226 WvpRedisMsgCmd.REQUEST_PUSH_STREAM, serial, result);
229 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 244 WvpRedisMsgCmd.GET_SEND_ITEM, serial, result);
247 245  
248 246 JSONObject jsonObject = (JSONObject)JSON.toJSON(response);
249   - redis.convertAndSend(WVP_PUSH_STREAM_KEY, jsonObject);
  247 + RedisUtil.convertAndSend(WVP_PUSH_STREAM_KEY, jsonObject);
250 248 return;
251 249 }
252 250 // 确定流是否在线
... ... @@ -269,7 +267,7 @@ public class RedisGbPlayMsgListener implements MessageListener {
269 267 userSetting.getServerId(), toId, WvpRedisMsgCmd.GET_SEND_ITEM, serial, result
270 268 );
271 269 JSONObject jsonObject = (JSONObject)JSON.toJSON(response);
272   - redis.convertAndSend(WVP_PUSH_STREAM_KEY, jsonObject);
  270 + RedisUtil.convertAndSend(WVP_PUSH_STREAM_KEY, jsonObject);
273 271 }, userSetting.getPlatformPlayTimeout());
274 272  
275 273 // 添加订阅
... ... @@ -308,7 +306,7 @@ public class RedisGbPlayMsgListener implements MessageListener {
308 306 userSetting.getServerId(), toId, WvpRedisMsgCmd.GET_SEND_ITEM, serial, result
309 307 );
310 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 343 wvpResult.setMsg("timeout");
346 344 errorCallback.handler(wvpResult);
347 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 368 callbacksForStartSendRtpStream.remove(key);
371 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 27 private final static Logger logger = LoggerFactory.getLogger(RedisStreamMsgListener.class);
28 28  
29 29 @Autowired
30   - private ISIPCommander commander;
31   -
32   - @Autowired
33   - private ISIPCommanderForPlatform commanderForPlatform;
34   -
35   - @Autowired
36   - private IVideoManagerStorage storage;
37   -
38   - @Autowired
39 30 private UserSetting userSetting;
40 31  
41 32 @Autowired
... ...
src/main/java/com/genersoft/iot/vmp/storager/impl/RedisCatchStorageImpl.java
... ... @@ -22,7 +22,6 @@ import org.slf4j.Logger;
22 22 import org.slf4j.LoggerFactory;
23 23 import org.springframework.beans.factory.annotation.Autowired;
24 24 import org.springframework.stereotype.Component;
25   -import org.springframework.util.StringUtils;
26 25  
27 26 import java.util.*;
28 27  
... ... @@ -33,9 +32,6 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage {
33 32 private final Logger logger = LoggerFactory.getLogger(RedisCatchStorageImpl.class);
34 33  
35 34 @Autowired
36   - private RedisUtil redis;
37   -
38   - @Autowired
39 35 private DeviceChannelMapper deviceChannelMapper;
40 36  
41 37 @Autowired
... ... @@ -45,9 +41,9 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage {
45 41 public Long getCSEQ() {
46 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 45 if (result > Integer.MAX_VALUE) {
50   - redis.set(key, 1);
  46 + RedisUtil.set(key, 1);
51 47 result = 1;
52 48 }
53 49 return result;
... ... @@ -57,9 +53,9 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage {
57 53 public Long getSN(String method) {
58 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 57 if (result > Integer.MAX_VALUE) {
62   - redis.set(key, 1);
  58 + RedisUtil.set(key, 1);
63 59 result = 1;
64 60 }
65 61 return result;
... ... @@ -68,20 +64,20 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage {
68 64 @Override
69 65 public void resetAllCSEQ() {
70 66 String scanKey = VideoManagerConstants.SIP_CSEQ_PREFIX + userSetting.getServerId() + "_*";
71   - List<Object> keys = redis.scan(scanKey);
  67 + List<Object> keys = RedisUtil.scan(scanKey);
72 68 for (Object o : keys) {
73 69 String key = (String) o;
74   - redis.set(key, 1);
  70 + RedisUtil.set(key, 1);
75 71 }
76 72 }
77 73  
78 74 @Override
79 75 public void resetAllSN() {
80 76 String scanKey = VideoManagerConstants.SIP_SN_PREFIX + userSetting.getServerId() + "_*";
81   - List<Object> keys = redis.scan(scanKey);
  77 + List<Object> keys = RedisUtil.scan(scanKey);
82 78 for (Object o : keys) {
83 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 88 */
93 89 @Override
94 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 92 stream.getStream(), stream.getDeviceID(), stream.getChannelId()),
97 93 stream);
98 94 }
... ... @@ -107,7 +103,7 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage {
107 103 if (streamInfo == null) {
108 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 107 userSetting.getServerId(),
112 108 streamInfo.getStream(),
113 109 streamInfo.getDeviceID(),
... ... @@ -120,7 +116,7 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage {
120 116 */
121 117 @Override
122 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 120 VideoManagerConstants.PLAYER_PREFIX,
125 121 userSetting.getServerId(),
126 122 streamInfo.getStream(),
... ... @@ -129,36 +125,36 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage {
129 125 }
130 126 @Override
131 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 129 if (playLeys == null || playLeys.size() == 0) {
134 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 135 @Override
140 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 138 userSetting.getServerId(),
143 139 deviceId,
144 140 channelId));
145 141 if (playLeys == null || playLeys.size() == 0) {
146 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 147 @Override
152 148 public Map<String, StreamInfo> queryPlayByDeviceId(String deviceId) {
153 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 152 if (players.size() == 0) {
157 153 return streamInfos;
158 154 }
159 155 for (Object player : players) {
160 156 String key = (String) player;
161   - StreamInfo streamInfo = (StreamInfo) redis.get(key);
  157 + StreamInfo streamInfo = (StreamInfo) RedisUtil.get(key);
162 158 streamInfos.put(streamInfo.getDeviceID() + "_" + streamInfo.getChannelId(), streamInfo);
163 159 }
164 160 return streamInfos;
... ... @@ -167,7 +163,7 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage {
167 163  
168 164 @Override
169 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 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 171 public boolean startDownload(StreamInfo stream, String callId) {
176 172 boolean result;
177 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 175 userSetting.getServerId(), stream.getDeviceID(), stream.getChannelId(), stream.getStream(), callId), stream);
180 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 178 userSetting.getServerId(), stream.getDeviceID(), stream.getChannelId(), stream.getStream(), callId), stream, 60*60);
183 179 }
184 180 return result;
... ... @@ -210,10 +206,10 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage {
210 206 stream,
211 207 callId
212 208 );
213   - List<Object> scan = redis.scan(key);
  209 + List<Object> scan = RedisUtil.scan(key);
214 210 if (scan.size() > 0) {
215 211 for (Object keyObj : scan) {
216   - redis.del((String) keyObj);
  212 + RedisUtil.del((String) keyObj);
217 213 }
218 214 }
219 215 return true;
... ... @@ -246,10 +242,10 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage {
246 242 stream,
247 243 callId
248 244 );
249   - List<Object> scan = redis.scan(key);
  245 + List<Object> scan = RedisUtil.scan(key);
250 246 if (scan.size() > 0) {
251 247 for (Object keyObj : scan) {
252   - redis.del((String) keyObj);
  248 + RedisUtil.del((String) keyObj);
253 249 }
254 250 }
255 251 return true;
... ... @@ -279,9 +275,9 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage {
279 275 stream,
280 276 callId
281 277 );
282   - List<Object> streamInfoScan = redis.scan(key);
  278 + List<Object> streamInfoScan = RedisUtil.scan(key);
283 279 if (streamInfoScan.size() > 0) {
284   - return (StreamInfo) redis.get((String) streamInfoScan.get(0));
  280 + return (StreamInfo) RedisUtil.get((String) streamInfoScan.get(0));
285 281 }else {
286 282 return null;
287 283 }
... ... @@ -290,64 +286,64 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage {
290 286 @Override
291 287 public void updatePlatformCatchInfo(ParentPlatformCatch parentPlatformCatch) {
292 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 292 @Override
297 293 public void updatePlatformKeepalive(ParentPlatform parentPlatform) {
298 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 298 @Override
303 299 public void updatePlatformRegister(ParentPlatform parentPlatform) {
304 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 304 @Override
309 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 309 @Override
314 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 314 @Override
319 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 319 @Override
324 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 325 @Override
330 326 public void updatePlatformRegisterInfo(String callId, String platformGbId) {
331 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 332 @Override
337 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 337 @Override
342 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 342 @Override
347 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 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 352 String key = VideoManagerConstants.PLATFORM_SEND_RTP_INFO_PREFIX + userSetting.getServerId() + "_"
357 353 + sendRtpItem.getPlatformId() + "_" + sendRtpItem.getChannelId() + "_"
358 354 + sendRtpItem.getStreamId() + "_" + sendRtpItem.getCallId();
359   - redis.set(key, sendRtpItem);
  355 + RedisUtil.set(key, sendRtpItem);
360 356 }
361 357  
362 358 @Override
... ... @@ -375,9 +371,9 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage {
375 371 }
376 372 String key = VideoManagerConstants.PLATFORM_SEND_RTP_INFO_PREFIX + userSetting.getServerId() + "_" + platformGbId
377 373 + "_" + channelId + "_" + streamId + "_" + callId;
378   - List<Object> scan = redis.scan(key);
  374 + List<Object> scan = RedisUtil.scan(key);
379 375 if (scan.size() > 0) {
380   - return (SendRtpItem)redis.get((String)scan.get(0));
  376 + return (SendRtpItem)RedisUtil.get((String)scan.get(0));
381 377 }else {
382 378 return null;
383 379 }
... ... @@ -389,12 +385,12 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage {
389 385 platformGbId = "*";
390 386 }
391 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 389 List<SendRtpItem> result= new ArrayList<>();
394 390  
395 391 for (Object o : queryResult) {
396 392 String keyItem = (String) o;
397   - result.add((SendRtpItem) redis.get(keyItem));
  393 + result.add((SendRtpItem) RedisUtil.get(keyItem));
398 394 }
399 395  
400 396 return result;
... ... @@ -415,10 +411,10 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage {
415 411 }
416 412 String key = VideoManagerConstants.PLATFORM_SEND_RTP_INFO_PREFIX + userSetting.getServerId() + "_" + platformGbId
417 413 + "_" + channelId + "_" + streamId + "_" + callId;
418   - List<Object> scan = redis.scan(key);
  414 + List<Object> scan = RedisUtil.scan(key);
419 415 if (scan.size() > 0) {
420 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 428 @Override
433 429 public boolean isChannelSendingRTP(String channelId) {
434 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 432 if (RtpStreams.size() > 0) {
437 433 return true;
438 434 } else {
... ... @@ -442,30 +438,30 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage {
442 438  
443 439 @Override
444 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 442 userSetting.getServerId(),
447 443 deviceId));
448 444 if (playLeys.size() > 0) {
449 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 451 userSetting.getServerId(),
456 452 deviceId));
457 453 if (playBackers.size() > 0) {
458 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 460 userSetting.getServerId(),
465 461 deviceId));
466 462 if (deviceCache.size() > 0) {
467 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 469 @Override
474 470 public void updateWVPInfo(JSONObject jsonObject, int time) {
475 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 475 @Override
480 476 public void sendStreamChangeMsg(String type, JSONObject jsonObject) {
481 477 String key = VideoManagerConstants.WVP_MSG_STREAM_CHANGE_PREFIX + type;
482 478 logger.info("[redis 流变化事件] {}: {}", key, jsonObject.toString());
483   - redis.convertAndSend(key, jsonObject);
  479 + RedisUtil.convertAndSend(key, jsonObject);
484 480 }
485 481  
486 482 @Override
... ... @@ -491,13 +487,13 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage {
491 487 if (streamAuthorityInfo != null) {
492 488 mediaItem.setCallId(streamAuthorityInfo.getCallId());
493 489 }
494   - redis.set(key, mediaItem);
  490 + RedisUtil.set(key, mediaItem);
495 491 }
496 492  
497 493 @Override
498 494 public void removeStream(String mediaServerId, String type, String app, String streamId) {
499 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 499 @Override
... ... @@ -524,9 +520,9 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage {
524 520 stream,
525 521 callId
526 522 );
527   - List<Object> streamInfoScan = redis.scan(key);
  523 + List<Object> streamInfoScan = RedisUtil.scan(key);
528 524 if (streamInfoScan.size() > 0) {
529   - return (StreamInfo) redis.get((String) streamInfoScan.get(0));
  525 + return (StreamInfo) RedisUtil.get((String) streamInfoScan.get(0));
530 526 }else {
531 527 return null;
532 528 }
... ... @@ -535,16 +531,16 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage {
535 531 @Override
536 532 public ThirdPartyGB queryMemberNoGBId(String queryKey) {
537 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 535 return JSONObject.toJavaObject(jsonObject, ThirdPartyGB.class);
540 536 }
541 537  
542 538 @Override
543 539 public void removeStream(String mediaServerId, String type) {
544 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 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 548 public List<MediaItem> getStreams(String mediaServerId, String type) {
553 549 List<MediaItem> result = new ArrayList<>();
554 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 552 for (Object stream : streams) {
557   - MediaItem mediaItem = (MediaItem)redis.get((String) stream);
  553 + MediaItem mediaItem = (MediaItem)RedisUtil.get((String) stream);
558 554 result.add(mediaItem);
559 555 }
560 556 return result;
... ... @@ -563,43 +559,43 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage {
563 559 @Override
564 560 public void updateDevice(Device device) {
565 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 565 @Override
570 566 public void removeDevice(String deviceId) {
571 567 String key = VideoManagerConstants.DEVICE_PREFIX + userSetting.getServerId() + "_" + deviceId;
572   - redis.del(key);
  568 + RedisUtil.del(key);
573 569 }
574 570  
575 571 @Override
576 572 public Device getDevice(String deviceId) {
577 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 577 @Override
582 578 public void updateGpsMsgInfo(GPSMsgInfo gpsMsgInfo) {
583 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 583 @Override
588 584 public GPSMsgInfo getGpsMsgInfo(String gbId) {
589 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 589 @Override
594 590 public List<GPSMsgInfo> getAllGpsMsgInfo() {
595 591 String scanKey = VideoManagerConstants.WVP_STREAM_GPS_MSG_PREFIX + userSetting.getServerId() + "_*";
596 592 List<GPSMsgInfo> result = new ArrayList<>();
597   - List<Object> keys = redis.scan(scanKey);
  593 + List<Object> keys = RedisUtil.scan(scanKey);
598 594 for (Object o : keys) {
599 595 String key = (String) o;
600   - GPSMsgInfo gpsMsgInfo = (GPSMsgInfo) redis.get(key);
  596 + GPSMsgInfo gpsMsgInfo = (GPSMsgInfo) RedisUtil.get(key);
601 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 605 @Override
610 606 public void updateStreamAuthorityInfo(String app, String stream, StreamAuthorityInfo streamAuthorityInfo) {
611 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 611 @Override
616 612 public void removeStreamAuthorityInfo(String app, String stream) {
617 613 String key = VideoManagerConstants.MEDIA_STREAM_AUTHORITY + userSetting.getServerId() + "_" + app+ "_" + stream ;
618   - redis.del(key);
  614 + RedisUtil.del(key);
619 615 }
620 616  
621 617 @Override
622 618 public StreamAuthorityInfo getStreamAuthorityInfo(String app, String stream) {
623 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 627 String scanKey = VideoManagerConstants.WVP_SERVER_STREAM_PREFIX + userSetting.getServerId() + "_*_" + app + "_" + streamId + "_" + mediaServerId;
632 628  
633 629 MediaItem result = null;
634   - List<Object> keys = redis.scan(scanKey);
  630 + List<Object> keys = RedisUtil.scan(scanKey);
635 631 if (keys.size() > 0) {
636 632 String key = (String) keys.get(0);
637   - result = (MediaItem)redis.get(key);
  633 + result = (MediaItem)RedisUtil.get(key);
638 634 }
639 635  
640 636 return result;
... ... @@ -646,11 +642,11 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage {
646 642 SystemInfoDto<Double> systemInfoDto = new SystemInfoDto<>();
647 643 systemInfoDto.setTime(DateUtil.getNow());
648 644 systemInfoDto.setData(cpuInfo);
649   - redis.lSet(key, systemInfoDto);
  645 + RedisUtil.lSet(key, systemInfoDto);
650 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 657 SystemInfoDto<Double> systemInfoDto = new SystemInfoDto<>();
662 658 systemInfoDto.setTime(DateUtil.getNow());
663 659 systemInfoDto.setData(memInfo);
664   - redis.lSet(key, systemInfoDto);
  660 + RedisUtil.lSet(key, systemInfoDto);
665 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 672 SystemInfoDto<Map<String, String>> systemInfoDto = new SystemInfoDto<>();
677 673 systemInfoDto.setTime(DateUtil.getNow());
678 674 systemInfoDto.setData(networkInterfaces);
679   - redis.lSet(key, systemInfoDto);
  675 + RedisUtil.lSet(key, systemInfoDto);
680 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 685 public void sendMobilePositionMsg(JSONObject jsonObject) {
690 686 String key = VideoManagerConstants.VM_MSG_SUBSCRIBE_MOBILE_POSITION;
691 687 logger.info("[redis发送通知]移动位置 {}: {}", key, jsonObject.toString());
692   - redis.convertAndSend(key, jsonObject);
  688 + RedisUtil.convertAndSend(key, jsonObject);
693 689 }
694 690  
695 691 @Override
696 692 public void sendStreamPushRequestedMsg(MessageForPushChannel msg) {
697 693 String key = VideoManagerConstants.VM_MSG_STREAM_PUSH_REQUESTED;
698 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 698 @Override
703 699 public void sendAlarmMsg(AlarmChannelMessage msg) {
704 700 String key = VideoManagerConstants.VM_MSG_SUBSCRIBE_ALARM;
705 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 705 @Override
... ... @@ -718,6 +714,6 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage {
718 714 logger.info("[redis通知]获取所有推流设备的状态");
719 715 JSONObject jsonObject = new JSONObject();
720 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 4 import java.util.concurrent.TimeUnit;
5 5  
6 6 import com.alibaba.fastjson.JSONObject;
  7 +import com.genersoft.iot.vmp.utils.SpringBeanFactory;
7 8 import org.springframework.beans.factory.annotation.Autowired;
8 9 import org.springframework.data.redis.core.*;
9 10 import org.springframework.stereotype.Component;
... ... @@ -14,12 +15,14 @@ import org.springframework.util.CollectionUtils;
14 15 * @author: swwheihei
15 16 * @date: 2020年5月6日 下午8:27:29
16 17 */
17   -@Component
18 18 @SuppressWarnings(value = {"rawtypes", "unchecked"})
19 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 30 * @param time 时间(秒)
28 31 * @return true / false
29 32 */
30   - public boolean expire(String key, long time) {
  33 + public static boolean expire(String key, long time) {
31 34 try {
32 35 if (time > 0) {
33 36 redisTemplate.expire(key, time, TimeUnit.SECONDS);
... ... @@ -44,7 +47,7 @@ public class RedisUtil {
44 47 * @param key 键
45 48 * @return
46 49 */
47   - public long getExpire(String key) {
  50 + public static long getExpire(String key) {
48 51 return redisTemplate.getExpire(key, TimeUnit.SECONDS);
49 52 }
50 53  
... ... @@ -53,7 +56,7 @@ public class RedisUtil {
53 56 * @param key 键
54 57 * @return true / false
55 58 */
56   - public boolean hasKey(String key) {
  59 + public static boolean hasKey(String key) {
57 60 try {
58 61 return redisTemplate.hasKey(key);
59 62 } catch (Exception e) {
... ... @@ -67,7 +70,7 @@ public class RedisUtil {
67 70 * @SuppressWarnings("unchecked") 忽略类型转换警告
68 71 * @param key 键(一个或者多个)
69 72 */
70   - public boolean del(String... key) {
  73 + public static boolean del(String... key) {
71 74 try {
72 75 if (key != null && key.length > 0) {
73 76 if (key.length == 1) {
... ... @@ -91,7 +94,7 @@ public class RedisUtil {
91 94 * @param key 键
92 95 * @return 值
93 96 */
94   - public Object get(String key) {
  97 + public static Object get(String key) {
95 98 return key == null ? null : redisTemplate.opsForValue().get(key);
96 99 }
97 100  
... ... @@ -101,7 +104,7 @@ public class RedisUtil {
101 104 * @param value 值
102 105 * @return true / false
103 106 */
104   - public boolean set(String key, Object value) {
  107 + public static boolean set(String key, Object value) {
105 108 try {
106 109 redisTemplate.opsForValue().set(key, value);
107 110 return true;
... ... @@ -118,7 +121,7 @@ public class RedisUtil {
118 121 * @param time 时间(秒),如果 time < 0 则设置无限时间
119 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 125 try {
123 126 if (time > 0) {
124 127 redisTemplate.opsForValue().set(key, value, time, TimeUnit.SECONDS);
... ... @@ -138,7 +141,7 @@ public class RedisUtil {
138 141 * @param delta 递增大小
139 142 * @return
140 143 */
141   - public long incr(String key, long delta) {
  144 + public static long incr(String key, long delta) {
142 145 if (delta < 0) {
143 146 throw new RuntimeException("递增因子必须大于 0");
144 147 }
... ... @@ -151,7 +154,7 @@ public class RedisUtil {
151 154 * @param delta 递减大小
152 155 * @return
153 156 */
154   - public long decr(String key, long delta) {
  157 + public static long decr(String key, long delta) {
155 158 if (delta < 0) {
156 159 throw new RuntimeException("递减因子必须大于 0");
157 160 }
... ... @@ -166,7 +169,7 @@ public class RedisUtil {
166 169 * @param item 项(no null)
167 170 * @return 值
168 171 */
169   - public Object hget(String key, String item) {
  172 + public static Object hget(String key, String item) {
170 173 return redisTemplate.opsForHash().get(key, item);
171 174 }
172 175  
... ... @@ -175,7 +178,7 @@ public class RedisUtil {
175 178 * @param key 键(no null)
176 179 * @return 对应的多个键值
177 180 */
178   - public Map<Object, Object> hmget(String key) {
  181 + public static Map<Object, Object> hmget(String key) {
179 182 return redisTemplate.opsForHash().entries(key);
180 183 }
181 184  
... ... @@ -185,7 +188,7 @@ public class RedisUtil {
185 188 * @param map 值
186 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 192 try {
190 193 redisTemplate.opsForHash().putAll(key, map);
191 194 return true;
... ... @@ -202,7 +205,7 @@ public class RedisUtil {
202 205 * @param time 时间
203 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 209 try {
207 210 redisTemplate.opsForHash().putAll(key, map);
208 211 if (time > 0) {
... ... @@ -222,7 +225,7 @@ public class RedisUtil {
222 225 * @param value 值
223 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 229 try {
227 230 redisTemplate.opsForHash().put(key, item, value);
228 231 return true;
... ... @@ -240,7 +243,7 @@ public class RedisUtil {
240 243 * @param time 时间(如果原来的 Hash表 设置了时间,这里会覆盖)
241 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 247 try {
245 248 redisTemplate.opsForHash().put(key, item, value);
246 249 if (time > 0) {
... ... @@ -258,7 +261,7 @@ public class RedisUtil {
258 261 * @param key 键
259 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 265 redisTemplate.opsForHash().delete(key, item);
263 266 }
264 267  
... ... @@ -268,7 +271,7 @@ public class RedisUtil {
268 271 * @param item 值(no null)
269 272 * @return true / false
270 273 */
271   - public boolean hHasKey(String key, String item) {
  274 + public static boolean hHasKey(String key, String item) {
272 275 return redisTemplate.opsForHash().hasKey(key, item);
273 276 }
274 277  
... ... @@ -279,7 +282,7 @@ public class RedisUtil {
279 282 * @param by 递增大小 > 0
280 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 286 return redisTemplate.opsForHash().increment(key, item, by);
284 287 }
285 288  
... ... @@ -290,7 +293,7 @@ public class RedisUtil {
290 293 * @param by 递减大小
291 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 297 return redisTemplate.opsForHash().increment(key, item, -by);
295 298 }
296 299  
... ... @@ -301,7 +304,7 @@ public class RedisUtil {
301 304 * @param key 键
302 305 * @return 值
303 306 */
304   - public Set<Object> sGet(String key) {
  307 + public static Set<Object> sGet(String key) {
305 308 try {
306 309 return redisTemplate.opsForSet().members(key);
307 310 } catch (Exception e) {
... ... @@ -316,7 +319,7 @@ public class RedisUtil {
316 319 * @param value 值
317 320 * @return true / false
318 321 */
319   - public boolean sHasKey(String key, Object value) {
  322 + public static boolean sHasKey(String key, Object value) {
320 323 try {
321 324 return redisTemplate.opsForSet().isMember(key, value);
322 325 } catch (Exception e) {
... ... @@ -331,7 +334,7 @@ public class RedisUtil {
331 334 * @param values 值(可以多个)
332 335 * @return 成功个数
333 336 */
334   - public long sSet(String key, Object... values) {
  337 + public static long sSet(String key, Object... values) {
335 338 try {
336 339 return redisTemplate.opsForSet().add(key, values);
337 340 } catch (Exception e) {
... ... @@ -347,7 +350,7 @@ public class RedisUtil {
347 350 * @param values 值(可以多个)
348 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 354 try {
352 355 long count = redisTemplate.opsForSet().add(key, values);
353 356 if (time > 0) {
... ... @@ -365,7 +368,7 @@ public class RedisUtil {
365 368 * @param key 键
366 369 * @return 长度
367 370 */
368   - public long sGetSetSize(String key) {
  371 + public static long sGetSetSize(String key) {
369 372 try {
370 373 return redisTemplate.opsForSet().size(key);
371 374 } catch (Exception e) {
... ... @@ -380,7 +383,7 @@ public class RedisUtil {
380 383 * @param values 值
381 384 * @return 成功移除个数
382 385 */
383   - public long setRemove(String key, Object... values) {
  386 + public static long setRemove(String key, Object... values) {
384 387 try {
385 388 return redisTemplate.opsForSet().remove(key, values);
386 389 } catch (Exception e) {
... ... @@ -397,7 +400,7 @@ public class RedisUtil {
397 400 * @param value
398 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 404 redisTemplate.opsForZSet().add(key, value, score);
402 405 }
403 406  
... ... @@ -407,7 +410,7 @@ public class RedisUtil {
407 410 * @param key
408 411 * @param value
409 412 */
410   - public void zRemove(Object key, Object value) {
  413 + public static void zRemove(Object key, Object value) {
411 414 redisTemplate.opsForZSet().remove(key, value);
412 415 }
413 416  
... ... @@ -418,7 +421,7 @@ public class RedisUtil {
418 421 * @param value
419 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 425 return redisTemplate.opsForZSet().incrementScore(key, value, delta);
423 426 }
424 427  
... ... @@ -429,7 +432,7 @@ public class RedisUtil {
429 432 * @param value
430 433 * @return
431 434 */
432   - public Double zScore(Object key, Object value) {
  435 + public static Double zScore(Object key, Object value) {
433 436 return redisTemplate.opsForZSet().score(key, value);
434 437 }
435 438  
... ... @@ -440,7 +443,7 @@ public class RedisUtil {
440 443 * @param value
441 444 * @return
442 445 */
443   - public Long zRank(Object key, Object value) {
  446 + public static Long zRank(Object key, Object value) {
444 447 return redisTemplate.opsForZSet().rank(key, value);
445 448 }
446 449  
... ... @@ -450,7 +453,7 @@ public class RedisUtil {
450 453 * @param key
451 454 * @return
452 455 */
453   - public Long zSize(Object key) {
  456 + public static Long zSize(Object key) {
454 457 return redisTemplate.opsForZSet().zCard(key);
455 458 }
456 459  
... ... @@ -464,7 +467,7 @@ public class RedisUtil {
464 467 * @param end
465 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 471 return redisTemplate.opsForZSet().range(key, start, end);
469 472 }
470 473 /**
... ... @@ -475,7 +478,7 @@ public class RedisUtil {
475 478 * @param end
476 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 482 return redisTemplate.opsForZSet().rangeWithScores(key, start, end);
480 483 }
481 484 /**
... ... @@ -488,7 +491,7 @@ public class RedisUtil {
488 491 * @param end
489 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 495 return redisTemplate.opsForZSet().reverseRange(key, start, end);
493 496 }
494 497 /**
... ... @@ -499,7 +502,7 @@ public class RedisUtil {
499 502 * @param max
500 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 506 return redisTemplate.opsForZSet().rangeByScore(key, min, max);
504 507 }
505 508  
... ... @@ -513,7 +516,7 @@ public class RedisUtil {
513 516 * @param end 结束(0 到 -1 代表所有值)
514 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 520 try {
518 521 return redisTemplate.opsForList().range(key, start, end);
519 522 } catch (Exception e) {
... ... @@ -527,7 +530,7 @@ public class RedisUtil {
527 530 * @param key 键
528 531 * @return 长度
529 532 */
530   - public long lGetListSize(String key) {
  533 + public static long lGetListSize(String key) {
531 534 try {
532 535 return redisTemplate.opsForList().size(key);
533 536 } catch (Exception e) {
... ... @@ -544,7 +547,7 @@ public class RedisUtil {
544 547 * 当 index < 0 时 {-1:表尾, -2:倒数第二个元素}
545 548 * @return 值
546 549 */
547   - public Object lGetIndex(String key, long index) {
  550 + public static Object lGetIndex(String key, long index) {
548 551 try {
549 552 return redisTemplate.opsForList().index(key, index);
550 553 } catch (Exception e) {
... ... @@ -559,7 +562,7 @@ public class RedisUtil {
559 562 * @param value 值
560 563 * @return true / false
561 564 */
562   - public boolean lSet(String key, Object value) {
  565 + public static boolean lSet(String key, Object value) {
563 566 try {
564 567 redisTemplate.opsForList().rightPush(key, value);
565 568 return true;
... ... @@ -576,7 +579,7 @@ public class RedisUtil {
576 579 * @param time 时间
577 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 583 try {
581 584 redisTemplate.opsForList().rightPush(key, value);
582 585 if (time > 0) {
... ... @@ -595,7 +598,7 @@ public class RedisUtil {
595 598 * @param values 值
596 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 602 try {
600 603 redisTemplate.opsForList().rightPushAll(key, values);
601 604 return true;
... ... @@ -612,7 +615,7 @@ public class RedisUtil {
612 615 * @param time 时间
613 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 619 try {
617 620 redisTemplate.opsForList().rightPushAll(key, values);
618 621 if (time > 0) {
... ... @@ -632,7 +635,7 @@ public class RedisUtil {
632 635 * @param value 值
633 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 639 try {
637 640 redisTemplate.opsForList().set(key, index, value);
638 641 return true;
... ... @@ -651,7 +654,7 @@ public class RedisUtil {
651 654 * @param value
652 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 658 try {
656 659 return redisTemplate.opsForList().remove(key, count, value);
657 660 } catch (Exception e) {
... ... @@ -665,7 +668,7 @@ public class RedisUtil {
665 668 * @param key 键
666 669 * @return
667 670 */
668   - public Object lLeftPop(String key) {
  671 + public static Object lLeftPop(String key) {
669 672 return redisTemplate.opsForList().leftPop(key);
670 673 }
671 674  
... ... @@ -674,7 +677,7 @@ public class RedisUtil {
674 677 * @param key 键
675 678 * @return
676 679 */
677   - public Object lrightPop(String key) {
  680 + public static Object lrightPop(String key) {
678 681 return redisTemplate.opsForList().rightPop(key);
679 682 }
680 683  
... ... @@ -683,7 +686,7 @@ public class RedisUtil {
683 686 * @param key 键
684 687 * @return true / false
685 688 */
686   - public List<Object> keys(String key) {
  689 + public static List<Object> keys(String key) {
687 690 try {
688 691 Set<String> set = redisTemplate.keys(key);
689 692 return new ArrayList<>(set);
... ... @@ -699,7 +702,7 @@ public class RedisUtil {
699 702 * @param query 查询参数
700 703 * @return
701 704 */
702   -// public List<Object> scan(String query) {
  705 +// public static List<Object> scan(String query) {
703 706 // List<Object> result = new ArrayList<>();
704 707 // try {
705 708 // Cursor<Map.Entry<Object,Object>> cursor = redisTemplate.opsForHash().scan("field",
... ... @@ -723,33 +726,23 @@ public class RedisUtil {
723 726 * @param query 查询参数
724 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 746 // redisTemplate.convertAndSend(channel, msg);
754 747 redisTemplate.convertAndSend(channel, msg);
755 748  
... ...
src/main/java/com/genersoft/iot/vmp/vmanager/bean/BatchGBStreamParam.java
1 1 package com.genersoft.iot.vmp.vmanager.bean;
2 2  
3 3 import com.genersoft.iot.vmp.gb28181.bean.GbStream;
  4 +import io.swagger.v3.oas.annotations.media.Schema;
4 5  
5 6 import java.util.List;
6 7  
  8 +/**
  9 + * @author lin
  10 + */
  11 +@Schema(description = "多个推流信息")
7 12 public class BatchGBStreamParam {
  13 + @Schema(description = "推流信息列表")
8 14 private List<GbStream> gbStreams;
9 15  
10 16 public List<GbStream> getGbStreams() {
... ...
src/main/java/com/genersoft/iot/vmp/vmanager/bean/WVPResult.java
1 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 7 public class WVPResult<T> {
5 8  
6 9 public WVPResult() {
... ... @@ -13,8 +16,11 @@ public class WVPResult&lt;T&gt; {
13 16 }
14 17  
15 18  
  19 + @Schema(description = "错误码,0为成功")
16 20 private int code;
  21 + @Schema(description = "描述,错误时描述错误原因")
17 22 private String msg;
  23 + @Schema(description = "数据")
18 24 private T data;
19 25  
20 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 13 import com.genersoft.iot.vmp.vmanager.bean.WVPResult;
14 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 19 import org.slf4j.Logger;
21 20 import org.slf4j.LoggerFactory;
22 21 import org.springframework.beans.factory.annotation.Autowired;
... ... @@ -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 36 @CrossOrigin
38 37 @RestController
39 38 @RequestMapping("/api/position")
... ... @@ -54,27 +53,22 @@ public class MobilePositionController {
54 53 private IDeviceService deviceService;
55 54  
56 55 /**
57   - * 查询历史轨迹
  56 + * 查询历史轨迹
58 57 * @param deviceId 设备ID
59 58 * @param start 开始时间
60 59 * @param end 结束时间
61 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 67 @GetMapping("/history/{deviceId}")
71 68 public ResponseEntity<WVPResult<List<MobilePosition>>> positions(@PathVariable String deviceId,
72 69 @RequestParam(required = false) String channelId,
73 70 @RequestParam(required = false) String start,
74 71 @RequestParam(required = false) String end) {
75   -// if (logger.isDebugEnabled()) {
76   -// logger.debug("查询设备" + deviceId + "的历史轨迹");
77   -// }
78 72  
79 73 if (StringUtil.isEmpty(start)) {
80 74 start = null;
... ... @@ -94,15 +88,10 @@ public class MobilePositionController {
94 88 * @param deviceId 设备ID
95 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 93 @GetMapping("/latest/{deviceId}")
102 94 public ResponseEntity<MobilePosition> latestPosition(@PathVariable String deviceId) {
103   -// if (logger.isDebugEnabled()) {
104   -// logger.debug("查询设备" + deviceId + "的最新位置");
105   -// }
106 95 MobilePosition result = storager.queryLatestPosition(deviceId);
107 96 return new ResponseEntity<>(result, HttpStatus.OK);
108 97 }
... ... @@ -112,10 +101,8 @@ public class MobilePositionController {
112 101 * @param deviceId 设备ID
113 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 106 @GetMapping("/realtime/{deviceId}")
120 107 public DeferredResult<ResponseEntity<MobilePosition>> realTimePosition(@PathVariable String deviceId) {
121 108 Device device = storager.queryVideoDevice(deviceId);
... ... @@ -149,12 +136,10 @@ public class MobilePositionController {
149 136 * @param interval 上报时间间隔
150 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 143 @GetMapping("/subscribe/{deviceId}")
159 144 public ResponseEntity<String> positionSubscribe(@PathVariable String deviceId,
160 145 @RequestParam String expires,
... ...
src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/SseController/SseController.java
1 1 package com.genersoft.iot.vmp.vmanager.gb28181.SseController;
2 2  
3 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 6 import org.springframework.beans.factory.annotation.Autowired;
9 7 import org.springframework.stereotype.Controller;
10 8 import org.springframework.web.bind.annotation.CrossOrigin;
... ... @@ -18,7 +16,7 @@ import org.springframework.web.servlet.mvc.method.annotation.SseEmitter;
18 16 * @author: lawrencehj
19 17 * @data: 2021-01-20
20 18 */
21   -@Api(tags = "SSE推送")
  19 +@Tag(name = "SSE推送")
22 20 @CrossOrigin
23 21 @Controller
24 22 @RequestMapping("/api")
... ... @@ -26,10 +24,6 @@ public class SseController {
26 24 @Autowired
27 25 AlarmEventListener alarmEventListener;
28 26  
29   - @ApiOperation("浏览器推送")
30   - @ApiImplicitParams({
31   - @ApiImplicitParam(name = "browserId", value = "浏览器ID", dataTypeClass = String.class),
32   - })
33 27 @GetMapping("/emit")
34 28 public SseEmitter emit(@RequestParam String browserId) {
35 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 3 import com.genersoft.iot.vmp.gb28181.bean.Device;
4 4 import com.genersoft.iot.vmp.gb28181.bean.DeviceAlarm;
5 5 import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform;
6   -import com.genersoft.iot.vmp.gb28181.bean.SubscribeInfo;
7 6 import com.genersoft.iot.vmp.gb28181.transmit.cmd.ISIPCommander;
8 7 import com.genersoft.iot.vmp.gb28181.transmit.cmd.ISIPCommanderForPlatform;
9 8 import com.genersoft.iot.vmp.service.IDeviceAlarmService;
10   -import com.genersoft.iot.vmp.service.IGbStreamService;
11 9 import com.genersoft.iot.vmp.storager.IVideoManagerStorage;
12 10 import com.genersoft.iot.vmp.utils.DateUtil;
13 11 import com.genersoft.iot.vmp.vmanager.bean.WVPResult;
14 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 16 import org.springframework.beans.factory.annotation.Autowired;
21 17 import org.springframework.http.HttpStatus;
22 18 import org.springframework.http.ResponseEntity;
23 19 import org.springframework.util.StringUtils;
24 20 import org.springframework.web.bind.annotation.*;
25 21  
26   -import java.text.ParseException;
27 22 import java.time.LocalDateTime;
28 23 import java.util.Arrays;
29 24 import java.util.List;
30 25  
31   -@Api(tags = "报警信息管理")
  26 +@Tag(name = "报警信息管理")
32 27 @CrossOrigin
33 28 @RestController
34 29 @RequestMapping("/api/alarm")
... ... @@ -46,68 +41,6 @@ public class AlarmController {
46 41 @Autowired
47 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 50 * @param time 结束时间(这个时间之前的报警会被删除)
118 51 * @return
119 52 */
120   - @ApiOperation("删除报警")
121 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 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 63 if (StringUtils.isEmpty(id)) {
133 64 id = null;
... ... @@ -161,11 +92,9 @@ public class AlarmController {
161 92 * @param deviceId 报警id
162 93 * @return
163 94 */
164   - @ApiOperation("测试向上级/设备发送模拟报警通知")
165 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 98 public ResponseEntity<WVPResult<String>> delete(
170 99 @RequestParam(required = false) String deviceId
171 100 ) {
... ... @@ -201,5 +130,64 @@ public class AlarmController {
201 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 14 import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommander;
15 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 20 import org.slf4j.Logger;
22 21 import org.slf4j.LoggerFactory;
23 22 import org.springframework.beans.factory.annotation.Autowired;
... ... @@ -28,7 +27,7 @@ import org.springframework.web.context.request.async.DeferredResult;
28 27  
29 28 import java.util.UUID;
30 29  
31   -@Api(tags = "国标设备配置")
  30 +@Tag(name = "国标设备配置")
32 31 @CrossOrigin
33 32 @RestController
34 33 @RequestMapping("/api/device/config")
... ... @@ -55,16 +54,14 @@ public class DeviceConfig {
55 54 * @param heartBeatCount 心跳计数
56 55 * @return
57 56 */
58   - @ApiOperation("基本配置设置命令")
59 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 65 public DeferredResult<ResponseEntity<String>> homePositionApi(@PathVariable String deviceId,
69 66 String channelId,
70 67 @RequestParam(required = false) String name,
... ... @@ -109,12 +106,10 @@ public class DeviceConfig {
109 106 * @param channelId 通道ID
110 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 113 @GetMapping("/query/{deviceId}/{configType}")
119 114 public DeferredResult<ResponseEntity<String>> configDownloadApi(@PathVariable String deviceId,
120 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 14 import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommander;
15 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 20 import org.slf4j.Logger;
22 21 import org.slf4j.LoggerFactory;
23 22 import org.springframework.beans.factory.annotation.Autowired;
... ... @@ -29,7 +28,7 @@ import org.springframework.web.context.request.async.DeferredResult;
29 28  
30 29 import java.util.UUID;
31 30  
32   -@Api(tags = "国标设备控制")
  31 +@Tag(name = "国标设备控制")
33 32 @CrossOrigin
34 33 @RestController
35 34 @RequestMapping("/api/device/control")
... ... @@ -51,10 +50,12 @@ public class DeviceControl {
51 50 *
52 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 59 @GetMapping("/teleboot/{deviceId}")
59 60 public ResponseEntity<String> teleBootApi(@PathVariable String deviceId) {
60 61 if (logger.isDebugEnabled()) {
... ... @@ -80,13 +81,10 @@ public class DeviceControl {
80 81 * @param recordCmdStr Record:手动录像,StopRecord:停止手动录像
81 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 88 @GetMapping("/record/{deviceId}/{recordCmdStr}")
91 89 public DeferredResult<ResponseEntity<String>> recordApi(@PathVariable String deviceId,
92 90 @PathVariable String recordCmdStr, String channelId) {
... ... @@ -127,13 +125,10 @@ public class DeviceControl {
127 125 * @param deviceId 设备ID
128 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 132 @GetMapping("/guard/{deviceId}/{guardCmdStr}")
138 133 public DeferredResult<ResponseEntity<String>> guardApi(@PathVariable String deviceId, String channelId, @PathVariable String guardCmdStr) {
139 134 if (logger.isDebugEnabled()) {
... ... @@ -171,13 +166,11 @@ public class DeviceControl {
171 166 * @param alarmMethod 报警方式(可选)
172 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 174 @GetMapping("/reset_alarm/{deviceId}")
182 175 public DeferredResult<ResponseEntity<String>> resetAlarmApi(@PathVariable String deviceId, String channelId,
183 176 @RequestParam(required = false) String alarmMethod,
... ... @@ -215,11 +208,9 @@ public class DeviceControl {
215 208 * @param deviceId 设备ID
216 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 214 @GetMapping("/i_frame/{deviceId}")
224 215 public ResponseEntity<String> iFrame(@PathVariable String deviceId,
225 216 @RequestParam(required = false) String channelId) {
... ... @@ -249,15 +240,12 @@ public class DeviceControl {
249 240 * @param presetIndex 调用预置位编号(可选)
250 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 249 @GetMapping("/home_position/{deviceId}/{enabled}")
262 250 public DeferredResult<ResponseEntity<String>> homePositionApi(@PathVariable String deviceId,
263 251 @PathVariable String enabled,
... ... @@ -307,17 +295,14 @@ public class DeviceControl {
307 295 * @param lengthy 拉框宽度像素值
308 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 306 @GetMapping("drag_zoom/zoom_in")
322 307 public ResponseEntity<String> dragZoomIn(@RequestParam String deviceId,
323 308 @RequestParam(required = false) String channelId,
... ... @@ -356,17 +341,15 @@ public class DeviceControl {
356 341 * @param lengthy 拉框宽度像素值
357 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 353 @GetMapping("/drag_zoom/zoom_out")
371 354 public ResponseEntity<String> dragZoomOut(@RequestParam String deviceId,
372 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 19 import com.genersoft.iot.vmp.vmanager.bean.BaseTree;
20 20 import com.genersoft.iot.vmp.vmanager.bean.WVPResult;
21 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 25 import org.apache.commons.compress.utils.IOUtils;
27 26 import org.apache.http.HttpResponse;
28 27 import org.slf4j.Logger;
... ... @@ -41,7 +40,7 @@ import java.io.*;
41 40 import java.nio.file.Files;
42 41 import java.util.*;
43 42  
44   -@Api(tags = "国标设备查询", value = "国标设备查询")
  43 +@Tag(name = "国标设备查询", description = "国标设备查询")
45 44 @SuppressWarnings("rawtypes")
46 45 @CrossOrigin
47 46 @RestController
... ... @@ -79,17 +78,11 @@ public class DeviceQuery {
79 78 * @param deviceId 国标ID
80 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 83 @GetMapping("/devices/{deviceId}")
87 84 public ResponseEntity<Device> devices(@PathVariable String deviceId){
88 85  
89   -// if (logger.isDebugEnabled()) {
90   -// logger.debug("查询视频设备API调用,deviceId:" + deviceId);
91   -// }
92   -
93 86 Device device = storager.queryVideoDevice(deviceId);
94 87 return new ResponseEntity<>(device,HttpStatus.OK);
95 88 }
... ... @@ -100,18 +93,12 @@ public class DeviceQuery {
100 93 * @param count 每页查询数量
101 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 99 @GetMapping("/devices")
109 100 public PageInfo<Device> devices(int page, int count){
110 101  
111   -// if (logger.isDebugEnabled()) {
112   -// logger.debug("查询所有视频设备API调用");
113   -// }
114   -
115 102 return storager.queryVideoDeviceList(page, count);
116 103 }
117 104  
... ... @@ -124,28 +111,24 @@ public class DeviceQuery {
124 111 * @param query 查询内容
125 112 * @param online 是否在线 在线 true / 离线 false
126 113 * @param channelType 设备 false/子目录 true
  114 + * @param catalogUnderDevice 是否直属与设备的目录
127 115 * @return 通道列表
128 116 */
129   - @ApiOperation("分页查询通道")
130 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 126 public ResponseEntity<PageInfo> channels(@PathVariable String deviceId,
141 127 int page, int count,
142 128 @RequestParam(required = false) String query,
143 129 @RequestParam(required = false) Boolean online,
144 130 @RequestParam(required = false) Boolean channelType,
145 131 @RequestParam(required = false) Boolean catalogUnderDevice) {
146   -// if (logger.isDebugEnabled()) {
147   -// logger.debug("查询视频设备通道API调用");
148   -// }
149 132 if (StringUtils.isEmpty(query)) {
150 133 query = null;
151 134 }
... ... @@ -159,10 +142,8 @@ public class DeviceQuery {
159 142 * @param deviceId 设备id
160 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 147 @PostMapping("/devices/{deviceId}/sync")
167 148 public WVPResult<SyncStatus> devicesSync(@PathVariable String deviceId){
168 149  
... ... @@ -192,10 +173,8 @@ public class DeviceQuery {
192 173 * @param deviceId 设备id
193 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 178 @DeleteMapping("/devices/{deviceId}/delete")
200 179 public ResponseEntity<String> delete(@PathVariable String deviceId){
201 180  
... ... @@ -239,16 +218,14 @@ public class DeviceQuery {
239 218 * @param channelType 通道类型
240 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 229 @GetMapping("/sub_channels/{deviceId}/{channelId}/channels")
253 230 public ResponseEntity<PageInfo> subChannels(@PathVariable String deviceId,
254 231 @PathVariable String channelId,
... ... @@ -258,9 +235,6 @@ public class DeviceQuery {
258 235 @RequestParam(required = false) Boolean online,
259 236 @RequestParam(required = false) Boolean channelType){
260 237  
261   -// if (logger.isDebugEnabled()) {
262   -// logger.debug("查询所有视频通道API调用");
263   -// }
264 238 DeviceChannel deviceChannel = storager.queryChannel(deviceId,channelId);
265 239 if (deviceChannel == null) {
266 240 PageInfo<DeviceChannel> deviceChannelPageResult = new PageInfo<>();
... ... @@ -277,13 +251,11 @@ public class DeviceQuery {
277 251 * @param channel 通道
278 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 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 259 deviceChannelService.updateChannel(deviceId, channel);
288 260 return new ResponseEntity<>(null,HttpStatus.OK);
289 261 }
... ... @@ -294,17 +266,14 @@ public class DeviceQuery {
294 266 * @param streamMode 数据流传输模式
295 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 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 275 Device device = storager.queryVideoDevice(deviceId);
306 276 device.setStreamMode(streamMode);
307   -// storager.updateDevice(device);
308 277 deviceService.updateDevice(device);
309 278 return new ResponseEntity<>(null,HttpStatus.OK);
310 279 }
... ... @@ -314,10 +283,8 @@ public class DeviceQuery {
314 283 * @param device 设备信息
315 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 288 @PostMapping("/device/update/")
322 289 public ResponseEntity<WVPResult<String>> updateDevice(Device device){
323 290  
... ... @@ -335,10 +302,8 @@ public class DeviceQuery {
335 302 *
336 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 307 @GetMapping("/devices/{deviceId}/status")
343 308 public DeferredResult<ResponseEntity<String>> deviceStatusApi(@PathVariable String deviceId) {
344 309 if (logger.isDebugEnabled()) {
... ... @@ -383,16 +348,14 @@ public class DeviceQuery {
383 348 * @param endTime 报警发生终止时间(可选)
384 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 359 @GetMapping("/alarm/{deviceId}")
397 360 public DeferredResult<ResponseEntity<String>> alarmApi(@PathVariable String deviceId,
398 361 @RequestParam(required = false) String startPriority,
... ... @@ -430,7 +393,8 @@ public class DeviceQuery {
430 393  
431 394  
432 395 @GetMapping("/{deviceId}/sync_status")
433   - @ApiOperation(value = "获取通道同步进度", notes = "获取通道同步进度")
  396 + @Operation(summary = "获取通道同步进度")
  397 + @Parameter(name = "deviceId", description = "设备国标编号", required = true)
434 398 public WVPResult<SyncStatus> getSyncStatus(@PathVariable String deviceId) {
435 399 SyncStatus channelSyncStatus = deviceService.getChannelSyncStatus(deviceId);
436 400 WVPResult<SyncStatus> wvpResult = new WVPResult<>();
... ... @@ -448,7 +412,8 @@ public class DeviceQuery {
448 412 }
449 413  
450 414 @GetMapping("/{deviceId}/subscribe_info")
451   - @ApiOperation(value = "获取设备的订阅状态", notes = "获取设备的订阅状态")
  415 + @Operation(summary = "获取设备的订阅状态")
  416 + @Parameter(name = "deviceId", description = "设备国标编号", required = true)
452 417 public WVPResult<Map<String, String>> getSubscribeInfo(@PathVariable String deviceId) {
453 418 Set<String> allKeys = dynamicTask.getAllKeys();
454 419 Map<String, String> dialogStateMap = new HashMap<>();
... ... @@ -473,7 +438,9 @@ public class DeviceQuery {
473 438 }
474 439  
475 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 444 public void getSnap(HttpServletResponse resp, @PathVariable String deviceId, @PathVariable String channelId) {
478 445  
479 446 try {
... ... @@ -493,16 +460,17 @@ public class DeviceQuery {
493 460 * @param count 每页条数
494 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 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 476 if (page <= 0) {
... ... @@ -543,13 +511,11 @@ public class DeviceQuery {
543 511 * @param count 每页条数
544 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 519 @GetMapping("/tree/channel/{deviceId}")
554 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 5 import com.genersoft.iot.vmp.vmanager.gb28181.gbStream.bean.GbStreamParam;
6 6 import com.genersoft.iot.vmp.service.IGbStreamService;
7 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 11 import org.slf4j.Logger;
13 12 import org.slf4j.LoggerFactory;
14 13 import org.springframework.beans.factory.annotation.Autowired;
15 14 import org.springframework.util.StringUtils;
16 15 import org.springframework.web.bind.annotation.*;
17 16  
18   -@Api(tags = "视频流关联到级联平台")
  17 +@Tag(name = "视频流关联到级联平台")
19 18 @CrossOrigin
20 19 @RestController
21 20 @RequestMapping("/api/gbStream")
... ... @@ -37,16 +36,13 @@ public class GbStreamController {
37 36 * @param platformId 平台ID
38 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 46 @GetMapping(value = "/list")
51 47 @ResponseBody
52 48 public PageInfo<GbStream> list(@RequestParam(required = true)Integer page,
... ... @@ -76,11 +72,7 @@ public class GbStreamController {
76 72 * @param gbStreamParam
77 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 76 @DeleteMapping(value = "/del")
85 77 @ResponseBody
86 78 public Object del(@RequestBody GbStreamParam gbStreamParam){
... ... @@ -97,10 +89,7 @@ public class GbStreamController {
97 89 * @param gbStreamParam
98 90 * @return
99 91 */
100   - @ApiOperation("保存国标关联")
101   - @ApiImplicitParams({
102   - @ApiImplicitParam(name = "gbStreamParam", value = "GbStreamParam", required = true, dataTypeClass = GbStreamParam.class),
103   - })
  92 + @Operation(summary = "保存国标关联")
104 93 @PostMapping(value = "/add")
105 94 @ResponseBody
106 95 public Object add(@RequestBody GbStreamParam gbStreamParam){
... ...
src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/gbStream/bean/GbStreamParam.java
1 1 package com.genersoft.iot.vmp.vmanager.gb28181.gbStream.bean;
2 2  
3 3 import com.genersoft.iot.vmp.gb28181.bean.GbStream;
  4 +import io.swagger.v3.oas.annotations.media.Schema;
4 5  
5 6 import java.util.List;
6 7  
  8 +@Schema(description = "国标关联参数")
7 9 public class GbStreamParam {
8 10  
  11 + @Schema(description = "平台ID")
9 12 private String platformId;
10 13  
  14 + @Schema(description = "目录ID")
11 15 private String catalogId;
12 16  
  17 + @Schema(description = "流国标信息列表")
13 18 private List<GbStream> gbStreams;
14 19  
15 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 3 import com.genersoft.iot.vmp.common.StreamInfo;
4 4 import com.genersoft.iot.vmp.conf.security.SecurityUtils;
5 5 import com.genersoft.iot.vmp.conf.security.dto.LoginUser;
6   -import com.genersoft.iot.vmp.media.zlm.dto.OnPublishHookParam;
7 6 import com.genersoft.iot.vmp.media.zlm.dto.StreamAuthorityInfo;
8   -import com.genersoft.iot.vmp.service.IMediaServerService;
9 7 import com.genersoft.iot.vmp.service.IStreamProxyService;
10   -import com.genersoft.iot.vmp.service.IStreamPushService;
11 8 import com.genersoft.iot.vmp.service.IMediaService;
12 9 import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
13   -import com.genersoft.iot.vmp.storager.IVideoManagerStorage;
14 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 14 import org.slf4j.Logger;
20 15 import org.slf4j.LoggerFactory;
21 16 import org.springframework.beans.factory.annotation.Autowired;
... ... @@ -25,7 +20,7 @@ import org.springframework.web.bind.annotation.*;
25 20 import javax.servlet.http.HttpServletRequest;
26 21  
27 22  
28   -@Api(tags = "媒体流相关")
  23 +@Tag(name = "媒体流相关")
29 24 @Controller
30 25 @CrossOrigin
31 26 @RequestMapping(value = "/api/media")
... ... @@ -48,12 +43,12 @@ public class MediaController {
48 43 * @param stream 流id
49 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 52 @GetMapping(value = "/stream_info_by_app_and_stream")
58 53 @ResponseBody
59 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 18 import com.genersoft.iot.vmp.vmanager.gb28181.platform.bean.ChannelReduce;
19 19 import com.genersoft.iot.vmp.vmanager.gb28181.platform.bean.UpdateChannelParam;
20 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 24 import org.slf4j.Logger;
26 25 import org.slf4j.LoggerFactory;
27 26 import org.springframework.beans.factory.annotation.Autowired;
... ... @@ -36,7 +35,7 @@ import java.util.List;
36 35 /**
37 36 * 级联平台管理
38 37 */
39   -@Api(tags = "级联平台管理")
  38 +@Tag(name = "级联平台管理")
40 39 @CrossOrigin
41 40 @RestController
42 41 @RequestMapping("/api/platform")
... ... @@ -73,7 +72,7 @@ public class PlatformController {
73 72 *
74 73 * @return
75 74 */
76   - @ApiOperation("获取国标服务的配置")
  75 + @Operation(summary = "获取国标服务的配置")
77 76 @GetMapping("/server_config")
78 77 public ResponseEntity<JSONObject> serverConfig() {
79 78 JSONObject result = new JSONObject();
... ... @@ -89,7 +88,8 @@ public class PlatformController {
89 88 *
90 89 * @return
91 90 */
92   - @ApiOperation("获取国标服务的配置")
  91 + @Operation(summary = "获取级联服务器信息")
  92 + @Parameter(name = "id", description = "平台国标编号", required = true)
93 93 @GetMapping("/info/{id}")
94 94 public ResponseEntity<WVPResult<ParentPlatform>> getPlatform(@PathVariable String id) {
95 95 ParentPlatform parentPlatform = storager.queryParentPlatByServerGBId(id);
... ... @@ -112,12 +112,10 @@ public class PlatformController {
112 112 * @param count 每页条数
113 113 * @return
114 114 */
115   - @ApiOperation("分页查询级联平台")
116 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 119 public PageInfo<ParentPlatform> platforms(@PathVariable int page, @PathVariable int count) {
122 120  
123 121 PageInfo<ParentPlatform> parentPlatformPageInfo = storager.queryParentPlatformList(page, count);
... ... @@ -136,10 +134,7 @@ public class PlatformController {
136 134 * @param parentPlatform
137 135 * @return
138 136 */
139   - @ApiOperation("添加上级平台信息")
140   - @ApiImplicitParams({
141   - @ApiImplicitParam(name = "parentPlatform", value = "上级平台信息", dataTypeClass = ParentPlatform.class),
142   - })
  137 + @Operation(summary = "添加上级平台信息")
143 138 @PostMapping("/add")
144 139 @ResponseBody
145 140 public ResponseEntity<WVPResult<String>> addPlatform(@RequestBody ParentPlatform parentPlatform) {
... ... @@ -211,10 +206,7 @@ public class PlatformController {
211 206 * @param parentPlatform
212 207 * @return
213 208 */
214   - @ApiOperation("保存上级平台信息")
215   - @ApiImplicitParams({
216   - @ApiImplicitParam(name = "parentPlatform", value = "上级平台信息", dataTypeClass = ParentPlatform.class),
217   - })
  209 + @Operation(summary = "保存上级平台信息")
218 210 @PostMapping("/save")
219 211 @ResponseBody
220 212 public ResponseEntity<WVPResult<String>> savePlatform(@RequestBody ParentPlatform parentPlatform) {
... ... @@ -286,10 +278,8 @@ public class PlatformController {
286 278 * @param serverGBId 上级平台国标ID
287 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 283 @DeleteMapping("/delete/{serverGBId}")
294 284 @ResponseBody
295 285 public ResponseEntity<String> deletePlatform(@PathVariable String serverGBId) {
... ... @@ -339,17 +329,12 @@ public class PlatformController {
339 329 * @param serverGBId 上级平台国标ID
340 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 334 @GetMapping("/exit/{serverGBId}")
347 335 @ResponseBody
348 336 public ResponseEntity<String> exitPlatform(@PathVariable String serverGBId) {
349 337  
350   -// if (logger.isDebugEnabled()) {
351   -// logger.debug("查询上级平台是否存在API调用:" + serverGBId);
352   -// }
353 338 ParentPlatform parentPlatform = storager.queryParentPlatByServerGBId(serverGBId);
354 339 return new ResponseEntity<>(String.valueOf(parentPlatform != null), HttpStatus.OK);
355 340 }
... ... @@ -365,16 +350,14 @@ public class PlatformController {
365 350 * @param channelType 通道类型
366 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 361 @GetMapping("/channel_list")
379 362 @ResponseBody
380 363 public PageInfo<ChannelReduce> channelList(int page, int count,
... ... @@ -384,9 +367,6 @@ public class PlatformController {
384 367 @RequestParam(required = false) Boolean online,
385 368 @RequestParam(required = false) Boolean channelType) {
386 369  
387   -// if (logger.isDebugEnabled()) {
388   -// logger.debug("查询所有所有通道API调用");
389   -// }
390 370 if (StringUtils.isEmpty(platformId)) {
391 371 platformId = null;
392 372 }
... ... @@ -407,10 +387,7 @@ public class PlatformController {
407 387 * @param param 通道关联参数
408 388 * @return
409 389 */
410   - @ApiOperation("向上级平台添加国标通道")
411   - @ApiImplicitParams({
412   - @ApiImplicitParam(name = "param", value = "通道关联参数", dataTypeClass = UpdateChannelParam.class),
413   - })
  390 + @Operation(summary = "向上级平台添加国标通道")
414 391 @PostMapping("/update_channel_for_gb")
415 392 @ResponseBody
416 393 public ResponseEntity<String> updateChannelForGB(@RequestBody UpdateChannelParam param) {
... ... @@ -429,10 +406,7 @@ public class PlatformController {
429 406 * @param param 通道关联参数
430 407 * @return
431 408 */
432   - @ApiOperation("从上级平台移除国标通道")
433   - @ApiImplicitParams({
434   - @ApiImplicitParam(name = "param", value = "通道关联参数", dataTypeClass = UpdateChannelParam.class),
435   - })
  409 + @Operation(summary = "从上级平台移除国标通道")
436 410 @DeleteMapping("/del_channel_for_gb")
437 411 @ResponseBody
438 412 public ResponseEntity<String> delChannelForGB(@RequestBody UpdateChannelParam param) {
... ... @@ -452,11 +426,9 @@ public class PlatformController {
452 426 * @param parentId 目录父ID
453 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 432 @GetMapping("/catalog")
461 433 @ResponseBody
462 434 public ResponseEntity<WVPResult<List<PlatformCatalog>>> getCatalogByPlatform(String platformId, String parentId) {
... ... @@ -472,11 +444,6 @@ public class PlatformController {
472 444 parentId = platform.getDeviceGBId();
473 445 }
474 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 448 WVPResult<List<PlatformCatalog>> result = new WVPResult<>();
482 449 result.setCode(0);
... ... @@ -491,10 +458,7 @@ public class PlatformController {
491 458 * @param platformCatalog 目录
492 459 * @return
493 460 */
494   - @ApiOperation("添加目录")
495   - @ApiImplicitParams({
496   - @ApiImplicitParam(name = "platformCatalog", value = "目录信息", dataTypeClass = PlatformCatalog.class, required = true),
497   - })
  461 + @Operation(summary = "添加目录")
498 462 @PostMapping("/catalog/add")
499 463 @ResponseBody
500 464 public ResponseEntity<WVPResult<List<PlatformCatalog>>> addCatalog(@RequestBody PlatformCatalog platformCatalog) {
... ... @@ -528,10 +492,7 @@ public class PlatformController {
528 492 * @param platformCatalog 目录
529 493 * @return
530 494 */
531   - @ApiOperation("编辑目录")
532   - @ApiImplicitParams({
533   - @ApiImplicitParam(name = "platformCatalog", value = "目录信息", dataTypeClass = PlatformCatalog.class, required = true),
534   - })
  495 + @Operation(summary = "编辑目录")
535 496 @PostMapping("/catalog/edit")
536 497 @ResponseBody
537 498 public ResponseEntity<WVPResult<List<PlatformCatalog>>> editCatalog(@RequestBody PlatformCatalog platformCatalog) {
... ... @@ -561,12 +522,12 @@ public class PlatformController {
561 522 * 删除目录
562 523 *
563 524 * @param id 目录Id
  525 + * @param platformId 平台Id
564 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 531 @DeleteMapping("/catalog/del")
571 532 @ResponseBody
572 533 public ResponseEntity<WVPResult<String>> delCatalog(String id, String platformId) {
... ... @@ -609,10 +570,7 @@ public class PlatformController {
609 570 * @param platformCatalog 关联的信息
610 571 * @return
611 572 */
612   - @ApiOperation("删除关联")
613   - @ApiImplicitParams({
614   - @ApiImplicitParam(name = "platformCatalog", value = "关联的信息", dataTypeClass = PlatformCatalog.class, required = true),
615   - })
  573 + @Operation(summary = "删除关联")
616 574 @DeleteMapping("/catalog/relation/del")
617 575 @ResponseBody
618 576 public ResponseEntity<WVPResult<List<PlatformCatalog>>> delRelation(@RequestBody PlatformCatalog platformCatalog) {
... ... @@ -641,11 +599,9 @@ public class PlatformController {
641 599 * @param catalogId 目录Id
642 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 605 @PostMapping("/catalog/default/update")
650 606 @ResponseBody
651 607 public ResponseEntity<WVPResult<String>> setDefaultCatalog(String platformId, String catalogId) {
... ...
src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/platform/bean/ChannelReduce.java
1 1 package com.genersoft.iot.vmp.vmanager.gb28181.platform.bean;
2 2  
3 3 import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel;
  4 +import io.swagger.v3.oas.annotations.media.Schema;
4 5  
5 6 /**
6 7 * 精简的channel信息展示,主要是选择通道的时候展示列表使用
7 8 */
  9 +@Schema(description = "精简的channel信息展示")
8 10 public class ChannelReduce {
9 11  
10 12 /**
11 13 * deviceChannel的数据库自增ID
12 14 */
  15 + @Schema(description = "deviceChannel的数据库自增ID")
13 16 private int id;
14 17  
15 18 /**
16 19 * 通道id
17 20 */
  21 + @Schema(description = "通道国标编号")
18 22 private String channelId;
19 23  
20 24 /**
21 25 * 设备id
22 26 */
  27 + @Schema(description = "设备国标编号")
23 28 private String deviceId;
24 29  
25 30 /**
26 31 * 通道名
27 32 */
  33 + @Schema(description = "通道名")
28 34 private String name;
29 35  
30 36 /**
31 37 * 生产厂商
32 38 */
  39 + @Schema(description = "生产厂商")
33 40 private String manufacturer;
34 41  
35 42 /**
36 43 * wan地址
37 44 */
  45 + @Schema(description = "wan地址")
38 46 private String hostAddress;
39 47  
40 48 /**
41 49 * 子节点数
42 50 */
  51 + @Schema(description = "子节点数")
43 52 private int subCount;
44 53  
45 54 /**
46 55 * 平台Id
47 56 */
  57 + @Schema(description = "平台上级国标编号")
48 58 private String platformId;
49 59  
50 60 /**
51 61 * 目录Id
52 62 */
  63 + @Schema(description = "目录国标编号")
53 64 private String catalogId;
54 65  
55 66 public int getId() {
... ...
src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/platform/bean/UpdateChannelParam.java
1 1 package com.genersoft.iot.vmp.vmanager.gb28181.platform.bean;
2 2  
  3 +import io.swagger.v3.oas.annotations.media.Schema;
  4 +
3 5 import java.util.List;
4 6  
  7 +/**
  8 + * 通道关联参数
  9 + * @author lin
  10 + */
  11 +@Schema(description = "通道关联参数")
5 12 public class UpdateChannelParam {
  13 +
  14 + @Schema(description = "上级平台的国标编号")
6 15 private String platformId;
  16 +
  17 + @Schema(description = "目录的国标编号")
7 18 private String catalogId;
  19 +
  20 + @Schema(description = "")
8 21 private List<ChannelReduce> channelReduces;
9 22  
10 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 15 import com.genersoft.iot.vmp.vmanager.gb28181.play.bean.PlayResult;
16 16 import com.genersoft.iot.vmp.service.IMediaService;
17 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 22 import org.slf4j.Logger;
23 23 import org.slf4j.LoggerFactory;
24 24 import org.springframework.beans.factory.annotation.Autowired;
... ... @@ -39,7 +39,7 @@ import org.springframework.web.context.request.async.DeferredResult;
39 39 import java.util.List;
40 40 import java.util.UUID;
41 41  
42   -@Api(tags = "国标设备点播")
  42 +@Tag(name = "国标设备点播")
43 43 @CrossOrigin
44 44 @RestController
45 45 @RequestMapping("/api/play")
... ... @@ -74,11 +74,9 @@ public class PlayController {
74 74 @Autowired
75 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 80 @GetMapping("/start/{deviceId}/{channelId}")
83 81 public DeferredResult<ResponseEntity<String>> play(@PathVariable String deviceId,
84 82 @PathVariable String channelId) {
... ... @@ -91,11 +89,10 @@ public class PlayController {
91 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 96 @GetMapping("/stop/{deviceId}/{channelId}")
100 97 public DeferredResult<ResponseEntity<String>> playStop(@PathVariable String deviceId, @PathVariable String channelId) {
101 98  
... ... @@ -164,10 +161,8 @@ public class PlayController {
164 161 * @param streamId 流ID
165 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 166 @PostMapping("/convert/{streamId}")
172 167 public ResponseEntity<String> playConvert(@PathVariable String streamId) {
173 168 StreamInfo streamInfo = redisCatchStorage.queryPlayByStreamId(streamId);
... ... @@ -211,10 +206,9 @@ public class PlayController {
211 206 * @param key
212 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 212 @PostMapping("/convertStop/{key}")
219 213 public ResponseEntity<String> playConvertStop(@PathVariable String key, String mediaServerId) {
220 214 JSONObject result = new JSONObject();
... ... @@ -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 249 @GetMapping("/broadcast/{deviceId}")
258 250 @PostMapping("/broadcast/{deviceId}")
259 251 public DeferredResult<ResponseEntity<String>> broadcastApi(@PathVariable String deviceId) {
... ... @@ -313,7 +305,7 @@ public class PlayController {
313 305 return result;
314 306 }
315 307  
316   - @ApiOperation("获取所有的ssrc")
  308 + @Operation(summary = "获取所有的ssrc")
317 309 @GetMapping("/ssrc")
318 310 public WVPResult<JSONObject> getSSRC() {
319 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 2  
3 3 import com.genersoft.iot.vmp.common.StreamInfo;
4 4 import com.genersoft.iot.vmp.gb28181.transmit.callback.DeferredResultHolder;
5   -//import com.genersoft.iot.vmp.media.zlm.ZLMRESTfulUtils;
6 5 import com.genersoft.iot.vmp.service.IMediaServerService;
7 6 import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
8 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 11 import org.slf4j.Logger;
14 12 import org.slf4j.LoggerFactory;
15 13 import org.springframework.beans.factory.annotation.Autowired;
... ... @@ -28,7 +26,7 @@ import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommander;
28 26 import com.genersoft.iot.vmp.storager.IVideoManagerStorage;
29 27 import org.springframework.web.context.request.async.DeferredResult;
30 28  
31   -@Api(tags = "视频回放")
  29 +@Tag(name = "视频回放")
32 30 @CrossOrigin
33 31 @RestController
34 32 @RequestMapping("/api/playback")
... ... @@ -45,25 +43,17 @@ public class PlaybackController {
45 43 @Autowired
46 44 private IRedisCatchStorage redisCatchStorage;
47 45  
48   - // @Autowired
49   - // private ZLMRESTfulUtils zlmresTfulUtils;
50   -
51 46 @Autowired
52 47 private IPlayService playService;
53 48  
54 49 @Autowired
55 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 57 @GetMapping("/start/{deviceId}/{channelId}")
68 58 public DeferredResult<ResponseEntity<String>> play(@PathVariable String deviceId, @PathVariable String channelId,
69 59 String startTime,String endTime) {
... ... @@ -79,12 +69,11 @@ public class PlaybackController {
79 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 77 @GetMapping("/stop/{deviceId}/{channelId}/{stream}")
89 78 public ResponseEntity<String> playStop(
90 79 @PathVariable String deviceId,
... ... @@ -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 106 @GetMapping("/pause/{streamId}")
119 107 public ResponseEntity<String> playPause(@PathVariable String streamId) {
120 108 logger.info("playPause: "+streamId);
... ... @@ -131,10 +119,9 @@ public class PlaybackController {
131 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 125 @GetMapping("/resume/{streamId}")
139 126 public ResponseEntity<String> playResume(@PathVariable String streamId) {
140 127 logger.info("playResume: "+streamId);
... ... @@ -151,11 +138,10 @@ public class PlaybackController {
151 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 145 @GetMapping("/seek/{streamId}/{seekTime}")
160 146 public ResponseEntity<String> playSeek(@PathVariable String streamId, @PathVariable long seekTime) {
161 147 logger.info("playSeek: "+streamId+", "+seekTime);
... ... @@ -172,11 +158,9 @@ public class PlaybackController {
172 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 164 @GetMapping("/speed/{streamId}/{speed}")
181 165 public ResponseEntity<String> playSpeed(@PathVariable String streamId, @PathVariable Double speed) {
182 166 logger.info("playSpeed: "+streamId+", "+speed);
... ...
src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/ptz/PtzController.java
1 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 7 import org.slf4j.Logger;
8 8 import org.slf4j.LoggerFactory;
9 9 import org.springframework.beans.factory.annotation.Autowired;
... ... @@ -21,7 +21,7 @@ import com.genersoft.iot.vmp.storager.IVideoManagerStorage;
21 21  
22 22 import java.util.UUID;
23 23  
24   -@Api(tags = "云台控制")
  24 +@Tag(name = "云台控制")
25 25 @CrossOrigin
26 26 @RestController
27 27 @RequestMapping("/api/ptz")
... ... @@ -48,15 +48,14 @@ public class PtzController {
48 48 * @param zoomSpeed 缩放速度
49 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 59 @PostMapping("/control/{deviceId}/{channelId}")
61 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 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 116 @PostMapping("/front_end_command/{deviceId}/{channelId}")
119 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 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 132 @GetMapping("/preset/query/{deviceId}/{channelId}")
136 133 public DeferredResult<ResponseEntity<String>> presetQueryApi(@PathVariable String deviceId, @PathVariable String channelId) {
137 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 7 import com.genersoft.iot.vmp.service.IPlayService;
8 8 import com.genersoft.iot.vmp.utils.DateUtil;
9 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 14 import org.slf4j.Logger;
15 15 import org.slf4j.LoggerFactory;
16 16 import org.springframework.beans.factory.annotation.Autowired;
... ... @@ -32,7 +32,7 @@ import com.genersoft.iot.vmp.storager.IVideoManagerStorage;
32 32 import java.time.LocalDate;
33 33 import java.util.UUID;
34 34  
35   -@Api(tags = "国标录像")
  35 +@Tag(name = "国标录像")
36 36 @CrossOrigin
37 37 @RestController
38 38 @RequestMapping("/api/gb_record")
... ... @@ -52,16 +52,11 @@ public class GBRecordController {
52 52 @Autowired
53 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 60 @GetMapping("/query/{deviceId}/{channelId}")
66 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 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 121 @GetMapping("/download/start/{deviceId}/{channelId}")
128 122 public DeferredResult<ResponseEntity<String>> download(@PathVariable String deviceId, @PathVariable String channelId,
129 123 String startTime, String endTime, String downloadSpeed) {
... ... @@ -184,12 +178,10 @@ public class GBRecordController {
184 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 185 @GetMapping("/download/stop/{deviceId}/{channelId}/{stream}")
194 186 public ResponseEntity<String> playStop(@PathVariable String deviceId, @PathVariable String channelId, @PathVariable String stream) {
195 187  
... ... @@ -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 209 @GetMapping("/download/progress/{deviceId}/{channelId}/{stream}")
220 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 6 import com.genersoft.iot.vmp.utils.DateUtil;
7 7 import com.genersoft.iot.vmp.vmanager.bean.WVPResult;
8 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 13 import org.slf4j.Logger;
14 14 import org.slf4j.LoggerFactory;
15 15 import org.springframework.beans.factory.annotation.Autowired;
... ... @@ -20,7 +20,7 @@ import org.springframework.web.bind.annotation.*;
20 20  
21 21 import java.text.ParseException;
22 22  
23   -@Api(tags = "日志管理")
  23 +@Tag(name = "日志管理")
24 24 @CrossOrigin
25 25 @RestController
26 26 @RequestMapping("/api/log")
... ... @@ -45,16 +45,14 @@ public class LogController {
45 45 * @param endTime 结束时间
46 46 * @return
47 47 */
48   - @ApiOperation("分页查询报警")
49 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 56 public ResponseEntity<PageInfo<LogDto>> getAll(
59 57 @RequestParam int page,
60 58 @RequestParam int count,
... ... @@ -88,9 +86,8 @@ public class LogController {
88 86 * 清空日志
89 87 *
90 88 */
91   - @ApiOperation("清空日志")
  89 + @Operation(summary = "停止视频回放")
92 90 @DeleteMapping("/clear")
93   - @ApiImplicitParams({})
94 91 public ResponseEntity<WVPResult<String>> clear() {
95 92  
96 93 int count = logService.clear();
... ...
src/main/java/com/genersoft/iot/vmp/vmanager/record/RecordController.java
... ... @@ -13,7 +13,7 @@
13 13 //import org.springframework.beans.factory.annotation.Autowired;
14 14 //import org.springframework.web.bind.annotation.*;
15 15 //
16   -//@Api(tags = "云端录像")
  16 +//@Tag(name = "云端录像")
17 17 //@CrossOrigin
18 18 //@RestController
19 19 //@RequestMapping("/api/record")
... ... @@ -22,7 +22,7 @@
22 22 // @Autowired
23 23 // private IRecordInfoServer recordInfoServer;
24 24 //
25   -// @ApiOperation("录像列表查询")
  25 +// //@ApiOperation("录像列表查询")
26 26 // @ApiImplicitParams({
27 27 // @ApiImplicitParam(name="page", value = "当前页", required = true, dataTypeClass = Integer.class),
28 28 // @ApiImplicitParam(name="count", value = "每页查询数量", required = true, dataTypeClass = Integer.class),
... ... @@ -37,7 +37,7 @@
37 37 // return recordList;
38 38 // }
39 39 //
40   -// @ApiOperation("获取录像详情")
  40 +// //@ApiOperation("获取录像详情")
41 41 // @ApiImplicitParams({
42 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 15 import com.genersoft.iot.vmp.utils.SpringBeanFactory;
16 16 import com.genersoft.iot.vmp.vmanager.bean.WVPResult;
17 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 22 import org.springframework.beans.factory.annotation.Autowired;
23 23 import org.springframework.beans.factory.annotation.Value;
24 24 import org.springframework.context.ConfigurableApplicationContext;
... ... @@ -33,7 +33,7 @@ import java.util.List;
33 33 import java.util.Set;
34 34  
35 35 @SuppressWarnings("rawtypes")
36   -@Api(tags = "服务控制")
  36 +@Tag(name = "服务控制")
37 37 @CrossOrigin
38 38 @RestController
39 39 @RequestMapping("/api/server")
... ... @@ -61,10 +61,10 @@ public class ServerController {
61 61 private int serverPort;
62 62  
63 63  
64   - @ApiOperation("流媒体服务列表")
65 64 @GetMapping(value = "/media_server/list")
66 65 @ResponseBody
67   - public WVPResult<List<MediaServerItem>> getMediaServerList(boolean detail){
  66 + @Operation(summary = "流媒体服务列表")
  67 + public WVPResult<List<MediaServerItem>> getMediaServerList() {
68 68 WVPResult<List<MediaServerItem>> result = new WVPResult<>();
69 69 result.setCode(0);
70 70 result.setMsg("success");
... ... @@ -72,10 +72,10 @@ public class ServerController {
72 72 return result;
73 73 }
74 74  
75   - @ApiOperation("在线流媒体服务列表")
76 75 @GetMapping(value = "/media_server/online/list")
77 76 @ResponseBody
78   - public WVPResult<List<MediaServerItem>> getOnlineMediaServerList(){
  77 + @Operation(summary = "在线流媒体服务列表")
  78 + public WVPResult<List<MediaServerItem>> getOnlineMediaServerList() {
79 79 WVPResult<List<MediaServerItem>> result = new WVPResult<>();
80 80 result.setCode(0);
81 81 result.setMsg("success");
... ... @@ -83,10 +83,11 @@ public class ServerController {
83 83 return result;
84 84 }
85 85  
86   - @ApiOperation("获取流媒体服务")
87 86 @GetMapping(value = "/media_server/one/{id}")
88 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 91 WVPResult<MediaServerItem> result = new WVPResult<>();
91 92 result.setCode(0);
92 93 result.setMsg("success");
... ... @@ -94,57 +95,49 @@ public class ServerController {
94 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 102 @GetMapping(value = "/media_server/check")
104 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 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 111 @GetMapping(value = "/media_server/record/check")
116 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 114 boolean checkResult = mediaServerService.checkMediaRecordServer(ip, port);
119 115 WVPResult<String> result = new WVPResult<>();
120 116 if (checkResult) {
121 117 result.setCode(0);
122 118 result.setMsg("success");
123 119  
124   - }else {
  120 + } else {
125 121 result.setCode(-1);
126 122 result.setMsg("连接失败");
127 123 }
128 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 129 @PostMapping(value = "/media_server/save")
136 130 @ResponseBody
137   - public WVPResult<String> saveMediaServer(@RequestBody MediaServerItem mediaServerItem){
  131 + public WVPResult<String> saveMediaServer(@RequestBody MediaServerItem mediaServerItem) {
138 132 MediaServerItem mediaServerItemInDatabase = mediaServerService.getOne(mediaServerItem.getId());
139 133  
140 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 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 141 mediaServerItem.setSendRtpPortRange("30000,30500");
149 142 }
150 143 return mediaServerService.add(mediaServerItem);
... ... @@ -156,17 +149,15 @@ public class ServerController {
156 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 154 @DeleteMapping(value = "/media_server/delete")
164 155 @ResponseBody
165   - public WVPResult<String> deleteMediaServer(@RequestParam String id){
  156 + public WVPResult<String> deleteMediaServer(@RequestParam String id) {
166 157 if (mediaServerService.getOne(id) != null) {
167 158 mediaServerService.delete(id);
168 159 mediaServerService.deleteDb(id);
169   - }else {
  160 + } else {
170 161 WVPResult<String> result = new WVPResult<>();
171 162 result.setCode(-1);
172 163 result.setMsg("未找到此节点");
... ... @@ -179,18 +170,17 @@ public class ServerController {
179 170 }
180 171  
181 172  
182   -
183   - @ApiOperation("重启服务")
  173 + @Operation(summary = "重启服务")
184 174 @GetMapping(value = "/restart")
185 175 @ResponseBody
186   - public Object restart(){
  176 + public Object restart() {
187 177 Thread restartThread = new Thread(new Runnable() {
188 178 @Override
189 179 public void run() {
190 180 try {
191 181 Thread.sleep(3000);
192 182 SipProvider up = (SipProvider) SpringBeanFactory.getBean("udpSipProvider");
193   - SipStackImpl stack = (SipStackImpl)up.getSipStack();
  183 + SipStackImpl stack = (SipStackImpl) up.getSipStack();
194 184 stack.stop();
195 185 Iterator listener = stack.getListeningPoints();
196 186 while (listener.hasNext()) {
... ... @@ -213,10 +203,10 @@ public class ServerController {
213 203 return "success";
214 204 }
215 205  
216   - @ApiOperation("版本信息")
  206 + @Operation(summary = "获取版本信息")
217 207 @GetMapping(value = "/version")
218 208 @ResponseBody
219   - public WVPResult<VersionPo> getVersion(){
  209 + public WVPResult<VersionPo> getVersion() {
220 210 WVPResult<VersionPo> result = new WVPResult<>();
221 211 result.setCode(0);
222 212 result.setMsg("success");
... ... @@ -224,13 +214,11 @@ public class ServerController {
224 214 return result;
225 215 }
226 216  
227   - @ApiOperation("配置信息")
228 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 220 @ResponseBody
233   - public WVPResult<JSONObject> getVersion(String type){
  221 + public WVPResult<JSONObject> getVersion(String type) {
234 222 WVPResult<JSONObject> result = new WVPResult<>();
235 223 result.setCode(0);
236 224 result.setMsg("success");
... ... @@ -240,8 +228,8 @@ public class ServerController {
240 228 if (StringUtils.isEmpty(type)) {
241 229 jsonObject.put("sip", JSON.toJSON(sipConfig));
242 230 jsonObject.put("base", JSON.toJSON(userSetting));
243   - }else {
244   - switch (type){
  231 + } else {
  232 + switch (type) {
245 233 case "sip":
246 234 jsonObject.put("sip", sipConfig);
247 235 break;
... ... @@ -256,10 +244,10 @@ public class ServerController {
256 244 return result;
257 245 }
258 246  
259   - @ApiOperation("获取当前所有hook")
260 247 @GetMapping(value = "/hooks")
261 248 @ResponseBody
262   - public WVPResult<List<IHookSubscribe>> getHooks(){
  249 + @Operation(summary = "获取当前所有hook")
  250 + public WVPResult<List<IHookSubscribe>> getHooks() {
263 251 WVPResult<List<IHookSubscribe>> result = new WVPResult<>();
264 252 result.setCode(0);
265 253 result.setMsg("success");
... ... @@ -268,7 +256,7 @@ public class ServerController {
268 256 return result;
269 257 }
270 258  
271   -// @ApiOperation("当前进行中的动态任务")
  259 +// //@ApiOperation("当前进行中的动态任务")
272 260 // @GetMapping(value = "/dynamicTask")
273 261 // @ResponseBody
274 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 import com.genersoft.iot.vmp.service.IStreamProxyService;
11 11 import com.genersoft.iot.vmp.vmanager.bean.WVPResult;
12 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 17 import org.slf4j.Logger;
18 18 import org.slf4j.LoggerFactory;
19 19 import org.springframework.beans.factory.annotation.Autowired;
... ... @@ -25,7 +25,7 @@ import org.springframework.web.bind.annotation.*;
25 25 /**
26 26 * 拉流代理接口
27 27 */
28   -@Api(tags = "拉流代理")
  28 +@Tag(name = "拉流代理", description = "")
29 29 @Controller
30 30 @CrossOrigin
31 31 @RequestMapping(value = "/api/proxy")
... ... @@ -44,13 +44,11 @@ public class StreamProxyController {
44 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 52 @GetMapping(value = "/list")
55 53 @ResponseBody
56 54 public PageInfo<StreamProxyItem> list(@RequestParam(required = false)Integer page,
... ... @@ -61,9 +59,8 @@ public class StreamProxyController {
61 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 65 @PostMapping(value = "/save")
69 66 @ResponseBody
... ... @@ -82,12 +79,10 @@ public class StreamProxyController {
82 79 return result;
83 80 }
84 81  
85   - @ApiOperation("获取ffmpeg.cmd模板")
86 82 @GetMapping(value = "/ffmpeg_cmd/list")
87   - @ApiImplicitParams({
88   - @ApiImplicitParam(name = "mediaServerId", value = "流媒体ID", dataTypeClass = String.class),
89   - })
90 83 @ResponseBody
  84 + @Operation(summary = "获取ffmpeg.cmd模板")
  85 + @Parameter(name = "mediaServerId", description = "流媒体ID", required = true)
91 86 public WVPResult getFFmpegCMDs(@RequestParam String mediaServerId){
92 87 logger.debug("获取节点[ {} ]ffmpeg.cmd模板", mediaServerId );
93 88  
... ... @@ -100,13 +95,11 @@ public class StreamProxyController {
100 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 98 @DeleteMapping(value = "/del")
109 99 @ResponseBody
  100 + @Operation(summary = "移除代理")
  101 + @Parameter(name = "app", description = "应用名", required = true)
  102 + @Parameter(name = "stream", description = "流id", required = true)
110 103 public WVPResult del(@RequestParam String app, @RequestParam String stream){
111 104 logger.info("移除代理: " + app + "/" + stream);
112 105 WVPResult<Object> result = new WVPResult<>();
... ... @@ -121,13 +114,11 @@ public class StreamProxyController {
121 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 117 @GetMapping(value = "/start")
130 118 @ResponseBody
  119 + @Operation(summary = "启用代理")
  120 + @Parameter(name = "app", description = "应用名", required = true)
  121 + @Parameter(name = "stream", description = "流id", required = true)
131 122 public Object start(String app, String stream){
132 123 logger.info("启用代理: " + app + "/" + stream);
133 124 boolean result = streamProxyService.start(app, stream);
... ... @@ -137,13 +128,11 @@ public class StreamProxyController {
137 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 131 @GetMapping(value = "/stop")
146 132 @ResponseBody
  133 + @Operation(summary = "停用代理")
  134 + @Parameter(name = "app", description = "应用名", required = true)
  135 + @Parameter(name = "stream", description = "流id", required = true)
147 136 public Object stop(String app, String stream){
148 137 logger.info("停用代理: " + app + "/" + stream);
149 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 20 import com.genersoft.iot.vmp.vmanager.bean.StreamPushExcelDto;
21 21 import com.genersoft.iot.vmp.vmanager.bean.WVPResult;
22 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 27 import org.apache.poi.sl.usermodel.Sheet;
28 28 import org.slf4j.Logger;
29 29 import org.slf4j.LoggerFactory;
... ... @@ -44,7 +44,7 @@ import java.util.List;
44 44 import java.util.Map;
45 45 import java.util.UUID;
46 46  
47   -@Api(tags = "推流信息管理")
  47 +@Tag(name = "推流信息管理")
48 48 @Controller
49 49 @CrossOrigin
50 50 @RequestMapping(value = "/api/push")
... ... @@ -67,16 +67,14 @@ public class StreamPushController {
67 67 @Autowired
68 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 70 @GetMapping(value = "/list")
79 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 78 public PageInfo<StreamPushItem> list(@RequestParam(required = false)Integer page,
81 79 @RequestParam(required = false)Integer count,
82 80 @RequestParam(required = false)String query,
... ... @@ -93,12 +91,9 @@ public class StreamPushController {
93 91 return pushList;
94 92 }
95 93  
96   - @ApiOperation("将推流添加到国标")
97   - @ApiImplicitParams({
98   - @ApiImplicitParam(name = "stream", value = "直播流关联国标平台", dataTypeClass = GbStream.class),
99   - })
100 94 @PostMapping(value = "/save_to_gb")
101 95 @ResponseBody
  96 + @Operation(summary = "将推流添加到国标")
102 97 public Object saveToGB(@RequestBody GbStream stream){
103 98 if (streamPushService.saveToGB(stream)){
104 99 return "success";
... ... @@ -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 106 @DeleteMapping(value = "/remove_form_gb")
116 107 @ResponseBody
  108 + @Operation(summary = "将推流移出到国标")
117 109 public Object removeFormGB(@RequestBody GbStream stream){
118 110 if (streamPushService.removeFromGB(stream)){
119 111 return "success";
... ... @@ -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 118 @PostMapping(value = "/stop")
132 119 @ResponseBody
  120 + @Operation(summary = "中止一个推流")
  121 + @Parameter(name = "app", description = "应用名", required = true)
  122 + @Parameter(name = "stream", description = "流id", required = true)
133 123 public Object stop(String app, String streamId){
134 124 if (streamPushService.stop(app, streamId)){
135 125 return "success";
... ... @@ -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 131 @DeleteMapping(value = "/batchStop")
147 132 @ResponseBody
  133 + @Operation(summary = "中止多个推流")
148 134 public Object batchStop(@RequestBody BatchGBStreamParam batchGBStreamParam){
149 135 if (batchGBStreamParam.getGbStreams().size() == 0) {
150 136 return "fail";
... ... @@ -256,14 +242,12 @@ public class StreamPushController {
256 242 * @param stream 流id
257 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 245 @GetMapping(value = "/getPlayUrl")
266 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 251 public WVPResult<StreamInfo> getPlayUrl(@RequestParam String app,@RequestParam String stream,
268 252 @RequestParam(required = false) String mediaServerId){
269 253 boolean authority = false;
... ... @@ -297,12 +281,9 @@ public class StreamPushController {
297 281 * @param stream 推流信息
298 282 * @return
299 283 */
300   - @ApiOperation("获取推流播放地址")
301   - @ApiImplicitParams({
302   - @ApiImplicitParam(name = "stream", value = "推流信息", dataTypeClass = StreamPushItem.class),
303   - })
304 284 @PostMapping(value = "/add")
305 285 @ResponseBody
  286 + @Operation(summary = "停止视频回放")
306 287 public WVPResult<StreamInfo> add(@RequestBody StreamPushItem stream){
307 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 5 import com.genersoft.iot.vmp.storager.dao.dto.Role;
6 6 import com.genersoft.iot.vmp.utils.DateUtil;
7 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 12 import org.springframework.beans.factory.annotation.Autowired;
13 13 import org.springframework.http.HttpStatus;
14 14 import org.springframework.http.ResponseEntity;
... ... @@ -16,7 +16,7 @@ import org.springframework.web.bind.annotation.*;
16 16  
17 17 import java.util.List;
18 18  
19   -@Api(tags = "角色管理")
  19 +@Tag(name = "角色管理")
20 20 @CrossOrigin
21 21 @RestController
22 22 @RequestMapping("/api/role")
... ... @@ -25,12 +25,10 @@ public class RoleController {
25 25 @Autowired
26 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 28 @PostMapping("/add")
  29 + @Operation(summary = "添加角色")
  30 + @Parameter(name = "name", description = "角色名", required = true)
  31 + @Parameter(name = "authority", description = "权限(自行定义内容,目前未使用)", required = true)
34 32 public ResponseEntity<WVPResult<Integer>> add(@RequestParam String name,
35 33 @RequestParam(required = false) String authority){
36 34 WVPResult<Integer> result = new WVPResult<>();
... ... @@ -57,11 +55,9 @@ public class RoleController {
57 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 58 @DeleteMapping("/delete")
  59 + @Operation(summary = "删除角色")
  60 + @Parameter(name = "id", description = "用户Id", required = true)
65 61 public ResponseEntity<WVPResult<String>> delete(@RequestParam Integer id){
66 62 // 获取当前登录用户id
67 63 int currenRoleId = SecurityUtils.getUserInfo().getRole().getId();
... ... @@ -79,9 +75,8 @@ public class RoleController {
79 75 return new ResponseEntity<>(result, HttpStatus.OK);
80 76 }
81 77  
82   - @ApiOperation("查询角色")
83   - @ApiImplicitParams({})
84 78 @GetMapping("/all")
  79 + @Operation(summary = "查询角色")
85 80 public ResponseEntity<WVPResult<List<Role>>> all(){
86 81 // 获取当前登录用户id
87 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 9 import com.genersoft.iot.vmp.utils.DateUtil;
10 10 import com.genersoft.iot.vmp.vmanager.bean.WVPResult;
11 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 16 import org.springframework.beans.factory.annotation.Autowired;
17 17 import org.springframework.http.HttpStatus;
18 18 import org.springframework.http.ResponseEntity;
... ... @@ -24,7 +24,7 @@ import org.springframework.web.bind.annotation.*;
24 24 import javax.security.sasl.AuthenticationException;
25 25 import java.util.List;
26 26  
27   -@Api(tags = "用户管理")
  27 +@Tag(name = "用户管理")
28 28 @CrossOrigin
29 29 @RestController
30 30 @RequestMapping("/api/user")
... ... @@ -39,12 +39,10 @@ public class UserController {
39 39 @Autowired
40 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 42 @GetMapping("/login")
  43 + @Operation(summary = "登录")
  44 + @Parameter(name = "username", description = "用户名", required = true)
  45 + @Parameter(name = "password", description = "密码(32位md5加密)", required = true)
48 46 public WVPResult<LoginUser> login(@RequestParam String username, @RequestParam String password){
49 47 LoginUser user = null;
50 48 WVPResult<LoginUser> result = new WVPResult<>();
... ... @@ -66,13 +64,11 @@ public class UserController {
66 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 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 72 public String changePassword(@RequestParam String oldPassword, @RequestParam String password){
77 73 // 获取当前登录用户id
78 74 LoginUser userInfo = SecurityUtils.getUserInfo();
... ... @@ -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 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 101 public ResponseEntity<WVPResult<Integer>> add(@RequestParam String username,
108 102 @RequestParam String password,
109 103 @RequestParam Integer roleId){
... ... @@ -146,11 +140,9 @@ public class UserController {
146 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 146 public ResponseEntity<WVPResult<String>> delete(@RequestParam Integer id){
155 147 // 获取当前登录用户id
156 148 int currenRoleId = SecurityUtils.getUserInfo().getRole().getId();
... ... @@ -168,9 +160,8 @@ public class UserController {
168 160 return new ResponseEntity<>(result, HttpStatus.OK);
169 161 }
170 162  
171   - @ApiOperation("查询用户")
172   - @ApiImplicitParams({})
173 163 @GetMapping("/all")
  164 + @Operation(summary = "查询用户")
174 165 public ResponseEntity<WVPResult<List<User>>> all(){
175 166 // 获取当前登录用户id
176 167 List<User> allUsers = userService.getAllUsers();
... ... @@ -188,22 +179,18 @@ public class UserController {
188 179 * @param count 每页查询数量
189 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 182 @GetMapping("/users")
  183 + @Operation(summary = "分页查询用户")
  184 + @Parameter(name = "page", description = "当前页", required = true)
  185 + @Parameter(name = "count", description = "每页查询数量", required = true)
197 186 public PageInfo<User> users(int page, int count) {
198 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 190 @RequestMapping("/changePushKey")
  191 + @Operation(summary = "修改pushkey")
  192 + @Parameter(name = "userId", description = "用户Id", required = true)
  193 + @Parameter(name = "pushKey", description = "新的pushKey", required = true)
207 194 public ResponseEntity<WVPResult<String>> changePushKey(@RequestParam Integer userId,@RequestParam String pushKey) {
208 195 // 获取当前登录用户id
209 196 int currenRoleId = SecurityUtils.getUserInfo().getRole().getId();
... ... @@ -221,13 +208,11 @@ public class UserController {
221 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 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 216 public String changePasswordForAdmin(@RequestParam int userId, @RequestParam String password) {
232 217 // 获取当前登录用户id
233 218 LoginUser userInfo = SecurityUtils.getUserInfo();
... ...
src/main/resources/all-application.yml
... ... @@ -187,7 +187,7 @@ user-settings:
187 187 logInDatebase: true
188 188  
189 189 # 在线文档: swagger-ui(生产环境建议关闭)
190   -swagger-ui:
  190 +doc:
191 191 enabled: true
192 192  
193 193 # 版本信息, 不需修改
... ...
src/main/resources/application-docker.yml
... ... @@ -80,7 +80,7 @@ user-settings:
80 80 auto-apply-play: true
81 81  
82 82 # 在线文档: swagger-ui(生产环境建议关闭)
83   -swagger-ui:
  83 +doc:
84 84 enabled: true
85 85  
86 86 # 版本信息, 不需修改
... ...
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 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 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 0 \ No newline at end of file