Commit a59095db0c240987028d4d05ab561665ed8fe7ea
Committed by
GitHub
Merge branch '648540858:wvp-28181-2.0' into wvp-28181-2.0
Showing
56 changed files
with
1293 additions
and
926 deletions
pom.xml
| ... | ... | @@ -61,6 +61,13 @@ |
| 61 | 61 | <dependency> |
| 62 | 62 | <groupId>org.springframework.boot</groupId> |
| 63 | 63 | <artifactId>spring-boot-starter-data-redis</artifactId> |
| 64 | + <exclusions> | |
| 65 | + <!-- 去掉 Lettuce 的依赖, Spring Boot 优先使用 Lettuce 作为 Redis 客户端 --> | |
| 66 | + <exclusion> | |
| 67 | + <groupId>io.lettuce</groupId> | |
| 68 | + <artifactId>lettuce-core</artifactId> | |
| 69 | + </exclusion> | |
| 70 | + </exclusions> | |
| 64 | 71 | </dependency> |
| 65 | 72 | <dependency> |
| 66 | 73 | <groupId>org.springframework.boot</groupId> |
| ... | ... | @@ -75,6 +82,12 @@ |
| 75 | 82 | <groupId>org.mybatis.spring.boot</groupId> |
| 76 | 83 | <artifactId>mybatis-spring-boot-starter</artifactId> |
| 77 | 84 | <version>2.1.4</version> |
| 85 | + <exclusions> | |
| 86 | + <exclusion> | |
| 87 | + <groupId>com.zaxxer</groupId> | |
| 88 | + <artifactId>HikariCP</artifactId> | |
| 89 | + </exclusion> | |
| 90 | + </exclusions> | |
| 78 | 91 | </dependency> |
| 79 | 92 | <dependency> |
| 80 | 93 | <groupId>org.springframework.boot</groupId> |
| ... | ... | @@ -84,7 +97,6 @@ |
| 84 | 97 | <dependency> |
| 85 | 98 | <groupId>redis.clients</groupId> |
| 86 | 99 | <artifactId>jedis</artifactId> |
| 87 | - <version>${jedis-version}</version> | |
| 88 | 100 | </dependency> |
| 89 | 101 | |
| 90 | 102 | <!-- druid数据库连接池 --> | ... | ... |
sql/mysql.sql
| ... | ... | @@ -2,55 +2,60 @@ |
| 2 | 2 | -- |
| 3 | 3 | -- Host: 127.0.0.1 Database: wvp2 |
| 4 | 4 | -- ------------------------------------------------------ |
| 5 | --- Server version 8.0.29-0ubuntu0.22.04.2 | |
| 5 | +-- Server version 8.0.29-0ubuntu0.22.04.3 | |
| 6 | 6 | |
| 7 | -/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; | |
| 8 | -/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; | |
| 9 | -/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; | |
| 7 | +/*!40101 SET @OLD_CHARACTER_SET_CLIENT = @@CHARACTER_SET_CLIENT */; | |
| 8 | +/*!40101 SET @OLD_CHARACTER_SET_RESULTS = @@CHARACTER_SET_RESULTS */; | |
| 9 | +/*!40101 SET @OLD_COLLATION_CONNECTION = @@COLLATION_CONNECTION */; | |
| 10 | 10 | /*!50503 SET NAMES utf8mb4 */; |
| 11 | -/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; | |
| 12 | -/*!40103 SET TIME_ZONE='+00:00' */; | |
| 13 | -/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; | |
| 14 | -/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; | |
| 15 | -/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; | |
| 16 | -/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; | |
| 11 | +/*!40103 SET @OLD_TIME_ZONE = @@TIME_ZONE */; | |
| 12 | +/*!40103 SET TIME_ZONE = ' + 00:00' */; | |
| 13 | +/*!40014 SET @OLD_UNIQUE_CHECKS = @@UNIQUE_CHECKS, UNIQUE_CHECKS = 0 */; | |
| 14 | +/*!40014 SET @OLD_FOREIGN_KEY_CHECKS = @@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS = 0 */; | |
| 15 | +/*!40101 SET @OLD_SQL_MODE = @@SQL_MODE, SQL_MODE = 'NO_AUTO_VALUE_ON_ZERO' */; | |
| 16 | +/*!40111 SET @OLD_SQL_NOTES = @@SQL_NOTES, SQL_NOTES = 0 */; | |
| 17 | 17 | |
| 18 | 18 | -- |
| 19 | 19 | -- Table structure for table `device` |
| 20 | 20 | -- |
| 21 | 21 | |
| 22 | 22 | DROP TABLE IF EXISTS `device`; |
| 23 | -/*!40101 SET @saved_cs_client = @@character_set_client */; | |
| 23 | +/*!40101 SET @saved_cs_client = @@character_set_client */; | |
| 24 | 24 | /*!50503 SET character_set_client = utf8mb4 */; |
| 25 | -CREATE TABLE `device` ( | |
| 26 | - `id` int NOT NULL AUTO_INCREMENT, | |
| 27 | - `deviceId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, | |
| 28 | - `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, | |
| 29 | - `manufacturer` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, | |
| 30 | - `model` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, | |
| 31 | - `firmware` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, | |
| 32 | - `transport` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, | |
| 33 | - `streamMode` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, | |
| 34 | - `online` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, | |
| 35 | - `registerTime` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, | |
| 36 | - `keepaliveTime` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, | |
| 37 | - `ip` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, | |
| 38 | - `createTime` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, | |
| 39 | - `updateTime` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, | |
| 40 | - `port` int NOT NULL, | |
| 41 | - `expires` int NOT NULL, | |
| 42 | - `subscribeCycleForCatalog` int NOT NULL, | |
| 43 | - `hostAddress` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, | |
| 44 | - `charset` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, | |
| 45 | - `subscribeCycleForMobilePosition` int DEFAULT NULL, | |
| 46 | - `mobilePositionSubmissionInterval` int DEFAULT '5', | |
| 47 | - `subscribeCycleForAlarm` int DEFAULT NULL, | |
| 48 | - `ssrcCheck` int DEFAULT '0', | |
| 49 | - `geoCoordSys` varchar(50) COLLATE utf8mb4_general_ci NOT NULL, | |
| 50 | - `treeType` varchar(50) COLLATE utf8mb4_general_ci NOT NULL, | |
| 51 | - PRIMARY KEY (`id`) USING BTREE, | |
| 52 | - UNIQUE KEY `device_deviceId_uindex` (`deviceId`) USING BTREE | |
| 53 | -) ENGINE=InnoDB AUTO_INCREMENT=45 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC; | |
| 25 | +CREATE TABLE `device` | |
| 26 | +( | |
| 27 | + `id` int NOT NULL AUTO_INCREMENT, | |
| 28 | + `deviceId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, | |
| 29 | + `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, | |
| 30 | + `manufacturer` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, | |
| 31 | + `model` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, | |
| 32 | + `firmware` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, | |
| 33 | + `transport` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, | |
| 34 | + `streamMode` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, | |
| 35 | + `online` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, | |
| 36 | + `registerTime` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, | |
| 37 | + `keepaliveTime` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, | |
| 38 | + `ip` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, | |
| 39 | + `createTime` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, | |
| 40 | + `updateTime` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, | |
| 41 | + `port` int NOT NULL, | |
| 42 | + `expires` int NOT NULL, | |
| 43 | + `subscribeCycleForCatalog` int NOT NULL, | |
| 44 | + `hostAddress` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, | |
| 45 | + `charset` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, | |
| 46 | + `subscribeCycleForMobilePosition` int DEFAULT NULL, | |
| 47 | + `mobilePositionSubmissionInterval` int DEFAULT '5 ', | |
| 48 | + `subscribeCycleForAlarm` int DEFAULT NULL, | |
| 49 | + `ssrcCheck` int DEFAULT '0 ', | |
| 50 | + `geoCoordSys` varchar(50) COLLATE utf8mb4_general_ci NOT NULL, | |
| 51 | + `treeType` varchar(50) COLLATE utf8mb4_general_ci NOT NULL, | |
| 52 | + PRIMARY KEY (`id`) USING BTREE, | |
| 53 | + UNIQUE KEY `device_deviceId_uindex` (`deviceId`) USING BTREE | |
| 54 | +) ENGINE = InnoDB | |
| 55 | + AUTO_INCREMENT = 53 | |
| 56 | + DEFAULT CHARSET = utf8mb4 | |
| 57 | + COLLATE = utf8mb4_general_ci | |
| 58 | + ROW_FORMAT = DYNAMIC; | |
| 54 | 59 | /*!40101 SET character_set_client = @saved_cs_client */; |
| 55 | 60 | |
| 56 | 61 | -- |
| ... | ... | @@ -58,8 +63,10 @@ CREATE TABLE `device` ( |
| 58 | 63 | -- |
| 59 | 64 | |
| 60 | 65 | LOCK TABLES `device` WRITE; |
| 61 | -/*!40000 ALTER TABLE `device` DISABLE KEYS */; | |
| 62 | -/*!40000 ALTER TABLE `device` ENABLE KEYS */; | |
| 66 | +/*!40000 ALTER TABLE `device` | |
| 67 | + DISABLE KEYS */; | |
| 68 | +/*!40000 ALTER TABLE `device` | |
| 69 | + ENABLE KEYS */; | |
| 63 | 70 | UNLOCK TABLES; |
| 64 | 71 | |
| 65 | 72 | -- |
| ... | ... | @@ -67,22 +74,26 @@ UNLOCK TABLES; |
| 67 | 74 | -- |
| 68 | 75 | |
| 69 | 76 | DROP TABLE IF EXISTS `device_alarm`; |
| 70 | -/*!40101 SET @saved_cs_client = @@character_set_client */; | |
| 77 | +/*!40101 SET @saved_cs_client = @@character_set_client */; | |
| 71 | 78 | /*!50503 SET character_set_client = utf8mb4 */; |
| 72 | -CREATE TABLE `device_alarm` ( | |
| 73 | - `id` int NOT NULL AUTO_INCREMENT, | |
| 74 | - `deviceId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, | |
| 75 | - `channelId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, | |
| 76 | - `alarmPriority` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, | |
| 77 | - `alarmMethod` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, | |
| 78 | - `alarmTime` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, | |
| 79 | - `alarmDescription` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, | |
| 80 | - `longitude` double DEFAULT NULL, | |
| 81 | - `latitude` double DEFAULT NULL, | |
| 82 | - `alarmType` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, | |
| 83 | - `createTime` varchar(50) COLLATE utf8mb4_general_ci DEFAULT NULL, | |
| 84 | - PRIMARY KEY (`id`) USING BTREE | |
| 85 | -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC; | |
| 79 | +CREATE TABLE `device_alarm` | |
| 80 | +( | |
| 81 | + `id` int NOT NULL AUTO_INCREMENT, | |
| 82 | + `deviceId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, | |
| 83 | + `channelId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, | |
| 84 | + `alarmPriority` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, | |
| 85 | + `alarmMethod` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, | |
| 86 | + `alarmTime` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, | |
| 87 | + `alarmDescription` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, | |
| 88 | + `longitude` double DEFAULT NULL, | |
| 89 | + `latitude` double DEFAULT NULL, | |
| 90 | + `alarmType` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, | |
| 91 | + `createTime` varchar(50) COLLATE utf8mb4_general_ci DEFAULT NULL, | |
| 92 | + PRIMARY KEY (`id`) USING BTREE | |
| 93 | +) ENGINE = InnoDB | |
| 94 | + DEFAULT CHARSET = utf8mb4 | |
| 95 | + COLLATE = utf8mb4_general_ci | |
| 96 | + ROW_FORMAT = DYNAMIC; | |
| 86 | 97 | /*!40101 SET character_set_client = @saved_cs_client */; |
| 87 | 98 | |
| 88 | 99 | -- |
| ... | ... | @@ -90,8 +101,10 @@ CREATE TABLE `device_alarm` ( |
| 90 | 101 | -- |
| 91 | 102 | |
| 92 | 103 | LOCK TABLES `device_alarm` WRITE; |
| 93 | -/*!40000 ALTER TABLE `device_alarm` DISABLE KEYS */; | |
| 94 | -/*!40000 ALTER TABLE `device_alarm` ENABLE KEYS */; | |
| 104 | +/*!40000 ALTER TABLE `device_alarm` | |
| 105 | + DISABLE KEYS */; | |
| 106 | +/*!40000 ALTER TABLE `device_alarm` | |
| 107 | + ENABLE KEYS */; | |
| 95 | 108 | UNLOCK TABLES; |
| 96 | 109 | |
| 97 | 110 | -- |
| ... | ... | @@ -99,50 +112,55 @@ UNLOCK TABLES; |
| 99 | 112 | -- |
| 100 | 113 | |
| 101 | 114 | DROP TABLE IF EXISTS `device_channel`; |
| 102 | -/*!40101 SET @saved_cs_client = @@character_set_client */; | |
| 115 | +/*!40101 SET @saved_cs_client = @@character_set_client */; | |
| 103 | 116 | /*!50503 SET character_set_client = utf8mb4 */; |
| 104 | -CREATE TABLE `device_channel` ( | |
| 105 | - `id` int NOT NULL AUTO_INCREMENT, | |
| 106 | - `channelId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, | |
| 107 | - `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, | |
| 108 | - `manufacture` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, | |
| 109 | - `model` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, | |
| 110 | - `owner` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, | |
| 111 | - `civilCode` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, | |
| 112 | - `block` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, | |
| 113 | - `address` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, | |
| 114 | - `parentId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, | |
| 115 | - `safetyWay` int DEFAULT NULL, | |
| 116 | - `registerWay` int DEFAULT NULL, | |
| 117 | - `certNum` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, | |
| 118 | - `certifiable` int DEFAULT NULL, | |
| 119 | - `errCode` int DEFAULT NULL, | |
| 120 | - `endTime` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, | |
| 121 | - `secrecy` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, | |
| 122 | - `ipAddress` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, | |
| 123 | - `port` int DEFAULT NULL, | |
| 124 | - `password` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, | |
| 125 | - `PTZType` int DEFAULT NULL, | |
| 126 | - `status` int DEFAULT NULL, | |
| 127 | - `longitude` double DEFAULT NULL, | |
| 128 | - `latitude` double DEFAULT NULL, | |
| 129 | - `streamId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, | |
| 130 | - `deviceId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, | |
| 131 | - `parental` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, | |
| 132 | - `hasAudio` bit(1) DEFAULT NULL, | |
| 133 | - `createTime` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, | |
| 134 | - `updateTime` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, | |
| 135 | - `subCount` int DEFAULT '0', | |
| 136 | - `longitudeGcj02` double DEFAULT NULL, | |
| 137 | - `latitudeGcj02` double DEFAULT NULL, | |
| 138 | - `longitudeWgs84` double DEFAULT NULL, | |
| 139 | - `latitudeWgs84` double DEFAULT NULL, | |
| 140 | - `businessGroupId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, | |
| 141 | - `gpsTime` varchar(50) COLLATE utf8mb4_general_ci DEFAULT NULL, | |
| 142 | - PRIMARY KEY (`id`) USING BTREE, | |
| 143 | - UNIQUE KEY `device_channel_id_uindex` (`id`) USING BTREE, | |
| 144 | - UNIQUE KEY `device_channel_pk` (`channelId`,`deviceId`) USING BTREE | |
| 145 | -) ENGINE=InnoDB AUTO_INCREMENT=19336 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC; | |
| 117 | +CREATE TABLE `device_channel` | |
| 118 | +( | |
| 119 | + `id` int NOT NULL AUTO_INCREMENT, | |
| 120 | + `channelId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, | |
| 121 | + `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, | |
| 122 | + `manufacture` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, | |
| 123 | + `model` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, | |
| 124 | + `owner` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, | |
| 125 | + `civilCode` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, | |
| 126 | + `block` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, | |
| 127 | + `address` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, | |
| 128 | + `parentId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, | |
| 129 | + `safetyWay` int DEFAULT NULL, | |
| 130 | + `registerWay` int DEFAULT NULL, | |
| 131 | + `certNum` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, | |
| 132 | + `certifiable` int DEFAULT NULL, | |
| 133 | + `errCode` int DEFAULT NULL, | |
| 134 | + `endTime` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, | |
| 135 | + `secrecy` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, | |
| 136 | + `ipAddress` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, | |
| 137 | + `port` int DEFAULT NULL, | |
| 138 | + `password` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, | |
| 139 | + `PTZType` int DEFAULT NULL, | |
| 140 | + `status` int DEFAULT NULL, | |
| 141 | + `longitude` double DEFAULT NULL, | |
| 142 | + `latitude` double DEFAULT NULL, | |
| 143 | + `streamId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, | |
| 144 | + `deviceId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, | |
| 145 | + `parental` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, | |
| 146 | + `hasAudio` bit(1) DEFAULT NULL, | |
| 147 | + `createTime` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, | |
| 148 | + `updateTime` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, | |
| 149 | + `subCount` int DEFAULT '0 ', | |
| 150 | + `longitudeGcj02` double DEFAULT NULL, | |
| 151 | + `latitudeGcj02` double DEFAULT NULL, | |
| 152 | + `longitudeWgs84` double DEFAULT NULL, | |
| 153 | + `latitudeWgs84` double DEFAULT NULL, | |
| 154 | + `businessGroupId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, | |
| 155 | + `gpsTime` varchar(50) COLLATE utf8mb4_general_ci DEFAULT NULL, | |
| 156 | + PRIMARY KEY (`id`) USING BTREE, | |
| 157 | + UNIQUE KEY `device_channel_id_uindex` (`id`) USING BTREE, | |
| 158 | + UNIQUE KEY `device_channel_pk` (`channelId`, `deviceId`) USING BTREE | |
| 159 | +) ENGINE = InnoDB | |
| 160 | + AUTO_INCREMENT = 19496 | |
| 161 | + DEFAULT CHARSET = utf8mb4 | |
| 162 | + COLLATE = utf8mb4_general_ci | |
| 163 | + ROW_FORMAT = DYNAMIC; | |
| 146 | 164 | /*!40101 SET character_set_client = @saved_cs_client */; |
| 147 | 165 | |
| 148 | 166 | -- |
| ... | ... | @@ -150,8 +168,10 @@ CREATE TABLE `device_channel` ( |
| 150 | 168 | -- |
| 151 | 169 | |
| 152 | 170 | LOCK TABLES `device_channel` WRITE; |
| 153 | -/*!40000 ALTER TABLE `device_channel` DISABLE KEYS */; | |
| 154 | -/*!40000 ALTER TABLE `device_channel` ENABLE KEYS */; | |
| 171 | +/*!40000 ALTER TABLE `device_channel` | |
| 172 | + DISABLE KEYS */; | |
| 173 | +/*!40000 ALTER TABLE `device_channel` | |
| 174 | + ENABLE KEYS */; | |
| 155 | 175 | UNLOCK TABLES; |
| 156 | 176 | |
| 157 | 177 | -- |
| ... | ... | @@ -159,27 +179,32 @@ UNLOCK TABLES; |
| 159 | 179 | -- |
| 160 | 180 | |
| 161 | 181 | DROP TABLE IF EXISTS `device_mobile_position`; |
| 162 | -/*!40101 SET @saved_cs_client = @@character_set_client */; | |
| 182 | +/*!40101 SET @saved_cs_client = @@character_set_client */; | |
| 163 | 183 | /*!50503 SET character_set_client = utf8mb4 */; |
| 164 | -CREATE TABLE `device_mobile_position` ( | |
| 165 | - `id` int NOT NULL AUTO_INCREMENT, | |
| 166 | - `deviceId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, | |
| 167 | - `channelId` varchar(50) COLLATE utf8mb4_general_ci DEFAULT NULL, | |
| 168 | - `deviceName` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, | |
| 169 | - `time` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, | |
| 170 | - `longitude` double NOT NULL, | |
| 171 | - `latitude` double NOT NULL, | |
| 172 | - `altitude` double DEFAULT NULL, | |
| 173 | - `speed` double DEFAULT NULL, | |
| 174 | - `direction` double DEFAULT NULL, | |
| 175 | - `reportSource` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, | |
| 176 | - `longitudeGcj02` double DEFAULT NULL, | |
| 177 | - `latitudeGcj02` double DEFAULT NULL, | |
| 178 | - `longitudeWgs84` double DEFAULT NULL, | |
| 179 | - `latitudeWgs84` double DEFAULT NULL, | |
| 180 | - `createTime` varchar(50) COLLATE utf8mb4_general_ci DEFAULT NULL, | |
| 181 | - PRIMARY KEY (`id`) USING BTREE | |
| 182 | -) ENGINE=InnoDB AUTO_INCREMENT=6751 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC; | |
| 184 | +CREATE TABLE `device_mobile_position` | |
| 185 | +( | |
| 186 | + `id` int NOT NULL AUTO_INCREMENT, | |
| 187 | + `deviceId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, | |
| 188 | + `channelId` varchar(50) COLLATE utf8mb4_general_ci DEFAULT NULL, | |
| 189 | + `deviceName` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, | |
| 190 | + `time` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, | |
| 191 | + `longitude` double NOT NULL, | |
| 192 | + `latitude` double NOT NULL, | |
| 193 | + `altitude` double DEFAULT NULL, | |
| 194 | + `speed` double DEFAULT NULL, | |
| 195 | + `direction` double DEFAULT NULL, | |
| 196 | + `reportSource` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, | |
| 197 | + `longitudeGcj02` double DEFAULT NULL, | |
| 198 | + `latitudeGcj02` double DEFAULT NULL, | |
| 199 | + `longitudeWgs84` double DEFAULT NULL, | |
| 200 | + `latitudeWgs84` double DEFAULT NULL, | |
| 201 | + `createTime` varchar(50) COLLATE utf8mb4_general_ci DEFAULT NULL, | |
| 202 | + PRIMARY KEY (`id`) USING BTREE | |
| 203 | +) ENGINE = InnoDB | |
| 204 | + AUTO_INCREMENT = 6956 | |
| 205 | + DEFAULT CHARSET = utf8mb4 | |
| 206 | + COLLATE = utf8mb4_general_ci | |
| 207 | + ROW_FORMAT = DYNAMIC; | |
| 183 | 208 | /*!40101 SET character_set_client = @saved_cs_client */; |
| 184 | 209 | |
| 185 | 210 | -- |
| ... | ... | @@ -187,8 +212,10 @@ CREATE TABLE `device_mobile_position` ( |
| 187 | 212 | -- |
| 188 | 213 | |
| 189 | 214 | LOCK TABLES `device_mobile_position` WRITE; |
| 190 | -/*!40000 ALTER TABLE `device_mobile_position` DISABLE KEYS */; | |
| 191 | -/*!40000 ALTER TABLE `device_mobile_position` ENABLE KEYS */; | |
| 215 | +/*!40000 ALTER TABLE `device_mobile_position` | |
| 216 | + DISABLE KEYS */; | |
| 217 | +/*!40000 ALTER TABLE `device_mobile_position` | |
| 218 | + ENABLE KEYS */; | |
| 192 | 219 | UNLOCK TABLES; |
| 193 | 220 | |
| 194 | 221 | -- |
| ... | ... | @@ -196,24 +223,29 @@ UNLOCK TABLES; |
| 196 | 223 | -- |
| 197 | 224 | |
| 198 | 225 | DROP TABLE IF EXISTS `gb_stream`; |
| 199 | -/*!40101 SET @saved_cs_client = @@character_set_client */; | |
| 226 | +/*!40101 SET @saved_cs_client = @@character_set_client */; | |
| 200 | 227 | /*!50503 SET character_set_client = utf8mb4 */; |
| 201 | -CREATE TABLE `gb_stream` ( | |
| 202 | - `gbStreamId` int NOT NULL AUTO_INCREMENT, | |
| 203 | - `app` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, | |
| 204 | - `stream` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, | |
| 205 | - `gbId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, | |
| 206 | - `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, | |
| 207 | - `longitude` double DEFAULT NULL, | |
| 208 | - `latitude` double DEFAULT NULL, | |
| 209 | - `streamType` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, | |
| 210 | - `mediaServerId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, | |
| 211 | - `createTime` varchar(50) COLLATE utf8mb4_general_ci DEFAULT NULL, | |
| 212 | - `gpsTime` varchar(50) COLLATE utf8mb4_general_ci DEFAULT NULL, | |
| 213 | - PRIMARY KEY (`gbStreamId`) USING BTREE, | |
| 214 | - UNIQUE KEY `app` (`app`,`stream`) USING BTREE, | |
| 215 | - UNIQUE KEY `gbId` (`gbId`) USING BTREE | |
| 216 | -) ENGINE=InnoDB AUTO_INCREMENT=301740 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC; | |
| 228 | +CREATE TABLE `gb_stream` | |
| 229 | +( | |
| 230 | + `gbStreamId` int NOT NULL AUTO_INCREMENT, | |
| 231 | + `app` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, | |
| 232 | + `stream` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, | |
| 233 | + `gbId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, | |
| 234 | + `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, | |
| 235 | + `longitude` double DEFAULT NULL, | |
| 236 | + `latitude` double DEFAULT NULL, | |
| 237 | + `streamType` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, | |
| 238 | + `mediaServerId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, | |
| 239 | + `createTime` varchar(50) COLLATE utf8mb4_general_ci DEFAULT NULL, | |
| 240 | + `gpsTime` varchar(50) COLLATE utf8mb4_general_ci DEFAULT NULL, | |
| 241 | + PRIMARY KEY (`gbStreamId`) USING BTREE, | |
| 242 | + UNIQUE KEY `app` (`app`, `stream`) USING BTREE, | |
| 243 | + UNIQUE KEY `gbId` (`gbId`) USING BTREE | |
| 244 | +) ENGINE = InnoDB | |
| 245 | + AUTO_INCREMENT = 301754 | |
| 246 | + DEFAULT CHARSET = utf8mb4 | |
| 247 | + COLLATE = utf8mb4_general_ci | |
| 248 | + ROW_FORMAT = DYNAMIC; | |
| 217 | 249 | /*!40101 SET character_set_client = @saved_cs_client */; |
| 218 | 250 | |
| 219 | 251 | -- |
| ... | ... | @@ -221,8 +253,10 @@ CREATE TABLE `gb_stream` ( |
| 221 | 253 | -- |
| 222 | 254 | |
| 223 | 255 | LOCK TABLES `gb_stream` WRITE; |
| 224 | -/*!40000 ALTER TABLE `gb_stream` DISABLE KEYS */; | |
| 225 | -/*!40000 ALTER TABLE `gb_stream` ENABLE KEYS */; | |
| 256 | +/*!40000 ALTER TABLE `gb_stream` | |
| 257 | + DISABLE KEYS */; | |
| 258 | +/*!40000 ALTER TABLE `gb_stream` | |
| 259 | + ENABLE KEYS */; | |
| 226 | 260 | UNLOCK TABLES; |
| 227 | 261 | |
| 228 | 262 | -- |
| ... | ... | @@ -230,20 +264,25 @@ UNLOCK TABLES; |
| 230 | 264 | -- |
| 231 | 265 | |
| 232 | 266 | DROP TABLE IF EXISTS `log`; |
| 233 | -/*!40101 SET @saved_cs_client = @@character_set_client */; | |
| 267 | +/*!40101 SET @saved_cs_client = @@character_set_client */; | |
| 234 | 268 | /*!50503 SET character_set_client = utf8mb4 */; |
| 235 | -CREATE TABLE `log` ( | |
| 236 | - `id` int NOT NULL AUTO_INCREMENT, | |
| 237 | - `name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, | |
| 238 | - `type` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, | |
| 239 | - `uri` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, | |
| 240 | - `address` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, | |
| 241 | - `result` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, | |
| 242 | - `timing` bigint NOT NULL, | |
| 243 | - `username` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, | |
| 244 | - `createTime` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, | |
| 245 | - PRIMARY KEY (`id`) USING BTREE | |
| 246 | -) ENGINE=InnoDB AUTO_INCREMENT=37760 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC; | |
| 269 | +CREATE TABLE `log` | |
| 270 | +( | |
| 271 | + `id` int NOT NULL AUTO_INCREMENT, | |
| 272 | + `name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, | |
| 273 | + `type` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, | |
| 274 | + `uri` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, | |
| 275 | + `address` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, | |
| 276 | + `result` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, | |
| 277 | + `timing` bigint NOT NULL, | |
| 278 | + `username` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, | |
| 279 | + `createTime` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, | |
| 280 | + PRIMARY KEY (`id`) USING BTREE | |
| 281 | +) ENGINE = InnoDB | |
| 282 | + AUTO_INCREMENT = 42703 | |
| 283 | + DEFAULT CHARSET = utf8mb4 | |
| 284 | + COLLATE = utf8mb4_general_ci | |
| 285 | + ROW_FORMAT = DYNAMIC; | |
| 247 | 286 | /*!40101 SET character_set_client = @saved_cs_client */; |
| 248 | 287 | |
| 249 | 288 | -- |
| ... | ... | @@ -251,8 +290,10 @@ CREATE TABLE `log` ( |
| 251 | 290 | -- |
| 252 | 291 | |
| 253 | 292 | LOCK TABLES `log` WRITE; |
| 254 | -/*!40000 ALTER TABLE `log` DISABLE KEYS */; | |
| 255 | -/*!40000 ALTER TABLE `log` ENABLE KEYS */; | |
| 293 | +/*!40000 ALTER TABLE `log` | |
| 294 | + DISABLE KEYS */; | |
| 295 | +/*!40000 ALTER TABLE `log` | |
| 296 | + ENABLE KEYS */; | |
| 256 | 297 | UNLOCK TABLES; |
| 257 | 298 | |
| 258 | 299 | -- |
| ... | ... | @@ -260,35 +301,39 @@ UNLOCK TABLES; |
| 260 | 301 | -- |
| 261 | 302 | |
| 262 | 303 | DROP TABLE IF EXISTS `media_server`; |
| 263 | -/*!40101 SET @saved_cs_client = @@character_set_client */; | |
| 304 | +/*!40101 SET @saved_cs_client = @@character_set_client */; | |
| 264 | 305 | /*!50503 SET character_set_client = utf8mb4 */; |
| 265 | -CREATE TABLE `media_server` ( | |
| 266 | - `id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, | |
| 267 | - `ip` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, | |
| 268 | - `hookIp` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, | |
| 269 | - `sdpIp` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, | |
| 270 | - `streamIp` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, | |
| 271 | - `httpPort` int NOT NULL, | |
| 272 | - `httpSSlPort` int NOT NULL, | |
| 273 | - `rtmpPort` int NOT NULL, | |
| 274 | - `rtmpSSlPort` int NOT NULL, | |
| 275 | - `rtpProxyPort` int NOT NULL, | |
| 276 | - `rtspPort` int NOT NULL, | |
| 277 | - `rtspSSLPort` int NOT NULL, | |
| 278 | - `autoConfig` int NOT NULL, | |
| 279 | - `secret` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, | |
| 280 | - `streamNoneReaderDelayMS` int NOT NULL, | |
| 281 | - `rtpEnable` int NOT NULL, | |
| 282 | - `rtpPortRange` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, | |
| 283 | - `sendRtpPortRange` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, | |
| 284 | - `recordAssistPort` int NOT NULL, | |
| 285 | - `defaultServer` int NOT NULL, | |
| 286 | - `createTime` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, | |
| 287 | - `updateTime` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, | |
| 288 | - `hookAliveInterval` int NOT NULL, | |
| 289 | - PRIMARY KEY (`id`) USING BTREE, | |
| 290 | - UNIQUE KEY `media_server_i` (`ip`,`httpPort`) USING BTREE | |
| 291 | -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC; | |
| 306 | +CREATE TABLE `media_server` | |
| 307 | +( | |
| 308 | + `id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, | |
| 309 | + `ip` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, | |
| 310 | + `hookIp` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, | |
| 311 | + `sdpIp` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, | |
| 312 | + `streamIp` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, | |
| 313 | + `httpPort` int NOT NULL, | |
| 314 | + `httpSSlPort` int NOT NULL, | |
| 315 | + `rtmpPort` int NOT NULL, | |
| 316 | + `rtmpSSlPort` int NOT NULL, | |
| 317 | + `rtpProxyPort` int NOT NULL, | |
| 318 | + `rtspPort` int NOT NULL, | |
| 319 | + `rtspSSLPort` int NOT NULL, | |
| 320 | + `autoConfig` int NOT NULL, | |
| 321 | + `secret` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, | |
| 322 | + `streamNoneReaderDelayMS` int NOT NULL, | |
| 323 | + `rtpEnable` int NOT NULL, | |
| 324 | + `rtpPortRange` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, | |
| 325 | + `sendRtpPortRange` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, | |
| 326 | + `recordAssistPort` int NOT NULL, | |
| 327 | + `defaultServer` int NOT NULL, | |
| 328 | + `createTime` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, | |
| 329 | + `updateTime` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, | |
| 330 | + `hookAliveInterval` int NOT NULL, | |
| 331 | + PRIMARY KEY (`id`) USING BTREE, | |
| 332 | + UNIQUE KEY `media_server_i` (`ip`, `httpPort`) USING BTREE | |
| 333 | +) ENGINE = InnoDB | |
| 334 | + DEFAULT CHARSET = utf8mb4 | |
| 335 | + COLLATE = utf8mb4_general_ci | |
| 336 | + ROW_FORMAT = DYNAMIC; | |
| 292 | 337 | /*!40101 SET character_set_client = @saved_cs_client */; |
| 293 | 338 | |
| 294 | 339 | -- |
| ... | ... | @@ -296,8 +341,10 @@ CREATE TABLE `media_server` ( |
| 296 | 341 | -- |
| 297 | 342 | |
| 298 | 343 | LOCK TABLES `media_server` WRITE; |
| 299 | -/*!40000 ALTER TABLE `media_server` DISABLE KEYS */; | |
| 300 | -/*!40000 ALTER TABLE `media_server` ENABLE KEYS */; | |
| 344 | +/*!40000 ALTER TABLE `media_server` | |
| 345 | + DISABLE KEYS */; | |
| 346 | +/*!40000 ALTER TABLE `media_server` | |
| 347 | + ENABLE KEYS */; | |
| 301 | 348 | UNLOCK TABLES; |
| 302 | 349 | |
| 303 | 350 | -- |
| ... | ... | @@ -305,39 +352,44 @@ UNLOCK TABLES; |
| 305 | 352 | -- |
| 306 | 353 | |
| 307 | 354 | DROP TABLE IF EXISTS `parent_platform`; |
| 308 | -/*!40101 SET @saved_cs_client = @@character_set_client */; | |
| 355 | +/*!40101 SET @saved_cs_client = @@character_set_client */; | |
| 309 | 356 | /*!50503 SET character_set_client = utf8mb4 */; |
| 310 | -CREATE TABLE `parent_platform` ( | |
| 311 | - `id` int NOT NULL AUTO_INCREMENT, | |
| 312 | - `enable` int DEFAULT NULL, | |
| 313 | - `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, | |
| 314 | - `serverGBId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, | |
| 315 | - `serverGBDomain` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, | |
| 316 | - `serverIP` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, | |
| 317 | - `serverPort` int DEFAULT NULL, | |
| 318 | - `deviceGBId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, | |
| 319 | - `deviceIp` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, | |
| 320 | - `devicePort` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, | |
| 321 | - `username` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, | |
| 322 | - `password` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, | |
| 323 | - `expires` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, | |
| 324 | - `keepTimeout` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, | |
| 325 | - `transport` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, | |
| 326 | - `characterSet` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, | |
| 327 | - `catalogId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, | |
| 328 | - `ptz` int DEFAULT NULL, | |
| 329 | - `rtcp` int DEFAULT NULL, | |
| 330 | - `status` bit(1) DEFAULT NULL, | |
| 331 | - `startOfflinePush` int DEFAULT '0', | |
| 332 | - `administrativeDivision` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, | |
| 333 | - `catalogGroup` int DEFAULT '1', | |
| 334 | - `createTime` varchar(50) COLLATE utf8mb4_general_ci DEFAULT NULL, | |
| 335 | - `updateTime` varchar(50) COLLATE utf8mb4_general_ci DEFAULT NULL, | |
| 336 | - `treeType` varchar(50) COLLATE utf8mb4_general_ci NOT NULL, | |
| 337 | - PRIMARY KEY (`id`) USING BTREE, | |
| 338 | - UNIQUE KEY `parent_platform_id_uindex` (`id`) USING BTREE, | |
| 339 | - UNIQUE KEY `parent_platform_pk` (`serverGBId`) USING BTREE | |
| 340 | -) ENGINE=InnoDB AUTO_INCREMENT=35 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC; | |
| 357 | +CREATE TABLE `parent_platform` | |
| 358 | +( | |
| 359 | + `id` int NOT NULL AUTO_INCREMENT, | |
| 360 | + `enable` int DEFAULT NULL, | |
| 361 | + `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, | |
| 362 | + `serverGBId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, | |
| 363 | + `serverGBDomain` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, | |
| 364 | + `serverIP` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, | |
| 365 | + `serverPort` int DEFAULT NULL, | |
| 366 | + `deviceGBId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, | |
| 367 | + `deviceIp` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, | |
| 368 | + `devicePort` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, | |
| 369 | + `username` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, | |
| 370 | + `password` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, | |
| 371 | + `expires` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, | |
| 372 | + `keepTimeout` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, | |
| 373 | + `transport` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, | |
| 374 | + `characterSet` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, | |
| 375 | + `catalogId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, | |
| 376 | + `ptz` int DEFAULT NULL, | |
| 377 | + `rtcp` int DEFAULT NULL, | |
| 378 | + `status` bit(1) DEFAULT NULL, | |
| 379 | + `startOfflinePush` int DEFAULT '0 ', | |
| 380 | + `administrativeDivision` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, | |
| 381 | + `catalogGroup` int DEFAULT '1 ', | |
| 382 | + `createTime` varchar(50) COLLATE utf8mb4_general_ci DEFAULT NULL, | |
| 383 | + `updateTime` varchar(50) COLLATE utf8mb4_general_ci DEFAULT NULL, | |
| 384 | + `treeType` varchar(50) COLLATE utf8mb4_general_ci NOT NULL, | |
| 385 | + PRIMARY KEY (`id`) USING BTREE, | |
| 386 | + UNIQUE KEY `parent_platform_id_uindex` (`id`) USING BTREE, | |
| 387 | + UNIQUE KEY `parent_platform_pk` (`serverGBId`) USING BTREE | |
| 388 | +) ENGINE = InnoDB | |
| 389 | + AUTO_INCREMENT = 40 | |
| 390 | + DEFAULT CHARSET = utf8mb4 | |
| 391 | + COLLATE = utf8mb4_general_ci | |
| 392 | + ROW_FORMAT = DYNAMIC; | |
| 341 | 393 | /*!40101 SET character_set_client = @saved_cs_client */; |
| 342 | 394 | |
| 343 | 395 | -- |
| ... | ... | @@ -345,8 +397,10 @@ CREATE TABLE `parent_platform` ( |
| 345 | 397 | -- |
| 346 | 398 | |
| 347 | 399 | LOCK TABLES `parent_platform` WRITE; |
| 348 | -/*!40000 ALTER TABLE `parent_platform` DISABLE KEYS */; | |
| 349 | -/*!40000 ALTER TABLE `parent_platform` ENABLE KEYS */; | |
| 400 | +/*!40000 ALTER TABLE `parent_platform` | |
| 401 | + DISABLE KEYS */; | |
| 402 | +/*!40000 ALTER TABLE `parent_platform` | |
| 403 | + ENABLE KEYS */; | |
| 350 | 404 | UNLOCK TABLES; |
| 351 | 405 | |
| 352 | 406 | -- |
| ... | ... | @@ -354,17 +408,21 @@ UNLOCK TABLES; |
| 354 | 408 | -- |
| 355 | 409 | |
| 356 | 410 | DROP TABLE IF EXISTS `platform_catalog`; |
| 357 | -/*!40101 SET @saved_cs_client = @@character_set_client */; | |
| 411 | +/*!40101 SET @saved_cs_client = @@character_set_client */; | |
| 358 | 412 | /*!50503 SET character_set_client = utf8mb4 */; |
| 359 | -CREATE TABLE `platform_catalog` ( | |
| 360 | - `id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, | |
| 361 | - `platformId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, | |
| 362 | - `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, | |
| 363 | - `parentId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, | |
| 364 | - `civilCode` varchar(50) COLLATE utf8mb4_general_ci DEFAULT NULL, | |
| 365 | - `businessGroupId` varchar(50) COLLATE utf8mb4_general_ci DEFAULT NULL, | |
| 366 | - PRIMARY KEY (`id`) USING BTREE | |
| 367 | -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC; | |
| 413 | +CREATE TABLE `platform_catalog` | |
| 414 | +( | |
| 415 | + `id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, | |
| 416 | + `platformId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, | |
| 417 | + `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, | |
| 418 | + `parentId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, | |
| 419 | + `civilCode` varchar(50) COLLATE utf8mb4_general_ci DEFAULT NULL, | |
| 420 | + `businessGroupId` varchar(50) COLLATE utf8mb4_general_ci DEFAULT NULL, | |
| 421 | + PRIMARY KEY (`id`) USING BTREE | |
| 422 | +) ENGINE = InnoDB | |
| 423 | + DEFAULT CHARSET = utf8mb4 | |
| 424 | + COLLATE = utf8mb4_general_ci | |
| 425 | + ROW_FORMAT = DYNAMIC; | |
| 368 | 426 | /*!40101 SET character_set_client = @saved_cs_client */; |
| 369 | 427 | |
| 370 | 428 | -- |
| ... | ... | @@ -372,8 +430,10 @@ CREATE TABLE `platform_catalog` ( |
| 372 | 430 | -- |
| 373 | 431 | |
| 374 | 432 | LOCK TABLES `platform_catalog` WRITE; |
| 375 | -/*!40000 ALTER TABLE `platform_catalog` DISABLE KEYS */; | |
| 376 | -/*!40000 ALTER TABLE `platform_catalog` ENABLE KEYS */; | |
| 433 | +/*!40000 ALTER TABLE `platform_catalog` | |
| 434 | + DISABLE KEYS */; | |
| 435 | +/*!40000 ALTER TABLE `platform_catalog` | |
| 436 | + ENABLE KEYS */; | |
| 377 | 437 | UNLOCK TABLES; |
| 378 | 438 | |
| 379 | 439 | -- |
| ... | ... | @@ -381,15 +441,20 @@ UNLOCK TABLES; |
| 381 | 441 | -- |
| 382 | 442 | |
| 383 | 443 | DROP TABLE IF EXISTS `platform_gb_channel`; |
| 384 | -/*!40101 SET @saved_cs_client = @@character_set_client */; | |
| 444 | +/*!40101 SET @saved_cs_client = @@character_set_client */; | |
| 385 | 445 | /*!50503 SET character_set_client = utf8mb4 */; |
| 386 | -CREATE TABLE `platform_gb_channel` ( | |
| 387 | - `id` int NOT NULL AUTO_INCREMENT, | |
| 388 | - `platformId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, | |
| 389 | - `catalogId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, | |
| 390 | - `deviceChannelId` int NOT NULL, | |
| 391 | - PRIMARY KEY (`id`) USING BTREE | |
| 392 | -) ENGINE=InnoDB AUTO_INCREMENT=4912 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC; | |
| 446 | +CREATE TABLE `platform_gb_channel` | |
| 447 | +( | |
| 448 | + `id` int NOT NULL AUTO_INCREMENT, | |
| 449 | + `platformId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, | |
| 450 | + `catalogId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, | |
| 451 | + `deviceChannelId` int NOT NULL, | |
| 452 | + PRIMARY KEY (`id`) USING BTREE | |
| 453 | +) ENGINE = InnoDB | |
| 454 | + AUTO_INCREMENT = 4915 | |
| 455 | + DEFAULT CHARSET = utf8mb4 | |
| 456 | + COLLATE = utf8mb4_general_ci | |
| 457 | + ROW_FORMAT = DYNAMIC; | |
| 393 | 458 | /*!40101 SET character_set_client = @saved_cs_client */; |
| 394 | 459 | |
| 395 | 460 | -- |
| ... | ... | @@ -397,8 +462,10 @@ CREATE TABLE `platform_gb_channel` ( |
| 397 | 462 | -- |
| 398 | 463 | |
| 399 | 464 | LOCK TABLES `platform_gb_channel` WRITE; |
| 400 | -/*!40000 ALTER TABLE `platform_gb_channel` DISABLE KEYS */; | |
| 401 | -/*!40000 ALTER TABLE `platform_gb_channel` ENABLE KEYS */; | |
| 465 | +/*!40000 ALTER TABLE `platform_gb_channel` | |
| 466 | + DISABLE KEYS */; | |
| 467 | +/*!40000 ALTER TABLE `platform_gb_channel` | |
| 468 | + ENABLE KEYS */; | |
| 402 | 469 | UNLOCK TABLES; |
| 403 | 470 | |
| 404 | 471 | -- |
| ... | ... | @@ -406,16 +473,21 @@ UNLOCK TABLES; |
| 406 | 473 | -- |
| 407 | 474 | |
| 408 | 475 | DROP TABLE IF EXISTS `platform_gb_stream`; |
| 409 | -/*!40101 SET @saved_cs_client = @@character_set_client */; | |
| 476 | +/*!40101 SET @saved_cs_client = @@character_set_client */; | |
| 410 | 477 | /*!50503 SET character_set_client = utf8mb4 */; |
| 411 | -CREATE TABLE `platform_gb_stream` ( | |
| 412 | - `platformId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, | |
| 413 | - `catalogId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, | |
| 414 | - `gbStreamId` int NOT NULL, | |
| 415 | - `id` int NOT NULL AUTO_INCREMENT, | |
| 416 | - PRIMARY KEY (`id`) USING BTREE, | |
| 417 | - UNIQUE KEY `platform_gb_stream_pk` (`platformId`,`catalogId`,`gbStreamId`) USING BTREE | |
| 418 | -) ENGINE=InnoDB AUTO_INCREMENT=302134 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC; | |
| 478 | +CREATE TABLE `platform_gb_stream` | |
| 479 | +( | |
| 480 | + `platformId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, | |
| 481 | + `catalogId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, | |
| 482 | + `gbStreamId` int NOT NULL, | |
| 483 | + `id` int NOT NULL AUTO_INCREMENT, | |
| 484 | + PRIMARY KEY (`id`) USING BTREE, | |
| 485 | + UNIQUE KEY `platform_gb_stream_pk` (`platformId`, `catalogId`, `gbStreamId`) USING BTREE | |
| 486 | +) ENGINE = InnoDB | |
| 487 | + AUTO_INCREMENT = 302149 | |
| 488 | + DEFAULT CHARSET = utf8mb4 | |
| 489 | + COLLATE = utf8mb4_general_ci | |
| 490 | + ROW_FORMAT = DYNAMIC; | |
| 419 | 491 | /*!40101 SET character_set_client = @saved_cs_client */; |
| 420 | 492 | |
| 421 | 493 | -- |
| ... | ... | @@ -423,8 +495,10 @@ CREATE TABLE `platform_gb_stream` ( |
| 423 | 495 | -- |
| 424 | 496 | |
| 425 | 497 | LOCK TABLES `platform_gb_stream` WRITE; |
| 426 | -/*!40000 ALTER TABLE `platform_gb_stream` DISABLE KEYS */; | |
| 427 | -/*!40000 ALTER TABLE `platform_gb_stream` ENABLE KEYS */; | |
| 498 | +/*!40000 ALTER TABLE `platform_gb_stream` | |
| 499 | + DISABLE KEYS */; | |
| 500 | +/*!40000 ALTER TABLE `platform_gb_stream` | |
| 501 | + ENABLE KEYS */; | |
| 428 | 502 | UNLOCK TABLES; |
| 429 | 503 | |
| 430 | 504 | -- |
| ... | ... | @@ -432,31 +506,36 @@ UNLOCK TABLES; |
| 432 | 506 | -- |
| 433 | 507 | |
| 434 | 508 | DROP TABLE IF EXISTS `stream_proxy`; |
| 435 | -/*!40101 SET @saved_cs_client = @@character_set_client */; | |
| 509 | +/*!40101 SET @saved_cs_client = @@character_set_client */; | |
| 436 | 510 | /*!50503 SET character_set_client = utf8mb4 */; |
| 437 | -CREATE TABLE `stream_proxy` ( | |
| 438 | - `id` int NOT NULL AUTO_INCREMENT, | |
| 439 | - `type` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, | |
| 440 | - `app` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, | |
| 441 | - `stream` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, | |
| 442 | - `url` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, | |
| 443 | - `src_url` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, | |
| 444 | - `dst_url` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, | |
| 445 | - `timeout_ms` int DEFAULT NULL, | |
| 446 | - `ffmpeg_cmd_key` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, | |
| 447 | - `rtp_type` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, | |
| 448 | - `mediaServerId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, | |
| 449 | - `enable_hls` bit(1) DEFAULT NULL, | |
| 450 | - `enable_mp4` bit(1) DEFAULT NULL, | |
| 451 | - `enable` bit(1) NOT NULL, | |
| 452 | - `status` bit(1) NOT NULL, | |
| 453 | - `enable_remove_none_reader` bit(1) NOT NULL, | |
| 454 | - `createTime` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, | |
| 455 | - `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, | |
| 456 | - `updateTime` varchar(50) COLLATE utf8mb4_general_ci DEFAULT NULL, | |
| 457 | - PRIMARY KEY (`id`) USING BTREE, | |
| 458 | - UNIQUE KEY `stream_proxy_pk` (`app`,`stream`) USING BTREE | |
| 459 | -) ENGINE=InnoDB AUTO_INCREMENT=66 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC; | |
| 511 | +CREATE TABLE `stream_proxy` | |
| 512 | +( | |
| 513 | + `id` int NOT NULL AUTO_INCREMENT, | |
| 514 | + `type` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, | |
| 515 | + `app` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, | |
| 516 | + `stream` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, | |
| 517 | + `url` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, | |
| 518 | + `src_url` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, | |
| 519 | + `dst_url` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, | |
| 520 | + `timeout_ms` int DEFAULT NULL, | |
| 521 | + `ffmpeg_cmd_key` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, | |
| 522 | + `rtp_type` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, | |
| 523 | + `mediaServerId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, | |
| 524 | + `enable_hls` bit(1) DEFAULT NULL, | |
| 525 | + `enable_mp4` bit(1) DEFAULT NULL, | |
| 526 | + `enable` bit(1) NOT NULL, | |
| 527 | + `status` bit(1) NOT NULL, | |
| 528 | + `enable_remove_none_reader` bit(1) NOT NULL, | |
| 529 | + `createTime` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, | |
| 530 | + `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, | |
| 531 | + `updateTime` varchar(50) COLLATE utf8mb4_general_ci DEFAULT NULL, | |
| 532 | + PRIMARY KEY (`id`) USING BTREE, | |
| 533 | + UNIQUE KEY `stream_proxy_pk` (`app`, `stream`) USING BTREE | |
| 534 | +) ENGINE = InnoDB | |
| 535 | + AUTO_INCREMENT = 66 | |
| 536 | + DEFAULT CHARSET = utf8mb4 | |
| 537 | + COLLATE = utf8mb4_general_ci | |
| 538 | + ROW_FORMAT = DYNAMIC; | |
| 460 | 539 | /*!40101 SET character_set_client = @saved_cs_client */; |
| 461 | 540 | |
| 462 | 541 | -- |
| ... | ... | @@ -464,8 +543,10 @@ CREATE TABLE `stream_proxy` ( |
| 464 | 543 | -- |
| 465 | 544 | |
| 466 | 545 | LOCK TABLES `stream_proxy` WRITE; |
| 467 | -/*!40000 ALTER TABLE `stream_proxy` DISABLE KEYS */; | |
| 468 | -/*!40000 ALTER TABLE `stream_proxy` ENABLE KEYS */; | |
| 546 | +/*!40000 ALTER TABLE `stream_proxy` | |
| 547 | + DISABLE KEYS */; | |
| 548 | +/*!40000 ALTER TABLE `stream_proxy` | |
| 549 | + ENABLE KEYS */; | |
| 469 | 550 | UNLOCK TABLES; |
| 470 | 551 | |
| 471 | 552 | -- |
| ... | ... | @@ -473,25 +554,32 @@ UNLOCK TABLES; |
| 473 | 554 | -- |
| 474 | 555 | |
| 475 | 556 | DROP TABLE IF EXISTS `stream_push`; |
| 476 | -/*!40101 SET @saved_cs_client = @@character_set_client */; | |
| 557 | +/*!40101 SET @saved_cs_client = @@character_set_client */; | |
| 477 | 558 | /*!50503 SET character_set_client = utf8mb4 */; |
| 478 | -CREATE TABLE `stream_push` ( | |
| 479 | - `id` int NOT NULL AUTO_INCREMENT, | |
| 480 | - `app` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, | |
| 481 | - `stream` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, | |
| 482 | - `totalReaderCount` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, | |
| 483 | - `originType` int DEFAULT NULL, | |
| 484 | - `originTypeStr` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, | |
| 485 | - `createTime` varchar(50) COLLATE utf8mb4_general_ci DEFAULT NULL, | |
| 486 | - `aliveSecond` int DEFAULT NULL, | |
| 487 | - `mediaServerId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, | |
| 488 | - `serverId` varchar(50) COLLATE utf8mb4_general_ci NOT NULL, | |
| 489 | - `pushTime` varchar(50) COLLATE utf8mb4_general_ci DEFAULT NULL, | |
| 490 | - `updateTime` varchar(50) COLLATE utf8mb4_general_ci DEFAULT NULL, | |
| 491 | - `status` int DEFAULT NULL, | |
| 492 | - PRIMARY KEY (`id`) USING BTREE, | |
| 493 | - UNIQUE KEY `stream_push_pk` (`app`,`stream`) USING BTREE | |
| 494 | -) ENGINE=InnoDB AUTO_INCREMENT=305390 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC; | |
| 559 | +CREATE TABLE `stream_push` | |
| 560 | +( | |
| 561 | + `id` int NOT NULL AUTO_INCREMENT, | |
| 562 | + `app` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, | |
| 563 | + `stream` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, | |
| 564 | + `totalReaderCount` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, | |
| 565 | + `originType` int DEFAULT NULL, | |
| 566 | + `originTypeStr` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, | |
| 567 | + `createTime` varchar(50) COLLATE utf8mb4_general_ci DEFAULT NULL, | |
| 568 | + `aliveSecond` int DEFAULT NULL, | |
| 569 | + `mediaServerId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, | |
| 570 | + `serverId` varchar(50) COLLATE utf8mb4_general_ci NOT NULL, | |
| 571 | + `pushTime` varchar(50) COLLATE utf8mb4_general_ci DEFAULT NULL, | |
| 572 | + `updateTime` varchar(50) COLLATE utf8mb4_general_ci DEFAULT NULL, | |
| 573 | + `status` int DEFAULT NULL, | |
| 574 | + `pushIng` int DEFAULT NULL, | |
| 575 | + `self` int DEFAULT NULL, | |
| 576 | + PRIMARY KEY (`id`) USING BTREE, | |
| 577 | + UNIQUE KEY `stream_push_pk` (`app`, `stream`) USING BTREE | |
| 578 | +) ENGINE = InnoDB | |
| 579 | + AUTO_INCREMENT = 305415 | |
| 580 | + DEFAULT CHARSET = utf8mb4 | |
| 581 | + COLLATE = utf8mb4_general_ci | |
| 582 | + ROW_FORMAT = DYNAMIC; | |
| 495 | 583 | /*!40101 SET character_set_client = @saved_cs_client */; |
| 496 | 584 | |
| 497 | 585 | -- |
| ... | ... | @@ -499,8 +587,10 @@ CREATE TABLE `stream_push` ( |
| 499 | 587 | -- |
| 500 | 588 | |
| 501 | 589 | LOCK TABLES `stream_push` WRITE; |
| 502 | -/*!40000 ALTER TABLE `stream_push` DISABLE KEYS */; | |
| 503 | -/*!40000 ALTER TABLE `stream_push` ENABLE KEYS */; | |
| 590 | +/*!40000 ALTER TABLE `stream_push` | |
| 591 | + DISABLE KEYS */; | |
| 592 | +/*!40000 ALTER TABLE `stream_push` | |
| 593 | + ENABLE KEYS */; | |
| 504 | 594 | UNLOCK TABLES; |
| 505 | 595 | |
| 506 | 596 | -- |
| ... | ... | @@ -508,19 +598,24 @@ UNLOCK TABLES; |
| 508 | 598 | -- |
| 509 | 599 | |
| 510 | 600 | DROP TABLE IF EXISTS `user`; |
| 511 | -/*!40101 SET @saved_cs_client = @@character_set_client */; | |
| 601 | +/*!40101 SET @saved_cs_client = @@character_set_client */; | |
| 512 | 602 | /*!50503 SET character_set_client = utf8mb4 */; |
| 513 | -CREATE TABLE `user` ( | |
| 514 | - `id` int NOT NULL AUTO_INCREMENT, | |
| 515 | - `username` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, | |
| 516 | - `password` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, | |
| 517 | - `roleId` int NOT NULL, | |
| 518 | - `createTime` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, | |
| 519 | - `updateTime` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, | |
| 520 | - `pushKey` varchar(50) COLLATE utf8mb4_general_ci DEFAULT NULL, | |
| 521 | - PRIMARY KEY (`id`) USING BTREE, | |
| 522 | - UNIQUE KEY `user_username_uindex` (`username`) USING BTREE | |
| 523 | -) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC; | |
| 603 | +CREATE TABLE `user` | |
| 604 | +( | |
| 605 | + `id` int NOT NULL AUTO_INCREMENT, | |
| 606 | + `username` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, | |
| 607 | + `password` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, | |
| 608 | + `roleId` int NOT NULL, | |
| 609 | + `createTime` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, | |
| 610 | + `updateTime` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, | |
| 611 | + `pushKey` varchar(50) COLLATE utf8mb4_general_ci DEFAULT NULL, | |
| 612 | + PRIMARY KEY (`id`) USING BTREE, | |
| 613 | + UNIQUE KEY `user_username_uindex` (`username`) USING BTREE | |
| 614 | +) ENGINE = InnoDB | |
| 615 | + AUTO_INCREMENT = 2 | |
| 616 | + DEFAULT CHARSET = utf8mb4 | |
| 617 | + COLLATE = utf8mb4_general_ci | |
| 618 | + ROW_FORMAT = DYNAMIC; | |
| 524 | 619 | /*!40101 SET character_set_client = @saved_cs_client */; |
| 525 | 620 | |
| 526 | 621 | -- |
| ... | ... | @@ -528,9 +623,13 @@ CREATE TABLE `user` ( |
| 528 | 623 | -- |
| 529 | 624 | |
| 530 | 625 | LOCK TABLES `user` WRITE; |
| 531 | -/*!40000 ALTER TABLE `user` DISABLE KEYS */; | |
| 532 | -INSERT INTO `user` VALUES (1,'admin','21232f297a57a5a743894a0e4a801fc3',1,'2021 - 04 - 13 14:14:57','2021 - 04 - 13 14:14:57','453df297a57a5a7438934sda801fc3'); | |
| 533 | -/*!40000 ALTER TABLE `user` ENABLE KEYS */; | |
| 626 | +/*!40000 ALTER TABLE `user` | |
| 627 | + DISABLE KEYS */; | |
| 628 | +INSERT INTO `user` | |
| 629 | +VALUES (1, 'admin', '21232f297a57a5a743894a0e4a801fc3', 1, '2021 - 04 - 13 14:14:57', '2021 - 04 - 13 14:14:57', | |
| 630 | + '01685cb9573ae25ec6c52142402da7c5'); | |
| 631 | +/*!40000 ALTER TABLE `user` | |
| 632 | + ENABLE KEYS */; | |
| 534 | 633 | UNLOCK TABLES; |
| 535 | 634 | |
| 536 | 635 | -- |
| ... | ... | @@ -538,16 +637,21 @@ UNLOCK TABLES; |
| 538 | 637 | -- |
| 539 | 638 | |
| 540 | 639 | DROP TABLE IF EXISTS `user_role`; |
| 541 | -/*!40101 SET @saved_cs_client = @@character_set_client */; | |
| 640 | +/*!40101 SET @saved_cs_client = @@character_set_client */; | |
| 542 | 641 | /*!50503 SET character_set_client = utf8mb4 */; |
| 543 | -CREATE TABLE `user_role` ( | |
| 544 | - `id` int NOT NULL AUTO_INCREMENT, | |
| 545 | - `name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, | |
| 546 | - `authority` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, | |
| 547 | - `createTime` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, | |
| 548 | - `updateTime` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, | |
| 549 | - PRIMARY KEY (`id`) USING BTREE | |
| 550 | -) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC; | |
| 642 | +CREATE TABLE `user_role` | |
| 643 | +( | |
| 644 | + `id` int NOT NULL AUTO_INCREMENT, | |
| 645 | + `name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, | |
| 646 | + `authority` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, | |
| 647 | + `createTime` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, | |
| 648 | + `updateTime` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, | |
| 649 | + PRIMARY KEY (`id`) USING BTREE | |
| 650 | +) ENGINE = InnoDB | |
| 651 | + AUTO_INCREMENT = 2 | |
| 652 | + DEFAULT CHARSET = utf8mb4 | |
| 653 | + COLLATE = utf8mb4_general_ci | |
| 654 | + ROW_FORMAT = DYNAMIC; | |
| 551 | 655 | /*!40101 SET character_set_client = @saved_cs_client */; |
| 552 | 656 | |
| 553 | 657 | -- |
| ... | ... | @@ -555,18 +659,21 @@ CREATE TABLE `user_role` ( |
| 555 | 659 | -- |
| 556 | 660 | |
| 557 | 661 | LOCK TABLES `user_role` WRITE; |
| 558 | -/*!40000 ALTER TABLE `user_role` DISABLE KEYS */; | |
| 559 | -INSERT INTO `user_role` VALUES (1,'admin','0','2021-04-13 14:14:57','2021-04-13 14:14:57'); | |
| 560 | -/*!40000 ALTER TABLE `user_role` ENABLE KEYS */; | |
| 662 | +/*!40000 ALTER TABLE `user_role` | |
| 663 | + DISABLE KEYS */; | |
| 664 | +INSERT INTO `user_role` | |
| 665 | +VALUES (1, 'admin', '0 ', '2021 - 04 - 13 14:14:57', '2021 - 04 - 13 14:14:57'); | |
| 666 | +/*!40000 ALTER TABLE `user_role` | |
| 667 | + ENABLE KEYS */; | |
| 561 | 668 | UNLOCK TABLES; |
| 562 | -/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; | |
| 669 | +/*!40103 SET TIME_ZONE = @OLD_TIME_ZONE */; | |
| 563 | 670 | |
| 564 | -/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; | |
| 565 | -/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; | |
| 566 | -/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; | |
| 567 | -/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; | |
| 568 | -/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; | |
| 569 | -/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; | |
| 570 | -/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; | |
| 671 | +/*!40101 SET SQL_MODE = @OLD_SQL_MODE */; | |
| 672 | +/*!40014 SET FOREIGN_KEY_CHECKS = @OLD_FOREIGN_KEY_CHECKS */; | |
| 673 | +/*!40014 SET UNIQUE_CHECKS = @OLD_UNIQUE_CHECKS */; | |
| 674 | +/*!40101 SET CHARACTER_SET_CLIENT = @OLD_CHARACTER_SET_CLIENT */; | |
| 675 | +/*!40101 SET CHARACTER_SET_RESULTS = @OLD_CHARACTER_SET_RESULTS */; | |
| 676 | +/*!40101 SET COLLATION_CONNECTION = @OLD_COLLATION_CONNECTION */; | |
| 677 | +/*!40111 SET SQL_NOTES = @OLD_SQL_NOTES */; | |
| 571 | 678 | |
| 572 | --- Dump completed on 2022-07-17 23:15:09 | |
| 679 | +-- Dump completed on 2022-07-27 14:51:08 | ... | ... |
sql/update.sql
src/main/java/com/genersoft/iot/vmp/conf/UserSetting.java
src/main/java/com/genersoft/iot/vmp/conf/security/DefaultUserDetailsServiceImpl.java
| 1 | 1 | package com.genersoft.iot.vmp.conf.security; |
| 2 | 2 | |
| 3 | -import com.genersoft.iot.vmp.conf.security.dto.LoginUser; | |
| 4 | -import com.genersoft.iot.vmp.service.IUserService; | |
| 5 | -import com.genersoft.iot.vmp.storager.dao.dto.User; | |
| 6 | -import com.github.xiaoymin.knife4j.core.util.StrUtil; | |
| 3 | +import java.time.LocalDateTime; | |
| 4 | + | |
| 7 | 5 | import org.slf4j.Logger; |
| 8 | 6 | import org.slf4j.LoggerFactory; |
| 9 | 7 | import org.springframework.beans.factory.annotation.Autowired; |
| ... | ... | @@ -12,7 +10,10 @@ import org.springframework.security.core.userdetails.UserDetailsService; |
| 12 | 10 | import org.springframework.security.core.userdetails.UsernameNotFoundException; |
| 13 | 11 | import org.springframework.stereotype.Component; |
| 14 | 12 | |
| 15 | -import java.time.LocalDateTime; | |
| 13 | +import com.alibaba.excel.util.StringUtils; | |
| 14 | +import com.genersoft.iot.vmp.conf.security.dto.LoginUser; | |
| 15 | +import com.genersoft.iot.vmp.service.IUserService; | |
| 16 | +import com.genersoft.iot.vmp.storager.dao.dto.User; | |
| 16 | 17 | |
| 17 | 18 | /** |
| 18 | 19 | * 用户登录认证逻辑 |
| ... | ... | @@ -27,7 +28,7 @@ public class DefaultUserDetailsServiceImpl implements UserDetailsService { |
| 27 | 28 | |
| 28 | 29 | @Override |
| 29 | 30 | public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException { |
| 30 | - if (StrUtil.isBlank(username)) { | |
| 31 | + if (StringUtils.isBlank(username)) { | |
| 31 | 32 | logger.info("登录用户:{} 不存在", username); |
| 32 | 33 | throw new UsernameNotFoundException("登录用户:" + username + " 不存在"); |
| 33 | 34 | } | ... | ... |
src/main/java/com/genersoft/iot/vmp/gb28181/bean/CatalogData.java
| ... | ... | @@ -3,8 +3,14 @@ package com.genersoft.iot.vmp.gb28181.bean; |
| 3 | 3 | import java.time.Instant; |
| 4 | 4 | import java.util.List; |
| 5 | 5 | |
| 6 | +/** | |
| 7 | + * @author lin | |
| 8 | + */ | |
| 6 | 9 | public class CatalogData { |
| 7 | - private int sn; // 命令序列号 | |
| 10 | + /** | |
| 11 | + * 命令序列号 | |
| 12 | + */ | |
| 13 | + private int sn; | |
| 8 | 14 | private int total; |
| 9 | 15 | private List<DeviceChannel> channelList; |
| 10 | 16 | private Instant lastTime; | ... | ... |
src/main/java/com/genersoft/iot/vmp/gb28181/bean/SyncStatus.java
| ... | ... | @@ -2,12 +2,15 @@ package com.genersoft.iot.vmp.gb28181.bean; |
| 2 | 2 | |
| 3 | 3 | /** |
| 4 | 4 | * 摄像机同步状态 |
| 5 | + * @author lin | |
| 5 | 6 | */ |
| 6 | 7 | public class SyncStatus { |
| 7 | 8 | private int total; |
| 8 | 9 | private int current; |
| 9 | 10 | private String errorMsg; |
| 10 | 11 | |
| 12 | + private boolean syncIng; | |
| 13 | + | |
| 11 | 14 | public int getTotal() { |
| 12 | 15 | return total; |
| 13 | 16 | } |
| ... | ... | @@ -31,4 +34,12 @@ public class SyncStatus { |
| 31 | 34 | public void setErrorMsg(String errorMsg) { |
| 32 | 35 | this.errorMsg = errorMsg; |
| 33 | 36 | } |
| 37 | + | |
| 38 | + public boolean isSyncIng() { | |
| 39 | + return syncIng; | |
| 40 | + } | |
| 41 | + | |
| 42 | + public void setSyncIng(boolean syncIng) { | |
| 43 | + this.syncIng = syncIng; | |
| 44 | + } | |
| 34 | 45 | } | ... | ... |
src/main/java/com/genersoft/iot/vmp/gb28181/session/CatalogDataCatch.java
| ... | ... | @@ -84,6 +84,11 @@ public class CatalogDataCatch { |
| 84 | 84 | syncStatus.setCurrent(catalogData.getChannelList().size()); |
| 85 | 85 | syncStatus.setTotal(catalogData.getTotal()); |
| 86 | 86 | syncStatus.setErrorMsg(catalogData.getErrorMsg()); |
| 87 | + if (catalogData.getStatus().equals(CatalogData.CatalogDataStatus.end)) { | |
| 88 | + syncStatus.setSyncIng(false); | |
| 89 | + }else { | |
| 90 | + syncStatus.setSyncIng(true); | |
| 91 | + } | |
| 87 | 92 | return syncStatus; |
| 88 | 93 | } |
| 89 | 94 | ... | ... |
src/main/java/com/genersoft/iot/vmp/gb28181/task/impl/MobilePositionSubscribeTask.java
| ... | ... | @@ -39,9 +39,9 @@ public class MobilePositionSubscribeTask implements ISubscribeTask { |
| 39 | 39 | dynamicTask.stop(taskKey); |
| 40 | 40 | } |
| 41 | 41 | sipCommander.mobilePositionSubscribe(device, dialog, eventResult -> { |
| 42 | -// if (eventResult.dialog != null || eventResult.dialog.getState().equals(DialogState.CONFIRMED)) { | |
| 43 | -// dialog = eventResult.dialog; | |
| 44 | -// } | |
| 42 | + if (eventResult.dialog != null || eventResult.dialog.getState().equals(DialogState.CONFIRMED)) { | |
| 43 | + dialog = eventResult.dialog; | |
| 44 | + } | |
| 45 | 45 | ResponseEvent event = (ResponseEvent) eventResult.event; |
| 46 | 46 | if (event.getResponse().getRawContent() != null) { |
| 47 | 47 | // 成功 | ... | ... |
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommander.java
| ... | ... | @@ -10,6 +10,9 @@ import com.genersoft.iot.vmp.gb28181.event.SipSubscribe; |
| 10 | 10 | import com.genersoft.iot.vmp.gb28181.session.VideoStreamSessionManager; |
| 11 | 11 | import com.genersoft.iot.vmp.gb28181.transmit.cmd.ISIPCommander; |
| 12 | 12 | import com.genersoft.iot.vmp.gb28181.transmit.cmd.SIPRequestHeaderProvider; |
| 13 | +import com.genersoft.iot.vmp.media.zlm.dto.HookSubscribeFactory; | |
| 14 | +import com.genersoft.iot.vmp.media.zlm.dto.HookSubscribeForStreamChange; | |
| 15 | +import com.genersoft.iot.vmp.media.zlm.dto.HookType; | |
| 13 | 16 | import com.genersoft.iot.vmp.utils.DateUtil; |
| 14 | 17 | import com.genersoft.iot.vmp.gb28181.utils.NumericUtil; |
| 15 | 18 | import com.genersoft.iot.vmp.media.zlm.ZLMHttpHookSubscribe; |
| ... | ... | @@ -348,25 +351,19 @@ public class SIPCommander implements ISIPCommander { |
| 348 | 351 | @Override |
| 349 | 352 | public void playStreamCmd(MediaServerItem mediaServerItem, SSRCInfo ssrcInfo, Device device, String channelId, |
| 350 | 353 | ZLMHttpHookSubscribe.Event event, SipSubscribe.Event okEvent, SipSubscribe.Event errorEvent) { |
| 351 | - String streamId = ssrcInfo.getStream(); | |
| 354 | + String stream = ssrcInfo.getStream(); | |
| 352 | 355 | try { |
| 353 | 356 | if (device == null) { |
| 354 | 357 | return; |
| 355 | 358 | } |
| 356 | 359 | String streamMode = device.getStreamMode().toUpperCase(); |
| 357 | 360 | |
| 358 | - logger.info("{} 分配的ZLM为: {} [{}:{}]", streamId, mediaServerItem.getId(), mediaServerItem.getIp(), ssrcInfo.getPort()); | |
| 359 | - // 添加订阅 | |
| 360 | - JSONObject subscribeKey = new JSONObject(); | |
| 361 | - subscribeKey.put("app", "rtp"); | |
| 362 | - subscribeKey.put("stream", streamId); | |
| 363 | - subscribeKey.put("regist", true); | |
| 364 | - subscribeKey.put("schema", "rtmp"); | |
| 365 | - subscribeKey.put("mediaServerId", mediaServerItem.getId()); | |
| 366 | - subscribe.addSubscribe(ZLMHttpHookSubscribe.HookType.on_stream_changed, subscribeKey, | |
| 367 | - (MediaServerItem mediaServerItemInUse, JSONObject json)->{ | |
| 361 | + logger.info("{} 分配的ZLM为: {} [{}:{}]", stream, mediaServerItem.getId(), mediaServerItem.getIp(), ssrcInfo.getPort()); | |
| 362 | + HookSubscribeForStreamChange hookSubscribe = HookSubscribeFactory.on_stream_changed("rtp", stream, true, "rtmp", mediaServerItem.getId()); | |
| 363 | + subscribe.addSubscribe(hookSubscribe, (MediaServerItem mediaServerItemInUse, JSONObject json)->{ | |
| 368 | 364 | if (event != null) { |
| 369 | 365 | event.response(mediaServerItemInUse, json); |
| 366 | + subscribe.removeSubscribe(hookSubscribe); | |
| 370 | 367 | } |
| 371 | 368 | }); |
| 372 | 369 | // |
| ... | ... | @@ -440,7 +437,7 @@ public class SIPCommander implements ISIPCommander { |
| 440 | 437 | errorEvent.response(e); |
| 441 | 438 | }), e ->{ |
| 442 | 439 | // 这里为例避免一个通道的点播只有一个callID这个参数使用一个固定值 |
| 443 | - streamSession.put(device.getDeviceId(), channelId ,"play", streamId, ssrcInfo.getSsrc(), mediaServerItem.getId(), ((ResponseEvent)e.event).getClientTransaction(), VideoStreamSessionManager.SessionType.play); | |
| 440 | + streamSession.put(device.getDeviceId(), channelId ,"play", stream, ssrcInfo.getSsrc(), mediaServerItem.getId(), ((ResponseEvent)e.event).getClientTransaction(), VideoStreamSessionManager.SessionType.play); | |
| 444 | 441 | streamSession.put(device.getDeviceId(), channelId ,"play", e.dialog); |
| 445 | 442 | okEvent.response(e); |
| 446 | 443 | }); |
| ... | ... | @@ -530,21 +527,14 @@ public class SIPCommander implements ISIPCommander { |
| 530 | 527 | |
| 531 | 528 | CallIdHeader callIdHeader = device.getTransport().equals("TCP") ? tcpSipProvider.getNewCallId() |
| 532 | 529 | : udpSipProvider.getNewCallId(); |
| 533 | - | |
| 530 | + HookSubscribeForStreamChange hookSubscribe = HookSubscribeFactory.on_stream_changed("rtp", ssrcInfo.getStream(), true, "rtmp", mediaServerItem.getId()); | |
| 534 | 531 | // 添加订阅 |
| 535 | - JSONObject subscribeKey = new JSONObject(); | |
| 536 | - subscribeKey.put("app", "rtp"); | |
| 537 | - subscribeKey.put("stream", ssrcInfo.getStream()); | |
| 538 | - subscribeKey.put("regist", true); | |
| 539 | - subscribeKey.put("schema", "rtmp"); | |
| 540 | - subscribeKey.put("mediaServerId", mediaServerItem.getId()); | |
| 541 | - logger.debug("录像回放添加订阅,订阅内容:" + subscribeKey); | |
| 542 | - subscribe.addSubscribe(ZLMHttpHookSubscribe.HookType.on_stream_changed, subscribeKey, | |
| 543 | - (MediaServerItem mediaServerItemInUse, JSONObject json)->{ | |
| 532 | + subscribe.addSubscribe(hookSubscribe, (MediaServerItem mediaServerItemInUse, JSONObject json)->{ | |
| 544 | 533 | if (hookEvent != null) { |
| 545 | 534 | InviteStreamInfo inviteStreamInfo = new InviteStreamInfo(mediaServerItemInUse, json, callIdHeader.getCallId(), "rtp", ssrcInfo.getStream()); |
| 546 | 535 | hookEvent.call(inviteStreamInfo); |
| 547 | 536 | } |
| 537 | + subscribe.removeSubscribe(hookSubscribe); | |
| 548 | 538 | }); |
| 549 | 539 | Request request = headerProvider.createPlaybackInviteRequest(device, channelId, content.toString(), null, "fromplybck" + tm, null, callIdHeader, ssrcInfo.getSsrc()); |
| 550 | 540 | |
| ... | ... | @@ -643,21 +633,15 @@ public class SIPCommander implements ISIPCommander { |
| 643 | 633 | CallIdHeader callIdHeader = device.getTransport().equals("TCP") ? tcpSipProvider.getNewCallId() |
| 644 | 634 | : udpSipProvider.getNewCallId(); |
| 645 | 635 | |
| 636 | + HookSubscribeForStreamChange hookSubscribe = HookSubscribeFactory.on_stream_changed("rtp", ssrcInfo.getStream(), true, null, mediaServerItem.getId()); | |
| 646 | 637 | // 添加订阅 |
| 647 | - JSONObject subscribeKey = new JSONObject(); | |
| 648 | - subscribeKey.put("app", "rtp"); | |
| 649 | - subscribeKey.put("stream", ssrcInfo.getStream()); | |
| 650 | - subscribeKey.put("regist", true); | |
| 651 | - subscribeKey.put("mediaServerId", mediaServerItem.getId()); | |
| 652 | - logger.debug("录像回放添加订阅,订阅内容:" + subscribeKey.toString()); | |
| 653 | - subscribe.addSubscribe(ZLMHttpHookSubscribe.HookType.on_stream_changed, subscribeKey, | |
| 654 | - (MediaServerItem mediaServerItemInUse, JSONObject json)->{ | |
| 638 | + subscribe.addSubscribe(hookSubscribe, (MediaServerItem mediaServerItemInUse, JSONObject json)->{ | |
| 655 | 639 | hookEvent.call(new InviteStreamInfo(mediaServerItem, json, callIdHeader.getCallId(), "rtp", ssrcInfo.getStream())); |
| 656 | - subscribe.removeSubscribe(ZLMHttpHookSubscribe.HookType.on_stream_changed, subscribeKey); | |
| 657 | - subscribeKey.put("regist", false); | |
| 658 | - subscribeKey.put("schema", "rtmp"); | |
| 640 | + subscribe.removeSubscribe(hookSubscribe); | |
| 641 | + hookSubscribe.getContent().put("regist", false); | |
| 642 | + hookSubscribe.getContent().put("schema", "rtmp"); | |
| 659 | 643 | // 添加流注销的订阅,注销了后向设备发送bye |
| 660 | - subscribe.addSubscribe(ZLMHttpHookSubscribe.HookType.on_stream_changed, subscribeKey, | |
| 644 | + subscribe.addSubscribe(hookSubscribe, | |
| 661 | 645 | (MediaServerItem mediaServerItemForEnd, JSONObject jsonForEnd)->{ |
| 662 | 646 | ClientTransaction transaction = streamSession.getTransaction(device.getDeviceId(), channelId, ssrcInfo.getStream(), callIdHeader.getCallId()); |
| 663 | 647 | if (transaction != null) { | ... | ... |
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/ByeRequestProcessor.java
| ... | ... | @@ -126,7 +126,7 @@ public class ByeRequestProcessor extends SIPRequestProcessorParent implements In |
| 126 | 126 | SsrcTransaction ssrcTransactionForPlay = streamSession.getSsrcTransaction(device.getDeviceId(), channelId, "play", null); |
| 127 | 127 | if (ssrcTransactionForPlay != null){ |
| 128 | 128 | SIPDialog dialogForPlay = (SIPDialog) SerializeUtils.deSerialize(ssrcTransactionForPlay.getDialog()); |
| 129 | - if (dialogForPlay.getCallId().equals(callIdHeader.getCallId())){ | |
| 129 | + if (dialogForPlay.getCallId().getCallId().equals(callIdHeader.getCallId())){ | |
| 130 | 130 | // 释放ssrc |
| 131 | 131 | MediaServerItem mediaServerItem = mediaServerService.getOne(ssrcTransactionForPlay.getMediaServerId()); |
| 132 | 132 | if (mediaServerItem != null) { | ... | ... |
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/InviteRequestProcessor.java
| ... | ... | @@ -419,18 +419,16 @@ public class InviteRequestProcessor extends SIPRequestProcessorParent implements |
| 419 | 419 | } |
| 420 | 420 | } |
| 421 | 421 | } else if (gbStream != null) { |
| 422 | - if (streamPushItem.isStatus()) { | |
| 423 | - // 在线状态 | |
| 422 | + if (streamPushItem != null && streamPushItem.isPushIng()) { | |
| 423 | + // 推流状态 | |
| 424 | 424 | pushStream(evt, gbStream, streamPushItem, platform, callIdHeader, mediaServerItem, port, tcpActive, |
| 425 | 425 | mediaTransmissionTCP, channelId, addressStr, ssrc, requesterId); |
| 426 | 426 | } else { |
| 427 | - // 不在线 拉起 | |
| 427 | + // 未推流 拉起 | |
| 428 | 428 | notifyStreamOnline(evt, gbStream, streamPushItem, platform, callIdHeader, mediaServerItem, port, tcpActive, |
| 429 | 429 | mediaTransmissionTCP, channelId, addressStr, ssrc, requesterId); |
| 430 | 430 | } |
| 431 | - | |
| 432 | 431 | } |
| 433 | - | |
| 434 | 432 | } |
| 435 | 433 | |
| 436 | 434 | } catch (SipException | InvalidArgumentException | ParseException e) { |
| ... | ... | @@ -453,7 +451,7 @@ public class InviteRequestProcessor extends SIPRequestProcessorParent implements |
| 453 | 451 | int port, Boolean tcpActive, boolean mediaTransmissionTCP, |
| 454 | 452 | String channelId, String addressStr, String ssrc, String requesterId) throws InvalidArgumentException, ParseException, SipException { |
| 455 | 453 | // 推流 |
| 456 | - if (streamPushItem.getServerId().equals(userSetting.getServerId())) { | |
| 454 | + if (streamPushItem.isSelf()) { | |
| 457 | 455 | Boolean streamReady = zlmrtpServerFactory.isStreamReady(mediaServerItem, gbStream.getApp(), gbStream.getStream()); |
| 458 | 456 | if (streamReady) { |
| 459 | 457 | // 自平台内容 |
| ... | ... | @@ -502,7 +500,7 @@ public class InviteRequestProcessor extends SIPRequestProcessorParent implements |
| 502 | 500 | String channelId, String addressStr, String ssrc, String requesterId) throws InvalidArgumentException, ParseException, SipException { |
| 503 | 501 | if ("proxy".equals(gbStream.getStreamType())) { |
| 504 | 502 | // TODO 控制启用以使设备上线 |
| 505 | - logger.info("[ app={}, stream={} ]通道离线,启用流后开始推流", gbStream.getApp(), gbStream.getStream()); | |
| 503 | + logger.info("[ app={}, stream={} ]通道未推流,启用流后开始推流", gbStream.getApp(), gbStream.getStream()); | |
| 506 | 504 | responseAck(evt, Response.BAD_REQUEST, "channel [" + gbStream.getGbId() + "] offline"); |
| 507 | 505 | } else if ("push".equals(gbStream.getStreamType())) { |
| 508 | 506 | if (!platform.isStartOfflinePush()) { |
| ... | ... | @@ -510,7 +508,7 @@ public class InviteRequestProcessor extends SIPRequestProcessorParent implements |
| 510 | 508 | return; |
| 511 | 509 | } |
| 512 | 510 | // 发送redis消息以使设备上线 |
| 513 | - logger.info("[ app={}, stream={} ]通道离线,发送redis信息控制设备开始推流", gbStream.getApp(), gbStream.getStream()); | |
| 511 | + logger.info("[ app={}, stream={} ]通道未推流,发送redis信息控制设备开始推流", gbStream.getApp(), gbStream.getStream()); | |
| 514 | 512 | |
| 515 | 513 | MessageForPushChannel messageForPushChannel = MessageForPushChannel.getInstance(1, |
| 516 | 514 | gbStream.getApp(), gbStream.getStream(), gbStream.getGbId(), gbStream.getPlatformId(), |
| ... | ... | @@ -520,7 +518,7 @@ public class InviteRequestProcessor extends SIPRequestProcessorParent implements |
| 520 | 518 | dynamicTask.startDelay(callIdHeader.getCallId(), () -> { |
| 521 | 519 | logger.info("[ app={}, stream={} ] 等待设备开始推流超时", gbStream.getApp(), gbStream.getStream()); |
| 522 | 520 | try { |
| 523 | - mediaListManager.removedChannelOnlineEventLister(gbStream.getGbId()); | |
| 521 | + mediaListManager.removedChannelOnlineEventLister(gbStream.getApp(), gbStream.getStream()); | |
| 524 | 522 | responseAck(evt, Response.REQUEST_TIMEOUT); // 超时 |
| 525 | 523 | } catch (SipException e) { |
| 526 | 524 | e.printStackTrace(); |
| ... | ... | @@ -535,7 +533,7 @@ public class InviteRequestProcessor extends SIPRequestProcessorParent implements |
| 535 | 533 | Boolean finalTcpActive = tcpActive; |
| 536 | 534 | |
| 537 | 535 | // 添加在本机上线的通知 |
| 538 | - mediaListManager.addChannelOnlineEventLister(gbStream.getGbId(), (app, stream, serverId) -> { | |
| 536 | + mediaListManager.addChannelOnlineEventLister(gbStream.getApp(), gbStream.getStream(), (app, stream, serverId) -> { | |
| 539 | 537 | dynamicTask.stop(callIdHeader.getCallId()); |
| 540 | 538 | if (serverId.equals(userSetting.getServerId())) { |
| 541 | 539 | SendRtpItem sendRtpItem = zlmrtpServerFactory.createSendRtpItem(mediaServerItem, addressStr, finalPort, ssrc, requesterId, |
| ... | ... | @@ -623,7 +621,7 @@ public class InviteRequestProcessor extends SIPRequestProcessorParent implements |
| 623 | 621 | // 离线 |
| 624 | 622 | // 查询是否在本机上线了 |
| 625 | 623 | StreamPushItem currentStreamPushItem = streamPushService.getPush(streamPushItem.getApp(), streamPushItem.getStream()); |
| 626 | - if (currentStreamPushItem.isStatus()) { | |
| 624 | + if (currentStreamPushItem.isPushIng()) { | |
| 627 | 625 | // 在线状态 |
| 628 | 626 | pushStream(evt, gbStream, streamPushItem, platform, callIdHeader, mediaServerItem, port, tcpActive, |
| 629 | 627 | mediaTransmissionTCP, channelId, addressStr, ssrc, requesterId); | ... | ... |
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/NotifyRequestProcessor.java
| ... | ... | @@ -92,39 +92,36 @@ public class NotifyRequestProcessor extends SIPRequestProcessorParent implements |
| 92 | 92 | @Override |
| 93 | 93 | public void process(RequestEvent evt) { |
| 94 | 94 | try { |
| 95 | - | |
| 96 | 95 | taskQueue.offer(new HandlerCatchData(evt, null, null)); |
| 97 | 96 | responseAck(evt, Response.OK); |
| 98 | 97 | if (!taskQueueHandlerRun) { |
| 99 | 98 | taskQueueHandlerRun = true; |
| 100 | 99 | taskExecutor.execute(()-> { |
| 101 | - while (!taskQueue.isEmpty()) { | |
| 102 | - try { | |
| 103 | - HandlerCatchData take = taskQueue.poll(); | |
| 104 | - Element rootElement = getRootElement(take.getEvt()); | |
| 105 | - String cmd = XmlUtil.getText(rootElement, "CmdType"); | |
| 106 | - | |
| 107 | - if (CmdType.CATALOG.equals(cmd)) { | |
| 108 | - logger.info("接收到Catalog通知"); | |
| 109 | - processNotifyCatalogList(take.getEvt()); | |
| 110 | - } else if (CmdType.ALARM.equals(cmd)) { | |
| 111 | - logger.info("接收到Alarm通知"); | |
| 112 | - processNotifyAlarm(take.getEvt()); | |
| 113 | - } else if (CmdType.MOBILE_POSITION.equals(cmd)) { | |
| 114 | - logger.info("接收到MobilePosition通知"); | |
| 115 | - processNotifyMobilePosition(take.getEvt()); | |
| 116 | - } else { | |
| 117 | - logger.info("接收到消息:" + cmd); | |
| 118 | - } | |
| 119 | - } catch (DocumentException e) { | |
| 120 | - throw new RuntimeException(e); | |
| 121 | - } | |
| 100 | + while (!taskQueue.isEmpty()) { | |
| 101 | + try { | |
| 102 | + HandlerCatchData take = taskQueue.poll(); | |
| 103 | + Element rootElement = getRootElement(take.getEvt()); | |
| 104 | + String cmd = XmlUtil.getText(rootElement, "CmdType"); | |
| 105 | + | |
| 106 | + if (CmdType.CATALOG.equals(cmd)) { | |
| 107 | + logger.info("接收到Catalog通知"); | |
| 108 | + processNotifyCatalogList(take.getEvt()); | |
| 109 | + } else if (CmdType.ALARM.equals(cmd)) { | |
| 110 | + logger.info("接收到Alarm通知"); | |
| 111 | + processNotifyAlarm(take.getEvt()); | |
| 112 | + } else if (CmdType.MOBILE_POSITION.equals(cmd)) { | |
| 113 | + logger.info("接收到MobilePosition通知"); | |
| 114 | + processNotifyMobilePosition(take.getEvt()); | |
| 115 | + } else { | |
| 116 | + logger.info("接收到消息:" + cmd); | |
| 122 | 117 | } |
| 123 | - taskQueueHandlerRun = false; | |
| 124 | - }); | |
| 118 | + } catch (DocumentException e) { | |
| 119 | + throw new RuntimeException(e); | |
| 120 | + } | |
| 121 | + } | |
| 122 | + taskQueueHandlerRun = false; | |
| 123 | + }); | |
| 125 | 124 | } |
| 126 | - | |
| 127 | - | |
| 128 | 125 | } catch (SipException | InvalidArgumentException | ParseException e) { |
| 129 | 126 | e.printStackTrace(); |
| 130 | 127 | } |
| ... | ... | @@ -174,7 +171,7 @@ public class NotifyRequestProcessor extends SIPRequestProcessorParent implements |
| 174 | 171 | } else { |
| 175 | 172 | mobilePosition.setAltitude(0.0); |
| 176 | 173 | } |
| 177 | - logger.info("[收到 移动位置订阅]:{}/{}->{}.{}", mobilePosition.getDeviceId(), mobilePosition.getChannelId(), | |
| 174 | + logger.info("[收到移动位置订阅通知]:{}/{}->{}.{}", mobilePosition.getDeviceId(), mobilePosition.getChannelId(), | |
| 178 | 175 | mobilePosition.getLongitude(), mobilePosition.getLatitude()); |
| 179 | 176 | mobilePosition.setReportSource("Mobile Position"); |
| 180 | 177 | |
| ... | ... | @@ -318,7 +315,7 @@ public class NotifyRequestProcessor extends SIPRequestProcessorParent implements |
| 318 | 315 | |
| 319 | 316 | Device device = redisCatchStorage.getDevice(deviceId); |
| 320 | 317 | if (device == null || device.getOnline() == 0) { |
| 321 | - logger.warn("[收到 目录订阅]:{}, 但是设备已经离线", (device != null ? device.getDeviceId():"" )); | |
| 318 | + logger.warn("[收到目录订阅]:{}, 但是设备已经离线", (device != null ? device.getDeviceId():"" )); | |
| 322 | 319 | return; |
| 323 | 320 | } |
| 324 | 321 | Element rootElement = getRootElement(evt, device.getCharset()); |
| ... | ... | @@ -339,28 +336,28 @@ public class NotifyRequestProcessor extends SIPRequestProcessorParent implements |
| 339 | 336 | Element eventElement = itemDevice.element("Event"); |
| 340 | 337 | String event; |
| 341 | 338 | if (eventElement == null) { |
| 342 | - logger.warn("[收到 目录订阅]:{}, 但是Event为空, 设为默认值 ADD", (device != null ? device.getDeviceId():"" )); | |
| 339 | + logger.warn("[收到目录订阅]:{}, 但是Event为空, 设为默认值 ADD", (device != null ? device.getDeviceId():"" )); | |
| 343 | 340 | event = CatalogEvent.ADD; |
| 344 | 341 | }else { |
| 345 | 342 | event = eventElement.getText().toUpperCase(); |
| 346 | 343 | } |
| 347 | 344 | DeviceChannel channel = XmlUtil.channelContentHander(itemDevice, device, event); |
| 348 | 345 | channel.setDeviceId(device.getDeviceId()); |
| 349 | - logger.info("[收到 目录订阅]:{}/{}", device.getDeviceId(), channel.getChannelId()); | |
| 346 | + logger.info("[收到目录订阅]:{}/{}", device.getDeviceId(), channel.getChannelId()); | |
| 350 | 347 | switch (event) { |
| 351 | 348 | case CatalogEvent.ON: |
| 352 | 349 | // 上线 |
| 353 | - logger.info("收到来自设备【{}】的通道【{}】上线通知", device.getDeviceId(), channel.getChannelId()); | |
| 350 | + logger.info("[收到通道上线通知] 来自设备: {}, 通道 {}", device.getDeviceId(), channel.getChannelId()); | |
| 354 | 351 | storager.deviceChannelOnline(deviceId, channel.getChannelId()); |
| 355 | 352 | break; |
| 356 | 353 | case CatalogEvent.OFF : |
| 357 | 354 | // 离线 |
| 358 | - logger.info("收到来自设备【{}】的通道【{}】离线通知", device.getDeviceId(), channel.getChannelId()); | |
| 355 | + logger.info("[收到通道离线通知] 来自设备: {}, 通道 {}", device.getDeviceId(), channel.getChannelId()); | |
| 359 | 356 | storager.deviceChannelOffline(deviceId, channel.getChannelId()); |
| 360 | 357 | break; |
| 361 | 358 | case CatalogEvent.VLOST: |
| 362 | 359 | // 视频丢失 |
| 363 | - logger.info("收到来自设备【{}】的通道【{}】视频丢失通知", device.getDeviceId(), channel.getChannelId()); | |
| 360 | + logger.info("[收到通道视频丢失通知] 来自设备: {}, 通道 {}", device.getDeviceId(), channel.getChannelId()); | |
| 364 | 361 | storager.deviceChannelOffline(deviceId, channel.getChannelId()); |
| 365 | 362 | break; |
| 366 | 363 | case CatalogEvent.DEFECT: |
| ... | ... | @@ -368,17 +365,17 @@ public class NotifyRequestProcessor extends SIPRequestProcessorParent implements |
| 368 | 365 | break; |
| 369 | 366 | case CatalogEvent.ADD: |
| 370 | 367 | // 增加 |
| 371 | - logger.info("收到来自设备【{}】的增加通道【{}】通知", device.getDeviceId(), channel.getChannelId()); | |
| 368 | + logger.info("[收到增加通道通知] 来自设备: {}, 通道 {}", device.getDeviceId(), channel.getChannelId()); | |
| 372 | 369 | deviceChannelService.updateChannel(deviceId, channel); |
| 373 | 370 | break; |
| 374 | 371 | case CatalogEvent.DEL: |
| 375 | 372 | // 删除 |
| 376 | - logger.info("收到来自设备【{}】的删除通道【{}】通知", device.getDeviceId(), channel.getChannelId()); | |
| 373 | + logger.info("[收到删除通道通知] 来自设备: {}, 通道 {}", device.getDeviceId(), channel.getChannelId()); | |
| 377 | 374 | storager.delChannel(deviceId, channel.getChannelId()); |
| 378 | 375 | break; |
| 379 | 376 | case CatalogEvent.UPDATE: |
| 380 | 377 | // 更新 |
| 381 | - logger.info("收到来自设备【{}】的更新通道【{}】通知", device.getDeviceId(), channel.getChannelId()); | |
| 378 | + logger.info("[收到更新通道通知] 来自设备: {}, 通道 {}", device.getDeviceId(), channel.getChannelId()); | |
| 382 | 379 | deviceChannelService.updateChannel(deviceId, channel); |
| 383 | 380 | break; |
| 384 | 381 | default: | ... | ... |
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/RegisterRequestProcessor.java
| ... | ... | @@ -143,6 +143,7 @@ public class RegisterRequestProcessor extends SIPRequestProcessorParent implemen |
| 143 | 143 | device.setGeoCoordSys("WGS84"); |
| 144 | 144 | device.setTreeType("CivilCode"); |
| 145 | 145 | device.setDeviceId(deviceId); |
| 146 | + device.setOnline(0); | |
| 146 | 147 | } |
| 147 | 148 | device.setIp(received); |
| 148 | 149 | device.setPort(rPort); | ... | ... |
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/notify/cmd/AlarmNotifyMessageHandler.java
| ... | ... | @@ -69,7 +69,7 @@ public class AlarmNotifyMessageHandler extends SIPRequestProcessorParent impleme |
| 69 | 69 | |
| 70 | 70 | @Override |
| 71 | 71 | public void handForDevice(RequestEvent evt, Device device, Element rootElement) { |
| 72 | - logger.info("收到来自设备[{}]的报警通知", device.getDeviceId()); | |
| 72 | + logger.info("[收到报警通知]设备:{}", device.getDeviceId()); | |
| 73 | 73 | // 回复200 OK |
| 74 | 74 | try { |
| 75 | 75 | responseAck(evt, Response.OK); | ... | ... |
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/query/cmd/DeviceInfoQueryMessageHandler.java
| ... | ... | @@ -44,7 +44,7 @@ public class DeviceInfoQueryMessageHandler extends SIPRequestProcessorParent imp |
| 44 | 44 | |
| 45 | 45 | @Override |
| 46 | 46 | public void handForPlatform(RequestEvent evt, ParentPlatform parentPlatform, Element rootElement) { |
| 47 | - logger.info("接收到DeviceInfo查询消息"); | |
| 47 | + logger.info("[DeviceInfo查询]消息"); | |
| 48 | 48 | FromHeader fromHeader = (FromHeader) evt.getRequest().getHeader(FromHeader.NAME); |
| 49 | 49 | try { |
| 50 | 50 | // 回复200 OK | ... | ... |
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/response/cmd/CatalogResponseMessageHandler.java
| ... | ... | @@ -111,6 +111,7 @@ public class CatalogResponseMessageHandler extends SIPRequestProcessorParent imp |
| 111 | 111 | int sumNum = Integer.parseInt(sumNumElement.getText()); |
| 112 | 112 | |
| 113 | 113 | if (sumNum == 0) { |
| 114 | + logger.info("[收到通道]设备:{}的: 0个", take.getDevice().getDeviceId()); | |
| 114 | 115 | // 数据已经完整接收 |
| 115 | 116 | storager.cleanChannelsForDevice(take.getDevice().getDeviceId()); |
| 116 | 117 | catalogDataCatch.setChannelSyncEnd(take.getDevice().getDeviceId(), null); |
| ... | ... | @@ -132,7 +133,7 @@ public class CatalogResponseMessageHandler extends SIPRequestProcessorParent imp |
| 132 | 133 | } |
| 133 | 134 | int sn = Integer.parseInt(snElement.getText()); |
| 134 | 135 | catalogDataCatch.put(take.getDevice().getDeviceId(), sn, sumNum, take.getDevice(), channelList); |
| 135 | - logger.info("收到来自设备【{}】的通道: {}个,{}/{}", take.getDevice().getDeviceId(), channelList.size(), catalogDataCatch.get(take.getDevice().getDeviceId()) == null ? 0 :catalogDataCatch.get(take.getDevice().getDeviceId()).size(), sumNum); | |
| 136 | + logger.info("[收到通道]设备: {} -> {}个,{}/{}", take.getDevice().getDeviceId(), channelList.size(), catalogDataCatch.get(take.getDevice().getDeviceId()) == null ? 0 :catalogDataCatch.get(take.getDevice().getDeviceId()).size(), sumNum); | |
| 136 | 137 | if (catalogDataCatch.get(take.getDevice().getDeviceId()).size() == sumNum) { |
| 137 | 138 | // 数据已经完整接收 |
| 138 | 139 | boolean resetChannelsResult = storager.resetChannels(take.getDevice().getDeviceId(), catalogDataCatch.get(take.getDevice().getDeviceId())); | ... | ... |
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/response/impl/RegisterResponseProcessor.java
| ... | ... | @@ -26,7 +26,7 @@ import javax.sip.message.Response; |
| 26 | 26 | @Component |
| 27 | 27 | public class RegisterResponseProcessor extends SIPResponseProcessorAbstract { |
| 28 | 28 | |
| 29 | - private Logger logger = LoggerFactory.getLogger(RegisterResponseProcessor.class); | |
| 29 | + private final Logger logger = LoggerFactory.getLogger(RegisterResponseProcessor.class); | |
| 30 | 30 | private final String method = "REGISTER"; |
| 31 | 31 | |
| 32 | 32 | @Autowired |
| ... | ... | @@ -69,11 +69,11 @@ public class RegisterResponseProcessor extends SIPResponseProcessorAbstract { |
| 69 | 69 | |
| 70 | 70 | ParentPlatformCatch parentPlatformCatch = redisCatchStorage.queryPlatformCatchInfo(platformGBId); |
| 71 | 71 | if (parentPlatformCatch == null) { |
| 72 | - logger.warn(String.format("收到 %s 的注册/注销%S请求, 但是平台缓存信息未查询到!!!", platformGBId, response.getStatusCode())); | |
| 72 | + logger.warn(String.format("[收到注册/注销%S请求]平台:%s,但是平台缓存信息未查询到!!!", response.getStatusCode(),platformGBId)); | |
| 73 | 73 | return; |
| 74 | 74 | } |
| 75 | 75 | String action = parentPlatformCatch.getParentPlatform().getExpires().equals("0") ? "注销" : "注册"; |
| 76 | - logger.info(String.format("收到 %s %s的%S响应", platformGBId, action, response.getStatusCode() )); | |
| 76 | + logger.info(String.format("[%s %S响应]%s ", action, response.getStatusCode(), platformGBId )); | |
| 77 | 77 | ParentPlatform parentPlatform = parentPlatformCatch.getParentPlatform(); |
| 78 | 78 | if (parentPlatform == null) { |
| 79 | 79 | logger.warn(String.format("收到 %s %s的%S请求, 但是平台信息未查询到!!!", platformGBId, action, response.getStatusCode())); | ... | ... |
src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMHttpHookListener.java
| ... | ... | @@ -102,12 +102,13 @@ public class ZLMHttpHookListener { |
| 102 | 102 | logger.debug("[ ZLM HOOK ] on_server_keepalive API调用,参数:" + json.toString()); |
| 103 | 103 | } |
| 104 | 104 | String mediaServerId = json.getString("mediaServerId"); |
| 105 | - List<ZLMHttpHookSubscribe.Event> subscribes = this.subscribe.getSubscribes(ZLMHttpHookSubscribe.HookType.on_server_keepalive); | |
| 105 | + List<ZLMHttpHookSubscribe.Event> subscribes = this.subscribe.getSubscribes(HookType.on_server_keepalive); | |
| 106 | 106 | if (subscribes != null && subscribes.size() > 0) { |
| 107 | 107 | for (ZLMHttpHookSubscribe.Event subscribe : subscribes) { |
| 108 | 108 | subscribe.response(null, json); |
| 109 | 109 | } |
| 110 | 110 | } |
| 111 | + mediaServerService.updateMediaServerKeepalive(mediaServerId, json.getJSONObject("data")); | |
| 111 | 112 | |
| 112 | 113 | JSONObject ret = new JSONObject(); |
| 113 | 114 | ret.put("code", 0); |
| ... | ... | @@ -167,7 +168,7 @@ public class ZLMHttpHookListener { |
| 167 | 168 | logger.debug("[ ZLM HOOK ]on_play API调用,参数:" + JSON.toJSONString(param)); |
| 168 | 169 | } |
| 169 | 170 | String mediaServerId = param.getMediaServerId(); |
| 170 | - ZLMHttpHookSubscribe.Event subscribe = this.subscribe.getSubscribe(ZLMHttpHookSubscribe.HookType.on_play, json); | |
| 171 | + ZLMHttpHookSubscribe.Event subscribe = this.subscribe.sendNotify(HookType.on_play, json); | |
| 171 | 172 | if (subscribe != null ) { |
| 172 | 173 | MediaServerItem mediaInfo = mediaServerService.getOne(mediaServerId); |
| 173 | 174 | if (mediaInfo != null) { |
| ... | ... | @@ -240,6 +241,8 @@ public class ZLMHttpHookListener { |
| 240 | 241 | if (mediaInfo != null) { |
| 241 | 242 | assistRESTfulUtils.addStreamCallInfo(mediaInfo, param.getApp(), param.getStream(), callId, null); |
| 242 | 243 | } |
| 244 | + }else { | |
| 245 | + zlmMediaListManager.sendStreamEvent(param.getApp(),param.getStream(), param.getMediaServerId()); | |
| 243 | 246 | } |
| 244 | 247 | |
| 245 | 248 | ret.put("code", 0); |
| ... | ... | @@ -250,7 +253,7 @@ public class ZLMHttpHookListener { |
| 250 | 253 | } |
| 251 | 254 | |
| 252 | 255 | |
| 253 | - ZLMHttpHookSubscribe.Event subscribe = this.subscribe.getSubscribe(ZLMHttpHookSubscribe.HookType.on_publish, json); | |
| 256 | + ZLMHttpHookSubscribe.Event subscribe = this.subscribe.sendNotify(HookType.on_publish, json); | |
| 254 | 257 | if (subscribe != null) { |
| 255 | 258 | if (mediaInfo != null) { |
| 256 | 259 | subscribe.response(mediaInfo, json); |
| ... | ... | @@ -374,7 +377,7 @@ public class ZLMHttpHookListener { |
| 374 | 377 | logger.debug("[ ZLM HOOK ]on_shell_login API调用,参数:" + json.toString()); |
| 375 | 378 | } |
| 376 | 379 | String mediaServerId = json.getString("mediaServerId"); |
| 377 | - ZLMHttpHookSubscribe.Event subscribe = this.subscribe.getSubscribe(ZLMHttpHookSubscribe.HookType.on_shell_login, json); | |
| 380 | + ZLMHttpHookSubscribe.Event subscribe = this.subscribe.sendNotify(HookType.on_shell_login, json); | |
| 378 | 381 | if (subscribe != null ) { |
| 379 | 382 | MediaServerItem mediaInfo = mediaServerService.getOne(mediaServerId); |
| 380 | 383 | if (mediaInfo != null) { |
| ... | ... | @@ -400,7 +403,7 @@ public class ZLMHttpHookListener { |
| 400 | 403 | logger.info("[ ZLM HOOK ]on_stream_changed API调用,参数:" + JSONObject.toJSONString(item)); |
| 401 | 404 | String mediaServerId = item.getMediaServerId(); |
| 402 | 405 | JSONObject json = (JSONObject) JSON.toJSON(item); |
| 403 | - ZLMHttpHookSubscribe.Event subscribe = this.subscribe.getSubscribe(ZLMHttpHookSubscribe.HookType.on_stream_changed, json); | |
| 406 | + ZLMHttpHookSubscribe.Event subscribe = this.subscribe.sendNotify(HookType.on_stream_changed, json); | |
| 404 | 407 | if (subscribe != null ) { |
| 405 | 408 | MediaServerItem mediaInfo = mediaServerService.getOne(mediaServerId); |
| 406 | 409 | if (mediaInfo != null) { |
| ... | ... | @@ -461,7 +464,6 @@ public class ZLMHttpHookListener { |
| 461 | 464 | StreamInfo streamInfoByAppAndStream = mediaService.getStreamInfoByAppAndStream(mediaServerItem, |
| 462 | 465 | app, stream, tracks, streamAuthorityInfo.getCallId()); |
| 463 | 466 | item.setStreamInfo(streamInfoByAppAndStream); |
| 464 | - item.setSeverId(userSetting.getServerId()); | |
| 465 | 467 | redisCatchStorage.addStream(mediaServerItem, type, app, stream, item); |
| 466 | 468 | if (item.getOriginType() == OriginType.RTSP_PUSH.ordinal() |
| 467 | 469 | || item.getOriginType() == OriginType.RTMP_PUSH.ordinal() |
| ... | ... | @@ -469,20 +471,6 @@ public class ZLMHttpHookListener { |
| 469 | 471 | item.setSeverId(userSetting.getServerId()); |
| 470 | 472 | zlmMediaListManager.addPush(item); |
| 471 | 473 | } |
| 472 | - | |
| 473 | -// List<GbStream> gbStreams = new ArrayList<>(); | |
| 474 | -// if (streamPushItem == null || streamPushItem.getGbId() == null) { | |
| 475 | -// GbStream gbStream = storager.getGbStream(app, streamId); | |
| 476 | -// gbStreams.add(gbStream); | |
| 477 | -// }else { | |
| 478 | -// if (streamPushItem.getGbId() != null) { | |
| 479 | -// gbStreams.add(streamPushItem); | |
| 480 | -// } | |
| 481 | -// } | |
| 482 | -// if (gbStreams.size() > 0) { | |
| 483 | -// eventPublisher.catalogEventPublishForStream(null, gbStreams, CatalogEvent.ON); | |
| 484 | -// } | |
| 485 | - | |
| 486 | 474 | }else { |
| 487 | 475 | // 兼容流注销时类型从redis记录获取 |
| 488 | 476 | MediaItem mediaItem = redisCatchStorage.getStreamInfo(app, stream, mediaServerId); |
| ... | ... | @@ -626,16 +614,21 @@ public class ZLMHttpHookListener { |
| 626 | 614 | } |
| 627 | 615 | String remoteAddr = request.getRemoteAddr(); |
| 628 | 616 | jsonObject.put("ip", remoteAddr); |
| 629 | - List<ZLMHttpHookSubscribe.Event> subscribes = this.subscribe.getSubscribes(ZLMHttpHookSubscribe.HookType.on_server_started); | |
| 617 | + List<ZLMHttpHookSubscribe.Event> subscribes = this.subscribe.getSubscribes(HookType.on_server_started); | |
| 630 | 618 | if (subscribes != null && subscribes.size() > 0) { |
| 631 | 619 | for (ZLMHttpHookSubscribe.Event subscribe : subscribes) { |
| 632 | 620 | subscribe.response(null, jsonObject); |
| 633 | 621 | } |
| 634 | 622 | } |
| 623 | + | |
| 624 | + ZLMServerConfig zlmServerConfig = JSONObject.toJavaObject(jsonObject, ZLMServerConfig.class); | |
| 625 | + if (zlmServerConfig !=null ) { | |
| 626 | + mediaServerService.zlmServerOnline(zlmServerConfig); | |
| 627 | + } | |
| 635 | 628 | JSONObject ret = new JSONObject(); |
| 636 | 629 | ret.put("code", 0); |
| 637 | 630 | ret.put("msg", "success"); |
| 638 | - return new ResponseEntity<String>(ret.toString(),HttpStatus.OK); | |
| 631 | + return new ResponseEntity<>(ret.toString(),HttpStatus.OK); | |
| 639 | 632 | } |
| 640 | 633 | |
| 641 | 634 | private Map<String, String> urlParamToMap(String params) { | ... | ... |
src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMHttpHookSubscribe.java
| 1 | 1 | package com.genersoft.iot.vmp.media.zlm; |
| 2 | 2 | |
| 3 | 3 | import com.alibaba.fastjson.JSONObject; |
| 4 | +import com.genersoft.iot.vmp.media.zlm.dto.HookType; | |
| 5 | +import com.genersoft.iot.vmp.media.zlm.dto.IHookSubscribe; | |
| 4 | 6 | import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem; |
| 5 | 7 | import org.springframework.stereotype.Component; |
| 6 | 8 | import org.springframework.util.CollectionUtils; |
| 7 | 9 | |
| 10 | +import java.time.Instant; | |
| 8 | 11 | import java.util.*; |
| 9 | 12 | import java.util.concurrent.ConcurrentHashMap; |
| 13 | +import java.util.concurrent.TimeUnit; | |
| 10 | 14 | |
| 11 | 15 | /** |
| 12 | 16 | * @description:针对 ZLMediaServer的hook事件订阅 |
| ... | ... | @@ -16,51 +20,39 @@ import java.util.concurrent.ConcurrentHashMap; |
| 16 | 20 | @Component |
| 17 | 21 | public class ZLMHttpHookSubscribe { |
| 18 | 22 | |
| 19 | - public enum HookType{ | |
| 20 | - on_flow_report, | |
| 21 | - on_http_access, | |
| 22 | - on_play, | |
| 23 | - on_publish, | |
| 24 | - on_record_mp4, | |
| 25 | - on_rtsp_auth, | |
| 26 | - on_rtsp_realm, | |
| 27 | - on_shell_login, | |
| 28 | - on_stream_changed, | |
| 29 | - on_stream_none_reader, | |
| 30 | - on_stream_not_found, | |
| 31 | - on_server_started, | |
| 32 | - on_server_keepalive | |
| 33 | - } | |
| 34 | - | |
| 35 | 23 | @FunctionalInterface |
| 36 | 24 | public interface Event{ |
| 37 | 25 | void response(MediaServerItem mediaServerItem, JSONObject response); |
| 38 | 26 | } |
| 39 | 27 | |
| 40 | - private Map<HookType, Map<JSONObject, ZLMHttpHookSubscribe.Event>> allSubscribes = new ConcurrentHashMap<>(); | |
| 28 | + private Map<HookType, Map<IHookSubscribe, ZLMHttpHookSubscribe.Event>> allSubscribes = new ConcurrentHashMap<>(); | |
| 41 | 29 | |
| 42 | - public void addSubscribe(HookType type, JSONObject hookResponse, ZLMHttpHookSubscribe.Event event) { | |
| 43 | - allSubscribes.computeIfAbsent(type, k -> new ConcurrentHashMap<>()).put(hookResponse, event); | |
| 30 | + public void addSubscribe(IHookSubscribe hookSubscribe, ZLMHttpHookSubscribe.Event event) { | |
| 31 | + if (hookSubscribe.getExpires() == null) { | |
| 32 | + // 默认5分钟过期 | |
| 33 | + Instant expiresInstant = Instant.now().plusSeconds(TimeUnit.MINUTES.toSeconds(5)); | |
| 34 | + hookSubscribe.setExpires(expiresInstant); | |
| 35 | + } | |
| 36 | + allSubscribes.computeIfAbsent(hookSubscribe.getHookType(), k -> new ConcurrentHashMap<>()).put(hookSubscribe, event); | |
| 44 | 37 | } |
| 45 | 38 | |
| 46 | - public ZLMHttpHookSubscribe.Event getSubscribe(HookType type, JSONObject hookResponse) { | |
| 39 | + public ZLMHttpHookSubscribe.Event sendNotify(HookType type, JSONObject hookResponse) { | |
| 47 | 40 | ZLMHttpHookSubscribe.Event event= null; |
| 48 | - Map<JSONObject, Event> eventMap = allSubscribes.get(type); | |
| 41 | + Map<IHookSubscribe, Event> eventMap = allSubscribes.get(type); | |
| 49 | 42 | if (eventMap == null) { |
| 50 | 43 | return null; |
| 51 | 44 | } |
| 52 | - for (JSONObject key : eventMap.keySet()) { | |
| 45 | + for (IHookSubscribe key : eventMap.keySet()) { | |
| 53 | 46 | Boolean result = null; |
| 54 | - for (String s : key.keySet()) { | |
| 47 | + for (String s : key.getContent().keySet()) { | |
| 55 | 48 | if (result == null) { |
| 56 | - result = key.getString(s).equals(hookResponse.getString(s)); | |
| 49 | + result = key.getContent().getString(s).equals(hookResponse.getString(s)); | |
| 57 | 50 | }else { |
| 58 | - if (key.getString(s) == null) { | |
| 51 | + if (key.getContent().getString(s) == null) { | |
| 59 | 52 | continue; |
| 60 | 53 | } |
| 61 | - result = result && key.getString(s).equals(hookResponse.getString(s)); | |
| 54 | + result = result && key.getContent().getString(s).equals(hookResponse.getString(s)); | |
| 62 | 55 | } |
| 63 | - | |
| 64 | 56 | } |
| 65 | 57 | if (null != result && result) { |
| 66 | 58 | event = eventMap.get(key); |
| ... | ... | @@ -69,26 +61,30 @@ public class ZLMHttpHookSubscribe { |
| 69 | 61 | return event; |
| 70 | 62 | } |
| 71 | 63 | |
| 72 | - public void removeSubscribe(HookType type, JSONObject hookResponse) { | |
| 73 | - Map<JSONObject, Event> eventMap = allSubscribes.get(type); | |
| 64 | + public void removeSubscribe(IHookSubscribe hookSubscribe) { | |
| 65 | + Map<IHookSubscribe, Event> eventMap = allSubscribes.get(hookSubscribe.getHookType()); | |
| 74 | 66 | if (eventMap == null) { |
| 75 | 67 | return; |
| 76 | 68 | } |
| 77 | 69 | |
| 78 | - Set<Map.Entry<JSONObject, Event>> entries = eventMap.entrySet(); | |
| 70 | + Set<Map.Entry<IHookSubscribe, Event>> entries = eventMap.entrySet(); | |
| 79 | 71 | if (entries.size() > 0) { |
| 80 | - List<Map.Entry<JSONObject, ZLMHttpHookSubscribe.Event>> entriesToRemove = new ArrayList<>(); | |
| 81 | - for (Map.Entry<JSONObject, ZLMHttpHookSubscribe.Event> entry : entries) { | |
| 82 | - JSONObject key = entry.getKey(); | |
| 72 | + List<Map.Entry<IHookSubscribe, ZLMHttpHookSubscribe.Event>> entriesToRemove = new ArrayList<>(); | |
| 73 | + for (Map.Entry<IHookSubscribe, ZLMHttpHookSubscribe.Event> entry : entries) { | |
| 74 | + JSONObject content = entry.getKey().getContent(); | |
| 75 | + if (content == null || content.size() == 0) { | |
| 76 | + entriesToRemove.add(entry); | |
| 77 | + continue; | |
| 78 | + } | |
| 83 | 79 | Boolean result = null; |
| 84 | - for (String s : key.keySet()) { | |
| 80 | + for (String s : content.keySet()) { | |
| 85 | 81 | if (result == null) { |
| 86 | - result = key.getString(s).equals(hookResponse.getString(s)); | |
| 82 | + result = content.getString(s).equals(hookSubscribe.getContent().getString(s)); | |
| 87 | 83 | }else { |
| 88 | - if (key.getString(s) == null) { | |
| 84 | + if (content.getString(s) == null) { | |
| 89 | 85 | continue; |
| 90 | 86 | } |
| 91 | - result = result && key.getString(s).equals(hookResponse.getString(s)); | |
| 87 | + result = result && content.getString(s).equals(hookSubscribe.getContent().getString(s)); | |
| 92 | 88 | } |
| 93 | 89 | } |
| 94 | 90 | if (null != result && result){ |
| ... | ... | @@ -97,7 +93,7 @@ public class ZLMHttpHookSubscribe { |
| 97 | 93 | } |
| 98 | 94 | |
| 99 | 95 | if (!CollectionUtils.isEmpty(entriesToRemove)) { |
| 100 | - for (Map.Entry<JSONObject, ZLMHttpHookSubscribe.Event> entry : entriesToRemove) { | |
| 96 | + for (Map.Entry<IHookSubscribe, ZLMHttpHookSubscribe.Event> entry : entriesToRemove) { | |
| 101 | 97 | entries.remove(entry); |
| 102 | 98 | } |
| 103 | 99 | } |
| ... | ... | @@ -111,17 +107,25 @@ public class ZLMHttpHookSubscribe { |
| 111 | 107 | * @return |
| 112 | 108 | */ |
| 113 | 109 | public List<ZLMHttpHookSubscribe.Event> getSubscribes(HookType type) { |
| 114 | - // ZLMHttpHookSubscribe.Event event= null; | |
| 115 | - Map<JSONObject, Event> eventMap = allSubscribes.get(type); | |
| 110 | + Map<IHookSubscribe, Event> eventMap = allSubscribes.get(type); | |
| 116 | 111 | if (eventMap == null) { |
| 117 | 112 | return null; |
| 118 | 113 | } |
| 119 | 114 | List<ZLMHttpHookSubscribe.Event> result = new ArrayList<>(); |
| 120 | - for (JSONObject key : eventMap.keySet()) { | |
| 115 | + for (IHookSubscribe key : eventMap.keySet()) { | |
| 121 | 116 | result.add(eventMap.get(key)); |
| 122 | 117 | } |
| 123 | 118 | return result; |
| 124 | 119 | } |
| 125 | 120 | |
| 121 | + public List<IHookSubscribe> getAll(){ | |
| 122 | + ArrayList<IHookSubscribe> result = new ArrayList<>(); | |
| 123 | + Collection<Map<IHookSubscribe, Event>> values = allSubscribes.values(); | |
| 124 | + for (Map<IHookSubscribe, Event> value : values) { | |
| 125 | + result.addAll(value.keySet()); | |
| 126 | + } | |
| 127 | + return result; | |
| 128 | + } | |
| 129 | + | |
| 126 | 130 | |
| 127 | 131 | } | ... | ... |
src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMMediaListManager.java
| ... | ... | @@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONObject; |
| 4 | 4 | import com.genersoft.iot.vmp.conf.UserSetting; |
| 5 | 5 | import com.genersoft.iot.vmp.gb28181.bean.GbStream; |
| 6 | 6 | import com.genersoft.iot.vmp.media.zlm.dto.*; |
| 7 | +import com.genersoft.iot.vmp.service.IMediaServerService; | |
| 7 | 8 | import com.genersoft.iot.vmp.service.IStreamProxyService; |
| 8 | 9 | import com.genersoft.iot.vmp.service.IStreamPushService; |
| 9 | 10 | import com.genersoft.iot.vmp.service.bean.ThirdPartyGB; |
| ... | ... | @@ -63,99 +64,48 @@ public class ZLMMediaListManager { |
| 63 | 64 | @Autowired |
| 64 | 65 | private UserSetting userSetting; |
| 65 | 66 | |
| 66 | - private Map<String, ChannelOnlineEvent> channelOnlineEvents = new ConcurrentHashMap<>(); | |
| 67 | - | |
| 68 | - | |
| 69 | - public void updateMediaList(MediaServerItem mediaServerItem) { | |
| 70 | - storager.clearMediaList(); | |
| 71 | - | |
| 72 | - // 使用异步的当时更新媒体流列表 | |
| 73 | - zlmresTfulUtils.getMediaList(mediaServerItem, (mediaList ->{ | |
| 74 | - if (mediaList == null) { | |
| 75 | - return; | |
| 76 | - } | |
| 77 | - String dataStr = mediaList.getString("data"); | |
| 78 | - | |
| 79 | - Integer code = mediaList.getInteger("code"); | |
| 80 | - Map<String, StreamPushItem> result = new HashMap<>(); | |
| 81 | - List<StreamPushItem> streamPushItems = null; | |
| 82 | - // 获取所有的国标关联 | |
| 83 | -// List<GbStream> gbStreams = gbStreamMapper.selectAllByMediaServerId(mediaServerItem.getId()); | |
| 84 | - if (code == 0 ) { | |
| 85 | - if (dataStr != null) { | |
| 86 | - streamPushItems = streamPushService.handleJSON(dataStr, mediaServerItem); | |
| 87 | - } | |
| 88 | - }else { | |
| 89 | - logger.warn("更新视频流失败,错误code: " + code); | |
| 90 | - } | |
| 91 | - | |
| 92 | - if (streamPushItems != null) { | |
| 93 | - storager.updateMediaList(streamPushItems); | |
| 94 | - for (StreamPushItem streamPushItem : streamPushItems) { | |
| 95 | - JSONObject jsonObject = new JSONObject(); | |
| 96 | - jsonObject.put("app", streamPushItem.getApp()); | |
| 97 | - jsonObject.put("stream", streamPushItem.getStream()); | |
| 98 | - jsonObject.put("mediaServerId", mediaServerItem.getId()); | |
| 99 | - subscribe.addSubscribe(ZLMHttpHookSubscribe.HookType.on_play,jsonObject, | |
| 100 | - (MediaServerItem mediaServerItemInuse, JSONObject response)->{ | |
| 101 | - updateMedia(mediaServerItem, response.getString("app"), response.getString("stream")); | |
| 102 | - } | |
| 103 | - ); | |
| 104 | - } | |
| 105 | - } | |
| 106 | - })); | |
| 67 | + @Autowired | |
| 68 | + private ZLMRTPServerFactory zlmrtpServerFactory; | |
| 107 | 69 | |
| 108 | - } | |
| 70 | + @Autowired | |
| 71 | + private IMediaServerService mediaServerService; | |
| 109 | 72 | |
| 110 | - public void addMedia(MediaServerItem mediaServerItem, String app, String streamId) { | |
| 111 | - //使用异步更新推流 | |
| 112 | - updateMedia(mediaServerItem, app, streamId); | |
| 113 | - } | |
| 73 | + private Map<String, ChannelOnlineEvent> channelOnPublishEvents = new ConcurrentHashMap<>(); | |
| 114 | 74 | |
| 115 | 75 | public StreamPushItem addPush(MediaItem mediaItem) { |
| 116 | 76 | // 查找此直播流是否存在redis预设gbId |
| 117 | 77 | StreamPushItem transform = streamPushService.transform(mediaItem); |
| 118 | 78 | StreamPushItem pushInDb = streamPushService.getPush(mediaItem.getApp(), mediaItem.getStream()); |
| 119 | - transform.setPushIng(true); | |
| 79 | + transform.setPushIng(mediaItem.isRegist()); | |
| 120 | 80 | transform.setUpdateTime(DateUtil.getNow()); |
| 121 | 81 | transform.setPushTime(DateUtil.getNow()); |
| 82 | + transform.setSelf(userSetting.getServerId().equals(mediaItem.getSeverId())); | |
| 122 | 83 | if (pushInDb == null) { |
| 123 | 84 | transform.setCreateTime(DateUtil.getNow()); |
| 124 | 85 | streamPushMapper.add(transform); |
| 125 | 86 | }else { |
| 126 | 87 | streamPushMapper.update(transform); |
| 127 | 88 | } |
| 89 | + if (transform != null) { | |
| 90 | + if (getChannelOnlineEventLister(transform.getApp(), transform.getStream()) != null) { | |
| 91 | + getChannelOnlineEventLister(transform.getApp(), transform.getStream()).run(transform.getApp(), transform.getStream(), transform.getServerId()); | |
| 92 | + removedChannelOnlineEventLister(transform.getApp(), transform.getStream()); | |
| 93 | + } | |
| 94 | + } | |
| 128 | 95 | return transform; |
| 129 | 96 | } |
| 130 | 97 | |
| 131 | - | |
| 132 | - public void updateMedia(MediaServerItem mediaServerItem, String app, String streamId) { | |
| 133 | - //使用异步更新推流 | |
| 134 | - zlmresTfulUtils.getMediaList(mediaServerItem, app, streamId, "rtmp", json->{ | |
| 135 | - | |
| 136 | - if (json == null) { | |
| 137 | - return; | |
| 138 | - } | |
| 139 | - String dataStr = json.getString("data"); | |
| 140 | - | |
| 141 | - Integer code = json.getInteger("code"); | |
| 142 | - Map<String, StreamPushItem> result = new HashMap<>(); | |
| 143 | - List<StreamPushItem> streamPushItems = null; | |
| 144 | - if (code == 0 ) { | |
| 145 | - if (dataStr != null) { | |
| 146 | - streamPushItems = streamPushService.handleJSON(dataStr, mediaServerItem); | |
| 147 | - } | |
| 148 | - }else { | |
| 149 | - logger.warn("更新视频流失败,错误code: " + code); | |
| 98 | + public void sendStreamEvent(String app, String stream, String mediaServerId) { | |
| 99 | + MediaServerItem mediaServerItem = mediaServerService.getOne(mediaServerId); | |
| 100 | + // 查看推流状态 | |
| 101 | + if (zlmrtpServerFactory.isStreamReady(mediaServerItem, app, stream)) { | |
| 102 | + if (getChannelOnlineEventLister(app, stream) != null) { | |
| 103 | + getChannelOnlineEventLister(app, stream).run(app, stream, mediaServerId); | |
| 104 | + removedChannelOnlineEventLister(app, stream); | |
| 150 | 105 | } |
| 151 | - | |
| 152 | - if (streamPushItems != null && streamPushItems.size() == 1) { | |
| 153 | - storager.updateMedia(streamPushItems.get(0)); | |
| 154 | - } | |
| 155 | - }); | |
| 106 | + } | |
| 156 | 107 | } |
| 157 | 108 | |
| 158 | - | |
| 159 | 109 | public int removeMedia(String app, String streamId) { |
| 160 | 110 | // 查找是否关联了国标, 关联了不删除, 置为离线 |
| 161 | 111 | GbStream gbStream = gbStreamMapper.selectOne(app, streamId); |
| ... | ... | @@ -163,48 +113,21 @@ public class ZLMMediaListManager { |
| 163 | 113 | if (gbStream == null) { |
| 164 | 114 | result = storager.removeMedia(app, streamId); |
| 165 | 115 | }else { |
| 166 | - // TODO 暂不设置为离线 | |
| 167 | 116 | result =storager.mediaOffline(app, streamId); |
| 168 | 117 | } |
| 169 | 118 | return result; |
| 170 | 119 | } |
| 171 | 120 | |
| 172 | - public void addChannelOnlineEventLister(String key, ChannelOnlineEvent callback) { | |
| 173 | - this.channelOnlineEvents.put(key,callback); | |
| 121 | + public void addChannelOnlineEventLister(String app, String stream, ChannelOnlineEvent callback) { | |
| 122 | + this.channelOnPublishEvents.put(app + "_" + stream, callback); | |
| 174 | 123 | } |
| 175 | 124 | |
| 176 | - public void removedChannelOnlineEventLister(String key) { | |
| 177 | - this.channelOnlineEvents.remove(key); | |
| 125 | + public void removedChannelOnlineEventLister(String app, String stream) { | |
| 126 | + this.channelOnPublishEvents.remove(app + "_" + stream); | |
| 178 | 127 | } |
| 179 | 128 | |
| 129 | + public ChannelOnlineEvent getChannelOnlineEventLister(String app, String stream) { | |
| 130 | + return this.channelOnPublishEvents.get(app + "_" + stream); | |
| 131 | + } | |
| 180 | 132 | |
| 181 | - | |
| 182 | -// public void clearAllSessions() { | |
| 183 | -// logger.info("清空所有国标相关的session"); | |
| 184 | -// JSONObject allSessionJSON = zlmresTfulUtils.getAllSession(); | |
| 185 | -// ZLMServerConfig mediaInfo = redisCatchStorage.getMediaInfo(); | |
| 186 | -// HashSet<String> allLocalPorts = new HashSet(); | |
| 187 | -// if (allSessionJSON.getInteger("code") == 0) { | |
| 188 | -// JSONArray data = allSessionJSON.getJSONArray("data"); | |
| 189 | -// if (data.size() > 0) { | |
| 190 | -// for (int i = 0; i < data.size(); i++) { | |
| 191 | -// JSONObject sessionJOSN = data.getJSONObject(i); | |
| 192 | -// Integer local_port = sessionJOSN.getInteger("local_port"); | |
| 193 | -// if (!local_port.equals(Integer.valueOf(mediaInfo.getHttpPort())) && | |
| 194 | -// !local_port.equals(Integer.valueOf(mediaInfo.getHttpSSLport())) && | |
| 195 | -// !local_port.equals(Integer.valueOf(mediaInfo.getRtmpPort())) && | |
| 196 | -// !local_port.equals(Integer.valueOf(mediaInfo.getRtspPort())) && | |
| 197 | -// !local_port.equals(Integer.valueOf(mediaInfo.getRtspSSlport())) && | |
| 198 | -// !local_port.equals(Integer.valueOf(mediaInfo.getHookOnFlowReport()))){ | |
| 199 | -// allLocalPorts.add(sessionJOSN.getInteger("local_port") + ""); | |
| 200 | -// } | |
| 201 | -// } | |
| 202 | -// } | |
| 203 | -// } | |
| 204 | -// if (allLocalPorts.size() > 0) { | |
| 205 | -// List<String> result = new ArrayList<>(allLocalPorts); | |
| 206 | -// String localPortSStr = String.join(",", result); | |
| 207 | -// zlmresTfulUtils.kickSessions(localPortSStr); | |
| 208 | -// } | |
| 209 | -// } | |
| 210 | 133 | } | ... | ... |
src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMRTPServerFactory.java
| ... | ... | @@ -87,7 +87,7 @@ public class ZLMRTPServerFactory { |
| 87 | 87 | return result; |
| 88 | 88 | } |
| 89 | 89 | |
| 90 | - public int createRTPServer(MediaServerItem mediaServerItem, String streamId, int ssrc) { | |
| 90 | + public int createRTPServer(MediaServerItem mediaServerItem, String streamId, int ssrc, Integer port) { | |
| 91 | 91 | int result = -1; |
| 92 | 92 | // 查询此rtp server 是否已经存在 |
| 93 | 93 | JSONObject rtpInfo = zlmresTfulUtils.getRtpInfo(mediaServerItem, streamId); |
| ... | ... | @@ -105,7 +105,11 @@ public class ZLMRTPServerFactory { |
| 105 | 105 | param.put("enable_tcp", 1); |
| 106 | 106 | param.put("stream_id", streamId); |
| 107 | 107 | // 推流端口设置0则使用随机端口 |
| 108 | - param.put("port", 0); | |
| 108 | + if (port == null) { | |
| 109 | + param.put("port", 0); | |
| 110 | + }else { | |
| 111 | + param.put("port", port); | |
| 112 | + } | |
| 109 | 113 | param.put("ssrc", ssrc); |
| 110 | 114 | JSONObject openRtpServerResultJson = zlmresTfulUtils.openRtpServer(mediaServerItem, param); |
| 111 | 115 | |
| ... | ... | @@ -273,8 +277,10 @@ public class ZLMRTPServerFactory { |
| 273 | 277 | * 查询待转推的流是否就绪 |
| 274 | 278 | */ |
| 275 | 279 | public Boolean isStreamReady(MediaServerItem mediaServerItem, String app, String streamId) { |
| 276 | - JSONObject mediaInfo = zlmresTfulUtils.getMediaInfo(mediaServerItem, app, "rtmp", streamId); | |
| 277 | - return (mediaInfo.getInteger("code") == 0 && mediaInfo.getBoolean("online")); | |
| 280 | + JSONObject mediaInfo = zlmresTfulUtils.getMediaList(mediaServerItem, app, streamId); | |
| 281 | + return (mediaInfo.getInteger("code") == 0 | |
| 282 | + && mediaInfo.getJSONArray("data") != null | |
| 283 | + && mediaInfo.getJSONArray("data").size() > 0); | |
| 278 | 284 | } |
| 279 | 285 | |
| 280 | 286 | /** | ... | ... |
src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMRunner.java
| ... | ... | @@ -6,22 +6,22 @@ import com.alibaba.fastjson.JSONObject; |
| 6 | 6 | import com.genersoft.iot.vmp.conf.DynamicTask; |
| 7 | 7 | import com.genersoft.iot.vmp.conf.MediaConfig; |
| 8 | 8 | import com.genersoft.iot.vmp.gb28181.event.EventPublisher; |
| 9 | +import com.genersoft.iot.vmp.media.zlm.dto.HookSubscribeFactory; | |
| 10 | +import com.genersoft.iot.vmp.media.zlm.dto.HookSubscribeForServerStarted; | |
| 11 | +import com.genersoft.iot.vmp.media.zlm.dto.HookSubscribeForStreamChange; | |
| 9 | 12 | import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem; |
| 10 | 13 | import com.genersoft.iot.vmp.service.IMediaServerService; |
| 11 | -import com.genersoft.iot.vmp.service.IStreamProxyService; | |
| 12 | -import com.genersoft.iot.vmp.storager.IRedisCatchStorage; | |
| 13 | 14 | import org.slf4j.Logger; |
| 14 | 15 | import org.slf4j.LoggerFactory; |
| 15 | 16 | import org.springframework.beans.factory.annotation.Autowired; |
| 16 | -import org.springframework.beans.factory.annotation.Qualifier; | |
| 17 | 17 | import org.springframework.boot.CommandLineRunner; |
| 18 | 18 | import org.springframework.core.annotation.Order; |
| 19 | 19 | import org.springframework.scheduling.annotation.Async; |
| 20 | -import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; | |
| 21 | 20 | import org.springframework.stereotype.Component; |
| 22 | -import org.springframework.util.StringUtils; | |
| 23 | 21 | |
| 22 | +import java.time.Instant; | |
| 24 | 23 | import java.util.*; |
| 24 | +import java.util.concurrent.TimeUnit; | |
| 25 | 25 | |
| 26 | 26 | @Component |
| 27 | 27 | @Order(value=1) |
| ... | ... | @@ -38,18 +38,12 @@ public class ZLMRunner implements CommandLineRunner { |
| 38 | 38 | private ZLMHttpHookSubscribe hookSubscribe; |
| 39 | 39 | |
| 40 | 40 | @Autowired |
| 41 | - private IStreamProxyService streamProxyService; | |
| 42 | - | |
| 43 | - @Autowired | |
| 44 | 41 | private EventPublisher publisher; |
| 45 | 42 | |
| 46 | 43 | @Autowired |
| 47 | 44 | private IMediaServerService mediaServerService; |
| 48 | 45 | |
| 49 | 46 | @Autowired |
| 50 | - private IRedisCatchStorage redisCatchStorage; | |
| 51 | - | |
| 52 | - @Autowired | |
| 53 | 47 | private MediaConfig mediaConfig; |
| 54 | 48 | |
| 55 | 49 | @Autowired |
| ... | ... | @@ -67,26 +61,24 @@ public class ZLMRunner implements CommandLineRunner { |
| 67 | 61 | mediaServerService.updateToDatabase(mediaSerItem); |
| 68 | 62 | } |
| 69 | 63 | mediaServerService.syncCatchFromDatabase(); |
| 64 | + HookSubscribeForServerStarted hookSubscribeForServerStarted = HookSubscribeFactory.on_server_started(); | |
| 65 | +// Instant expiresInstant = Instant.now().plusSeconds(TimeUnit.SECONDS.toSeconds(60)); | |
| 66 | +// hookSubscribeForStreamChange.setExpires(expiresInstant); | |
| 70 | 67 | // 订阅 zlm启动事件, 新的zlm也会从这里进入系统 |
| 71 | - hookSubscribe.addSubscribe(ZLMHttpHookSubscribe.HookType.on_server_started,new JSONObject(), | |
| 68 | + hookSubscribe.addSubscribe(hookSubscribeForServerStarted, | |
| 72 | 69 | (MediaServerItem mediaServerItem, JSONObject response)->{ |
| 73 | 70 | ZLMServerConfig zlmServerConfig = JSONObject.toJavaObject(response, ZLMServerConfig.class); |
| 74 | 71 | if (zlmServerConfig !=null ) { |
| 75 | 72 | if (startGetMedia != null) { |
| 76 | 73 | startGetMedia.remove(zlmServerConfig.getGeneralMediaServerId()); |
| 74 | + if (startGetMedia.size() == 0) { | |
| 75 | + hookSubscribe.removeSubscribe(HookSubscribeFactory.on_server_started()); | |
| 76 | + } | |
| 77 | 77 | } |
| 78 | - mediaServerService.zlmServerOnline(zlmServerConfig); | |
| 79 | 78 | } |
| 80 | 79 | }); |
| 81 | 80 | |
| 82 | - // 订阅 zlm保活事件, 当zlm离线时做业务的处理 | |
| 83 | - hookSubscribe.addSubscribe(ZLMHttpHookSubscribe.HookType.on_server_keepalive,new JSONObject(), | |
| 84 | - (MediaServerItem mediaServerItem, JSONObject response)->{ | |
| 85 | - String mediaServerId = response.getString("mediaServerId"); | |
| 86 | - if (mediaServerId !=null ) { | |
| 87 | - mediaServerService.updateMediaServerKeepalive(mediaServerId, response.getJSONObject("data")); | |
| 88 | - } | |
| 89 | - }); | |
| 81 | + | |
| 90 | 82 | |
| 91 | 83 | // 获取zlm信息 |
| 92 | 84 | logger.info("[zlm] 等待默认zlm中..."); |
| ... | ... | @@ -125,6 +117,9 @@ public class ZLMRunner implements CommandLineRunner { |
| 125 | 117 | zlmServerConfigFirst.setIp(mediaServerItem.getIp()); |
| 126 | 118 | zlmServerConfigFirst.setHttpPort(mediaServerItem.getHttpPort()); |
| 127 | 119 | startGetMedia.remove(mediaServerItem.getId()); |
| 120 | + if (startGetMedia.size() == 0) { | |
| 121 | + hookSubscribe.removeSubscribe(HookSubscribeFactory.on_server_started()); | |
| 122 | + } | |
| 128 | 123 | mediaServerService.zlmServerOnline(zlmServerConfigFirst); |
| 129 | 124 | }else { |
| 130 | 125 | logger.info("[ {} ]-[ {}:{} ]主动连接失败, 清理相关资源, 开始尝试重试连接", |
| ... | ... | @@ -139,6 +134,9 @@ public class ZLMRunner implements CommandLineRunner { |
| 139 | 134 | zlmServerConfig.setIp(mediaServerItem.getIp()); |
| 140 | 135 | zlmServerConfig.setHttpPort(mediaServerItem.getHttpPort()); |
| 141 | 136 | startGetMedia.remove(mediaServerItem.getId()); |
| 137 | + if (startGetMedia.size() == 0) { | |
| 138 | + hookSubscribe.removeSubscribe(HookSubscribeFactory.on_server_started()); | |
| 139 | + } | |
| 142 | 140 | mediaServerService.zlmServerOnline(zlmServerConfig); |
| 143 | 141 | } |
| 144 | 142 | }, 2000); | ... | ... |
src/main/java/com/genersoft/iot/vmp/media/zlm/dto/HookSubscribeFactory.java
0 → 100644
| 1 | +package com.genersoft.iot.vmp.media.zlm.dto; | |
| 2 | + | |
| 3 | + | |
| 4 | +import com.alibaba.fastjson.JSONObject; | |
| 5 | + | |
| 6 | +/** | |
| 7 | + * hook 订阅工厂 | |
| 8 | + * @author lin | |
| 9 | + */ | |
| 10 | +public class HookSubscribeFactory { | |
| 11 | + | |
| 12 | + public static HookSubscribeForStreamChange on_stream_changed(String app, String stream, boolean regist, String scheam, String mediaServerId) { | |
| 13 | + HookSubscribeForStreamChange hookSubscribe = new HookSubscribeForStreamChange(); | |
| 14 | + JSONObject subscribeKey = new com.alibaba.fastjson.JSONObject(); | |
| 15 | + subscribeKey.put("app", app); | |
| 16 | + subscribeKey.put("stream", stream); | |
| 17 | + subscribeKey.put("regist", regist); | |
| 18 | + if (scheam != null) { | |
| 19 | + subscribeKey.put("schema", scheam); | |
| 20 | + } | |
| 21 | + subscribeKey.put("mediaServerId", mediaServerId); | |
| 22 | + hookSubscribe.setContent(subscribeKey); | |
| 23 | + | |
| 24 | + return hookSubscribe; | |
| 25 | + } | |
| 26 | + | |
| 27 | + public static HookSubscribeForServerStarted on_server_started() { | |
| 28 | + HookSubscribeForServerStarted hookSubscribe = new HookSubscribeForServerStarted(); | |
| 29 | + hookSubscribe.setContent(new JSONObject()); | |
| 30 | + | |
| 31 | + return hookSubscribe; | |
| 32 | + } | |
| 33 | +} | ... | ... |
src/main/java/com/genersoft/iot/vmp/media/zlm/dto/HookSubscribeForServerStarted.java
0 → 100644
| 1 | +package com.genersoft.iot.vmp.media.zlm.dto; | |
| 2 | + | |
| 3 | +import com.alibaba.fastjson.JSONObject; | |
| 4 | +import com.alibaba.fastjson.annotation.JSONField; | |
| 5 | + | |
| 6 | +import java.time.Instant; | |
| 7 | + | |
| 8 | +/** | |
| 9 | + * hook订阅-流变化 | |
| 10 | + * @author lin | |
| 11 | + */ | |
| 12 | +public class HookSubscribeForServerStarted implements IHookSubscribe{ | |
| 13 | + | |
| 14 | + private HookType hookType = HookType.on_server_started; | |
| 15 | + | |
| 16 | + private JSONObject content; | |
| 17 | + | |
| 18 | + @JSONField(format="yyyy-MM-dd HH:mm:ss") | |
| 19 | + private Instant expires; | |
| 20 | + | |
| 21 | + @Override | |
| 22 | + public HookType getHookType() { | |
| 23 | + return hookType; | |
| 24 | + } | |
| 25 | + | |
| 26 | + @Override | |
| 27 | + public JSONObject getContent() { | |
| 28 | + return content; | |
| 29 | + } | |
| 30 | + | |
| 31 | + public void setContent(JSONObject content) { | |
| 32 | + this.content = content; | |
| 33 | + } | |
| 34 | + | |
| 35 | + @Override | |
| 36 | + public Instant getExpires() { | |
| 37 | + return expires; | |
| 38 | + } | |
| 39 | + | |
| 40 | + @Override | |
| 41 | + public void setExpires(Instant expires) { | |
| 42 | + this.expires = expires; | |
| 43 | + } | |
| 44 | +} | ... | ... |
src/main/java/com/genersoft/iot/vmp/media/zlm/dto/HookSubscribeForStreamChange.java
0 → 100644
| 1 | +package com.genersoft.iot.vmp.media.zlm.dto; | |
| 2 | + | |
| 3 | +import com.alibaba.fastjson.JSONObject; | |
| 4 | +import com.alibaba.fastjson.annotation.JSONField; | |
| 5 | + | |
| 6 | +import java.time.Instant; | |
| 7 | + | |
| 8 | +/** | |
| 9 | + * hook订阅-流变化 | |
| 10 | + * @author lin | |
| 11 | + */ | |
| 12 | +public class HookSubscribeForStreamChange implements IHookSubscribe{ | |
| 13 | + | |
| 14 | + private HookType hookType = HookType.on_stream_changed; | |
| 15 | + | |
| 16 | + private JSONObject content; | |
| 17 | + | |
| 18 | + private Instant expires; | |
| 19 | + | |
| 20 | + @Override | |
| 21 | + public HookType getHookType() { | |
| 22 | + return hookType; | |
| 23 | + } | |
| 24 | + | |
| 25 | + @Override | |
| 26 | + public JSONObject getContent() { | |
| 27 | + return content; | |
| 28 | + } | |
| 29 | + | |
| 30 | + public void setContent(JSONObject content) { | |
| 31 | + this.content = content; | |
| 32 | + } | |
| 33 | + | |
| 34 | + @Override | |
| 35 | + public Instant getExpires() { | |
| 36 | + return expires; | |
| 37 | + } | |
| 38 | + | |
| 39 | + @Override | |
| 40 | + public void setExpires(Instant expires) { | |
| 41 | + this.expires = expires; | |
| 42 | + } | |
| 43 | +} | ... | ... |
src/main/java/com/genersoft/iot/vmp/media/zlm/dto/HookType.java
0 → 100644
| 1 | +package com.genersoft.iot.vmp.media.zlm.dto; | |
| 2 | + | |
| 3 | +/** | |
| 4 | + * hook类型 | |
| 5 | + * @author lin | |
| 6 | + */ | |
| 7 | + | |
| 8 | +public enum HookType { | |
| 9 | + | |
| 10 | + on_flow_report, | |
| 11 | + on_http_access, | |
| 12 | + on_play, | |
| 13 | + on_publish, | |
| 14 | + on_record_mp4, | |
| 15 | + on_rtsp_auth, | |
| 16 | + on_rtsp_realm, | |
| 17 | + on_shell_login, | |
| 18 | + on_stream_changed, | |
| 19 | + on_stream_none_reader, | |
| 20 | + on_stream_not_found, | |
| 21 | + on_server_started, | |
| 22 | + on_server_keepalive | |
| 23 | +} | ... | ... |
src/main/java/com/genersoft/iot/vmp/media/zlm/dto/IHookSubscribe.java
0 → 100644
| 1 | +package com.genersoft.iot.vmp.media.zlm.dto; | |
| 2 | + | |
| 3 | +import com.alibaba.fastjson.JSONObject; | |
| 4 | + | |
| 5 | +import java.time.Instant; | |
| 6 | + | |
| 7 | +/** | |
| 8 | + * zlm hook事件的参数 | |
| 9 | + * @author lin | |
| 10 | + */ | |
| 11 | +public interface IHookSubscribe { | |
| 12 | + | |
| 13 | + /** | |
| 14 | + * 获取hook类型 | |
| 15 | + * @return hook类型 | |
| 16 | + */ | |
| 17 | + HookType getHookType(); | |
| 18 | + | |
| 19 | + /** | |
| 20 | + * 获取hook的具体内容 | |
| 21 | + * @return hook的具体内容 | |
| 22 | + */ | |
| 23 | + JSONObject getContent(); | |
| 24 | + | |
| 25 | + /** | |
| 26 | + * 设置过期时间 | |
| 27 | + * @param instant 过期时间 | |
| 28 | + */ | |
| 29 | + void setExpires(Instant instant); | |
| 30 | + | |
| 31 | + /** | |
| 32 | + * 获取过期时间 | |
| 33 | + * @return 过期时间 | |
| 34 | + */ | |
| 35 | + Instant getExpires(); | |
| 36 | +} | ... | ... |
src/main/java/com/genersoft/iot/vmp/media/zlm/dto/StreamPushItem.java
| ... | ... | @@ -108,6 +108,13 @@ public class StreamPushItem extends GbStream implements Comparable<StreamPushIte |
| 108 | 108 | */ |
| 109 | 109 | private boolean pushIng; |
| 110 | 110 | |
| 111 | + /** | |
| 112 | + * 是否自己平台的推流 | |
| 113 | + */ | |
| 114 | + private boolean self; | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 111 | 118 | public String getVhost() { |
| 112 | 119 | return vhost; |
| 113 | 120 | } |
| ... | ... | @@ -290,5 +297,13 @@ public class StreamPushItem extends GbStream implements Comparable<StreamPushIte |
| 290 | 297 | public void setPushIng(boolean pushIng) { |
| 291 | 298 | this.pushIng = pushIng; |
| 292 | 299 | } |
| 300 | + | |
| 301 | + public boolean isSelf() { | |
| 302 | + return self; | |
| 303 | + } | |
| 304 | + | |
| 305 | + public void setSelf(boolean self) { | |
| 306 | + this.self = self; | |
| 307 | + } | |
| 293 | 308 | } |
| 294 | 309 | ... | ... |
src/main/java/com/genersoft/iot/vmp/service/IMediaServerService.java
| ... | ... | @@ -48,6 +48,8 @@ public interface IMediaServerService { |
| 48 | 48 | |
| 49 | 49 | SSRCInfo openRTPServer(MediaServerItem mediaServerItem, String streamId, String ssrc, boolean ssrcCheck, boolean isPlayback); |
| 50 | 50 | |
| 51 | + SSRCInfo openRTPServer(MediaServerItem mediaServerItem, String streamId, String ssrc, boolean ssrcCheck, boolean isPlayback, Integer port); | |
| 52 | + | |
| 51 | 53 | void closeRTPServer(String deviceId, String channelId, String ssrc); |
| 52 | 54 | |
| 53 | 55 | void clearRTPServer(MediaServerItem mediaServerItem); | ... | ... |
src/main/java/com/genersoft/iot/vmp/service/IStreamPushService.java
src/main/java/com/genersoft/iot/vmp/service/StreamGPSSubscribeTask.java deleted
100644 → 0
| 1 | -package com.genersoft.iot.vmp.service; | |
| 2 | - | |
| 3 | -import com.genersoft.iot.vmp.service.bean.GPSMsgInfo; | |
| 4 | -import com.genersoft.iot.vmp.storager.IRedisCatchStorage; | |
| 5 | -import com.genersoft.iot.vmp.storager.IVideoManagerStorage; | |
| 6 | -import org.springframework.beans.factory.annotation.Autowired; | |
| 7 | -import org.springframework.scheduling.annotation.Scheduled; | |
| 8 | -import org.springframework.stereotype.Component; | |
| 9 | - | |
| 10 | -import java.util.List; | |
| 11 | - | |
| 12 | - | |
| 13 | -/** | |
| 14 | - * 定时查找redis中的GPS推送消息,并保存到对应的流中 | |
| 15 | - */ | |
| 16 | -@Component | |
| 17 | -public class StreamGPSSubscribeTask { | |
| 18 | - | |
| 19 | - @Autowired | |
| 20 | - private IRedisCatchStorage redisCatchStorage; | |
| 21 | - | |
| 22 | - @Autowired | |
| 23 | - private IVideoManagerStorage storager; | |
| 24 | - | |
| 25 | - | |
| 26 | - @Scheduled(fixedRate = 30 * 1000) //每30秒执行一次 | |
| 27 | - public void execute(){ | |
| 28 | - List<GPSMsgInfo> gpsMsgInfo = redisCatchStorage.getAllGpsMsgInfo(); | |
| 29 | - if (gpsMsgInfo.size() > 0) { | |
| 30 | - storager.updateStreamGPS(gpsMsgInfo); | |
| 31 | - for (GPSMsgInfo msgInfo : gpsMsgInfo) { | |
| 32 | - msgInfo.setStored(true); | |
| 33 | - redisCatchStorage.updateGpsMsgInfo(msgInfo); | |
| 34 | - } | |
| 35 | - } | |
| 36 | - | |
| 37 | - } | |
| 38 | -} |
src/main/java/com/genersoft/iot/vmp/service/impl/DeviceServiceImpl.java
| ... | ... | @@ -86,10 +86,10 @@ public class DeviceServiceImpl implements IDeviceService { |
| 86 | 86 | redisCatchStorage.clearCatchByDeviceId(device.getDeviceId()); |
| 87 | 87 | } |
| 88 | 88 | device.setUpdateTime(now); |
| 89 | - device.setOnline(1); | |
| 90 | 89 | |
| 91 | - // 第一次上线 | |
| 90 | + // 第一次上线 或则设备之前是离线状态--进行通道同步和设备信息查询 | |
| 92 | 91 | if (device.getCreateTime() == null) { |
| 92 | + device.setOnline(1); | |
| 93 | 93 | device.setCreateTime(now); |
| 94 | 94 | logger.info("[设备上线,首次注册]: {},查询设备信息以及通道信息", device.getDeviceId()); |
| 95 | 95 | deviceMapper.add(device); |
| ... | ... | @@ -97,8 +97,19 @@ public class DeviceServiceImpl implements IDeviceService { |
| 97 | 97 | commander.deviceInfoQuery(device); |
| 98 | 98 | sync(device); |
| 99 | 99 | }else { |
| 100 | - deviceMapper.update(device); | |
| 101 | - redisCatchStorage.updateDevice(device); | |
| 100 | + if(device.getOnline() == 0){ | |
| 101 | + device.setOnline(1); | |
| 102 | + device.setCreateTime(now); | |
| 103 | + logger.info("[设备上线,离线状态下重新注册]: {},查询设备信息以及通道信息", device.getDeviceId()); | |
| 104 | + deviceMapper.update(device); | |
| 105 | + redisCatchStorage.updateDevice(device); | |
| 106 | + commander.deviceInfoQuery(device); | |
| 107 | + sync(device); | |
| 108 | + }else { | |
| 109 | + deviceMapper.update(device); | |
| 110 | + redisCatchStorage.updateDevice(device); | |
| 111 | + } | |
| 112 | + | |
| 102 | 113 | } |
| 103 | 114 | |
| 104 | 115 | // 上线添加订阅 |
| ... | ... | @@ -125,6 +136,8 @@ public class DeviceServiceImpl implements IDeviceService { |
| 125 | 136 | device.setOnline(0); |
| 126 | 137 | redisCatchStorage.updateDevice(device); |
| 127 | 138 | deviceMapper.update(device); |
| 139 | + //进行通道离线 | |
| 140 | + deviceChannelMapper.offlineByDeviceId(deviceId); | |
| 128 | 141 | // 离线释放所有ssrc |
| 129 | 142 | List<SsrcTransaction> ssrcTransactions = streamSession.getSsrcTransactionForAll(deviceId, null, null, null); |
| 130 | 143 | if (ssrcTransactions != null && ssrcTransactions.size() > 0) { |
| ... | ... | @@ -147,7 +160,7 @@ public class DeviceServiceImpl implements IDeviceService { |
| 147 | 160 | logger.info("[添加目录订阅] 设备{}", device.getDeviceId()); |
| 148 | 161 | // 添加目录订阅 |
| 149 | 162 | CatalogSubscribeTask catalogSubscribeTask = new CatalogSubscribeTask(device, sipCommander, dynamicTask); |
| 150 | - // 提前开始刷新订阅 | |
| 163 | + // 刷新订阅 | |
| 151 | 164 | int subscribeCycleForCatalog = Math.max(device.getSubscribeCycleForCatalog(),30); |
| 152 | 165 | // 设置最小值为30 |
| 153 | 166 | dynamicTask.startCron(device.getDeviceId() + "catalog", catalogSubscribeTask, (subscribeCycleForCatalog -1) * 1000); |
| ... | ... | @@ -182,8 +195,8 @@ public class DeviceServiceImpl implements IDeviceService { |
| 182 | 195 | MobilePositionSubscribeTask mobilePositionSubscribeTask = new MobilePositionSubscribeTask(device, sipCommander, dynamicTask); |
| 183 | 196 | // 设置最小值为30 |
| 184 | 197 | int subscribeCycleForCatalog = Math.max(device.getSubscribeCycleForMobilePosition(),30); |
| 185 | - // 提前开始刷新订阅 | |
| 186 | - dynamicTask.startCron(device.getDeviceId() + "mobile_position" , mobilePositionSubscribeTask, (subscribeCycleForCatalog -1 ) * 1000); | |
| 198 | + // 刷新订阅 | |
| 199 | + dynamicTask.startCron(device.getDeviceId() + "mobile_position" , mobilePositionSubscribeTask, (subscribeCycleForCatalog) * 1000); | |
| 187 | 200 | return true; |
| 188 | 201 | } |
| 189 | 202 | ... | ... |
src/main/java/com/genersoft/iot/vmp/service/impl/MediaServerServiceImpl.java
| 1 | 1 | package com.genersoft.iot.vmp.service.impl; |
| 2 | 2 | |
| 3 | +import java.time.LocalDateTime; | |
| 4 | +import java.util.ArrayList; | |
| 5 | +import java.util.Collections; | |
| 6 | +import java.util.HashMap; | |
| 7 | +import java.util.List; | |
| 8 | +import java.util.Map; | |
| 9 | +import java.util.Set; | |
| 10 | + | |
| 11 | +import org.slf4j.Logger; | |
| 12 | +import org.slf4j.LoggerFactory; | |
| 13 | +import org.springframework.beans.factory.annotation.Autowired; | |
| 14 | +import org.springframework.beans.factory.annotation.Value; | |
| 15 | +import org.springframework.jdbc.datasource.DataSourceTransactionManager; | |
| 16 | +import org.springframework.stereotype.Service; | |
| 17 | +import org.springframework.transaction.TransactionDefinition; | |
| 18 | +import org.springframework.transaction.TransactionStatus; | |
| 19 | +import org.springframework.util.StringUtils; | |
| 20 | + | |
| 3 | 21 | import com.alibaba.fastjson.JSON; |
| 4 | 22 | import com.alibaba.fastjson.JSONArray; |
| 5 | 23 | import com.alibaba.fastjson.JSONObject; |
| 6 | 24 | import com.genersoft.iot.vmp.common.VideoManagerConstants; |
| 7 | 25 | import com.genersoft.iot.vmp.conf.SipConfig; |
| 8 | 26 | import com.genersoft.iot.vmp.conf.UserSetting; |
| 9 | -import com.genersoft.iot.vmp.gb28181.bean.SsrcTransaction; | |
| 10 | 27 | import com.genersoft.iot.vmp.gb28181.event.EventPublisher; |
| 11 | 28 | import com.genersoft.iot.vmp.gb28181.session.SsrcConfig; |
| 12 | 29 | import com.genersoft.iot.vmp.gb28181.session.VideoStreamSessionManager; |
| ... | ... | @@ -15,30 +32,16 @@ import com.genersoft.iot.vmp.media.zlm.ZLMRTPServerFactory; |
| 15 | 32 | import com.genersoft.iot.vmp.media.zlm.ZLMServerConfig; |
| 16 | 33 | import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem; |
| 17 | 34 | import com.genersoft.iot.vmp.service.IMediaServerService; |
| 18 | -import com.genersoft.iot.vmp.service.IStreamProxyService; | |
| 19 | 35 | import com.genersoft.iot.vmp.service.bean.SSRCInfo; |
| 20 | -import com.genersoft.iot.vmp.storager.IVideoManagerStorage; | |
| 21 | 36 | import com.genersoft.iot.vmp.storager.dao.MediaServerMapper; |
| 22 | 37 | import com.genersoft.iot.vmp.utils.DateUtil; |
| 23 | 38 | import com.genersoft.iot.vmp.utils.redis.JedisUtil; |
| 24 | 39 | import com.genersoft.iot.vmp.utils.redis.RedisUtil; |
| 25 | 40 | import com.genersoft.iot.vmp.vmanager.bean.WVPResult; |
| 26 | -import okhttp3.*; | |
| 27 | -import org.slf4j.Logger; | |
| 28 | -import org.slf4j.LoggerFactory; | |
| 29 | -import org.springframework.beans.factory.annotation.Autowired; | |
| 30 | -import org.springframework.beans.factory.annotation.Value; | |
| 31 | -import org.springframework.jdbc.datasource.DataSourceTransactionManager; | |
| 32 | -import org.springframework.stereotype.Service; | |
| 33 | -import org.springframework.transaction.TransactionDefinition; | |
| 34 | -import org.springframework.transaction.TransactionStatus; | |
| 35 | -import org.springframework.util.StringUtils; | |
| 36 | 41 | |
| 37 | -import java.text.ParseException; | |
| 38 | -import java.text.SimpleDateFormat; | |
| 39 | -import java.time.LocalDateTime; | |
| 40 | -import java.util.*; | |
| 41 | -import java.util.stream.Collectors; | |
| 42 | +import okhttp3.OkHttpClient; | |
| 43 | +import okhttp3.Request; | |
| 44 | +import okhttp3.Response; | |
| 42 | 45 | |
| 43 | 46 | /** |
| 44 | 47 | * 媒体服务器节点管理 |
| ... | ... | @@ -82,12 +85,6 @@ public class MediaServerServiceImpl implements IMediaServerService { |
| 82 | 85 | private RedisUtil redisUtil; |
| 83 | 86 | |
| 84 | 87 | @Autowired |
| 85 | - private IVideoManagerStorage storager; | |
| 86 | - | |
| 87 | - @Autowired | |
| 88 | - private IStreamProxyService streamProxyService; | |
| 89 | - | |
| 90 | - @Autowired | |
| 91 | 88 | private EventPublisher publisher; |
| 92 | 89 | |
| 93 | 90 | @Autowired |
| ... | ... | @@ -124,7 +121,7 @@ public class MediaServerServiceImpl implements IMediaServerService { |
| 124 | 121 | } |
| 125 | 122 | |
| 126 | 123 | @Override |
| 127 | - public SSRCInfo openRTPServer(MediaServerItem mediaServerItem, String streamId, String presetSsrc, boolean ssrcCheck, boolean isPlayback) { | |
| 124 | + public SSRCInfo openRTPServer(MediaServerItem mediaServerItem, String streamId, String presetSsrc, boolean ssrcCheck, boolean isPlayback, Integer port) { | |
| 128 | 125 | if (mediaServerItem == null || mediaServerItem.getId() == null) { |
| 129 | 126 | return null; |
| 130 | 127 | } |
| ... | ... | @@ -152,7 +149,7 @@ public class MediaServerServiceImpl implements IMediaServerService { |
| 152 | 149 | } |
| 153 | 150 | int rtpServerPort = mediaServerItem.getRtpProxyPort(); |
| 154 | 151 | if (mediaServerItem.isRtpEnable()) { |
| 155 | - rtpServerPort = zlmrtpServerFactory.createRTPServer(mediaServerItem, streamId, ssrcCheck?Integer.parseInt(ssrc):0); | |
| 152 | + rtpServerPort = zlmrtpServerFactory.createRTPServer(mediaServerItem, streamId, ssrcCheck?Integer.parseInt(ssrc):0, port); | |
| 156 | 153 | } |
| 157 | 154 | redisUtil.set(key, mediaServerItem); |
| 158 | 155 | return new SSRCInfo(rtpServerPort, ssrc, streamId); |
| ... | ... | @@ -160,6 +157,11 @@ public class MediaServerServiceImpl implements IMediaServerService { |
| 160 | 157 | } |
| 161 | 158 | |
| 162 | 159 | @Override |
| 160 | + public SSRCInfo openRTPServer(MediaServerItem mediaServerItem, String streamId, String ssrc, boolean ssrcCheck, boolean isPlayback) { | |
| 161 | + return openRTPServer(mediaServerItem, streamId, ssrc, ssrcCheck, isPlayback, null); | |
| 162 | + } | |
| 163 | + | |
| 164 | + @Override | |
| 163 | 165 | public void closeRTPServer(String deviceId, String channelId, String stream) { |
| 164 | 166 | String mediaServerId = streamSession.getMediaServerId(deviceId, channelId, stream); |
| 165 | 167 | String ssrc = streamSession.getSSRC(deviceId, channelId, stream); |
| ... | ... | @@ -355,14 +357,15 @@ public class MediaServerServiceImpl implements IMediaServerService { |
| 355 | 357 | */ |
| 356 | 358 | @Override |
| 357 | 359 | public void zlmServerOnline(ZLMServerConfig zlmServerConfig) { |
| 358 | - logger.info("[ZLM] 正在连接 : {} -> {}:{}", | |
| 359 | - zlmServerConfig.getGeneralMediaServerId(), zlmServerConfig.getIp(), zlmServerConfig.getHttpPort()); | |
| 360 | 360 | |
| 361 | 361 | MediaServerItem serverItem = mediaServerMapper.queryOne(zlmServerConfig.getGeneralMediaServerId()); |
| 362 | 362 | if (serverItem == null) { |
| 363 | 363 | logger.warn("[未注册的zlm] 拒接接入:{}来自{}:{}", zlmServerConfig.getGeneralMediaServerId(), zlmServerConfig.getIp(),zlmServerConfig.getHttpPort() ); |
| 364 | 364 | logger.warn("请检查ZLM的<general.mediaServerId>配置是否与WVP的<media.id>一致"); |
| 365 | 365 | return; |
| 366 | + }else { | |
| 367 | + logger.info("[ZLM] 正在连接 : {} -> {}:{}", | |
| 368 | + zlmServerConfig.getGeneralMediaServerId(), zlmServerConfig.getIp(), zlmServerConfig.getHttpPort()); | |
| 366 | 369 | } |
| 367 | 370 | serverItem.setHookAliveInterval(zlmServerConfig.getHookAliveInterval()); |
| 368 | 371 | if (serverItem.getHttpPort() == 0) { |
| ... | ... | @@ -599,9 +602,6 @@ public class MediaServerServiceImpl implements IMediaServerService { |
| 599 | 602 | boolean result = false; |
| 600 | 603 | OkHttpClient client = new OkHttpClient(); |
| 601 | 604 | String url = String.format("http://%s:%s/index/api/record", ip, port); |
| 602 | - | |
| 603 | - FormBody.Builder builder = new FormBody.Builder(); | |
| 604 | - | |
| 605 | 605 | Request request = new Request.Builder() |
| 606 | 606 | .get() |
| 607 | 607 | .url(url) |
| ... | ... | @@ -633,7 +633,6 @@ public class MediaServerServiceImpl implements IMediaServerService { |
| 633 | 633 | MediaServerItem mediaServerItem = getOne(mediaServerId); |
| 634 | 634 | if (mediaServerItem == null) { |
| 635 | 635 | // zlm连接重试 |
| 636 | - | |
| 637 | 636 | logger.warn("[更新ZLM 保活信息]失败,未找到流媒体信息"); |
| 638 | 637 | return; |
| 639 | 638 | } |
| ... | ... | @@ -652,7 +651,7 @@ public class MediaServerServiceImpl implements IMediaServerService { |
| 652 | 651 | mediaServerItemMap.put(mediaServerItem.getId(), mediaServerItem); |
| 653 | 652 | } |
| 654 | 653 | for (MediaServerItem mediaServerItem : allInCatch) { |
| 655 | - if (mediaServerItemMap.get(mediaServerItem) == null) { | |
| 654 | + if (!mediaServerItemMap.containsKey(mediaServerItem.getId())) { | |
| 656 | 655 | delete(mediaServerItem.getId()); |
| 657 | 656 | } |
| 658 | 657 | } | ... | ... |
src/main/java/com/genersoft/iot/vmp/service/impl/MediaServiceImpl.java
| ... | ... | @@ -67,9 +67,9 @@ public class MediaServiceImpl implements IMediaService { |
| 67 | 67 | JSONObject mediaJSON = JSON.parseObject(JSON.toJSONString(data.get(0)), JSONObject.class); |
| 68 | 68 | JSONArray tracks = mediaJSON.getJSONArray("tracks"); |
| 69 | 69 | if (authority) { |
| 70 | - streamInfo = getStreamInfoByAppAndStream(mediaInfo, app, stream, tracks, streamAuthorityInfo.getCallId()); | |
| 70 | + streamInfo = getStreamInfoByAppAndStream(mediaInfo, app, stream, tracks, addr,streamAuthorityInfo.getCallId()); | |
| 71 | 71 | }else { |
| 72 | - streamInfo = getStreamInfoByAppAndStream(mediaInfo, app, stream, tracks, null); | |
| 72 | + streamInfo = getStreamInfoByAppAndStream(mediaInfo, app, stream, tracks, addr,null); | |
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | } | ... | ... |
src/main/java/com/genersoft/iot/vmp/service/impl/PlayServiceImpl.java
| 1 | 1 | package com.genersoft.iot.vmp.service.impl; |
| 2 | 2 | |
| 3 | +import java.math.BigDecimal; | |
| 4 | +import java.math.RoundingMode; | |
| 5 | +import java.util.List; | |
| 6 | +import java.util.Objects; | |
| 7 | +import java.util.UUID; | |
| 8 | + | |
| 9 | +import javax.sip.ResponseEvent; | |
| 10 | + | |
| 11 | +import org.slf4j.Logger; | |
| 12 | +import org.slf4j.LoggerFactory; | |
| 13 | +import org.springframework.beans.factory.annotation.Autowired; | |
| 14 | +import org.springframework.http.HttpStatus; | |
| 15 | +import org.springframework.http.ResponseEntity; | |
| 16 | +import org.springframework.stereotype.Service; | |
| 17 | +import org.springframework.web.context.request.async.DeferredResult; | |
| 18 | + | |
| 3 | 19 | import com.alibaba.fastjson.JSON; |
| 4 | 20 | import com.alibaba.fastjson.JSONArray; |
| 5 | 21 | import com.alibaba.fastjson.JSONObject; |
| 6 | 22 | import com.genersoft.iot.vmp.common.StreamInfo; |
| 7 | 23 | import com.genersoft.iot.vmp.conf.DynamicTask; |
| 8 | 24 | import com.genersoft.iot.vmp.conf.UserSetting; |
| 9 | -import com.genersoft.iot.vmp.gb28181.bean.*; | |
| 25 | +import com.genersoft.iot.vmp.gb28181.bean.Device; | |
| 26 | +import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel; | |
| 27 | +import com.genersoft.iot.vmp.gb28181.bean.InviteStreamCallback; | |
| 28 | +import com.genersoft.iot.vmp.gb28181.bean.InviteStreamInfo; | |
| 29 | +import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform; | |
| 30 | +import com.genersoft.iot.vmp.gb28181.bean.SendRtpItem; | |
| 31 | +import com.genersoft.iot.vmp.gb28181.bean.SsrcTransaction; | |
| 10 | 32 | import com.genersoft.iot.vmp.gb28181.event.SipSubscribe; |
| 11 | 33 | import com.genersoft.iot.vmp.gb28181.session.VideoStreamSessionManager; |
| 12 | 34 | import com.genersoft.iot.vmp.gb28181.transmit.callback.DeferredResultHolder; |
| 13 | 35 | import com.genersoft.iot.vmp.gb28181.transmit.callback.RequestMessage; |
| 14 | 36 | import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommander; |
| 15 | 37 | import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommanderFroPlatform; |
| 38 | +import com.genersoft.iot.vmp.media.zlm.dto.HookSubscribeFactory; | |
| 39 | +import com.genersoft.iot.vmp.media.zlm.dto.HookSubscribeForStreamChange; | |
| 40 | +import com.genersoft.iot.vmp.media.zlm.dto.HookType; | |
| 16 | 41 | import com.genersoft.iot.vmp.utils.DateUtil; |
| 17 | 42 | import com.genersoft.iot.vmp.media.zlm.AssistRESTfulUtils; |
| 18 | 43 | import com.genersoft.iot.vmp.media.zlm.ZLMHttpHookSubscribe; |
| ... | ... | @@ -27,23 +52,11 @@ import com.genersoft.iot.vmp.service.bean.PlayBackResult; |
| 27 | 52 | import com.genersoft.iot.vmp.service.bean.SSRCInfo; |
| 28 | 53 | import com.genersoft.iot.vmp.storager.IRedisCatchStorage; |
| 29 | 54 | import com.genersoft.iot.vmp.storager.IVideoManagerStorage; |
| 55 | +import com.genersoft.iot.vmp.utils.DateUtil; | |
| 30 | 56 | import com.genersoft.iot.vmp.vmanager.bean.WVPResult; |
| 31 | 57 | import com.genersoft.iot.vmp.vmanager.gb28181.play.bean.PlayResult; |
| 32 | -import gov.nist.javax.sip.stack.SIPDialog; | |
| 33 | -import org.slf4j.Logger; | |
| 34 | -import org.slf4j.LoggerFactory; | |
| 35 | -import org.springframework.beans.factory.annotation.Autowired; | |
| 36 | -import org.springframework.http.HttpStatus; | |
| 37 | -import org.springframework.http.ResponseEntity; | |
| 38 | -import org.springframework.stereotype.Service; | |
| 39 | -import org.springframework.util.ResourceUtils; | |
| 40 | -import org.springframework.web.context.request.async.DeferredResult; | |
| 41 | 58 | |
| 42 | -import javax.sip.ResponseEvent; | |
| 43 | -import java.io.FileNotFoundException; | |
| 44 | -import java.math.BigDecimal; | |
| 45 | -import java.math.RoundingMode; | |
| 46 | -import java.util.*; | |
| 59 | +import gov.nist.javax.sip.stack.SIPDialog; | |
| 47 | 60 | |
| 48 | 61 | @SuppressWarnings(value = {"rawtypes", "unchecked"}) |
| 49 | 62 | @Service |
| ... | ... | @@ -296,16 +309,10 @@ public class PlayServiceImpl implements IPlayService { |
| 296 | 309 | // 单端口模式streamId也有变化,需要重新设置监听 |
| 297 | 310 | if (!mediaServerItem.isRtpEnable()) { |
| 298 | 311 | // 添加订阅 |
| 299 | - JSONObject subscribeKey = new JSONObject(); | |
| 300 | - subscribeKey.put("app", "rtp"); | |
| 301 | - subscribeKey.put("stream", stream); | |
| 302 | - subscribeKey.put("regist", true); | |
| 303 | - subscribeKey.put("schema", "rtmp"); | |
| 304 | - subscribeKey.put("mediaServerId", mediaServerItem.getId()); | |
| 305 | - subscribe.removeSubscribe(ZLMHttpHookSubscribe.HookType.on_stream_changed,subscribeKey); | |
| 306 | - subscribeKey.put("stream", String.format("%08x", Integer.parseInt(ssrcInResponse)).toUpperCase()); | |
| 307 | - subscribe.addSubscribe(ZLMHttpHookSubscribe.HookType.on_stream_changed, subscribeKey, | |
| 308 | - (MediaServerItem mediaServerItemInUse, JSONObject response)->{ | |
| 312 | + HookSubscribeForStreamChange hookSubscribe = HookSubscribeFactory.on_stream_changed("rtp", stream, true, "rtmp", mediaServerItem.getId()); | |
| 313 | + subscribe.removeSubscribe(hookSubscribe); | |
| 314 | + hookSubscribe.getContent().put("stream", String.format("%08x", Integer.parseInt(ssrcInResponse)).toUpperCase()); | |
| 315 | + subscribe.addSubscribe(hookSubscribe, (MediaServerItem mediaServerItemInUse, JSONObject response)->{ | |
| 309 | 316 | logger.info("[ZLM HOOK] ssrc修正后收到订阅消息: " + response.toJSONString()); |
| 310 | 317 | dynamicTask.stop(timeOutTaskKey); |
| 311 | 318 | // hook响应 |
| ... | ... | @@ -316,7 +323,7 @@ public class PlayServiceImpl implements IPlayService { |
| 316 | 323 | // 关闭rtp server |
| 317 | 324 | mediaServerService.closeRTPServer(device.getDeviceId(), channelId, finalSsrcInfo.getStream()); |
| 318 | 325 | // 重新开启ssrc server |
| 319 | - mediaServerService.openRTPServer(mediaServerItem, finalSsrcInfo.getStream(), ssrcInResponse, device.isSsrcCheck(), false); | |
| 326 | + mediaServerService.openRTPServer(mediaServerItem, finalSsrcInfo.getStream(), ssrcInResponse, device.isSsrcCheck(), false, finalSsrcInfo.getPort()); | |
| 320 | 327 | |
| 321 | 328 | } |
| 322 | 329 | } |
| ... | ... | @@ -531,14 +538,6 @@ public class PlayServiceImpl implements IPlayService { |
| 531 | 538 | StreamInfo streamInfo = onPublishHandler(inviteStreamInfo.getMediaServerItem(), inviteStreamInfo.getResponse(), deviceId, channelId); |
| 532 | 539 | streamInfo.setStartTime(startTime); |
| 533 | 540 | streamInfo.setEndTime(endTime); |
| 534 | - if (streamInfo == null) { | |
| 535 | - logger.warn("录像下载API调用失败!"); | |
| 536 | - wvpResult.setCode(-1); | |
| 537 | - wvpResult.setMsg("录像下载API调用失败"); | |
| 538 | - downloadResult.setCode(-1); | |
| 539 | - hookCallBack.call(downloadResult); | |
| 540 | - return ; | |
| 541 | - } | |
| 542 | 541 | redisCatchStorage.startDownload(streamInfo, inviteStreamInfo.getCallId()); |
| 543 | 542 | wvpResult.setCode(0); |
| 544 | 543 | wvpResult.setMsg("success"); | ... | ... |
src/main/java/com/genersoft/iot/vmp/service/impl/RedisGbPlayMsgListener.java
| ... | ... | @@ -8,6 +8,9 @@ import com.genersoft.iot.vmp.gb28181.bean.SendRtpItem; |
| 8 | 8 | import com.genersoft.iot.vmp.media.zlm.ZLMHttpHookSubscribe; |
| 9 | 9 | import com.genersoft.iot.vmp.media.zlm.ZLMMediaListManager; |
| 10 | 10 | import com.genersoft.iot.vmp.media.zlm.ZLMRTPServerFactory; |
| 11 | +import com.genersoft.iot.vmp.media.zlm.dto.HookSubscribeFactory; | |
| 12 | +import com.genersoft.iot.vmp.media.zlm.dto.HookSubscribeForStreamChange; | |
| 13 | +import com.genersoft.iot.vmp.media.zlm.dto.HookType; | |
| 11 | 14 | import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem; |
| 12 | 15 | import com.genersoft.iot.vmp.service.IMediaServerService; |
| 13 | 16 | import com.genersoft.iot.vmp.service.bean.*; |
| ... | ... | @@ -270,14 +273,9 @@ public class RedisGbPlayMsgListener implements MessageListener { |
| 270 | 273 | }, userSetting.getPlatformPlayTimeout()); |
| 271 | 274 | |
| 272 | 275 | // 添加订阅 |
| 273 | - JSONObject subscribeKey = new JSONObject(); | |
| 274 | - subscribeKey.put("app", content.getApp()); | |
| 275 | - subscribeKey.put("stream", content.getStream()); | |
| 276 | - subscribeKey.put("regist", true); | |
| 277 | - subscribeKey.put("schema", "rtmp"); | |
| 278 | - subscribeKey.put("mediaServerId", mediaServerItem.getId()); | |
| 279 | - subscribe.addSubscribe(ZLMHttpHookSubscribe.HookType.on_stream_changed, subscribeKey, | |
| 280 | - (MediaServerItem mediaServerItemInUse, JSONObject json)->{ | |
| 276 | + HookSubscribeForStreamChange hookSubscribe = HookSubscribeFactory.on_stream_changed(content.getApp(), content.getStream(), true, "rtmp", mediaServerItem.getId()); | |
| 277 | + | |
| 278 | + subscribe.addSubscribe(hookSubscribe, (MediaServerItem mediaServerItemInUse, JSONObject json)->{ | |
| 281 | 279 | dynamicTask.stop(taskKey); |
| 282 | 280 | responseSendItem(mediaServerItem, content, toId, serial); |
| 283 | 281 | }); | ... | ... |
src/main/java/com/genersoft/iot/vmp/service/impl/RedisGpsMsgListener.java
| 1 | 1 | package com.genersoft.iot.vmp.service.impl; |
| 2 | 2 | |
| 3 | 3 | import com.alibaba.fastjson.JSON; |
| 4 | +import com.genersoft.iot.vmp.gb28181.bean.HandlerCatchData; | |
| 4 | 5 | import com.genersoft.iot.vmp.service.bean.GPSMsgInfo; |
| 5 | 6 | import com.genersoft.iot.vmp.storager.IRedisCatchStorage; |
| 7 | +import com.genersoft.iot.vmp.storager.IVideoManagerStorage; | |
| 6 | 8 | import org.jetbrains.annotations.NotNull; |
| 7 | 9 | import org.slf4j.Logger; |
| 8 | 10 | import org.slf4j.LoggerFactory; |
| 9 | 11 | import org.springframework.beans.factory.annotation.Autowired; |
| 12 | +import org.springframework.beans.factory.annotation.Qualifier; | |
| 10 | 13 | import org.springframework.data.redis.connection.Message; |
| 11 | 14 | import org.springframework.data.redis.connection.MessageListener; |
| 15 | +import org.springframework.scheduling.annotation.Scheduled; | |
| 16 | +import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; | |
| 12 | 17 | import org.springframework.stereotype.Component; |
| 13 | 18 | |
| 19 | +import java.util.List; | |
| 20 | +import java.util.concurrent.ConcurrentLinkedQueue; | |
| 21 | + | |
| 14 | 22 | /** |
| 15 | 23 | * 接收来自redis的GPS更新通知 |
| 16 | 24 | * @author lin |
| ... | ... | @@ -20,13 +28,50 @@ public class RedisGpsMsgListener implements MessageListener { |
| 20 | 28 | |
| 21 | 29 | private final static Logger logger = LoggerFactory.getLogger(RedisGpsMsgListener.class); |
| 22 | 30 | |
| 31 | + private boolean taskQueueHandlerRun = false; | |
| 32 | + | |
| 23 | 33 | @Autowired |
| 24 | 34 | private IRedisCatchStorage redisCatchStorage; |
| 25 | 35 | |
| 36 | + @Autowired | |
| 37 | + private IVideoManagerStorage storager; | |
| 38 | + | |
| 39 | + private final ConcurrentLinkedQueue<Message> taskQueue = new ConcurrentLinkedQueue<>(); | |
| 40 | + | |
| 41 | + @Qualifier("taskExecutor") | |
| 42 | + @Autowired | |
| 43 | + private ThreadPoolTaskExecutor taskExecutor; | |
| 44 | + | |
| 45 | + | |
| 26 | 46 | @Override |
| 27 | 47 | public void onMessage(@NotNull Message message, byte[] bytes) { |
| 28 | - // TODO 加消息队列 | |
| 29 | - GPSMsgInfo gpsMsgInfo = JSON.parseObject(message.getBody(), GPSMsgInfo.class); | |
| 30 | - redisCatchStorage.updateGpsMsgInfo(gpsMsgInfo); | |
| 48 | + taskQueue.offer(message); | |
| 49 | + if (!taskQueueHandlerRun) { | |
| 50 | + taskQueueHandlerRun = true; | |
| 51 | + taskExecutor.execute(() -> { | |
| 52 | + while (!taskQueue.isEmpty()) { | |
| 53 | + Message msg = taskQueue.poll(); | |
| 54 | + GPSMsgInfo gpsMsgInfo = JSON.parseObject(msg.getBody(), GPSMsgInfo.class); | |
| 55 | + // 只是放入redis缓存起来 | |
| 56 | + redisCatchStorage.updateGpsMsgInfo(gpsMsgInfo); | |
| 57 | + } | |
| 58 | + taskQueueHandlerRun = false; | |
| 59 | + }); | |
| 60 | + } | |
| 61 | + } | |
| 62 | + | |
| 63 | + /** | |
| 64 | + * 定时将经纬度更新到数据库 | |
| 65 | + */ | |
| 66 | + @Scheduled(fixedRate = 2 * 1000) //每2秒执行一次 | |
| 67 | + public void execute(){ | |
| 68 | + List<GPSMsgInfo> gpsMsgInfo = redisCatchStorage.getAllGpsMsgInfo(); | |
| 69 | + if (gpsMsgInfo.size() > 0) { | |
| 70 | + storager.updateStreamGPS(gpsMsgInfo); | |
| 71 | + for (GPSMsgInfo msgInfo : gpsMsgInfo) { | |
| 72 | + msgInfo.setStored(true); | |
| 73 | + redisCatchStorage.updateGpsMsgInfo(msgInfo); | |
| 74 | + } | |
| 75 | + } | |
| 31 | 76 | } |
| 32 | 77 | } | ... | ... |
src/main/java/com/genersoft/iot/vmp/service/impl/RedisPushStreamStatusMsgListener.java
| ... | ... | @@ -14,6 +14,7 @@ import com.genersoft.iot.vmp.media.zlm.ZLMMediaListManager; |
| 14 | 14 | import com.genersoft.iot.vmp.media.zlm.dto.MediaItem; |
| 15 | 15 | import com.genersoft.iot.vmp.media.zlm.dto.StreamPushItem; |
| 16 | 16 | import com.genersoft.iot.vmp.service.IStreamPushService; |
| 17 | +import com.genersoft.iot.vmp.service.bean.GPSMsgInfo; | |
| 17 | 18 | import com.genersoft.iot.vmp.service.bean.PushStreamStatusChangeFromRedisDto; |
| 18 | 19 | import com.genersoft.iot.vmp.service.bean.StreamPushItemFromRedis; |
| 19 | 20 | import com.genersoft.iot.vmp.storager.IRedisCatchStorage; |
| ... | ... | @@ -21,14 +22,17 @@ import com.genersoft.iot.vmp.storager.IVideoManagerStorage; |
| 21 | 22 | import org.slf4j.Logger; |
| 22 | 23 | import org.slf4j.LoggerFactory; |
| 23 | 24 | import org.springframework.beans.factory.annotation.Autowired; |
| 25 | +import org.springframework.beans.factory.annotation.Qualifier; | |
| 24 | 26 | import org.springframework.boot.ApplicationArguments; |
| 25 | 27 | import org.springframework.boot.ApplicationRunner; |
| 26 | 28 | import org.springframework.data.redis.connection.Message; |
| 27 | 29 | import org.springframework.data.redis.connection.MessageListener; |
| 30 | +import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; | |
| 28 | 31 | import org.springframework.stereotype.Component; |
| 29 | 32 | |
| 30 | 33 | import java.util.ArrayList; |
| 31 | 34 | import java.util.List; |
| 35 | +import java.util.concurrent.ConcurrentLinkedQueue; | |
| 32 | 36 | |
| 33 | 37 | |
| 34 | 38 | /** |
| ... | ... | @@ -40,6 +44,8 @@ public class RedisPushStreamStatusMsgListener implements MessageListener, Applic |
| 40 | 44 | |
| 41 | 45 | private final static Logger logger = LoggerFactory.getLogger(RedisPushStreamStatusMsgListener.class); |
| 42 | 46 | |
| 47 | + private boolean taskQueueHandlerRun = false; | |
| 48 | + | |
| 43 | 49 | @Autowired |
| 44 | 50 | private IRedisCatchStorage redisCatchStorage; |
| 45 | 51 | |
| ... | ... | @@ -47,34 +53,51 @@ public class RedisPushStreamStatusMsgListener implements MessageListener, Applic |
| 47 | 53 | private IStreamPushService streamPushService; |
| 48 | 54 | |
| 49 | 55 | @Autowired |
| 50 | - private EventPublisher eventPublisher; | |
| 56 | + private DynamicTask dynamicTask; | |
| 51 | 57 | |
| 52 | - @Autowired | |
| 53 | - private UserSetting userSetting; | |
| 54 | 58 | |
| 59 | + | |
| 60 | + private final ConcurrentLinkedQueue<Message> taskQueue = new ConcurrentLinkedQueue<>(); | |
| 61 | + | |
| 62 | + @Qualifier("taskExecutor") | |
| 55 | 63 | @Autowired |
| 56 | - private DynamicTask dynamicTask; | |
| 64 | + private ThreadPoolTaskExecutor taskExecutor; | |
| 57 | 65 | |
| 58 | 66 | @Override |
| 59 | 67 | public void onMessage(Message message, byte[] bytes) { |
| 60 | - PushStreamStatusChangeFromRedisDto statusChangeFromPushStream = JSON.parseObject(message.getBody(), PushStreamStatusChangeFromRedisDto.class); | |
| 61 | - if (statusChangeFromPushStream == null) { | |
| 62 | - logger.warn("[REDIS 消息]推流设备状态变化消息解析失败"); | |
| 63 | - return; | |
| 64 | - } | |
| 65 | - if (statusChangeFromPushStream.isSetAllOffline()) { | |
| 66 | - // 所有设备离线 | |
| 67 | - streamPushService.allStreamOffline(); | |
| 68 | - } | |
| 69 | - if (statusChangeFromPushStream.getOfflineStreams() != null | |
| 70 | - && statusChangeFromPushStream.getOfflineStreams().size() > 0) { | |
| 71 | - // 更新部分设备离线 | |
| 72 | - streamPushService.offline(statusChangeFromPushStream.getOfflineStreams()); | |
| 73 | - } | |
| 74 | - if (statusChangeFromPushStream.getOnlineStreams() != null && | |
| 75 | - statusChangeFromPushStream.getOnlineStreams().size() > 0) { | |
| 76 | - // 更新部分设备上线 | |
| 77 | - streamPushService.online(statusChangeFromPushStream.getOnlineStreams()); | |
| 68 | + // TODO 增加队列 | |
| 69 | + logger.warn("[REDIS消息-推流设备状态变化]: {}", new String(message.getBody())); | |
| 70 | + taskQueue.offer(message); | |
| 71 | + | |
| 72 | + if (!taskQueueHandlerRun) { | |
| 73 | + taskQueueHandlerRun = true; | |
| 74 | + taskExecutor.execute(() -> { | |
| 75 | + while (!taskQueue.isEmpty()) { | |
| 76 | + Message msg = taskQueue.poll(); | |
| 77 | + PushStreamStatusChangeFromRedisDto statusChangeFromPushStream = JSON.parseObject(msg.getBody(), PushStreamStatusChangeFromRedisDto.class); | |
| 78 | + if (statusChangeFromPushStream == null) { | |
| 79 | + logger.warn("[REDIS消息]推流设备状态变化消息解析失败"); | |
| 80 | + return; | |
| 81 | + } | |
| 82 | + // 取消定时任务 | |
| 83 | + dynamicTask.stop(VideoManagerConstants.VM_MSG_GET_ALL_ONLINE_REQUESTED); | |
| 84 | + if (statusChangeFromPushStream.isSetAllOffline()) { | |
| 85 | + // 所有设备离线 | |
| 86 | + streamPushService.allStreamOffline(); | |
| 87 | + } | |
| 88 | + if (statusChangeFromPushStream.getOfflineStreams() != null | |
| 89 | + && statusChangeFromPushStream.getOfflineStreams().size() > 0) { | |
| 90 | + // 更新部分设备离线 | |
| 91 | + streamPushService.offline(statusChangeFromPushStream.getOfflineStreams()); | |
| 92 | + } | |
| 93 | + if (statusChangeFromPushStream.getOnlineStreams() != null && | |
| 94 | + statusChangeFromPushStream.getOnlineStreams().size() > 0) { | |
| 95 | + // 更新部分设备上线 | |
| 96 | + streamPushService.online(statusChangeFromPushStream.getOnlineStreams()); | |
| 97 | + } | |
| 98 | + } | |
| 99 | + taskQueueHandlerRun = false; | |
| 100 | + }); | |
| 78 | 101 | } |
| 79 | 102 | } |
| 80 | 103 | |
| ... | ... | @@ -83,7 +106,7 @@ public class RedisPushStreamStatusMsgListener implements MessageListener, Applic |
| 83 | 106 | // 启动时设置所有推流通道离线,发起查询请求 |
| 84 | 107 | redisCatchStorage.sendStreamPushRequestedMsgForStatus(); |
| 85 | 108 | dynamicTask.startDelay(VideoManagerConstants.VM_MSG_GET_ALL_ONLINE_REQUESTED, ()->{ |
| 86 | - logger.info("[REDIS 消息]未收到redis回复推流设备状态,执行推流设备离线"); | |
| 109 | + logger.info("[REDIS消息]未收到redis回复推流设备状态,执行推流设备离线"); | |
| 87 | 110 | // 五秒收不到请求就设置通道离线,然后通知上级离线 |
| 88 | 111 | streamPushService.allStreamOffline(); |
| 89 | 112 | }, 5000); | ... | ... |
src/main/java/com/genersoft/iot/vmp/service/impl/RedisStreamMsgListener.java
| ... | ... | @@ -46,7 +46,7 @@ public class RedisStreamMsgListener implements MessageListener { |
| 46 | 46 | |
| 47 | 47 | JSONObject steamMsgJson = JSON.parseObject(message.getBody(), JSONObject.class); |
| 48 | 48 | if (steamMsgJson == null) { |
| 49 | - logger.warn("[REDIS的ALARM通知]消息解析失败"); | |
| 49 | + logger.warn("[收到redis 流变化]消息解析失败"); | |
| 50 | 50 | return; |
| 51 | 51 | } |
| 52 | 52 | String serverId = steamMsgJson.getString("serverId"); |
| ... | ... | @@ -55,7 +55,7 @@ public class RedisStreamMsgListener implements MessageListener { |
| 55 | 55 | // 自己发送的消息忽略即可 |
| 56 | 56 | return; |
| 57 | 57 | } |
| 58 | - logger.info("[REDIS通知] 流变化: {}", new String(message.getBody())); | |
| 58 | + logger.info("[收到redis 流变化]: {}", new String(message.getBody())); | |
| 59 | 59 | String app = steamMsgJson.getString("app"); |
| 60 | 60 | String stream = steamMsgJson.getString("stream"); |
| 61 | 61 | boolean register = steamMsgJson.getBoolean("register"); |
| ... | ... | @@ -72,9 +72,10 @@ public class RedisStreamMsgListener implements MessageListener { |
| 72 | 72 | mediaItem.setOriginType(0); |
| 73 | 73 | mediaItem.setOriginTypeStr("0"); |
| 74 | 74 | mediaItem.setOriginTypeStr("unknown"); |
| 75 | - | |
| 76 | - zlmMediaListManager.addPush(mediaItem); | |
| 77 | - | |
| 78 | - | |
| 75 | + if (register) { | |
| 76 | + zlmMediaListManager.addPush(mediaItem); | |
| 77 | + }else { | |
| 78 | + zlmMediaListManager.removeMedia(app, stream); | |
| 79 | + } | |
| 79 | 80 | } |
| 80 | 81 | } | ... | ... |
src/main/java/com/genersoft/iot/vmp/service/impl/StreamPushServiceImpl.java
| ... | ... | @@ -22,7 +22,10 @@ import com.github.pagehelper.PageInfo; |
| 22 | 22 | import org.slf4j.Logger; |
| 23 | 23 | import org.slf4j.LoggerFactory; |
| 24 | 24 | import org.springframework.beans.factory.annotation.Autowired; |
| 25 | +import org.springframework.jdbc.datasource.DataSourceTransactionManager; | |
| 25 | 26 | import org.springframework.stereotype.Service; |
| 27 | +import org.springframework.transaction.TransactionDefinition; | |
| 28 | +import org.springframework.transaction.TransactionStatus; | |
| 26 | 29 | import org.springframework.util.StringUtils; |
| 27 | 30 | |
| 28 | 31 | import java.util.*; |
| ... | ... | @@ -69,6 +72,12 @@ public class StreamPushServiceImpl implements IStreamPushService { |
| 69 | 72 | @Autowired |
| 70 | 73 | private IMediaServerService mediaServerService; |
| 71 | 74 | |
| 75 | + @Autowired | |
| 76 | + DataSourceTransactionManager dataSourceTransactionManager; | |
| 77 | + | |
| 78 | + @Autowired | |
| 79 | + TransactionDefinition transactionDefinition; | |
| 80 | + | |
| 72 | 81 | @Override |
| 73 | 82 | public List<StreamPushItem> handleJSON(String jsonData, MediaServerItem mediaServerItem) { |
| 74 | 83 | if (jsonData == null) { |
| ... | ... | @@ -463,4 +472,27 @@ public class StreamPushServiceImpl implements IStreamPushService { |
| 463 | 472 | // 发送通知 |
| 464 | 473 | eventPublisher.catalogEventPublishForStream(null, onlinePushers, CatalogEvent.ON); |
| 465 | 474 | } |
| 475 | + | |
| 476 | + @Override | |
| 477 | + public boolean add(StreamPushItem stream) { | |
| 478 | + stream.setUpdateTime(DateUtil.getNow()); | |
| 479 | + stream.setCreateTime(DateUtil.getNow()); | |
| 480 | + stream.setServerId(userSetting.getServerId()); | |
| 481 | + | |
| 482 | + // 放在事务内执行 | |
| 483 | + boolean result = false; | |
| 484 | + TransactionStatus transactionStatus = dataSourceTransactionManager.getTransaction(transactionDefinition); | |
| 485 | + try { | |
| 486 | + int addStreamResult = streamPushMapper.add(stream); | |
| 487 | + if (!StringUtils.isEmpty(stream.getGbId())) { | |
| 488 | + gbStreamMapper.add(stream); | |
| 489 | + } | |
| 490 | + dataSourceTransactionManager.commit(transactionStatus); | |
| 491 | + result = true; | |
| 492 | + }catch (Exception e) { | |
| 493 | + logger.error("批量移除流与平台的关系时错误", e); | |
| 494 | + dataSourceTransactionManager.rollback(transactionStatus); | |
| 495 | + } | |
| 496 | + return result; | |
| 497 | + } | |
| 466 | 498 | } | ... | ... |
src/main/java/com/genersoft/iot/vmp/storager/IVideoManagerStorage.java
| ... | ... | @@ -300,39 +300,12 @@ public interface IVideoManagerStorage { |
| 300 | 300 | List<DeviceChannel> queryGbStreamListInPlatform(String platformId); |
| 301 | 301 | |
| 302 | 302 | /** |
| 303 | - * 批量更新推流列表 | |
| 304 | - * @param streamPushItems | |
| 305 | - */ | |
| 306 | - void updateMediaList(List<StreamPushItem> streamPushItems); | |
| 307 | - | |
| 308 | - /** | |
| 309 | - * 更新单个推流 | |
| 310 | - * @param streamPushItem | |
| 311 | - */ | |
| 312 | - void updateMedia(StreamPushItem streamPushItem); | |
| 313 | - | |
| 314 | - /** | |
| 315 | 303 | * 移除单个推流 |
| 316 | 304 | * @param app |
| 317 | 305 | * @param stream |
| 318 | 306 | */ |
| 319 | 307 | int removeMedia(String app, String stream); |
| 320 | 308 | |
| 321 | - | |
| 322 | - /** | |
| 323 | - * 获取但个推流 | |
| 324 | - * @param app | |
| 325 | - * @param stream | |
| 326 | - * @return | |
| 327 | - */ | |
| 328 | - StreamPushItem getMedia(String app, String stream); | |
| 329 | - | |
| 330 | - | |
| 331 | - /** | |
| 332 | - * 清空推流列表 | |
| 333 | - */ | |
| 334 | - void clearMediaList(); | |
| 335 | - | |
| 336 | 309 | /** |
| 337 | 310 | * 设置流离线 |
| 338 | 311 | */ | ... | ... |
src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceChannelMapper.java
| ... | ... | @@ -140,6 +140,9 @@ public interface DeviceChannelMapper { |
| 140 | 140 | @Update(value = {"UPDATE device_channel SET status=0 WHERE deviceId=#{deviceId} AND channelId=#{channelId}"}) |
| 141 | 141 | void offline(String deviceId, String channelId); |
| 142 | 142 | |
| 143 | + @Update(value = {"UPDATE device_channel SET status=0 WHERE deviceId=#{deviceId}"}) | |
| 144 | + void offlineByDeviceId(String deviceId); | |
| 145 | + | |
| 143 | 146 | @Update(value = {"UPDATE device_channel SET status=1 WHERE deviceId=#{deviceId} AND channelId=#{channelId}"}) |
| 144 | 147 | void online(String deviceId, String channelId); |
| 145 | 148 | ... | ... |
src/main/java/com/genersoft/iot/vmp/storager/dao/PlatformCatalogMapper.java
| ... | ... | @@ -50,7 +50,7 @@ public interface PlatformCatalogMapper { |
| 50 | 50 | @Select("SELECT pc.* FROM platform_catalog pc WHERE pc.id = #{id}") |
| 51 | 51 | PlatformCatalog selectParentCatalog(String id); |
| 52 | 52 | |
| 53 | - @Select("SELECT pc.id as channelId, pc.name, pc.civilCode, pc.businessGroupId,'0' as parental, pc.parentId " + | |
| 53 | + @Select("SELECT pc.id as channelId, pc.name, pc.civilCode, pc.businessGroupId,'1' as parental, pc.parentId " + | |
| 54 | 54 | " FROM platform_catalog pc WHERE pc.platformId=#{platformId}") |
| 55 | 55 | List<DeviceChannel> queryCatalogInPlatform(String platformId); |
| 56 | 56 | } | ... | ... |
src/main/java/com/genersoft/iot/vmp/storager/dao/StreamPushMapper.java
| ... | ... | @@ -15,9 +15,10 @@ import java.util.List; |
| 15 | 15 | public interface StreamPushMapper { |
| 16 | 16 | |
| 17 | 17 | @Insert("INSERT INTO stream_push (app, stream, totalReaderCount, originType, originTypeStr, " + |
| 18 | - "pushTime, aliveSecond, mediaServerId, serverId, updateTime, createTime, pushIng) VALUES" + | |
| 18 | + "pushTime, aliveSecond, mediaServerId, serverId, updateTime, createTime, pushIng, self) VALUES" + | |
| 19 | 19 | "('${app}', '${stream}', '${totalReaderCount}', '${originType}', '${originTypeStr}', " + |
| 20 | - "'${pushTime}', '${aliveSecond}', '${mediaServerId}' , '${serverId}' , '${updateTime}' , '${createTime}', ${pushIng} )") | |
| 20 | + "'${pushTime}', '${aliveSecond}', '${mediaServerId}' , '${serverId}' , '${updateTime}' , '${createTime}', " + | |
| 21 | + "${pushIng}, ${self} )") | |
| 21 | 22 | int add(StreamPushItem streamPushItem); |
| 22 | 23 | |
| 23 | 24 | |
| ... | ... | @@ -31,6 +32,7 @@ public interface StreamPushMapper { |
| 31 | 32 | "<if test=\"pushTime != null\">, pushTime='${pushTime}'</if>" + |
| 32 | 33 | "<if test=\"aliveSecond != null\">, aliveSecond='${aliveSecond}'</if>" + |
| 33 | 34 | "<if test=\"pushIng != null\">, pushIng=${pushIng}</if>" + |
| 35 | + "<if test=\"self != null\">, self=${self}</if>" + | |
| 34 | 36 | "WHERE app=#{app} AND stream=#{stream}"+ |
| 35 | 37 | " </script>"}) |
| 36 | 38 | int update(StreamPushItem streamPushItem); |
| ... | ... | @@ -119,7 +121,7 @@ public interface StreamPushMapper { |
| 119 | 121 | @Update("UPDATE stream_push " + |
| 120 | 122 | "SET pushIng=${pushIng} " + |
| 121 | 123 | "WHERE app=#{app} AND stream=#{stream}") |
| 122 | - int updatePushStatus(String app, String stream, boolean status); | |
| 124 | + int updatePushStatus(String app, String stream, boolean pushIng); | |
| 123 | 125 | |
| 124 | 126 | @Update("UPDATE stream_push " + |
| 125 | 127 | "SET status=#{status} " + | ... | ... |
src/main/java/com/genersoft/iot/vmp/storager/impl/RedisCatchStorageImpl.java
| ... | ... | @@ -479,7 +479,7 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { |
| 479 | 479 | @Override |
| 480 | 480 | public void sendStreamChangeMsg(String type, JSONObject jsonObject) { |
| 481 | 481 | String key = VideoManagerConstants.WVP_MSG_STREAM_CHANGE_PREFIX + type; |
| 482 | - logger.debug("[redis 流变化事件] {}: {}", key, jsonObject.toString()); | |
| 482 | + logger.info("[redis 流变化事件] {}: {}", key, jsonObject.toString()); | |
| 483 | 483 | redis.convertAndSend(key, jsonObject); |
| 484 | 484 | } |
| 485 | 485 | |
| ... | ... | @@ -688,21 +688,21 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { |
| 688 | 688 | @Override |
| 689 | 689 | public void sendMobilePositionMsg(JSONObject jsonObject) { |
| 690 | 690 | String key = VideoManagerConstants.VM_MSG_SUBSCRIBE_MOBILE_POSITION; |
| 691 | - logger.info("[redis 移动位置订阅通知] {}: {}", key, jsonObject.toString()); | |
| 691 | + logger.info("[redis发送通知]移动位置 {}: {}", key, jsonObject.toString()); | |
| 692 | 692 | redis.convertAndSend(key, jsonObject); |
| 693 | 693 | } |
| 694 | 694 | |
| 695 | 695 | @Override |
| 696 | 696 | public void sendStreamPushRequestedMsg(MessageForPushChannel msg) { |
| 697 | 697 | String key = VideoManagerConstants.VM_MSG_STREAM_PUSH_REQUESTED; |
| 698 | - logger.info("[redis 推流被请求通知] {}: {}/{}", key, msg.getApp(), msg.getStream()); | |
| 698 | + logger.info("[redis发送通知]推流被请求 {}: {}/{}", key, msg.getApp(), msg.getStream()); | |
| 699 | 699 | redis.convertAndSend(key, (JSONObject)JSON.toJSON(msg)); |
| 700 | 700 | } |
| 701 | 701 | |
| 702 | 702 | @Override |
| 703 | 703 | public void sendAlarmMsg(AlarmChannelMessage msg) { |
| 704 | 704 | String key = VideoManagerConstants.VM_MSG_SUBSCRIBE_ALARM; |
| 705 | - logger.info("[redis 报警通知] {}: {}", key, JSON.toJSON(msg)); | |
| 705 | + logger.info("[redis发送通知] 报警{}: {}", key, JSON.toJSON(msg)); | |
| 706 | 706 | redis.convertAndSend(key, (JSONObject)JSON.toJSON(msg)); |
| 707 | 707 | } |
| 708 | 708 | |
| ... | ... | @@ -715,7 +715,7 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { |
| 715 | 715 | @Override |
| 716 | 716 | public void sendStreamPushRequestedMsgForStatus() { |
| 717 | 717 | String key = VideoManagerConstants.VM_MSG_GET_ALL_ONLINE_REQUESTED; |
| 718 | - logger.info("[redis 通知]获取所有推流设备的状态"); | |
| 718 | + logger.info("[redis通知]获取所有推流设备的状态"); | |
| 719 | 719 | JSONObject jsonObject = new JSONObject(); |
| 720 | 720 | jsonObject.put(key, key); |
| 721 | 721 | redis.convertAndSend(key, jsonObject); | ... | ... |
src/main/java/com/genersoft/iot/vmp/storager/impl/VideoManagerStorageImpl.java
| ... | ... | @@ -636,54 +636,18 @@ public class VideoManagerStorageImpl implements IVideoManagerStorage { |
| 636 | 636 | } |
| 637 | 637 | |
| 638 | 638 | @Override |
| 639 | - public void updateMediaList(List<StreamPushItem> streamPushItems) { | |
| 640 | - if (streamPushItems == null || streamPushItems.size() == 0) { | |
| 641 | - return; | |
| 642 | - } | |
| 643 | - logger.info("updateMediaList: " + streamPushItems.size()); | |
| 644 | - streamPushMapper.addAll(streamPushItems); | |
| 645 | - // TODO 待优化 | |
| 646 | - for (int i = 0; i < streamPushItems.size(); i++) { | |
| 647 | - int onlineResult = mediaOnline(streamPushItems.get(i).getApp(), streamPushItems.get(i).getStream()); | |
| 648 | - if (onlineResult > 0) { | |
| 649 | - // 发送上线通知 | |
| 650 | - eventPublisher.catalogEventPublishForStream(null, streamPushItems.get(i), CatalogEvent.ON); | |
| 651 | - } | |
| 652 | - } | |
| 653 | - } | |
| 654 | - | |
| 655 | - | |
| 656 | - | |
| 657 | - @Override | |
| 658 | - public void updateMedia(StreamPushItem streamPushItem) { | |
| 659 | - streamPushMapper.del(streamPushItem.getApp(), streamPushItem.getStream()); | |
| 660 | - streamPushMapper.add(streamPushItem); | |
| 661 | - mediaOffline(streamPushItem.getApp(), streamPushItem.getStream()); | |
| 662 | - } | |
| 663 | - | |
| 664 | - @Override | |
| 665 | 639 | public int removeMedia(String app, String stream) { |
| 666 | 640 | return streamPushMapper.del(app, stream); |
| 667 | 641 | } |
| 668 | 642 | |
| 669 | 643 | @Override |
| 670 | - public StreamPushItem getMedia(String app, String stream) { | |
| 671 | - return streamPushMapper.selectOne(app, stream); | |
| 672 | - } | |
| 673 | - | |
| 674 | - @Override | |
| 675 | - public void clearMediaList() { | |
| 676 | - streamPushMapper.clear(); | |
| 677 | - } | |
| 678 | - | |
| 679 | - @Override | |
| 680 | 644 | public int mediaOffline(String app, String stream) { |
| 681 | 645 | GbStream gbStream = gbStreamMapper.selectOne(app, stream); |
| 682 | 646 | int result; |
| 683 | 647 | if ("proxy".equals(gbStream.getStreamType())) { |
| 684 | 648 | result = streamProxyMapper.updateStatus(app, stream, false); |
| 685 | 649 | }else { |
| 686 | - result = streamPushMapper.updateStatus(app, stream, false); | |
| 650 | + result = streamPushMapper.updatePushStatus(app, stream, false); | |
| 687 | 651 | } |
| 688 | 652 | return result; |
| 689 | 653 | } |
| ... | ... | @@ -695,7 +659,7 @@ public class VideoManagerStorageImpl implements IVideoManagerStorage { |
| 695 | 659 | if ("proxy".equals(gbStream.getStreamType())) { |
| 696 | 660 | result = streamProxyMapper.updateStatus(app, stream, true); |
| 697 | 661 | }else { |
| 698 | - result = streamPushMapper.updateStatus(app, stream, true); | |
| 662 | + result = streamPushMapper.updatePushStatus(app, stream, true); | |
| 699 | 663 | } |
| 700 | 664 | return result; |
| 701 | 665 | } |
| ... | ... | @@ -741,6 +705,7 @@ public class VideoManagerStorageImpl implements IVideoManagerStorage { |
| 741 | 705 | if (platformCatalog.getPlatformId().equals(platformCatalog.getParentId())) { |
| 742 | 706 | // 第一层节点 |
| 743 | 707 | platformCatalog.setBusinessGroupId(platformCatalog.getId()); |
| 708 | + platformCatalog.setParentId(platform.getDeviceGBId()); | |
| 744 | 709 | }else { |
| 745 | 710 | // 获取顶层的 |
| 746 | 711 | PlatformCatalog topCatalog = getTopCatalog(platformCatalog.getParentId(), platformCatalog.getPlatformId()); |
| ... | ... | @@ -749,6 +714,10 @@ public class VideoManagerStorageImpl implements IVideoManagerStorage { |
| 749 | 714 | } |
| 750 | 715 | if (platform.getTreeType().equals(TreeType.CIVIL_CODE)) { |
| 751 | 716 | platformCatalog.setCivilCode(platformCatalog.getId()); |
| 717 | + if (platformCatalog.getPlatformId().equals(platformCatalog.getParentId())) { | |
| 718 | + // 第一层节点 | |
| 719 | + platformCatalog.setParentId(platform.getDeviceGBId()); | |
| 720 | + } | |
| 752 | 721 | } |
| 753 | 722 | |
| 754 | 723 | int result = catalogMapper.add(platformCatalog); | ... | ... |
src/main/java/com/genersoft/iot/vmp/vmanager/bean/WVPResult.java
src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/platform/PlatformController.java
| ... | ... | @@ -8,6 +8,7 @@ import com.genersoft.iot.vmp.conf.UserSetting; |
| 8 | 8 | import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform; |
| 9 | 9 | import com.genersoft.iot.vmp.gb28181.bean.PlatformCatalog; |
| 10 | 10 | import com.genersoft.iot.vmp.gb28181.bean.SubscribeHolder; |
| 11 | +import com.genersoft.iot.vmp.gb28181.bean.TreeType; | |
| 11 | 12 | import com.genersoft.iot.vmp.gb28181.transmit.cmd.ISIPCommanderForPlatform; |
| 12 | 13 | import com.genersoft.iot.vmp.service.IPlatformChannelService; |
| 13 | 14 | import com.genersoft.iot.vmp.storager.IRedisCatchStorage; |
| ... | ... | @@ -463,13 +464,20 @@ public class PlatformController { |
| 463 | 464 | if (logger.isDebugEnabled()) { |
| 464 | 465 | logger.debug("查询目录,platformId: {}, parentId: {}", platformId, parentId); |
| 465 | 466 | } |
| 467 | + ParentPlatform platform = storager.queryParentPlatByServerGBId(platformId); | |
| 468 | + if (platform == null) { | |
| 469 | + return new ResponseEntity<>(new WVPResult<>(400, "平台未找到", null), HttpStatus.OK); | |
| 470 | + } | |
| 471 | + if (platformId.equals(parentId)) { | |
| 472 | + parentId = platform.getDeviceGBId(); | |
| 473 | + } | |
| 466 | 474 | List<PlatformCatalog> platformCatalogList = storager.getChildrenCatalogByPlatform(platformId, parentId); |
| 467 | - // 查询下属的国标通道 | |
| 468 | -// List<PlatformCatalog> catalogsForChannel = storager.queryChannelInParentPlatformAndCatalog(platformId, parentId); | |
| 469 | - // 查询下属的直播流通道 | |
| 470 | -// List<PlatformCatalog> catalogsForStream = storager.queryStreamInParentPlatformAndCatalog(platformId, parentId); | |
| 471 | -// platformCatalogList.addAll(catalogsForChannel); | |
| 472 | -// platformCatalogList.addAll(catalogsForStream); | |
| 475 | +// if (platform.getTreeType().equals(TreeType.BUSINESS_GROUP)) { | |
| 476 | +// platformCatalogList = storager.getChildrenCatalogByPlatform(platformId, parentId); | |
| 477 | +// }else { | |
| 478 | +// | |
| 479 | +// } | |
| 480 | + | |
| 473 | 481 | WVPResult<List<PlatformCatalog>> result = new WVPResult<>(); |
| 474 | 482 | result.setCode(0); |
| 475 | 483 | result.setMsg("success"); | ... | ... |
src/main/java/com/genersoft/iot/vmp/vmanager/server/ServerController.java
| ... | ... | @@ -8,6 +8,8 @@ import com.genersoft.iot.vmp.conf.DynamicTask; |
| 8 | 8 | import com.genersoft.iot.vmp.conf.SipConfig; |
| 9 | 9 | import com.genersoft.iot.vmp.conf.UserSetting; |
| 10 | 10 | import com.genersoft.iot.vmp.conf.VersionInfo; |
| 11 | +import com.genersoft.iot.vmp.media.zlm.ZLMHttpHookSubscribe; | |
| 12 | +import com.genersoft.iot.vmp.media.zlm.dto.IHookSubscribe; | |
| 11 | 13 | import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem; |
| 12 | 14 | import com.genersoft.iot.vmp.service.IMediaServerService; |
| 13 | 15 | import com.genersoft.iot.vmp.utils.SpringBeanFactory; |
| ... | ... | @@ -38,7 +40,7 @@ import java.util.Set; |
| 38 | 40 | public class ServerController { |
| 39 | 41 | |
| 40 | 42 | @Autowired |
| 41 | - private ConfigurableApplicationContext context; | |
| 43 | + private ZLMHttpHookSubscribe zlmHttpHookSubscribe; | |
| 42 | 44 | |
| 43 | 45 | @Autowired |
| 44 | 46 | private IMediaServerService mediaServerService; |
| ... | ... | @@ -254,6 +256,18 @@ public class ServerController { |
| 254 | 256 | return result; |
| 255 | 257 | } |
| 256 | 258 | |
| 259 | + @ApiOperation("获取当前所有hook") | |
| 260 | + @GetMapping(value = "/hooks") | |
| 261 | + @ResponseBody | |
| 262 | + public WVPResult<List<IHookSubscribe>> getHooks(){ | |
| 263 | + WVPResult<List<IHookSubscribe>> result = new WVPResult<>(); | |
| 264 | + result.setCode(0); | |
| 265 | + result.setMsg("success"); | |
| 266 | + List<IHookSubscribe> all = zlmHttpHookSubscribe.getAll(); | |
| 267 | + result.setData(all); | |
| 268 | + return result; | |
| 269 | + } | |
| 270 | + | |
| 257 | 271 | // @ApiOperation("当前进行中的动态任务") |
| 258 | 272 | // @GetMapping(value = "/dynamicTask") |
| 259 | 273 | // @ResponseBody | ... | ... |
src/main/java/com/genersoft/iot/vmp/vmanager/streamPush/StreamPushController.java
| ... | ... | @@ -4,6 +4,7 @@ import com.alibaba.excel.EasyExcel; |
| 4 | 4 | import com.alibaba.excel.ExcelReader; |
| 5 | 5 | import com.alibaba.excel.read.metadata.ReadSheet; |
| 6 | 6 | import com.genersoft.iot.vmp.common.StreamInfo; |
| 7 | +import com.genersoft.iot.vmp.conf.UserSetting; | |
| 7 | 8 | import com.genersoft.iot.vmp.conf.security.SecurityUtils; |
| 8 | 9 | import com.genersoft.iot.vmp.conf.security.dto.LoginUser; |
| 9 | 10 | import com.genersoft.iot.vmp.gb28181.bean.GbStream; |
| ... | ... | @@ -63,6 +64,9 @@ public class StreamPushController { |
| 63 | 64 | @Autowired |
| 64 | 65 | private IMediaService mediaService; |
| 65 | 66 | |
| 67 | + @Autowired | |
| 68 | + private UserSetting userSetting; | |
| 69 | + | |
| 66 | 70 | @ApiOperation("推流列表查询") |
| 67 | 71 | @ApiImplicitParams({ |
| 68 | 72 | @ApiImplicitParam(name="page", value = "当前页", required = true, dataTypeClass = Integer.class), |
| ... | ... | @@ -260,29 +264,63 @@ public class StreamPushController { |
| 260 | 264 | }) |
| 261 | 265 | @GetMapping(value = "/getPlayUrl") |
| 262 | 266 | @ResponseBody |
| 263 | - public WVPResult<StreamInfo> getPlayUrl(HttpServletRequest request, @RequestParam String app, | |
| 264 | - @RequestParam String stream, | |
| 265 | - @RequestParam(required = false) String mediaServerId){ | |
| 267 | + public WVPResult<StreamInfo> getPlayUrl(@RequestParam String app,@RequestParam String stream, | |
| 268 | + @RequestParam(required = false) String mediaServerId){ | |
| 266 | 269 | boolean authority = false; |
| 267 | 270 | // 是否登陆用户, 登陆用户返回完整信息 |
| 268 | 271 | LoginUser userInfo = SecurityUtils.getUserInfo(); |
| 269 | 272 | if (userInfo!= null) { |
| 270 | 273 | authority = true; |
| 271 | 274 | } |
| 272 | - | |
| 273 | - StreamInfo streamInfo = mediaService.getStreamInfoByAppAndStreamWithCheck(app, stream, mediaServerId, authority); | |
| 274 | - | |
| 275 | 275 | WVPResult<StreamInfo> result = new WVPResult<>(); |
| 276 | + StreamPushItem push = streamPushService.getPush(app, stream); | |
| 277 | + if (push != null && !push.isSelf()) { | |
| 278 | + result.setCode(-1); | |
| 279 | + result.setMsg("来自其他平台的推流信息"); | |
| 280 | + return result; | |
| 281 | + } | |
| 282 | + StreamInfo streamInfo = mediaService.getStreamInfoByAppAndStreamWithCheck(app, stream, mediaServerId, authority); | |
| 276 | 283 | if (streamInfo != null){ |
| 277 | 284 | result.setCode(0); |
| 278 | - result.setMsg("scccess"); | |
| 285 | + result.setMsg("success"); | |
| 279 | 286 | result.setData(streamInfo); |
| 280 | 287 | }else { |
| 281 | 288 | result.setCode(-1); |
| 282 | - result.setMsg("fail"); | |
| 289 | + result.setMsg("获取播放地址失败"); | |
| 283 | 290 | } |
| 291 | + | |
| 284 | 292 | return result; |
| 285 | 293 | } |
| 286 | 294 | |
| 295 | + /** | |
| 296 | + * 获取推流播放地址 | |
| 297 | + * @param stream 推流信息 | |
| 298 | + * @return | |
| 299 | + */ | |
| 300 | + @ApiOperation("获取推流播放地址") | |
| 301 | + @ApiImplicitParams({ | |
| 302 | + @ApiImplicitParam(name = "stream", value = "推流信息", dataTypeClass = StreamPushItem.class), | |
| 303 | + }) | |
| 304 | + @PostMapping(value = "/add") | |
| 305 | + @ResponseBody | |
| 306 | + public WVPResult<StreamInfo> add(@RequestBody StreamPushItem stream){ | |
| 307 | + if (StringUtils.isEmpty(stream.getGbId())) { | |
| 308 | + | |
| 309 | + return new WVPResult<>(400, "国标ID不可为空", null); | |
| 310 | + } | |
| 311 | + if (StringUtils.isEmpty(stream.getApp()) && StringUtils.isEmpty(stream.getStream())) { | |
| 312 | + return new WVPResult<>(400, "app或stream不可为空", null); | |
| 313 | + } | |
| 314 | + stream.setStatus(false); | |
| 315 | + stream.setPushIng(false); | |
| 316 | + stream.setAliveSecond(0L); | |
| 317 | + stream.setTotalReaderCount("0"); | |
| 318 | + boolean result = streamPushService.add(stream); | |
| 287 | 319 | |
| 320 | + if (result) { | |
| 321 | + return new WVPResult<>(0, "success", null); | |
| 322 | + }else { | |
| 323 | + return new WVPResult<>(-1, "fail", null); | |
| 324 | + } | |
| 325 | + } | |
| 288 | 326 | } | ... | ... |
web_src/src/components/PushVideoList.vue
| ... | ... | @@ -34,6 +34,8 @@ |
| 34 | 34 | <el-button icon="el-icon-delete" size="mini" style="margin-right: 1rem;" |
| 35 | 35 | :disabled="multipleSelection.length === 0" type="danger" @click="batchDel">批量移除 |
| 36 | 36 | </el-button> |
| 37 | + <el-button icon="el-icon-plus" size="mini" style="margin-right: 1rem;" type="primary" @click="addStream">添加通道 | |
| 38 | + </el-button> | |
| 37 | 39 | <el-button icon="el-icon-refresh-right" circle size="mini" @click="refresh()"></el-button> |
| 38 | 40 | </div> |
| 39 | 41 | </div> |
| ... | ... | @@ -67,14 +69,14 @@ |
| 67 | 69 | </el-table-column> |
| 68 | 70 | <el-table-column label="本平台推流" min-width="100"> |
| 69 | 71 | <template slot-scope="scope"> |
| 70 | - {{scope.row.pushIng && !!!scope.row.serverId ? '是' : '否' }} | |
| 72 | + {{scope.row.pushIng && !!scope.row.self ? '是' : '否' }} | |
| 71 | 73 | </template> |
| 72 | 74 | </el-table-column> |
| 73 | 75 | |
| 74 | 76 | <el-table-column label="操作" min-width="360" fixed="right"> |
| 75 | 77 | <template slot-scope="scope"> |
| 76 | 78 | <el-button size="medium" icon="el-icon-video-play" |
| 77 | - v-if="(scope.row.status == false && scope.row.gbId == null) || scope.row.status" | |
| 79 | + v-if="scope.row.pushIng === true" | |
| 78 | 80 | @click="playPush(scope.row)" type="text">播放 |
| 79 | 81 | </el-button> |
| 80 | 82 | <el-divider direction="vertical"></el-divider> |
| ... | ... | @@ -108,7 +110,7 @@ |
| 108 | 110 | <script> |
| 109 | 111 | import streamProxyEdit from './dialog/StreamProxyEdit.vue' |
| 110 | 112 | import devicePlayer from './dialog/devicePlayer.vue' |
| 111 | -import addStreamTOGB from './dialog/addStreamTOGB.vue' | |
| 113 | +import addStreamTOGB from './dialog/pushStreamEdit.vue' | |
| 112 | 114 | import uiHeader from '../layout/UiHeader.vue' |
| 113 | 115 | import importChannel from './dialog/importChannel.vue' |
| 114 | 116 | import MediaServer from './service/MediaServer' |
| ... | ... | @@ -200,10 +202,15 @@ export default { |
| 200 | 202 | } |
| 201 | 203 | }).then(function (res) { |
| 202 | 204 | that.getListLoading = false; |
| 203 | - that.$refs.devicePlayer.openDialog("streamPlay", null, null, { | |
| 204 | - streamInfo: res.data.data, | |
| 205 | - hasAudio: true | |
| 206 | - }); | |
| 205 | + if (res.data.code === 0 ) { | |
| 206 | + that.$refs.devicePlayer.openDialog("streamPlay", null, null, { | |
| 207 | + streamInfo: res.data.data, | |
| 208 | + hasAudio: true | |
| 209 | + }); | |
| 210 | + }else { | |
| 211 | + that.$message.error(res.data.msg); | |
| 212 | + } | |
| 213 | + | |
| 207 | 214 | }).catch(function (error) { |
| 208 | 215 | console.error(error); |
| 209 | 216 | that.getListLoading = false; |
| ... | ... | @@ -252,6 +259,9 @@ export default { |
| 252 | 259 | |
| 253 | 260 | }) |
| 254 | 261 | }, |
| 262 | + addStream: function (){ | |
| 263 | + this.$refs.addStreamTOGB.openDialog(null, this.initData); | |
| 264 | + }, | |
| 255 | 265 | batchDel: function () { |
| 256 | 266 | this.$confirm(`确定删除选中的${this.multipleSelection.length}个通道?`, '提示', { |
| 257 | 267 | confirmButtonText: '确定', | ... | ... |
web_src/src/components/channelList.vue
| ... | ... | @@ -124,7 +124,6 @@ |
| 124 | 124 | import devicePlayer from './dialog/devicePlayer.vue' |
| 125 | 125 | import uiHeader from '../layout/UiHeader.vue' |
| 126 | 126 | import moment from "moment"; |
| 127 | -import DviceService from "./service/DeviceService"; | |
| 128 | 127 | import DeviceService from "./service/DeviceService"; |
| 129 | 128 | import DeviceTree from "./common/DeviceTree"; |
| 130 | 129 | |
| ... | ... | @@ -318,7 +317,7 @@ export default { |
| 318 | 317 | changeSubchannel(itemData) { |
| 319 | 318 | this.beforeUrl = this.$router.currentRoute.path; |
| 320 | 319 | |
| 321 | - var url = `/${this.$router.currentRoute.name}/${this.$router.currentRoute.params.deviceId}/${itemData.channelId}/${this.$router.currentRoute.params.count}/1` | |
| 320 | + var url = `/${this.$router.currentRoute.name}/${this.$router.currentRoute.params.deviceId}/${itemData.channelId}` | |
| 322 | 321 | this.$router.push(url).then(() => { |
| 323 | 322 | this.searchSrt = ""; |
| 324 | 323 | this.channelType = ""; | ... | ... |
web_src/src/components/dialog/SyncChannelProgress.vue
| ... | ... | @@ -63,34 +63,39 @@ export default { |
| 63 | 63 | } |
| 64 | 64 | |
| 65 | 65 | if (res.data.data != null) { |
| 66 | - if (res.data.data.total == 0) { | |
| 67 | - if (res.data.data.errorMsg !== null ){ | |
| 68 | - this.msg = res.data.data.errorMsg; | |
| 69 | - this.syncStatus = "exception" | |
| 70 | - }else { | |
| 71 | - this.msg = `等待同步中`; | |
| 72 | - this.timmer = setTimeout(this.getProgress, 300) | |
| 73 | - } | |
| 74 | - }else { | |
| 75 | - if (res.data.data.total == res.data.data.current) { | |
| 76 | - this.syncStatus = "success" | |
| 77 | - this.percentage = 100; | |
| 78 | - this.msg = '同步成功'; | |
| 79 | - }else { | |
| 66 | + if (res.data.syncIng) { | |
| 67 | + if (res.data.data.total == 0) { | |
| 80 | 68 | if (res.data.data.errorMsg !== null ){ |
| 81 | 69 | this.msg = res.data.data.errorMsg; |
| 82 | 70 | this.syncStatus = "exception" |
| 83 | 71 | }else { |
| 84 | - this.total = res.data.data.total; | |
| 85 | - this.current = res.data.data.current; | |
| 86 | - this.percentage = Math.floor(Number(res.data.data.current)/Number(res.data.data.total)* 10000)/100; | |
| 87 | - this.msg = `同步中...[${res.data.data.current}/${res.data.data.total}]`; | |
| 72 | + this.msg = `等待同步中`; | |
| 88 | 73 | this.timmer = setTimeout(this.getProgress, 300) |
| 89 | 74 | } |
| 75 | + }else { | |
| 76 | + if (res.data.data.total == res.data.data.current) { | |
| 77 | + this.syncStatus = "success" | |
| 78 | + this.percentage = 100; | |
| 79 | + this.msg = '同步成功'; | |
| 80 | + }else { | |
| 81 | + if (res.data.data.errorMsg !== null ){ | |
| 82 | + this.msg = res.data.data.errorMsg; | |
| 83 | + this.syncStatus = "exception" | |
| 84 | + }else { | |
| 85 | + this.total = res.data.data.total; | |
| 86 | + this.current = res.data.data.current; | |
| 87 | + this.percentage = Math.floor(Number(res.data.data.current)/Number(res.data.data.total)* 10000)/100; | |
| 88 | + this.msg = `同步中...[${res.data.data.current}/${res.data.data.total}]`; | |
| 89 | + this.timmer = setTimeout(this.getProgress, 300) | |
| 90 | + } | |
| 91 | + } | |
| 90 | 92 | } |
| 93 | + }else { | |
| 94 | + this.syncStatus = "success" | |
| 95 | + this.percentage = 100; | |
| 96 | + this.msg = '同步成功'; | |
| 91 | 97 | } |
| 92 | 98 | } |
| 93 | - | |
| 94 | 99 | }else { |
| 95 | 100 | if (this.syncFlag) { |
| 96 | 101 | this.syncStatus = "success" | ... | ... |
web_src/src/components/dialog/catalogEdit.vue
| ... | ... | @@ -70,12 +70,11 @@ export default { |
| 70 | 70 | console.log(catalogType) |
| 71 | 71 | // 216 为虚拟组织 215 为业务分组;目录第一级必须为业务分组, 业务分组下为虚拟组织,虚拟组织下可以有其他虚拟组织 |
| 72 | 72 | if (this.level === 1 && catalogType !== "215") { |
| 73 | - return callback(new Error('业务分组模式下第一层目录的编号10到13位必须为215')); | |
| 73 | + return callback(new Error('业务分组模式下第一层目录的编号11到13位必须为215')); | |
| 74 | 74 | } |
| 75 | 75 | if (this.level > 1 && catalogType !== "216") { |
| 76 | - return callback(new Error('业务分组模式下第一层以下目录的编号10到13位必须为216')); | |
| 76 | + return callback(new Error('业务分组模式下第一层以下目录的编号11到13位必须为216')); | |
| 77 | 77 | } |
| 78 | - | |
| 79 | 78 | } |
| 80 | 79 | callback(); |
| 81 | 80 | } |
| ... | ... | @@ -94,7 +93,7 @@ export default { |
| 94 | 93 | }, |
| 95 | 94 | rules: { |
| 96 | 95 | name: [{ required: true, message: "请输入名称", trigger: "blur" }], |
| 97 | - id: [{ trigger: "blur",validator: checkId }] | |
| 96 | + id: [{ required: true, trigger: "blur",validator: checkId }] | |
| 98 | 97 | }, |
| 99 | 98 | }; |
| 100 | 99 | }, | ... | ... |
web_src/src/components/dialog/addStreamTOGB.vue renamed to web_src/src/components/dialog/pushStreamEdit.vue
| ... | ... | @@ -15,10 +15,10 @@ |
| 15 | 15 | <el-input v-model="proxyParam.name" clearable></el-input> |
| 16 | 16 | </el-form-item> |
| 17 | 17 | <el-form-item label="流应用名" prop="app"> |
| 18 | - <el-input v-model="proxyParam.app" clearable :disabled="true"></el-input> | |
| 18 | + <el-input v-model="proxyParam.app" clearable :disabled="edit"></el-input> | |
| 19 | 19 | </el-form-item> |
| 20 | 20 | <el-form-item label="流ID" prop="stream"> |
| 21 | - <el-input v-model="proxyParam.stream" clearable :disabled="true"></el-input> | |
| 21 | + <el-input v-model="proxyParam.stream" clearable :disabled="edit"></el-input> | |
| 22 | 22 | </el-form-item> |
| 23 | 23 | <el-form-item label="国标编码" prop="gbId"> |
| 24 | 24 | <el-input v-model="proxyParam.gbId" placeholder="设置国标编码可推送到国标" clearable></el-input> |
| ... | ... | @@ -28,7 +28,6 @@ |
| 28 | 28 | <el-button type="primary" @click="onSubmit">保存</el-button> |
| 29 | 29 | <el-button @click="close">取消</el-button> |
| 30 | 30 | </div> |
| 31 | - | |
| 32 | 31 | </el-form-item> |
| 33 | 32 | </el-form> |
| 34 | 33 | </div> |
| ... | ... | @@ -38,7 +37,7 @@ |
| 38 | 37 | |
| 39 | 38 | <script> |
| 40 | 39 | export default { |
| 41 | - name: "streamProxyEdit", | |
| 40 | + name: "pushStreamEdit", | |
| 42 | 41 | props: {}, |
| 43 | 42 | computed: {}, |
| 44 | 43 | created() {}, |
| ... | ... | @@ -63,13 +62,13 @@ export default { |
| 63 | 62 | listChangeCallback: null, |
| 64 | 63 | showDialog: false, |
| 65 | 64 | isLoging: false, |
| 65 | + edit: false, | |
| 66 | 66 | proxyParam: { |
| 67 | 67 | name: null, |
| 68 | 68 | app: null, |
| 69 | 69 | stream: null, |
| 70 | 70 | gbId: null, |
| 71 | 71 | }, |
| 72 | - | |
| 73 | 72 | rules: { |
| 74 | 73 | name: [{ required: true, message: "请输入名称", trigger: "blur" }], |
| 75 | 74 | app: [{ required: true, message: "请输入应用名", trigger: "blur" }], |
| ... | ... | @@ -84,30 +83,53 @@ export default { |
| 84 | 83 | this.listChangeCallback = callback; |
| 85 | 84 | if (proxyParam != null) { |
| 86 | 85 | this.proxyParam = proxyParam; |
| 87 | - } | |
| 86 | + this.edit = true | |
| 87 | + } | |
| 88 | 88 | }, |
| 89 | 89 | onSubmit: function () { |
| 90 | 90 | console.log("onSubmit"); |
| 91 | - var that = this; | |
| 92 | - that.$axios({ | |
| 93 | - method:"post", | |
| 94 | - url:`/api/push/save_to_gb`, | |
| 95 | - data: that.proxyParam | |
| 96 | - }).then(function (res) { | |
| 91 | + if (this.edit) { | |
| 92 | + this.$axios({ | |
| 93 | + method:"post", | |
| 94 | + url:`/api/push/save_to_gb`, | |
| 95 | + data: this.proxyParam | |
| 96 | + }).then( (res) => { | |
| 97 | 97 | if (res.data == "success") { |
| 98 | - that.$message({ | |
| 98 | + this.$message({ | |
| 99 | 99 | showClose: true, |
| 100 | 100 | message: "保存成功", |
| 101 | 101 | type: "success", |
| 102 | 102 | }); |
| 103 | - that.showDialog = false; | |
| 104 | - if (that.listChangeCallback != null) { | |
| 105 | - that.listChangeCallback(); | |
| 103 | + this.showDialog = false; | |
| 104 | + if (this.listChangeCallback != null) { | |
| 105 | + this.listChangeCallback(); | |
| 106 | 106 | } |
| 107 | 107 | } |
| 108 | - }).catch(function (error) { | |
| 108 | + }).catch((error)=> { | |
| 109 | 109 | console.log(error); |
| 110 | - }); | |
| 110 | + }); | |
| 111 | + }else { | |
| 112 | + this.$axios({ | |
| 113 | + method:"post", | |
| 114 | + url:`/api/push/add`, | |
| 115 | + data: this.proxyParam | |
| 116 | + }).then( (res) => { | |
| 117 | + if (res.data.code === 0) { | |
| 118 | + this.$message({ | |
| 119 | + showClose: true, | |
| 120 | + message: "保存成功", | |
| 121 | + type: "success", | |
| 122 | + }); | |
| 123 | + this.showDialog = false; | |
| 124 | + if (this.listChangeCallback != null) { | |
| 125 | + this.listChangeCallback(); | |
| 126 | + } | |
| 127 | + } | |
| 128 | + }).catch((error)=> { | |
| 129 | + console.log(error); | |
| 130 | + }); | |
| 131 | + } | |
| 132 | + | |
| 111 | 133 | }, |
| 112 | 134 | close: function () { |
| 113 | 135 | console.log("关闭加入GB"); |
| ... | ... | @@ -131,6 +153,9 @@ export default { |
| 131 | 153 | if (this.platform.enable && this.platform.expires == "0") { |
| 132 | 154 | this.platform.expires = "300"; |
| 133 | 155 | } |
| 156 | + }, | |
| 157 | + handleNodeClick: function (node){ | |
| 158 | + | |
| 134 | 159 | } |
| 135 | 160 | }, |
| 136 | 161 | }; | ... | ... |