From 1a9e49d9ff210e39f6297150db758906a4f02e6f Mon Sep 17 00:00:00 2001 From: 648540858 <648540858@qq.com> Date: 星期五, 19 八月 2022 17:11:51 +0800 Subject: [PATCH] 依赖包版本升级 --- src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/device/DeviceConfig.java | 35 src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/media/MediaController.java | 25 src/main/java/com/genersoft/iot/vmp/common/StreamInfo.java | 1 src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/device/DeviceQuery.java | 180 +-- src/main/java/com/genersoft/iot/vmp/vmanager/log/LogController.java | 29 src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/SseController/SseController.java | 12 src/main/java/com/genersoft/iot/vmp/gb28181/bean/DeviceChannel.java | 46 + src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/platform/bean/UpdateChannelParam.java | 13 src/main/java/com/genersoft/iot/vmp/service/impl/MediaServerServiceImpl.java | 73 - src/main/java/com/genersoft/iot/vmp/conf/DynamicTask.java | 17 src/main/java/com/genersoft/iot/vmp/media/zlm/dto/StreamPushItem.java | 22 src/main/java/com/genersoft/iot/vmp/service/impl/RedisGbPlayMsgListener.java | 14 src/main/java/com/genersoft/iot/vmp/gb28181/bean/PlatformCatalog.java | 14 src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/device/DeviceControl.java | 115 +- src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/alarm/AlarmController.java | 156 +-- src/main/java/com/genersoft/iot/vmp/vmanager/streamPush/StreamPushController.java | 63 - src/main/java/com/genersoft/iot/vmp/vmanager/streamProxy/StreamProxyController.java | 57 src/main/java/com/genersoft/iot/vmp/utils/redis/RedisUtil.java | 137 +- src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/platform/PlatformController.java | 122 -- src/main/java/com/genersoft/iot/vmp/gb28181/session/VideoStreamSessionManager.java | 23 src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/ptz/PtzController.java | 53 src/main/java/com/genersoft/iot/vmp/vmanager/record/RecordController.java | 6 src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/playback/PlaybackController.java | 70 - src/main/java/com/genersoft/iot/vmp/gb28181/bean/Device.java | 33 src/main/java/com/genersoft/iot/vmp/media/zlm/dto/StreamProxyItem.java | 23 src/main/java/com/genersoft/iot/vmp/media/zlm/dto/MediaServerItem.java | 30 pom.xml | 44 src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/platform/bean/ChannelReduce.java | 11 src/main/java/com/genersoft/iot/vmp/vmanager/bean/BatchGBStreamParam.java | 6 src/main/java/com/genersoft/iot/vmp/service/impl/RedisStreamMsgListener.java | 9 src/main/java/com/genersoft/iot/vmp/storager/impl/RedisCatchStorageImpl.java | 190 ++-- src/main/resources/application-docker.yml | 2 src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/gbStream/GbStreamController.java | 37 src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/gbStream/bean/GbStreamParam.java | 5 src/main/java/com/genersoft/iot/vmp/gb28181/bean/ParentPlatform.java | 36 src/main/java/com/genersoft/iot/vmp/vmanager/bean/WVPResult.java | 6 src/main/java/com/genersoft/iot/vmp/gb28181/session/SsrcConfig.java | 8 src/main/java/com/genersoft/iot/vmp/VManageBootstrap.java | 2 src/main/java/com/genersoft/iot/vmp/gb28181/bean/PlatformGbStream.java | 8 src/main/java/com/genersoft/iot/vmp/gb28181/bean/DeviceAlarm.java | 19 src/main/java/com/genersoft/iot/vmp/vmanager/user/RoleController.java | 27 src/main/java/com/genersoft/iot/vmp/conf/redis/RedisConfig.java | 177 ++-- src/main/resources/all-application.yml | 2 src/main/java/com/genersoft/iot/vmp/vmanager/server/ServerController.java | 104 +- /dev/null | 66 - src/main/java/com/genersoft/iot/vmp/gb28181/bean/GbStream.java | 15 src/main/java/com/genersoft/iot/vmp/gb28181/bean/SyncStatus.java | 8 src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/play/PlayController.java | 48 src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/record/GBRecordController.java | 60 src/main/java/com/genersoft/iot/vmp/vmanager/user/UserController.java | 75 - src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/MobilePosition/MobilePositionController.java | 51 51 files changed, 1,153 insertions(+), 1,232 deletions(-) diff --git a/pom.xml b/pom.xml index 2abd9d8..2b9a838 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> - <version>2.3.5.RELEASE</version> + <version>2.7.2</version> </parent> <groupId>com.genersoft</groupId> @@ -47,7 +47,6 @@ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <maven.build.timestamp.format>MMddHHmm</maven.build.timestamp.format> <maven-jar-plugin.version>3.1.1</maven-jar-plugin.version> - <jedis-version>3.1.0</jedis-version> <!-- 渚濊禆鐗堟湰 --> <snippetsDirectory>${project.build.directory}/generated-snippets</snippetsDirectory> @@ -74,7 +73,7 @@ <dependency> <groupId>org.mybatis.spring.boot</groupId> <artifactId>mybatis-spring-boot-starter</artifactId> - <version>2.1.4</version> + <version>2.2.2</version> <exclusions> <exclusion> <groupId>com.zaxxer</groupId> @@ -91,36 +90,35 @@ <dependency> <groupId>com.alibaba</groupId> <artifactId>druid-spring-boot-starter</artifactId> - <version>1.1.22</version> + <version>1.2.11</version> </dependency> <!-- mysql鏁版嵁搴� --> <dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> - <version>8.0.22</version> + <version>8.0.30</version> </dependency> <!--Mybatis鍒嗛〉鎻掍欢 --> <dependency> <groupId>com.github.pagehelper</groupId> <artifactId>pagehelper-spring-boot-starter</artifactId> - <version>1.4.1</version> + <version>1.4.3</version> </dependency> - <!--Swagger3 --> <!--鍦ㄧ嚎鏂囨。 --> <dependency> - <groupId>io.springfox</groupId> - <artifactId>springfox-boot-starter</artifactId> - <version>3.0.0</version> - </dependency> - <dependency> - <groupId>com.github.xiaoymin</groupId> - <artifactId>knife4j-spring-boot-starter</artifactId> - <version>3.0.2</version> + <groupId>org.springdoc</groupId> + <artifactId>springdoc-openapi-ui</artifactId> + <version>1.6.10</version> </dependency> + <dependency> + <groupId>com.github.xiaoymin</groupId> + <artifactId>knife4j-springdoc-ui</artifactId> + <version>3.0.3</version> + </dependency> <!--鍙傛暟鏍¢獙 --> <dependency> @@ -145,7 +143,7 @@ <dependency> <groupId>org.slf4j</groupId> <artifactId>log4j-over-slf4j</artifactId> - <version>1.7.35</version> + <version>1.7.36</version> </dependency> <!-- xml瑙f瀽搴� --> @@ -167,14 +165,14 @@ <dependency> <groupId>com.squareup.okhttp3</groupId> <artifactId>okhttp</artifactId> - <version>4.9.0</version> + <version>4.10.0</version> </dependency> <!-- okhttp 璋冭瘯鏃ュ織 --> <dependency> <groupId>com.squareup.okhttp3</groupId> <artifactId>logging-interceptor</artifactId> - <version>4.9.0</version> + <version>4.10.0</version> </dependency> @@ -183,7 +181,7 @@ <dependency> <groupId>io.github.rburgst</groupId> <artifactId>okhttp-digest</artifactId> - <version>2.5</version> + <version>2.7</version> </dependency> <!-- https://mvnrepository.com/artifact/net.sf.kxml/kxml2 --> @@ -197,21 +195,21 @@ <dependency> <groupId>org.mitre.dsmiley.httpproxy</groupId> <artifactId>smiley-http-proxy-servlet</artifactId> - <version>1.12</version> + <version>1.12.1</version> </dependency> <!--excel瑙f瀽搴�--> <dependency> <groupId>com.alibaba</groupId> <artifactId>easyexcel</artifactId> - <version>3.0.4</version> + <version>3.1.1</version> </dependency> <!-- 鑾峰彇绯荤粺淇℃伅 --> <dependency> <groupId>com.github.oshi</groupId> <artifactId>oshi-core</artifactId> - <version>6.1.0</version> + <version>6.2.2</version> </dependency> <dependency> @@ -231,7 +229,7 @@ <dependency> <groupId>com.google.guava</groupId> <artifactId>guava</artifactId> - <version>31.0.1-jre</version> + <version>31.1-jre</version> </dependency> diff --git a/src/main/java/com/genersoft/iot/vmp/VManageBootstrap.java b/src/main/java/com/genersoft/iot/vmp/VManageBootstrap.java index 3bac82d..21002c4 100644 --- a/src/main/java/com/genersoft/iot/vmp/VManageBootstrap.java +++ b/src/main/java/com/genersoft/iot/vmp/VManageBootstrap.java @@ -8,7 +8,6 @@ import org.springframework.boot.web.servlet.ServletComponentScan; import org.springframework.context.ConfigurableApplicationContext; import org.springframework.scheduling.annotation.EnableScheduling; -import springfox.documentation.oas.annotations.EnableOpenApi; /** * 鍚姩绫� @@ -16,7 +15,6 @@ @ServletComponentScan("com.genersoft.iot.vmp.conf") @SpringBootApplication @EnableScheduling -@EnableOpenApi @EnableDruidSupport public class VManageBootstrap extends LogManager { private static String[] args; diff --git a/src/main/java/com/genersoft/iot/vmp/common/StreamInfo.java b/src/main/java/com/genersoft/iot/vmp/common/StreamInfo.java index b5788ae..4f717f0 100644 --- a/src/main/java/com/genersoft/iot/vmp/common/StreamInfo.java +++ b/src/main/java/com/genersoft/iot/vmp/common/StreamInfo.java @@ -1,6 +1,5 @@ package com.genersoft.iot.vmp.common; -import com.alibaba.fastjson.JSONArray; public class StreamInfo { diff --git a/src/main/java/com/genersoft/iot/vmp/conf/DynamicTask.java b/src/main/java/com/genersoft/iot/vmp/conf/DynamicTask.java index 1885632..b2c2358 100644 --- a/src/main/java/com/genersoft/iot/vmp/conf/DynamicTask.java +++ b/src/main/java/com/genersoft/iot/vmp/conf/DynamicTask.java @@ -9,6 +9,7 @@ import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler; import org.springframework.stereotype.Component; +import javax.annotation.PostConstruct; import java.time.Instant; import java.util.Map; import java.util.Set; @@ -25,20 +26,18 @@ private final Logger logger = LoggerFactory.getLogger(DynamicTask.class); - @Autowired private ThreadPoolTaskScheduler threadPoolTaskScheduler; private final Map<String, ScheduledFuture<?>> futureMap = new ConcurrentHashMap<>(); private final Map<String, Runnable> runnableMap = new ConcurrentHashMap<>(); - @Bean - public ThreadPoolTaskScheduler threadPoolTaskScheduler() { - ThreadPoolTaskScheduler schedulerPool = new ThreadPoolTaskScheduler(); - schedulerPool.setPoolSize(300); - schedulerPool.setWaitForTasksToCompleteOnShutdown(true); - schedulerPool.setAwaitTerminationSeconds(10); - return schedulerPool; - + @PostConstruct + public void DynamicTask() { + threadPoolTaskScheduler = new ThreadPoolTaskScheduler(); + threadPoolTaskScheduler.setPoolSize(300); + threadPoolTaskScheduler.setWaitForTasksToCompleteOnShutdown(true); + threadPoolTaskScheduler.setAwaitTerminationSeconds(10); + threadPoolTaskScheduler.initialize(); } /** diff --git a/src/main/java/com/genersoft/iot/vmp/conf/RedisConfig.java b/src/main/java/com/genersoft/iot/vmp/conf/redis/RedisConfig.java similarity index 90% rename from src/main/java/com/genersoft/iot/vmp/conf/RedisConfig.java rename to src/main/java/com/genersoft/iot/vmp/conf/redis/RedisConfig.java index 449a018..7bdeab4 100644 --- a/src/main/java/com/genersoft/iot/vmp/conf/RedisConfig.java +++ b/src/main/java/com/genersoft/iot/vmp/conf/redis/RedisConfig.java @@ -1,90 +1,87 @@ -package com.genersoft.iot.vmp.conf; - -import com.alibaba.fastjson.parser.ParserConfig; -import com.genersoft.iot.vmp.common.VideoManagerConstants; -import com.genersoft.iot.vmp.service.impl.*; -import org.apache.commons.lang3.StringUtils; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.cache.annotation.CachingConfigurerSupport; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.data.redis.connection.RedisConnectionFactory; -import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory; -import org.springframework.data.redis.core.RedisTemplate; -import org.springframework.data.redis.listener.PatternTopic; -import org.springframework.data.redis.listener.RedisMessageListenerContainer; -import org.springframework.data.redis.serializer.StringRedisSerializer; - -import com.genersoft.iot.vmp.utils.redis.FastJsonRedisSerializer; - - -/** - * @description:Redis涓棿浠堕厤缃被锛屼娇鐢╯pring-data-redis闆嗘垚锛岃嚜鍔ㄤ粠application.yml涓姞杞絩edis閰嶇疆 - * @author: swwheihei - * @date: 2019骞�5鏈�30鏃� 涓婂崍10:58:25 - * - */ -@Configuration -public class RedisConfig extends CachingConfigurerSupport { - - @Autowired - private RedisGpsMsgListener redisGPSMsgListener; - - @Autowired - private RedisAlarmMsgListener redisAlarmMsgListener; - - @Autowired - private RedisStreamMsgListener redisStreamMsgListener; - - @Autowired - private RedisGbPlayMsgListener redisGbPlayMsgListener; - - @Autowired - private RedisPushStreamStatusMsgListener redisPushStreamStatusMsgListener; - - @Autowired - private RedisPushStreamListMsgListener redisPushStreamListMsgListener; - - @Bean - public RedisTemplate<Object, Object> redisTemplate(RedisConnectionFactory redisConnectionFactory) { - RedisTemplate<Object, Object> redisTemplate = new RedisTemplate<>(); - // 浣跨敤fastJson搴忓垪鍖� - FastJsonRedisSerializer fastJsonRedisSerializer = new FastJsonRedisSerializer(Object.class); - // value鍊肩殑搴忓垪鍖栭噰鐢╢astJsonRedisSerializer - redisTemplate.setValueSerializer(fastJsonRedisSerializer); - redisTemplate.setHashValueSerializer(fastJsonRedisSerializer); - // 鍏ㄥ眬寮�鍚疉utoType锛屼笉寤鸿浣跨敤 - ParserConfig.getGlobalInstance().setAutoTypeSupport(true); - // 寤鸿浣跨敤杩欑鏂瑰紡锛屽皬鑼冨洿鎸囧畾鐧藉悕鍗曪紝闇�瑕佸簭鍒楀寲鐨勭被 -// ParserConfig.getGlobalInstance().addAccept("com.avatar"); - // key鐨勫簭鍒楀寲閲囩敤StringRedisSerializer - redisTemplate.setKeySerializer(new StringRedisSerializer()); - redisTemplate.setHashKeySerializer(new StringRedisSerializer()); - redisTemplate.setConnectionFactory(redisConnectionFactory); - return redisTemplate; - } - - - /** - * redis娑堟伅鐩戝惉鍣ㄥ鍣� 鍙互娣诲姞澶氫釜鐩戝惉涓嶅悓璇濋鐨剅edis鐩戝惉鍣紝鍙渶瑕佹妸娑堟伅鐩戝惉鍣ㄥ拰鐩稿簲鐨勬秷鎭闃呭鐞嗗櫒缁戝畾锛岃娑堟伅鐩戝惉鍣� - * 閫氳繃鍙嶅皠鎶�鏈皟鐢ㄦ秷鎭闃呭鐞嗗櫒鐨勭浉鍏虫柟娉曡繘琛屼竴浜涗笟鍔″鐞� - * - * @param connectionFactory - * @return - */ - @Bean - RedisMessageListenerContainer container(RedisConnectionFactory connectionFactory) { - - RedisMessageListenerContainer container = new RedisMessageListenerContainer(); - container.setConnectionFactory(connectionFactory); - container.addMessageListener(redisGPSMsgListener, new PatternTopic(VideoManagerConstants.VM_MSG_GPS)); - container.addMessageListener(redisAlarmMsgListener, new PatternTopic(VideoManagerConstants.VM_MSG_SUBSCRIBE_ALARM_RECEIVE)); - container.addMessageListener(redisStreamMsgListener, new PatternTopic(VideoManagerConstants.WVP_MSG_STREAM_CHANGE_PREFIX + "PUSH")); - container.addMessageListener(redisGbPlayMsgListener, new PatternTopic(RedisGbPlayMsgListener.WVP_PUSH_STREAM_KEY)); - container.addMessageListener(redisPushStreamStatusMsgListener, new PatternTopic(VideoManagerConstants.VM_MSG_PUSH_STREAM_STATUS_CHANGE)); - container.addMessageListener(redisPushStreamListMsgListener, new PatternTopic(VideoManagerConstants.VM_MSG_PUSH_STREAM_LIST_CHANGE)); - return container; - } - -} +package com.genersoft.iot.vmp.conf.redis; + + +import com.alibaba.fastjson.parser.ParserConfig; +import com.genersoft.iot.vmp.common.VideoManagerConstants; +import com.genersoft.iot.vmp.service.impl.*; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.cache.annotation.CachingConfigurerSupport; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.data.redis.connection.RedisConnectionFactory; +import org.springframework.data.redis.core.RedisTemplate; +import org.springframework.data.redis.listener.PatternTopic; +import org.springframework.data.redis.listener.RedisMessageListenerContainer; +import org.springframework.data.redis.serializer.RedisSerializer; +import org.springframework.data.redis.serializer.StringRedisSerializer; + +import com.genersoft.iot.vmp.utils.redis.FastJsonRedisSerializer; + + +/** + * @description:Redis涓棿浠堕厤缃被锛屼娇鐢╯pring-data-redis闆嗘垚锛岃嚜鍔ㄤ粠application.yml涓姞杞絩edis閰嶇疆 + * @author: swwheihei + * @date: 2019骞�5鏈�30鏃� 涓婂崍10:58:25 + * + */ +@Configuration +public class RedisConfig extends CachingConfigurerSupport { + + @Autowired + private RedisGpsMsgListener redisGPSMsgListener; + + @Autowired + private RedisAlarmMsgListener redisAlarmMsgListener; + + @Autowired + private RedisStreamMsgListener redisStreamMsgListener; + + @Autowired + private RedisGbPlayMsgListener redisGbPlayMsgListener; + + @Autowired + private RedisPushStreamStatusMsgListener redisPushStreamStatusMsgListener; + + @Autowired + private RedisPushStreamListMsgListener redisPushStreamListMsgListener; + + @Bean + public RedisTemplate<Object, Object> redisTemplate(RedisConnectionFactory redisConnectionFactory) { + RedisTemplate<Object, Object> redisTemplate = new RedisTemplate<>(); + // 浣跨敤fastJson搴忓垪鍖� + FastJsonRedisSerializer fastJsonRedisSerializer = new FastJsonRedisSerializer(Object.class); + // value鍊肩殑搴忓垪鍖栭噰鐢╢astJsonRedisSerializer + redisTemplate.setValueSerializer(fastJsonRedisSerializer); + redisTemplate.setHashValueSerializer(fastJsonRedisSerializer); + // 鍏ㄥ眬寮�鍚疉utoType锛屼笉寤鸿浣跨敤 + ParserConfig.getGlobalInstance().setAutoTypeSupport(true); + // key鐨勫簭鍒楀寲閲囩敤StringRedisSerializer + redisTemplate.setKeySerializer(new StringRedisSerializer()); + redisTemplate.setHashKeySerializer(new StringRedisSerializer()); + redisTemplate.setConnectionFactory(redisConnectionFactory); + return redisTemplate; + } + + + /** + * redis娑堟伅鐩戝惉鍣ㄥ鍣� 鍙互娣诲姞澶氫釜鐩戝惉涓嶅悓璇濋鐨剅edis鐩戝惉鍣紝鍙渶瑕佹妸娑堟伅鐩戝惉鍣ㄥ拰鐩稿簲鐨勬秷鎭闃呭鐞嗗櫒缁戝畾锛岃娑堟伅鐩戝惉鍣� + * 閫氳繃鍙嶅皠鎶�鏈皟鐢ㄦ秷鎭闃呭鐞嗗櫒鐨勭浉鍏虫柟娉曡繘琛屼竴浜涗笟鍔″鐞� + * + * @param connectionFactory + * @return + */ + @Bean + RedisMessageListenerContainer container(RedisConnectionFactory connectionFactory) { + + RedisMessageListenerContainer container = new RedisMessageListenerContainer(); + container.setConnectionFactory(connectionFactory); + container.addMessageListener(redisGPSMsgListener, new PatternTopic(VideoManagerConstants.VM_MSG_GPS)); + container.addMessageListener(redisAlarmMsgListener, new PatternTopic(VideoManagerConstants.VM_MSG_SUBSCRIBE_ALARM_RECEIVE)); + container.addMessageListener(redisStreamMsgListener, new PatternTopic(VideoManagerConstants.WVP_MSG_STREAM_CHANGE_PREFIX + "PUSH")); + container.addMessageListener(redisGbPlayMsgListener, new PatternTopic(RedisGbPlayMsgListener.WVP_PUSH_STREAM_KEY)); + container.addMessageListener(redisPushStreamStatusMsgListener, new PatternTopic(VideoManagerConstants.VM_MSG_PUSH_STREAM_STATUS_CHANGE)); + container.addMessageListener(redisPushStreamListMsgListener, new PatternTopic(VideoManagerConstants.VM_MSG_PUSH_STREAM_LIST_CHANGE)); + return container; + } + +} diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/bean/Device.java b/src/main/java/com/genersoft/iot/vmp/gb28181/bean/Device.java index 880117f..b26dc68 100644 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/bean/Device.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/bean/Device.java @@ -1,41 +1,50 @@ package com.genersoft.iot.vmp.gb28181.bean; +import io.swagger.v3.oas.annotations.media.Schema; + /** * 鍥芥爣璁惧/骞冲彴 * @author lin */ +@Schema(description = "鍥芥爣璁惧/骞冲彴") public class Device { /** - * 璁惧Id + * 璁惧鍥芥爣缂栧彿 */ + @Schema(description = "璁惧鍥芥爣缂栧彿") private String deviceId; /** * 璁惧鍚� */ + @Schema(description = "鍚嶇О") private String name; /** * 鐢熶骇鍘傚晢 */ + @Schema(description = "鐢熶骇鍘傚晢") private String manufacturer; /** * 鍨嬪彿 */ + @Schema(description = "鍨嬪彿") private String model; /** * 鍥轰欢鐗堟湰 */ + @Schema(description = "鍥轰欢鐗堟湰") private String firmware; /** * 浼犺緭鍗忚 * UDP/TCP */ + @Schema(description = "浼犺緭鍗忚锛圲DP/TCP锛�") private String transport; /** @@ -44,103 +53,123 @@ * TCP-ACTIVE锛歵cp涓诲姩妯″紡 * TCP-PASSIVE锛歵cp琚姩妯″紡 */ + @Schema(description = "鏁版嵁娴佷紶杈撴ā寮�") private String streamMode; /** * wan鍦板潃_ip */ + @Schema(description = "IP") private String ip; /** * wan鍦板潃_port */ + @Schema(description = "绔彛") private int port; /** * wan鍦板潃 */ + @Schema(description = "wan鍦板潃") private String hostAddress; /** * 鍦ㄧ嚎 */ + @Schema(description = "鏄惁鍦ㄧ嚎锛�1涓哄湪绾匡紝0涓虹绾�") private int online; /** * 娉ㄥ唽鏃堕棿 */ + @Schema(description = "娉ㄥ唽鏃堕棿") private String registerTime; /** * 蹇冭烦鏃堕棿 */ + @Schema(description = "蹇冭烦鏃堕棿") private String keepaliveTime; /** * 閫氶亾涓暟 */ + @Schema(description = "閫氶亾涓暟") private int channelCount; /** * 娉ㄥ唽鏈夋晥鏈� */ + @Schema(description = "娉ㄥ唽鏈夋晥鏈�") private int expires; /** * 鍒涘缓鏃堕棿 */ + @Schema(description = "鍒涘缓鏃堕棿") private String createTime; /** * 鏇存柊鏃堕棿 */ + @Schema(description = "鏇存柊鏃堕棿") private String updateTime; /** * 璁惧浣跨敤鐨勫獟浣搃d, 榛樿涓簄ull */ + @Schema(description = "璁惧浣跨敤鐨勫獟浣搃d, 榛樿涓簄ull") private String mediaServerId; /** * 瀛楃闆�, 鏀寔 UTF-8 涓� GB2312 */ + @Schema(description = "绗﹂泦, 鏀寔 UTF-8 涓� GB2312") private String charset ; /** * 鐩綍璁㈤槄鍛ㄦ湡锛�0涓轰笉璁㈤槄 */ + @Schema(description = "鐩綍璁㈤槄鍛ㄦ湡锛�0涓轰笉璁㈤槄") private int subscribeCycleForCatalog; /** * 绉诲姩璁惧浣嶇疆璁㈤槄鍛ㄦ湡锛�0涓轰笉璁㈤槄 */ + @Schema(description = "绉诲姩璁惧浣嶇疆璁㈤槄鍛ㄦ湡锛�0涓轰笉璁㈤槄") private int subscribeCycleForMobilePosition; /** * 绉诲姩璁惧浣嶇疆淇℃伅涓婃姤鏃堕棿闂撮殧,鍗曚綅:绉�,榛樿鍊�5 */ + @Schema(description = "绉诲姩璁惧浣嶇疆淇℃伅涓婃姤鏃堕棿闂撮殧,鍗曚綅:绉�,榛樿鍊�5") private int mobilePositionSubmissionInterval = 5; /** * 鎶ヨ璁㈤槄鍛ㄦ湡锛�0涓轰笉璁㈤槄 */ + @Schema(description = "鎶ヨ蹇冭烦鏃堕棿璁㈤槄鍛ㄦ湡锛�0涓轰笉璁㈤槄") private int subscribeCycleForAlarm; /** * 鏄惁寮�鍚痵src鏍¢獙锛岄粯璁ゅ叧闂紝寮�鍚彲浠ラ槻姝覆娴� */ + @Schema(description = "鏄惁寮�鍚痵src鏍¢獙锛岄粯璁ゅ叧闂紝寮�鍚彲浠ラ槻姝覆娴�") private boolean ssrcCheck = true; /** - * 鍦扮悊鍧愭爣绯伙紝 鐩墠鏀寔 WGS84,GCJ02 TODO CGCS2000 + * 鍦扮悊鍧愭爣绯伙紝 鐩墠鏀寔 WGS84,GCJ02 */ + @Schema(description = "鍦扮悊鍧愭爣绯伙紝 鐩墠鏀寔 WGS84,GCJ02") private String geoCoordSys; /** * 鏍戠被鍨� 鍥芥爣瑙勫畾浜嗕袱绉嶆爲鐨勫睍鐜版柟寮� 琛屾斂鍖哄垝锛欳ivilCode 鍜屼笟鍔″垎缁�:BusinessGroup */ + @Schema(description = "鏍戠被鍨� 鍥芥爣瑙勫畾浜嗕袱绉嶆爲鐨勫睍鐜版柟寮� 琛屾斂鍖哄垝锛欳ivilCode 鍜屼笟鍔″垎缁�:BusinessGroup") private String treeType; diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/bean/DeviceAlarm.java b/src/main/java/com/genersoft/iot/vmp/gb28181/bean/DeviceAlarm.java index 0f5f392..bfc97b5 100644 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/bean/DeviceAlarm.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/bean/DeviceAlarm.java @@ -1,52 +1,67 @@ package com.genersoft.iot.vmp.gb28181.bean; +import io.swagger.v3.oas.annotations.media.Schema; +/** + * @author lin + */ +@Schema(description = "鎶ヨ淇℃伅") public class DeviceAlarm { /** * 鏁版嵁搴搃d */ + @Schema(description = "鏁版嵁搴搃d") private String id; /** * 璁惧Id */ + @Schema(description = "璁惧鐨勫浗鏍囩紪鍙�") private String deviceId; /** * 閫氶亾Id */ + @Schema(description = "閫氶亾鐨勫浗鏍囩紪鍙�") private String channelId; /** - * 鎶ヨ绾у埆, 1涓轰竴绾ц鎯�, 2涓轰簩绾ц鎯�, 3涓轰笁绾ц鎯�, 4涓哄洓绾� 璀︽儏- + * 鎶ヨ绾у埆, 1涓轰竴绾ц鎯�, 2涓轰簩绾ц鎯�, 3涓轰笁绾ц鎯�, 4涓哄洓绾ц鎯� */ + @Schema(description = "鎶ヨ绾у埆, 1涓轰竴绾ц鎯�, 2涓轰簩绾ц鎯�, 3涓轰笁绾ц鎯�, 4涓哄洓绾ц鎯�") private String alarmPriority; /** * 鎶ヨ鏂瑰紡 , 1涓虹數璇濇姤璀�, 2涓鸿澶囨姤璀�, 3涓虹煭淇℃姤璀�, 4涓� GPS鎶ヨ, 5涓鸿棰戞姤璀�, 6涓鸿澶囨晠闅滄姤璀�, * 7鍏朵粬鎶ヨ;鍙互涓虹洿鎺ョ粍鍚堝12涓虹數璇濇姤璀︽垨 璁惧鎶ヨ- */ + @Schema(description = "鎶ヨ鏂瑰紡 , 1涓虹數璇濇姤璀�, 2涓鸿澶囨姤璀�, 3涓虹煭淇℃姤璀�, 4涓� GPS鎶ヨ, 5涓鸿棰戞姤璀�, 6涓鸿澶囨晠闅滄姤璀�,\n" + + "\t * 7鍏朵粬鎶ヨ;鍙互涓虹洿鎺ョ粍鍚堝12涓虹數璇濇姤璀︽垨璁惧鎶ヨ") private String alarmMethod; /** * 鎶ヨ鏃堕棿 */ + @Schema(description = "鎶ヨ鏃堕棿") private String alarmTime; /** * 鎶ヨ鍐呭鎻忚堪 */ + @Schema(description = "鎶ヨ鍐呭鎻忚堪") private String alarmDescription; /** * 缁忓害 */ + @Schema(description = "缁忓害") private double longitude; /** * 绾害 */ + @Schema(description = "绾害") private double latitude; /** @@ -75,8 +90,10 @@ * 1-瀛樺偍璁惧纾佺洏鏁呴殰鎶ヨ; * 2-瀛樺偍璁惧椋庢墖鏁呴殰鎶ヨ銆� */ + @Schema(description = "鎶ヨ绫诲瀷") private String alarmType; + @Schema(description = "鍒涘缓鏃堕棿") private String createTime; diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/bean/DeviceChannel.java b/src/main/java/com/genersoft/iot/vmp/gb28181/bean/DeviceChannel.java index 0d98674..0e1b618 100644 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/bean/DeviceChannel.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/bean/DeviceChannel.java @@ -1,136 +1,165 @@ package com.genersoft.iot.vmp.gb28181.bean; +import io.swagger.v3.oas.annotations.media.Schema; + +@Schema(description = "閫氶亾淇℃伅") public class DeviceChannel { /** * 鏁版嵁搴撹嚜澧濱D */ + @Schema(description = "鏁版嵁搴撹嚜澧濱D") private int id; /** - * 閫氶亾id + * 閫氶亾鍥芥爣缂栧彿 */ + @Schema(description = "閫氶亾鍥芥爣缂栧彿") private String channelId; /** - * 璁惧id + * 璁惧鍥芥爣缂栧彿 */ + @Schema(description = "璁惧鍥芥爣缂栧彿") private String deviceId; /** * 閫氶亾鍚� */ + @Schema(description = "鍚嶇О") private String name; /** * 鐢熶骇鍘傚晢 */ + @Schema(description = "鐢熶骇鍘傚晢") private String manufacture; /** * 鍨嬪彿 */ + @Schema(description = "鍨嬪彿") private String model; /** * 璁惧褰掑睘 */ + @Schema(description = "璁惧褰掑睘") private String owner; /** * 琛屾斂鍖哄煙 */ + @Schema(description = "琛屾斂鍖哄煙") private String civilCode; /** * 璀﹀尯 */ + @Schema(description = "璀﹀尯") private String block; /** * 瀹夎鍦板潃 */ + @Schema(description = "瀹夎鍦板潃") private String address; /** * 鏄惁鏈夊瓙璁惧 1鏈�, 0娌℃湁 */ + @Schema(description = "鏄惁鏈夊瓙璁惧 1鏈�, 0娌℃湁") private int parental; /** * 鐖剁骇id */ + @Schema(description = "鐖剁骇id") private String parentId; /** * 淇′护瀹夊叏妯″紡 缂虹渷涓�0; 0:涓嶉噰鐢�; 2: S/MIME绛惧悕鏂瑰紡; 3: S/ MIME鍔犲瘑绛惧悕鍚屾椂閲囩敤鏂瑰紡; 4:鏁板瓧鎽樿鏂瑰紡 */ + @Schema(description = "淇′护瀹夊叏妯″紡 缂虹渷涓�0; 0:涓嶉噰鐢�; 2: S/MIME绛惧悕鏂瑰紡; 3: S/ MIME鍔犲瘑绛惧悕鍚屾椂閲囩敤鏂瑰紡; 4:鏁板瓧鎽樿鏂瑰紡") private int safetyWay; /** * 娉ㄥ唽鏂瑰紡 缂虹渷涓�1;1:绗﹀悎IETFRFC3261鏍囧噯鐨勮璇佹敞鍐屾ā 寮�; 2:鍩轰簬鍙d护鐨勫弻鍚戣璇佹敞鍐屾ā寮�; 3:鍩轰簬鏁板瓧璇佷功鐨勫弻鍚戣璇佹敞鍐屾ā寮� */ + @Schema(description = "娉ㄥ唽鏂瑰紡 缂虹渷涓�1;1:绗﹀悎IETFRFC3261鏍囧噯鐨勮璇佹敞鍐屾ā 寮�; 2:鍩轰簬鍙d护鐨勫弻鍚戣璇佹敞鍐屾ā寮�; 3:鍩轰簬鏁板瓧璇佷功鐨勫弻鍚戣璇佹敞鍐屾ā寮�") private int registerWay; /** * 璇佷功搴忓垪鍙� */ + @Schema(description = "璇佷功搴忓垪鍙�") private String certNum; /** * 璇佷功鏈夋晥鏍囪瘑 缂虹渷涓�0;璇佷功鏈夋晥鏍囪瘑:0:鏃犳晥1: 鏈夋晥 */ + @Schema(description = "璇佷功鏈夋晥鏍囪瘑 缂虹渷涓�0;璇佷功鏈夋晥鏍囪瘑:0:鏃犳晥1: 鏈夋晥") private int certifiable; /** * 璇佷功鏃犳晥鍘熷洜鐮� */ + @Schema(description = "璇佷功鏃犳晥鍘熷洜鐮�") private int errCode; /** * 璇佷功缁堟鏈夋晥鏈� */ + @Schema(description = "璇佷功缁堟鏈夋晥鏈�") private String endTime; /** * 淇濆瘑灞炴�� 缂虹渷涓�0; 0:涓嶆秹瀵�, 1:娑夊瘑 */ + @Schema(description = "淇濆瘑灞炴�� 缂虹渷涓�0; 0:涓嶆秹瀵�, 1:娑夊瘑") private String secrecy; /** * IP鍦板潃 */ + @Schema(description = "IP鍦板潃") private String ipAddress; /** * 绔彛鍙� */ + @Schema(description = "绔彛鍙�") private int port; /** * 瀵嗙爜 */ + @Schema(description = "瀵嗙爜") private String password; /** * 浜戝彴绫诲瀷 */ + @Schema(description = "浜戝彴绫诲瀷") private int PTZType; /** * 浜戝彴绫诲瀷鎻忚堪瀛楃涓� */ + @Schema(description = "浜戝彴绫诲瀷鎻忚堪瀛楃涓�") private String PTZTypeText; /** * 鍒涘缓鏃堕棿 */ + @Schema(description = "鍒涘缓鏃堕棿") private String createTime; /** * 鏇存柊鏃堕棿 */ + @Schema(description = "鏇存柊鏃堕棿") private String updateTime; /** @@ -142,66 +171,79 @@ * <Status>OFF</Status> * 閬囧埌杩嘚VR涓嬬殑IPC涓嬪彂淇′护鍙互鎺ㄦ祦锛� 浣嗘槸 Status 鍝嶅簲 OFF */ + @Schema(description = "鍦ㄧ嚎/绂荤嚎锛� 1鍦ㄧ嚎,0绂荤嚎") private int status; /** * 缁忓害 */ + @Schema(description = "缁忓害") private double longitude; /** * 绾害 */ + @Schema(description = "绾害") private double latitude; /** * 缁忓害 GCJ02 */ + @Schema(description = "GCJ02鍧愭爣绯荤粡搴�") private double longitudeGcj02; /** * 绾害 GCJ02 */ + @Schema(description = "GCJ02鍧愭爣绯荤含搴�") private double latitudeGcj02; /** * 缁忓害 WGS84 */ + @Schema(description = "WGS84鍧愭爣绯荤粡搴�") private double longitudeWgs84; /** * 绾害 WGS84 */ + @Schema(description = "WGS84鍧愭爣绯荤含搴�") private double latitudeWgs84; /** * 瀛愯澶囨暟 */ + @Schema(description = "瀛愯澶囨暟") private int subCount; /** * 娴佸敮涓�缂栧彿锛屽瓨鍦ㄨ〃绀烘鍦ㄧ洿鎾� */ + @Schema(description = "娴佸敮涓�缂栧彿锛屽瓨鍦ㄨ〃绀烘鍦ㄧ洿鎾�") private String streamId; /** * 鏄惁鍚湁闊抽 */ + @Schema(description = "鏄惁鍚湁闊抽") private boolean hasAudio; /** * 鏍囪閫氶亾鐨勭被鍨嬶紝0->鍥芥爣閫氶亾 1->鐩存挱娴侀�氶亾 2->涓氬姟鍒嗙粍/铏氭嫙缁勭粐/琛屾斂鍖哄垝 */ + @Schema(description = "鏍囪閫氶亾鐨勭被鍨嬶紝0->鍥芥爣閫氶亾 1->鐩存挱娴侀�氶亾 2->涓氬姟鍒嗙粍/铏氭嫙缁勭粐/琛屾斂鍖哄垝") private int channelType; /** * 涓氬姟鍒嗙粍 */ + @Schema(description = "涓氬姟鍒嗙粍") private String businessGroupId; /** * GPS鐨勬洿鏂版椂闂� */ + @Schema(description = "GPS鐨勬洿鏂版椂闂�") private String gpsTime; public int getId() { diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/bean/GbStream.java b/src/main/java/com/genersoft/iot/vmp/gb28181/bean/GbStream.java index f9efeee..d1e4ccb 100644 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/bean/GbStream.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/bean/GbStream.java @@ -1,21 +1,36 @@ package com.genersoft.iot.vmp.gb28181.bean; +import io.swagger.v3.oas.annotations.media.Schema; + /** * 鐩存挱娴佸叧鑱斿浗鏍囦笂绾у钩鍙� + * @author lin */ +@Schema(description = "鐩存挱娴佸叧鑱斿浗鏍囦笂绾у钩鍙�") public class GbStream extends PlatformGbStream{ + @Schema(description = "ID") private Integer gbStreamId; + @Schema(description = "搴旂敤鍚�") private String app; + @Schema(description = "娴両D") private String stream; + @Schema(description = "鍥芥爣ID") private String gbId; + @Schema(description = "鍚嶇О") private String name; + @Schema(description = "娴佸獟浣揑D") private String mediaServerId; + @Schema(description = "缁忓害") private double longitude; + @Schema(description = "绾害") private double latitude; + @Schema(description = "娴佺被鍨嬶紙鎷夋祦/鎺ㄦ祦锛�") private String streamType; + @Schema(description = "鐘舵��") private boolean status; + @Schema(description = "鍒涘缓鏃堕棿") public String createTime; @Override diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/bean/ParentPlatform.java b/src/main/java/com/genersoft/iot/vmp/gb28181/bean/ParentPlatform.java index 61e777a..ef2eecd 100644 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/bean/ParentPlatform.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/bean/ParentPlatform.java @@ -1,157 +1,193 @@ package com.genersoft.iot.vmp.gb28181.bean; +import io.swagger.v3.oas.annotations.media.Schema; + +/** + * @author lin + */ +@Schema(description = "骞冲彴淇℃伅") public class ParentPlatform { /** * id */ + @Schema(description = "ID(鏁版嵁搴撲腑)") private Integer id; /** * 鏄惁鍚敤 */ + @Schema(description = "鏄惁鍚敤") private boolean enable; /** * 鍚嶇О */ + @Schema(description = "鍚嶇О") private String name; /** * SIP鏈嶅姟鍥芥爣缂栫爜 */ + @Schema(description = "SIP鏈嶅姟鍥芥爣缂栫爜") private String serverGBId; /** * SIP鏈嶅姟鍥芥爣鍩� */ + @Schema(description = "SIP鏈嶅姟鍥芥爣鍩�") private String serverGBDomain; /** * SIP鏈嶅姟IP */ + @Schema(description = "SIP鏈嶅姟IP") private String serverIP; /** * SIP鏈嶅姟绔彛 */ + @Schema(description = "SIP鏈嶅姟绔彛") private int serverPort; /** * 璁惧鍥芥爣缂栧彿 */ + @Schema(description = "11111") private String deviceGBId; /** * 璁惧ip */ + @Schema(description = "璁惧ip") private String deviceIp; /** * 璁惧绔彛 */ + @Schema(description = "璁惧绔彛") private String devicePort; /** * SIP璁よ瘉鐢ㄦ埛鍚�(榛樿浣跨敤璁惧鍥芥爣缂栧彿) */ + @Schema(description = "SIP璁よ瘉鐢ㄦ埛鍚�(榛樿浣跨敤璁惧鍥芥爣缂栧彿)") private String username; /** * SIP璁よ瘉瀵嗙爜 */ + @Schema(description = "SIP璁よ瘉瀵嗙爜") private String password; /** * 娉ㄥ唽鍛ㄦ湡 (绉�) */ + @Schema(description = "娉ㄥ唽鍛ㄦ湡 (绉�)") private String expires; /** * 蹇冭烦鍛ㄦ湡(绉�) */ + @Schema(description = "蹇冭烦鍛ㄦ湡(绉�)") private String keepTimeout; /** * 浼犺緭鍗忚 * UDP/TCP */ + @Schema(description = "浼犺緭鍗忚") private String transport; /** * 瀛楃闆� */ + @Schema(description = "瀛楃闆�") private String characterSet; /** * 鍏佽浜戝彴鎺у埗 */ + @Schema(description = "鍏佽浜戝彴鎺у埗") private boolean ptz; /** * RTCP娴佷繚娲� * TODO 棰勭暀, 鏆備笉瀹炵幇 */ + @Schema(description = "RTCP娴佷繚娲�") private boolean rtcp; /** * 鍦ㄧ嚎鐘舵�� */ + @Schema(description = "鍦ㄧ嚎鐘舵��") private boolean status; /** * 鍦ㄧ嚎鐘舵�� */ + @Schema(description = "鍦ㄧ嚎鐘舵��") private int channelCount; /** * 榛樿鐩綍Id,鑷姩娣诲姞鐨勯�氶亾澶氭斁鍦ㄨ繖涓洰褰曚笅 */ + @Schema(description = "榛樿鐩綍Id,鑷姩娣诲姞鐨勯�氶亾澶氭斁鍦ㄨ繖涓洰褰曚笅") private String catalogId; /** * 宸茶璁㈤槄鐩綍淇℃伅 */ + @Schema(description = "宸茶璁㈤槄鐩綍淇℃伅") private boolean catalogSubscribe; /** * 宸茶璁㈤槄鎶ヨ淇℃伅 */ + @Schema(description = "宸茶璁㈤槄鎶ヨ淇℃伅") private boolean alarmSubscribe; /** * 宸茶璁㈤槄绉诲姩浣嶇疆淇℃伅 */ + @Schema(description = "宸茶璁㈤槄绉诲姩浣嶇疆淇℃伅") private boolean mobilePositionSubscribe; /** * 鐐规挱鏈帹娴佺殑璁惧鏃舵槸鍚︿娇鐢╮edis閫氱煡鎷夎捣 */ + @Schema(description = "鐐规挱鏈帹娴佺殑璁惧鏃舵槸鍚︿娇鐢╮edis閫氱煡鎷夎捣") private boolean startOfflinePush; /** * 鐩綍鍒嗙粍-姣忔鍚戜笂绾у彂閫侀�氶亾淇℃伅鏃跺崟涓寘鎼哄甫鐨勯�氶亾鏁伴噺锛屽彇鍊�1,2,4,8 */ + @Schema(description = "鐩綍鍒嗙粍-姣忔鍚戜笂绾у彂閫侀�氶亾淇℃伅鏃跺崟涓寘鎼哄甫鐨勯�氶亾鏁伴噺锛屽彇鍊�1,2,4,8") private int catalogGroup; /** * 琛屾斂鍖哄垝 */ + @Schema(description = "琛屾斂鍖哄垝") private String administrativeDivision; /** * 鏇存柊鏃堕棿 */ + @Schema(description = "鏇存柊鏃堕棿") private String updateTime; /** * 鍒涘缓鏃堕棿 */ + @Schema(description = "鍒涘缓鏃堕棿") private String createTime; /** * 鏍戠被鍨� 鍥芥爣瑙勫畾浜嗕袱绉嶆爲鐨勫睍鐜版柟寮� 琛屾斂鍖哄垝 CivilCode 鍜屼笟鍔″垎缁�:BusinessGroup */ + @Schema(description = "鏍戠被鍨� 鍥芥爣瑙勫畾浜嗕袱绉嶆爲鐨勫睍鐜版柟寮� 琛屾斂鍖哄垝 CivilCode 鍜屼笟鍔″垎缁�:BusinessGrou") private String treeType; public Integer getId() { diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/bean/PlatformCatalog.java b/src/main/java/com/genersoft/iot/vmp/gb28181/bean/PlatformCatalog.java index 58a9cbb..38ba2f0 100644 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/bean/PlatformCatalog.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/bean/PlatformCatalog.java @@ -1,27 +1,41 @@ package com.genersoft.iot.vmp.gb28181.bean; +import io.swagger.v3.oas.annotations.media.Schema; + /** * 鍥芥爣绾ц仈-鐩綍 * @author lin */ +@Schema(description = "鐩綍淇℃伅") public class PlatformCatalog { + @Schema(description = "ID") private String id; + + @Schema(description = "鍚嶇О") private String name; + + @Schema(description = "骞冲彴ID") private String platformId; + + @Schema(description = "鐖剁骇鐩綍ID") private String parentId; + @Schema(description = "琛屾斂鍖哄垝") private String civilCode; + @Schema(description = "鐩綍鍒嗙粍") private String businessGroupId; /** * 瀛愯妭鐐规暟 */ + @Schema(description = "瀛愯妭鐐规暟") private int childrenCount; /** * 0 鐩綍, 1 鍥芥爣閫氶亾, 2 鐩存挱娴� */ + @Schema(description = "绫诲瀷锛�0 鐩綍, 1 鍥芥爣閫氶亾, 2 鐩存挱娴�") private int type; public String getId() { diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/bean/PlatformGbStream.java b/src/main/java/com/genersoft/iot/vmp/gb28181/bean/PlatformGbStream.java index f425dfa..d52cf7b 100644 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/bean/PlatformGbStream.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/bean/PlatformGbStream.java @@ -1,8 +1,16 @@ package com.genersoft.iot.vmp.gb28181.bean; +import io.swagger.v3.oas.annotations.media.Schema; + public class PlatformGbStream { + + @Schema(description = "ID") private Integer gbStreamId; + + @Schema(description = "骞冲彴ID") private String platformId; + + @Schema(description = "鐩綍ID") private String catalogId; public Integer getGbStreamId() { diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/bean/SyncStatus.java b/src/main/java/com/genersoft/iot/vmp/gb28181/bean/SyncStatus.java index f3a197c..373b971 100644 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/bean/SyncStatus.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/bean/SyncStatus.java @@ -1,14 +1,20 @@ package com.genersoft.iot.vmp.gb28181.bean; +import io.swagger.v3.oas.annotations.media.Schema; + /** * 鎽勫儚鏈哄悓姝ョ姸鎬� * @author lin */ +@Schema(description = "鎽勫儚鏈哄悓姝ョ姸鎬�") public class SyncStatus { + @Schema(description = "鎬绘暟") private int total; + @Schema(description = "褰撳墠鏇存柊澶氬皯") private int current; + @Schema(description = "閿欒鎻忚堪") private String errorMsg; - + @Schema(description = "鏄惁鍚屾涓�") private boolean syncIng; public int getTotal() { diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/event/offline/KeepaliveTimeoutListenerForPlatform.java b/src/main/java/com/genersoft/iot/vmp/gb28181/event/offline/KeepaliveTimeoutListenerForPlatform.java deleted file mode 100644 index 8516fc7..0000000 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/event/offline/KeepaliveTimeoutListenerForPlatform.java +++ /dev/null @@ -1,81 +0,0 @@ -package com.genersoft.iot.vmp.gb28181.event.offline; - -import com.genersoft.iot.vmp.conf.RedisKeyExpirationEventMessageListener; -import com.genersoft.iot.vmp.conf.UserSetting; -import com.genersoft.iot.vmp.gb28181.bean.Device; -import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform; -import com.genersoft.iot.vmp.gb28181.event.SipSubscribe; -import com.genersoft.iot.vmp.storager.IVideoManagerStorage; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.data.redis.connection.Message; -import org.springframework.data.redis.listener.RedisMessageListenerContainer; -import org.springframework.stereotype.Component; - -import com.genersoft.iot.vmp.common.VideoManagerConstants; -import com.genersoft.iot.vmp.gb28181.event.EventPublisher; - -/** - * 璁惧蹇冭烦瓒呮椂鐩戝惉,鍊熷姪redis杩囨湡鐗规�э紝杩涜鐩戝惉锛岀洃鍚埌璇存槑璁惧蹇冭烦瓒呮椂锛屽彂閫佺绾夸簨浠� - * @author swwheihei - */ -@Component -public class KeepaliveTimeoutListenerForPlatform extends RedisKeyExpirationEventMessageListener { - - private Logger logger = LoggerFactory.getLogger(KeepaliveTimeoutListenerForPlatform.class); - - @Autowired - private EventPublisher publisher; - - @Autowired - private UserSetting userSetting; - - @Autowired - private SipSubscribe sipSubscribe; - - @Autowired - private IVideoManagerStorage storager; - - public KeepaliveTimeoutListenerForPlatform(RedisMessageListenerContainer listenerContainer, UserSetting userSetting) { - super(listenerContainer, userSetting); - } - - - /** - * 鐩戝惉澶辨晥鐨刱ey - * @param message - * @param pattern - */ - @Override - public void onMessage(Message message, byte[] pattern) { - // 鑾峰彇澶辨晥鐨刱ey - String expiredKey = message.toString(); - // 骞冲彴蹇冭烦鍒版湡,闇�瑕侀噸鍙�, 鍒ゆ柇鏄惁宸茬粡澶氭鏈敹鍒板績璺冲洖澶�, 澶氭鏈敹鍒�,鍒欓噸鏂板彂璧锋敞鍐�, 娉ㄥ唽灏濊瘯澶氭鏈緱鍒板洖澶�,鍒欒涓哄钩鍙扮绾� - String PLATFORM_KEEPLIVEKEY_PREFIX = VideoManagerConstants.PLATFORM_KEEPALIVE_PREFIX + userSetting.getServerId() + "_"; - String PLATFORM_REGISTER_PREFIX = VideoManagerConstants.PLATFORM_REGISTER_PREFIX + userSetting.getServerId() + "_"; - String REGISTER_INFO_PREFIX = VideoManagerConstants.PLATFORM_REGISTER_INFO_PREFIX + userSetting.getServerId() + "_"; - if (expiredKey.startsWith(PLATFORM_KEEPLIVEKEY_PREFIX)) { - String platformGbId = expiredKey.substring(PLATFORM_KEEPLIVEKEY_PREFIX.length()); - ParentPlatform platform = storager.queryParentPlatByServerGBId(platformGbId); - if (platform != null) { - publisher.platformKeepaliveExpireEventPublish(platformGbId); - } - }else if (expiredKey.startsWith(PLATFORM_REGISTER_PREFIX)) { - String platformGbId = expiredKey.substring(PLATFORM_REGISTER_PREFIX.length(),expiredKey.length()); - ParentPlatform platform = storager.queryParentPlatByServerGBId(platformGbId); - if (platform != null) { - publisher.platformRegisterCycleEventPublish(platformGbId); - } - }else if (expiredKey.startsWith(REGISTER_INFO_PREFIX)) { - String callId = expiredKey.substring(REGISTER_INFO_PREFIX.length()); - if (sipSubscribe.getErrorSubscribe(callId) != null) { - SipSubscribe.EventResult eventResult = new SipSubscribe.EventResult(); - eventResult.callId = callId; - eventResult.msg = "娉ㄥ唽瓒呮椂"; - eventResult.type = "register timeout"; - sipSubscribe.getErrorSubscribe(callId).response(eventResult); - } - } - } -} diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/session/SsrcConfig.java b/src/main/java/com/genersoft/iot/vmp/gb28181/session/SsrcConfig.java index 2812c7d..cc303c8 100644 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/session/SsrcConfig.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/session/SsrcConfig.java @@ -1,27 +1,35 @@ package com.genersoft.iot.vmp.gb28181.session; import com.genersoft.iot.vmp.utils.ConfigConst; +import io.swagger.v3.oas.annotations.media.Schema; import java.util.ArrayList; import java.util.List; import java.util.Random; import java.util.Set; +@Schema(description = "ssrc淇℃伅") public class SsrcConfig { /** * zlm娴佸獟浣撴湇鍔″櫒Id */ + @Schema(description = "娴佸獟浣撴湇鍔″櫒Id") private String mediaServerId; + @Schema(description = "SSRC鍓嶇紑") private String ssrcPrefix; + /** * zlm娴佸獟浣撴湇鍔″櫒宸茬敤浼氳瘽鍙ユ焺 */ + @Schema(description = "zlm娴佸獟浣撴湇鍔″櫒宸茬敤浼氳瘽鍙ユ焺") private List<String> isUsed; + /** * zlm娴佸獟浣撴湇鍔″櫒鍙敤浼氳瘽鍙ユ焺 */ + @Schema(description = "zlm娴佸獟浣撴湇鍔″櫒鍙敤浼氳瘽鍙ユ焺") private List<String> notUsed; public SsrcConfig() { diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/session/VideoStreamSessionManager.java b/src/main/java/com/genersoft/iot/vmp/gb28181/session/VideoStreamSessionManager.java index a22d24d..f61ae09 100644 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/session/VideoStreamSessionManager.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/session/VideoStreamSessionManager.java @@ -25,9 +25,6 @@ public class VideoStreamSessionManager { @Autowired - private RedisUtil redisUtil; - - @Autowired private UserSetting userSetting; public enum SessionType { @@ -58,9 +55,9 @@ ssrcTransaction.setMediaServerId(mediaServerId); ssrcTransaction.setType(type); - redisUtil.set(VideoManagerConstants.MEDIA_TRANSACTION_USED_PREFIX + userSetting.getServerId() + RedisUtil.set(VideoManagerConstants.MEDIA_TRANSACTION_USED_PREFIX + userSetting.getServerId() + "_" + deviceId + "_" + channelId + "_" + callId + "_" + stream, ssrcTransaction); - redisUtil.set(VideoManagerConstants.MEDIA_TRANSACTION_USED_PREFIX + userSetting.getServerId() + RedisUtil.set(VideoManagerConstants.MEDIA_TRANSACTION_USED_PREFIX + userSetting.getServerId() + "_" + deviceId + "_" + channelId + "_" + callId + "_" + stream, ssrcTransaction); } @@ -70,7 +67,7 @@ byte[] dialogByteArray = SerializeUtils.serialize(dialog); ssrcTransaction.setDialog(dialogByteArray); } - redisUtil.set(VideoManagerConstants.MEDIA_TRANSACTION_USED_PREFIX + userSetting.getServerId() + RedisUtil.set(VideoManagerConstants.MEDIA_TRANSACTION_USED_PREFIX + userSetting.getServerId() + "_" + deviceId + "_" + channelId + "_" + ssrcTransaction.getCallId() + "_" + ssrcTransaction.getStream(), ssrcTransaction); } @@ -126,11 +123,11 @@ stream ="*"; } String key = VideoManagerConstants.MEDIA_TRANSACTION_USED_PREFIX + userSetting.getServerId() + "_" + deviceId + "_" + channelId + "_" + callId+ "_" + stream; - List<Object> scanResult = redisUtil.scan(key); + List<Object> scanResult = RedisUtil.scan(key); if (scanResult.size() == 0) { return null; } - return (SsrcTransaction)redisUtil.get((String) scanResult.get(0)); + return (SsrcTransaction)RedisUtil.get((String) scanResult.get(0)); } public List<SsrcTransaction> getSsrcTransactionForAll(String deviceId, String channelId, String callId, String stream){ @@ -147,13 +144,13 @@ stream ="*"; } String key = VideoManagerConstants.MEDIA_TRANSACTION_USED_PREFIX + userSetting.getServerId() + "_" + deviceId + "_" + channelId + "_" + callId+ "_" + stream; - List<Object> scanResult = redisUtil.scan(key); + List<Object> scanResult = RedisUtil.scan(key); if (scanResult.size() == 0) { return null; } List<SsrcTransaction> result = new ArrayList<>(); for (Object keyObj : scanResult) { - result.add((SsrcTransaction)redisUtil.get((String) keyObj)); + result.add((SsrcTransaction)RedisUtil.get((String) keyObj)); } return result; } @@ -179,17 +176,17 @@ if (ssrcTransaction == null) { return; } - redisUtil.del(VideoManagerConstants.MEDIA_TRANSACTION_USED_PREFIX + userSetting.getServerId() + "_" + RedisUtil.del(VideoManagerConstants.MEDIA_TRANSACTION_USED_PREFIX + userSetting.getServerId() + "_" + deviceId + "_" + channelId + "_" + ssrcTransaction.getCallId() + "_" + ssrcTransaction.getStream()); } public List<SsrcTransaction> getAllSsrc() { - List<Object> ssrcTransactionKeys = redisUtil.scan(String.format("%s_*_*_*_*", VideoManagerConstants.MEDIA_TRANSACTION_USED_PREFIX+ userSetting.getServerId())); + List<Object> ssrcTransactionKeys = RedisUtil.scan(String.format("%s_*_*_*_*", VideoManagerConstants.MEDIA_TRANSACTION_USED_PREFIX+ userSetting.getServerId())); List<SsrcTransaction> result= new ArrayList<>(); for (int i = 0; i < ssrcTransactionKeys.size(); i++) { String key = (String)ssrcTransactionKeys.get(i); - SsrcTransaction ssrcTransaction = (SsrcTransaction)redisUtil.get(key); + SsrcTransaction ssrcTransaction = (SsrcTransaction)RedisUtil.get(key); result.add(ssrcTransaction); } return result; diff --git a/src/main/java/com/genersoft/iot/vmp/media/zlm/dto/MediaServerItem.java b/src/main/java/com/genersoft/iot/vmp/media/zlm/dto/MediaServerItem.java index 181fc5b..8f5d5af 100644 --- a/src/main/java/com/genersoft/iot/vmp/media/zlm/dto/MediaServerItem.java +++ b/src/main/java/com/genersoft/iot/vmp/media/zlm/dto/MediaServerItem.java @@ -3,64 +3,93 @@ import com.genersoft.iot.vmp.gb28181.session.SsrcConfig; import com.genersoft.iot.vmp.media.zlm.ZLMServerConfig; +import io.swagger.v3.oas.annotations.media.Schema; import org.springframework.util.StringUtils; import java.util.HashMap; +@Schema(description = "娴佸獟浣撴湇鍔′俊鎭�") public class MediaServerItem{ + @Schema(description = "ID") private String id; + @Schema(description = "IP") private String ip; + @Schema(description = "hook浣跨敤鐨処P锛坺lm璁块棶WVP浣跨敤鐨処P锛�") private String hookIp; + @Schema(description = "SDP IP") private String sdpIp; + @Schema(description = "娴両P") private String streamIp; + @Schema(description = "HTTP绔彛") private int httpPort; + @Schema(description = "HTTPS绔彛") private int httpSSlPort; + @Schema(description = "RTMP绔彛") private int rtmpPort; + @Schema(description = "RTMPS绔彛") private int rtmpSSlPort; + @Schema(description = "RTP鏀舵祦绔彛锛堝崟绔彛妯″紡鏈夌敤锛�") private int rtpProxyPort; + @Schema(description = "RTSP绔彛") private int rtspPort; + @Schema(description = "RTSPS绔彛") private int rtspSSLPort; + @Schema(description = "鏄惁寮�鍚嚜鍔ㄩ厤缃甖LM") private boolean autoConfig; + @Schema(description = "ZLM閴存潈鍙傛暟") private String secret; + @Schema(description = "鏌愪釜娴佹棤浜鸿鐪嬫椂锛岃Е鍙慼ook.on_stream_none_reader浜嬩欢鐨勬渶澶х瓑寰呮椂闂达紝鍗曚綅姣") private int streamNoneReaderDelayMS; + @Schema(description = "keepalive hook瑙﹀彂闂撮殧,鍗曚綅绉�") private int hookAliveInterval; + @Schema(description = "鏄惁浣跨敤澶氱鍙fā寮�") private boolean rtpEnable; + @Schema(description = "鐘舵��") private boolean status; + @Schema(description = "澶氱鍙TP鏀舵祦绔彛鑼冨洿") private String rtpPortRange; + @Schema(description = "RTP鍙戞祦绔彛鑼冨洿") private String sendRtpPortRange; + @Schema(description = "assist鏈嶅姟绔彛") private int recordAssistPort; + @Schema(description = "鍒涘缓鏃堕棿") private String createTime; + @Schema(description = "鏇存柊鏃堕棿") private String updateTime; + @Schema(description = "涓婃蹇冭烦鏃堕棿") private String lastKeepaliveTime; + @Schema(description = "鏄惁鏄粯璁LM") private boolean defaultServer; + @Schema(description = "SSRC淇℃伅") private SsrcConfig ssrcConfig; + @Schema(description = "褰撳墠浣跨敤鍒扮殑绔彛") private int currentPort; @@ -68,6 +97,7 @@ * 姣忎竴鍙癦LM閮芥湁涓�濂楃嫭绔嬬殑SSRC鍒楄〃 * 鍦ˋpplicationCheckRunner閲屽mediaServerSsrcMap杩涜鍒濆鍖� */ + @Schema(description = "ID") private HashMap<String, SsrcConfig> mediaServerSsrcMap; public MediaServerItem() { diff --git a/src/main/java/com/genersoft/iot/vmp/media/zlm/dto/StreamProxyItem.java b/src/main/java/com/genersoft/iot/vmp/media/zlm/dto/StreamProxyItem.java index b7a1399..897e9e3 100644 --- a/src/main/java/com/genersoft/iot/vmp/media/zlm/dto/StreamProxyItem.java +++ b/src/main/java/com/genersoft/iot/vmp/media/zlm/dto/StreamProxyItem.java @@ -1,24 +1,45 @@ package com.genersoft.iot.vmp.media.zlm.dto; import com.genersoft.iot.vmp.gb28181.bean.GbStream; +import io.swagger.v3.oas.annotations.media.Schema; +/** + * @author lin + */ +@Schema(description = "鎷夋祦浠g悊鐨勪俊鎭�") public class StreamProxyItem extends GbStream { + @Schema(description = "绫诲瀷") private String type; + @Schema(description = "搴旂敤鍚�") private String app; + @Schema(description = "娴両D") private String stream; + @Schema(description = "娴佸獟浣撴湇鍔D") private String mediaServerId; + @Schema(description = "鎷夋祦鍦板潃") private String url; + @Schema(description = "鎷夋祦鍦板潃") private String src_url; + @Schema(description = "鐩爣鍦板潃") private String dst_url; + @Schema(description = "瓒呮椂鏃堕棿") private int timeout_ms; + @Schema(description = "ffmpeg妯℃澘KEY") private String ffmpeg_cmd_key; + @Schema(description = "rtsp鎷夋祦鏃讹紝鎷夋祦鏂瑰紡锛�0锛歵cp锛�1锛歶dp锛�2锛氱粍鎾�") private String rtp_type; + @Schema(description = "鏄惁鍚敤") private boolean enable; + @Schema(description = "鏄惁鍚敤HLS") private boolean enable_hls; + @Schema(description = "鏄惁鍚敤MP4") private boolean enable_mp4; - private boolean enable_remove_none_reader; // 鏃犱汉瑙傜湅鏃跺垹闄� + @Schema(description = "鏄惁 鏃犱汉瑙傜湅鏃跺垹闄�") + private boolean enable_remove_none_reader; + @Schema(description = "涓婄骇骞冲彴鍥芥爣ID") private String platformGbId; + @Schema(description = "鍒涘缓鏃堕棿") private String createTime; public String getType() { diff --git a/src/main/java/com/genersoft/iot/vmp/media/zlm/dto/StreamPushItem.java b/src/main/java/com/genersoft/iot/vmp/media/zlm/dto/StreamPushItem.java index ff63f6f..1a73a20 100644 --- a/src/main/java/com/genersoft/iot/vmp/media/zlm/dto/StreamPushItem.java +++ b/src/main/java/com/genersoft/iot/vmp/media/zlm/dto/StreamPushItem.java @@ -2,37 +2,43 @@ import com.genersoft.iot.vmp.gb28181.bean.GbStream; import com.genersoft.iot.vmp.utils.DateUtil; +import io.swagger.v3.oas.annotations.media.Schema; import org.jetbrains.annotations.NotNull; import org.springframework.util.unit.DataUnit; import java.util.List; - +@Schema(description = "鎺ㄦ祦淇℃伅") public class StreamPushItem extends GbStream implements Comparable<StreamPushItem>{ /** * id */ + @Schema(description = "id") private Integer id; /** * 搴旂敤鍚� */ + @Schema(description = "搴旂敤鍚�") private String app; /** * 娴乮d */ + @Schema(description = "娴乮d") private String stream; /** * 瑙傜湅鎬讳汉鏁帮紝鍖呮嫭hls/rtsp/rtmp/http-flv/ws-flv */ + @Schema(description = "瑙傜湅鎬讳汉鏁�") private String totalReaderCount; /** * 鍗忚 鍖呮嫭hls/rtsp/rtmp/http-flv/ws-flv */ + @Schema(description = "鍗忚 鍖呮嫭hls/rtsp/rtmp/http-flv/ws-flv") private List<MediaSchema> schemas; /** @@ -46,71 +52,85 @@ * mp4_vod=6, * device_chn=7 */ + @Schema(description = "浜х敓婧愮被鍨�") private int originType; /** * 瀹㈡埛绔拰鏈嶅姟鍣ㄧ綉缁滀俊鎭紝鍙兘涓簄ull绫诲瀷 */ + @Schema(description = "瀹㈡埛绔拰鏈嶅姟鍣ㄧ綉缁滀俊鎭紝鍙兘涓簄ull绫诲瀷") private MediaItem.OriginSock originSock; /** * 浜х敓婧愮被鍨嬬殑瀛楃涓叉弿杩� */ + @Schema(description = "浜х敓婧愮被鍨嬬殑瀛楃涓叉弿杩�") private String originTypeStr; /** * 浜х敓婧愮殑url */ + @Schema(description = "浜х敓婧愮殑url") private String originUrl; /** * 瀛樻椿鏃堕棿锛屽崟浣嶇 */ + @Schema(description = "瀛樻椿鏃堕棿锛屽崟浣嶇") private Long aliveSecond; /** * 闊宠棰戣建閬� */ + @Schema(description = "闊宠棰戣建閬�") private List<MediaItem.MediaTrack> tracks; /** * 闊宠棰戣建閬� */ + @Schema(description = "闊宠棰戣建閬�") private String vhost; /** * 浣跨敤鐨勬祦濯掍綋ID */ + @Schema(description = "浣跨敤鐨勬祦濯掍綋ID") private String mediaServerId; /** * 浣跨敤鐨勬湇鍔D */ + @Schema(description = "浣跨敤鐨勬湇鍔D") private String serverId; /** * 鎺ㄦ祦鏃堕棿 */ + @Schema(description = "鎺ㄦ祦鏃堕棿") private String pushTime; /** * 鏇存柊鏃堕棿 */ + @Schema(description = "鏇存柊鏃堕棿") private String updateTime; /** * 鍒涘缓鏃堕棿 */ + @Schema(description = "鍒涘缓鏃堕棿") private String createTime; /** * 鏄惁姝e湪鎺ㄦ祦 */ + @Schema(description = "鏄惁姝e湪鎺ㄦ祦") private boolean pushIng; /** * 鏄惁鑷繁骞冲彴鐨勬帹娴� */ + @Schema(description = "鏄惁鑷繁骞冲彴鐨勬帹娴�") private boolean self; diff --git a/src/main/java/com/genersoft/iot/vmp/service/impl/MediaServerServiceImpl.java b/src/main/java/com/genersoft/iot/vmp/service/impl/MediaServerServiceImpl.java index df66bba..27de261 100644 --- a/src/main/java/com/genersoft/iot/vmp/service/impl/MediaServerServiceImpl.java +++ b/src/main/java/com/genersoft/iot/vmp/service/impl/MediaServerServiceImpl.java @@ -8,7 +8,6 @@ import java.util.Map; import java.util.Set; -import com.genersoft.iot.vmp.media.zlm.ZLMRunner; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -54,9 +53,6 @@ @Autowired private SipConfig sipConfig; - @Autowired - private ZLMRunner zlmRunner; - @Value("${server.ssl.enabled:false}") private boolean sslEnabled; @@ -84,8 +80,6 @@ @Autowired private ZLMRTPServerFactory zlmrtpServerFactory; - @Autowired - private RedisUtil redisUtil; @Autowired private EventPublisher publisher; @@ -104,12 +98,12 @@ if (mediaServerItem.getSsrcConfig() == null) { SsrcConfig ssrcConfig = new SsrcConfig(mediaServerItem.getId(), null, sipConfig.getDomain()); mediaServerItem.setSsrcConfig(ssrcConfig); - redisUtil.set(VideoManagerConstants.MEDIA_SERVER_PREFIX + userSetting.getServerId() + "_" + mediaServerItem.getId(), mediaServerItem); + RedisUtil.set(VideoManagerConstants.MEDIA_SERVER_PREFIX + userSetting.getServerId() + "_" + mediaServerItem.getId(), mediaServerItem); } // 鏌ヨredis鏄惁瀛樺湪姝ediaServer String key = VideoManagerConstants.MEDIA_SERVER_PREFIX + userSetting.getServerId() + "_" + mediaServerItem.getId(); - if (!redisUtil.hasKey(key)) { - redisUtil.set(key, mediaServerItem); + if (!RedisUtil.hasKey(key)) { + RedisUtil.set(key, mediaServerItem); } } @@ -151,7 +145,7 @@ if (mediaServerItem.isRtpEnable()) { rtpServerPort = zlmrtpServerFactory.createRTPServer(mediaServerItem, streamId, ssrcCheck?Integer.parseInt(ssrc):0, port); } - redisUtil.set(key, mediaServerItem); + RedisUtil.set(key, mediaServerItem); return new SSRCInfo(rtpServerPort, ssrc, streamId); } } @@ -184,7 +178,7 @@ ssrcConfig.releaseSsrc(ssrc); mediaServerItem.setSsrcConfig(ssrcConfig); String key = VideoManagerConstants.MEDIA_SERVER_PREFIX + userSetting.getServerId() + "_" + mediaServerItem.getId(); - redisUtil.set(key, mediaServerItem); + RedisUtil.set(key, mediaServerItem); } /** @@ -193,7 +187,7 @@ @Override public void clearRTPServer(MediaServerItem mediaServerItem) { mediaServerItem.setSsrcConfig(new SsrcConfig(mediaServerItem.getId(), null, sipConfig.getDomain())); - redisUtil.zAdd(VideoManagerConstants.MEDIA_SERVERS_ONLINE_PREFIX + userSetting.getServerId(), mediaServerItem.getId(), 0); + RedisUtil.zAdd(VideoManagerConstants.MEDIA_SERVERS_ONLINE_PREFIX + userSetting.getServerId(), mediaServerItem.getId(), 0); } @@ -215,19 +209,19 @@ ); } String key = VideoManagerConstants.MEDIA_SERVER_PREFIX + userSetting.getServerId() + "_" + mediaServerItemInDataBase.getId(); - redisUtil.set(key, mediaServerItemInDataBase); + RedisUtil.set(key, mediaServerItemInDataBase); } @Override public List<MediaServerItem> getAll() { List<MediaServerItem> result = new ArrayList<>(); - List<Object> mediaServerKeys = redisUtil.scan(String.format("%S*", VideoManagerConstants.MEDIA_SERVER_PREFIX+ userSetting.getServerId() + "_" )); + List<Object> mediaServerKeys = RedisUtil.scan(String.format("%S*", VideoManagerConstants.MEDIA_SERVER_PREFIX+ userSetting.getServerId() + "_" )); String onlineKey = VideoManagerConstants.MEDIA_SERVERS_ONLINE_PREFIX + userSetting.getServerId(); for (Object mediaServerKey : mediaServerKeys) { String key = (String) mediaServerKey; - MediaServerItem mediaServerItem = (MediaServerItem) redisUtil.get(key); + MediaServerItem mediaServerItem = (MediaServerItem) RedisUtil.get(key); // 妫�鏌ョ姸鎬� - Double aDouble = redisUtil.zScore(onlineKey, mediaServerItem.getId()); + Double aDouble = RedisUtil.zScore(onlineKey, mediaServerItem.getId()); if (aDouble != null) { mediaServerItem.setStatus(true); } @@ -253,13 +247,13 @@ @Override public List<MediaServerItem> getAllOnline() { String key = VideoManagerConstants.MEDIA_SERVERS_ONLINE_PREFIX + userSetting.getServerId(); - Set<String> mediaServerIdSet = redisUtil.zRevRange(key, 0, -1); + Set<String> mediaServerIdSet = RedisUtil.zRevRange(key, 0, -1); List<MediaServerItem> result = new ArrayList<>(); if (mediaServerIdSet != null && mediaServerIdSet.size() > 0) { for (String mediaServerId : mediaServerIdSet) { String serverKey = VideoManagerConstants.MEDIA_SERVER_PREFIX + userSetting.getServerId() + "_" + mediaServerId; - result.add((MediaServerItem) redisUtil.get(serverKey)); + result.add((MediaServerItem) RedisUtil.get(serverKey)); } } Collections.reverse(result); @@ -277,7 +271,7 @@ return null; } String key = VideoManagerConstants.MEDIA_SERVER_PREFIX + userSetting.getServerId() + "_" + mediaServerId; - return (MediaServerItem)redisUtil.get(key); + return (MediaServerItem)RedisUtil.get(key); } @Override @@ -289,7 +283,7 @@ @Override public void clearMediaServerForOnline() { String key = VideoManagerConstants.MEDIA_SERVERS_ONLINE_PREFIX + userSetting.getServerId(); - redisUtil.del(key); + RedisUtil.del(key); } @Override @@ -397,14 +391,14 @@ } mediaServerMapper.update(serverItem); String key = VideoManagerConstants.MEDIA_SERVER_PREFIX + userSetting.getServerId() + "_" + zlmServerConfig.getGeneralMediaServerId(); - if (redisUtil.get(key) == null) { + if (RedisUtil.get(key) == null) { SsrcConfig ssrcConfig = new SsrcConfig(zlmServerConfig.getGeneralMediaServerId(), null, sipConfig.getDomain()); serverItem.setSsrcConfig(ssrcConfig); }else { - MediaServerItem mediaServerItemInRedis = (MediaServerItem)redisUtil.get(key); + MediaServerItem mediaServerItemInRedis = (MediaServerItem)RedisUtil.get(key); serverItem.setSsrcConfig(mediaServerItemInRedis.getSsrcConfig()); } - redisUtil.set(key, serverItem); + RedisUtil.set(key, serverItem); resetOnlineServerItem(serverItem); if (serverItem.isAutoConfig()) { setZLMConfig(serverItem, "0".equals(zlmServerConfig.getHookEnable())); @@ -425,15 +419,15 @@ // 鏇存柊缂撳瓨 String key = VideoManagerConstants.MEDIA_SERVERS_ONLINE_PREFIX + userSetting.getServerId(); // 浣跨敤zset鐨勫垎鏁颁綔涓哄綋鍓嶅苟鍙戦噺锛� 榛樿鍊艰缃负0 - if (redisUtil.zScore(key, serverItem.getId()) == null) { // 涓嶅瓨鍦ㄥ垯璁剧疆榛樿鍊� 宸插瓨鍦ㄥ垯閲嶇疆 - redisUtil.zAdd(key, serverItem.getId(), 0L); + if (RedisUtil.zScore(key, serverItem.getId()) == null) { // 涓嶅瓨鍦ㄥ垯璁剧疆榛樿鍊� 宸插瓨鍦ㄥ垯閲嶇疆 + RedisUtil.zAdd(key, serverItem.getId(), 0L); // 鏌ヨ鏈嶅姟娴佹暟閲� zlmresTfulUtils.getMediaList(serverItem, null, null, "rtmp",(mediaList ->{ Integer code = mediaList.getInteger("code"); if (code == 0) { JSONArray data = mediaList.getJSONArray("data"); if (data != null) { - redisUtil.zAdd(key, serverItem.getId(), data.size()); + RedisUtil.zAdd(key, serverItem.getId(), data.size()); } } })); @@ -450,14 +444,14 @@ return; } String key = VideoManagerConstants.MEDIA_SERVERS_ONLINE_PREFIX + userSetting.getServerId(); - redisUtil.zIncrScore(key, mediaServerId, 1); + RedisUtil.zIncrScore(key, mediaServerId, 1); } @Override public void removeCount(String mediaServerId) { String key = VideoManagerConstants.MEDIA_SERVERS_ONLINE_PREFIX + userSetting.getServerId(); - redisUtil.zIncrScore(key, mediaServerId, - 1); + RedisUtil.zIncrScore(key, mediaServerId, - 1); } /** @@ -468,15 +462,15 @@ public MediaServerItem getMediaServerForMinimumLoad() { String key = VideoManagerConstants.MEDIA_SERVERS_ONLINE_PREFIX + userSetting.getServerId(); - if (redisUtil.zSize(key) == null || redisUtil.zSize(key) == 0) { - if (redisUtil.zSize(key) == null || redisUtil.zSize(key) == 0) { + if (RedisUtil.zSize(key) == null || RedisUtil.zSize(key) == 0) { + if (RedisUtil.zSize(key) == null || RedisUtil.zSize(key) == 0) { logger.info("鑾峰彇璐熻浇鏈�浣庣殑鑺傜偣鏃舵棤鍦ㄧ嚎鑺傜偣"); return null; } } // 鑾峰彇鍒嗘暟鏈�浣庣殑锛屽強骞跺彂鏈�浣庣殑 - Set<Object> objects = redisUtil.ZRange(key, 0, -1); + Set<Object> objects = RedisUtil.ZRange(key, 0, -1); ArrayList<Object> mediaServerObjectS = new ArrayList<>(objects); String mediaServerId = (String)mediaServerObjectS.get(0); @@ -619,9 +613,9 @@ @Override public void delete(String id) { - redisUtil.zRemove(VideoManagerConstants.MEDIA_SERVERS_ONLINE_PREFIX + userSetting.getServerId(), id); + RedisUtil.zRemove(VideoManagerConstants.MEDIA_SERVERS_ONLINE_PREFIX + userSetting.getServerId(), id); String key = VideoManagerConstants.MEDIA_SERVER_PREFIX + userSetting.getServerId() + "_" + id; - redisUtil.del(key); + RedisUtil.del(key); } @Override public void deleteDb(String id){ @@ -640,7 +634,7 @@ } // zlm杩炴帴閲嶈瘯 logger.warn("[鏇存柊ZLM 淇濇椿淇℃伅]澶辫触锛屾湭鎵惧埌娴佸獟浣撲俊鎭�,灏濊瘯閲嶈繛zlm"); - reloadZlm(); +// reloadZlm(); mediaServerItem = getOne(mediaServerId); if (mediaServerItem == null) { // zlm杩炴帴閲嶈瘯 @@ -650,7 +644,7 @@ } String key = VideoManagerConstants.MEDIA_SERVER_KEEPALIVE_PREFIX + userSetting.getServerId() + "_" + mediaServerId; int hookAliveInterval = mediaServerItem.getHookAliveInterval() + 2; - redisUtil.set(key, data, hookAliveInterval); + RedisUtil.set(key, data, hookAliveInterval); } private MediaServerItem getOneFromDatabase(String mediaServerId) { @@ -670,15 +664,6 @@ if (!mediaServerItemMap.containsKey(mediaServerItem.getId())) { delete(mediaServerItem.getId()); } - } - } - - public void reloadZlm(){ - try { - zlmRunner.run(); - Thread.sleep(500);//寤惰繜0.5绉掔紦鍐叉椂闂� - } catch (Exception e) { - logger.warn("灏濊瘯閲嶈繛zlm澶辫触锛�",e); } } } diff --git a/src/main/java/com/genersoft/iot/vmp/service/impl/RedisGbPlayMsgListener.java b/src/main/java/com/genersoft/iot/vmp/service/impl/RedisGbPlayMsgListener.java index a4fa635..0f5f57c 100644 --- a/src/main/java/com/genersoft/iot/vmp/service/impl/RedisGbPlayMsgListener.java +++ b/src/main/java/com/genersoft/iot/vmp/service/impl/RedisGbPlayMsgListener.java @@ -66,8 +66,6 @@ @Autowired private UserSetting userSetting; - @Autowired - private RedisUtil redis; @Autowired private ZLMMediaListManager zlmMediaListManager; @@ -227,7 +225,7 @@ WvpRedisMsg response = WvpRedisMsg.getResponseInstance(userSetting.getServerId(), toId, WvpRedisMsgCmd.REQUEST_PUSH_STREAM, serial, result); JSONObject jsonObject = (JSONObject)JSON.toJSON(response); - redis.convertAndSend(WVP_PUSH_STREAM_KEY, jsonObject); + RedisUtil.convertAndSend(WVP_PUSH_STREAM_KEY, jsonObject); } /** @@ -246,7 +244,7 @@ WvpRedisMsgCmd.GET_SEND_ITEM, serial, result); JSONObject jsonObject = (JSONObject)JSON.toJSON(response); - redis.convertAndSend(WVP_PUSH_STREAM_KEY, jsonObject); + RedisUtil.convertAndSend(WVP_PUSH_STREAM_KEY, jsonObject); return; } // 纭畾娴佹槸鍚﹀湪绾� @@ -269,7 +267,7 @@ userSetting.getServerId(), toId, WvpRedisMsgCmd.GET_SEND_ITEM, serial, result ); JSONObject jsonObject = (JSONObject)JSON.toJSON(response); - redis.convertAndSend(WVP_PUSH_STREAM_KEY, jsonObject); + RedisUtil.convertAndSend(WVP_PUSH_STREAM_KEY, jsonObject); }, userSetting.getPlatformPlayTimeout()); // 娣诲姞璁㈤槄 @@ -308,7 +306,7 @@ userSetting.getServerId(), toId, WvpRedisMsgCmd.GET_SEND_ITEM, serial, result ); JSONObject jsonObject = (JSONObject)JSON.toJSON(response); - redis.convertAndSend(WVP_PUSH_STREAM_KEY, jsonObject); + RedisUtil.convertAndSend(WVP_PUSH_STREAM_KEY, jsonObject); } /** @@ -345,7 +343,7 @@ wvpResult.setMsg("timeout"); errorCallback.handler(wvpResult); }, userSetting.getPlatformPlayTimeout()); - redis.convertAndSend(WVP_PUSH_STREAM_KEY, jsonObject); + RedisUtil.convertAndSend(WVP_PUSH_STREAM_KEY, jsonObject); } /** @@ -370,6 +368,6 @@ callbacksForStartSendRtpStream.remove(key); callbacksForError.remove(key); }); - redis.convertAndSend(WVP_PUSH_STREAM_KEY, jsonObject); + RedisUtil.convertAndSend(WVP_PUSH_STREAM_KEY, jsonObject); } } diff --git a/src/main/java/com/genersoft/iot/vmp/service/impl/RedisStreamMsgListener.java b/src/main/java/com/genersoft/iot/vmp/service/impl/RedisStreamMsgListener.java index fe024c0..118a227 100644 --- a/src/main/java/com/genersoft/iot/vmp/service/impl/RedisStreamMsgListener.java +++ b/src/main/java/com/genersoft/iot/vmp/service/impl/RedisStreamMsgListener.java @@ -27,15 +27,6 @@ private final static Logger logger = LoggerFactory.getLogger(RedisStreamMsgListener.class); @Autowired - private ISIPCommander commander; - - @Autowired - private ISIPCommanderForPlatform commanderForPlatform; - - @Autowired - private IVideoManagerStorage storage; - - @Autowired private UserSetting userSetting; @Autowired diff --git a/src/main/java/com/genersoft/iot/vmp/storager/impl/RedisCatchStorageImpl.java b/src/main/java/com/genersoft/iot/vmp/storager/impl/RedisCatchStorageImpl.java index 81920b8..ff31c11 100644 --- a/src/main/java/com/genersoft/iot/vmp/storager/impl/RedisCatchStorageImpl.java +++ b/src/main/java/com/genersoft/iot/vmp/storager/impl/RedisCatchStorageImpl.java @@ -22,7 +22,6 @@ import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; -import org.springframework.util.StringUtils; import java.util.*; @@ -31,9 +30,6 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { private final Logger logger = LoggerFactory.getLogger(RedisCatchStorageImpl.class); - - @Autowired - private RedisUtil redis; @Autowired private DeviceChannelMapper deviceChannelMapper; @@ -45,9 +41,9 @@ public Long getCSEQ() { String key = VideoManagerConstants.SIP_CSEQ_PREFIX + userSetting.getServerId(); - long result = redis.incr(key, 1L); + long result = RedisUtil.incr(key, 1L); if (result > Integer.MAX_VALUE) { - redis.set(key, 1); + RedisUtil.set(key, 1); result = 1; } return result; @@ -57,9 +53,9 @@ public Long getSN(String method) { String key = VideoManagerConstants.SIP_SN_PREFIX + userSetting.getServerId() + "_" + method; - long result = redis.incr(key, 1L); + long result = RedisUtil.incr(key, 1L); if (result > Integer.MAX_VALUE) { - redis.set(key, 1); + RedisUtil.set(key, 1); result = 1; } return result; @@ -68,20 +64,20 @@ @Override public void resetAllCSEQ() { String scanKey = VideoManagerConstants.SIP_CSEQ_PREFIX + userSetting.getServerId() + "_*"; - List<Object> keys = redis.scan(scanKey); + List<Object> keys = RedisUtil.scan(scanKey); for (Object o : keys) { String key = (String) o; - redis.set(key, 1); + RedisUtil.set(key, 1); } } @Override public void resetAllSN() { String scanKey = VideoManagerConstants.SIP_SN_PREFIX + userSetting.getServerId() + "_*"; - List<Object> keys = redis.scan(scanKey); + List<Object> keys = RedisUtil.scan(scanKey); for (Object o : keys) { String key = (String) o; - redis.set(key, 1); + RedisUtil.set(key, 1); } } @@ -92,7 +88,7 @@ */ @Override public boolean startPlay(StreamInfo stream) { - return redis.set(String.format("%S_%S_%s_%s_%s", VideoManagerConstants.PLAYER_PREFIX, userSetting.getServerId(), + return RedisUtil.set(String.format("%S_%S_%s_%s_%s", VideoManagerConstants.PLAYER_PREFIX, userSetting.getServerId(), stream.getStream(), stream.getDeviceID(), stream.getChannelId()), stream); } @@ -107,7 +103,7 @@ if (streamInfo == null) { return false; } - return redis.del(String.format("%S_%s_%s_%s_%s", VideoManagerConstants.PLAYER_PREFIX, + return RedisUtil.del(String.format("%S_%s_%s_%s_%s", VideoManagerConstants.PLAYER_PREFIX, userSetting.getServerId(), streamInfo.getStream(), streamInfo.getDeviceID(), @@ -120,7 +116,7 @@ */ @Override public StreamInfo queryPlay(StreamInfo streamInfo) { - return (StreamInfo)redis.get(String.format("%S_%s_%s_%s_%s", + return (StreamInfo)RedisUtil.get(String.format("%S_%s_%s_%s_%s", VideoManagerConstants.PLAYER_PREFIX, userSetting.getServerId(), streamInfo.getStream(), @@ -129,36 +125,36 @@ } @Override public StreamInfo queryPlayByStreamId(String streamId) { - List<Object> playLeys = redis.scan(String.format("%S_%s_%s_*", VideoManagerConstants.PLAYER_PREFIX, userSetting.getServerId(), streamId)); + List<Object> playLeys = RedisUtil.scan(String.format("%S_%s_%s_*", VideoManagerConstants.PLAYER_PREFIX, userSetting.getServerId(), streamId)); if (playLeys == null || playLeys.size() == 0) { return null; } - return (StreamInfo)redis.get(playLeys.get(0).toString()); + return (StreamInfo)RedisUtil.get(playLeys.get(0).toString()); } @Override public StreamInfo queryPlayByDevice(String deviceId, String channelId) { - List<Object> playLeys = redis.scan(String.format("%S_%s_*_%s_%s", VideoManagerConstants.PLAYER_PREFIX, + List<Object> playLeys = RedisUtil.scan(String.format("%S_%s_*_%s_%s", VideoManagerConstants.PLAYER_PREFIX, userSetting.getServerId(), deviceId, channelId)); if (playLeys == null || playLeys.size() == 0) { return null; } - return (StreamInfo)redis.get(playLeys.get(0).toString()); + return (StreamInfo)RedisUtil.get(playLeys.get(0).toString()); } @Override public Map<String, StreamInfo> queryPlayByDeviceId(String deviceId) { Map<String, StreamInfo> streamInfos = new HashMap<>(); -// List<Object> playLeys = redis.keys(String.format("%S_*_%S_*", VideoManagerConstants.PLAYER_PREFIX, deviceId)); - List<Object> players = redis.scan(String.format("%S_%s_*_%S_*", VideoManagerConstants.PLAYER_PREFIX, userSetting.getServerId(),deviceId)); +// List<Object> playLeys = RedisUtil.keys(String.format("%S_*_%S_*", VideoManagerConstants.PLAYER_PREFIX, deviceId)); + List<Object> players = RedisUtil.scan(String.format("%S_%s_*_%S_*", VideoManagerConstants.PLAYER_PREFIX, userSetting.getServerId(),deviceId)); if (players.size() == 0) { return streamInfos; } for (Object player : players) { String key = (String) player; - StreamInfo streamInfo = (StreamInfo) redis.get(key); + StreamInfo streamInfo = (StreamInfo) RedisUtil.get(key); streamInfos.put(streamInfo.getDeviceID() + "_" + streamInfo.getChannelId(), streamInfo); } return streamInfos; @@ -167,7 +163,7 @@ @Override public boolean startPlayback(StreamInfo stream, String callId) { - return redis.set(String.format("%S_%s_%s_%s_%s_%s", VideoManagerConstants.PLAY_BLACK_PREFIX, + return RedisUtil.set(String.format("%S_%s_%s_%s_%s_%s", VideoManagerConstants.PLAY_BLACK_PREFIX, userSetting.getServerId(), stream.getDeviceID(), stream.getChannelId(), stream.getStream(), callId), stream); } @@ -175,10 +171,10 @@ public boolean startDownload(StreamInfo stream, String callId) { boolean result; if (stream.getProgress() == 1) { - result = redis.set(String.format("%S_%s_%s_%s_%s_%s", VideoManagerConstants.DOWNLOAD_PREFIX, + result = RedisUtil.set(String.format("%S_%s_%s_%s_%s_%s", VideoManagerConstants.DOWNLOAD_PREFIX, userSetting.getServerId(), stream.getDeviceID(), stream.getChannelId(), stream.getStream(), callId), stream); }else { - result = redis.set(String.format("%S_%s_%s_%s_%s_%s", VideoManagerConstants.DOWNLOAD_PREFIX, + result = RedisUtil.set(String.format("%S_%s_%s_%s_%s_%s", VideoManagerConstants.DOWNLOAD_PREFIX, userSetting.getServerId(), stream.getDeviceID(), stream.getChannelId(), stream.getStream(), callId), stream, 60*60); } return result; @@ -210,10 +206,10 @@ stream, callId ); - List<Object> scan = redis.scan(key); + List<Object> scan = RedisUtil.scan(key); if (scan.size() > 0) { for (Object keyObj : scan) { - redis.del((String) keyObj); + RedisUtil.del((String) keyObj); } } return true; @@ -246,10 +242,10 @@ stream, callId ); - List<Object> scan = redis.scan(key); + List<Object> scan = RedisUtil.scan(key); if (scan.size() > 0) { for (Object keyObj : scan) { - redis.del((String) keyObj); + RedisUtil.del((String) keyObj); } } return true; @@ -279,9 +275,9 @@ stream, callId ); - List<Object> streamInfoScan = redis.scan(key); + List<Object> streamInfoScan = RedisUtil.scan(key); if (streamInfoScan.size() > 0) { - return (StreamInfo) redis.get((String) streamInfoScan.get(0)); + return (StreamInfo) RedisUtil.get((String) streamInfoScan.get(0)); }else { return null; } @@ -290,64 +286,64 @@ @Override public void updatePlatformCatchInfo(ParentPlatformCatch parentPlatformCatch) { String key = VideoManagerConstants.PLATFORM_CATCH_PREFIX + userSetting.getServerId() + "_" + parentPlatformCatch.getId(); - redis.set(key, parentPlatformCatch); + RedisUtil.set(key, parentPlatformCatch); } @Override public void updatePlatformKeepalive(ParentPlatform parentPlatform) { String key = VideoManagerConstants.PLATFORM_KEEPALIVE_PREFIX + userSetting.getServerId() + "_" + parentPlatform.getServerGBId(); - redis.set(key, "", Integer.parseInt(parentPlatform.getKeepTimeout())); + RedisUtil.set(key, "", Integer.parseInt(parentPlatform.getKeepTimeout())); } @Override public void updatePlatformRegister(ParentPlatform parentPlatform) { String key = VideoManagerConstants.PLATFORM_REGISTER_PREFIX + userSetting.getServerId() + "_" + parentPlatform.getServerGBId(); - redis.set(key, "", Integer.parseInt(parentPlatform.getExpires())); + RedisUtil.set(key, "", Integer.parseInt(parentPlatform.getExpires())); } @Override public ParentPlatformCatch queryPlatformCatchInfo(String platformGbId) { - return (ParentPlatformCatch)redis.get(VideoManagerConstants.PLATFORM_CATCH_PREFIX + userSetting.getServerId() + "_" + platformGbId); + return (ParentPlatformCatch)RedisUtil.get(VideoManagerConstants.PLATFORM_CATCH_PREFIX + userSetting.getServerId() + "_" + platformGbId); } @Override public void delPlatformCatchInfo(String platformGbId) { - redis.del(VideoManagerConstants.PLATFORM_CATCH_PREFIX + userSetting.getServerId() + "_" + platformGbId); + RedisUtil.del(VideoManagerConstants.PLATFORM_CATCH_PREFIX + userSetting.getServerId() + "_" + platformGbId); } @Override public void delPlatformKeepalive(String platformGbId) { - redis.del(VideoManagerConstants.PLATFORM_KEEPALIVE_PREFIX + userSetting.getServerId() + "_" + platformGbId); + RedisUtil.del(VideoManagerConstants.PLATFORM_KEEPALIVE_PREFIX + userSetting.getServerId() + "_" + platformGbId); } @Override public void delPlatformRegister(String platformGbId) { - redis.del(VideoManagerConstants.PLATFORM_REGISTER_PREFIX + userSetting.getServerId() + "_" + platformGbId); + RedisUtil.del(VideoManagerConstants.PLATFORM_REGISTER_PREFIX + userSetting.getServerId() + "_" + platformGbId); } @Override public void updatePlatformRegisterInfo(String callId, String platformGbId) { String key = VideoManagerConstants.PLATFORM_REGISTER_INFO_PREFIX + userSetting.getServerId() + "_" + callId; - redis.set(key, platformGbId, 30); + RedisUtil.set(key, platformGbId, 30); } @Override public String queryPlatformRegisterInfo(String callId) { - return (String)redis.get(VideoManagerConstants.PLATFORM_REGISTER_INFO_PREFIX + userSetting.getServerId() + "_" + callId); + return (String)RedisUtil.get(VideoManagerConstants.PLATFORM_REGISTER_INFO_PREFIX + userSetting.getServerId() + "_" + callId); } @Override public void delPlatformRegisterInfo(String callId) { - redis.del(VideoManagerConstants.PLATFORM_REGISTER_INFO_PREFIX + userSetting.getServerId() + "_" + callId); + RedisUtil.del(VideoManagerConstants.PLATFORM_REGISTER_INFO_PREFIX + userSetting.getServerId() + "_" + callId); } @Override public void cleanPlatformRegisterInfos() { - List regInfos = redis.scan(VideoManagerConstants.PLATFORM_REGISTER_INFO_PREFIX + userSetting.getServerId() + "_" + "*"); + List regInfos = RedisUtil.scan(VideoManagerConstants.PLATFORM_REGISTER_INFO_PREFIX + userSetting.getServerId() + "_" + "*"); for (Object key : regInfos) { - redis.del(key.toString()); + RedisUtil.del(key.toString()); } } @@ -356,7 +352,7 @@ String key = VideoManagerConstants.PLATFORM_SEND_RTP_INFO_PREFIX + userSetting.getServerId() + "_" + sendRtpItem.getPlatformId() + "_" + sendRtpItem.getChannelId() + "_" + sendRtpItem.getStreamId() + "_" + sendRtpItem.getCallId(); - redis.set(key, sendRtpItem); + RedisUtil.set(key, sendRtpItem); } @Override @@ -375,9 +371,9 @@ } String key = VideoManagerConstants.PLATFORM_SEND_RTP_INFO_PREFIX + userSetting.getServerId() + "_" + platformGbId + "_" + channelId + "_" + streamId + "_" + callId; - List<Object> scan = redis.scan(key); + List<Object> scan = RedisUtil.scan(key); if (scan.size() > 0) { - return (SendRtpItem)redis.get((String)scan.get(0)); + return (SendRtpItem)RedisUtil.get((String)scan.get(0)); }else { return null; } @@ -389,12 +385,12 @@ platformGbId = "*"; } String key = VideoManagerConstants.PLATFORM_SEND_RTP_INFO_PREFIX + userSetting.getServerId() + "_" + platformGbId + "_*" + "_*" + "_*"; - List<Object> queryResult = redis.scan(key); + List<Object> queryResult = RedisUtil.scan(key); List<SendRtpItem> result= new ArrayList<>(); for (Object o : queryResult) { String keyItem = (String) o; - result.add((SendRtpItem) redis.get(keyItem)); + result.add((SendRtpItem) RedisUtil.get(keyItem)); } return result; @@ -415,10 +411,10 @@ } String key = VideoManagerConstants.PLATFORM_SEND_RTP_INFO_PREFIX + userSetting.getServerId() + "_" + platformGbId + "_" + channelId + "_" + streamId + "_" + callId; - List<Object> scan = redis.scan(key); + List<Object> scan = RedisUtil.scan(key); if (scan.size() > 0) { for (Object keyStr : scan) { - redis.del((String)keyStr); + RedisUtil.del((String)keyStr); } } } @@ -432,7 +428,7 @@ @Override public boolean isChannelSendingRTP(String channelId) { String key = VideoManagerConstants.PLATFORM_SEND_RTP_INFO_PREFIX + userSetting.getServerId() + "_" + "*_" + channelId + "*_" + "*_"; - List<Object> RtpStreams = redis.scan(key); + List<Object> RtpStreams = RedisUtil.scan(key); if (RtpStreams.size() > 0) { return true; } else { @@ -442,30 +438,30 @@ @Override public void clearCatchByDeviceId(String deviceId) { - List<Object> playLeys = redis.scan(String.format("%S_%s_*_%s_*", VideoManagerConstants.PLAYER_PREFIX, + List<Object> playLeys = RedisUtil.scan(String.format("%S_%s_*_%s_*", VideoManagerConstants.PLAYER_PREFIX, userSetting.getServerId(), deviceId)); if (playLeys.size() > 0) { for (Object key : playLeys) { - redis.del(key.toString()); + RedisUtil.del(key.toString()); } } - List<Object> playBackers = redis.scan(String.format("%S_%s_%s_*_*_*", VideoManagerConstants.PLAY_BLACK_PREFIX, + List<Object> playBackers = RedisUtil.scan(String.format("%S_%s_%s_*_*_*", VideoManagerConstants.PLAY_BLACK_PREFIX, userSetting.getServerId(), deviceId)); if (playBackers.size() > 0) { for (Object key : playBackers) { - redis.del(key.toString()); + RedisUtil.del(key.toString()); } } - List<Object> deviceCache = redis.scan(String.format("%S%s_%s", VideoManagerConstants.DEVICE_PREFIX, + List<Object> deviceCache = RedisUtil.scan(String.format("%S%s_%s", VideoManagerConstants.DEVICE_PREFIX, userSetting.getServerId(), deviceId)); if (deviceCache.size() > 0) { for (Object key : deviceCache) { - redis.del(key.toString()); + RedisUtil.del(key.toString()); } } } @@ -473,14 +469,14 @@ @Override public void updateWVPInfo(JSONObject jsonObject, int time) { String key = VideoManagerConstants.WVP_SERVER_PREFIX + userSetting.getServerId(); - redis.set(key, jsonObject, time); + RedisUtil.set(key, jsonObject, time); } @Override public void sendStreamChangeMsg(String type, JSONObject jsonObject) { String key = VideoManagerConstants.WVP_MSG_STREAM_CHANGE_PREFIX + type; logger.info("[redis 娴佸彉鍖栦簨浠禲 {}: {}", key, jsonObject.toString()); - redis.convertAndSend(key, jsonObject); + RedisUtil.convertAndSend(key, jsonObject); } @Override @@ -491,13 +487,13 @@ if (streamAuthorityInfo != null) { mediaItem.setCallId(streamAuthorityInfo.getCallId()); } - redis.set(key, mediaItem); + RedisUtil.set(key, mediaItem); } @Override public void removeStream(String mediaServerId, String type, String app, String streamId) { String key = VideoManagerConstants.WVP_SERVER_STREAM_PREFIX + userSetting.getServerId() + "_" + type + "_" + app + "_" + streamId + "_" + mediaServerId; - redis.del(key); + RedisUtil.del(key); } @Override @@ -524,9 +520,9 @@ stream, callId ); - List<Object> streamInfoScan = redis.scan(key); + List<Object> streamInfoScan = RedisUtil.scan(key); if (streamInfoScan.size() > 0) { - return (StreamInfo) redis.get((String) streamInfoScan.get(0)); + return (StreamInfo) RedisUtil.get((String) streamInfoScan.get(0)); }else { return null; } @@ -535,16 +531,16 @@ @Override public ThirdPartyGB queryMemberNoGBId(String queryKey) { String key = VideoManagerConstants.WVP_STREAM_GB_ID_PREFIX + queryKey; - JSONObject jsonObject = (JSONObject)redis.get(key); + JSONObject jsonObject = (JSONObject)RedisUtil.get(key); return JSONObject.toJavaObject(jsonObject, ThirdPartyGB.class); } @Override public void removeStream(String mediaServerId, String type) { String key = VideoManagerConstants.WVP_SERVER_STREAM_PREFIX + userSetting.getServerId() + "_" + type + "_*_*_" + mediaServerId; - List<Object> streams = redis.scan(key); + List<Object> streams = RedisUtil.scan(key); for (Object stream : streams) { - redis.del((String) stream); + RedisUtil.del((String) stream); } } @@ -552,9 +548,9 @@ public List<MediaItem> getStreams(String mediaServerId, String type) { List<MediaItem> result = new ArrayList<>(); String key = VideoManagerConstants.WVP_SERVER_STREAM_PREFIX + userSetting.getServerId() + "_" + type + "_*_*_" + mediaServerId; - List<Object> streams = redis.scan(key); + List<Object> streams = RedisUtil.scan(key); for (Object stream : streams) { - MediaItem mediaItem = (MediaItem)redis.get((String) stream); + MediaItem mediaItem = (MediaItem)RedisUtil.get((String) stream); result.add(mediaItem); } return result; @@ -563,43 +559,43 @@ @Override public void updateDevice(Device device) { String key = VideoManagerConstants.DEVICE_PREFIX + userSetting.getServerId() + "_" + device.getDeviceId(); - redis.set(key, device); + RedisUtil.set(key, device); } @Override public void removeDevice(String deviceId) { String key = VideoManagerConstants.DEVICE_PREFIX + userSetting.getServerId() + "_" + deviceId; - redis.del(key); + RedisUtil.del(key); } @Override public Device getDevice(String deviceId) { String key = VideoManagerConstants.DEVICE_PREFIX + userSetting.getServerId() + "_" + deviceId; - return (Device)redis.get(key); + return (Device)RedisUtil.get(key); } @Override public void updateGpsMsgInfo(GPSMsgInfo gpsMsgInfo) { String key = VideoManagerConstants.WVP_STREAM_GPS_MSG_PREFIX + userSetting.getServerId() + "_" + gpsMsgInfo.getId(); - redis.set(key, gpsMsgInfo, 60); // 榛樿GPS娑堟伅淇濆瓨1鍒嗛挓 + RedisUtil.set(key, gpsMsgInfo, 60); // 榛樿GPS娑堟伅淇濆瓨1鍒嗛挓 } @Override public GPSMsgInfo getGpsMsgInfo(String gbId) { String key = VideoManagerConstants.WVP_STREAM_GPS_MSG_PREFIX + userSetting.getServerId() + "_" + gbId; - return (GPSMsgInfo)redis.get(key); + return (GPSMsgInfo)RedisUtil.get(key); } @Override public List<GPSMsgInfo> getAllGpsMsgInfo() { String scanKey = VideoManagerConstants.WVP_STREAM_GPS_MSG_PREFIX + userSetting.getServerId() + "_*"; List<GPSMsgInfo> result = new ArrayList<>(); - List<Object> keys = redis.scan(scanKey); + List<Object> keys = RedisUtil.scan(scanKey); for (Object o : keys) { String key = (String) o; - GPSMsgInfo gpsMsgInfo = (GPSMsgInfo) redis.get(key); + GPSMsgInfo gpsMsgInfo = (GPSMsgInfo) RedisUtil.get(key); if (!gpsMsgInfo.isStored()) { // 鍙彇娌℃湁瀛樿繃寰� - result.add((GPSMsgInfo) redis.get(key)); + result.add((GPSMsgInfo) RedisUtil.get(key)); } } @@ -609,19 +605,19 @@ @Override public void updateStreamAuthorityInfo(String app, String stream, StreamAuthorityInfo streamAuthorityInfo) { String key = VideoManagerConstants.MEDIA_STREAM_AUTHORITY + userSetting.getServerId() + "_" + app+ "_" + stream; - redis.set(key, streamAuthorityInfo); + RedisUtil.set(key, streamAuthorityInfo); } @Override public void removeStreamAuthorityInfo(String app, String stream) { String key = VideoManagerConstants.MEDIA_STREAM_AUTHORITY + userSetting.getServerId() + "_" + app+ "_" + stream ; - redis.del(key); + RedisUtil.del(key); } @Override public StreamAuthorityInfo getStreamAuthorityInfo(String app, String stream) { String key = VideoManagerConstants.MEDIA_STREAM_AUTHORITY + userSetting.getServerId() + "_" + app+ "_" + stream ; - return (StreamAuthorityInfo) redis.get(key); + return (StreamAuthorityInfo) RedisUtil.get(key); } @@ -631,10 +627,10 @@ String scanKey = VideoManagerConstants.WVP_SERVER_STREAM_PREFIX + userSetting.getServerId() + "_*_" + app + "_" + streamId + "_" + mediaServerId; MediaItem result = null; - List<Object> keys = redis.scan(scanKey); + List<Object> keys = RedisUtil.scan(scanKey); if (keys.size() > 0) { String key = (String) keys.get(0); - result = (MediaItem)redis.get(key); + result = (MediaItem)RedisUtil.get(key); } return result; @@ -646,11 +642,11 @@ SystemInfoDto<Double> systemInfoDto = new SystemInfoDto<>(); systemInfoDto.setTime(DateUtil.getNow()); systemInfoDto.setData(cpuInfo); - redis.lSet(key, systemInfoDto); + RedisUtil.lSet(key, systemInfoDto); // 姣忕涓�涓紝鏈�澶氬彧瀛�30涓� - if (redis.lGetListSize(key) > 30) { - for (int i = 0; i < redis.lGetListSize(key) - 30; i++) { - redis.lLeftPop(key); + if (RedisUtil.lGetListSize(key) > 30) { + for (int i = 0; i < RedisUtil.lGetListSize(key) - 30; i++) { + RedisUtil.lLeftPop(key); } } } @@ -661,11 +657,11 @@ SystemInfoDto<Double> systemInfoDto = new SystemInfoDto<>(); systemInfoDto.setTime(DateUtil.getNow()); systemInfoDto.setData(memInfo); - redis.lSet(key, systemInfoDto); + RedisUtil.lSet(key, systemInfoDto); // 姣忕涓�涓紝鏈�澶氬彧瀛�30涓� - if (redis.lGetListSize(key) > 30) { - for (int i = 0; i < redis.lGetListSize(key) - 30; i++) { - redis.lLeftPop(key); + if (RedisUtil.lGetListSize(key) > 30) { + for (int i = 0; i < RedisUtil.lGetListSize(key) - 30; i++) { + RedisUtil.lLeftPop(key); } } } @@ -676,11 +672,11 @@ SystemInfoDto<Map<String, String>> systemInfoDto = new SystemInfoDto<>(); systemInfoDto.setTime(DateUtil.getNow()); systemInfoDto.setData(networkInterfaces); - redis.lSet(key, systemInfoDto); + RedisUtil.lSet(key, systemInfoDto); // 姣忕涓�涓紝鏈�澶氬彧瀛�30涓� - if (redis.lGetListSize(key) > 30) { - for (int i = 0; i < redis.lGetListSize(key) - 30; i++) { - redis.lLeftPop(key); + if (RedisUtil.lGetListSize(key) > 30) { + for (int i = 0; i < RedisUtil.lGetListSize(key) - 30; i++) { + RedisUtil.lLeftPop(key); } } } @@ -689,21 +685,21 @@ public void sendMobilePositionMsg(JSONObject jsonObject) { String key = VideoManagerConstants.VM_MSG_SUBSCRIBE_MOBILE_POSITION; logger.info("[redis鍙戦�侀�氱煡]绉诲姩浣嶇疆 {}: {}", key, jsonObject.toString()); - redis.convertAndSend(key, jsonObject); + RedisUtil.convertAndSend(key, jsonObject); } @Override public void sendStreamPushRequestedMsg(MessageForPushChannel msg) { String key = VideoManagerConstants.VM_MSG_STREAM_PUSH_REQUESTED; logger.info("[redis鍙戦�侀�氱煡]鎺ㄦ祦琚姹� {}: {}/{}", key, msg.getApp(), msg.getStream()); - redis.convertAndSend(key, (JSONObject)JSON.toJSON(msg)); + RedisUtil.convertAndSend(key, (JSONObject)JSON.toJSON(msg)); } @Override public void sendAlarmMsg(AlarmChannelMessage msg) { String key = VideoManagerConstants.VM_MSG_SUBSCRIBE_ALARM; logger.info("[redis鍙戦�侀�氱煡] 鎶ヨ{}: {}", key, JSON.toJSON(msg)); - redis.convertAndSend(key, (JSONObject)JSON.toJSON(msg)); + RedisUtil.convertAndSend(key, (JSONObject)JSON.toJSON(msg)); } @Override @@ -718,6 +714,6 @@ logger.info("[redis閫氱煡]鑾峰彇鎵�鏈夋帹娴佽澶囩殑鐘舵��"); JSONObject jsonObject = new JSONObject(); jsonObject.put(key, key); - redis.convertAndSend(key, jsonObject); + RedisUtil.convertAndSend(key, jsonObject); } } diff --git a/src/main/java/com/genersoft/iot/vmp/utils/redis/RedisUtil.java b/src/main/java/com/genersoft/iot/vmp/utils/redis/RedisUtil.java index 8ab0672..5ef0b39 100644 --- a/src/main/java/com/genersoft/iot/vmp/utils/redis/RedisUtil.java +++ b/src/main/java/com/genersoft/iot/vmp/utils/redis/RedisUtil.java @@ -4,6 +4,7 @@ import java.util.concurrent.TimeUnit; import com.alibaba.fastjson.JSONObject; +import com.genersoft.iot.vmp.utils.SpringBeanFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.redis.core.*; import org.springframework.stereotype.Component; @@ -14,12 +15,14 @@ * @author: swwheihei * @date: 2020骞�5鏈�6鏃� 涓嬪崍8:27:29 */ -@Component @SuppressWarnings(value = {"rawtypes", "unchecked"}) public class RedisUtil { - @Autowired - private RedisTemplate redisTemplate; + private static RedisTemplate redisTemplate; + + static { + redisTemplate = (RedisTemplate)SpringBeanFactory.getBean("redisTemplate"); + } /** * 鎸囧畾缂撳瓨澶辨晥鏃堕棿 @@ -27,7 +30,7 @@ * @param time 鏃堕棿锛堢锛� * @return true / false */ - public boolean expire(String key, long time) { + public static boolean expire(String key, long time) { try { if (time > 0) { redisTemplate.expire(key, time, TimeUnit.SECONDS); @@ -44,7 +47,7 @@ * @param key 閿� * @return */ - public long getExpire(String key) { + public static long getExpire(String key) { return redisTemplate.getExpire(key, TimeUnit.SECONDS); } @@ -53,7 +56,7 @@ * @param key 閿� * @return true / false */ - public boolean hasKey(String key) { + public static boolean hasKey(String key) { try { return redisTemplate.hasKey(key); } catch (Exception e) { @@ -67,7 +70,7 @@ * @SuppressWarnings("unchecked") 蹇界暐绫诲瀷杞崲璀﹀憡 * @param key 閿紙涓�涓垨鑰呭涓級 */ - public boolean del(String... key) { + public static boolean del(String... key) { try { if (key != null && key.length > 0) { if (key.length == 1) { @@ -91,7 +94,7 @@ * @param key 閿� * @return 鍊� */ - public Object get(String key) { + public static Object get(String key) { return key == null ? null : redisTemplate.opsForValue().get(key); } @@ -101,7 +104,7 @@ * @param value 鍊� * @return true / false */ - public boolean set(String key, Object value) { + public static boolean set(String key, Object value) { try { redisTemplate.opsForValue().set(key, value); return true; @@ -118,7 +121,7 @@ * @param time 鏃堕棿锛堢锛夛紝濡傛灉 time < 0 鍒欒缃棤闄愭椂闂� * @return true / false */ - public boolean set(String key, Object value, long time) { + public static boolean set(String key, Object value, long time) { try { if (time > 0) { redisTemplate.opsForValue().set(key, value, time, TimeUnit.SECONDS); @@ -138,7 +141,7 @@ * @param delta 閫掑澶у皬 * @return */ - public long incr(String key, long delta) { + public static long incr(String key, long delta) { if (delta < 0) { throw new RuntimeException("閫掑鍥犲瓙蹇呴』澶т簬 0"); } @@ -151,7 +154,7 @@ * @param delta 閫掑噺澶у皬 * @return */ - public long decr(String key, long delta) { + public static long decr(String key, long delta) { if (delta < 0) { throw new RuntimeException("閫掑噺鍥犲瓙蹇呴』澶т簬 0"); } @@ -166,7 +169,7 @@ * @param item 椤癸紙no null锛� * @return 鍊� */ - public Object hget(String key, String item) { + public static Object hget(String key, String item) { return redisTemplate.opsForHash().get(key, item); } @@ -175,7 +178,7 @@ * @param key 閿紙no null锛� * @return 瀵瑰簲鐨勫涓敭鍊� */ - public Map<Object, Object> hmget(String key) { + public static Map<Object, Object> hmget(String key) { return redisTemplate.opsForHash().entries(key); } @@ -185,7 +188,7 @@ * @param map 鍊� * @return true / false */ - public boolean hmset(String key, Map<Object, Object> map) { + public static boolean hmset(String key, Map<Object, Object> map) { try { redisTemplate.opsForHash().putAll(key, map); return true; @@ -202,7 +205,7 @@ * @param time 鏃堕棿 * @return true / false */ - public boolean hmset(String key, Map<Object, Object> map, long time) { + public static boolean hmset(String key, Map<Object, Object> map, long time) { try { redisTemplate.opsForHash().putAll(key, map); if (time > 0) { @@ -222,7 +225,7 @@ * @param value 鍊� * @return true / false */ - public boolean hset(String key, String item, Object value) { + public static boolean hset(String key, String item, Object value) { try { redisTemplate.opsForHash().put(key, item, value); return true; @@ -240,7 +243,7 @@ * @param time 鏃堕棿锛堝鏋滃師鏉ョ殑 Hash琛� 璁剧疆浜嗘椂闂达紝杩欓噷浼氳鐩栵級 * @return true / false */ - public boolean hset(String key, String item, Object value, long time) { + public static boolean hset(String key, String item, Object value, long time) { try { redisTemplate.opsForHash().put(key, item, value); if (time > 0) { @@ -258,7 +261,7 @@ * @param key 閿� * @param item 椤癸紙鍙互澶氫釜锛宯o null锛� */ - public void hdel(String key, Object... item) { + public static void hdel(String key, Object... item) { redisTemplate.opsForHash().delete(key, item); } @@ -268,7 +271,7 @@ * @param item 鍊硷紙no null锛� * @return true / false */ - public boolean hHasKey(String key, String item) { + public static boolean hHasKey(String key, String item) { return redisTemplate.opsForHash().hasKey(key, item); } @@ -279,7 +282,7 @@ * @param by 閫掑澶у皬 > 0 * @return */ - public Double hincr(String key, String item, Double by) { + public static Double hincr(String key, String item, Double by) { return redisTemplate.opsForHash().increment(key, item, by); } @@ -290,7 +293,7 @@ * @param by 閫掑噺澶у皬 * @return */ - public Double hdecr(String key, String item, Double by) { + public static Double hdecr(String key, String item, Double by) { return redisTemplate.opsForHash().increment(key, item, -by); } @@ -301,7 +304,7 @@ * @param key 閿� * @return 鍊� */ - public Set<Object> sGet(String key) { + public static Set<Object> sGet(String key) { try { return redisTemplate.opsForSet().members(key); } catch (Exception e) { @@ -316,7 +319,7 @@ * @param value 鍊� * @return true / false */ - public boolean sHasKey(String key, Object value) { + public static boolean sHasKey(String key, Object value) { try { return redisTemplate.opsForSet().isMember(key, value); } catch (Exception e) { @@ -331,7 +334,7 @@ * @param values 鍊硷紙鍙互澶氫釜锛� * @return 鎴愬姛涓暟 */ - public long sSet(String key, Object... values) { + public static long sSet(String key, Object... values) { try { return redisTemplate.opsForSet().add(key, values); } catch (Exception e) { @@ -347,7 +350,7 @@ * @param values 鍊硷紙鍙互澶氫釜锛� * @return 鎴愬姛鏀惧叆涓暟 */ - public long sSet(String key, long time, Object... values) { + public static long sSet(String key, long time, Object... values) { try { long count = redisTemplate.opsForSet().add(key, values); if (time > 0) { @@ -365,7 +368,7 @@ * @param key 閿� * @return 闀垮害 */ - public long sGetSetSize(String key) { + public static long sGetSetSize(String key) { try { return redisTemplate.opsForSet().size(key); } catch (Exception e) { @@ -380,7 +383,7 @@ * @param values 鍊� * @return 鎴愬姛绉婚櫎涓暟 */ - public long setRemove(String key, Object... values) { + public static long setRemove(String key, Object... values) { try { return redisTemplate.opsForSet().remove(key, values); } catch (Exception e) { @@ -397,7 +400,7 @@ * @param value * @param score */ - public void zAdd(Object key, Object value, double score) { + public static void zAdd(Object key, Object value, double score) { redisTemplate.opsForZSet().add(key, value, score); } @@ -407,7 +410,7 @@ * @param key * @param value */ - public void zRemove(Object key, Object value) { + public static void zRemove(Object key, Object value) { redisTemplate.opsForZSet().remove(key, value); } @@ -418,7 +421,7 @@ * @param value * @param delta -1 琛ㄧず鍑� 1 琛ㄧず鍔�1 */ - public Double zIncrScore(Object key, Object value, double delta) { + public static Double zIncrScore(Object key, Object value, double delta) { return redisTemplate.opsForZSet().incrementScore(key, value, delta); } @@ -429,7 +432,7 @@ * @param value * @return */ - public Double zScore(Object key, Object value) { + public static Double zScore(Object key, Object value) { return redisTemplate.opsForZSet().score(key, value); } @@ -440,7 +443,7 @@ * @param value * @return */ - public Long zRank(Object key, Object value) { + public static Long zRank(Object key, Object value) { return redisTemplate.opsForZSet().rank(key, value); } @@ -450,7 +453,7 @@ * @param key * @return */ - public Long zSize(Object key) { + public static Long zSize(Object key) { return redisTemplate.opsForZSet().zCard(key); } @@ -464,7 +467,7 @@ * @param end * @return */ - public Set<Object> ZRange(Object key, int start, int end) { + public static Set<Object> ZRange(Object key, int start, int end) { return redisTemplate.opsForZSet().range(key, start, end); } /** @@ -475,7 +478,7 @@ * @param end * @return */ - public Set<ZSetOperations.TypedTuple<String>> zRangeWithScore(Object key, int start, int end) { + public static Set<ZSetOperations.TypedTuple<String>> zRangeWithScore(Object key, int start, int end) { return redisTemplate.opsForZSet().rangeWithScores(key, start, end); } /** @@ -488,7 +491,7 @@ * @param end * @return */ - public Set<String> zRevRange(Object key, int start, int end) { + public static Set<String> zRevRange(Object key, int start, int end) { return redisTemplate.opsForZSet().reverseRange(key, start, end); } /** @@ -499,7 +502,7 @@ * @param max * @return */ - public Set<String> zSortRange(Object key, int min, int max) { + public static Set<String> zSortRange(Object key, int min, int max) { return redisTemplate.opsForZSet().rangeByScore(key, min, max); } @@ -513,7 +516,7 @@ * @param end 缁撴潫锛�0 鍒� -1 浠h〃鎵�鏈夊�硷級 * @return */ - public List<Object> lGet(String key, long start, long end) { + public static List<Object> lGet(String key, long start, long end) { try { return redisTemplate.opsForList().range(key, start, end); } catch (Exception e) { @@ -527,7 +530,7 @@ * @param key 閿� * @return 闀垮害 */ - public long lGetListSize(String key) { + public static long lGetListSize(String key) { try { return redisTemplate.opsForList().size(key); } catch (Exception e) { @@ -544,7 +547,7 @@ * 褰� index < 0 鏃� {-1:琛ㄥ熬, -2:鍊掓暟绗簩涓厓绱爙 * @return 鍊� */ - public Object lGetIndex(String key, long index) { + public static Object lGetIndex(String key, long index) { try { return redisTemplate.opsForList().index(key, index); } catch (Exception e) { @@ -559,7 +562,7 @@ * @param value 鍊� * @return true / false */ - public boolean lSet(String key, Object value) { + public static boolean lSet(String key, Object value) { try { redisTemplate.opsForList().rightPush(key, value); return true; @@ -576,7 +579,7 @@ * @param time 鏃堕棿 * @return true / false */ - public boolean lSet(String key, Object value, long time) { + public static boolean lSet(String key, Object value, long time) { try { redisTemplate.opsForList().rightPush(key, value); if (time > 0) { @@ -595,7 +598,7 @@ * @param values 鍊� * @return true / false */ - public boolean lSetList(String key, List<Object> values) { + public static boolean lSetList(String key, List<Object> values) { try { redisTemplate.opsForList().rightPushAll(key, values); return true; @@ -612,7 +615,7 @@ * @param time 鏃堕棿 * @return true / false */ - public boolean lSetList(String key, List<Object> values, long time) { + public static boolean lSetList(String key, List<Object> values, long time) { try { redisTemplate.opsForList().rightPushAll(key, values); if (time > 0) { @@ -632,7 +635,7 @@ * @param value 鍊� * @return true / false */ - public boolean lUpdateIndex(String key, long index, Object value) { + public static boolean lUpdateIndex(String key, long index, Object value) { try { redisTemplate.opsForList().set(key, index, value); return true; @@ -651,7 +654,7 @@ * @param value * @return */ - public long lRemove(String key, long count, Object value) { + public static long lRemove(String key, long count, Object value) { try { return redisTemplate.opsForList().remove(key, count, value); } catch (Exception e) { @@ -665,7 +668,7 @@ * @param key 閿� * @return */ - public Object lLeftPop(String key) { + public static Object lLeftPop(String key) { return redisTemplate.opsForList().leftPop(key); } @@ -674,7 +677,7 @@ * @param key 閿� * @return */ - public Object lrightPop(String key) { + public static Object lrightPop(String key) { return redisTemplate.opsForList().rightPop(key); } @@ -683,7 +686,7 @@ * @param key 閿� * @return true / false */ - public List<Object> keys(String key) { + public static List<Object> keys(String key) { try { Set<String> set = redisTemplate.keys(key); return new ArrayList<>(set); @@ -699,7 +702,7 @@ * @param query 鏌ヨ鍙傛暟 * @return */ -// public List<Object> scan(String query) { +// public static List<Object> scan(String query) { // List<Object> result = new ArrayList<>(); // try { // Cursor<Map.Entry<Object,Object>> cursor = redisTemplate.opsForHash().scan("field", @@ -723,33 +726,23 @@ * @param query 鏌ヨ鍙傛暟 * @return */ - public List<Object> scan(String query) { - Set<String> keys = (Set<String>) redisTemplate.execute((RedisCallback<Set<String>>) connection -> { - Set<String> keysTmp = new HashSet<>(); - Cursor<byte[]> cursor = connection.scan(new ScanOptions.ScanOptionsBuilder().match(query).count(1000).build()); - while (cursor.hasNext()) { - keysTmp.add(new String(cursor.next())); + public static List<Object> scan(String query) { + Set<String> resultKeys = (Set<String>) redisTemplate.execute((RedisCallback<Set<String>>) connection -> { + ScanOptions scanOptions = ScanOptions.scanOptions().match("*" + query + "*").count(1000).build(); + Cursor<byte[]> scan = connection.scan(scanOptions); + Set<String> keys = new HashSet<>(); + while (scan.hasNext()) { + byte[] next = scan.next(); + keys.add(new String(next)); } - return keysTmp; + return keys; }); -// Set<String> keys = (Set<String>) redisTemplate.execute(new RedisCallback<Set<String>>(){ -// -// @Override -// public Set<String> doInRedis(RedisConnection connection) throws DataAccessException { -// Set<String> keysTmp = new HashSet<>(); -// Cursor<byte[]> cursor = connection.scan(new ScanOptions.ScanOptionsBuilder().match(query).count(1000).build()); -// while (cursor.hasNext()) { -// keysTmp.add(new String(cursor.next())); -// } -// return keysTmp; -// } -// }); - return new ArrayList<>(keys); + return new ArrayList<>(resultKeys); } // ============================== 娑堟伅鍙戦�佷笌璁㈤槄 ============================== - public void convertAndSend(String channel, JSONObject msg) { + public static void convertAndSend(String channel, JSONObject msg) { // redisTemplate.convertAndSend(channel, msg); redisTemplate.convertAndSend(channel, msg); diff --git a/src/main/java/com/genersoft/iot/vmp/vmanager/bean/BatchGBStreamParam.java b/src/main/java/com/genersoft/iot/vmp/vmanager/bean/BatchGBStreamParam.java index e03461e..0090488 100644 --- a/src/main/java/com/genersoft/iot/vmp/vmanager/bean/BatchGBStreamParam.java +++ b/src/main/java/com/genersoft/iot/vmp/vmanager/bean/BatchGBStreamParam.java @@ -1,10 +1,16 @@ package com.genersoft.iot.vmp.vmanager.bean; import com.genersoft.iot.vmp.gb28181.bean.GbStream; +import io.swagger.v3.oas.annotations.media.Schema; import java.util.List; +/** + * @author lin + */ +@Schema(description = "澶氫釜鎺ㄦ祦淇℃伅") public class BatchGBStreamParam { + @Schema(description = "鎺ㄦ祦淇℃伅鍒楄〃") private List<GbStream> gbStreams; public List<GbStream> getGbStreams() { diff --git a/src/main/java/com/genersoft/iot/vmp/vmanager/bean/WVPResult.java b/src/main/java/com/genersoft/iot/vmp/vmanager/bean/WVPResult.java index db937d6..0a3f58c 100644 --- a/src/main/java/com/genersoft/iot/vmp/vmanager/bean/WVPResult.java +++ b/src/main/java/com/genersoft/iot/vmp/vmanager/bean/WVPResult.java @@ -1,6 +1,9 @@ package com.genersoft.iot.vmp.vmanager.bean; +import io.swagger.v3.oas.annotations.media.Schema; + +@Schema(description = "缁熶竴杩斿洖缁撴灉") public class WVPResult<T> { public WVPResult() { @@ -13,8 +16,11 @@ } + @Schema(description = "閿欒鐮侊紝0涓烘垚鍔�") private int code; + @Schema(description = "鎻忚堪锛岄敊璇椂鎻忚堪閿欒鍘熷洜") private String msg; + @Schema(description = "鏁版嵁") private T data; private static final Integer SUCCESS = 200; diff --git a/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/MobilePosition/MobilePositionController.java b/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/MobilePosition/MobilePositionController.java index e4c24b2..7bd4949 100644 --- a/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/MobilePosition/MobilePositionController.java +++ b/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/MobilePosition/MobilePositionController.java @@ -13,10 +13,9 @@ import com.genersoft.iot.vmp.vmanager.bean.WVPResult; import com.github.pagehelper.util.StringUtil; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiImplicitParams; -import io.swagger.annotations.ApiOperation; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.tags.Tag; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -33,7 +32,7 @@ /** * 浣嶇疆淇℃伅绠$悊 */ -@Api(tags = "浣嶇疆淇℃伅绠$悊") +@Tag(name = "浣嶇疆淇℃伅绠$悊") @CrossOrigin @RestController @RequestMapping("/api/position") @@ -54,27 +53,22 @@ private IDeviceService deviceService; /** - * 鏌ヨ鍘嗗彶杞ㄨ抗 + * 鏌ヨ鍘嗗彶杞ㄨ抗 * @param deviceId 璁惧ID * @param start 寮�濮嬫椂闂� * @param end 缁撴潫鏃堕棿 * @return */ - @ApiOperation("鏌ヨ鍘嗗彶杞ㄨ抗") - @ApiImplicitParams({ - @ApiImplicitParam(name = "deviceId", value = "璁惧ID", required = true, dataTypeClass = String.class), - @ApiImplicitParam(name = "channelId", value = "閫氶亾ID", required = false, dataTypeClass = String.class), - @ApiImplicitParam(name = "start", value = "寮�濮嬫椂闂�", required = false, dataTypeClass = String.class), - @ApiImplicitParam(name = "end", value = "缁撴潫鏃堕棿", required = false, dataTypeClass = String.class), - }) + @Operation(summary = "鏌ヨ鍘嗗彶杞ㄨ抗") + @Parameter(name = "deviceId", description = "璁惧鍥芥爣缂栧彿", required = true) + @Parameter(name = "channelId", description = "閫氶亾鍥芥爣缂栧彿") + @Parameter(name = "start", description = "寮�濮嬫椂闂�") + @Parameter(name = "end", description = "缁撴潫鏃堕棿") @GetMapping("/history/{deviceId}") public ResponseEntity<WVPResult<List<MobilePosition>>> positions(@PathVariable String deviceId, @RequestParam(required = false) String channelId, @RequestParam(required = false) String start, @RequestParam(required = false) String end) { -// if (logger.isDebugEnabled()) { -// logger.debug("鏌ヨ璁惧" + deviceId + "鐨勫巻鍙茶建杩�"); -// } if (StringUtil.isEmpty(start)) { start = null; @@ -94,15 +88,10 @@ * @param deviceId 璁惧ID * @return */ - @ApiOperation("鏌ヨ璁惧鏈�鏂颁綅缃�") - @ApiImplicitParams({ - @ApiImplicitParam(name = "deviceId", value = "璁惧ID", required = true, dataTypeClass = String.class), - }) + @Operation(summary = "鏌ヨ璁惧鏈�鏂颁綅缃�") + @Parameter(name = "deviceId", description = "璁惧鍥芥爣缂栧彿", required = true) @GetMapping("/latest/{deviceId}") public ResponseEntity<MobilePosition> latestPosition(@PathVariable String deviceId) { -// if (logger.isDebugEnabled()) { -// logger.debug("鏌ヨ璁惧" + deviceId + "鐨勬渶鏂颁綅缃�"); -// } MobilePosition result = storager.queryLatestPosition(deviceId); return new ResponseEntity<>(result, HttpStatus.OK); } @@ -112,10 +101,8 @@ * @param deviceId 璁惧ID * @return */ - @ApiOperation("鑾峰彇绉诲姩浣嶇疆淇℃伅") - @ApiImplicitParams({ - @ApiImplicitParam(name = "deviceId", value = "璁惧ID", required = true, dataTypeClass = String.class), - }) + @Operation(summary = "鑾峰彇绉诲姩浣嶇疆淇℃伅") + @Parameter(name = "deviceId", description = "璁惧鍥芥爣缂栧彿", required = true) @GetMapping("/realtime/{deviceId}") public DeferredResult<ResponseEntity<MobilePosition>> realTimePosition(@PathVariable String deviceId) { Device device = storager.queryVideoDevice(deviceId); @@ -149,12 +136,10 @@ * @param interval 涓婃姤鏃堕棿闂撮殧 * @return true = 鍛戒护鍙戦�佹垚鍔� */ - @ApiOperation("璁㈤槄浣嶇疆淇℃伅") - @ApiImplicitParams({ - @ApiImplicitParam(name = "deviceId", value = "璁惧ID", required = true, dataTypeClass = String.class), - @ApiImplicitParam(name = "expires", value = "璁㈤槄瓒呮椂鏃堕棿", dataTypeClass = String.class), - @ApiImplicitParam(name = "interval", value = "涓婃姤鏃堕棿闂撮殧", dataTypeClass = String.class), - }) + @Operation(summary = "璁㈤槄浣嶇疆淇℃伅") + @Parameter(name = "deviceId", description = "璁惧鍥芥爣缂栧彿", required = true) + @Parameter(name = "expires", description = "璁㈤槄瓒呮椂鏃堕棿", required = true) + @Parameter(name = "interval", description = "涓婃姤鏃堕棿闂撮殧", required = true) @GetMapping("/subscribe/{deviceId}") public ResponseEntity<String> positionSubscribe(@PathVariable String deviceId, @RequestParam String expires, diff --git a/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/SseController/SseController.java b/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/SseController/SseController.java index 5f09828..d58d431 100644 --- a/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/SseController/SseController.java +++ b/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/SseController/SseController.java @@ -1,10 +1,8 @@ package com.genersoft.iot.vmp.vmanager.gb28181.SseController; import com.genersoft.iot.vmp.gb28181.event.alarm.AlarmEventListener; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiImplicitParams; -import io.swagger.annotations.ApiOperation; + +import io.swagger.v3.oas.annotations.tags.Tag; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.CrossOrigin; @@ -18,7 +16,7 @@ * @author: lawrencehj * @data: 2021-01-20 */ -@Api(tags = "SSE鎺ㄩ��") +@Tag(name = "SSE鎺ㄩ��") @CrossOrigin @Controller @RequestMapping("/api") @@ -26,10 +24,6 @@ @Autowired AlarmEventListener alarmEventListener; - @ApiOperation("娴忚鍣ㄦ帹閫�") - @ApiImplicitParams({ - @ApiImplicitParam(name = "browserId", value = "娴忚鍣↖D", dataTypeClass = String.class), - }) @GetMapping("/emit") public SseEmitter emit(@RequestParam String browserId) { final SseEmitter sseEmitter = new SseEmitter(0L); diff --git a/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/alarm/AlarmController.java b/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/alarm/AlarmController.java index 509c988..79b7d58 100644 --- a/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/alarm/AlarmController.java +++ b/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/alarm/AlarmController.java @@ -3,32 +3,27 @@ import com.genersoft.iot.vmp.gb28181.bean.Device; import com.genersoft.iot.vmp.gb28181.bean.DeviceAlarm; import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform; -import com.genersoft.iot.vmp.gb28181.bean.SubscribeInfo; import com.genersoft.iot.vmp.gb28181.transmit.cmd.ISIPCommander; import com.genersoft.iot.vmp.gb28181.transmit.cmd.ISIPCommanderForPlatform; import com.genersoft.iot.vmp.service.IDeviceAlarmService; -import com.genersoft.iot.vmp.service.IGbStreamService; import com.genersoft.iot.vmp.storager.IVideoManagerStorage; import com.genersoft.iot.vmp.utils.DateUtil; import com.genersoft.iot.vmp.vmanager.bean.WVPResult; import com.github.pagehelper.PageInfo; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiImplicitParams; -import io.swagger.annotations.ApiOperation; -import io.swagger.models.auth.In; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.tags.Tag; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.util.StringUtils; import org.springframework.web.bind.annotation.*; -import java.text.ParseException; import java.time.LocalDateTime; import java.util.Arrays; import java.util.List; -@Api(tags = "鎶ヨ淇℃伅绠$悊") +@Tag(name = "鎶ヨ淇℃伅绠$悊") @CrossOrigin @RestController @RequestMapping("/api/alarm") @@ -46,68 +41,6 @@ @Autowired private IVideoManagerStorage storage; - /** - * 鍒嗛〉鏌ヨ鎶ヨ - * - * @param deviceId 璁惧id - * @param page 褰撳墠椤� - * @param count 姣忛〉鏌ヨ鏁伴噺 - * @param alarmPriority 鎶ヨ绾у埆 - * @param alarmMethod 鎶ヨ鏂瑰紡 - * @param alarmType 鎶ヨ绫诲瀷 - * @param startTime 寮�濮嬫椂闂� - * @param endTime 缁撴潫鏃堕棿 - * @return - */ - @ApiOperation("鍒嗛〉鏌ヨ鎶ヨ") - @GetMapping("/all") - @ApiImplicitParams({ - @ApiImplicitParam(name="deviceId", value = "璁惧id", dataTypeClass = String.class), - @ApiImplicitParam(name="page", value = "褰撳墠椤�", required = true ,dataTypeClass = Integer.class), - @ApiImplicitParam(name="count", value = "姣忛〉鏌ヨ鏁伴噺", required = true ,dataTypeClass = Integer.class), - @ApiImplicitParam(name="alarmPriority", value = "鏌ヨ鍐呭" ,dataTypeClass = String.class), - @ApiImplicitParam(name="alarmMethod", value = "鏌ヨ鍐呭" ,dataTypeClass = String.class), - @ApiImplicitParam(name="alarmMethod", value = "鏌ヨ鍐呭" ,dataTypeClass = String.class), - @ApiImplicitParam(name="alarmType", value = "鏌ヨ鍐呭" ,dataTypeClass = String.class), - @ApiImplicitParam(name="startTime", value = "寮�濮嬫椂闂�" ,dataTypeClass = String.class), - @ApiImplicitParam(name="endTime", value = "缁撴潫鏃堕棿" ,dataTypeClass = String.class), - }) - public ResponseEntity<PageInfo<DeviceAlarm>> getAll( - @RequestParam int page, - @RequestParam int count, - @RequestParam(required = false) String deviceId, - @RequestParam(required = false) String alarmPriority, - @RequestParam(required = false) String alarmMethod, - @RequestParam(required = false) String alarmType, - @RequestParam(required = false) String startTime, - @RequestParam(required = false) String endTime - ) { - if (StringUtils.isEmpty(alarmPriority)) { - alarmPriority = null; - } - if (StringUtils.isEmpty(alarmMethod)) { - alarmMethod = null; - } - if (StringUtils.isEmpty(alarmType)) { - alarmType = null; - } - if (StringUtils.isEmpty(startTime)) { - startTime = null; - } - if (StringUtils.isEmpty(endTime)) { - endTime = null; - } - - - if (!DateUtil.verification(startTime, DateUtil.formatter) || !DateUtil.verification(endTime, DateUtil.formatter)){ - return new ResponseEntity<>(null, HttpStatus.BAD_REQUEST); - } - - PageInfo<DeviceAlarm> allAlarm = deviceAlarmService.getAllAlarm(page, count, deviceId, alarmPriority, alarmMethod, - alarmType, startTime, endTime); - return new ResponseEntity<>(allAlarm, HttpStatus.OK); - } - /** * 鍒犻櫎鎶ヨ @@ -117,17 +50,15 @@ * @param time 缁撴潫鏃堕棿(杩欎釜鏃堕棿涔嬪墠鐨勬姤璀︿細琚垹闄�) * @return */ - @ApiOperation("鍒犻櫎鎶ヨ") @DeleteMapping("/delete") - @ApiImplicitParams({ - @ApiImplicitParam(name="id", value = "ID", required = false ,dataTypeClass = Integer.class), - @ApiImplicitParam(name="deviceIds", value = "澶氫釜璁惧id,閫楀彿鍒嗛殧", required = false ,dataTypeClass = String.class), - @ApiImplicitParam(name="time", value = "缁撴潫鏃堕棿", required = false ,dataTypeClass = String.class), - }) + @Operation(summary = "鍒犻櫎鎶ヨ") + @Parameter(name = "id", description = "ID") + @Parameter(name = "deviceIds", description = "澶氫釜璁惧id,閫楀彿鍒嗛殧") + @Parameter(name = "time", description = "缁撴潫鏃堕棿") public ResponseEntity<WVPResult<String>> delete( - @RequestParam(required = false) Integer id, - @RequestParam(required = false) String deviceIds, - @RequestParam(required = false) String time + @RequestParam(required = false) Integer id, + @RequestParam(required = false) String deviceIds, + @RequestParam(required = false) String time ) { if (StringUtils.isEmpty(id)) { id = null; @@ -161,11 +92,9 @@ * @param deviceId 鎶ヨid * @return */ - @ApiOperation("娴嬭瘯鍚戜笂绾�/璁惧鍙戦�佹ā鎷熸姤璀﹂�氱煡") @GetMapping("/test/notify/alarm") - @ApiImplicitParams({ - @ApiImplicitParam(name="deviceId", value = "deviceId", required = true ,dataTypeClass = Integer.class) - }) + @Operation(summary = "娴嬭瘯鍚戜笂绾�/璁惧鍙戦�佹ā鎷熸姤璀﹂�氱煡") + @Parameter(name = "deviceId", description = "璁惧鍥芥爣缂栧彿") public ResponseEntity<WVPResult<String>> delete( @RequestParam(required = false) String deviceId ) { @@ -201,5 +130,64 @@ return new ResponseEntity<WVPResult<String>>(wvpResult, HttpStatus.OK); } + /** + * 鍒嗛〉鏌ヨ鎶ヨ + * + * @param deviceId 璁惧id + * @param page 褰撳墠椤� + * @param count 姣忛〉鏌ヨ鏁伴噺 + * @param alarmPriority 鎶ヨ绾у埆 + * @param alarmMethod 鎶ヨ鏂瑰紡 + * @param alarmType 鎶ヨ绫诲瀷 + * @param startTime 寮�濮嬫椂闂� + * @param endTime 缁撴潫鏃堕棿 + * @return + */ + @Operation(summary = "鍒嗛〉鏌ヨ鎶ヨ") + @Parameter(name = "page",description = "褰撳墠椤�",required = true) + @Parameter(name = "count",description = "姣忛〉鏌ヨ鏁伴噺",required = true) + @Parameter(name = "deviceId",description = "璁惧id") + @Parameter(name = "alarmPriority",description = "鏌ヨ鍐呭") + @Parameter(name = "alarmMethod",description = "鏌ヨ鍐呭") + @Parameter(name = "alarmType",description = "姣忛〉鏌ヨ鏁伴噺") + @Parameter(name = "startTime",description = "寮�濮嬫椂闂�") + @Parameter(name = "endTime",description = "缁撴潫鏃堕棿") + @GetMapping("/all") + public ResponseEntity<PageInfo<DeviceAlarm>> getAll( + @RequestParam int page, + @RequestParam int count, + @RequestParam(required = false) String deviceId, + @RequestParam(required = false) String alarmPriority, + @RequestParam(required = false) String alarmMethod, + @RequestParam(required = false) String alarmType, + @RequestParam(required = false) String startTime, + @RequestParam(required = false) String endTime + ) { + if (StringUtils.isEmpty(alarmPriority)) { + alarmPriority = null; + } + if (StringUtils.isEmpty(alarmMethod)) { + alarmMethod = null; + } + if (StringUtils.isEmpty(alarmType)) { + alarmType = null; + } + if (StringUtils.isEmpty(startTime)) { + startTime = null; + } + if (StringUtils.isEmpty(endTime)) { + endTime = null; + } + + + if (!DateUtil.verification(startTime, DateUtil.formatter) || !DateUtil.verification(endTime, DateUtil.formatter)){ + return new ResponseEntity<>(null, HttpStatus.BAD_REQUEST); + } + + PageInfo<DeviceAlarm> allAlarm = deviceAlarmService.getAllAlarm(page, count, deviceId, alarmPriority, alarmMethod, + alarmType, startTime, endTime); + return new ResponseEntity<>(allAlarm, HttpStatus.OK); + } + } diff --git a/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/device/DeviceConfig.java b/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/device/DeviceConfig.java index 88c15a4..d20a29e 100644 --- a/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/device/DeviceConfig.java +++ b/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/device/DeviceConfig.java @@ -14,10 +14,9 @@ import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommander; import com.genersoft.iot.vmp.storager.IVideoManagerStorage; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiImplicitParams; -import io.swagger.annotations.ApiOperation; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.tags.Tag; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -28,7 +27,7 @@ import java.util.UUID; -@Api(tags = "鍥芥爣璁惧閰嶇疆") +@Tag(name = "鍥芥爣璁惧閰嶇疆") @CrossOrigin @RestController @RequestMapping("/api/device/config") @@ -55,16 +54,14 @@ * @param heartBeatCount 蹇冭烦璁℃暟 * @return */ - @ApiOperation("鍩烘湰閰嶇疆璁剧疆鍛戒护") @GetMapping("/basicParam/{deviceId}") - @ApiImplicitParams({ - @ApiImplicitParam(name = "deviceId", value ="璁惧ID" ,dataTypeClass = String.class), - @ApiImplicitParam(name = "channelId", value ="閫氶亾ID",dataTypeClass = String.class ), - @ApiImplicitParam(name = "name", value ="鍚嶇О" ,dataTypeClass = String.class), - @ApiImplicitParam(name = "expiration", value ="鍒版湡鏃堕棿" ,dataTypeClass = String.class), - @ApiImplicitParam(name = "heartBeatInterval", value ="蹇冭烦闂撮殧" ,dataTypeClass = String.class), - @ApiImplicitParam(name = "heartBeatCount", value ="蹇冭烦璁℃暟" ,dataTypeClass = String.class), - }) + @Operation(summary = "鍩烘湰閰嶇疆璁剧疆鍛戒护") + @Parameter(name = "deviceId", description = "璁惧鍥芥爣缂栧彿", required = true) + @Parameter(name = "channelId", description = "閫氶亾鍥芥爣缂栧彿", required = true) + @Parameter(name = "name", description = "鍚嶇О") + @Parameter(name = "expiration", description = "鍒版湡鏃堕棿") + @Parameter(name = "heartBeatInterval", description = "蹇冭烦闂撮殧") + @Parameter(name = "heartBeatCount", description = "蹇冭烦璁℃暟") public DeferredResult<ResponseEntity<String>> homePositionApi(@PathVariable String deviceId, String channelId, @RequestParam(required = false) String name, @@ -109,12 +106,10 @@ * @param channelId 閫氶亾ID * @return */ - @ApiOperation("璁惧閰嶇疆鏌ヨ璇锋眰") - @ApiImplicitParams({ - @ApiImplicitParam(name = "deviceId", value ="璁惧ID" ,dataTypeClass = String.class), - @ApiImplicitParam(name = "channelId", value ="閫氶亾ID" ,dataTypeClass = String.class), - @ApiImplicitParam(name = "configType", value ="閰嶇疆绫诲瀷" ,dataTypeClass = String.class), - }) + @Operation(summary = "璁惧閰嶇疆鏌ヨ璇锋眰") + @Parameter(name = "deviceId", description = "璁惧鍥芥爣缂栧彿", required = true) + @Parameter(name = "channelId", description = "閫氶亾鍥芥爣缂栧彿", required = true) + @Parameter(name = "configType", description = "閰嶇疆绫诲瀷") @GetMapping("/query/{deviceId}/{configType}") public DeferredResult<ResponseEntity<String>> configDownloadApi(@PathVariable String deviceId, @PathVariable String configType, diff --git a/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/device/DeviceControl.java b/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/device/DeviceControl.java index 4db11e3..615e644 100644 --- a/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/device/DeviceControl.java +++ b/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/device/DeviceControl.java @@ -14,10 +14,9 @@ import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommander; import com.genersoft.iot.vmp.storager.IVideoManagerStorage; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiImplicitParams; -import io.swagger.annotations.ApiOperation; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.tags.Tag; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -29,7 +28,7 @@ import java.util.UUID; -@Api(tags = "鍥芥爣璁惧鎺у埗") +@Tag(name = "鍥芥爣璁惧鎺у埗") @CrossOrigin @RestController @RequestMapping("/api/device/control") @@ -51,10 +50,12 @@ * * @param deviceId 璁惧ID */ - @ApiOperation("杩滅▼鍚姩鎺у埗鍛戒护") - @ApiImplicitParams({ - @ApiImplicitParam(name = "deviceId", value ="璁惧ID", required = true, dataTypeClass = String.class), - }) +// //@ApiOperation("杩滅▼鍚姩鎺у埗鍛戒护") +// @ApiImplicitParams({ +// @ApiImplicitParam(name = "deviceId", value ="璁惧ID", required = true, dataTypeClass = String.class), +// }) + @Operation(summary = "杩滅▼鍚姩鎺у埗鍛戒护") + @Parameter(name = "deviceId", description = "璁惧鍥芥爣缂栧彿", required = true) @GetMapping("/teleboot/{deviceId}") public ResponseEntity<String> teleBootApi(@PathVariable String deviceId) { if (logger.isDebugEnabled()) { @@ -80,13 +81,10 @@ * @param recordCmdStr Record锛氭墜鍔ㄥ綍鍍忥紝StopRecord锛氬仠姝㈡墜鍔ㄥ綍鍍� * @param channelId 閫氶亾缂栫爜锛堝彲閫夛級 */ - @ApiOperation("褰曞儚鎺у埗鍛戒护") - @ApiImplicitParams({ - @ApiImplicitParam(name = "deviceId", value ="璁惧ID", required = true, dataTypeClass = String.class), - @ApiImplicitParam(name = "channelId", value ="閫氶亾缂栫爜" ,dataTypeClass = String.class), - @ApiImplicitParam(name = "recordCmdStr", value ="鍛戒护锛� 鍙�夊�硷細Record锛堟墜鍔ㄥ綍鍍忥級锛孲topRecord锛堝仠姝㈡墜鍔ㄥ綍鍍忥級", - required = true ,dataTypeClass = String.class), - }) + @Operation(summary = "褰曞儚鎺у埗") + @Parameter(name = "deviceId", description = "璁惧鍥芥爣缂栧彿", required = true) + @Parameter(name = "channelId", description = "閫氶亾鍥芥爣缂栧彿", required = true) + @Parameter(name = "recordCmdStr", description = "鍛戒护锛� 鍙�夊�硷細Record锛堟墜鍔ㄥ綍鍍忥級锛孲topRecord锛堝仠姝㈡墜鍔ㄥ綍鍍忥級", required = true) @GetMapping("/record/{deviceId}/{recordCmdStr}") public DeferredResult<ResponseEntity<String>> recordApi(@PathVariable String deviceId, @PathVariable String recordCmdStr, String channelId) { @@ -127,13 +125,10 @@ * @param deviceId 璁惧ID * @param guardCmdStr SetGuard锛氬竷闃诧紝ResetGuard锛氭挙闃� */ - @ApiOperation("甯冮槻/鎾ら槻鍛戒护") - @ApiImplicitParams({ - @ApiImplicitParam(name = "deviceId", value = "璁惧ID", required = true, dataTypeClass = String.class), - @ApiImplicitParam(name = "channelId", value ="閫氶亾缂栫爜" ,dataTypeClass = String.class), - @ApiImplicitParam(name = "guardCmdStr", value ="鍛戒护锛� 鍙�夊�硷細SetGuard锛堝竷闃诧級锛孯esetGuard锛堟挙闃诧級", required = true, - dataTypeClass = String.class) - }) + @Operation(summary = "甯冮槻/鎾ら槻鍛戒护") + @Parameter(name = "deviceId", description = "璁惧鍥芥爣缂栧彿", required = true) + @Parameter(name = "channelId", description = "閫氶亾鍥芥爣缂栧彿", required = true) + @Parameter(name = "guardCmdStr", description = "鍛戒护锛� 鍙�夊�硷細SetGuard锛堝竷闃诧級锛孯esetGuard锛堟挙闃诧級", required = true) @GetMapping("/guard/{deviceId}/{guardCmdStr}") public DeferredResult<ResponseEntity<String>> guardApi(@PathVariable String deviceId, String channelId, @PathVariable String guardCmdStr) { if (logger.isDebugEnabled()) { @@ -171,13 +166,11 @@ * @param alarmMethod 鎶ヨ鏂瑰紡锛堝彲閫夛級 * @param alarmType 鎶ヨ绫诲瀷锛堝彲閫夛級 */ - @ApiOperation("鎶ヨ澶嶄綅") - @ApiImplicitParams({ - @ApiImplicitParam(name = "deviceId", value = "璁惧ID", required = true, dataTypeClass = String.class), - @ApiImplicitParam(name = "channelId", value ="閫氶亾缂栫爜" ,dataTypeClass = String.class), - @ApiImplicitParam(name = "alarmMethod", value ="鎶ヨ鏂瑰紡", dataTypeClass = String.class), - @ApiImplicitParam(name = "alarmType", value ="鎶ヨ绫诲瀷", dataTypeClass = String.class), - }) + @Operation(summary = "鎶ヨ澶嶄綅") + @Parameter(name = "deviceId", description = "璁惧鍥芥爣缂栧彿", required = true) + @Parameter(name = "channelId", description = "閫氶亾鍥芥爣缂栧彿", required = true) + @Parameter(name = "alarmMethod", description = "鎶ヨ鏂瑰紡") + @Parameter(name = "alarmType", description = "鎶ヨ绫诲瀷") @GetMapping("/reset_alarm/{deviceId}") public DeferredResult<ResponseEntity<String>> resetAlarmApi(@PathVariable String deviceId, String channelId, @RequestParam(required = false) String alarmMethod, @@ -215,11 +208,9 @@ * @param deviceId 璁惧ID * @param channelId 閫氶亾ID */ - @ApiOperation("寮哄埗鍏抽敭甯�") - @ApiImplicitParams({ - @ApiImplicitParam(name = "deviceId", value = "璁惧ID", required = true, dataTypeClass = String.class), - @ApiImplicitParam(name = "channelId", value ="閫氶亾ID", required = true, dataTypeClass = String.class), - }) + @Operation(summary = "寮哄埗鍏抽敭甯�") + @Parameter(name = "deviceId", description = "璁惧鍥芥爣缂栧彿", required = true) + @Parameter(name = "channelId", description = "閫氶亾鍥芥爣缂栧彿") @GetMapping("/i_frame/{deviceId}") public ResponseEntity<String> iFrame(@PathVariable String deviceId, @RequestParam(required = false) String channelId) { @@ -249,15 +240,12 @@ * @param presetIndex 璋冪敤棰勭疆浣嶇紪鍙凤紙鍙�夛級 * @param channelId 閫氶亾缂栫爜锛堝彲閫夛級 */ - @ApiOperation("鐪嬪畧浣嶆帶鍒�") - @ApiImplicitParams({ - @ApiImplicitParam(name = "deviceId", value = "璁惧ID", required = true, dataTypeClass = String.class), - @ApiImplicitParam(name = "channelId", value ="閫氶亾缂栫爜" ,dataTypeClass = String.class), - @ApiImplicitParam(name = "enabled", value = "鏄惁寮�鍚湅瀹堜綅 1:寮�鍚�,0:鍏抽棴", required = true, dataTypeClass = String.class), - @ApiImplicitParam(name = "resetTime", value = "鑷姩褰掍綅鏃堕棿闂撮殧", dataTypeClass = String.class), - @ApiImplicitParam(name = "presetIndex", value = "璋冪敤棰勭疆浣嶇紪鍙�", dataTypeClass = String.class), - @ApiImplicitParam(name = "channelId", value ="閫氶亾ID", dataTypeClass = String.class), - }) + @Operation(summary = "鐪嬪畧浣嶆帶鍒�") + @Parameter(name = "deviceId", description = "璁惧鍥芥爣缂栧彿", required = true) + @Parameter(name = "channelId", description = "閫氶亾鍥芥爣缂栧彿", required = true) + @Parameter(name = "enabled", description = "鏄惁寮�鍚湅瀹堜綅 1:寮�鍚�,0:鍏抽棴", required = true) + @Parameter(name = "presetIndex", description = "璋冪敤棰勭疆浣嶇紪鍙�") + @Parameter(name = "resetTime", description = "鑷姩褰掍綅鏃堕棿闂撮殧") @GetMapping("/home_position/{deviceId}/{enabled}") public DeferredResult<ResponseEntity<String>> homePositionApi(@PathVariable String deviceId, @PathVariable String enabled, @@ -307,17 +295,14 @@ * @param lengthy 鎷夋瀹藉害鍍忕礌鍊� * @return */ - @ApiOperation("鎷夋鏀惧ぇ") - @ApiImplicitParams({ - @ApiImplicitParam(name = "deviceId", value = "璁惧ID", required = true, dataTypeClass = String.class), - @ApiImplicitParam(name = "channelId", value = "閫氶亾ID", dataTypeClass = String.class), - @ApiImplicitParam(name = "length", value = "鎾斁绐楀彛闀垮害鍍忕礌鍊�", required = true, dataTypeClass = Integer.class), - @ApiImplicitParam(name = "width", value = "鎾斁绐楀彛瀹藉害鍍忕礌鍊�", required = true, dataTypeClass = Integer.class), - @ApiImplicitParam(name = "midpointx", value = "鎷夋涓績鐨勬í杞村潗鏍囧儚绱犲��", required = true, dataTypeClass = Integer.class), - @ApiImplicitParam(name = "midpointy", value = "鎷夋涓績鐨勭旱杞村潗鏍囧儚绱犲��", required = true, dataTypeClass = Integer.class), - @ApiImplicitParam(name = "lengthx", value = "鎷夋闀垮害鍍忕礌鍊�", required = true, dataTypeClass = Integer.class), - @ApiImplicitParam(name = "lengthy", value = "鎷夋瀹藉害鍍忕礌鍊�", required = true, dataTypeClass = Integer.class), - }) + @Operation(summary = "鎷夋鏀惧ぇ") + @Parameter(name = "deviceId", description = "璁惧鍥芥爣缂栧彿", required = true) + @Parameter(name = "channelId", description = "閫氶亾鍥芥爣缂栧彿", required = true) + @Parameter(name = "length", description = "鎾斁绐楀彛闀垮害鍍忕礌鍊�", required = true) + @Parameter(name = "midpointx", description = "鎷夋涓績鐨勬í杞村潗鏍囧儚绱犲��", required = true) + @Parameter(name = "midpointy", description = "鎷夋涓績鐨勭旱杞村潗鏍囧儚绱犲��", required = true) + @Parameter(name = "lengthx", description = "鎷夋闀垮害鍍忕礌鍊�", required = true) + @Parameter(name = "lengthy", description = "lengthy", required = true) @GetMapping("drag_zoom/zoom_in") public ResponseEntity<String> dragZoomIn(@RequestParam String deviceId, @RequestParam(required = false) String channelId, @@ -356,17 +341,15 @@ * @param lengthy 鎷夋瀹藉害鍍忕礌鍊� * @return */ - @ApiOperation("鎷夋缂╁皬") - @ApiImplicitParams({ - @ApiImplicitParam(name = "deviceId", value = "璁惧ID", required = true, dataTypeClass = String.class), - @ApiImplicitParam(name = "channelId", value = "閫氶亾ID", dataTypeClass = String.class), - @ApiImplicitParam(name = "length", value = "鎾斁绐楀彛闀垮害鍍忕礌鍊�", required = true, dataTypeClass = Integer.class), - @ApiImplicitParam(name = "width", value = "鎾斁绐楀彛瀹藉害鍍忕礌鍊�", required = true, dataTypeClass = Integer.class), - @ApiImplicitParam(name = "midpointx", value = "鎷夋涓績鐨勬í杞村潗鏍囧儚绱犲��", required = true, dataTypeClass = Integer.class), - @ApiImplicitParam(name = "midpointy", value = "鎷夋涓績鐨勭旱杞村潗鏍囧儚绱犲��", required = true, dataTypeClass = Integer.class), - @ApiImplicitParam(name = "lengthx", value = "鎷夋闀垮害鍍忕礌鍊�", required = true, dataTypeClass = Integer.class), - @ApiImplicitParam(name = "lengthy", value = "鎷夋瀹藉害鍍忕礌鍊�", required = true, dataTypeClass = Integer.class), - }) + @Operation(summary = "鎷夋鏀惧ぇ") + @Parameter(name = "deviceId", description = "璁惧鍥芥爣缂栧彿", required = true) + @Parameter(name = "channelId", description = "閫氶亾鍥芥爣缂栧彿") + @Parameter(name = "length", description = "鎾斁绐楀彛闀垮害鍍忕礌鍊�", required = true) + @Parameter(name = "width", description = "鎷夋涓績鐨勬í杞村潗鏍囧儚绱犲��", required = true) + @Parameter(name = "midpointx", description = "鎷夋涓績鐨勬í杞村潗鏍囧儚绱犲��", required = true) + @Parameter(name = "midpointy", description = "鎷夋涓績鐨勭旱杞村潗鏍囧儚绱犲��", required = true) + @Parameter(name = "lengthx", description = "鎷夋闀垮害鍍忕礌鍊�", required = true) + @Parameter(name = "lengthy", description = "鎷夋瀹藉害鍍忕礌鍊�", required = true) @GetMapping("/drag_zoom/zoom_out") public ResponseEntity<String> dragZoomOut(@RequestParam String deviceId, @RequestParam(required = false) String channelId, diff --git a/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/device/DeviceQuery.java b/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/device/DeviceQuery.java index 29f9d88..b3c8ef9 100644 --- a/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/device/DeviceQuery.java +++ b/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/device/DeviceQuery.java @@ -19,10 +19,9 @@ import com.genersoft.iot.vmp.vmanager.bean.BaseTree; import com.genersoft.iot.vmp.vmanager.bean.WVPResult; import com.github.pagehelper.PageInfo; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiImplicitParams; -import io.swagger.annotations.ApiOperation; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.tags.Tag; import org.apache.commons.compress.utils.IOUtils; import org.apache.http.HttpResponse; import org.slf4j.Logger; @@ -41,7 +40,7 @@ import java.nio.file.Files; import java.util.*; -@Api(tags = "鍥芥爣璁惧鏌ヨ", value = "鍥芥爣璁惧鏌ヨ") +@Tag(name = "鍥芥爣璁惧鏌ヨ", description = "鍥芥爣璁惧鏌ヨ") @SuppressWarnings("rawtypes") @CrossOrigin @RestController @@ -79,16 +78,10 @@ * @param deviceId 鍥芥爣ID * @return 鍥芥爣璁惧 */ - @ApiOperation("浣跨敤ID鏌ヨ鍥芥爣璁惧") - @ApiImplicitParams({ - @ApiImplicitParam(name = "deviceId", value = "璁惧ID", required = true, dataTypeClass = String.class), - }) + @Operation(summary = "鏌ヨ鍥芥爣璁惧") + @Parameter(name = "deviceId", description = "璁惧鍥芥爣缂栧彿", required = true) @GetMapping("/devices/{deviceId}") public ResponseEntity<Device> devices(@PathVariable String deviceId){ - -// if (logger.isDebugEnabled()) { -// logger.debug("鏌ヨ瑙嗛璁惧API璋冪敤锛宒eviceId锛�" + deviceId); -// } Device device = storager.queryVideoDevice(deviceId); return new ResponseEntity<>(device,HttpStatus.OK); @@ -100,17 +93,11 @@ * @param count 姣忛〉鏌ヨ鏁伴噺 * @return 鍒嗛〉鍥芥爣鍒楄〃 */ - @ApiOperation("鍒嗛〉鏌ヨ鍥芥爣璁惧") - @ApiImplicitParams({ - @ApiImplicitParam(name = "page", value = "褰撳墠椤�", required = true, dataTypeClass = Integer.class), - @ApiImplicitParam(name = "count", value = "姣忛〉鏌ヨ鏁伴噺", required = true, dataTypeClass = Integer.class), - }) + @Operation(summary = "鍒嗛〉鏌ヨ鍥芥爣璁惧") + @Parameter(name = "page", description = "褰撳墠椤�", required = true) + @Parameter(name = "count", description = "姣忛〉鏌ヨ鏁伴噺", required = true) @GetMapping("/devices") public PageInfo<Device> devices(int page, int count){ - -// if (logger.isDebugEnabled()) { -// logger.debug("鏌ヨ鎵�鏈夎棰戣澶嘇PI璋冪敤"); -// } return storager.queryVideoDeviceList(page, count); } @@ -124,28 +111,24 @@ * @param query 鏌ヨ鍐呭 * @param online 鏄惁鍦ㄧ嚎 鍦ㄧ嚎 true / 绂荤嚎 false * @param channelType 璁惧 false/瀛愮洰褰� true + * @param catalogUnderDevice 鏄惁鐩村睘涓庤澶囩殑鐩綍 * @return 閫氶亾鍒楄〃 */ - @ApiOperation("鍒嗛〉鏌ヨ閫氶亾") @GetMapping("/devices/{deviceId}/channels") - @ApiImplicitParams({ - @ApiImplicitParam(name="deviceId", value = "璁惧id", required = true ,dataTypeClass = String.class), - @ApiImplicitParam(name="page", value = "褰撳墠椤�", required = true ,dataTypeClass = Integer.class), - @ApiImplicitParam(name="count", value = "姣忛〉鏌ヨ鏁伴噺", required = true ,dataTypeClass = Integer.class), - @ApiImplicitParam(name="query", value = "鏌ヨ鍐呭" ,dataTypeClass = String.class), - @ApiImplicitParam(name="online", value = "鏄惁鍦ㄧ嚎" ,dataTypeClass = Boolean.class), - @ApiImplicitParam(name="channelType", value = "璁惧/瀛愮洰褰�-> false/true" ,dataTypeClass = Boolean.class), - @ApiImplicitParam(name="catalogUnderDevice", value = "鏄惁鐩村睘涓庤澶囩殑鐩綍" ,dataTypeClass = Boolean.class), - }) + @Operation(summary = "鍒嗛〉鏌ヨ閫氶亾") + @Parameter(name = "deviceId", description = "璁惧鍥芥爣缂栧彿", required = true) + @Parameter(name = "page", description = "褰撳墠椤�", required = true) + @Parameter(name = "count", description = "姣忛〉鏌ヨ鏁伴噺", required = true) + @Parameter(name = "query", description = "鏌ヨ鍐呭") + @Parameter(name = "online", description = "鏄惁鍦ㄧ嚎") + @Parameter(name = "channelType", description = "璁惧/瀛愮洰褰�-> false/true") + @Parameter(name = "catalogUnderDevice", description = "鏄惁鐩村睘涓庤澶囩殑鐩綍") public ResponseEntity<PageInfo> channels(@PathVariable String deviceId, int page, int count, @RequestParam(required = false) String query, @RequestParam(required = false) Boolean online, @RequestParam(required = false) Boolean channelType, @RequestParam(required = false) Boolean catalogUnderDevice) { -// if (logger.isDebugEnabled()) { -// logger.debug("鏌ヨ瑙嗛璁惧閫氶亾API璋冪敤"); -// } if (StringUtils.isEmpty(query)) { query = null; } @@ -159,10 +142,8 @@ * @param deviceId 璁惧id * @return */ - @ApiOperation("鍚屾璁惧閫氶亾") - @ApiImplicitParams({ - @ApiImplicitParam(name="deviceId", value = "璁惧id", required = true, dataTypeClass = String.class), - }) + @Operation(summary = "鍚屾璁惧閫氶亾") + @Parameter(name = "deviceId", description = "璁惧鍥芥爣缂栧彿", required = true) @PostMapping("/devices/{deviceId}/sync") public WVPResult<SyncStatus> devicesSync(@PathVariable String deviceId){ @@ -192,10 +173,8 @@ * @param deviceId 璁惧id * @return */ - @ApiOperation("绉婚櫎璁惧") - @ApiImplicitParams({ - @ApiImplicitParam(name="deviceId", value = "璁惧id", required = true, dataTypeClass = String.class), - }) + @Operation(summary = "绉婚櫎璁惧") + @Parameter(name = "deviceId", description = "璁惧鍥芥爣缂栧彿", required = true) @DeleteMapping("/devices/{deviceId}/delete") public ResponseEntity<String> delete(@PathVariable String deviceId){ @@ -239,16 +218,14 @@ * @param channelType 閫氶亾绫诲瀷 * @return 瀛愰�氶亾鍒楄〃 */ - @ApiOperation("鍒嗛〉鏌ヨ瀛愮洰褰曢�氶亾") - @ApiImplicitParams({ - @ApiImplicitParam(name="deviceId", value = "璁惧id", required = true, dataTypeClass = String.class), - @ApiImplicitParam(name="channelId", value = "閫氶亾id", required = true, dataTypeClass = String.class), - @ApiImplicitParam(name="page", value = "褰撳墠椤�", required = true, dataTypeClass = Integer.class), - @ApiImplicitParam(name="count", value = "姣忛〉鏉℃暟", required = true, dataTypeClass = Integer.class), - @ApiImplicitParam(name="query", value = "鏌ヨ鍐呭", dataTypeClass = String.class), - @ApiImplicitParam(name="online", value = "鏄惁鍦ㄧ嚎", dataTypeClass = Boolean.class), - @ApiImplicitParam(name="channelType", value = "閫氶亾绫诲瀷锛� 瀛愮洰褰�", dataTypeClass = Boolean.class), - }) + @Operation(summary = "鍒嗛〉鏌ヨ瀛愮洰褰曢�氶亾") + @Parameter(name = "deviceId", description = "璁惧鍥芥爣缂栧彿", required = true) + @Parameter(name = "channelId", description = "閫氶亾鍥芥爣缂栧彿", required = true) + @Parameter(name = "page", description = "褰撳墠椤�", required = true) + @Parameter(name = "count", description = "姣忛〉鏌ヨ鏁伴噺", required = true) + @Parameter(name = "query", description = "鏌ヨ鍐呭") + @Parameter(name = "online", description = "鏄惁鍦ㄧ嚎") + @Parameter(name = "channelType", description = "璁惧/瀛愮洰褰�-> false/true") @GetMapping("/sub_channels/{deviceId}/{channelId}/channels") public ResponseEntity<PageInfo> subChannels(@PathVariable String deviceId, @PathVariable String channelId, @@ -258,9 +235,6 @@ @RequestParam(required = false) Boolean online, @RequestParam(required = false) Boolean channelType){ -// if (logger.isDebugEnabled()) { -// logger.debug("鏌ヨ鎵�鏈夎棰戦�氶亾API璋冪敤"); -// } DeviceChannel deviceChannel = storager.queryChannel(deviceId,channelId); if (deviceChannel == null) { PageInfo<DeviceChannel> deviceChannelPageResult = new PageInfo<>(); @@ -277,13 +251,11 @@ * @param channel 閫氶亾 * @return */ - @ApiOperation("鏇存柊閫氶亾淇℃伅") - @ApiImplicitParams({ - @ApiImplicitParam(name="deviceId", value = "璁惧id", required = true, dataTypeClass = String.class), - @ApiImplicitParam(name="channel", value = "閫氶亾", required = true, dataTypeClass = String.class), - }) + @Operation(summary = "鏇存柊閫氶亾淇℃伅") + @Parameter(name = "deviceId", description = "璁惧鍥芥爣缂栧彿", required = true) + @Parameter(name = "channel", description = "閫氶亾淇℃伅", required = true) @PostMapping("/channel/update/{deviceId}") - public ResponseEntity<PageInfo> updateChannel(@PathVariable String deviceId,DeviceChannel channel){ + public ResponseEntity updateChannel(@PathVariable String deviceId,DeviceChannel channel){ deviceChannelService.updateChannel(deviceId, channel); return new ResponseEntity<>(null,HttpStatus.OK); } @@ -294,17 +266,14 @@ * @param streamMode 鏁版嵁娴佷紶杈撴ā寮� * @return */ - @ApiOperation("淇敼鏁版嵁娴佷紶杈撴ā寮�") - @ApiImplicitParams({ - @ApiImplicitParam(name = "deviceId", value = "璁惧id", required = true, dataTypeClass = String.class), - @ApiImplicitParam(name = "streamMode", value = "鏁版嵁娴佷紶杈撴ā寮�, 鍙栧�硷細" + - "UDP锛坲dp浼犺緭锛夛紝TCP-ACTIVE锛坱cp涓诲姩妯″紡,鏆備笉鏀寔锛夛紝TCP-PASSIVE锛坱cp琚姩妯″紡锛�", dataTypeClass = String.class), - }) + @Operation(summary = "淇敼鏁版嵁娴佷紶杈撴ā寮�") + @Parameter(name = "deviceId", description = "璁惧鍥芥爣缂栧彿", required = true) + @Parameter(name = "streamMode", description = "鏁版嵁娴佷紶杈撴ā寮�, 鍙栧�硷細" + + "UDP锛坲dp浼犺緭锛夛紝TCP-ACTIVE锛坱cp涓诲姩妯″紡,鏆備笉鏀寔锛夛紝TCP-PASSIVE锛坱cp琚姩妯″紡锛�", required = true) @PostMapping("/transport/{deviceId}/{streamMode}") - public ResponseEntity<PageInfo> updateTransport(@PathVariable String deviceId, @PathVariable String streamMode){ + public ResponseEntity updateTransport(@PathVariable String deviceId, @PathVariable String streamMode){ Device device = storager.queryVideoDevice(deviceId); device.setStreamMode(streamMode); -// storager.updateDevice(device); deviceService.updateDevice(device); return new ResponseEntity<>(null,HttpStatus.OK); } @@ -314,10 +283,8 @@ * @param device 璁惧淇℃伅 * @return */ - @ApiOperation("鏇存柊璁惧淇℃伅") - @ApiImplicitParams({ - @ApiImplicitParam(name = "device", value = "璁惧淇℃伅", required = true, dataTypeClass = Device.class) - }) + @Operation(summary = "鏇存柊璁惧淇℃伅") + @Parameter(name = "device", description = "璁惧", required = true) @PostMapping("/device/update/") public ResponseEntity<WVPResult<String>> updateDevice(Device device){ @@ -335,10 +302,8 @@ * * @param deviceId 璁惧id */ - @ApiOperation("璁惧鐘舵�佹煡璇�") - @ApiImplicitParams({ - @ApiImplicitParam(name = "deviceId", value = "璁惧id", required = true, dataTypeClass = String.class), - }) + @Operation(summary = "璁惧鐘舵�佹煡璇�") + @Parameter(name = "deviceId", description = "璁惧鍥芥爣缂栧彿", required = true) @GetMapping("/devices/{deviceId}/status") public DeferredResult<ResponseEntity<String>> deviceStatusApi(@PathVariable String deviceId) { if (logger.isDebugEnabled()) { @@ -383,16 +348,14 @@ * @param endTime 鎶ヨ鍙戠敓缁堟鏃堕棿锛堝彲閫夛級 * @return true = 鍛戒护鍙戦�佹垚鍔� */ - @ApiOperation("璁惧鎶ヨ鏌ヨ") - @ApiImplicitParams({ - @ApiImplicitParam(name = "deviceId", value = "璁惧id", required = true, dataTypeClass = String.class), - @ApiImplicitParam(name = "startPriority", value = "鎶ヨ璧峰绾у埆", dataTypeClass = String.class), - @ApiImplicitParam(name = "endPriority", value = "鎶ヨ缁堟绾у埆", dataTypeClass = String.class), - @ApiImplicitParam(name = "alarmMethod", value = "鎶ヨ鏂瑰紡鏉′欢", dataTypeClass = String.class), - @ApiImplicitParam(name = "alarmType", value = "鎶ヨ绫诲瀷", dataTypeClass = String.class), - @ApiImplicitParam(name = "startTime", value = "鎶ヨ鍙戠敓璧峰鏃堕棿", dataTypeClass = String.class), - @ApiImplicitParam(name = "endTime", value = "鎶ヨ鍙戠敓缁堟鏃堕棿", dataTypeClass = String.class), - }) + @Operation(summary = "璁惧鐘舵�佹煡璇�") + @Parameter(name = "deviceId", description = "璁惧鍥芥爣缂栧彿", required = true) + @Parameter(name = "startPriority", description = "鎶ヨ璧峰绾у埆") + @Parameter(name = "endPriority", description = "鎶ヨ缁堟绾у埆") + @Parameter(name = "alarmMethod", description = "鎶ヨ鏂瑰紡鏉′欢") + @Parameter(name = "alarmType", description = "鎶ヨ绫诲瀷") + @Parameter(name = "startTime", description = "鎶ヨ鍙戠敓璧峰鏃堕棿") + @Parameter(name = "endTime", description = "鎶ヨ鍙戠敓缁堟鏃堕棿") @GetMapping("/alarm/{deviceId}") public DeferredResult<ResponseEntity<String>> alarmApi(@PathVariable String deviceId, @RequestParam(required = false) String startPriority, @@ -430,7 +393,8 @@ @GetMapping("/{deviceId}/sync_status") - @ApiOperation(value = "鑾峰彇閫氶亾鍚屾杩涘害", notes = "鑾峰彇閫氶亾鍚屾杩涘害") + @Operation(summary = "鑾峰彇閫氶亾鍚屾杩涘害") + @Parameter(name = "deviceId", description = "璁惧鍥芥爣缂栧彿", required = true) public WVPResult<SyncStatus> getSyncStatus(@PathVariable String deviceId) { SyncStatus channelSyncStatus = deviceService.getChannelSyncStatus(deviceId); WVPResult<SyncStatus> wvpResult = new WVPResult<>(); @@ -448,7 +412,8 @@ } @GetMapping("/{deviceId}/subscribe_info") - @ApiOperation(value = "鑾峰彇璁惧鐨勮闃呯姸鎬�", notes = "鑾峰彇璁惧鐨勮闃呯姸鎬�") + @Operation(summary = "鑾峰彇璁惧鐨勮闃呯姸鎬�") + @Parameter(name = "deviceId", description = "璁惧鍥芥爣缂栧彿", required = true) public WVPResult<Map<String, String>> getSubscribeInfo(@PathVariable String deviceId) { Set<String> allKeys = dynamicTask.getAllKeys(); Map<String, String> dialogStateMap = new HashMap<>(); @@ -473,7 +438,9 @@ } @GetMapping("/snap/{deviceId}/{channelId}") - @ApiOperation(value = "璇锋眰鎴浘", notes = "璇锋眰鎴浘") + @Operation(summary = "璇锋眰鎴浘") + @Parameter(name = "deviceId", description = "璁惧鍥芥爣缂栧彿", required = true) + @Parameter(name = "channelId", description = "閫氶亾鍥芥爣缂栧彿", required = true) public void getSnap(HttpServletResponse resp, @PathVariable String deviceId, @PathVariable String channelId) { try { @@ -493,16 +460,17 @@ * @param count 姣忛〉鏉℃暟 * @return 鍥芥爣璁惧 */ - @ApiOperation("鏌ヨ鍥芥爣鏍�") - @ApiImplicitParams({ - @ApiImplicitParam(name = "deviceId", value = "璁惧ID", required = true, dataTypeClass = String.class), - @ApiImplicitParam(name = "parentId", value = "鐖禝D", required = false, dataTypeClass = String.class), - @ApiImplicitParam(name = "onlyCatalog", value = "鍙幏鍙栫洰褰�", required = false, dataTypeClass = Boolean.class), - @ApiImplicitParam(name="page", value = "褰撳墠椤�", required = true, dataTypeClass = Integer.class), - @ApiImplicitParam(name="count", value = "姣忛〉鏉℃暟", required = true, dataTypeClass = Integer.class), - }) + @Operation(summary = "鏌ヨ鍥芥爣鏍�") + @Parameter(name = "deviceId", description = "璁惧鍥芥爣缂栧彿", required = true) + @Parameter(name = "parentId", description = "鐖剁骇鍥芥爣缂栧彿") + @Parameter(name = "onlyCatalog", description = "鍙幏鍙栫洰褰�") + @Parameter(name = "page", description = "褰撳墠椤�", required = true) + @Parameter(name = "count", description = "姣忛〉鏉℃暟", required = true) @GetMapping("/tree/{deviceId}") - public ResponseEntity<PageInfo> getTree(@PathVariable String deviceId, @RequestParam(required = false) String parentId, @RequestParam(required = false) Boolean onlyCatalog, int page, int count){ + public ResponseEntity<PageInfo> getTree(@PathVariable String deviceId, + @RequestParam(required = false) String parentId, + @RequestParam(required = false) Boolean onlyCatalog, + int page, int count){ if (page <= 0) { @@ -543,13 +511,11 @@ * @param count 姣忛〉鏉℃暟 * @return 鍥芥爣璁惧 */ - @ApiOperation("鏌ヨ鍥芥爣鏍戜笅鐨勯�氶亾") - @ApiImplicitParams({ - @ApiImplicitParam(name = "deviceId", value = "璁惧ID", required = true, dataTypeClass = String.class), - @ApiImplicitParam(name = "parentId", value = "鐖禝D", required = false, dataTypeClass = String.class), - @ApiImplicitParam(name="page", value = "褰撳墠椤�", required = true, dataTypeClass = Integer.class), - @ApiImplicitParam(name="count", value = "姣忛〉鏉℃暟", required = true, dataTypeClass = Integer.class), - }) + @Operation(summary = "鏌ヨ鍥芥爣鏍戜笅鐨勯�氶亾") + @Parameter(name = "deviceId", description = "璁惧鍥芥爣缂栧彿", required = true) + @Parameter(name = "parentId", description = "鐖剁骇鍥芥爣缂栧彿") + @Parameter(name = "page", description = "褰撳墠椤�", required = true) + @Parameter(name = "count", description = "姣忛〉鏉℃暟", required = true) @GetMapping("/tree/channel/{deviceId}") public ResponseEntity<PageInfo> getChannelInTreeNode(@PathVariable String deviceId, @RequestParam(required = false) String parentId, int page, int count){ diff --git a/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/gbStream/GbStreamController.java b/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/gbStream/GbStreamController.java index fba050b..1a9f80a 100644 --- a/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/gbStream/GbStreamController.java +++ b/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/gbStream/GbStreamController.java @@ -5,17 +5,16 @@ import com.genersoft.iot.vmp.vmanager.gb28181.gbStream.bean.GbStreamParam; import com.genersoft.iot.vmp.service.IGbStreamService; import com.github.pagehelper.PageInfo; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiImplicitParams; -import io.swagger.annotations.ApiOperation; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.tags.Tag; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.util.StringUtils; import org.springframework.web.bind.annotation.*; -@Api(tags = "瑙嗛娴佸叧鑱斿埌绾ц仈骞冲彴") +@Tag(name = "瑙嗛娴佸叧鑱斿埌绾ц仈骞冲彴") @CrossOrigin @RestController @RequestMapping("/api/gbStream") @@ -37,16 +36,13 @@ * @param platformId 骞冲彴ID * @return */ - @ApiOperation("鏌ヨ鍥芥爣閫氶亾") - @ApiImplicitParams({ - @ApiImplicitParam(name = "page", value = "褰撳墠椤�", required = true , dataTypeClass = Integer.class), - @ApiImplicitParam(name = "count", value = "姣忛〉鏉℃暟", required = true , dataTypeClass = Integer.class), - @ApiImplicitParam(name = "platformId", value = "骞冲彴ID", required = true , dataTypeClass = String.class), - @ApiImplicitParam(name = "catalogId", value = "鐩綍ID", required = false , dataTypeClass = String.class), - @ApiImplicitParam(name="query", value = "鏌ヨ鍐呭", required = false , dataTypeClass = String.class), - @ApiImplicitParam(name="mediaServerId", value = "娴佸獟浣揑D", required = false , dataTypeClass = String.class), - - }) + @Operation(summary = "鏌ヨ鍥芥爣閫氶亾") + @Parameter(name = "page", description = "褰撳墠椤�", required = true) + @Parameter(name = "count", description = "姣忛〉鏉℃暟", required = true) + @Parameter(name = "platformId", description = "骞冲彴ID", required = true) + @Parameter(name = "catalogId", description = "鐩綍ID") + @Parameter(name = "query", description = "鏌ヨ鍐呭") + @Parameter(name = "mediaServerId", description = "娴佸獟浣揑D") @GetMapping(value = "/list") @ResponseBody public PageInfo<GbStream> list(@RequestParam(required = true)Integer page, @@ -76,11 +72,7 @@ * @param gbStreamParam * @return */ - @ApiOperation("绉婚櫎鍥芥爣鍏宠仈") - @ApiImplicitParams({ - @ApiImplicitParam(name = "gbStreamParam", value = "GbStreamParam", required = true, - dataTypeClass = GbStreamParam.class), - }) + @Operation(summary = "绉婚櫎鍥芥爣鍏宠仈") @DeleteMapping(value = "/del") @ResponseBody public Object del(@RequestBody GbStreamParam gbStreamParam){ @@ -97,10 +89,7 @@ * @param gbStreamParam * @return */ - @ApiOperation("淇濆瓨鍥芥爣鍏宠仈") - @ApiImplicitParams({ - @ApiImplicitParam(name = "gbStreamParam", value = "GbStreamParam", required = true, dataTypeClass = GbStreamParam.class), - }) + @Operation(summary = "淇濆瓨鍥芥爣鍏宠仈") @PostMapping(value = "/add") @ResponseBody public Object add(@RequestBody GbStreamParam gbStreamParam){ diff --git a/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/gbStream/bean/GbStreamParam.java b/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/gbStream/bean/GbStreamParam.java index a377c1c..161f2e7 100644 --- a/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/gbStream/bean/GbStreamParam.java +++ b/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/gbStream/bean/GbStreamParam.java @@ -1,15 +1,20 @@ package com.genersoft.iot.vmp.vmanager.gb28181.gbStream.bean; import com.genersoft.iot.vmp.gb28181.bean.GbStream; +import io.swagger.v3.oas.annotations.media.Schema; import java.util.List; +@Schema(description = "鍥芥爣鍏宠仈鍙傛暟") public class GbStreamParam { + @Schema(description = "骞冲彴ID") private String platformId; + @Schema(description = "鐩綍ID") private String catalogId; + @Schema(description = "娴佸浗鏍囦俊鎭垪琛�") private List<GbStream> gbStreams; public String getPlatformId() { diff --git a/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/media/MediaController.java b/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/media/MediaController.java index 48973f9..4ad39a9 100644 --- a/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/media/MediaController.java +++ b/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/media/MediaController.java @@ -3,19 +3,14 @@ import com.genersoft.iot.vmp.common.StreamInfo; import com.genersoft.iot.vmp.conf.security.SecurityUtils; import com.genersoft.iot.vmp.conf.security.dto.LoginUser; -import com.genersoft.iot.vmp.media.zlm.dto.OnPublishHookParam; import com.genersoft.iot.vmp.media.zlm.dto.StreamAuthorityInfo; -import com.genersoft.iot.vmp.service.IMediaServerService; import com.genersoft.iot.vmp.service.IStreamProxyService; -import com.genersoft.iot.vmp.service.IStreamPushService; import com.genersoft.iot.vmp.service.IMediaService; import com.genersoft.iot.vmp.storager.IRedisCatchStorage; -import com.genersoft.iot.vmp.storager.IVideoManagerStorage; import com.genersoft.iot.vmp.vmanager.bean.WVPResult; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiImplicitParams; -import io.swagger.annotations.ApiOperation; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.tags.Tag; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -25,7 +20,7 @@ import javax.servlet.http.HttpServletRequest; -@Api(tags = "濯掍綋娴佺浉鍏�") +@Tag(name = "濯掍綋娴佺浉鍏�") @Controller @CrossOrigin @RequestMapping(value = "/api/media") @@ -48,12 +43,12 @@ * @param stream 娴乮d * @return */ - @ApiOperation("鏍规嵁搴旂敤鍚嶅拰娴乮d鑾峰彇鎾斁鍦板潃") - @ApiImplicitParams({ - @ApiImplicitParam(name = "app", value = "搴旂敤鍚�", dataTypeClass = String.class), - @ApiImplicitParam(name = "stream", value = "娴乮d", dataTypeClass = String.class), - @ApiImplicitParam(name = "mediaServerId", value = "濯掍綋鏈嶅姟鍣╥d", dataTypeClass = String.class, required = false), - }) + @Operation(summary = "鏍规嵁搴旂敤鍚嶅拰娴乮d鑾峰彇鎾斁鍦板潃") + @Parameter(name = "app", description = "搴旂敤鍚�", required = true) + @Parameter(name = "stream", description = "娴乮d", required = true) + @Parameter(name = "mediaServerId", description = "濯掍綋鏈嶅姟鍣╥d") + @Parameter(name = "callId", description = "鎺ㄦ祦鏃舵惡甯︾殑鑷畾涔夐壌鏉僆D") + @Parameter(name = "useSourceIpAsStreamIp", description = "鏄惁浣跨敤璇锋眰IP浣滀负杩斿洖鐨勫湴鍧�IP") @GetMapping(value = "/stream_info_by_app_and_stream") @ResponseBody public WVPResult<StreamInfo> getStreamInfoByAppAndStream(HttpServletRequest request, @RequestParam String app, diff --git a/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/platform/PlatformController.java b/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/platform/PlatformController.java index 7a22693..8b5229c 100644 --- a/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/platform/PlatformController.java +++ b/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/platform/PlatformController.java @@ -18,10 +18,9 @@ import com.genersoft.iot.vmp.vmanager.gb28181.platform.bean.ChannelReduce; import com.genersoft.iot.vmp.vmanager.gb28181.platform.bean.UpdateChannelParam; import com.github.pagehelper.PageInfo; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiImplicitParams; -import io.swagger.annotations.ApiOperation; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.tags.Tag; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -36,7 +35,7 @@ /** * 绾ц仈骞冲彴绠$悊 */ -@Api(tags = "绾ц仈骞冲彴绠$悊") +@Tag(name = "绾ц仈骞冲彴绠$悊") @CrossOrigin @RestController @RequestMapping("/api/platform") @@ -73,7 +72,7 @@ * * @return */ - @ApiOperation("鑾峰彇鍥芥爣鏈嶅姟鐨勯厤缃�") + @Operation(summary = "鑾峰彇鍥芥爣鏈嶅姟鐨勯厤缃�") @GetMapping("/server_config") public ResponseEntity<JSONObject> serverConfig() { JSONObject result = new JSONObject(); @@ -89,7 +88,8 @@ * * @return */ - @ApiOperation("鑾峰彇鍥芥爣鏈嶅姟鐨勯厤缃�") + @Operation(summary = "鑾峰彇绾ц仈鏈嶅姟鍣ㄤ俊鎭�") + @Parameter(name = "id", description = "骞冲彴鍥芥爣缂栧彿", required = true) @GetMapping("/info/{id}") public ResponseEntity<WVPResult<ParentPlatform>> getPlatform(@PathVariable String id) { ParentPlatform parentPlatform = storager.queryParentPlatByServerGBId(id); @@ -112,12 +112,10 @@ * @param count 姣忛〉鏉℃暟 * @return */ - @ApiOperation("鍒嗛〉鏌ヨ绾ц仈骞冲彴") @GetMapping("/query/{count}/{page}") - @ApiImplicitParams({ - @ApiImplicitParam(name = "page", value = "褰撳墠椤�", dataTypeClass = Integer.class), - @ApiImplicitParam(name = "count", value = "姣忛〉鏉℃暟", dataTypeClass = Integer.class), - }) + @Operation(summary = "鍒嗛〉鏌ヨ绾ц仈骞冲彴") + @Parameter(name = "page", description = "褰撳墠椤�", required = true) + @Parameter(name = "count", description = "姣忛〉鏉℃暟", required = true) public PageInfo<ParentPlatform> platforms(@PathVariable int page, @PathVariable int count) { PageInfo<ParentPlatform> parentPlatformPageInfo = storager.queryParentPlatformList(page, count); @@ -136,10 +134,7 @@ * @param parentPlatform * @return */ - @ApiOperation("娣诲姞涓婄骇骞冲彴淇℃伅") - @ApiImplicitParams({ - @ApiImplicitParam(name = "parentPlatform", value = "涓婄骇骞冲彴淇℃伅", dataTypeClass = ParentPlatform.class), - }) + @Operation(summary = "娣诲姞涓婄骇骞冲彴淇℃伅") @PostMapping("/add") @ResponseBody public ResponseEntity<WVPResult<String>> addPlatform(@RequestBody ParentPlatform parentPlatform) { @@ -211,10 +206,7 @@ * @param parentPlatform * @return */ - @ApiOperation("淇濆瓨涓婄骇骞冲彴淇℃伅") - @ApiImplicitParams({ - @ApiImplicitParam(name = "parentPlatform", value = "涓婄骇骞冲彴淇℃伅", dataTypeClass = ParentPlatform.class), - }) + @Operation(summary = "淇濆瓨涓婄骇骞冲彴淇℃伅") @PostMapping("/save") @ResponseBody public ResponseEntity<WVPResult<String>> savePlatform(@RequestBody ParentPlatform parentPlatform) { @@ -286,10 +278,8 @@ * @param serverGBId 涓婄骇骞冲彴鍥芥爣ID * @return */ - @ApiOperation("鍒犻櫎涓婄骇骞冲彴") - @ApiImplicitParams({ - @ApiImplicitParam(name = "serverGBId", value = "涓婄骇骞冲彴鍥芥爣ID", dataTypeClass = String.class), - }) + @Operation(summary = "鍒犻櫎涓婄骇骞冲彴") + @Parameter(name = "serverGBId", description = "涓婄骇骞冲彴鐨勫浗鏍囩紪鍙�") @DeleteMapping("/delete/{serverGBId}") @ResponseBody public ResponseEntity<String> deletePlatform(@PathVariable String serverGBId) { @@ -339,17 +329,12 @@ * @param serverGBId 涓婄骇骞冲彴鍥芥爣ID * @return */ - @ApiOperation("鏌ヨ涓婄骇骞冲彴鏄惁瀛樺湪") - @ApiImplicitParams({ - @ApiImplicitParam(name = "serverGBId", value = "涓婄骇骞冲彴鍥芥爣ID", dataTypeClass = String.class), - }) + @Operation(summary = "鏌ヨ涓婄骇骞冲彴鏄惁瀛樺湪") + @Parameter(name = "serverGBId", description = "涓婄骇骞冲彴鐨勫浗鏍囩紪鍙�") @GetMapping("/exit/{serverGBId}") @ResponseBody public ResponseEntity<String> exitPlatform(@PathVariable String serverGBId) { -// if (logger.isDebugEnabled()) { -// logger.debug("鏌ヨ涓婄骇骞冲彴鏄惁瀛樺湪API璋冪敤锛�" + serverGBId); -// } ParentPlatform parentPlatform = storager.queryParentPlatByServerGBId(serverGBId); return new ResponseEntity<>(String.valueOf(parentPlatform != null), HttpStatus.OK); } @@ -365,16 +350,14 @@ * @param channelType 閫氶亾绫诲瀷 * @return */ - @ApiOperation("鍒嗛〉鏌ヨ绾ц仈骞冲彴鐨勬墍鏈夋墍鏈夐�氶亾") - @ApiImplicitParams({ - @ApiImplicitParam(name = "page", value = "褰撳墠椤�", dataTypeClass = Integer.class), - @ApiImplicitParam(name = "count", value = "姣忛〉鏉℃暟", dataTypeClass = Integer.class), - @ApiImplicitParam(name = "platformId", value = "涓婄骇骞冲彴ID", dataTypeClass = String.class), - @ApiImplicitParam(name = "catalogId", value = "鐩綍ID", dataTypeClass = String.class), - @ApiImplicitParam(name = "query", value = "鏌ヨ鍐呭", dataTypeClass = String.class), - @ApiImplicitParam(name = "online", value = "鏄惁鍦ㄧ嚎", dataTypeClass = Boolean.class), - @ApiImplicitParam(name = "channelType", value = "閫氶亾绫诲瀷", dataTypeClass = Boolean.class), - }) + @Operation(summary = "鏌ヨ涓婄骇骞冲彴鏄惁瀛樺湪") + @Parameter(name = "page", description = "褰撳墠椤�", required = true) + @Parameter(name = "count", description = "姣忛〉鏉℃暟", required = true) + @Parameter(name = "platformId", description = "涓婄骇骞冲彴鐨勫浗鏍囩紪鍙�") + @Parameter(name = "catalogId", description = "鐩綍ID") + @Parameter(name = "query", description = "鏌ヨ鍐呭") + @Parameter(name = "online", description = "鏄惁鍦ㄧ嚎") + @Parameter(name = "channelType", description = "閫氶亾绫诲瀷") @GetMapping("/channel_list") @ResponseBody public PageInfo<ChannelReduce> channelList(int page, int count, @@ -384,9 +367,6 @@ @RequestParam(required = false) Boolean online, @RequestParam(required = false) Boolean channelType) { -// if (logger.isDebugEnabled()) { -// logger.debug("鏌ヨ鎵�鏈夋墍鏈夐�氶亾API璋冪敤"); -// } if (StringUtils.isEmpty(platformId)) { platformId = null; } @@ -407,10 +387,7 @@ * @param param 閫氶亾鍏宠仈鍙傛暟 * @return */ - @ApiOperation("鍚戜笂绾у钩鍙版坊鍔犲浗鏍囬�氶亾") - @ApiImplicitParams({ - @ApiImplicitParam(name = "param", value = "閫氶亾鍏宠仈鍙傛暟", dataTypeClass = UpdateChannelParam.class), - }) + @Operation(summary = "鍚戜笂绾у钩鍙版坊鍔犲浗鏍囬�氶亾") @PostMapping("/update_channel_for_gb") @ResponseBody public ResponseEntity<String> updateChannelForGB(@RequestBody UpdateChannelParam param) { @@ -429,10 +406,7 @@ * @param param 閫氶亾鍏宠仈鍙傛暟 * @return */ - @ApiOperation("浠庝笂绾у钩鍙扮Щ闄ゅ浗鏍囬�氶亾") - @ApiImplicitParams({ - @ApiImplicitParam(name = "param", value = "閫氶亾鍏宠仈鍙傛暟", dataTypeClass = UpdateChannelParam.class), - }) + @Operation(summary = "浠庝笂绾у钩鍙扮Щ闄ゅ浗鏍囬�氶亾") @DeleteMapping("/del_channel_for_gb") @ResponseBody public ResponseEntity<String> delChannelForGB(@RequestBody UpdateChannelParam param) { @@ -452,11 +426,9 @@ * @param parentId 鐩綍鐖禝D * @return */ - @ApiOperation("鑾峰彇鐩綍") - @ApiImplicitParams({ - @ApiImplicitParam(name = "platformId", value = "骞冲彴ID", dataTypeClass = String.class, required = true), - @ApiImplicitParam(name = "parentId", value = "鐩綍鐖禝D", dataTypeClass = String.class, required = true), - }) + @Operation(summary = "鑾峰彇鐩綍") + @Parameter(name = "platformId", description = "涓婄骇骞冲彴鐨勫浗鏍囩紪鍙�", required = true) + @Parameter(name = "parentId", description = "鐖剁骇鐩綍鐨勫浗鏍囩紪鍙�", required = true) @GetMapping("/catalog") @ResponseBody public ResponseEntity<WVPResult<List<PlatformCatalog>>> getCatalogByPlatform(String platformId, String parentId) { @@ -472,11 +444,6 @@ parentId = platform.getDeviceGBId(); } List<PlatformCatalog> platformCatalogList = storager.getChildrenCatalogByPlatform(platformId, parentId); -// if (platform.getTreeType().equals(TreeType.BUSINESS_GROUP)) { -// platformCatalogList = storager.getChildrenCatalogByPlatform(platformId, parentId); -// }else { -// -// } WVPResult<List<PlatformCatalog>> result = new WVPResult<>(); result.setCode(0); @@ -491,10 +458,7 @@ * @param platformCatalog 鐩綍 * @return */ - @ApiOperation("娣诲姞鐩綍") - @ApiImplicitParams({ - @ApiImplicitParam(name = "platformCatalog", value = "鐩綍淇℃伅", dataTypeClass = PlatformCatalog.class, required = true), - }) + @Operation(summary = "娣诲姞鐩綍") @PostMapping("/catalog/add") @ResponseBody public ResponseEntity<WVPResult<List<PlatformCatalog>>> addCatalog(@RequestBody PlatformCatalog platformCatalog) { @@ -528,10 +492,7 @@ * @param platformCatalog 鐩綍 * @return */ - @ApiOperation("缂栬緫鐩綍") - @ApiImplicitParams({ - @ApiImplicitParam(name = "platformCatalog", value = "鐩綍淇℃伅", dataTypeClass = PlatformCatalog.class, required = true), - }) + @Operation(summary = "缂栬緫鐩綍") @PostMapping("/catalog/edit") @ResponseBody public ResponseEntity<WVPResult<List<PlatformCatalog>>> editCatalog(@RequestBody PlatformCatalog platformCatalog) { @@ -561,12 +522,12 @@ * 鍒犻櫎鐩綍 * * @param id 鐩綍Id + * @param platformId 骞冲彴Id * @return */ - @ApiOperation("鍒犻櫎鐩綍") - @ApiImplicitParams({ - @ApiImplicitParam(name = "id", value = "鐩綍Id", dataTypeClass = String.class, required = true), - }) + @Operation(summary = "鍒犻櫎鐩綍") + @Parameter(name = "id", description = "鐩綍Id", required = true) + @Parameter(name = "platformId", description = "骞冲彴Id", required = true) @DeleteMapping("/catalog/del") @ResponseBody public ResponseEntity<WVPResult<String>> delCatalog(String id, String platformId) { @@ -609,10 +570,7 @@ * @param platformCatalog 鍏宠仈鐨勪俊鎭� * @return */ - @ApiOperation("鍒犻櫎鍏宠仈") - @ApiImplicitParams({ - @ApiImplicitParam(name = "platformCatalog", value = "鍏宠仈鐨勪俊鎭�", dataTypeClass = PlatformCatalog.class, required = true), - }) + @Operation(summary = "鍒犻櫎鍏宠仈") @DeleteMapping("/catalog/relation/del") @ResponseBody public ResponseEntity<WVPResult<List<PlatformCatalog>>> delRelation(@RequestBody PlatformCatalog platformCatalog) { @@ -641,11 +599,9 @@ * @param catalogId 鐩綍Id * @return */ - @ApiOperation("淇敼榛樿鐩綍") - @ApiImplicitParams({ - @ApiImplicitParam(name = "platformId", value = "骞冲彴Id", dataTypeClass = String.class, required = true), - @ApiImplicitParam(name = "catalogId", value = "鐩綍Id", dataTypeClass = String.class, required = true), - }) + @Operation(summary = "淇敼榛樿鐩綍") + @Parameter(name = "catalogId", description = "鐩綍Id", required = true) + @Parameter(name = "platformId", description = "骞冲彴Id", required = true) @PostMapping("/catalog/default/update") @ResponseBody public ResponseEntity<WVPResult<String>> setDefaultCatalog(String platformId, String catalogId) { diff --git a/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/platform/bean/ChannelReduce.java b/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/platform/bean/ChannelReduce.java index 10015e4..2b01d45 100644 --- a/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/platform/bean/ChannelReduce.java +++ b/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/platform/bean/ChannelReduce.java @@ -1,55 +1,66 @@ package com.genersoft.iot.vmp.vmanager.gb28181.platform.bean; import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel; +import io.swagger.v3.oas.annotations.media.Schema; /** * 绮剧畝鐨刢hannel淇℃伅灞曠ず锛屼富瑕佹槸閫夋嫨閫氶亾鐨勬椂鍊欏睍绀哄垪琛ㄤ娇鐢� */ +@Schema(description = "绮剧畝鐨刢hannel淇℃伅灞曠ず") public class ChannelReduce { /** * deviceChannel鐨勬暟鎹簱鑷ID */ + @Schema(description = "deviceChannel鐨勬暟鎹簱鑷ID") private int id; /** * 閫氶亾id */ + @Schema(description = "閫氶亾鍥芥爣缂栧彿") private String channelId; /** * 璁惧id */ + @Schema(description = "璁惧鍥芥爣缂栧彿") private String deviceId; /** * 閫氶亾鍚� */ + @Schema(description = "閫氶亾鍚�") private String name; /** * 鐢熶骇鍘傚晢 */ + @Schema(description = "鐢熶骇鍘傚晢") private String manufacturer; /** * wan鍦板潃 */ + @Schema(description = "wan鍦板潃") private String hostAddress; /** * 瀛愯妭鐐规暟 */ + @Schema(description = "瀛愯妭鐐规暟") private int subCount; /** * 骞冲彴Id */ + @Schema(description = "骞冲彴涓婄骇鍥芥爣缂栧彿") private String platformId; /** * 鐩綍Id */ + @Schema(description = "鐩綍鍥芥爣缂栧彿") private String catalogId; public int getId() { diff --git a/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/platform/bean/UpdateChannelParam.java b/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/platform/bean/UpdateChannelParam.java index 5b97f18..01762d9 100644 --- a/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/platform/bean/UpdateChannelParam.java +++ b/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/platform/bean/UpdateChannelParam.java @@ -1,10 +1,23 @@ package com.genersoft.iot.vmp.vmanager.gb28181.platform.bean; +import io.swagger.v3.oas.annotations.media.Schema; + import java.util.List; +/** + * 閫氶亾鍏宠仈鍙傛暟 + * @author lin + */ +@Schema(description = "閫氶亾鍏宠仈鍙傛暟") public class UpdateChannelParam { + + @Schema(description = "涓婄骇骞冲彴鐨勫浗鏍囩紪鍙�") private String platformId; + + @Schema(description = "鐩綍鐨勫浗鏍囩紪鍙�") private String catalogId; + + @Schema(description = "") private List<ChannelReduce> channelReduces; public String getPlatformId() { diff --git a/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/play/PlayController.java b/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/play/PlayController.java index cc6d416..233e1de 100644 --- a/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/play/PlayController.java +++ b/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/play/PlayController.java @@ -15,10 +15,10 @@ import com.genersoft.iot.vmp.vmanager.gb28181.play.bean.PlayResult; import com.genersoft.iot.vmp.service.IMediaService; import com.genersoft.iot.vmp.service.IPlayService; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiImplicitParams; -import io.swagger.annotations.ApiOperation; + +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.tags.Tag; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -39,7 +39,7 @@ import java.util.List; import java.util.UUID; -@Api(tags = "鍥芥爣璁惧鐐规挱") +@Tag(name = "鍥芥爣璁惧鐐规挱") @CrossOrigin @RestController @RequestMapping("/api/play") @@ -74,11 +74,9 @@ @Autowired private IMediaServerService mediaServerService; - @ApiOperation("寮�濮嬬偣鎾�") - @ApiImplicitParams({ - @ApiImplicitParam(name = "deviceId", value = "璁惧ID", dataTypeClass = String.class), - @ApiImplicitParam(name = "channelId", value = "閫氶亾ID", dataTypeClass = String.class), - }) + @Operation(summary = "寮�濮嬬偣鎾�") + @Parameter(name = "deviceId", description = "璁惧鍥芥爣缂栧彿", required = true) + @Parameter(name = "channelId", description = "閫氶亾鍥芥爣缂栧彿", required = true) @GetMapping("/start/{deviceId}/{channelId}") public DeferredResult<ResponseEntity<String>> play(@PathVariable String deviceId, @PathVariable String channelId) { @@ -91,11 +89,10 @@ return playResult.getResult(); } - @ApiOperation("鍋滄鐐规挱") - @ApiImplicitParams({ - @ApiImplicitParam(name = "deviceId", value = "璁惧ID", dataTypeClass = String.class), - @ApiImplicitParam(name = "channelId", value = "閫氶亾ID", dataTypeClass = String.class), - }) + + @Operation(summary = "鍋滄鐐规挱") + @Parameter(name = "deviceId", description = "璁惧鍥芥爣缂栧彿", required = true) + @Parameter(name = "channelId", description = "閫氶亾鍥芥爣缂栧彿", required = true) @GetMapping("/stop/{deviceId}/{channelId}") public DeferredResult<ResponseEntity<String>> playStop(@PathVariable String deviceId, @PathVariable String channelId) { @@ -164,10 +161,8 @@ * @param streamId 娴両D * @return */ - @ApiOperation("灏嗕笉鏄痟264鐨勮棰戦�氳繃ffmpeg 杞爜涓篽264 + aac") - @ApiImplicitParams({ - @ApiImplicitParam(name = "streamId", value = "瑙嗛娴両D", dataTypeClass = String.class), - }) + @Operation(summary = "灏嗕笉鏄痟264鐨勮棰戦�氳繃ffmpeg 杞爜涓篽264 + aac") + @Parameter(name = "streamId", description = "瑙嗛娴両D", required = true) @PostMapping("/convert/{streamId}") public ResponseEntity<String> playConvert(@PathVariable String streamId) { StreamInfo streamInfo = redisCatchStorage.queryPlayByStreamId(streamId); @@ -211,10 +206,9 @@ * @param key * @return */ - @ApiOperation("缁撴潫杞爜") - @ApiImplicitParams({ - @ApiImplicitParam(name = "key", value = "瑙嗛娴乲ey", dataTypeClass = String.class), - }) + @Operation(summary = "缁撴潫杞爜") + @Parameter(name = "key", description = "瑙嗛娴乲ey", required = true) + @Parameter(name = "mediaServerId", description = "娴佸獟浣撴湇鍔D", required = true) @PostMapping("/convertStop/{key}") public ResponseEntity<String> playConvertStop(@PathVariable String key, String mediaServerId) { JSONObject result = new JSONObject(); @@ -250,10 +244,8 @@ } - @ApiOperation("璇煶骞挎挱鍛戒护") - @ApiImplicitParams({ - @ApiImplicitParam(name = "deviceId", value = "璁惧Id", dataTypeClass = String.class), - }) + @Operation(summary = "璇煶骞挎挱鍛戒护") + @Parameter(name = "deviceId", description = "璁惧鍥芥爣缂栧彿", required = true) @GetMapping("/broadcast/{deviceId}") @PostMapping("/broadcast/{deviceId}") public DeferredResult<ResponseEntity<String>> broadcastApi(@PathVariable String deviceId) { @@ -313,7 +305,7 @@ return result; } - @ApiOperation("鑾峰彇鎵�鏈夌殑ssrc") + @Operation(summary = "鑾峰彇鎵�鏈夌殑ssrc") @GetMapping("/ssrc") public WVPResult<JSONObject> getSSRC() { if (logger.isDebugEnabled()) { diff --git a/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/playback/PlaybackController.java b/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/playback/PlaybackController.java index e095a6a..f556175 100644 --- a/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/playback/PlaybackController.java +++ b/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/playback/PlaybackController.java @@ -2,14 +2,12 @@ import com.genersoft.iot.vmp.common.StreamInfo; import com.genersoft.iot.vmp.gb28181.transmit.callback.DeferredResultHolder; -//import com.genersoft.iot.vmp.media.zlm.ZLMRESTfulUtils; import com.genersoft.iot.vmp.service.IMediaServerService; import com.genersoft.iot.vmp.storager.IRedisCatchStorage; import com.genersoft.iot.vmp.service.IPlayService; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiImplicitParams; -import io.swagger.annotations.ApiOperation; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.tags.Tag; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -28,7 +26,7 @@ import com.genersoft.iot.vmp.storager.IVideoManagerStorage; import org.springframework.web.context.request.async.DeferredResult; -@Api(tags = "瑙嗛鍥炴斁") +@Tag(name = "瑙嗛鍥炴斁") @CrossOrigin @RestController @RequestMapping("/api/playback") @@ -45,25 +43,17 @@ @Autowired private IRedisCatchStorage redisCatchStorage; - // @Autowired - // private ZLMRESTfulUtils zlmresTfulUtils; - @Autowired private IPlayService playService; @Autowired private DeferredResultHolder resultHolder; - @Autowired - private IMediaServerService mediaServerService; - - @ApiOperation("寮�濮嬭棰戝洖鏀�") - @ApiImplicitParams({ - @ApiImplicitParam(name = "deviceId", value = "璁惧ID", dataTypeClass = String.class), - @ApiImplicitParam(name = "channelId", value = "閫氶亾ID", dataTypeClass = String.class), - @ApiImplicitParam(name = "startTime", value = "寮�濮嬫椂闂�", dataTypeClass = String.class), - @ApiImplicitParam(name = "endTime", value = "缁撴潫鏃堕棿", dataTypeClass = String.class), - }) + @Operation(summary = "寮�濮嬭棰戝洖鏀�") + @Parameter(name = "deviceId", description = "璁惧鍥芥爣缂栧彿", required = true) + @Parameter(name = "channelId", description = "閫氶亾鍥芥爣缂栧彿", required = true) + @Parameter(name = "startTime", description = "寮�濮嬫椂闂�", required = true) + @Parameter(name = "endTime", description = "缁撴潫鏃堕棿", required = true) @GetMapping("/start/{deviceId}/{channelId}") public DeferredResult<ResponseEntity<String>> play(@PathVariable String deviceId, @PathVariable String channelId, String startTime,String endTime) { @@ -79,12 +69,11 @@ return result; } - @ApiOperation("鍋滄瑙嗛鍥炴斁") - @ApiImplicitParams({ - @ApiImplicitParam(name = "deviceId", value = "璁惧ID", dataTypeClass = String.class), - @ApiImplicitParam(name = "channelId", value = "閫氶亾ID", dataTypeClass = String.class), - @ApiImplicitParam(name = "stream", value = "娴両D", dataTypeClass = String.class), - }) + + @Operation(summary = "鍋滄瑙嗛鍥炴斁") + @Parameter(name = "deviceId", description = "璁惧鍥芥爣缂栧彿", required = true) + @Parameter(name = "channelId", description = "閫氶亾鍥芥爣缂栧彿", required = true) + @Parameter(name = "stream", description = "娴両D", required = true) @GetMapping("/stop/{deviceId}/{channelId}/{stream}") public ResponseEntity<String> playStop( @PathVariable String deviceId, @@ -111,10 +100,9 @@ } } - @ApiOperation("鍥炴斁鏆傚仠") - @ApiImplicitParams({ - @ApiImplicitParam(name = "streamId", value = "鍥炴斁娴両D", dataTypeClass = String.class), - }) + + @Operation(summary = "鍥炴斁鏆傚仠") + @Parameter(name = "streamId", description = "鍥炴斁娴両D", required = true) @GetMapping("/pause/{streamId}") public ResponseEntity<String> playPause(@PathVariable String streamId) { logger.info("playPause: "+streamId); @@ -131,10 +119,9 @@ return new ResponseEntity<String>(json.toString(), HttpStatus.OK); } - @ApiOperation("鍥炴斁鎭㈠") - @ApiImplicitParams({ - @ApiImplicitParam(name = "streamId", value = "鍥炴斁娴両D", dataTypeClass = String.class), - }) + + @Operation(summary = "鍥炴斁鎭㈠") + @Parameter(name = "streamId", description = "鍥炴斁娴両D", required = true) @GetMapping("/resume/{streamId}") public ResponseEntity<String> playResume(@PathVariable String streamId) { logger.info("playResume: "+streamId); @@ -151,11 +138,10 @@ return new ResponseEntity<String>(json.toString(), HttpStatus.OK); } - @ApiOperation("鍥炴斁鎷栧姩鎾斁") - @ApiImplicitParams({ - @ApiImplicitParam(name = "streamId", value = "鍥炴斁娴両D", dataTypeClass = String.class), - @ApiImplicitParam(name = "seekTime", value = "鎷栧姩鍋忕Щ閲忥紝鍗曚綅s", dataTypeClass = Long.class), - }) + + @Operation(summary = "鍥炴斁鎷栧姩鎾斁") + @Parameter(name = "streamId", description = "鍥炴斁娴両D", required = true) + @Parameter(name = "seekTime", description = "鎷栧姩鍋忕Щ閲忥紝鍗曚綅s", required = true) @GetMapping("/seek/{streamId}/{seekTime}") public ResponseEntity<String> playSeek(@PathVariable String streamId, @PathVariable long seekTime) { logger.info("playSeek: "+streamId+", "+seekTime); @@ -172,11 +158,9 @@ return new ResponseEntity<String>(json.toString(), HttpStatus.OK); } - @ApiOperation("鍥炴斁鍊嶉�熸挱鏀�") - @ApiImplicitParams({ - @ApiImplicitParam(name = "streamId", value = "鍥炴斁娴両D", dataTypeClass = String.class), - @ApiImplicitParam(name = "speed", value = "鍊嶉��0.25 0.5 1銆�2銆�4", dataTypeClass = Double.class), - }) + @Operation(summary = "鍥炴斁鍊嶉�熸挱鏀�") + @Parameter(name = "streamId", description = "鍥炴斁娴両D", required = true) + @Parameter(name = "speed", description = "鍊嶉��0.25 0.5 1銆�2銆�4", required = true) @GetMapping("/speed/{streamId}/{speed}") public ResponseEntity<String> playSpeed(@PathVariable String streamId, @PathVariable Double speed) { logger.info("playSpeed: "+streamId+", "+speed); diff --git a/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/ptz/PtzController.java b/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/ptz/PtzController.java index 4a29f8e..489396b 100644 --- a/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/ptz/PtzController.java +++ b/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/ptz/PtzController.java @@ -1,9 +1,9 @@ package com.genersoft.iot.vmp.vmanager.gb28181.ptz; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiImplicitParams; -import io.swagger.annotations.ApiOperation; + +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.tags.Tag; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -21,7 +21,7 @@ import java.util.UUID; -@Api(tags = "浜戝彴鎺у埗") +@Tag(name = "浜戝彴鎺у埗") @CrossOrigin @RestController @RequestMapping("/api/ptz") @@ -48,15 +48,14 @@ * @param zoomSpeed 缂╂斁閫熷害 * @return String 鎺у埗缁撴灉 */ - @ApiOperation("浜戝彴鎺у埗") - @ApiImplicitParams({ - @ApiImplicitParam(name = "deviceId", value = "璁惧ID", dataTypeClass = String.class), - @ApiImplicitParam(name = "channelId", value = "閫氶亾ID", dataTypeClass = String.class), - @ApiImplicitParam(name = "command", value = "鎺у埗鎸囦护,鍏佽鍊�: left, right, up, down, upleft, upright, downleft, downright, zoomin, zoomout, stop", dataTypeClass = String.class), - @ApiImplicitParam(name = "horizonSpeed", value = "姘村钩閫熷害", dataTypeClass = Integer.class), - @ApiImplicitParam(name = "verticalSpeed", value = "鍨傜洿閫熷害", dataTypeClass = Integer.class), - @ApiImplicitParam(name = "zoomSpeed", value = "缂╂斁閫熷害", dataTypeClass = Integer.class), - }) + + @Operation(summary = "浜戝彴鎺у埗") + @Parameter(name = "deviceId", description = "璁惧鍥芥爣缂栧彿", required = true) + @Parameter(name = "channelId", description = "閫氶亾鍥芥爣缂栧彿", required = true) + @Parameter(name = "command", description = "鎺у埗鎸囦护,鍏佽鍊�: left, right, up, down, upleft, upright, downleft, downright, zoomin, zoomout, stop", required = true) + @Parameter(name = "horizonSpeed", description = "姘村钩閫熷害", required = true) + @Parameter(name = "verticalSpeed", description = "鍨傜洿閫熷害", required = true) + @Parameter(name = "zoomSpeed", description = "缂╂斁閫熷害", required = true) @PostMapping("/control/{deviceId}/{channelId}") public ResponseEntity<String> ptz(@PathVariable String deviceId,@PathVariable String channelId, String command, int horizonSpeed, int verticalSpeed, int zoomSpeed){ @@ -106,15 +105,14 @@ return new ResponseEntity<String>("success",HttpStatus.OK); } - @ApiOperation("閫氱敤鍓嶇鎺у埗鍛戒护") - @ApiImplicitParams({ - @ApiImplicitParam(name = "deviceId", value = "璁惧ID", dataTypeClass = String.class), - @ApiImplicitParam(name = "channelId", value = "閫氶亾ID", dataTypeClass = String.class), - @ApiImplicitParam(name = "cmdCode", value = "鎸囦护鐮�", dataTypeClass = Integer.class), - @ApiImplicitParam(name = "parameter1", value = "鏁版嵁涓�", dataTypeClass = Integer.class), - @ApiImplicitParam(name = "parameter2", value = "鏁版嵁浜�", dataTypeClass = Integer.class), - @ApiImplicitParam(name = "combindCode2", value = "缁勫悎鐮佷簩", dataTypeClass = Integer.class), - }) + + @Operation(summary = "閫氱敤鍓嶇鎺у埗鍛戒护") + @Parameter(name = "deviceId", description = "璁惧鍥芥爣缂栧彿", required = true) + @Parameter(name = "channelId", description = "閫氶亾鍥芥爣缂栧彿", required = true) + @Parameter(name = "cmdCode", description = "鎸囦护鐮�", required = true) + @Parameter(name = "parameter1", description = "鏁版嵁涓�", required = true) + @Parameter(name = "parameter2", description = "鏁版嵁浜�", required = true) + @Parameter(name = "combindCode2", description = "缁勫悎鐮佷簩", required = true) @PostMapping("/front_end_command/{deviceId}/{channelId}") public ResponseEntity<String> frontEndCommand(@PathVariable String deviceId,@PathVariable String channelId,int cmdCode, int parameter1, int parameter2, int combindCode2){ @@ -127,11 +125,10 @@ return new ResponseEntity<String>("success",HttpStatus.OK); } - @ApiOperation("棰勭疆浣嶆煡璇�") - @ApiImplicitParams({ - @ApiImplicitParam(name = "deviceId", value = "璁惧ID", dataTypeClass = String.class), - @ApiImplicitParam(name = "channelId", value = "閫氶亾ID", dataTypeClass = String.class), - }) + + @Operation(summary = "棰勭疆浣嶆煡璇�") + @Parameter(name = "deviceId", description = "璁惧鍥芥爣缂栧彿", required = true) + @Parameter(name = "channelId", description = "閫氶亾鍥芥爣缂栧彿", required = true) @GetMapping("/preset/query/{deviceId}/{channelId}") public DeferredResult<ResponseEntity<String>> presetQueryApi(@PathVariable String deviceId, @PathVariable String channelId) { if (logger.isDebugEnabled()) { diff --git a/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/record/GBRecordController.java b/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/record/GBRecordController.java index f0f2eb2..435ff32 100644 --- a/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/record/GBRecordController.java +++ b/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/record/GBRecordController.java @@ -7,10 +7,10 @@ import com.genersoft.iot.vmp.service.IPlayService; import com.genersoft.iot.vmp.utils.DateUtil; import com.genersoft.iot.vmp.vmanager.bean.WVPResult; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiImplicitParams; -import io.swagger.annotations.ApiOperation; + +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.tags.Tag; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -32,7 +32,7 @@ import java.time.LocalDate; import java.util.UUID; -@Api(tags = "鍥芥爣褰曞儚") +@Tag(name = "鍥芥爣褰曞儚") @CrossOrigin @RestController @RequestMapping("/api/gb_record") @@ -52,16 +52,11 @@ @Autowired private IPlayService playService; - @Autowired - private IMediaServerService mediaServerService; - - @ApiOperation("褰曞儚鏌ヨ") - @ApiImplicitParams({ - @ApiImplicitParam(name = "deviceId", value = "璁惧ID", dataTypeClass = String.class), - @ApiImplicitParam(name = "channelId", value = "閫氶亾ID", dataTypeClass = String.class), - @ApiImplicitParam(name = "startTime", value = "寮�濮嬫椂闂�", dataTypeClass = String.class), - @ApiImplicitParam(name = "endTime", value = "缁撴潫鏃堕棿", dataTypeClass = String.class), - }) + @Operation(summary = "褰曞儚鏌ヨ") + @Parameter(name = "deviceId", description = "璁惧鍥芥爣缂栧彿", required = true) + @Parameter(name = "channelId", description = "閫氶亾鍥芥爣缂栧彿", required = true) + @Parameter(name = "startTime", description = "寮�濮嬫椂闂�", required = true) + @Parameter(name = "endTime", description = "缁撴潫鏃堕棿", required = true) @GetMapping("/query/{deviceId}/{channelId}") public DeferredResult<ResponseEntity<WVPResult<RecordInfo>>> recordinfo(@PathVariable String deviceId, @PathVariable String channelId, String startTime, String endTime){ @@ -116,14 +111,13 @@ return result; } - @ApiOperation("寮�濮嬪巻鍙插獟浣撲笅杞�") - @ApiImplicitParams({ - @ApiImplicitParam(name = "deviceId", value = "璁惧ID", dataTypeClass = String.class), - @ApiImplicitParam(name = "channelId", value = "閫氶亾ID", dataTypeClass = String.class), - @ApiImplicitParam(name = "startTime", value = "寮�濮嬫椂闂�", dataTypeClass = String.class), - @ApiImplicitParam(name = "endTime", value = "缁撴潫鏃堕棿", dataTypeClass = String.class), - @ApiImplicitParam(name = "downloadSpeed", value = "涓嬭浇鍊嶉��", dataTypeClass = String.class), - }) + + @Operation(summary = "寮�濮嬪巻鍙插獟浣撲笅杞�") + @Parameter(name = "deviceId", description = "璁惧鍥芥爣缂栧彿", required = true) + @Parameter(name = "channelId", description = "閫氶亾鍥芥爣缂栧彿", required = true) + @Parameter(name = "startTime", description = "寮�濮嬫椂闂�", required = true) + @Parameter(name = "endTime", description = "缁撴潫鏃堕棿", required = true) + @Parameter(name = "downloadSpeed", description = "涓嬭浇鍊嶉��", required = true) @GetMapping("/download/start/{deviceId}/{channelId}") public DeferredResult<ResponseEntity<String>> download(@PathVariable String deviceId, @PathVariable String channelId, String startTime, String endTime, String downloadSpeed) { @@ -184,12 +178,10 @@ return result; } - @ApiOperation("鍋滄鍘嗗彶濯掍綋涓嬭浇") - @ApiImplicitParams({ - @ApiImplicitParam(name = "deviceId", value = "璁惧ID", dataTypeClass = String.class), - @ApiImplicitParam(name = "channelId", value = "閫氶亾ID", dataTypeClass = String.class), - @ApiImplicitParam(name = "stream", value = "娴両D", dataTypeClass = String.class), - }) + @Operation(summary = "鍋滄鍘嗗彶濯掍綋涓嬭浇") + @Parameter(name = "deviceId", description = "璁惧鍥芥爣缂栧彿", required = true) + @Parameter(name = "channelId", description = "閫氶亾鍥芥爣缂栧彿", required = true) + @Parameter(name = "stream", description = "娴両D", required = true) @GetMapping("/download/stop/{deviceId}/{channelId}/{stream}") public ResponseEntity<String> playStop(@PathVariable String deviceId, @PathVariable String channelId, @PathVariable String stream) { @@ -210,12 +202,10 @@ } } - @ApiOperation("鑾峰彇鍘嗗彶濯掍綋涓嬭浇杩涘害") - @ApiImplicitParams({ - @ApiImplicitParam(name = "deviceId", value = "璁惧ID", dataTypeClass = String.class), - @ApiImplicitParam(name = "channelId", value = "閫氶亾ID", dataTypeClass = String.class), - @ApiImplicitParam(name = "stream", value = "娴両D", dataTypeClass = String.class), - }) + @Operation(summary = "鑾峰彇鍘嗗彶濯掍綋涓嬭浇杩涘害") + @Parameter(name = "deviceId", description = "璁惧鍥芥爣缂栧彿", required = true) + @Parameter(name = "channelId", description = "閫氶亾鍥芥爣缂栧彿", required = true) + @Parameter(name = "stream", description = "娴両D", required = true) @GetMapping("/download/progress/{deviceId}/{channelId}/{stream}") public ResponseEntity<StreamInfo> getProgress(@PathVariable String deviceId, @PathVariable String channelId, @PathVariable String stream) { diff --git a/src/main/java/com/genersoft/iot/vmp/vmanager/log/LogController.java b/src/main/java/com/genersoft/iot/vmp/vmanager/log/LogController.java index a9b23ef..6ad1d9d 100644 --- a/src/main/java/com/genersoft/iot/vmp/vmanager/log/LogController.java +++ b/src/main/java/com/genersoft/iot/vmp/vmanager/log/LogController.java @@ -6,10 +6,10 @@ import com.genersoft.iot.vmp.utils.DateUtil; import com.genersoft.iot.vmp.vmanager.bean.WVPResult; import com.github.pagehelper.PageInfo; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiImplicitParams; -import io.swagger.annotations.ApiOperation; + +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.tags.Tag; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -20,7 +20,7 @@ import java.text.ParseException; -@Api(tags = "鏃ュ織绠$悊") +@Tag(name = "鏃ュ織绠$悊") @CrossOrigin @RestController @RequestMapping("/api/log") @@ -45,16 +45,14 @@ * @param endTime 缁撴潫鏃堕棿 * @return */ - @ApiOperation("鍒嗛〉鏌ヨ鎶ヨ") @GetMapping("/all") - @ApiImplicitParams({ - @ApiImplicitParam(name="query", value = "鏌ヨ鍐呭", dataTypeClass = String.class), - @ApiImplicitParam(name="page", value = "褰撳墠椤�", required = true ,dataTypeClass = Integer.class), - @ApiImplicitParam(name="count", value = "姣忛〉鏌ヨ鏁伴噺", required = true ,dataTypeClass = Integer.class), - @ApiImplicitParam(name="type", value = "绫诲瀷" ,dataTypeClass = String.class), - @ApiImplicitParam(name="startTime", value = "鏌ヨ鍐呭" ,dataTypeClass = String.class), - @ApiImplicitParam(name="endTime", value = "鏌ヨ鍐呭" ,dataTypeClass = String.class), - }) + @Operation(summary = "鍒嗛〉鏌ヨ鎶ヨ") + @Parameter(name = "query", description = "鏌ヨ鍐呭", required = true) + @Parameter(name = "page", description = "褰撳墠椤�", required = true) + @Parameter(name = "count", description = "姣忛〉鏌ヨ鏁伴噺", required = true) + @Parameter(name = "type", description = "绫诲瀷", required = true) + @Parameter(name = "startTime", description = "寮�濮嬫椂闂�", required = true) + @Parameter(name = "endTime", description = "缁撴潫鏃堕棿", required = true) public ResponseEntity<PageInfo<LogDto>> getAll( @RequestParam int page, @RequestParam int count, @@ -88,9 +86,8 @@ * 娓呯┖鏃ュ織 * */ - @ApiOperation("娓呯┖鏃ュ織") + @Operation(summary = "鍋滄瑙嗛鍥炴斁") @DeleteMapping("/clear") - @ApiImplicitParams({}) public ResponseEntity<WVPResult<String>> clear() { int count = logService.clear(); diff --git a/src/main/java/com/genersoft/iot/vmp/vmanager/record/RecordController.java b/src/main/java/com/genersoft/iot/vmp/vmanager/record/RecordController.java index 844c9b7..ad5f552 100644 --- a/src/main/java/com/genersoft/iot/vmp/vmanager/record/RecordController.java +++ b/src/main/java/com/genersoft/iot/vmp/vmanager/record/RecordController.java @@ -13,7 +13,7 @@ //import org.springframework.beans.factory.annotation.Autowired; //import org.springframework.web.bind.annotation.*; // -//@Api(tags = "浜戠褰曞儚") +//@Tag(name = "浜戠褰曞儚") //@CrossOrigin //@RestController //@RequestMapping("/api/record") @@ -22,7 +22,7 @@ // @Autowired // private IRecordInfoServer recordInfoServer; // -// @ApiOperation("褰曞儚鍒楄〃鏌ヨ") +// //@ApiOperation("褰曞儚鍒楄〃鏌ヨ") // @ApiImplicitParams({ // @ApiImplicitParam(name="page", value = "褰撳墠椤�", required = true, dataTypeClass = Integer.class), // @ApiImplicitParam(name="count", value = "姣忛〉鏌ヨ鏁伴噺", required = true, dataTypeClass = Integer.class), @@ -37,7 +37,7 @@ // return recordList; // } // -// @ApiOperation("鑾峰彇褰曞儚璇︽儏") +// //@ApiOperation("鑾峰彇褰曞儚璇︽儏") // @ApiImplicitParams({ // @ApiImplicitParam(name="recordInfo", value = "褰曞儚璁板綍", required = true, dataTypeClass = RecordInfo.class) // }) diff --git a/src/main/java/com/genersoft/iot/vmp/vmanager/server/ServerController.java b/src/main/java/com/genersoft/iot/vmp/vmanager/server/ServerController.java index 2311d4b..95995b8 100644 --- a/src/main/java/com/genersoft/iot/vmp/vmanager/server/ServerController.java +++ b/src/main/java/com/genersoft/iot/vmp/vmanager/server/ServerController.java @@ -15,10 +15,10 @@ import com.genersoft.iot.vmp.utils.SpringBeanFactory; import com.genersoft.iot.vmp.vmanager.bean.WVPResult; import gov.nist.javax.sip.SipStackImpl; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiImplicitParams; -import io.swagger.annotations.ApiOperation; + +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.tags.Tag; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.ConfigurableApplicationContext; @@ -33,7 +33,7 @@ import java.util.Set; @SuppressWarnings("rawtypes") -@Api(tags = "鏈嶅姟鎺у埗") +@Tag(name = "鏈嶅姟鎺у埗") @CrossOrigin @RestController @RequestMapping("/api/server") @@ -61,10 +61,10 @@ private int serverPort; - @ApiOperation("娴佸獟浣撴湇鍔″垪琛�") @GetMapping(value = "/media_server/list") @ResponseBody - public WVPResult<List<MediaServerItem>> getMediaServerList(boolean detail){ + @Operation(summary = "娴佸獟浣撴湇鍔″垪琛�") + public WVPResult<List<MediaServerItem>> getMediaServerList() { WVPResult<List<MediaServerItem>> result = new WVPResult<>(); result.setCode(0); result.setMsg("success"); @@ -72,10 +72,10 @@ return result; } - @ApiOperation("鍦ㄧ嚎娴佸獟浣撴湇鍔″垪琛�") @GetMapping(value = "/media_server/online/list") @ResponseBody - public WVPResult<List<MediaServerItem>> getOnlineMediaServerList(){ + @Operation(summary = "鍦ㄧ嚎娴佸獟浣撴湇鍔″垪琛�") + public WVPResult<List<MediaServerItem>> getOnlineMediaServerList() { WVPResult<List<MediaServerItem>> result = new WVPResult<>(); result.setCode(0); result.setMsg("success"); @@ -83,10 +83,11 @@ return result; } - @ApiOperation("鑾峰彇娴佸獟浣撴湇鍔�") @GetMapping(value = "/media_server/one/{id}") @ResponseBody - public WVPResult<MediaServerItem> getMediaServer(@PathVariable String id){ + @Operation(summary = "鍋滄瑙嗛鍥炴斁") + @Parameter(name = "id", description = "娴佸獟浣撴湇鍔D", required = true) + public WVPResult<MediaServerItem> getMediaServer(@PathVariable String id) { WVPResult<MediaServerItem> result = new WVPResult<>(); result.setCode(0); result.setMsg("success"); @@ -94,57 +95,49 @@ return result; } - @ApiOperation("娴嬭瘯娴佸獟浣撴湇鍔�") - @ApiImplicitParams({ - @ApiImplicitParam(name="ip", value = "娴佸獟浣撴湇鍔P", dataTypeClass = String.class), - @ApiImplicitParam(name="port", value = "娴佸獟浣撴湇鍔TT绔彛", dataTypeClass = Integer.class), - @ApiImplicitParam(name="secret", value = "娴佸獟浣撴湇鍔ecret", dataTypeClass = String.class), - }) + @Operation(summary = "娴嬭瘯娴佸獟浣撴湇鍔�") + @Parameter(name = "ip", description = "娴佸獟浣撴湇鍔P", required = true) + @Parameter(name = "port", description = "娴佸獟浣撴湇鍔TT绔彛", required = true) + @Parameter(name = "secret", description = "娴佸獟浣撴湇鍔ecret", required = true) @GetMapping(value = "/media_server/check") @ResponseBody - public WVPResult<MediaServerItem> checkMediaServer(@RequestParam String ip, @RequestParam int port, @RequestParam String secret){ + public WVPResult<MediaServerItem> checkMediaServer(@RequestParam String ip, @RequestParam int port, @RequestParam String secret) { return mediaServerService.checkMediaServer(ip, port, secret); } - @ApiOperation("娴嬭瘯娴佸獟浣撳綍鍍忕鐞嗘湇鍔�") - @ApiImplicitParams({ - @ApiImplicitParam(name="ip", value = "娴佸獟浣撴湇鍔P", dataTypeClass = String.class), - @ApiImplicitParam(name="port", value = "娴佸獟浣撴湇鍔TT绔彛", dataTypeClass = Integer.class), - @ApiImplicitParam(name="secret", value = "娴佸獟浣撴湇鍔ecret", dataTypeClass = String.class), - }) + @Operation(summary = "娴嬭瘯娴佸獟浣撳綍鍍忕鐞嗘湇鍔�") + @Parameter(name = "ip", description = "娴佸獟浣撴湇鍔P", required = true) + @Parameter(name = "port", description = "娴佸獟浣撴湇鍔TT绔彛", required = true) @GetMapping(value = "/media_server/record/check") @ResponseBody - public WVPResult<String> checkMediaRecordServer(@RequestParam String ip, @RequestParam int port){ + public WVPResult<String> checkMediaRecordServer(@RequestParam String ip, @RequestParam int port) { boolean checkResult = mediaServerService.checkMediaRecordServer(ip, port); WVPResult<String> result = new WVPResult<>(); if (checkResult) { result.setCode(0); result.setMsg("success"); - }else { + } else { result.setCode(-1); result.setMsg("杩炴帴澶辫触"); } return result; } - @ApiOperation("淇濆瓨娴佸獟浣撴湇鍔�") - @ApiImplicitParams({ - @ApiImplicitParam(name="mediaServerItem", value = "娴佸獟浣撲俊鎭�", dataTypeClass = MediaServerItem.class) - }) + @Operation(summary = "淇濆瓨娴佸獟浣撴湇鍔�") + @Parameter(name = "mediaServerItem", description = "娴佸獟浣撲俊鎭�", required = true) @PostMapping(value = "/media_server/save") @ResponseBody - public WVPResult<String> saveMediaServer(@RequestBody MediaServerItem mediaServerItem){ + public WVPResult<String> saveMediaServer(@RequestBody MediaServerItem mediaServerItem) { MediaServerItem mediaServerItemInDatabase = mediaServerService.getOne(mediaServerItem.getId()); if (mediaServerItemInDatabase != null) { - if (StringUtils.isEmpty(mediaServerItemInDatabase.getSendRtpPortRange()) - && StringUtils.isEmpty(mediaServerItem.getSendRtpPortRange())){ + if (StringUtils.isEmpty(mediaServerItemInDatabase.getSendRtpPortRange()) && StringUtils.isEmpty(mediaServerItem.getSendRtpPortRange())) { mediaServerItem.setSendRtpPortRange("30000,30500"); } - mediaServerService.update(mediaServerItem); - }else { - if (StringUtils.isEmpty(mediaServerItem.getSendRtpPortRange())){ + mediaServerService.update(mediaServerItem); + } else { + if (StringUtils.isEmpty(mediaServerItem.getSendRtpPortRange())) { mediaServerItem.setSendRtpPortRange("30000,30500"); } return mediaServerService.add(mediaServerItem); @@ -156,17 +149,15 @@ return result; } - @ApiOperation("绉婚櫎娴佸獟浣撴湇鍔�") - @ApiImplicitParams({ - @ApiImplicitParam(name="id", value = "娴佸獟浣揑D", dataTypeClass = String.class) - }) + @Operation(summary = "绉婚櫎娴佸獟浣撴湇鍔�") + @Parameter(name = "id", description = "娴佸獟浣揑D", required = true) @DeleteMapping(value = "/media_server/delete") @ResponseBody - public WVPResult<String> deleteMediaServer(@RequestParam String id){ + public WVPResult<String> deleteMediaServer(@RequestParam String id) { if (mediaServerService.getOne(id) != null) { mediaServerService.delete(id); mediaServerService.deleteDb(id); - }else { + } else { WVPResult<String> result = new WVPResult<>(); result.setCode(-1); result.setMsg("鏈壘鍒版鑺傜偣"); @@ -179,18 +170,17 @@ } - - @ApiOperation("閲嶅惎鏈嶅姟") + @Operation(summary = "閲嶅惎鏈嶅姟") @GetMapping(value = "/restart") @ResponseBody - public Object restart(){ + public Object restart() { Thread restartThread = new Thread(new Runnable() { @Override public void run() { try { Thread.sleep(3000); SipProvider up = (SipProvider) SpringBeanFactory.getBean("udpSipProvider"); - SipStackImpl stack = (SipStackImpl)up.getSipStack(); + SipStackImpl stack = (SipStackImpl) up.getSipStack(); stack.stop(); Iterator listener = stack.getListeningPoints(); while (listener.hasNext()) { @@ -213,10 +203,10 @@ return "success"; } - @ApiOperation("鐗堟湰淇℃伅") + @Operation(summary = "鑾峰彇鐗堟湰淇℃伅") @GetMapping(value = "/version") @ResponseBody - public WVPResult<VersionPo> getVersion(){ + public WVPResult<VersionPo> getVersion() { WVPResult<VersionPo> result = new WVPResult<>(); result.setCode(0); result.setMsg("success"); @@ -224,13 +214,11 @@ return result; } - @ApiOperation("閰嶇疆淇℃伅") @GetMapping(value = "/config") - @ApiImplicitParams({ - @ApiImplicitParam(name="type", value = "閰嶇疆绫诲瀷锛坰ip, base锛�", dataTypeClass = String.class), - }) + @Operation(summary = "鑾峰彇閰嶇疆淇℃伅") + @Parameter(name = "type", description = "閰嶇疆绫诲瀷锛坰ip, base锛�", required = true) @ResponseBody - public WVPResult<JSONObject> getVersion(String type){ + public WVPResult<JSONObject> getVersion(String type) { WVPResult<JSONObject> result = new WVPResult<>(); result.setCode(0); result.setMsg("success"); @@ -240,8 +228,8 @@ if (StringUtils.isEmpty(type)) { jsonObject.put("sip", JSON.toJSON(sipConfig)); jsonObject.put("base", JSON.toJSON(userSetting)); - }else { - switch (type){ + } else { + switch (type) { case "sip": jsonObject.put("sip", sipConfig); break; @@ -256,10 +244,10 @@ return result; } - @ApiOperation("鑾峰彇褰撳墠鎵�鏈塰ook") @GetMapping(value = "/hooks") @ResponseBody - public WVPResult<List<IHookSubscribe>> getHooks(){ + @Operation(summary = "鑾峰彇褰撳墠鎵�鏈塰ook") + public WVPResult<List<IHookSubscribe>> getHooks() { WVPResult<List<IHookSubscribe>> result = new WVPResult<>(); result.setCode(0); result.setMsg("success"); @@ -268,7 +256,7 @@ return result; } -// @ApiOperation("褰撳墠杩涜涓殑鍔ㄦ�佷换鍔�") +// //@ApiOperation("褰撳墠杩涜涓殑鍔ㄦ�佷换鍔�") // @GetMapping(value = "/dynamicTask") // @ResponseBody // public WVPResult<JSONObject> getDynamicTask(){ diff --git a/src/main/java/com/genersoft/iot/vmp/vmanager/streamProxy/StreamProxyController.java b/src/main/java/com/genersoft/iot/vmp/vmanager/streamProxy/StreamProxyController.java index f21bfd1..1ec4318 100644 --- a/src/main/java/com/genersoft/iot/vmp/vmanager/streamProxy/StreamProxyController.java +++ b/src/main/java/com/genersoft/iot/vmp/vmanager/streamProxy/StreamProxyController.java @@ -10,10 +10,10 @@ import com.genersoft.iot.vmp.service.IStreamProxyService; import com.genersoft.iot.vmp.vmanager.bean.WVPResult; import com.github.pagehelper.PageInfo; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiImplicitParams; -import io.swagger.annotations.ApiOperation; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.Parameters; +import io.swagger.v3.oas.annotations.tags.Tag; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -25,7 +25,7 @@ /** * 鎷夋祦浠g悊鎺ュ彛 */ -@Api(tags = "鎷夋祦浠g悊") +@Tag(name = "鎷夋祦浠g悊", description = "") @Controller @CrossOrigin @RequestMapping(value = "/api/proxy") @@ -44,13 +44,11 @@ private IStreamProxyService streamProxyService; - @ApiOperation("鍒嗛〉鏌ヨ娴佷唬鐞�") - @ApiImplicitParams({ - @ApiImplicitParam(name="page", value = "褰撳墠椤�", required = true, dataTypeClass = Integer.class), - @ApiImplicitParam(name="count", value = "姣忛〉鏌ヨ鏁伴噺", required = true, dataTypeClass = Integer.class), - @ApiImplicitParam(name="query", value = "鏌ヨ鍐呭", dataTypeClass = String.class), - @ApiImplicitParam(name="online", value = "鏄惁鍦ㄧ嚎", dataTypeClass = Boolean.class), - }) + @Operation(summary = "鍒嗛〉鏌ヨ娴佷唬鐞�") + @Parameter(name = "page", description = "褰撳墠椤�") + @Parameter(name = "count", description = "姣忛〉鏌ヨ鏁伴噺") + @Parameter(name = "query", description = "鏌ヨ鍐呭") + @Parameter(name = "online", description = "鏄惁鍦ㄧ嚎") @GetMapping(value = "/list") @ResponseBody public PageInfo<StreamProxyItem> list(@RequestParam(required = false)Integer page, @@ -61,9 +59,8 @@ return streamProxyService.getAll(page, count); } - @ApiOperation("淇濆瓨浠g悊") - @ApiImplicitParams({ - @ApiImplicitParam(name = "param", value = "浠g悊鍙傛暟", dataTypeClass = StreamProxyItem.class), + @Operation(summary = "淇濆瓨浠g悊", parameters = { + @Parameter(name = "param", description = "浠g悊鍙傛暟", required = true), }) @PostMapping(value = "/save") @ResponseBody @@ -82,12 +79,10 @@ return result; } - @ApiOperation("鑾峰彇ffmpeg.cmd妯℃澘") @GetMapping(value = "/ffmpeg_cmd/list") - @ApiImplicitParams({ - @ApiImplicitParam(name = "mediaServerId", value = "娴佸獟浣揑D", dataTypeClass = String.class), - }) @ResponseBody + @Operation(summary = "鑾峰彇ffmpeg.cmd妯℃澘") + @Parameter(name = "mediaServerId", description = "娴佸獟浣揑D", required = true) public WVPResult getFFmpegCMDs(@RequestParam String mediaServerId){ logger.debug("鑾峰彇鑺傜偣[ {} ]ffmpeg.cmd妯℃澘", mediaServerId ); @@ -100,13 +95,11 @@ return result; } - @ApiOperation("绉婚櫎浠g悊") - @ApiImplicitParams({ - @ApiImplicitParam(name = "app", value = "搴旂敤鍚�", required = true, dataTypeClass = String.class), - @ApiImplicitParam(name = "stream", value = "娴両D", required = true, dataTypeClass = String.class), - }) @DeleteMapping(value = "/del") @ResponseBody + @Operation(summary = "绉婚櫎浠g悊") + @Parameter(name = "app", description = "搴旂敤鍚�", required = true) + @Parameter(name = "stream", description = "娴乮d", required = true) public WVPResult del(@RequestParam String app, @RequestParam String stream){ logger.info("绉婚櫎浠g悊锛� " + app + "/" + stream); WVPResult<Object> result = new WVPResult<>(); @@ -121,13 +114,11 @@ return result; } - @ApiOperation("鍚敤浠g悊") - @ApiImplicitParams({ - @ApiImplicitParam(name = "app", value = "搴旂敤鍚�", dataTypeClass = String.class), - @ApiImplicitParam(name = "stream", value = "娴両D", dataTypeClass = String.class), - }) @GetMapping(value = "/start") @ResponseBody + @Operation(summary = "鍚敤浠g悊") + @Parameter(name = "app", description = "搴旂敤鍚�", required = true) + @Parameter(name = "stream", description = "娴乮d", required = true) public Object start(String app, String stream){ logger.info("鍚敤浠g悊锛� " + app + "/" + stream); boolean result = streamProxyService.start(app, stream); @@ -137,13 +128,11 @@ return result?"success":"fail"; } - @ApiOperation("鍋滅敤浠g悊") - @ApiImplicitParams({ - @ApiImplicitParam(name = "app", value = "搴旂敤鍚�", dataTypeClass = String.class), - @ApiImplicitParam(name = "stream", value = "娴両D", dataTypeClass = String.class), - }) @GetMapping(value = "/stop") @ResponseBody + @Operation(summary = "鍋滅敤浠g悊") + @Parameter(name = "app", description = "搴旂敤鍚�", required = true) + @Parameter(name = "stream", description = "娴乮d", required = true) public Object stop(String app, String stream){ logger.info("鍋滅敤浠g悊锛� " + app + "/" + stream); boolean result = streamProxyService.stop(app, stream); diff --git a/src/main/java/com/genersoft/iot/vmp/vmanager/streamPush/StreamPushController.java b/src/main/java/com/genersoft/iot/vmp/vmanager/streamPush/StreamPushController.java index c978ae6..5e4daab 100644 --- a/src/main/java/com/genersoft/iot/vmp/vmanager/streamPush/StreamPushController.java +++ b/src/main/java/com/genersoft/iot/vmp/vmanager/streamPush/StreamPushController.java @@ -20,10 +20,10 @@ import com.genersoft.iot.vmp.vmanager.bean.StreamPushExcelDto; import com.genersoft.iot.vmp.vmanager.bean.WVPResult; import com.github.pagehelper.PageInfo; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiImplicitParams; -import io.swagger.annotations.ApiOperation; + +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.tags.Tag; import org.apache.poi.sl.usermodel.Sheet; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -44,7 +44,7 @@ import java.util.Map; import java.util.UUID; -@Api(tags = "鎺ㄦ祦淇℃伅绠$悊") +@Tag(name = "鎺ㄦ祦淇℃伅绠$悊") @Controller @CrossOrigin @RequestMapping(value = "/api/push") @@ -67,16 +67,14 @@ @Autowired private UserSetting userSetting; - @ApiOperation("鎺ㄦ祦鍒楄〃鏌ヨ") - @ApiImplicitParams({ - @ApiImplicitParam(name="page", value = "褰撳墠椤�", required = true, dataTypeClass = Integer.class), - @ApiImplicitParam(name="count", value = "姣忛〉鏌ヨ鏁伴噺", required = true, dataTypeClass = Integer.class), - @ApiImplicitParam(name="query", value = "鏌ヨ鍐呭", dataTypeClass = String.class), - @ApiImplicitParam(name="pushing", value = "鏄惁姝e湪鎺ㄦ祦", dataTypeClass = Boolean.class), - @ApiImplicitParam(name="mediaServerId", value = "娴佸獟浣揑D", dataTypeClass = String.class), - }) @GetMapping(value = "/list") @ResponseBody + @Operation(summary = "鎺ㄦ祦鍒楄〃鏌ヨ") + @Parameter(name = "page", description = "褰撳墠椤�") + @Parameter(name = "count", description = "姣忛〉鏌ヨ鏁伴噺") + @Parameter(name = "query", description = "鏌ヨ鍐呭") + @Parameter(name = "pushing", description = "鏄惁姝e湪鎺ㄦ祦") + @Parameter(name = "mediaServerId", description = "娴佸獟浣揑D") public PageInfo<StreamPushItem> list(@RequestParam(required = false)Integer page, @RequestParam(required = false)Integer count, @RequestParam(required = false)String query, @@ -93,12 +91,9 @@ return pushList; } - @ApiOperation("灏嗘帹娴佹坊鍔犲埌鍥芥爣") - @ApiImplicitParams({ - @ApiImplicitParam(name = "stream", value = "鐩存挱娴佸叧鑱斿浗鏍囧钩鍙�", dataTypeClass = GbStream.class), - }) @PostMapping(value = "/save_to_gb") @ResponseBody + @Operation(summary = "灏嗘帹娴佹坊鍔犲埌鍥芥爣") public Object saveToGB(@RequestBody GbStream stream){ if (streamPushService.saveToGB(stream)){ return "success"; @@ -108,12 +103,9 @@ } - @ApiOperation("灏嗘帹娴佺Щ鍑哄埌鍥芥爣") - @ApiImplicitParams({ - @ApiImplicitParam(name = "stream", value = "鐩存挱娴佸叧鑱斿浗鏍囧钩鍙�", dataTypeClass = GbStream.class), - }) @DeleteMapping(value = "/remove_form_gb") @ResponseBody + @Operation(summary = "灏嗘帹娴佺Щ鍑哄埌鍥芥爣") public Object removeFormGB(@RequestBody GbStream stream){ if (streamPushService.removeFromGB(stream)){ return "success"; @@ -123,13 +115,11 @@ } - @ApiOperation("涓涓�涓帹娴�") - @ApiImplicitParams({ - @ApiImplicitParam(name = "app", value = "搴旂敤鍚�", required = true, dataTypeClass = String.class), - @ApiImplicitParam(name = "streamId", value = "娴両D", required = true, dataTypeClass = String.class), - }) @PostMapping(value = "/stop") @ResponseBody + @Operation(summary = "涓涓�涓帹娴�") + @Parameter(name = "app", description = "搴旂敤鍚�", required = true) + @Parameter(name = "stream", description = "娴乮d", required = true) public Object stop(String app, String streamId){ if (streamPushService.stop(app, streamId)){ return "success"; @@ -138,13 +128,9 @@ } } - @ApiOperation("涓澶氫釜鎺ㄦ祦") - @ApiImplicitParams({ - @ApiImplicitParam(name = "app", value = "搴旂敤鍚�", required = true, dataTypeClass = String.class), - @ApiImplicitParam(name = "streamId", value = "娴両D", required = true, dataTypeClass = String.class), - }) @DeleteMapping(value = "/batchStop") @ResponseBody + @Operation(summary = "涓澶氫釜鎺ㄦ祦") public Object batchStop(@RequestBody BatchGBStreamParam batchGBStreamParam){ if (batchGBStreamParam.getGbStreams().size() == 0) { return "fail"; @@ -256,14 +242,12 @@ * @param stream 娴乮d * @return */ - @ApiOperation("鑾峰彇鎺ㄦ祦鎾斁鍦板潃") - @ApiImplicitParams({ - @ApiImplicitParam(name = "app", value = "搴旂敤鍚�", dataTypeClass = String.class), - @ApiImplicitParam(name = "stream", value = "娴乮d", dataTypeClass = String.class), - @ApiImplicitParam(name = "mediaServerId", value = "濯掍綋鏈嶅姟鍣╥d", dataTypeClass = String.class, required = false), - }) @GetMapping(value = "/getPlayUrl") @ResponseBody + @Operation(summary = "鑾峰彇鎺ㄦ祦鎾斁鍦板潃") + @Parameter(name = "app", description = "搴旂敤鍚�", required = true) + @Parameter(name = "stream", description = "娴乮d", required = true) + @Parameter(name = "mediaServerId", description = "濯掍綋鏈嶅姟鍣╥d") public WVPResult<StreamInfo> getPlayUrl(@RequestParam String app,@RequestParam String stream, @RequestParam(required = false) String mediaServerId){ boolean authority = false; @@ -297,12 +281,9 @@ * @param stream 鎺ㄦ祦淇℃伅 * @return */ - @ApiOperation("鑾峰彇鎺ㄦ祦鎾斁鍦板潃") - @ApiImplicitParams({ - @ApiImplicitParam(name = "stream", value = "鎺ㄦ祦淇℃伅", dataTypeClass = StreamPushItem.class), - }) @PostMapping(value = "/add") @ResponseBody + @Operation(summary = "鍋滄瑙嗛鍥炴斁") public WVPResult<StreamInfo> add(@RequestBody StreamPushItem stream){ if (StringUtils.isEmpty(stream.getGbId())) { diff --git a/src/main/java/com/genersoft/iot/vmp/vmanager/user/RoleController.java b/src/main/java/com/genersoft/iot/vmp/vmanager/user/RoleController.java index 887eb46..d4d5a2c 100644 --- a/src/main/java/com/genersoft/iot/vmp/vmanager/user/RoleController.java +++ b/src/main/java/com/genersoft/iot/vmp/vmanager/user/RoleController.java @@ -5,10 +5,10 @@ import com.genersoft.iot.vmp.storager.dao.dto.Role; import com.genersoft.iot.vmp.utils.DateUtil; import com.genersoft.iot.vmp.vmanager.bean.WVPResult; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiImplicitParams; -import io.swagger.annotations.ApiOperation; + +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.tags.Tag; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; @@ -16,7 +16,7 @@ import java.util.List; -@Api(tags = "瑙掕壊绠$悊") +@Tag(name = "瑙掕壊绠$悊") @CrossOrigin @RestController @RequestMapping("/api/role") @@ -25,12 +25,10 @@ @Autowired private IRoleService roleService; - @ApiOperation("娣诲姞瑙掕壊") - @ApiImplicitParams({ - @ApiImplicitParam(name = "name", required = true, value = "瑙掕壊鍚�", dataTypeClass = String.class), - @ApiImplicitParam(name = "authority", required = true, value = "鏉冮檺锛堣嚜琛屽畾涔夊唴瀹癸紝鐩墠鏈娇鐢級", dataTypeClass = String.class), - }) @PostMapping("/add") + @Operation(summary = "娣诲姞瑙掕壊") + @Parameter(name = "name", description = "瑙掕壊鍚�", required = true) + @Parameter(name = "authority", description = "鏉冮檺锛堣嚜琛屽畾涔夊唴瀹癸紝鐩墠鏈娇鐢級", required = true) public ResponseEntity<WVPResult<Integer>> add(@RequestParam String name, @RequestParam(required = false) String authority){ WVPResult<Integer> result = new WVPResult<>(); @@ -57,11 +55,9 @@ return new ResponseEntity<>(result, HttpStatus.OK); } - @ApiOperation("鍒犻櫎瑙掕壊") - @ApiImplicitParams({ - @ApiImplicitParam(name = "id", required = true, value = "鐢ㄦ埛Id", dataTypeClass = Integer.class), - }) @DeleteMapping("/delete") + @Operation(summary = "鍒犻櫎瑙掕壊") + @Parameter(name = "id", description = "鐢ㄦ埛Id", required = true) public ResponseEntity<WVPResult<String>> delete(@RequestParam Integer id){ // 鑾峰彇褰撳墠鐧诲綍鐢ㄦ埛id int currenRoleId = SecurityUtils.getUserInfo().getRole().getId(); @@ -79,9 +75,8 @@ return new ResponseEntity<>(result, HttpStatus.OK); } - @ApiOperation("鏌ヨ瑙掕壊") - @ApiImplicitParams({}) @GetMapping("/all") + @Operation(summary = "鏌ヨ瑙掕壊") public ResponseEntity<WVPResult<List<Role>>> all(){ // 鑾峰彇褰撳墠鐧诲綍鐢ㄦ埛id List<Role> allRoles = roleService.getAll(); diff --git a/src/main/java/com/genersoft/iot/vmp/vmanager/user/UserController.java b/src/main/java/com/genersoft/iot/vmp/vmanager/user/UserController.java index 442832b..d628d57 100644 --- a/src/main/java/com/genersoft/iot/vmp/vmanager/user/UserController.java +++ b/src/main/java/com/genersoft/iot/vmp/vmanager/user/UserController.java @@ -9,10 +9,10 @@ import com.genersoft.iot.vmp.utils.DateUtil; import com.genersoft.iot.vmp.vmanager.bean.WVPResult; import com.github.pagehelper.PageInfo; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiImplicitParams; -import io.swagger.annotations.ApiOperation; + +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.tags.Tag; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; @@ -24,7 +24,7 @@ import javax.security.sasl.AuthenticationException; import java.util.List; -@Api(tags = "鐢ㄦ埛绠$悊") +@Tag(name = "鐢ㄦ埛绠$悊") @CrossOrigin @RestController @RequestMapping("/api/user") @@ -39,12 +39,10 @@ @Autowired private IRoleService roleService; - @ApiOperation("鐧诲綍") - @ApiImplicitParams({ - @ApiImplicitParam(name = "username", required = true, value = "鐢ㄦ埛鍚�", dataTypeClass = String.class), - @ApiImplicitParam(name = "password", required = true, value = "瀵嗙爜锛�32浣峬d5鍔犲瘑锛�", dataTypeClass = String.class), - }) @GetMapping("/login") + @Operation(summary = "鐧诲綍") + @Parameter(name = "username", description = "鐢ㄦ埛鍚�", required = true) + @Parameter(name = "password", description = "瀵嗙爜锛�32浣峬d5鍔犲瘑锛�", required = true) public WVPResult<LoginUser> login(@RequestParam String username, @RequestParam String password){ LoginUser user = null; WVPResult<LoginUser> result = new WVPResult<>(); @@ -66,13 +64,11 @@ return result; } - @ApiOperation("淇敼瀵嗙爜") - @ApiImplicitParams({ - @ApiImplicitParam(name = "username", required = true, value = "鐢ㄦ埛鍚�", dataTypeClass = String.class), - @ApiImplicitParam(name = "oldpassword", required = true, value = "鏃у瘑鐮侊紙宸瞞d5鍔犲瘑鐨勫瘑鐮侊級", dataTypeClass = String.class), - @ApiImplicitParam(name = "password", required = true, value = "鏂板瘑鐮侊紙鏈猰d5鍔犲瘑鐨勫瘑鐮侊級", dataTypeClass = String.class), - }) @PostMapping("/changePassword") + @Operation(summary = "淇敼瀵嗙爜") + @Parameter(name = "username", description = "鐢ㄦ埛鍚�", required = true) + @Parameter(name = "oldpassword", description = "鏃у瘑鐮侊紙宸瞞d5鍔犲瘑鐨勫瘑鐮侊級", required = true) + @Parameter(name = "password", description = "鏂板瘑鐮侊紙鏈猰d5鍔犲瘑鐨勫瘑鐮侊級", required = true) public String changePassword(@RequestParam String oldPassword, @RequestParam String password){ // 鑾峰彇褰撳墠鐧诲綍鐢ㄦ埛id LoginUser userInfo = SecurityUtils.getUserInfo(); @@ -97,13 +93,11 @@ } - @ApiOperation("娣诲姞鐢ㄦ埛") - @ApiImplicitParams({ - @ApiImplicitParam(name = "username", required = true, value = "鐢ㄦ埛鍚�", dataTypeClass = String.class), - @ApiImplicitParam(name = "password", required = true, value = "瀵嗙爜锛堟湭md5鍔犲瘑鐨勫瘑鐮侊級", dataTypeClass = String.class), - @ApiImplicitParam(name = "roleId", required = true, value = "瑙掕壊ID", dataTypeClass = String.class), - }) @PostMapping("/add") + @Operation(summary = "鍋滄瑙嗛鍥炴斁") + @Parameter(name = "username", description = "鐢ㄦ埛鍚�", required = true) + @Parameter(name = "password", description = "瀵嗙爜锛堟湭md5鍔犲瘑鐨勫瘑鐮侊級", required = true) + @Parameter(name = "roleId", description = "瑙掕壊ID", required = true) public ResponseEntity<WVPResult<Integer>> add(@RequestParam String username, @RequestParam String password, @RequestParam Integer roleId){ @@ -146,11 +140,9 @@ return new ResponseEntity<>(result, HttpStatus.OK); } - @ApiOperation("鍒犻櫎鐢ㄦ埛") - @ApiImplicitParams({ - @ApiImplicitParam(name = "id", required = true, value = "鐢ㄦ埛Id", dataTypeClass = Integer.class), - }) - @DeleteMapping("/delete") + @DeleteMapping("/鍒犻櫎鐢ㄦ埛") + @Operation(summary = "鍋滄瑙嗛鍥炴斁") + @Parameter(name = "id", description = "鐢ㄦ埛Id", required = true) public ResponseEntity<WVPResult<String>> delete(@RequestParam Integer id){ // 鑾峰彇褰撳墠鐧诲綍鐢ㄦ埛id int currenRoleId = SecurityUtils.getUserInfo().getRole().getId(); @@ -168,9 +160,8 @@ return new ResponseEntity<>(result, HttpStatus.OK); } - @ApiOperation("鏌ヨ鐢ㄦ埛") - @ApiImplicitParams({}) @GetMapping("/all") + @Operation(summary = "鏌ヨ鐢ㄦ埛") public ResponseEntity<WVPResult<List<User>>> all(){ // 鑾峰彇褰撳墠鐧诲綍鐢ㄦ埛id List<User> allUsers = userService.getAllUsers(); @@ -188,22 +179,18 @@ * @param count 姣忛〉鏌ヨ鏁伴噺 * @return 鍒嗛〉鐢ㄦ埛鍒楄〃 */ - @ApiOperation("鍒嗛〉鏌ヨ鐢ㄦ埛") - @ApiImplicitParams({ - @ApiImplicitParam(name = "page", value = "褰撳墠椤�", required = true, dataTypeClass = Integer.class), - @ApiImplicitParam(name = "count", value = "姣忛〉鏌ヨ鏁伴噺", required = true, dataTypeClass = Integer.class), - }) @GetMapping("/users") + @Operation(summary = "鍒嗛〉鏌ヨ鐢ㄦ埛") + @Parameter(name = "page", description = "褰撳墠椤�", required = true) + @Parameter(name = "count", description = "姣忛〉鏌ヨ鏁伴噺", required = true) public PageInfo<User> users(int page, int count) { return userService.getUsers(page, count); } - @ApiOperation("淇敼pushkey") - @ApiImplicitParams({ - @ApiImplicitParam(name = "userId", required = true, value = "鐢ㄦ埛Id", dataTypeClass = Integer.class), - @ApiImplicitParam(name = "pushKey", required = true, value = "鏂扮殑pushKey", dataTypeClass = String.class), - }) @RequestMapping("/changePushKey") + @Operation(summary = "淇敼pushkey") + @Parameter(name = "userId", description = "鐢ㄦ埛Id", required = true) + @Parameter(name = "pushKey", description = "鏂扮殑pushKey", required = true) public ResponseEntity<WVPResult<String>> changePushKey(@RequestParam Integer userId,@RequestParam String pushKey) { // 鑾峰彇褰撳墠鐧诲綍鐢ㄦ埛id int currenRoleId = SecurityUtils.getUserInfo().getRole().getId(); @@ -221,13 +208,11 @@ return new ResponseEntity<>(result, HttpStatus.OK); } - @ApiOperation("绠$悊鍛樹慨鏀规櫘閫氱敤鎴峰瘑鐮�") - @ApiImplicitParams({ - @ApiImplicitParam(name = "adminId", required = true, value = "绠$悊鍛榠d", dataTypeClass = String.class), - @ApiImplicitParam(name = "userId", required = true, value = "鐢ㄦ埛id", dataTypeClass = String.class), - @ApiImplicitParam(name = "password", required = true, value = "鏂板瘑鐮侊紙鏈猰d5鍔犲瘑鐨勫瘑鐮侊級", dataTypeClass = String.class), - }) @PostMapping("/changePasswordForAdmin") + @Operation(summary = "绠$悊鍛樹慨鏀规櫘閫氱敤鎴峰瘑鐮�") + @Parameter(name = "adminId", description = "绠$悊鍛榠d", required = true) + @Parameter(name = "userId", description = "鐢ㄦ埛id", required = true) + @Parameter(name = "password", description = "鏂板瘑鐮侊紙鏈猰d5鍔犲瘑鐨勫瘑鐮侊級", required = true) public String changePasswordForAdmin(@RequestParam int userId, @RequestParam String password) { // 鑾峰彇褰撳墠鐧诲綍鐢ㄦ埛id LoginUser userInfo = SecurityUtils.getUserInfo(); diff --git a/src/main/resources/all-application.yml b/src/main/resources/all-application.yml index 1bea065..c9e4895 100644 --- a/src/main/resources/all-application.yml +++ b/src/main/resources/all-application.yml @@ -187,7 +187,7 @@ logInDatebase: true # 鍦ㄧ嚎鏂囨。锛� swagger-ui锛堢敓浜х幆澧冨缓璁叧闂級 -swagger-ui: +doc: enabled: true # 鐗堟湰淇℃伅锛� 涓嶉渶淇敼 diff --git a/src/main/resources/application-docker.yml b/src/main/resources/application-docker.yml index 53a8635..ecd9738 100644 --- a/src/main/resources/application-docker.yml +++ b/src/main/resources/application-docker.yml @@ -80,7 +80,7 @@ auto-apply-play: true # 鍦ㄧ嚎鏂囨。锛� swagger-ui锛堢敓浜х幆澧冨缓璁叧闂級 -swagger-ui: +doc: enabled: true # 鐗堟湰淇℃伅锛� 涓嶉渶淇敼 diff --git a/src/test/java/com/genersoft/iot/vmp/service/impl/DeviceAlarmServiceImplTest.java b/src/test/java/com/genersoft/iot/vmp/service/impl/DeviceAlarmServiceImplTest.java deleted file mode 100644 index c627511..0000000 --- a/src/test/java/com/genersoft/iot/vmp/service/impl/DeviceAlarmServiceImplTest.java +++ /dev/null @@ -1,120 +0,0 @@ -package com.genersoft.iot.vmp.service.impl; - -import com.genersoft.iot.vmp.gb28181.bean.DeviceAlarm; -import com.genersoft.iot.vmp.service.IDeviceAlarmService; -import com.genersoft.iot.vmp.utils.DateUtil; -import org.junit.runner.RunWith; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; - -import javax.annotation.Resource; -import java.time.Instant; -import java.time.LocalDateTime; -import java.time.ZoneOffset; -import java.time.temporal.TemporalAccessor; -import java.util.Date; - - -@SpringBootTest -@RunWith(SpringRunner.class) -class DeviceAlarmServiceImplTest { - - @Resource - private IDeviceAlarmService deviceAlarmService; - - @org.junit.jupiter.api.Test - void getAllAlarm() { -// deviceAlarmService.getAllAlarm(0, 10000, "11111111111111111111",null,null,null, null, null); -// System.out.println(deviceAlarmService.getAllAlarm(0, 10000, null, null, null, null, -// null, null).getSize()); -// -// System.out.println(deviceAlarmService.getAllAlarm(0, 10000, "11111111111111111111", null, null, null, -// null, null).getSize()); -// -// System.out.println(deviceAlarmService.getAllAlarm(0, 10000, "11111111111111111111", "1", null, null, -// null, null).getSize()); -// -// System.out.println(deviceAlarmService.getAllAlarm(0, 10000, "11111111111111111111", "2", null, null, -// null, null).getSize()); -// -// System.out.println(deviceAlarmService.getAllAlarm(0, 10000, "11111111111111111111", "3", null, null, -// null, null).getSize()); -// -// System.out.println(deviceAlarmService.getAllAlarm(0, 10000, "11111111111111111111", "4", null, null, -// null, null).getSize()); -// -// System.out.println(deviceAlarmService.getAllAlarm(0, 10000, "11111111111111111111", "5", null, null, -// null, null).getSize()); -// -// System.out.println(deviceAlarmService.getAllAlarm(0, 10000, "11111111111111111111", null, "1", null, -// null, null).getSize()); - -// System.out.println(deviceAlarmService.getAllAlarm(0, 10000, "11111111111111111111", null, "1", null, -// null, null).getSize()); - - - } - - - @org.junit.jupiter.api.Test - void add() { - for (int i = 0; i < 1000; i++) { - DeviceAlarm deviceAlarm = new DeviceAlarm(); - deviceAlarm.setDeviceId("11111111111111111111"); - deviceAlarm.setAlarmDescription("test_" + i); - - /** - * 鎶ヨ鏂瑰紡 , 1涓虹數璇濇姤璀�, 2涓鸿澶囨姤璀�, 3涓虹煭淇℃姤璀�, 4涓� GPS鎶ヨ, 5涓鸿棰戞姤璀�, 6涓鸿澶囨晠闅滄姤璀�, - * * 7鍏朵粬鎶ヨ;鍙互涓虹洿鎺ョ粍鍚堝12涓虹數璇濇姤璀︽垨 璁惧鎶ヨ- - */ - deviceAlarm.setAlarmMethod((int)(Math.random()*7 + 1) + ""); - Instant date = randomDate("2021-01-01 00:00:00", "2021-06-01 00:00:00"); - deviceAlarm.setAlarmTime(DateUtil.formatter.format(date)); - /** - * 鎶ヨ绾у埆, 1涓轰竴绾ц鎯�, 2涓轰簩绾ц鎯�, 3涓轰笁绾ц鎯�, 4涓哄洓绾� 璀︽儏- - */ - deviceAlarm.setAlarmPriority((int)(Math.random()*4 + 1) + ""); - deviceAlarm.setLongitude(116.325); - deviceAlarm.setLatitude(39.562); - deviceAlarmService.add(deviceAlarm); - } - - } - - @org.junit.jupiter.api.Test - void clearAlarmBeforeTime() { - deviceAlarmService.clearAlarmBeforeTime(null,null, null); - } - - - - - private Instant randomDate(String beginDate, String endDate) { - try { - - //鏋勯�犲紑濮嬫棩鏈� - LocalDateTime start = LocalDateTime.parse(beginDate, DateUtil.formatter); - - //鏋勯�犵粨鏉熸棩鏈� - LocalDateTime end = LocalDateTime.parse(endDate, DateUtil.formatter); - //getTime()琛ㄧず杩斿洖鑷� 1970 骞� 1 鏈� 1 鏃� 00:00:00 GMT 浠ユ潵姝� Date 瀵硅薄琛ㄧず鐨勬绉掓暟銆� - if (start.isAfter(end)) { - return null; - } - long date = random(start.toInstant(ZoneOffset.of("+8")).toEpochMilli(), end.toInstant(ZoneOffset.of("+8")).toEpochMilli()); - return Instant.ofEpochMilli(date); - } catch (Exception e) { - e.printStackTrace(); - } - return null; - } - - private static long random(long begin, long end) { - long rtn = begin + (long) (Math.random() * (end - begin)); - //濡傛灉杩斿洖鐨勬槸寮�濮嬫椂闂村拰缁撴潫鏃堕棿锛屽垯閫掑綊璋冪敤鏈嚱鏁版煡鎵鹃殢鏈哄�� - if (rtn == begin || rtn == end) { - return random(begin, end); - } - return rtn; - } -} \ No newline at end of file diff --git a/src/test/java/com/genersoft/iot/vmp/service/impl/RoleServiceImplTest.java b/src/test/java/com/genersoft/iot/vmp/service/impl/RoleServiceImplTest.java deleted file mode 100644 index 02dedcf..0000000 --- a/src/test/java/com/genersoft/iot/vmp/service/impl/RoleServiceImplTest.java +++ /dev/null @@ -1,56 +0,0 @@ -package com.genersoft.iot.vmp.service.impl; - -import com.genersoft.iot.vmp.service.IRoleService; -import com.genersoft.iot.vmp.service.IUserService; -import com.genersoft.iot.vmp.storager.dao.dto.Role; -import com.genersoft.iot.vmp.storager.dao.dto.User; -import com.genersoft.iot.vmp.utils.DateUtil; -import org.junit.runner.RunWith; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; - -import javax.annotation.Resource; -import java.util.List; - - -@SpringBootTest -@RunWith(SpringRunner.class) -class RoleServiceImplTest { - - @Resource - private IRoleService roleService; - - @org.junit.jupiter.api.Test - void getAllUser() { - List<Role> all = roleService.getAll(); - Role roleById = roleService.getRoleById(1); - - } - - - @org.junit.jupiter.api.Test - void add() { - for (int i = 0; i < 10; i++) { - Role role = new Role(); - role.setName("test+" + i); - role.setAuthority("adadadda"); - role.setCreateTime(DateUtil.getNow()); - role.setUpdateTime(DateUtil.getNow()); - roleService.add(role); - } - } - - @org.junit.jupiter.api.Test - void delete() { - roleService.delete(20); - } - - @org.junit.jupiter.api.Test - void update() { - Role role = new Role(); - role.setId(21); - role.setName("TTTTTT"); - role.setAuthority("adadadda"); - roleService.update(role); - } -} \ No newline at end of file diff --git a/src/test/java/com/genersoft/iot/vmp/service/impl/UserServiceImplTest.java b/src/test/java/com/genersoft/iot/vmp/service/impl/UserServiceImplTest.java deleted file mode 100644 index 3f902dc..0000000 --- a/src/test/java/com/genersoft/iot/vmp/service/impl/UserServiceImplTest.java +++ /dev/null @@ -1,66 +0,0 @@ -package com.genersoft.iot.vmp.service.impl; - -import com.genersoft.iot.vmp.service.IUserService; -import com.genersoft.iot.vmp.storager.dao.dto.Role; -import com.genersoft.iot.vmp.storager.dao.dto.User; -import com.genersoft.iot.vmp.utils.DateUtil; -import org.junit.runner.RunWith; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; - -import javax.annotation.Resource; -import java.util.List; - - -@SpringBootTest -@RunWith(SpringRunner.class) -class UserServiceImplTest { - - @Resource - private IUserService userService; - - - @org.junit.jupiter.api.Test - void getAllUser() { - List<User> allUsers = userService.getAllUsers(); - User admin = userService.getUser("admin", "21232f297a57a5a743894a0e4a801fc3"); - User admin1 = userService.getUserByUsername("admin"); - } - - - @org.junit.jupiter.api.Test - void add() { - for (int i = 0; i < 10; i++) { - User user = new User(); - user.setUsername("admin_" + i); - user.setPassword("admin_password_" + i); - - Role role = new Role(); - role.setId(1); - user.setRole(role); - user.setCreateTime(DateUtil.getNow()); - user.setUpdateTime(DateUtil.getNow()); - userService.addUser(user); - } - } - - @org.junit.jupiter.api.Test - void delete() { - userService.deleteUser(1002); - } - - @org.junit.jupiter.api.Test - void update() { - User user = new User(); - user.setId(11); - user.setUsername("update" ); - user.setPassword("update"); - Role role = new Role(); - role.setId(2); - user.setRole(role); - user.setUpdateTime(DateUtil.getNow()); - userService.updateUsers(user); - } - - -} \ No newline at end of file -- Gitblit v1.8.0