Commit 66e67569095f0ba871c2b584ceed73dfaa50d00c

Authored by 648540858
2 parents 5364db29 0b1cae75

Merge remote-tracking branch 'origin/wvp-28181-2.0' into liujie-20220712

# Conflicts:
#	src/main/java/com/genersoft/iot/vmp/service/IMediaService.java
#	src/main/java/com/genersoft/iot/vmp/service/impl/MediaServiceImpl.java
Showing 66 changed files with 1603 additions and 654 deletions
sql/mysql.sql
1 -- MySQL dump 10.13 Distrib 8.0.29, for Linux (x86_64) 1 -- MySQL dump 10.13 Distrib 8.0.29, for Linux (x86_64)
2 -- 2 --
3 --- Host: 127.0.0.1 Database: wvp3 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.2
6 6
@@ -23,34 +23,34 @@ DROP TABLE IF EXISTS `device`; @@ -23,34 +23,34 @@ DROP TABLE IF EXISTS `device`;
23 /*!40101 SET @saved_cs_client = @@character_set_client */; 23 /*!40101 SET @saved_cs_client = @@character_set_client */;
24 /*!50503 SET character_set_client = utf8mb4 */; 24 /*!50503 SET character_set_client = utf8mb4 */;
25 CREATE TABLE `device` ( 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) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,  
50 - `treeType` varchar(50) CHARACTER SET utf8mb4 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=32 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC; 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=42 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC;
54 /*!40101 SET character_set_client = @saved_cs_client */; 54 /*!40101 SET character_set_client = @saved_cs_client */;
55 55
56 -- 56 --
@@ -70,17 +70,18 @@ DROP TABLE IF EXISTS `device_alarm`; @@ -70,17 +70,18 @@ DROP TABLE IF EXISTS `device_alarm`;
70 /*!40101 SET @saved_cs_client = @@character_set_client */; 70 /*!40101 SET @saved_cs_client = @@character_set_client */;
71 /*!50503 SET character_set_client = utf8mb4 */; 71 /*!50503 SET character_set_client = utf8mb4 */;
72 CREATE TABLE `device_alarm` ( 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 - PRIMARY KEY (`id`) USING BTREE 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
84 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC; 85 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC;
85 /*!40101 SET character_set_client = @saved_cs_client */; 86 /*!40101 SET character_set_client = @saved_cs_client */;
86 87
@@ -101,46 +102,47 @@ DROP TABLE IF EXISTS `device_channel`; @@ -101,46 +102,47 @@ DROP TABLE IF EXISTS `device_channel`;
101 /*!40101 SET @saved_cs_client = @@character_set_client */; 102 /*!40101 SET @saved_cs_client = @@character_set_client */;
102 /*!50503 SET character_set_client = utf8mb4 */; 103 /*!50503 SET character_set_client = utf8mb4 */;
103 CREATE TABLE `device_channel` ( 104 CREATE TABLE `device_channel` (
104 - `id` int NOT NULL AUTO_INCREMENT,  
105 - `channelId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,  
106 - `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,  
107 - `manufacture` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,  
108 - `model` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,  
109 - `owner` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,  
110 - `civilCode` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,  
111 - `block` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,  
112 - `address` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,  
113 - `parentId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,  
114 - `safetyWay` int DEFAULT NULL,  
115 - `registerWay` int DEFAULT NULL,  
116 - `certNum` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,  
117 - `certifiable` int DEFAULT NULL,  
118 - `errCode` int DEFAULT NULL,  
119 - `endTime` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,  
120 - `secrecy` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,  
121 - `ipAddress` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,  
122 - `port` int DEFAULT NULL,  
123 - `password` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,  
124 - `PTZType` int DEFAULT NULL,  
125 - `status` int DEFAULT NULL,  
126 - `longitude` double DEFAULT NULL,  
127 - `latitude` double DEFAULT NULL,  
128 - `streamId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,  
129 - `deviceId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,  
130 - `parental` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,  
131 - `hasAudio` bit(1) DEFAULT NULL,  
132 - `createTime` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,  
133 - `updateTime` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,  
134 - `subCount` int DEFAULT '0',  
135 - `longitudeGcj02` double DEFAULT NULL,  
136 - `latitudeGcj02` double DEFAULT NULL,  
137 - `longitudeWgs84` double DEFAULT NULL,  
138 - `latitudeWgs84` double DEFAULT NULL,  
139 - `businessGroupId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,  
140 - PRIMARY KEY (`id`) USING BTREE,  
141 - UNIQUE KEY `device_channel_id_uindex` (`id`) USING BTREE,  
142 - UNIQUE KEY `device_channel_pk` (`channelId`,`deviceId`) USING BTREE  
143 -) ENGINE=InnoDB AUTO_INCREMENT=19314 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC; 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=19331 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC;
144 /*!40101 SET character_set_client = @saved_cs_client */; 146 /*!40101 SET character_set_client = @saved_cs_client */;
145 147
146 -- 148 --
@@ -160,22 +162,24 @@ DROP TABLE IF EXISTS `device_mobile_position`; @@ -160,22 +162,24 @@ DROP TABLE IF EXISTS `device_mobile_position`;
160 /*!40101 SET @saved_cs_client = @@character_set_client */; 162 /*!40101 SET @saved_cs_client = @@character_set_client */;
161 /*!50503 SET character_set_client = utf8mb4 */; 163 /*!50503 SET character_set_client = utf8mb4 */;
162 CREATE TABLE `device_mobile_position` ( 164 CREATE TABLE `device_mobile_position` (
163 - `id` int NOT NULL AUTO_INCREMENT,  
164 - `deviceId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,  
165 - `channelId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,  
166 - `deviceName` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,  
167 - `time` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,  
168 - `longitude` double NOT NULL,  
169 - `latitude` double NOT NULL,  
170 - `altitude` double DEFAULT NULL,  
171 - `speed` double DEFAULT NULL,  
172 - `direction` double DEFAULT NULL,  
173 - `reportSource` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,  
174 - `geodeticSystem` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,  
175 - `cnLng` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,  
176 - `cnLat` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,  
177 - PRIMARY KEY (`id`) USING BTREE  
178 -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC; 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;
179 /*!40101 SET character_set_client = @saved_cs_client */; 183 /*!40101 SET character_set_client = @saved_cs_client */;
180 184
181 -- 185 --
@@ -195,21 +199,21 @@ DROP TABLE IF EXISTS `gb_stream`; @@ -195,21 +199,21 @@ DROP TABLE IF EXISTS `gb_stream`;
195 /*!40101 SET @saved_cs_client = @@character_set_client */; 199 /*!40101 SET @saved_cs_client = @@character_set_client */;
196 /*!50503 SET character_set_client = utf8mb4 */; 200 /*!50503 SET character_set_client = utf8mb4 */;
197 CREATE TABLE `gb_stream` ( 201 CREATE TABLE `gb_stream` (
198 - `gbStreamId` int NOT NULL AUTO_INCREMENT,  
199 - `app` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,  
200 - `stream` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,  
201 - `gbId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,  
202 - `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,  
203 - `longitude` double DEFAULT NULL,  
204 - `latitude` double DEFAULT NULL,  
205 - `streamType` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,  
206 - `mediaServerId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,  
207 - `status` int DEFAULT NULL,  
208 - `createStamp` bigint DEFAULT NULL,  
209 - PRIMARY KEY (`gbStreamId`) USING BTREE,  
210 - UNIQUE KEY `app` (`app`,`stream`) USING BTREE,  
211 - UNIQUE KEY `gbId` (`gbId`) USING BTREE  
212 -) ENGINE=InnoDB AUTO_INCREMENT=301679 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC; 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=301681 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC;
213 /*!40101 SET character_set_client = @saved_cs_client */; 217 /*!40101 SET character_set_client = @saved_cs_client */;
214 218
215 -- 219 --
@@ -229,17 +233,17 @@ DROP TABLE IF EXISTS `log`; @@ -229,17 +233,17 @@ DROP TABLE IF EXISTS `log`;
229 /*!40101 SET @saved_cs_client = @@character_set_client */; 233 /*!40101 SET @saved_cs_client = @@character_set_client */;
230 /*!50503 SET character_set_client = utf8mb4 */; 234 /*!50503 SET character_set_client = utf8mb4 */;
231 CREATE TABLE `log` ( 235 CREATE TABLE `log` (
232 - `id` int NOT NULL AUTO_INCREMENT,  
233 - `name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,  
234 - `type` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,  
235 - `uri` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,  
236 - `address` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,  
237 - `result` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,  
238 - `timing` bigint NOT NULL,  
239 - `username` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,  
240 - `createTime` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,  
241 - PRIMARY KEY (`id`) USING BTREE  
242 -) ENGINE=InnoDB AUTO_INCREMENT=21611 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC; 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=34997 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC;
243 /*!40101 SET character_set_client = @saved_cs_client */; 247 /*!40101 SET character_set_client = @saved_cs_client */;
244 248
245 -- 249 --
@@ -259,31 +263,31 @@ DROP TABLE IF EXISTS `media_server`; @@ -259,31 +263,31 @@ DROP TABLE IF EXISTS `media_server`;
259 /*!40101 SET @saved_cs_client = @@character_set_client */; 263 /*!40101 SET @saved_cs_client = @@character_set_client */;
260 /*!50503 SET character_set_client = utf8mb4 */; 264 /*!50503 SET character_set_client = utf8mb4 */;
261 CREATE TABLE `media_server` ( 265 CREATE TABLE `media_server` (
262 - `id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,  
263 - `ip` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,  
264 - `hookIp` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,  
265 - `sdpIp` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,  
266 - `streamIp` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,  
267 - `httpPort` int NOT NULL,  
268 - `httpSSlPort` int NOT NULL,  
269 - `rtmpPort` int NOT NULL,  
270 - `rtmpSSlPort` int NOT NULL,  
271 - `rtpProxyPort` int NOT NULL,  
272 - `rtspPort` int NOT NULL,  
273 - `rtspSSLPort` int NOT NULL,  
274 - `autoConfig` int NOT NULL,  
275 - `secret` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,  
276 - `streamNoneReaderDelayMS` int NOT NULL,  
277 - `rtpEnable` int NOT NULL,  
278 - `rtpPortRange` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,  
279 - `sendRtpPortRange` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,  
280 - `recordAssistPort` int NOT NULL,  
281 - `defaultServer` int NOT NULL,  
282 - `createTime` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,  
283 - `updateTime` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,  
284 - `hookAliveInterval` int NOT NULL,  
285 - PRIMARY KEY (`id`) USING BTREE,  
286 - UNIQUE KEY `media_server_i` (`ip`,`httpPort`) USING BTREE 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
287 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC; 291 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC;
288 /*!40101 SET character_set_client = @saved_cs_client */; 292 /*!40101 SET character_set_client = @saved_cs_client */;
289 293
@@ -304,34 +308,36 @@ DROP TABLE IF EXISTS `parent_platform`; @@ -304,34 +308,36 @@ DROP TABLE IF EXISTS `parent_platform`;
304 /*!40101 SET @saved_cs_client = @@character_set_client */; 308 /*!40101 SET @saved_cs_client = @@character_set_client */;
305 /*!50503 SET character_set_client = utf8mb4 */; 309 /*!50503 SET character_set_client = utf8mb4 */;
306 CREATE TABLE `parent_platform` ( 310 CREATE TABLE `parent_platform` (
307 - `id` int NOT NULL AUTO_INCREMENT,  
308 - `enable` int DEFAULT NULL,  
309 - `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,  
310 - `serverGBId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,  
311 - `serverGBDomain` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,  
312 - `serverIP` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,  
313 - `serverPort` int DEFAULT NULL,  
314 - `deviceGBId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,  
315 - `deviceIp` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,  
316 - `devicePort` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,  
317 - `username` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,  
318 - `password` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,  
319 - `expires` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,  
320 - `keepTimeout` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,  
321 - `transport` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,  
322 - `characterSet` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,  
323 - `catalogId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,  
324 - `ptz` int DEFAULT NULL,  
325 - `rtcp` int DEFAULT NULL,  
326 - `status` bit(1) DEFAULT NULL,  
327 - `shareAllLiveStream` int DEFAULT NULL,  
328 - `startOfflinePush` int DEFAULT '0',  
329 - `administrativeDivision` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,  
330 - `catalogGroup` int DEFAULT '1',  
331 - PRIMARY KEY (`id`) USING BTREE,  
332 - UNIQUE KEY `parent_platform_id_uindex` (`id`) USING BTREE,  
333 - UNIQUE KEY `parent_platform_pk` (`serverGBId`) USING BTREE  
334 -) ENGINE=InnoDB AUTO_INCREMENT=31 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC; 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 + `shareAllLiveStream` int DEFAULT NULL,
  332 + `startOfflinePush` int DEFAULT '0',
  333 + `administrativeDivision` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
  334 + `catalogGroup` int DEFAULT '1',
  335 + `createTime` varchar(50) COLLATE utf8mb4_general_ci DEFAULT NULL,
  336 + `updateTime` varchar(50) COLLATE utf8mb4_general_ci DEFAULT 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=33 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC;
335 /*!40101 SET character_set_client = @saved_cs_client */; 341 /*!40101 SET character_set_client = @saved_cs_client */;
336 342
337 -- 343 --
@@ -351,11 +357,11 @@ DROP TABLE IF EXISTS `platform_catalog`; @@ -351,11 +357,11 @@ DROP TABLE IF EXISTS `platform_catalog`;
351 /*!40101 SET @saved_cs_client = @@character_set_client */; 357 /*!40101 SET @saved_cs_client = @@character_set_client */;
352 /*!50503 SET character_set_client = utf8mb4 */; 358 /*!50503 SET character_set_client = utf8mb4 */;
353 CREATE TABLE `platform_catalog` ( 359 CREATE TABLE `platform_catalog` (
354 - `id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,  
355 - `platformId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,  
356 - `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,  
357 - `parentId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,  
358 - PRIMARY KEY (`id`) USING BTREE 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 + PRIMARY KEY (`id`) USING BTREE
359 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC; 365 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC;
360 /*!40101 SET character_set_client = @saved_cs_client */; 366 /*!40101 SET character_set_client = @saved_cs_client */;
361 367
@@ -376,11 +382,11 @@ DROP TABLE IF EXISTS `platform_gb_channel`; @@ -376,11 +382,11 @@ DROP TABLE IF EXISTS `platform_gb_channel`;
376 /*!40101 SET @saved_cs_client = @@character_set_client */; 382 /*!40101 SET @saved_cs_client = @@character_set_client */;
377 /*!50503 SET character_set_client = utf8mb4 */; 383 /*!50503 SET character_set_client = utf8mb4 */;
378 CREATE TABLE `platform_gb_channel` ( 384 CREATE TABLE `platform_gb_channel` (
379 - `id` int NOT NULL AUTO_INCREMENT,  
380 - `platformId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,  
381 - `catalogId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,  
382 - `deviceChannelId` int NOT NULL,  
383 - PRIMARY KEY (`id`) USING BTREE 385 + `id` int NOT NULL AUTO_INCREMENT,
  386 + `platformId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
  387 + `catalogId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
  388 + `deviceChannelId` int NOT NULL,
  389 + PRIMARY KEY (`id`) USING BTREE
384 ) ENGINE=InnoDB AUTO_INCREMENT=4889 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC; 390 ) ENGINE=InnoDB AUTO_INCREMENT=4889 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC;
385 /*!40101 SET character_set_client = @saved_cs_client */; 391 /*!40101 SET character_set_client = @saved_cs_client */;
386 392
@@ -401,12 +407,12 @@ DROP TABLE IF EXISTS `platform_gb_stream`; @@ -401,12 +407,12 @@ DROP TABLE IF EXISTS `platform_gb_stream`;
401 /*!40101 SET @saved_cs_client = @@character_set_client */; 407 /*!40101 SET @saved_cs_client = @@character_set_client */;
402 /*!50503 SET character_set_client = utf8mb4 */; 408 /*!50503 SET character_set_client = utf8mb4 */;
403 CREATE TABLE `platform_gb_stream` ( 409 CREATE TABLE `platform_gb_stream` (
404 - `platformId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,  
405 - `catalogId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,  
406 - `gbStreamId` int NOT NULL,  
407 - `id` int NOT NULL AUTO_INCREMENT,  
408 - PRIMARY KEY (`id`) USING BTREE,  
409 - UNIQUE KEY `platform_gb_stream_pk` (`platformId`,`catalogId`,`gbStreamId`) USING BTREE 410 + `platformId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
  411 + `catalogId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
  412 + `gbStreamId` int NOT NULL,
  413 + `id` int NOT NULL AUTO_INCREMENT,
  414 + PRIMARY KEY (`id`) USING BTREE,
  415 + UNIQUE KEY `platform_gb_stream_pk` (`platformId`,`catalogId`,`gbStreamId`) USING BTREE
410 ) ENGINE=InnoDB AUTO_INCREMENT=302077 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC; 416 ) ENGINE=InnoDB AUTO_INCREMENT=302077 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC;
411 /*!40101 SET character_set_client = @saved_cs_client */; 417 /*!40101 SET character_set_client = @saved_cs_client */;
412 418
@@ -427,27 +433,28 @@ DROP TABLE IF EXISTS `stream_proxy`; @@ -427,27 +433,28 @@ DROP TABLE IF EXISTS `stream_proxy`;
427 /*!40101 SET @saved_cs_client = @@character_set_client */; 433 /*!40101 SET @saved_cs_client = @@character_set_client */;
428 /*!50503 SET character_set_client = utf8mb4 */; 434 /*!50503 SET character_set_client = utf8mb4 */;
429 CREATE TABLE `stream_proxy` ( 435 CREATE TABLE `stream_proxy` (
430 - `id` int NOT NULL AUTO_INCREMENT,  
431 - `type` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,  
432 - `app` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,  
433 - `stream` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,  
434 - `url` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,  
435 - `src_url` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,  
436 - `dst_url` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,  
437 - `timeout_ms` int DEFAULT NULL,  
438 - `ffmpeg_cmd_key` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,  
439 - `rtp_type` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,  
440 - `mediaServerId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,  
441 - `enable_hls` bit(1) DEFAULT NULL,  
442 - `enable_mp4` bit(1) DEFAULT NULL,  
443 - `enable` bit(1) NOT NULL,  
444 - `status` bit(1) NOT NULL,  
445 - `enable_remove_none_reader` bit(1) NOT NULL,  
446 - `createTime` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,  
447 - `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,  
448 - PRIMARY KEY (`id`) USING BTREE,  
449 - UNIQUE KEY `stream_proxy_pk` (`app`,`stream`) USING BTREE  
450 -) ENGINE=InnoDB AUTO_INCREMENT=61 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC; 436 + `id` int NOT NULL AUTO_INCREMENT,
  437 + `type` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
  438 + `app` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
  439 + `stream` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
  440 + `url` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
  441 + `src_url` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
  442 + `dst_url` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
  443 + `timeout_ms` int DEFAULT NULL,
  444 + `ffmpeg_cmd_key` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
  445 + `rtp_type` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
  446 + `mediaServerId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
  447 + `enable_hls` bit(1) DEFAULT NULL,
  448 + `enable_mp4` bit(1) DEFAULT NULL,
  449 + `enable` bit(1) NOT NULL,
  450 + `status` bit(1) NOT NULL,
  451 + `enable_remove_none_reader` bit(1) NOT NULL,
  452 + `createTime` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
  453 + `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
  454 + `updateTime` varchar(50) COLLATE utf8mb4_general_ci DEFAULT NULL,
  455 + PRIMARY KEY (`id`) USING BTREE,
  456 + UNIQUE KEY `stream_proxy_pk` (`app`,`stream`) USING BTREE
  457 +) ENGINE=InnoDB AUTO_INCREMENT=66 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC;
451 /*!40101 SET character_set_client = @saved_cs_client */; 458 /*!40101 SET character_set_client = @saved_cs_client */;
452 459
453 -- 460 --
@@ -467,19 +474,22 @@ DROP TABLE IF EXISTS `stream_push`; @@ -467,19 +474,22 @@ DROP TABLE IF EXISTS `stream_push`;
467 /*!40101 SET @saved_cs_client = @@character_set_client */; 474 /*!40101 SET @saved_cs_client = @@character_set_client */;
468 /*!50503 SET character_set_client = utf8mb4 */; 475 /*!50503 SET character_set_client = utf8mb4 */;
469 CREATE TABLE `stream_push` ( 476 CREATE TABLE `stream_push` (
470 - `id` int NOT NULL AUTO_INCREMENT,  
471 - `app` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,  
472 - `stream` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,  
473 - `totalReaderCount` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,  
474 - `originType` int DEFAULT NULL,  
475 - `originTypeStr` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,  
476 - `createStamp` bigint DEFAULT NULL,  
477 - `aliveSecond` int DEFAULT NULL,  
478 - `mediaServerId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,  
479 - `serverId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,  
480 - PRIMARY KEY (`id`) USING BTREE,  
481 - UNIQUE KEY `stream_push_pk` (`app`,`stream`) USING BTREE  
482 -) ENGINE=InnoDB AUTO_INCREMENT=305291 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC; 477 + `id` int NOT NULL AUTO_INCREMENT,
  478 + `app` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
  479 + `stream` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
  480 + `totalReaderCount` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
  481 + `originType` int DEFAULT NULL,
  482 + `originTypeStr` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
  483 + `createTime` varchar(50) COLLATE utf8mb4_general_ci DEFAULT NULL,
  484 + `aliveSecond` int DEFAULT NULL,
  485 + `mediaServerId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
  486 + `serverId` varchar(50) COLLATE utf8mb4_general_ci NOT NULL,
  487 + `pushTime` varchar(50) COLLATE utf8mb4_general_ci DEFAULT NULL,
  488 + `updateTime` varchar(50) COLLATE utf8mb4_general_ci DEFAULT NULL,
  489 + `status` int DEFAULT NULL,
  490 + PRIMARY KEY (`id`) USING BTREE,
  491 + UNIQUE KEY `stream_push_pk` (`app`,`stream`) USING BTREE
  492 +) ENGINE=InnoDB AUTO_INCREMENT=305315 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC;
483 /*!40101 SET character_set_client = @saved_cs_client */; 493 /*!40101 SET character_set_client = @saved_cs_client */;
484 494
485 -- 495 --
@@ -499,14 +509,15 @@ DROP TABLE IF EXISTS `user`; @@ -499,14 +509,15 @@ DROP TABLE IF EXISTS `user`;
499 /*!40101 SET @saved_cs_client = @@character_set_client */; 509 /*!40101 SET @saved_cs_client = @@character_set_client */;
500 /*!50503 SET character_set_client = utf8mb4 */; 510 /*!50503 SET character_set_client = utf8mb4 */;
501 CREATE TABLE `user` ( 511 CREATE TABLE `user` (
502 - `id` int NOT NULL AUTO_INCREMENT,  
503 - `username` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,  
504 - `password` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,  
505 - `roleId` int NOT NULL,  
506 - `createTime` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,  
507 - `updateTime` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,  
508 - PRIMARY KEY (`id`) USING BTREE,  
509 - UNIQUE KEY `user_username_uindex` (`username`) USING BTREE 512 + `id` int NOT NULL AUTO_INCREMENT,
  513 + `username` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
  514 + `password` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
  515 + `roleId` int NOT NULL,
  516 + `createTime` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
  517 + `updateTime` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
  518 + `pushKey` varchar(50) COLLATE utf8mb4_general_ci DEFAULT NULL,
  519 + PRIMARY KEY (`id`) USING BTREE,
  520 + UNIQUE KEY `user_username_uindex` (`username`) USING BTREE
510 ) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC; 521 ) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC;
511 /*!40101 SET character_set_client = @saved_cs_client */; 522 /*!40101 SET character_set_client = @saved_cs_client */;
512 523
@@ -516,7 +527,7 @@ CREATE TABLE `user` ( @@ -516,7 +527,7 @@ CREATE TABLE `user` (
516 527
517 LOCK TABLES `user` WRITE; 528 LOCK TABLES `user` WRITE;
518 /*!40000 ALTER TABLE `user` DISABLE KEYS */; 529 /*!40000 ALTER TABLE `user` DISABLE KEYS */;
519 -INSERT INTO `user` VALUES (1,'admin','21232f297a57a5a743894a0e4a801fc3',1,'2021 - 04 - 13 14:14:57','2021 - 04 - 13 14:14:57'); 530 +INSERT INTO `user` VALUES (1,'admin','21232f297a57a5a743894a0e4a801fc3',1,'2021 - 04 - 13 14:14:57','2021 - 04 - 13 14:14:57','453df297a57a5a7438934sda801fc3');
520 /*!40000 ALTER TABLE `user` ENABLE KEYS */; 531 /*!40000 ALTER TABLE `user` ENABLE KEYS */;
521 UNLOCK TABLES; 532 UNLOCK TABLES;
522 533
@@ -528,12 +539,12 @@ DROP TABLE IF EXISTS `user_role`; @@ -528,12 +539,12 @@ DROP TABLE IF EXISTS `user_role`;
528 /*!40101 SET @saved_cs_client = @@character_set_client */; 539 /*!40101 SET @saved_cs_client = @@character_set_client */;
529 /*!50503 SET character_set_client = utf8mb4 */; 540 /*!50503 SET character_set_client = utf8mb4 */;
530 CREATE TABLE `user_role` ( 541 CREATE TABLE `user_role` (
531 - `id` int NOT NULL AUTO_INCREMENT,  
532 - `name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,  
533 - `authority` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,  
534 - `createTime` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,  
535 - `updateTime` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,  
536 - PRIMARY KEY (`id`) USING BTREE 542 + `id` int NOT NULL AUTO_INCREMENT,
  543 + `name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
  544 + `authority` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
  545 + `createTime` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
  546 + `updateTime` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
  547 + PRIMARY KEY (`id`) USING BTREE
537 ) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC; 548 ) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC;
538 /*!40101 SET character_set_client = @saved_cs_client */; 549 /*!40101 SET character_set_client = @saved_cs_client */;
539 550
@@ -556,4 +567,4 @@ UNLOCK TABLES; @@ -556,4 +567,4 @@ UNLOCK TABLES;
556 /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; 567 /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
557 /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; 568 /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
558 569
559 --- Dump completed on 2022-06-26 17:33:30 570 +-- Dump completed on 2022-07-11 17:32:51
sql/update.sql
@@ -15,12 +15,14 @@ alter table device @@ -15,12 +15,14 @@ alter table device
15 15
16 alter table stream_push 16 alter table stream_push
17 add serverId varchar(50) not null; 17 add serverId varchar(50) not null;
  18 +
18 alter table device 19 alter table device
19 add geoCoordSys varchar(50) not null; 20 add geoCoordSys varchar(50) not null;
20 alter table device 21 alter table device
21 add treeType varchar(50) not null; 22 add treeType varchar(50) not null;
22 update device set device.geoCoordSys='WGS84'; 23 update device set device.geoCoordSys='WGS84';
23 update device set device.treeType='CivilCode'; 24 update device set device.treeType='CivilCode';
  25 +
24 alter table device_channel 26 alter table device_channel
25 add longitudeGcj02 double default null; 27 add longitudeGcj02 double default null;
26 alter table device_channel 28 alter table device_channel
@@ -31,4 +33,49 @@ alter table device_channel @@ -31,4 +33,49 @@ alter table device_channel
31 add latitudeWgs84 double default null; 33 add latitudeWgs84 double default null;
32 alter table device_channel 34 alter table device_channel
33 add businessGroupId varchar(50) default null; 35 add businessGroupId varchar(50) default null;
  36 +alter table device_channel
  37 + add gpsTime varchar(50) default null;
  38 +
  39 +
  40 +alter table device_mobile_position
  41 + change cnLng longitudeGcj02 double default null;
  42 +alter table device_mobile_position
  43 + change cnLat latitudeGcj02 double default null;
  44 +alter table device_mobile_position
  45 + add longitudeWgs84 double default null;
  46 +alter table device_mobile_position
  47 + add latitudeWgs84 double default null;
  48 +alter table device_mobile_position
  49 + drop geodeticSystem;
  50 +alter table device_mobile_position
  51 + add createTime varchar(50) default null;
  52 +
  53 +alter table device_alarm
  54 + add createTime varchar(50) default null;
  55 +
  56 +alter table gb_stream
  57 + change createStamp createTime varchar(50) default null;
  58 +
  59 +alter table parent_platform
  60 + add createTime varchar(50) default null;
  61 +alter table parent_platform
  62 + add updateTime varchar(50) default null;
  63 +
  64 +alter table stream_proxy
  65 + add updateTime varchar(50) default null;
  66 +
  67 +alter table stream_push
  68 + add pushTime varchar(50) default null;
  69 +alter table stream_push
  70 + add status int DEFAULT NULL;
  71 +alter table stream_push
  72 + add updateTime varchar(50) default null;
  73 +alter table stream_push
  74 + change createStamp createTime varchar(50) default null;
  75 +
  76 +alter table gb_stream
  77 + drop column status;
  78 +
  79 +alter table user
  80 + add pushKey varchar(50) default null;
34 81
src/main/java/com/genersoft/iot/vmp/common/StreamInfo.java
@@ -9,6 +9,9 @@ public class StreamInfo { @@ -9,6 +9,9 @@ public class StreamInfo {
9 private String deviceID; 9 private String deviceID;
10 private String channelId; 10 private String channelId;
11 private String flv; 11 private String flv;
  12 +
  13 + private String ip;
  14 +
12 private String https_flv; 15 private String https_flv;
13 private String ws_flv; 16 private String ws_flv;
14 private String wss_flv; 17 private String wss_flv;
@@ -292,4 +295,12 @@ public class StreamInfo { @@ -292,4 +295,12 @@ public class StreamInfo {
292 public void setProgress(double progress) { 295 public void setProgress(double progress) {
293 this.progress = progress; 296 this.progress = progress;
294 } 297 }
  298 +
  299 + public String getIp() {
  300 + return ip;
  301 + }
  302 +
  303 + public void setIp(String ip) {
  304 + this.ip = ip;
  305 + }
295 } 306 }
src/main/java/com/genersoft/iot/vmp/common/VideoManagerConstants.java
@@ -58,6 +58,8 @@ public class VideoManagerConstants { @@ -58,6 +58,8 @@ public class VideoManagerConstants {
58 58
59 public static final String MEDIA_TRANSACTION_USED_PREFIX = "VMP_MEDIA_TRANSACTION_"; 59 public static final String MEDIA_TRANSACTION_USED_PREFIX = "VMP_MEDIA_TRANSACTION_";
60 60
  61 + public static final String MEDIA_STREAM_AUTHORITY = "MEDIA_STREAM_AUTHORITY_";
  62 +
61 public static final String SIP_CSEQ_PREFIX = "VMP_SIP_CSEQ_"; 63 public static final String SIP_CSEQ_PREFIX = "VMP_SIP_CSEQ_";
62 64
63 public static final String SIP_SN_PREFIX = "VMP_SIP_SN_"; 65 public static final String SIP_SN_PREFIX = "VMP_SIP_SN_";
@@ -71,6 +73,8 @@ public class VideoManagerConstants { @@ -71,6 +73,8 @@ public class VideoManagerConstants {
71 public static final String SYSTEM_INFO_NET_PREFIX = "VMP_SYSTEM_INFO_NET_"; 73 public static final String SYSTEM_INFO_NET_PREFIX = "VMP_SYSTEM_INFO_NET_";
72 74
73 75
  76 +
  77 +
74 //************************** redis 消息********************************* 78 //************************** redis 消息*********************************
75 79
76 // 流变化的通知 80 // 流变化的通知
@@ -79,9 +83,15 @@ public class VideoManagerConstants { @@ -79,9 +83,15 @@ public class VideoManagerConstants {
79 // 接收推流设备的GPS变化通知 83 // 接收推流设备的GPS变化通知
80 public static final String VM_MSG_GPS = "VM_MSG_GPS"; 84 public static final String VM_MSG_GPS = "VM_MSG_GPS";
81 85
  86 + // 接收推流设备的GPS变化通知
  87 + public static final String VM_MSG_PUSH_STREAM_STATUS_CHANGE = "VM_MSG_PUSH_STREAM_STATUS_CHANGE";
  88 +
82 // redis 消息通知设备推流到平台 89 // redis 消息通知设备推流到平台
83 public static final String VM_MSG_STREAM_PUSH_REQUESTED = "VM_MSG_STREAM_PUSH_REQUESTED"; 90 public static final String VM_MSG_STREAM_PUSH_REQUESTED = "VM_MSG_STREAM_PUSH_REQUESTED";
84 91
  92 + // redis 消息请求所有的在线通道
  93 + public static final String VM_MSG_GET_ALL_ONLINE_REQUESTED = "VM_MSG_GET_ALL_ONLINE_REQUESTED";
  94 +
85 // 移动位置订阅通知 95 // 移动位置订阅通知
86 public static final String VM_MSG_SUBSCRIBE_MOBILE_POSITION = "mobileposition"; 96 public static final String VM_MSG_SUBSCRIBE_MOBILE_POSITION = "mobileposition";
87 97
src/main/java/com/genersoft/iot/vmp/conf/DynamicTask.java
@@ -5,6 +5,7 @@ import org.slf4j.Logger; @@ -5,6 +5,7 @@ import org.slf4j.Logger;
5 import org.slf4j.LoggerFactory; 5 import org.slf4j.LoggerFactory;
6 import org.springframework.beans.factory.annotation.Autowired; 6 import org.springframework.beans.factory.annotation.Autowired;
7 import org.springframework.context.annotation.Bean; 7 import org.springframework.context.annotation.Bean;
  8 +import org.springframework.scheduling.annotation.Scheduled;
8 import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler; 9 import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler;
9 import org.springframework.stereotype.Component; 10 import org.springframework.stereotype.Component;
10 11
@@ -103,12 +104,9 @@ public class DynamicTask { @@ -103,12 +104,9 @@ public class DynamicTask {
103 104
104 public void stop(String key) { 105 public void stop(String key) {
105 if (futureMap.get(key) != null && !futureMap.get(key).isCancelled()) { 106 if (futureMap.get(key) != null && !futureMap.get(key).isCancelled()) {
106 -// Runnable runnable = runnableMap.get(key);  
107 -// if (runnable instanceof ISubscribeTask) {  
108 -// ISubscribeTask subscribeTask = (ISubscribeTask) runnable;  
109 -// subscribeTask.stop();  
110 -// }  
111 futureMap.get(key).cancel(false); 107 futureMap.get(key).cancel(false);
  108 + futureMap.remove(key);
  109 + runnableMap.remove(key);
112 } 110 }
113 } 111 }
114 112
@@ -123,4 +121,19 @@ public class DynamicTask { @@ -123,4 +121,19 @@ public class DynamicTask {
123 public Runnable get(String key) { 121 public Runnable get(String key) {
124 return runnableMap.get(key); 122 return runnableMap.get(key);
125 } 123 }
  124 +
  125 + /**
  126 + * 每五分钟检查失效的任务,并移除
  127 + */
  128 + @Scheduled(cron="0 0/5 * * * ?")
  129 + public void execute(){
  130 + if (futureMap.size() > 0) {
  131 + for (String key : futureMap.keySet()) {
  132 + if (futureMap.get(key).isDone()) {
  133 + futureMap.remove(key);
  134 + runnableMap.remove(key);
  135 + }
  136 + }
  137 + }
  138 + }
126 } 139 }
src/main/java/com/genersoft/iot/vmp/gb28181/bean/DeviceAlarm.java
@@ -77,6 +77,8 @@ public class DeviceAlarm { @@ -77,6 +77,8 @@ public class DeviceAlarm {
77 */ 77 */
78 private String alarmType; 78 private String alarmType;
79 79
  80 + private String createTime;
  81 +
80 82
81 public String getId() { 83 public String getId() {
82 return id; 84 return id;
@@ -157,4 +159,12 @@ public class DeviceAlarm { @@ -157,4 +159,12 @@ public class DeviceAlarm {
157 public void setChannelId(String channelId) { 159 public void setChannelId(String channelId) {
158 this.channelId = channelId; 160 this.channelId = channelId;
159 } 161 }
  162 +
  163 + public String getCreateTime() {
  164 + return createTime;
  165 + }
  166 +
  167 + public void setCreateTime(String createTime) {
  168 + this.createTime = createTime;
  169 + }
160 } 170 }
src/main/java/com/genersoft/iot/vmp/gb28181/bean/DeviceChannel.java
@@ -199,6 +199,11 @@ public class DeviceChannel { @@ -199,6 +199,11 @@ public class DeviceChannel {
199 */ 199 */
200 private String businessGroupId; 200 private String businessGroupId;
201 201
  202 + /**
  203 + * GPS的更新时间
  204 + */
  205 + private String gpsTime;
  206 +
202 public int getId() { 207 public int getId() {
203 return id; 208 return id;
204 } 209 }
@@ -519,4 +524,12 @@ public class DeviceChannel { @@ -519,4 +524,12 @@ public class DeviceChannel {
519 public void setBusinessGroupId(String businessGroupId) { 524 public void setBusinessGroupId(String businessGroupId) {
520 this.businessGroupId = businessGroupId; 525 this.businessGroupId = businessGroupId;
521 } 526 }
  527 +
  528 + public String getGpsTime() {
  529 + return gpsTime;
  530 + }
  531 +
  532 + public void setGpsTime(String gpsTime) {
  533 + this.gpsTime = gpsTime;
  534 + }
522 } 535 }
src/main/java/com/genersoft/iot/vmp/gb28181/bean/GbStream.java
@@ -15,10 +15,8 @@ public class GbStream extends PlatformGbStream{ @@ -15,10 +15,8 @@ public class GbStream extends PlatformGbStream{
15 private double latitude; 15 private double latitude;
16 private String streamType; 16 private String streamType;
17 private boolean status; 17 private boolean status;
18 - /**  
19 - * GMT unix系统时间戳,单位秒  
20 - */  
21 - public Long createStamp; 18 +
  19 + public String createTime;
22 20
23 @Override 21 @Override
24 public Integer getGbStreamId() { 22 public Integer getGbStreamId() {
@@ -102,12 +100,11 @@ public class GbStream extends PlatformGbStream{ @@ -102,12 +100,11 @@ public class GbStream extends PlatformGbStream{
102 this.mediaServerId = mediaServerId; 100 this.mediaServerId = mediaServerId;
103 } 101 }
104 102
105 -  
106 - public Long getCreateStamp() {  
107 - return createStamp; 103 + public String getCreateTime() {
  104 + return createTime;
108 } 105 }
109 106
110 - public void setCreateStamp(Long createStamp) {  
111 - this.createStamp = createStamp; 107 + public void setCreateTime(String createTime) {
  108 + this.createTime = createTime;
112 } 109 }
113 } 110 }
src/main/java/com/genersoft/iot/vmp/gb28181/bean/MobilePosition.java
@@ -58,19 +58,29 @@ public class MobilePosition { @@ -58,19 +58,29 @@ public class MobilePosition {
58 private String reportSource; 58 private String reportSource;
59 59
60 /** 60 /**
61 - * 国内地理坐标系(GCJ-02 / BD-09) 61 + * 国内坐标系:经度坐标
  62 + */
  63 + private double longitudeGcj02;
  64 +
  65 + /**
  66 + * 国内坐标系:纬度坐标
62 */ 67 */
63 - private String GeodeticSystem; 68 + private double latitudeGcj02;
64 69
65 /** 70 /**
66 * 国内坐标系:经度坐标 71 * 国内坐标系:经度坐标
67 */ 72 */
68 - private String cnLng; 73 + private double longitudeWgs84;
69 74
70 /** 75 /**
71 * 国内坐标系:纬度坐标 76 * 国内坐标系:纬度坐标
72 */ 77 */
73 - private String cnLat; 78 + private double latitudeWgs84;
  79 +
  80 + /**
  81 + * 创建时间
  82 + */
  83 + private String createTime;
74 84
75 85
76 public String getDeviceId() { 86 public String getDeviceId() {
@@ -145,35 +155,51 @@ public class MobilePosition { @@ -145,35 +155,51 @@ public class MobilePosition {
145 this.reportSource = reportSource; 155 this.reportSource = reportSource;
146 } 156 }
147 157
148 - public String getGeodeticSystem() {  
149 - return GeodeticSystem; 158 + public String getChannelId() {
  159 + return channelId;
  160 + }
  161 +
  162 + public void setChannelId(String channelId) {
  163 + this.channelId = channelId;
150 } 164 }
151 165
152 - public void setGeodeticSystem(String geodeticSystem) {  
153 - GeodeticSystem = geodeticSystem; 166 + public double getLongitudeGcj02() {
  167 + return longitudeGcj02;
154 } 168 }
155 169
156 - public String getCnLng() {  
157 - return cnLng; 170 + public void setLongitudeGcj02(double longitudeGcj02) {
  171 + this.longitudeGcj02 = longitudeGcj02;
158 } 172 }
159 173
160 - public void setCnLng(String cnLng) {  
161 - this.cnLng = cnLng; 174 + public double getLatitudeGcj02() {
  175 + return latitudeGcj02;
162 } 176 }
163 177
164 - public String getCnLat() {  
165 - return cnLat; 178 + public void setLatitudeGcj02(double latitudeGcj02) {
  179 + this.latitudeGcj02 = latitudeGcj02;
166 } 180 }
167 181
168 - public void setCnLat(String cnLat) {  
169 - this.cnLat = cnLat; 182 + public double getLongitudeWgs84() {
  183 + return longitudeWgs84;
170 } 184 }
171 185
172 - public String getChannelId() {  
173 - return channelId; 186 + public void setLongitudeWgs84(double longitudeWgs84) {
  187 + this.longitudeWgs84 = longitudeWgs84;
174 } 188 }
175 189
176 - public void setChannelId(String channelId) {  
177 - this.channelId = channelId; 190 + public double getLatitudeWgs84() {
  191 + return latitudeWgs84;
  192 + }
  193 +
  194 + public void setLatitudeWgs84(double latitudeWgs84) {
  195 + this.latitudeWgs84 = latitudeWgs84;
  196 + }
  197 +
  198 + public String getCreateTime() {
  199 + return createTime;
  200 + }
  201 +
  202 + public void setCreateTime(String createTime) {
  203 + this.createTime = createTime;
178 } 204 }
179 } 205 }
src/main/java/com/genersoft/iot/vmp/gb28181/bean/ParentPlatform.java
@@ -144,6 +144,16 @@ public class ParentPlatform { @@ -144,6 +144,16 @@ public class ParentPlatform {
144 */ 144 */
145 private String administrativeDivision; 145 private String administrativeDivision;
146 146
  147 + /**
  148 + * 更新时间
  149 + */
  150 + private String updateTime;
  151 +
  152 + /**
  153 + * 创建时间
  154 + */
  155 + private String createTime;
  156 +
147 public Integer getId() { 157 public Integer getId() {
148 return id; 158 return id;
149 } 159 }
@@ -368,4 +378,20 @@ public class ParentPlatform { @@ -368,4 +378,20 @@ public class ParentPlatform {
368 public void setAdministrativeDivision(String administrativeDivision) { 378 public void setAdministrativeDivision(String administrativeDivision) {
369 this.administrativeDivision = administrativeDivision; 379 this.administrativeDivision = administrativeDivision;
370 } 380 }
  381 +
  382 + public String getUpdateTime() {
  383 + return updateTime;
  384 + }
  385 +
  386 + public void setUpdateTime(String updateTime) {
  387 + this.updateTime = updateTime;
  388 + }
  389 +
  390 + public String getCreateTime() {
  391 + return createTime;
  392 + }
  393 +
  394 + public void setCreateTime(String createTime) {
  395 + this.createTime = createTime;
  396 + }
371 } 397 }
src/main/java/com/genersoft/iot/vmp/domain/req/PresetQuerySipReq.java renamed to src/main/java/com/genersoft/iot/vmp/gb28181/bean/PresetQuerySipReq.java
1 -package com.genersoft.iot.vmp.domain.req; 1 +package com.genersoft.iot.vmp.gb28181.bean;
2 2
3 3
4 /** 4 /**
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/NotifyRequestProcessor.java
@@ -140,6 +140,7 @@ public class NotifyRequestProcessor extends SIPRequestProcessorParent implements @@ -140,6 +140,7 @@ public class NotifyRequestProcessor extends SIPRequestProcessorParent implements
140 Element rootElement = getRootElement(evt); 140 Element rootElement = getRootElement(evt);
141 141
142 MobilePosition mobilePosition = new MobilePosition(); 142 MobilePosition mobilePosition = new MobilePosition();
  143 + mobilePosition.setCreateTime(DateUtil.getNow());
143 Element deviceIdElement = rootElement.element("DeviceID"); 144 Element deviceIdElement = rootElement.element("DeviceID");
144 String channelId = deviceIdElement.getTextTrim().toString(); 145 String channelId = deviceIdElement.getTextTrim().toString();
145 Device device = redisCatchStorage.getDevice(deviceId); 146 Device device = redisCatchStorage.getDevice(deviceId);
@@ -173,16 +174,40 @@ public class NotifyRequestProcessor extends SIPRequestProcessorParent implements @@ -173,16 +174,40 @@ public class NotifyRequestProcessor extends SIPRequestProcessorParent implements
173 mobilePosition.getLongitude(), mobilePosition.getLatitude()); 174 mobilePosition.getLongitude(), mobilePosition.getLatitude());
174 mobilePosition.setReportSource("Mobile Position"); 175 mobilePosition.setReportSource("Mobile Position");
175 // 默认来源坐标系为WGS-84处理 176 // 默认来源坐标系为WGS-84处理
176 - Double[] gcj02Point = Coordtransform.WGS84ToGCJ02(mobilePosition.getLongitude(), mobilePosition.getLatitude());  
177 - logger.info("GCJ02坐标:" + gcj02Point[0] + ", " + gcj02Point[1]);  
178 - mobilePosition.setGeodeticSystem("GCJ-02");  
179 - mobilePosition.setCnLng(gcj02Point[0] + "");  
180 - mobilePosition.setCnLat(gcj02Point[1] + "");  
181 - if (!userSetting.getSavePositionHistory()) {  
182 - storager.clearMobilePositionsByDeviceId(deviceId); 177 + if ("WGS84".equals(device.getGeoCoordSys())) {
  178 + mobilePosition.setLongitudeWgs84(mobilePosition.getLongitude());
  179 + mobilePosition.setLatitudeWgs84(mobilePosition.getLatitude());
  180 + Double[] position = Coordtransform.WGS84ToGCJ02(mobilePosition.getLongitude(), mobilePosition.getLatitude());
  181 + mobilePosition.setLongitudeGcj02(position[0]);
  182 + mobilePosition.setLatitudeGcj02(position[1]);
  183 + }else if ("GCJ02".equals(device.getGeoCoordSys())) {
  184 + mobilePosition.setLongitudeGcj02(mobilePosition.getLongitude());
  185 + mobilePosition.setLatitudeGcj02(mobilePosition.getLatitude());
  186 + Double[] position = Coordtransform.GCJ02ToWGS84(mobilePosition.getLongitude(), mobilePosition.getLatitude());
  187 + mobilePosition.setLongitudeWgs84(position[0]);
  188 + mobilePosition.setLatitudeWgs84(position[1]);
  189 + }else {
  190 + mobilePosition.setLongitudeGcj02(0.00);
  191 + mobilePosition.setLatitudeGcj02(0.00);
  192 + mobilePosition.setLongitudeWgs84(0.00);
  193 + mobilePosition.setLatitudeWgs84(0.00);
183 } 194 }
184 - storager.insertMobilePosition(mobilePosition);  
185 - storager.updateChannelPotion(deviceId, channelId, mobilePosition.getLongitude(), mobilePosition.getLatitude() ); 195 + if (userSetting.getSavePositionHistory()) {
  196 + storager.insertMobilePosition(mobilePosition);
  197 + }
  198 +
  199 + // 更新device channel 的经纬度
  200 + DeviceChannel deviceChannel = new DeviceChannel();
  201 + deviceChannel.setDeviceId(device.getDeviceId());
  202 + deviceChannel.setChannelId(channelId);
  203 + deviceChannel.setLongitude(mobilePosition.getLongitude());
  204 + deviceChannel.setLatitude(mobilePosition.getLatitude());
  205 + deviceChannel.setLongitudeWgs84(mobilePosition.getLongitudeWgs84());
  206 + deviceChannel.setLatitudeWgs84(mobilePosition.getLatitudeWgs84());
  207 + deviceChannel.setLongitudeGcj02(mobilePosition.getLongitudeGcj02());
  208 + deviceChannel.setLatitudeGcj02(mobilePosition.getLatitudeGcj02());
  209 + deviceChannel.setGpsTime(mobilePosition.getTime());
  210 + storager.updateChannelPosition(deviceChannel);
186 // 发送redis消息。 通知位置信息的变化 211 // 发送redis消息。 通知位置信息的变化
187 JSONObject jsonObject = new JSONObject(); 212 JSONObject jsonObject = new JSONObject();
188 jsonObject.put("time", time); 213 jsonObject.put("time", time);
@@ -209,9 +234,12 @@ public class NotifyRequestProcessor extends SIPRequestProcessorParent implements @@ -209,9 +234,12 @@ public class NotifyRequestProcessor extends SIPRequestProcessorParent implements
209 return; 234 return;
210 } 235 }
211 try { 236 try {
  237 + FromHeader fromHeader = (FromHeader) evt.getRequest().getHeader(FromHeader.NAME);
  238 + String deviceId = SipUtils.getUserIdFromFromHeader(fromHeader);
  239 +
212 Element rootElement = getRootElement(evt); 240 Element rootElement = getRootElement(evt);
213 Element deviceIdElement = rootElement.element("DeviceID"); 241 Element deviceIdElement = rootElement.element("DeviceID");
214 - String deviceId = deviceIdElement.getText().toString(); 242 + String channelId = deviceIdElement.getText().toString();
215 243
216 Device device = redisCatchStorage.getDevice(deviceId); 244 Device device = redisCatchStorage.getDevice(deviceId);
217 if (device == null) { 245 if (device == null) {
@@ -247,21 +275,45 @@ public class NotifyRequestProcessor extends SIPRequestProcessorParent implements @@ -247,21 +275,45 @@ public class NotifyRequestProcessor extends SIPRequestProcessorParent implements
247 logger.info("[收到Notify-Alarm]:{}/{}", device.getDeviceId(), deviceAlarm.getChannelId()); 275 logger.info("[收到Notify-Alarm]:{}/{}", device.getDeviceId(), deviceAlarm.getChannelId());
248 if ("4".equals(deviceAlarm.getAlarmMethod())) { 276 if ("4".equals(deviceAlarm.getAlarmMethod())) {
249 MobilePosition mobilePosition = new MobilePosition(); 277 MobilePosition mobilePosition = new MobilePosition();
  278 + mobilePosition.setCreateTime(DateUtil.getNow());
250 mobilePosition.setDeviceId(deviceAlarm.getDeviceId()); 279 mobilePosition.setDeviceId(deviceAlarm.getDeviceId());
251 mobilePosition.setTime(deviceAlarm.getAlarmTime()); 280 mobilePosition.setTime(deviceAlarm.getAlarmTime());
252 mobilePosition.setLongitude(deviceAlarm.getLongitude()); 281 mobilePosition.setLongitude(deviceAlarm.getLongitude());
253 mobilePosition.setLatitude(deviceAlarm.getLatitude()); 282 mobilePosition.setLatitude(deviceAlarm.getLatitude());
254 mobilePosition.setReportSource("GPS Alarm"); 283 mobilePosition.setReportSource("GPS Alarm");
255 - // 默认来源坐标系为WGS-84处理  
256 - Double[] gcj02Point = Coordtransform.WGS84ToGCJ02(mobilePosition.getLongitude(), mobilePosition.getLatitude());  
257 - logger.info("GCJ02坐标:" + gcj02Point[0] + ", " + gcj02Point[1]);  
258 - mobilePosition.setGeodeticSystem("GCJ-02");  
259 - mobilePosition.setCnLng(gcj02Point[0] + "");  
260 - mobilePosition.setCnLat(gcj02Point[1] + "");  
261 - if (!userSetting.getSavePositionHistory()) {  
262 - storager.clearMobilePositionsByDeviceId(deviceId); 284 + if ("WGS84".equals(device.getGeoCoordSys())) {
  285 + mobilePosition.setLongitudeWgs84(mobilePosition.getLongitude());
  286 + mobilePosition.setLatitudeWgs84(mobilePosition.getLatitude());
  287 + Double[] position = Coordtransform.WGS84ToGCJ02(mobilePosition.getLongitude(), mobilePosition.getLatitude());
  288 + mobilePosition.setLongitudeGcj02(position[0]);
  289 + mobilePosition.setLatitudeGcj02(position[1]);
  290 + }else if ("GCJ02".equals(device.getGeoCoordSys())) {
  291 + mobilePosition.setLongitudeGcj02(mobilePosition.getLongitude());
  292 + mobilePosition.setLatitudeGcj02(mobilePosition.getLatitude());
  293 + Double[] position = Coordtransform.GCJ02ToWGS84(mobilePosition.getLongitude(), mobilePosition.getLatitude());
  294 + mobilePosition.setLongitudeWgs84(position[0]);
  295 + mobilePosition.setLatitudeWgs84(position[1]);
  296 + }else {
  297 + mobilePosition.setLongitudeGcj02(0.00);
  298 + mobilePosition.setLatitudeGcj02(0.00);
  299 + mobilePosition.setLongitudeWgs84(0.00);
  300 + mobilePosition.setLatitudeWgs84(0.00);
263 } 301 }
264 - storager.insertMobilePosition(mobilePosition); 302 + if (userSetting.getSavePositionHistory()) {
  303 + storager.insertMobilePosition(mobilePosition);
  304 + }
  305 + // 更新device channel 的经纬度
  306 + DeviceChannel deviceChannel = new DeviceChannel();
  307 + deviceChannel.setDeviceId(device.getDeviceId());
  308 + deviceChannel.setChannelId(channelId);
  309 + deviceChannel.setLongitude(mobilePosition.getLongitude());
  310 + deviceChannel.setLatitude(mobilePosition.getLatitude());
  311 + deviceChannel.setLongitudeWgs84(mobilePosition.getLongitudeWgs84());
  312 + deviceChannel.setLatitudeWgs84(mobilePosition.getLatitudeWgs84());
  313 + deviceChannel.setLongitudeGcj02(mobilePosition.getLongitudeGcj02());
  314 + deviceChannel.setLatitudeGcj02(mobilePosition.getLatitudeGcj02());
  315 + deviceChannel.setGpsTime(mobilePosition.getTime());
  316 + storager.updateChannelPosition(deviceChannel);
265 } 317 }
266 // TODO: 需要实现存储报警信息、报警分类 318 // TODO: 需要实现存储报警信息、报警分类
267 319
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/notify/cmd/AlarmNotifyMessageHandler.java
@@ -80,8 +80,8 @@ public class AlarmNotifyMessageHandler extends SIPRequestProcessorParent impleme @@ -80,8 +80,8 @@ public class AlarmNotifyMessageHandler extends SIPRequestProcessorParent impleme
80 Element deviceIdElement = rootElement.element("DeviceID"); 80 Element deviceIdElement = rootElement.element("DeviceID");
81 String channelId = deviceIdElement.getText().toString(); 81 String channelId = deviceIdElement.getText().toString();
82 82
83 -  
84 DeviceAlarm deviceAlarm = new DeviceAlarm(); 83 DeviceAlarm deviceAlarm = new DeviceAlarm();
  84 + deviceAlarm.setCreateTime(DateUtil.getNow());
85 deviceAlarm.setDeviceId(device.getDeviceId()); 85 deviceAlarm.setDeviceId(device.getDeviceId());
86 deviceAlarm.setChannelId(channelId); 86 deviceAlarm.setChannelId(channelId);
87 deviceAlarm.setAlarmPriority(getText(rootElement, "AlarmPriority")); 87 deviceAlarm.setAlarmPriority(getText(rootElement, "AlarmPriority"));
@@ -113,21 +113,45 @@ public class AlarmNotifyMessageHandler extends SIPRequestProcessorParent impleme @@ -113,21 +113,45 @@ public class AlarmNotifyMessageHandler extends SIPRequestProcessorParent impleme
113 if (!StringUtils.isEmpty(deviceAlarm.getAlarmMethod())) { 113 if (!StringUtils.isEmpty(deviceAlarm.getAlarmMethod())) {
114 if ( deviceAlarm.getAlarmMethod().contains(DeviceAlarmMethod.GPS.getVal() + "")) { 114 if ( deviceAlarm.getAlarmMethod().contains(DeviceAlarmMethod.GPS.getVal() + "")) {
115 MobilePosition mobilePosition = new MobilePosition(); 115 MobilePosition mobilePosition = new MobilePosition();
  116 + mobilePosition.setCreateTime(DateUtil.getNow());
116 mobilePosition.setDeviceId(deviceAlarm.getDeviceId()); 117 mobilePosition.setDeviceId(deviceAlarm.getDeviceId());
117 mobilePosition.setTime(deviceAlarm.getAlarmTime()); 118 mobilePosition.setTime(deviceAlarm.getAlarmTime());
118 mobilePosition.setLongitude(deviceAlarm.getLongitude()); 119 mobilePosition.setLongitude(deviceAlarm.getLongitude());
119 mobilePosition.setLatitude(deviceAlarm.getLatitude()); 120 mobilePosition.setLatitude(deviceAlarm.getLatitude());
120 mobilePosition.setReportSource("GPS Alarm"); 121 mobilePosition.setReportSource("GPS Alarm");
121 - // 默认来源坐标系为WGS-84处理  
122 - Double[] gcj02Point = Coordtransform.WGS84ToGCJ02(mobilePosition.getLongitude(), mobilePosition.getLatitude());  
123 - logger.info("GCJ02坐标:" + gcj02Point[0] + ", " + gcj02Point[1]);  
124 - mobilePosition.setGeodeticSystem("GCJ-02");  
125 - mobilePosition.setCnLng(gcj02Point[0] + "");  
126 - mobilePosition.setCnLat(gcj02Point[1] + "");  
127 - if (!userSetting.getSavePositionHistory()) {  
128 - storager.clearMobilePositionsByDeviceId(device.getDeviceId()); 122 + if ("WGS84".equals(device.getGeoCoordSys())) {
  123 + mobilePosition.setLongitudeWgs84(mobilePosition.getLongitude());
  124 + mobilePosition.setLatitudeWgs84(mobilePosition.getLatitude());
  125 + Double[] position = Coordtransform.WGS84ToGCJ02(mobilePosition.getLongitude(), mobilePosition.getLatitude());
  126 + mobilePosition.setLongitudeGcj02(position[0]);
  127 + mobilePosition.setLatitudeGcj02(position[1]);
  128 + }else if ("GCJ02".equals(device.getGeoCoordSys())) {
  129 + mobilePosition.setLongitudeGcj02(mobilePosition.getLongitude());
  130 + mobilePosition.setLatitudeGcj02(mobilePosition.getLatitude());
  131 + Double[] position = Coordtransform.GCJ02ToWGS84(mobilePosition.getLongitude(), mobilePosition.getLatitude());
  132 + mobilePosition.setLongitudeWgs84(position[0]);
  133 + mobilePosition.setLatitudeWgs84(position[1]);
  134 + }else {
  135 + mobilePosition.setLongitudeGcj02(0.00);
  136 + mobilePosition.setLatitudeGcj02(0.00);
  137 + mobilePosition.setLongitudeWgs84(0.00);
  138 + mobilePosition.setLatitudeWgs84(0.00);
  139 + }
  140 + if (userSetting.getSavePositionHistory()) {
  141 + storager.insertMobilePosition(mobilePosition);
129 } 142 }
130 - storager.insertMobilePosition(mobilePosition); 143 + // 更新device channel 的经纬度
  144 + DeviceChannel deviceChannel = new DeviceChannel();
  145 + deviceChannel.setDeviceId(device.getDeviceId());
  146 + deviceChannel.setChannelId(channelId);
  147 + deviceChannel.setLongitude(mobilePosition.getLongitude());
  148 + deviceChannel.setLatitude(mobilePosition.getLatitude());
  149 + deviceChannel.setLongitudeWgs84(mobilePosition.getLongitudeWgs84());
  150 + deviceChannel.setLatitudeWgs84(mobilePosition.getLatitudeWgs84());
  151 + deviceChannel.setLongitudeGcj02(mobilePosition.getLongitudeGcj02());
  152 + deviceChannel.setLatitudeGcj02(mobilePosition.getLatitudeGcj02());
  153 + deviceChannel.setGpsTime(mobilePosition.getTime());
  154 + storager.updateChannelPosition(deviceChannel);
131 } 155 }
132 } 156 }
133 if (!StringUtils.isEmpty(deviceAlarm.getDeviceId())) { 157 if (!StringUtils.isEmpty(deviceAlarm.getDeviceId())) {
@@ -177,6 +201,7 @@ public class AlarmNotifyMessageHandler extends SIPRequestProcessorParent impleme @@ -177,6 +201,7 @@ public class AlarmNotifyMessageHandler extends SIPRequestProcessorParent impleme
177 201
178 202
179 DeviceAlarm deviceAlarm = new DeviceAlarm(); 203 DeviceAlarm deviceAlarm = new DeviceAlarm();
  204 + deviceAlarm.setCreateTime(DateUtil.getNow());
180 deviceAlarm.setDeviceId(parentPlatform.getServerGBId()); 205 deviceAlarm.setDeviceId(parentPlatform.getServerGBId());
181 deviceAlarm.setChannelId(channelId); 206 deviceAlarm.setChannelId(channelId);
182 deviceAlarm.setAlarmPriority(getText(rootElement, "AlarmPriority")); 207 deviceAlarm.setAlarmPriority(getText(rootElement, "AlarmPriority"));
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/notify/cmd/MobilePositionNotifyMessageHandler.java
1 package com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.notify.cmd; 1 package com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.notify.cmd;
2 2
3 import com.genersoft.iot.vmp.conf.UserSetting; 3 import com.genersoft.iot.vmp.conf.UserSetting;
4 -import com.genersoft.iot.vmp.gb28181.bean.BaiduPoint;  
5 -import com.genersoft.iot.vmp.gb28181.bean.Device;  
6 -import com.genersoft.iot.vmp.gb28181.bean.MobilePosition;  
7 -import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform; 4 +import com.genersoft.iot.vmp.gb28181.bean.*;
8 import com.genersoft.iot.vmp.gb28181.transmit.event.request.SIPRequestProcessorParent; 5 import com.genersoft.iot.vmp.gb28181.transmit.event.request.SIPRequestProcessorParent;
9 import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.IMessageHandler; 6 import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.IMessageHandler;
10 import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.notify.NotifyMessageHandler; 7 import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.notify.NotifyMessageHandler;
11 import com.genersoft.iot.vmp.gb28181.utils.Coordtransform; 8 import com.genersoft.iot.vmp.gb28181.utils.Coordtransform;
12 import com.genersoft.iot.vmp.gb28181.utils.NumericUtil; 9 import com.genersoft.iot.vmp.gb28181.utils.NumericUtil;
13 import com.genersoft.iot.vmp.storager.IVideoManagerStorage; 10 import com.genersoft.iot.vmp.storager.IVideoManagerStorage;
  11 +import com.genersoft.iot.vmp.utils.DateUtil;
14 import com.genersoft.iot.vmp.utils.GpsUtil; 12 import com.genersoft.iot.vmp.utils.GpsUtil;
15 import org.dom4j.DocumentException; 13 import org.dom4j.DocumentException;
16 import org.dom4j.Element; 14 import org.dom4j.Element;
@@ -56,6 +54,7 @@ public class MobilePositionNotifyMessageHandler extends SIPRequestProcessorParen @@ -56,6 +54,7 @@ public class MobilePositionNotifyMessageHandler extends SIPRequestProcessorParen
56 rootElement = getRootElement(evt, device.getCharset()); 54 rootElement = getRootElement(evt, device.getCharset());
57 55
58 MobilePosition mobilePosition = new MobilePosition(); 56 MobilePosition mobilePosition = new MobilePosition();
  57 + mobilePosition.setCreateTime(DateUtil.getNow());
59 if (!StringUtils.isEmpty(device.getName())) { 58 if (!StringUtils.isEmpty(device.getName())) {
60 mobilePosition.setDeviceName(device.getName()); 59 mobilePosition.setDeviceName(device.getName());
61 } 60 }
@@ -80,16 +79,39 @@ public class MobilePositionNotifyMessageHandler extends SIPRequestProcessorParen @@ -80,16 +79,39 @@ public class MobilePositionNotifyMessageHandler extends SIPRequestProcessorParen
80 mobilePosition.setAltitude(0.0); 79 mobilePosition.setAltitude(0.0);
81 } 80 }
82 mobilePosition.setReportSource("Mobile Position"); 81 mobilePosition.setReportSource("Mobile Position");
83 - // 默认来源坐标系为WGS-84处理  
84 - Double[] gcj02Point = Coordtransform.WGS84ToGCJ02(mobilePosition.getLongitude(), mobilePosition.getLatitude());  
85 - logger.info("GCJ02坐标:" + gcj02Point[0] + ", " + gcj02Point[1]);  
86 - mobilePosition.setGeodeticSystem("GCJ-02");  
87 - mobilePosition.setCnLng(gcj02Point[0] + "");  
88 - mobilePosition.setCnLat(gcj02Point[1] + "");  
89 - if (!userSetting.getSavePositionHistory()) {  
90 - storager.clearMobilePositionsByDeviceId(device.getDeviceId()); 82 + if ("WGS84".equals(device.getGeoCoordSys())) {
  83 + mobilePosition.setLongitudeWgs84(mobilePosition.getLongitude());
  84 + mobilePosition.setLatitudeWgs84(mobilePosition.getLatitude());
  85 + Double[] position = Coordtransform.WGS84ToGCJ02(mobilePosition.getLongitude(), mobilePosition.getLatitude());
  86 + mobilePosition.setLongitudeGcj02(position[0]);
  87 + mobilePosition.setLatitudeGcj02(position[1]);
  88 + }else if ("GCJ02".equals(device.getGeoCoordSys())) {
  89 + mobilePosition.setLongitudeGcj02(mobilePosition.getLongitude());
  90 + mobilePosition.setLatitudeGcj02(mobilePosition.getLatitude());
  91 + Double[] position = Coordtransform.GCJ02ToWGS84(mobilePosition.getLongitude(), mobilePosition.getLatitude());
  92 + mobilePosition.setLongitudeWgs84(position[0]);
  93 + mobilePosition.setLatitudeWgs84(position[1]);
  94 + }else {
  95 + mobilePosition.setLongitudeGcj02(0.00);
  96 + mobilePosition.setLatitudeGcj02(0.00);
  97 + mobilePosition.setLongitudeWgs84(0.00);
  98 + mobilePosition.setLatitudeWgs84(0.00);
91 } 99 }
92 - storager.insertMobilePosition(mobilePosition); 100 + if (userSetting.getSavePositionHistory()) {
  101 + storager.insertMobilePosition(mobilePosition);
  102 + }
  103 + // 更新device channel 的经纬度
  104 + DeviceChannel deviceChannel = new DeviceChannel();
  105 + deviceChannel.setDeviceId(device.getDeviceId());
  106 + deviceChannel.setChannelId(mobilePosition.getChannelId());
  107 + deviceChannel.setLongitude(mobilePosition.getLongitude());
  108 + deviceChannel.setLatitude(mobilePosition.getLatitude());
  109 + deviceChannel.setLongitudeWgs84(mobilePosition.getLongitudeWgs84());
  110 + deviceChannel.setLatitudeWgs84(mobilePosition.getLatitudeWgs84());
  111 + deviceChannel.setLongitudeGcj02(mobilePosition.getLongitudeGcj02());
  112 + deviceChannel.setLatitudeGcj02(mobilePosition.getLatitudeGcj02());
  113 + deviceChannel.setGpsTime(mobilePosition.getTime());
  114 + storager.updateChannelPosition(deviceChannel);
93 //回复 200 OK 115 //回复 200 OK
94 responseAck(evt, Response.OK); 116 responseAck(evt, Response.OK);
95 } catch (DocumentException | SipException | InvalidArgumentException | ParseException e) { 117 } catch (DocumentException | SipException | InvalidArgumentException | ParseException e) {
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/response/cmd/CatalogResponseMessageHandler.java
@@ -171,71 +171,6 @@ public class CatalogResponseMessageHandler extends SIPRequestProcessorParent imp @@ -171,71 +171,6 @@ public class CatalogResponseMessageHandler extends SIPRequestProcessorParent imp
171 171
172 } 172 }
173 173
174 - /**  
175 - * 处理设备位置的更新  
176 - *  
177 - * @param evt, itemDevice  
178 - */  
179 - private void processNotifyMobilePosition(RequestEvent evt, Element itemDevice) {  
180 - try {  
181 - // 回复 200 OK  
182 - Element rootElement = getRootElement(evt);  
183 - MobilePosition mobilePosition = new MobilePosition();  
184 - Element deviceIdElement = rootElement.element("DeviceID");  
185 - String deviceId = deviceIdElement.getTextTrim().toString();  
186 - Device device = redisCatchStorage.getDevice(deviceId);  
187 - if (device != null) {  
188 - if (!StringUtils.isEmpty(device.getName())) {  
189 - mobilePosition.setDeviceName(device.getName());  
190 - }  
191 - }  
192 - mobilePosition.setDeviceId(XmlUtil.getText(rootElement, "DeviceID"));  
193 -  
194 - String time = XmlUtil.getText(itemDevice, "Time");  
195 - if(time==null){  
196 - time = XmlUtil.getText(itemDevice, "EndTime");  
197 - }  
198 - mobilePosition.setTime(time);  
199 - String longitude = XmlUtil.getText(itemDevice, "Longitude");  
200 - if(longitude!=null) {  
201 - mobilePosition.setLongitude(Double.parseDouble(longitude));  
202 - }  
203 - String latitude = XmlUtil.getText(itemDevice, "Latitude");  
204 - if(latitude!=null) {  
205 - mobilePosition.setLatitude(Double.parseDouble(latitude));  
206 - }  
207 - if (NumericUtil.isDouble(XmlUtil.getText(itemDevice, "Speed"))) {  
208 - mobilePosition.setSpeed(Double.parseDouble(XmlUtil.getText(itemDevice, "Speed")));  
209 - } else {  
210 - mobilePosition.setSpeed(0.0);  
211 - }  
212 - if (NumericUtil.isDouble(XmlUtil.getText(itemDevice, "Direction"))) {  
213 - mobilePosition.setDirection(Double.parseDouble(XmlUtil.getText(itemDevice, "Direction")));  
214 - } else {  
215 - mobilePosition.setDirection(0.0);  
216 - }  
217 - if (NumericUtil.isDouble(XmlUtil.getText(itemDevice, "Altitude"))) {  
218 - mobilePosition.setAltitude(Double.parseDouble(XmlUtil.getText(itemDevice, "Altitude")));  
219 - } else {  
220 - mobilePosition.setAltitude(0.0);  
221 - }  
222 - mobilePosition.setReportSource("Mobile Position");  
223 - // 默认来源坐标系为WGS-84处理  
224 - Double[] gcj02Point = Coordtransform.WGS84ToGCJ02(mobilePosition.getLongitude(), mobilePosition.getLatitude());  
225 - logger.info("GCJ02坐标:" + gcj02Point[0] + ", " + gcj02Point[1]);  
226 - mobilePosition.setGeodeticSystem("GCJ-02");  
227 - mobilePosition.setCnLng(gcj02Point[0] + "");  
228 - mobilePosition.setCnLat(gcj02Point[1] + "");  
229 - if (!userSetting.getSavePositionHistory()) {  
230 - storager.clearMobilePositionsByDeviceId(deviceId);  
231 - }  
232 - storager.insertMobilePosition(mobilePosition);  
233 - responseAck(evt, Response.OK);  
234 - } catch (DocumentException | SipException | InvalidArgumentException | ParseException e) {  
235 - e.printStackTrace();  
236 - }  
237 - }  
238 -  
239 public SyncStatus getChannelSyncProgress(String deviceId) { 174 public SyncStatus getChannelSyncProgress(String deviceId) {
240 if (catalogDataCatch.get(deviceId) == null) { 175 if (catalogDataCatch.get(deviceId) == null) {
241 return null; 176 return null;
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/response/cmd/MobilePositionResponseMessageHandler.java
1 package com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.response.cmd; 1 package com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.response.cmd;
2 2
3 import com.genersoft.iot.vmp.conf.UserSetting; 3 import com.genersoft.iot.vmp.conf.UserSetting;
4 -import com.genersoft.iot.vmp.gb28181.bean.BaiduPoint;  
5 -import com.genersoft.iot.vmp.gb28181.bean.Device;  
6 -import com.genersoft.iot.vmp.gb28181.bean.MobilePosition;  
7 -import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform; 4 +import com.genersoft.iot.vmp.gb28181.bean.*;
8 import com.genersoft.iot.vmp.gb28181.transmit.event.request.SIPRequestProcessorParent; 5 import com.genersoft.iot.vmp.gb28181.transmit.event.request.SIPRequestProcessorParent;
9 import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.IMessageHandler; 6 import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.IMessageHandler;
10 import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.response.ResponseMessageHandler; 7 import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.response.ResponseMessageHandler;
11 import com.genersoft.iot.vmp.gb28181.utils.Coordtransform; 8 import com.genersoft.iot.vmp.gb28181.utils.Coordtransform;
12 import com.genersoft.iot.vmp.gb28181.utils.NumericUtil; 9 import com.genersoft.iot.vmp.gb28181.utils.NumericUtil;
13 import com.genersoft.iot.vmp.storager.IVideoManagerStorage; 10 import com.genersoft.iot.vmp.storager.IVideoManagerStorage;
  11 +import com.genersoft.iot.vmp.utils.DateUtil;
14 import com.genersoft.iot.vmp.utils.GpsUtil; 12 import com.genersoft.iot.vmp.utils.GpsUtil;
15 import org.dom4j.DocumentException; 13 import org.dom4j.DocumentException;
16 import org.dom4j.Element; 14 import org.dom4j.Element;
@@ -56,6 +54,7 @@ public class MobilePositionResponseMessageHandler extends SIPRequestProcessorPar @@ -56,6 +54,7 @@ public class MobilePositionResponseMessageHandler extends SIPRequestProcessorPar
56 rootElement = getRootElement(evt, device.getCharset()); 54 rootElement = getRootElement(evt, device.getCharset());
57 55
58 MobilePosition mobilePosition = new MobilePosition(); 56 MobilePosition mobilePosition = new MobilePosition();
  57 + mobilePosition.setCreateTime(DateUtil.getNow());
59 if (!StringUtils.isEmpty(device.getName())) { 58 if (!StringUtils.isEmpty(device.getName())) {
60 mobilePosition.setDeviceName(device.getName()); 59 mobilePosition.setDeviceName(device.getName());
61 } 60 }
@@ -80,16 +79,39 @@ public class MobilePositionResponseMessageHandler extends SIPRequestProcessorPar @@ -80,16 +79,39 @@ public class MobilePositionResponseMessageHandler extends SIPRequestProcessorPar
80 mobilePosition.setAltitude(0.0); 79 mobilePosition.setAltitude(0.0);
81 } 80 }
82 mobilePosition.setReportSource("Mobile Position"); 81 mobilePosition.setReportSource("Mobile Position");
83 - // 默认来源坐标系为WGS-84处理  
84 - Double[] gcj02Point = Coordtransform.WGS84ToGCJ02(mobilePosition.getLongitude(), mobilePosition.getLatitude());  
85 - logger.info("GCJ02坐标:" + gcj02Point[0] + ", " + gcj02Point[1]);  
86 - mobilePosition.setGeodeticSystem("GCJ-02");  
87 - mobilePosition.setCnLng(gcj02Point[0] + "");  
88 - mobilePosition.setCnLat(gcj02Point[1] + "");  
89 - if (!userSetting.getSavePositionHistory()) {  
90 - storager.clearMobilePositionsByDeviceId(device.getDeviceId()); 82 + if ("WGS84".equals(device.getGeoCoordSys())) {
  83 + mobilePosition.setLongitudeWgs84(mobilePosition.getLongitude());
  84 + mobilePosition.setLatitudeWgs84(mobilePosition.getLatitude());
  85 + Double[] position = Coordtransform.WGS84ToGCJ02(mobilePosition.getLongitude(), mobilePosition.getLatitude());
  86 + mobilePosition.setLongitudeGcj02(position[0]);
  87 + mobilePosition.setLatitudeGcj02(position[1]);
  88 + }else if ("GCJ02".equals(device.getGeoCoordSys())) {
  89 + mobilePosition.setLongitudeGcj02(mobilePosition.getLongitude());
  90 + mobilePosition.setLatitudeGcj02(mobilePosition.getLatitude());
  91 + Double[] position = Coordtransform.GCJ02ToWGS84(mobilePosition.getLongitude(), mobilePosition.getLatitude());
  92 + mobilePosition.setLongitudeWgs84(position[0]);
  93 + mobilePosition.setLatitudeWgs84(position[1]);
  94 + }else {
  95 + mobilePosition.setLongitudeGcj02(0.00);
  96 + mobilePosition.setLatitudeGcj02(0.00);
  97 + mobilePosition.setLongitudeWgs84(0.00);
  98 + mobilePosition.setLatitudeWgs84(0.00);
91 } 99 }
92 - storager.insertMobilePosition(mobilePosition); 100 + if (userSetting.getSavePositionHistory()) {
  101 + storager.insertMobilePosition(mobilePosition);
  102 + }
  103 + // 更新device channel 的经纬度
  104 + DeviceChannel deviceChannel = new DeviceChannel();
  105 + deviceChannel.setDeviceId(device.getDeviceId());
  106 + deviceChannel.setChannelId(mobilePosition.getChannelId());
  107 + deviceChannel.setLongitude(mobilePosition.getLongitude());
  108 + deviceChannel.setLatitude(mobilePosition.getLatitude());
  109 + deviceChannel.setLongitudeWgs84(mobilePosition.getLongitudeWgs84());
  110 + deviceChannel.setLatitudeWgs84(mobilePosition.getLatitudeWgs84());
  111 + deviceChannel.setLongitudeGcj02(mobilePosition.getLongitudeGcj02());
  112 + deviceChannel.setLatitudeGcj02(mobilePosition.getLatitudeGcj02());
  113 + deviceChannel.setGpsTime(mobilePosition.getTime());
  114 + storager.updateChannelPosition(deviceChannel);
93 //回复 200 OK 115 //回复 200 OK
94 responseAck(evt, Response.OK); 116 responseAck(evt, Response.OK);
95 } catch (DocumentException | SipException | InvalidArgumentException | ParseException e) { 117 } catch (DocumentException | SipException | InvalidArgumentException | ParseException e) {
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/response/cmd/PresetQueryResponseMessageHandler.java
1 package com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.response.cmd; 1 package com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.response.cmd;
2 2
3 -import com.genersoft.iot.vmp.domain.req.PresetQuerySipReq; 3 +import com.genersoft.iot.vmp.gb28181.bean.PresetQuerySipReq;
4 import com.genersoft.iot.vmp.gb28181.bean.*; 4 import com.genersoft.iot.vmp.gb28181.bean.*;
5 import com.genersoft.iot.vmp.gb28181.transmit.callback.DeferredResultHolder; 5 import com.genersoft.iot.vmp.gb28181.transmit.callback.DeferredResultHolder;
6 import com.genersoft.iot.vmp.gb28181.transmit.callback.RequestMessage; 6 import com.genersoft.iot.vmp.gb28181.transmit.callback.RequestMessage;
src/main/java/com/genersoft/iot/vmp/gb28181/utils/XmlUtil.java
@@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONArray; @@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONArray;
4 import com.alibaba.fastjson.JSONObject; 4 import com.alibaba.fastjson.JSONObject;
5 import com.genersoft.iot.vmp.gb28181.bean.Device; 5 import com.genersoft.iot.vmp.gb28181.bean.Device;
6 import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel; 6 import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel;
  7 +import com.genersoft.iot.vmp.utils.DateUtil;
7 import org.dom4j.Attribute; 8 import org.dom4j.Attribute;
8 import org.dom4j.Document; 9 import org.dom4j.Document;
9 import org.dom4j.DocumentException; 10 import org.dom4j.DocumentException;
@@ -314,6 +315,7 @@ public class XmlUtil { @@ -314,6 +315,7 @@ public class XmlUtil {
314 } else { 315 } else {
315 deviceChannel.setLatitude(0.00); 316 deviceChannel.setLatitude(0.00);
316 } 317 }
  318 + deviceChannel.setGpsTime(DateUtil.getNow());
317 if (deviceChannel.getLongitude()*deviceChannel.getLatitude() > 0) { 319 if (deviceChannel.getLongitude()*deviceChannel.getLatitude() > 0) {
318 if ("WGS84".equals(device.getGeoCoordSys())) { 320 if ("WGS84".equals(device.getGeoCoordSys())) {
319 deviceChannel.setLongitudeWgs84(deviceChannel.getLongitude()); 321 deviceChannel.setLongitudeWgs84(deviceChannel.getLongitude());
src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMHttpHookListener.java
1 package com.genersoft.iot.vmp.media.zlm; 1 package com.genersoft.iot.vmp.media.zlm;
2 2
3 -import java.util.ArrayList; 3 +import java.util.HashMap;
4 import java.util.List; 4 import java.util.List;
  5 +import java.util.Map;
5 6
6 import com.alibaba.fastjson.JSON; 7 import com.alibaba.fastjson.JSON;
7 import com.genersoft.iot.vmp.common.StreamInfo; 8 import com.genersoft.iot.vmp.common.StreamInfo;
@@ -21,6 +22,7 @@ import org.slf4j.LoggerFactory; @@ -21,6 +22,7 @@ import org.slf4j.LoggerFactory;
21 import org.springframework.beans.factory.annotation.Autowired; 22 import org.springframework.beans.factory.annotation.Autowired;
22 import org.springframework.http.HttpStatus; 23 import org.springframework.http.HttpStatus;
23 import org.springframework.http.ResponseEntity; 24 import org.springframework.http.ResponseEntity;
  25 +import org.springframework.util.StringUtils;
24 import org.springframework.web.bind.annotation.PostMapping; 26 import org.springframework.web.bind.annotation.PostMapping;
25 import org.springframework.web.bind.annotation.RequestBody; 27 import org.springframework.web.bind.annotation.RequestBody;
26 import org.springframework.web.bind.annotation.RequestMapping; 28 import org.springframework.web.bind.annotation.RequestMapping;
@@ -80,6 +82,9 @@ public class ZLMHttpHookListener { @@ -80,6 +82,9 @@ public class ZLMHttpHookListener {
80 private UserSetting userSetting; 82 private UserSetting userSetting;
81 83
82 @Autowired 84 @Autowired
  85 + private IUserService userService;
  86 +
  87 + @Autowired
83 private VideoStreamSessionManager sessionManager; 88 private VideoStreamSessionManager sessionManager;
84 89
85 /** 90 /**
@@ -151,12 +156,14 @@ public class ZLMHttpHookListener { @@ -151,12 +156,14 @@ public class ZLMHttpHookListener {
151 */ 156 */
152 @ResponseBody 157 @ResponseBody
153 @PostMapping(value = "/on_play", produces = "application/json;charset=UTF-8") 158 @PostMapping(value = "/on_play", produces = "application/json;charset=UTF-8")
154 - public ResponseEntity<String> onPlay(@RequestBody JSONObject json){  
155 - 159 + public ResponseEntity<String> onPlay(@RequestBody OnPlayHookParam param){
  160 +
  161 + JSONObject json = (JSONObject)JSON.toJSON(param);
  162 +
156 if (logger.isDebugEnabled()) { 163 if (logger.isDebugEnabled()) {
157 - logger.debug("[ ZLM HOOK ]on_play API调用,参数:" + json.toString()); 164 + logger.debug("[ ZLM HOOK ]on_play API调用,参数:" + JSON.toJSONString(param));
158 } 165 }
159 - String mediaServerId = json.getString("mediaServerId"); 166 + String mediaServerId = param.getMediaServerId();
160 ZLMHttpHookSubscribe.Event subscribe = this.subscribe.getSubscribe(ZLMHttpHookSubscribe.HookType.on_play, json); 167 ZLMHttpHookSubscribe.Event subscribe = this.subscribe.getSubscribe(ZLMHttpHookSubscribe.HookType.on_play, json);
161 if (subscribe != null ) { 168 if (subscribe != null ) {
162 MediaServerItem mediaInfo = mediaServerService.getOne(mediaServerId); 169 MediaServerItem mediaInfo = mediaServerService.getOne(mediaServerId);
@@ -165,9 +172,20 @@ public class ZLMHttpHookListener { @@ -165,9 +172,20 @@ public class ZLMHttpHookListener {
165 } 172 }
166 } 173 }
167 JSONObject ret = new JSONObject(); 174 JSONObject ret = new JSONObject();
  175 + if (!"rtp".equals(param.getApp())) {
  176 + Map<String, String> paramMap = urlParamToMap(param.getParams());
  177 + StreamAuthorityInfo streamAuthorityInfo = redisCatchStorage.getStreamAuthorityInfo(param.getApp(), param.getStream());
  178 + if (streamAuthorityInfo == null
  179 + || (streamAuthorityInfo.getCallId() != null && !streamAuthorityInfo.getCallId().equals(paramMap.get("callId")))) {
  180 + ret.put("code", 401);
  181 + ret.put("msg", "Unauthorized");
  182 + return new ResponseEntity<>(ret.toString(),HttpStatus.OK);
  183 + }
  184 + }
  185 +
168 ret.put("code", 0); 186 ret.put("code", 0);
169 ret.put("msg", "success"); 187 ret.put("msg", "success");
170 - return new ResponseEntity<String>(ret.toString(),HttpStatus.OK); 188 + return new ResponseEntity<>(ret.toString(),HttpStatus.OK);
171 } 189 }
172 190
173 /** 191 /**
@@ -176,16 +194,49 @@ public class ZLMHttpHookListener { @@ -176,16 +194,49 @@ public class ZLMHttpHookListener {
176 */ 194 */
177 @ResponseBody 195 @ResponseBody
178 @PostMapping(value = "/on_publish", produces = "application/json;charset=UTF-8") 196 @PostMapping(value = "/on_publish", produces = "application/json;charset=UTF-8")
179 - public ResponseEntity<String> onPublish(@RequestBody JSONObject json) { 197 + public ResponseEntity<String> onPublish(@RequestBody OnPublishHookParam param) {
  198 +
  199 + JSONObject json = (JSONObject) JSON.toJSON(param);
180 200
181 logger.info("[ ZLM HOOK ]on_publish API调用,参数:" + json.toString()); 201 logger.info("[ ZLM HOOK ]on_publish API调用,参数:" + json.toString());
182 JSONObject ret = new JSONObject(); 202 JSONObject ret = new JSONObject();
  203 + if (!"rtp".equals(param.getApp())) {
  204 + // 推流鉴权
  205 + if (param.getParams() == null) {
  206 + logger.info("推流鉴权失败: 缺少不要参数:sign=md5(user表的pushKey)");
  207 + ret.put("code", 401);
  208 + ret.put("msg", "Unauthorized");
  209 + return new ResponseEntity<>(ret.toString(), HttpStatus.OK);
  210 + }
  211 + Map<String, String> paramMap = urlParamToMap(param.getParams());
  212 + String sign = paramMap.get("sign");
  213 + if (sign == null) {
  214 + logger.info("推流鉴权失败: 缺少不要参数:sign=md5(user表的pushKey)");
  215 + ret.put("code", 401);
  216 + ret.put("msg", "Unauthorized");
  217 + return new ResponseEntity<>(ret.toString(), HttpStatus.OK);
  218 + }
  219 + // 推流自定义播放鉴权码
  220 + String callId = paramMap.get("callId");
  221 + // 鉴权配置
  222 + boolean hasAuthority = userService.checkPushAuthority(callId, sign);
  223 + if (!hasAuthority) {
  224 + logger.info("推流鉴权失败: sign 无权限: callId={}. sign={}", callId, sign);
  225 + ret.put("code", 401);
  226 + ret.put("msg", "Unauthorized");
  227 + return new ResponseEntity<>(ret.toString(), HttpStatus.OK);
  228 + }
  229 + StreamAuthorityInfo streamAuthorityInfo = StreamAuthorityInfo.getInstanceByHook(param);
  230 + streamAuthorityInfo.setCallId(callId);
  231 + streamAuthorityInfo.setSign(sign);
  232 + // 鉴权通过
  233 + redisCatchStorage.updateStreamAuthorityInfo(param.getApp(), param.getStream(), streamAuthorityInfo);
  234 + }
  235 +
183 ret.put("code", 0); 236 ret.put("code", 0);
184 ret.put("msg", "success"); 237 ret.put("msg", "success");
185 ret.put("enable_hls", true); 238 ret.put("enable_hls", true);
186 - if (json.getInteger("originType") == 1  
187 - || json.getInteger("originType") == 2  
188 - || json.getInteger("originType") == 3) { 239 + if (!"rtp".equals(param.getApp())) {
189 ret.put("enable_audio", true); 240 ret.put("enable_audio", true);
190 } 241 }
191 242
@@ -200,14 +251,13 @@ public class ZLMHttpHookListener { @@ -200,14 +251,13 @@ public class ZLMHttpHookListener {
200 ret.put("msg", "zlm not register"); 251 ret.put("msg", "zlm not register");
201 } 252 }
202 } 253 }
203 - String app = json.getString("app");  
204 - String stream = json.getString("stream");  
205 - if ("rtp".equals(app)) { 254 +
  255 + if ("rtp".equals(param.getApp())) {
206 ret.put("enable_mp4", userSetting.getRecordSip()); 256 ret.put("enable_mp4", userSetting.getRecordSip());
207 }else { 257 }else {
208 ret.put("enable_mp4", userSetting.isRecordPushLive()); 258 ret.put("enable_mp4", userSetting.isRecordPushLive());
209 } 259 }
210 - List<SsrcTransaction> ssrcTransactionForAll = sessionManager.getSsrcTransactionForAll(null, null, null, stream); 260 + List<SsrcTransaction> ssrcTransactionForAll = sessionManager.getSsrcTransactionForAll(null, null, null, param.getStream());
211 if (ssrcTransactionForAll != null && ssrcTransactionForAll.size() == 1) { 261 if (ssrcTransactionForAll != null && ssrcTransactionForAll.size() == 1) {
212 String deviceId = ssrcTransactionForAll.get(0).getDeviceId(); 262 String deviceId = ssrcTransactionForAll.get(0).getDeviceId();
213 String channelId = ssrcTransactionForAll.get(0).getChannelId(); 263 String channelId = ssrcTransactionForAll.get(0).getChannelId();
@@ -221,13 +271,14 @@ public class ZLMHttpHookListener { @@ -221,13 +271,14 @@ public class ZLMHttpHookListener {
221 ret.put("enable_mp4", true); 271 ret.put("enable_mp4", true);
222 ret.put("enable_audio", true); 272 ret.put("enable_audio", true);
223 } 273 }
224 -  
225 } 274 }
226 275
227 276
228 return new ResponseEntity<String>(ret.toString(), HttpStatus.OK); 277 return new ResponseEntity<String>(ret.toString(), HttpStatus.OK);
229 } 278 }
230 - 279 +
  280 +
  281 +
231 /** 282 /**
232 * 录制mp4完成后通知事件;此事件对回复不敏感。 283 * 录制mp4完成后通知事件;此事件对回复不敏感。
233 * 284 *
@@ -312,9 +363,6 @@ public class ZLMHttpHookListener { @@ -312,9 +363,6 @@ public class ZLMHttpHookListener {
312 if (logger.isDebugEnabled()) { 363 if (logger.isDebugEnabled()) {
313 logger.debug("[ ZLM HOOK ]on_shell_login API调用,参数:" + json.toString()); 364 logger.debug("[ ZLM HOOK ]on_shell_login API调用,参数:" + json.toString());
314 } 365 }
315 - // TODO 如果是带有rtpstream则开启按需拉流  
316 - // String app = json.getString("app");  
317 - // String stream = json.getString("stream");  
318 String mediaServerId = json.getString("mediaServerId"); 366 String mediaServerId = json.getString("mediaServerId");
319 ZLMHttpHookSubscribe.Event subscribe = this.subscribe.getSubscribe(ZLMHttpHookSubscribe.HookType.on_shell_login, json); 367 ZLMHttpHookSubscribe.Event subscribe = this.subscribe.getSubscribe(ZLMHttpHookSubscribe.HookType.on_shell_login, json);
320 if (subscribe != null ) { 368 if (subscribe != null ) {
@@ -351,12 +399,24 @@ public class ZLMHttpHookListener { @@ -351,12 +399,24 @@ public class ZLMHttpHookListener {
351 } 399 }
352 // 流消失移除redis play 400 // 流消失移除redis play
353 String app = item.getApp(); 401 String app = item.getApp();
354 - String streamId = item.getStream(); 402 + String stream = item.getStream();
355 String schema = item.getSchema(); 403 String schema = item.getSchema();
356 List<MediaItem.MediaTrack> tracks = item.getTracks(); 404 List<MediaItem.MediaTrack> tracks = item.getTracks();
357 boolean regist = item.isRegist(); 405 boolean regist = item.isRegist();
  406 + if (regist) {
  407 + StreamAuthorityInfo streamAuthorityInfo = redisCatchStorage.getStreamAuthorityInfo(app, stream);
  408 + if (streamAuthorityInfo == null) {
  409 + streamAuthorityInfo = StreamAuthorityInfo.getInstanceByHook(item);
  410 + }else {
  411 + streamAuthorityInfo.setOriginType(item.getOriginType());
  412 + streamAuthorityInfo.setOriginTypeStr(item.getOriginTypeStr());
  413 + }
  414 + redisCatchStorage.updateStreamAuthorityInfo(app, stream, streamAuthorityInfo);
  415 + }else {
  416 + redisCatchStorage.removeStreamAuthorityInfo(app, stream);
  417 + }
358 if ("rtmp".equals(schema)){ 418 if ("rtmp".equals(schema)){
359 - logger.info("on_stream_changed:注册->{}, app->{}, stream->{}", regist, app, streamId); 419 + logger.info("on_stream_changed:注册->{}, app->{}, stream->{}", regist, app, stream);
360 if (regist) { 420 if (regist) {
361 mediaServerService.addCount(mediaServerId); 421 mediaServerService.addCount(mediaServerId);
362 }else { 422 }else {
@@ -365,15 +425,15 @@ public class ZLMHttpHookListener { @@ -365,15 +425,15 @@ public class ZLMHttpHookListener {
365 if (item.getOriginType() == OriginType.PULL.ordinal() 425 if (item.getOriginType() == OriginType.PULL.ordinal()
366 || item.getOriginType() == OriginType.FFMPEG_PULL.ordinal()) { 426 || item.getOriginType() == OriginType.FFMPEG_PULL.ordinal()) {
367 // 设置拉流代理上线/离线 427 // 设置拉流代理上线/离线
368 - streamProxyService.updateStatus(regist, app, streamId); 428 + streamProxyService.updateStatus(regist, app, stream);
369 } 429 }
370 if ("rtp".equals(app) && !regist ) { 430 if ("rtp".equals(app) && !regist ) {
371 - StreamInfo streamInfo = redisCatchStorage.queryPlayByStreamId(streamId); 431 + StreamInfo streamInfo = redisCatchStorage.queryPlayByStreamId(stream);
372 if (streamInfo!=null){ 432 if (streamInfo!=null){
373 redisCatchStorage.stopPlay(streamInfo); 433 redisCatchStorage.stopPlay(streamInfo);
374 storager.stopPlay(streamInfo.getDeviceID(), streamInfo.getChannelId()); 434 storager.stopPlay(streamInfo.getDeviceID(), streamInfo.getChannelId());
375 }else{ 435 }else{
376 - streamInfo = redisCatchStorage.queryPlayback(null, null, streamId, null); 436 + streamInfo = redisCatchStorage.queryPlayback(null, null, stream, null);
377 if (streamInfo != null) { 437 if (streamInfo != null) {
378 redisCatchStorage.stopPlayback(streamInfo.getDeviceID(), streamInfo.getChannelId(), 438 redisCatchStorage.stopPlayback(streamInfo.getDeviceID(), streamInfo.getChannelId(),
379 streamInfo.getStream(), null); 439 streamInfo.getStream(), null);
@@ -387,11 +447,12 @@ public class ZLMHttpHookListener { @@ -387,11 +447,12 @@ public class ZLMHttpHookListener {
387 447
388 if (mediaServerItem != null){ 448 if (mediaServerItem != null){
389 if (regist) { 449 if (regist) {
390 - StreamPushItem streamPushItem = null;  
391 - StreamInfo streamInfoByAppAndStream = mediaService.getStreamInfoByAppAndStream(mediaServerItem, app, streamId, tracks); 450 + StreamAuthorityInfo streamAuthorityInfo = redisCatchStorage.getStreamAuthorityInfo(app, stream);
  451 + StreamInfo streamInfoByAppAndStream = mediaService.getStreamInfoByAppAndStream(mediaServerItem,
  452 + app, stream, tracks, streamAuthorityInfo.getCallId());
392 item.setStreamInfo(streamInfoByAppAndStream); 453 item.setStreamInfo(streamInfoByAppAndStream);
393 454
394 - redisCatchStorage.addStream(mediaServerItem, type, app, streamId, item); 455 + redisCatchStorage.addStream(mediaServerItem, type, app, stream, item);
395 if (item.getOriginType() == OriginType.RTSP_PUSH.ordinal() 456 if (item.getOriginType() == OriginType.RTSP_PUSH.ordinal()
396 || item.getOriginType() == OriginType.RTMP_PUSH.ordinal() 457 || item.getOriginType() == OriginType.RTMP_PUSH.ordinal()
397 || item.getOriginType() == OriginType.RTC_PUSH.ordinal() ) { 458 || item.getOriginType() == OriginType.RTC_PUSH.ordinal() ) {
@@ -414,23 +475,23 @@ public class ZLMHttpHookListener { @@ -414,23 +475,23 @@ public class ZLMHttpHookListener {
414 475
415 }else { 476 }else {
416 // 兼容流注销时类型从redis记录获取 477 // 兼容流注销时类型从redis记录获取
417 - MediaItem mediaItem = redisCatchStorage.getStreamInfo(app, streamId, mediaServerId); 478 + MediaItem mediaItem = redisCatchStorage.getStreamInfo(app, stream, mediaServerId);
418 if (mediaItem != null) { 479 if (mediaItem != null) {
419 type = OriginType.values()[mediaItem.getOriginType()].getType(); 480 type = OriginType.values()[mediaItem.getOriginType()].getType();
420 - redisCatchStorage.removeStream(mediaServerItem.getId(), type, app, streamId); 481 + redisCatchStorage.removeStream(mediaServerItem.getId(), type, app, stream);
421 } 482 }
422 - GbStream gbStream = storager.getGbStream(app, streamId); 483 + GbStream gbStream = storager.getGbStream(app, stream);
423 if (gbStream != null) { 484 if (gbStream != null) {
424 // eventPublisher.catalogEventPublishForStream(null, gbStream, CatalogEvent.OFF); 485 // eventPublisher.catalogEventPublishForStream(null, gbStream, CatalogEvent.OFF);
425 } 486 }
426 - zlmMediaListManager.removeMedia(app, streamId); 487 + zlmMediaListManager.removeMedia(app, stream);
427 } 488 }
428 if (type != null) { 489 if (type != null) {
429 // 发送流变化redis消息 490 // 发送流变化redis消息
430 JSONObject jsonObject = new JSONObject(); 491 JSONObject jsonObject = new JSONObject();
431 jsonObject.put("serverId", userSetting.getServerId()); 492 jsonObject.put("serverId", userSetting.getServerId());
432 jsonObject.put("app", app); 493 jsonObject.put("app", app);
433 - jsonObject.put("stream", streamId); 494 + jsonObject.put("stream", stream);
434 jsonObject.put("register", regist); 495 jsonObject.put("register", regist);
435 jsonObject.put("mediaServerId", mediaServerId); 496 jsonObject.put("mediaServerId", mediaServerId);
436 redisCatchStorage.sendStreamChangeMsg(type, jsonObject); 497 redisCatchStorage.sendStreamChangeMsg(type, jsonObject);
@@ -453,10 +514,8 @@ public class ZLMHttpHookListener { @@ -453,10 +514,8 @@ public class ZLMHttpHookListener {
453 @ResponseBody 514 @ResponseBody
454 @PostMapping(value = "/on_stream_none_reader", produces = "application/json;charset=UTF-8") 515 @PostMapping(value = "/on_stream_none_reader", produces = "application/json;charset=UTF-8")
455 public ResponseEntity<String> onStreamNoneReader(@RequestBody JSONObject json){ 516 public ResponseEntity<String> onStreamNoneReader(@RequestBody JSONObject json){
456 -  
457 - if (logger.isDebugEnabled()) {  
458 - logger.debug("[ ZLM HOOK ]on_stream_none_reader API调用,参数:" + json.toString());  
459 - } 517 +
  518 + logger.info("[ ZLM HOOK ]on_stream_none_reader API调用,参数:" + json.toString());
460 String mediaServerId = json.getString("mediaServerId"); 519 String mediaServerId = json.getString("mediaServerId");
461 String streamId = json.getString("stream"); 520 String streamId = json.getString("stream");
462 String app = json.getString("app"); 521 String app = json.getString("app");
@@ -568,4 +627,22 @@ public class ZLMHttpHookListener { @@ -568,4 +627,22 @@ public class ZLMHttpHookListener {
568 ret.put("msg", "success"); 627 ret.put("msg", "success");
569 return new ResponseEntity<String>(ret.toString(),HttpStatus.OK); 628 return new ResponseEntity<String>(ret.toString(),HttpStatus.OK);
570 } 629 }
  630 +
  631 + private Map<String, String> urlParamToMap(String params) {
  632 + HashMap<String, String> map = new HashMap<>();
  633 + if (StringUtils.isEmpty(params)) {
  634 + return map;
  635 + }
  636 + String[] paramsArray = params.split("&");
  637 + if (paramsArray.length == 0) {
  638 + return map;
  639 + }
  640 + for (String param : paramsArray) {
  641 + String[] paramArray = param.split("=");
  642 + if (paramArray.length == 2){
  643 + map.put(paramArray[0], paramArray[1]);
  644 + }
  645 + }
  646 + return map;
  647 + }
571 } 648 }
src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMMediaListManager.java
@@ -12,6 +12,7 @@ import com.genersoft.iot.vmp.storager.IVideoManagerStorage; @@ -12,6 +12,7 @@ import com.genersoft.iot.vmp.storager.IVideoManagerStorage;
12 import com.genersoft.iot.vmp.storager.dao.GbStreamMapper; 12 import com.genersoft.iot.vmp.storager.dao.GbStreamMapper;
13 import com.genersoft.iot.vmp.storager.dao.PlatformGbStreamMapper; 13 import com.genersoft.iot.vmp.storager.dao.PlatformGbStreamMapper;
14 import com.genersoft.iot.vmp.storager.dao.StreamPushMapper; 14 import com.genersoft.iot.vmp.storager.dao.StreamPushMapper;
  15 +import com.genersoft.iot.vmp.utils.DateUtil;
15 import org.checkerframework.checker.units.qual.C; 16 import org.checkerframework.checker.units.qual.C;
16 import org.slf4j.Logger; 17 import org.slf4j.Logger;
17 import org.slf4j.LoggerFactory; 18 import org.slf4j.LoggerFactory;
@@ -114,63 +115,42 @@ public class ZLMMediaListManager { @@ -114,63 +115,42 @@ public class ZLMMediaListManager {
114 public StreamPushItem addPush(MediaItem mediaItem) { 115 public StreamPushItem addPush(MediaItem mediaItem) {
115 // 查找此直播流是否存在redis预设gbId 116 // 查找此直播流是否存在redis预设gbId
116 StreamPushItem transform = streamPushService.transform(mediaItem); 117 StreamPushItem transform = streamPushService.transform(mediaItem);
117 - // 从streamId取出查询关键值  
118 - Pattern pattern = Pattern.compile(userSetting.getThirdPartyGBIdReg());  
119 - Matcher matcher = pattern.matcher(mediaItem.getStream());// 指定要匹配的字符串  
120 - String queryKey = null;  
121 - if (matcher.find()) { //此处find()每次被调用后,会偏移到下一个匹配  
122 - queryKey = matcher.group();  
123 - }  
124 - if (queryKey != null) {  
125 - ThirdPartyGB thirdPartyGB = redisCatchStorage.queryMemberNoGBId(queryKey);  
126 - if (thirdPartyGB != null && !StringUtils.isEmpty(thirdPartyGB.getNationalStandardNo())) {  
127 - transform.setGbId(thirdPartyGB.getNationalStandardNo());  
128 - transform.setName(thirdPartyGB.getName());  
129 - }  
130 - }  
131 - if (!StringUtils.isEmpty(transform.getGbId())) {  
132 - // 如果这个国标ID已经给了其他推流且流已离线,则移除其他推流  
133 - List<GbStream> gbStreams = gbStreamMapper.selectByGBId(transform.getGbId());  
134 - if (gbStreams.size() > 0) {  
135 - for (GbStream gbStream : gbStreams) {  
136 - // 出现使用相同国标Id的视频流时,使用新流替换旧流,  
137 - if (queryKey != null && gbStream.getApp().equals(mediaItem.getApp())) {  
138 - Matcher matcherForStream = pattern.matcher(gbStream.getStream());  
139 - String queryKeyForStream = null;  
140 - if (matcherForStream.find()) { //此处find()每次被调用后,会偏移到下一个匹配  
141 - queryKeyForStream = matcherForStream.group();  
142 - }  
143 - if (queryKeyForStream == null || !queryKeyForStream.equals(queryKey)) {  
144 - // 此时不是同一个流  
145 - gbStreamMapper.del(gbStream.getApp(), gbStream.getStream());  
146 - if (!gbStream.isStatus()) {  
147 - streamPushMapper.del(gbStream.getApp(), gbStream.getStream());  
148 - }  
149 - }  
150 - }  
151 - }  
152 - }  
153 - List<GbStream> gbStreamList = gbStreamMapper.selectByGBId(transform.getGbId());  
154 - if (gbStreamList != null && gbStreamList.size() == 1) {  
155 - transform.setGbStreamId(gbStreamList.get(0).getGbStreamId());  
156 - transform.setPlatformId(gbStreamList.get(0).getPlatformId());  
157 - transform.setCatalogId(gbStreamList.get(0).getCatalogId());  
158 - transform.setGbId(gbStreamList.get(0).getGbId());  
159 - gbStreamMapper.update(transform);  
160 - streamPushMapper.del(gbStreamList.get(0).getApp(), gbStreamList.get(0).getStream());  
161 - }else {  
162 - transform.setCreateStamp(System.currentTimeMillis());  
163 - gbStreamMapper.add(transform);  
164 - }  
165 - if (transform != null) {  
166 - if (channelOnlineEvents.get(transform.getGbId()) != null) {  
167 - channelOnlineEvents.get(transform.getGbId()).run(transform.getApp(), transform.getStream(), transform.getServerId());  
168 - channelOnlineEvents.remove(transform.getGbId());  
169 - }  
170 - } 118 + StreamPushItem pushInDb = streamPushService.getPush(mediaItem.getApp(), mediaItem.getStream());
  119 + transform.setUpdateTime(DateUtil.getNow());
  120 + transform.setPushTime(DateUtil.getNow());
  121 + if (pushInDb == null) {
  122 + transform.setCreateTime(DateUtil.getNow());
  123 + streamPushMapper.add(transform);
  124 + }else {
  125 + streamPushMapper.update(transform);
  126 +
  127 +
  128 +// if (!StringUtils.isEmpty(pushInDb.getGbId())) {
  129 +// List<GbStream> gbStreamList = gbStreamMapper.selectByGBId(transform.getGbId());
  130 +// if (gbStreamList != null && gbStreamList.size() == 1) {
  131 +// transform.setGbStreamId(gbStreamList.get(0).getGbStreamId());
  132 +// transform.setPlatformId(gbStreamList.get(0).getPlatformId());
  133 +// transform.setCatalogId(gbStreamList.get(0).getCatalogId());
  134 +// transform.setGbId(gbStreamList.get(0).getGbId());
  135 +// gbStreamMapper.update(transform);
  136 +// streamPushMapper.del(gbStreamList.get(0).getApp(), gbStreamList.get(0).getStream());
  137 +// }else {
  138 +// transform.setCreateTime(DateUtil.getNow());
  139 +// transform.setUpdateTime(DateUtil.getNow());
  140 +// gbStreamMapper.add(transform);
  141 +// }
  142 + // 通知通道上线
  143 +// if (transform != null) {
  144 +// if (channelOnlineEvents.get(transform.getGbId()) != null) {
  145 +// channelOnlineEvents.get(transform.getGbId()).run(transform.getApp(), transform.getStream(), transform.getServerId());
  146 +// channelOnlineEvents.remove(transform.getGbId());
  147 +// }
  148 +// }
  149 +// }
171 } 150 }
172 151
173 - storager.updateMedia(transform); 152 +
  153 +
174 return transform; 154 return transform;
175 } 155 }
176 156
@@ -204,13 +184,13 @@ public class ZLMMediaListManager { @@ -204,13 +184,13 @@ public class ZLMMediaListManager {
204 184
205 public int removeMedia(String app, String streamId) { 185 public int removeMedia(String app, String streamId) {
206 // 查找是否关联了国标, 关联了不删除, 置为离线 186 // 查找是否关联了国标, 关联了不删除, 置为离线
207 - StreamProxyItem streamProxyItem = gbStreamMapper.selectOne(app, streamId);  
208 - int result = 0;  
209 - if (streamProxyItem == null) { 187 + GbStream gbStream = gbStreamMapper.selectOne(app, streamId);
  188 + int result;
  189 + if (gbStream == null) {
210 result = storager.removeMedia(app, streamId); 190 result = storager.removeMedia(app, streamId);
211 }else { 191 }else {
212 // TODO 暂不设置为离线 192 // TODO 暂不设置为离线
213 - result =storager.mediaOutline(app, streamId); 193 + result =storager.mediaOffline(app, streamId);
214 } 194 }
215 return result; 195 return result;
216 } 196 }
src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMRTPServerFactory.java
@@ -66,7 +66,7 @@ public class ZLMRTPServerFactory { @@ -66,7 +66,7 @@ public class ZLMRTPServerFactory {
66 String stream = UUID.randomUUID().toString(); 66 String stream = UUID.randomUUID().toString();
67 param.put("enable_tcp", 1); 67 param.put("enable_tcp", 1);
68 param.put("stream_id", stream); 68 param.put("stream_id", stream);
69 - param.put("port", 0); 69 +// param.put("port", 0);
70 JSONObject openRtpServerResultJson = zlmresTfulUtils.openRtpServer(mediaServerItem, param); 70 JSONObject openRtpServerResultJson = zlmresTfulUtils.openRtpServer(mediaServerItem, param);
71 71
72 if (openRtpServerResultJson != null) { 72 if (openRtpServerResultJson != null) {
@@ -101,9 +101,10 @@ public class ZLMRTPServerFactory { @@ -101,9 +101,10 @@ public class ZLMRTPServerFactory {
101 } 101 }
102 102
103 Map<String, Object> param = new HashMap<>(); 103 Map<String, Object> param = new HashMap<>();
104 - // 推流端口设置0则使用随机端口 104 +
105 param.put("enable_tcp", 1); 105 param.put("enable_tcp", 1);
106 param.put("stream_id", streamId); 106 param.put("stream_id", streamId);
  107 + // 推流端口设置0则使用随机端口
107 param.put("port", 0); 108 param.put("port", 0);
108 param.put("ssrc", ssrc); 109 param.put("ssrc", ssrc);
109 JSONObject openRtpServerResultJson = zlmresTfulUtils.openRtpServer(mediaServerItem, param); 110 JSONObject openRtpServerResultJson = zlmresTfulUtils.openRtpServer(mediaServerItem, param);
src/main/java/com/genersoft/iot/vmp/media/zlm/dto/HookParam.java 0 → 100644
  1 +package com.genersoft.iot.vmp.media.zlm.dto;
  2 +
  3 +/**
  4 + * zlm hook事件的参数
  5 + * @author lin
  6 + */
  7 +public class HookParam {
  8 + private String mediaServerId;
  9 +
  10 + public String getMediaServerId() {
  11 + return mediaServerId;
  12 + }
  13 +
  14 + public void setMediaServerId(String mediaServerId) {
  15 + this.mediaServerId = mediaServerId;
  16 + }
  17 +}
src/main/java/com/genersoft/iot/vmp/media/zlm/dto/OnPlayHookParam.java 0 → 100644
  1 +package com.genersoft.iot.vmp.media.zlm.dto;
  2 +
  3 +/**
  4 + * zlm hook事件中的on_play事件的参数
  5 + * @author lin
  6 + */
  7 +public class OnPlayHookParam extends HookParam{
  8 + private String id;
  9 + private String app;
  10 + private String stream;
  11 + private String ip;
  12 + private String params;
  13 + private int port;
  14 + private String schema;
  15 + private String vhost;
  16 +
  17 +
  18 + public String getId() {
  19 + return id;
  20 + }
  21 +
  22 + public void setId(String id) {
  23 + this.id = id;
  24 + }
  25 +
  26 + public String getApp() {
  27 + return app;
  28 + }
  29 +
  30 + public void setApp(String app) {
  31 + this.app = app;
  32 + }
  33 +
  34 + public String getStream() {
  35 + return stream;
  36 + }
  37 +
  38 + public void setStream(String stream) {
  39 + this.stream = stream;
  40 + }
  41 +
  42 + public String getIp() {
  43 + return ip;
  44 + }
  45 +
  46 + public void setIp(String ip) {
  47 + this.ip = ip;
  48 + }
  49 +
  50 + public String getParams() {
  51 + return params;
  52 + }
  53 +
  54 + public void setParams(String params) {
  55 + this.params = params;
  56 + }
  57 +
  58 + public int getPort() {
  59 + return port;
  60 + }
  61 +
  62 + public void setPort(int port) {
  63 + this.port = port;
  64 + }
  65 +
  66 + public String getSchema() {
  67 + return schema;
  68 + }
  69 +
  70 + public void setSchema(String schema) {
  71 + this.schema = schema;
  72 + }
  73 +
  74 + public String getVhost() {
  75 + return vhost;
  76 + }
  77 +
  78 + public void setVhost(String vhost) {
  79 + this.vhost = vhost;
  80 + }
  81 +
  82 +}
src/main/java/com/genersoft/iot/vmp/media/zlm/dto/OnPublishHookParam.java 0 → 100644
  1 +package com.genersoft.iot.vmp.media.zlm.dto;
  2 +
  3 +/**
  4 + * zlm hook事件中的on_publish事件的参数
  5 + * @author lin
  6 + */
  7 +public class OnPublishHookParam extends HookParam{
  8 + private String id;
  9 + private String app;
  10 + private String stream;
  11 + private String ip;
  12 + private String params;
  13 + private int port;
  14 + private String schema;
  15 + private String vhost;
  16 +
  17 +
  18 + public String getId() {
  19 + return id;
  20 + }
  21 +
  22 + public void setId(String id) {
  23 + this.id = id;
  24 + }
  25 +
  26 + public String getApp() {
  27 + return app;
  28 + }
  29 +
  30 + public void setApp(String app) {
  31 + this.app = app;
  32 + }
  33 +
  34 + public String getStream() {
  35 + return stream;
  36 + }
  37 +
  38 + public void setStream(String stream) {
  39 + this.stream = stream;
  40 + }
  41 +
  42 + public String getIp() {
  43 + return ip;
  44 + }
  45 +
  46 + public void setIp(String ip) {
  47 + this.ip = ip;
  48 + }
  49 +
  50 + public String getParams() {
  51 + return params;
  52 + }
  53 +
  54 + public void setParams(String params) {
  55 + this.params = params;
  56 + }
  57 +
  58 + public int getPort() {
  59 + return port;
  60 + }
  61 +
  62 + public void setPort(int port) {
  63 + this.port = port;
  64 + }
  65 +
  66 + public String getSchema() {
  67 + return schema;
  68 + }
  69 +
  70 + public void setSchema(String schema) {
  71 + this.schema = schema;
  72 + }
  73 +
  74 + public String getVhost() {
  75 + return vhost;
  76 + }
  77 +
  78 + public void setVhost(String vhost) {
  79 + this.vhost = vhost;
  80 + }
  81 +
  82 +}
src/main/java/com/genersoft/iot/vmp/media/zlm/dto/StreamAuthorityInfo.java 0 → 100644
  1 +package com.genersoft.iot.vmp.media.zlm.dto;
  2 +
  3 +/**
  4 + * 流的鉴权信息
  5 + * @author lin
  6 + */
  7 +public class StreamAuthorityInfo {
  8 +
  9 + private String id;
  10 + private String app;
  11 + private String stream;
  12 +
  13 + /**
  14 + * 产生源类型,
  15 + * unknown = 0,
  16 + * rtmp_push=1,
  17 + * rtsp_push=2,
  18 + * rtp_push=3,
  19 + * pull=4,
  20 + * ffmpeg_pull=5,
  21 + * mp4_vod=6,
  22 + * device_chn=7
  23 + */
  24 + private int originType;
  25 +
  26 + /**
  27 + * 产生源类型的字符串描述
  28 + */
  29 + private String originTypeStr;
  30 +
  31 + /**
  32 + * 推流时自定义的播放鉴权ID
  33 + */
  34 + private String callId;
  35 +
  36 + /**
  37 + * 推流的鉴权签名
  38 + */
  39 + private String sign;
  40 +
  41 + public String getId() {
  42 + return id;
  43 + }
  44 +
  45 + public void setId(String id) {
  46 + this.id = id;
  47 + }
  48 +
  49 + public String getApp() {
  50 + return app;
  51 + }
  52 +
  53 + public void setApp(String app) {
  54 + this.app = app;
  55 + }
  56 +
  57 + public String getStream() {
  58 + return stream;
  59 + }
  60 +
  61 + public void setStream(String stream) {
  62 + this.stream = stream;
  63 + }
  64 +
  65 + public int getOriginType() {
  66 + return originType;
  67 + }
  68 +
  69 + public void setOriginType(int originType) {
  70 + this.originType = originType;
  71 + }
  72 +
  73 + public String getOriginTypeStr() {
  74 + return originTypeStr;
  75 + }
  76 +
  77 + public void setOriginTypeStr(String originTypeStr) {
  78 + this.originTypeStr = originTypeStr;
  79 + }
  80 +
  81 + public String getCallId() {
  82 + return callId;
  83 + }
  84 +
  85 + public void setCallId(String callId) {
  86 + this.callId = callId;
  87 + }
  88 +
  89 + public String getSign() {
  90 + return sign;
  91 + }
  92 +
  93 + public void setSign(String sign) {
  94 + this.sign = sign;
  95 + }
  96 +
  97 + public static StreamAuthorityInfo getInstanceByHook(OnPublishHookParam hookParam) {
  98 + StreamAuthorityInfo streamAuthorityInfo = new StreamAuthorityInfo();
  99 + streamAuthorityInfo.setApp(hookParam.getApp());
  100 + streamAuthorityInfo.setStream(hookParam.getStream());
  101 + streamAuthorityInfo.setId(hookParam.getId());
  102 + return streamAuthorityInfo;
  103 + }
  104 +
  105 + public static StreamAuthorityInfo getInstanceByHook(MediaItem mediaItem) {
  106 + StreamAuthorityInfo streamAuthorityInfo = new StreamAuthorityInfo();
  107 + streamAuthorityInfo.setApp(mediaItem.getApp());
  108 + streamAuthorityInfo.setStream(mediaItem.getStream());
  109 + streamAuthorityInfo.setId(mediaItem.getMediaServerId());
  110 + streamAuthorityInfo.setOriginType(mediaItem.getOriginType());
  111 + streamAuthorityInfo.setOriginTypeStr(mediaItem.getOriginTypeStr());
  112 + return streamAuthorityInfo;
  113 + }
  114 +}
src/main/java/com/genersoft/iot/vmp/media/zlm/dto/StreamPushItem.java
1 package com.genersoft.iot.vmp.media.zlm.dto; 1 package com.genersoft.iot.vmp.media.zlm.dto;
2 2
3 import com.genersoft.iot.vmp.gb28181.bean.GbStream; 3 import com.genersoft.iot.vmp.gb28181.bean.GbStream;
  4 +import com.genersoft.iot.vmp.utils.DateUtil;
4 import org.jetbrains.annotations.NotNull; 5 import org.jetbrains.annotations.NotNull;
  6 +import org.springframework.util.unit.DataUnit;
5 7
6 import java.util.List; 8 import java.util.List;
7 9
@@ -86,6 +88,21 @@ public class StreamPushItem extends GbStream implements Comparable&lt;StreamPushIte @@ -86,6 +88,21 @@ public class StreamPushItem extends GbStream implements Comparable&lt;StreamPushIte
86 */ 88 */
87 private String serverId; 89 private String serverId;
88 90
  91 + /**
  92 + * 推流时间
  93 + */
  94 + private String pushTime;
  95 +
  96 + /**
  97 + * 更新时间
  98 + */
  99 + private String updateTime;
  100 +
  101 + /**
  102 + * 创建时间
  103 + */
  104 + private String createTime;
  105 +
89 public String getVhost() { 106 public String getVhost() {
90 return vhost; 107 return vhost;
91 } 108 }
@@ -97,7 +114,8 @@ public class StreamPushItem extends GbStream implements Comparable&lt;StreamPushIte @@ -97,7 +114,8 @@ public class StreamPushItem extends GbStream implements Comparable&lt;StreamPushIte
97 114
98 @Override 115 @Override
99 public int compareTo(@NotNull StreamPushItem streamPushItem) { 116 public int compareTo(@NotNull StreamPushItem streamPushItem) {
100 - return Long.valueOf(super.createStamp - streamPushItem.getCreateStamp().intValue()).intValue(); 117 + return Long.valueOf(DateUtil.yyyy_MM_dd_HH_mm_ssToTimestamp(super.createTime)
  118 + - DateUtil.yyyy_MM_dd_HH_mm_ssToTimestamp(streamPushItem.getCreateTime())).intValue();
101 } 119 }
102 120
103 public static class MediaSchema { 121 public static class MediaSchema {
@@ -232,5 +250,32 @@ public class StreamPushItem extends GbStream implements Comparable&lt;StreamPushIte @@ -232,5 +250,32 @@ public class StreamPushItem extends GbStream implements Comparable&lt;StreamPushIte
232 public void setServerId(String serverId) { 250 public void setServerId(String serverId) {
233 this.serverId = serverId; 251 this.serverId = serverId;
234 } 252 }
  253 +
  254 +
  255 + public String getPushTime() {
  256 + return pushTime;
  257 + }
  258 +
  259 + public void setPushTime(String pushTime) {
  260 + this.pushTime = pushTime;
  261 + }
  262 +
  263 + public String getUpdateTime() {
  264 + return updateTime;
  265 + }
  266 +
  267 + public void setUpdateTime(String updateTime) {
  268 + this.updateTime = updateTime;
  269 + }
  270 +
  271 + @Override
  272 + public String getCreateTime() {
  273 + return createTime;
  274 + }
  275 +
  276 + @Override
  277 + public void setCreateTime(String createTime) {
  278 + this.createTime = createTime;
  279 + }
235 } 280 }
236 281
src/main/java/com/genersoft/iot/vmp/service/IMediaService.java
@@ -15,7 +15,7 @@ public interface IMediaService { @@ -15,7 +15,7 @@ public interface IMediaService {
15 * @param stream 15 * @param stream
16 * @return 16 * @return
17 */ 17 */
18 - StreamInfo getStreamInfoByAppAndStreamWithCheck(String app, String stream, String mediaServerId,String addr); 18 + StreamInfo getStreamInfoByAppAndStreamWithCheck(String app, String stream, String mediaServerId,String addr, boolean authority);
19 19
20 20
21 /** 21 /**
@@ -24,7 +24,7 @@ public interface IMediaService { @@ -24,7 +24,7 @@ public interface IMediaService {
24 * @param stream 24 * @param stream
25 * @return 25 * @return
26 */ 26 */
27 - StreamInfo getStreamInfoByAppAndStreamWithCheck(String app, String stream, String mediaServerId); 27 + StreamInfo getStreamInfoByAppAndStreamWithCheck(String app, String stream, String mediaServerId, boolean authority);
28 28
29 /** 29 /**
30 * 根据应用名和流ID获取播放地址, 只是地址拼接 30 * 根据应用名和流ID获取播放地址, 只是地址拼接
@@ -32,7 +32,7 @@ public interface IMediaService { @@ -32,7 +32,7 @@ public interface IMediaService {
32 * @param stream 32 * @param stream
33 * @return 33 * @return
34 */ 34 */
35 - StreamInfo getStreamInfoByAppAndStream(MediaServerItem mediaServerItem, String app, String stream, Object tracks); 35 + StreamInfo getStreamInfoByAppAndStream(MediaServerItem mediaServerItem, String app, String stream, Object tracks, String callId);
36 36
37 /** 37 /**
38 * 根据应用名和流ID获取播放地址, 只是地址拼接,返回的ip使用远程访问ip,适用与zlm与wvp在一台主机的情况 38 * 根据应用名和流ID获取播放地址, 只是地址拼接,返回的ip使用远程访问ip,适用与zlm与wvp在一台主机的情况
@@ -40,6 +40,6 @@ public interface IMediaService { @@ -40,6 +40,6 @@ public interface IMediaService {
40 * @param stream 40 * @param stream
41 * @return 41 * @return
42 */ 42 */
43 - StreamInfo getStreamInfoByAppAndStream(MediaServerItem mediaInfo, String app, String stream, Object tracks, String addr); 43 + StreamInfo getStreamInfoByAppAndStream(MediaServerItem mediaInfo, String app, String stream, Object tracks, String addr, String callId);
44 StreamInfo getStreamInfoByAppAndStream(MediaServerItem mediaInfo, String app, String stream, Object tracks, String addr, boolean isPlay); 44 StreamInfo getStreamInfoByAppAndStream(MediaServerItem mediaInfo, String app, String stream, Object tracks, String addr, boolean isPlay);
45 } 45 }
src/main/java/com/genersoft/iot/vmp/service/IUserService.java
@@ -19,4 +19,6 @@ public interface IUserService { @@ -19,4 +19,6 @@ public interface IUserService {
19 List<User> getAllUsers(); 19 List<User> getAllUsers();
20 20
21 int updateUsers(User user); 21 int updateUsers(User user);
  22 +
  23 + boolean checkPushAuthority(String callId, String sign);
22 } 24 }
src/main/java/com/genersoft/iot/vmp/service/bean/PushStreamStatusChangeFromRedisDto.java 0 → 100644
  1 +package com.genersoft.iot.vmp.service.bean;
  2 +
  3 +import java.util.List;
  4 +
  5 +/**
  6 + * 收到redis通知修改推流通道状态
  7 + * @author lin
  8 + */
  9 +public class PushStreamStatusChangeFromRedisDto {
  10 +
  11 + private boolean setAllOffline;
  12 +
  13 + private List<StreamPushItemFromRedis> onlineStreams;
  14 +
  15 + private List<StreamPushItemFromRedis> offlineStreams;
  16 +
  17 +
  18 + public boolean isSetAllOffline() {
  19 + return setAllOffline;
  20 + }
  21 +
  22 + public void setSetAllOffline(boolean setAllOffline) {
  23 + this.setAllOffline = setAllOffline;
  24 + }
  25 +
  26 + public List<StreamPushItemFromRedis> getOnlineStreams() {
  27 + return onlineStreams;
  28 + }
  29 +
  30 + public void setOnlineStreams(List<StreamPushItemFromRedis> onlineStreams) {
  31 + this.onlineStreams = onlineStreams;
  32 + }
  33 +
  34 + public List<StreamPushItemFromRedis> getOfflineStreams() {
  35 + return offlineStreams;
  36 + }
  37 +
  38 + public void setOfflineStreams(List<StreamPushItemFromRedis> offlineStreams) {
  39 + this.offlineStreams = offlineStreams;
  40 + }
  41 +}
src/main/java/com/genersoft/iot/vmp/service/bean/StreamPushItemFromRedis.java 0 → 100644
  1 +package com.genersoft.iot.vmp.service.bean;
  2 +
  3 +
  4 +public class StreamPushItemFromRedis {
  5 + private String app;
  6 + private String stream;
  7 + private long timeStamp;
  8 +
  9 + public String getApp() {
  10 + return app;
  11 + }
  12 +
  13 + public void setApp(String app) {
  14 + this.app = app;
  15 + }
  16 +
  17 + public String getStream() {
  18 + return stream;
  19 + }
  20 +
  21 + public void setStream(String stream) {
  22 + this.stream = stream;
  23 + }
  24 +
  25 + public long getTimeStamp() {
  26 + return timeStamp;
  27 + }
  28 +
  29 + public void setTimeStamp(long timeStamp) {
  30 + this.timeStamp = timeStamp;
  31 + }
  32 +}
  33 +
  34 +
src/main/java/com/genersoft/iot/vmp/service/impl/GbStreamServiceImpl.java
@@ -149,9 +149,9 @@ public class GbStreamServiceImpl implements IGbStreamService { @@ -149,9 +149,9 @@ public class GbStreamServiceImpl implements IGbStreamService {
149 if (gbStream.getGbId() != null) { 149 if (gbStream.getGbId() != null) {
150 gbStreams.add(gbStream); 150 gbStreams.add(gbStream);
151 }else { 151 }else {
152 - StreamProxyItem streamProxyItem = gbStreamMapper.selectOne(gbStream.getApp(), gbStream.getStream());  
153 - if (streamProxyItem != null && streamProxyItem.getGbId() != null){  
154 - gbStreams.add(streamProxyItem); 152 + GbStream gbStreamIndb = gbStreamMapper.selectOne(gbStream.getApp(), gbStream.getStream());
  153 + if (gbStreamIndb != null && gbStreamIndb.getGbId() != null){
  154 + gbStreams.add(gbStreamIndb);
155 } 155 }
156 } 156 }
157 sendCatalogMsgs(gbStreams, type); 157 sendCatalogMsgs(gbStreams, type);
src/main/java/com/genersoft/iot/vmp/service/impl/MediaServiceImpl.java
@@ -7,12 +7,15 @@ import com.genersoft.iot.vmp.common.StreamInfo; @@ -7,12 +7,15 @@ import com.genersoft.iot.vmp.common.StreamInfo;
7 import com.genersoft.iot.vmp.conf.MediaConfig; 7 import com.genersoft.iot.vmp.conf.MediaConfig;
8 import com.genersoft.iot.vmp.media.zlm.ZLMRESTfulUtils; 8 import com.genersoft.iot.vmp.media.zlm.ZLMRESTfulUtils;
9 import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem; 9 import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem;
  10 +import com.genersoft.iot.vmp.media.zlm.dto.OnPublishHookParam;
  11 +import com.genersoft.iot.vmp.media.zlm.dto.StreamAuthorityInfo;
10 import com.genersoft.iot.vmp.service.IMediaServerService; 12 import com.genersoft.iot.vmp.service.IMediaServerService;
11 import com.genersoft.iot.vmp.storager.IRedisCatchStorage; 13 import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
12 import com.genersoft.iot.vmp.storager.IVideoManagerStorage; 14 import com.genersoft.iot.vmp.storager.IVideoManagerStorage;
13 import com.genersoft.iot.vmp.service.IMediaService; 15 import com.genersoft.iot.vmp.service.IMediaService;
14 import org.springframework.beans.factory.annotation.Autowired; 16 import org.springframework.beans.factory.annotation.Autowired;
15 import org.springframework.stereotype.Service; 17 import org.springframework.stereotype.Service;
  18 +import org.springframework.util.StringUtils;
16 19
17 @Service 20 @Service
18 public class MediaServiceImpl implements IMediaService { 21 public class MediaServiceImpl implements IMediaService {
@@ -36,20 +39,24 @@ public class MediaServiceImpl implements IMediaService { @@ -36,20 +39,24 @@ public class MediaServiceImpl implements IMediaService {
36 39
37 40
38 @Override 41 @Override
39 - public StreamInfo getStreamInfoByAppAndStream(MediaServerItem mediaInfo, String app, String stream, Object tracks) {  
40 - return getStreamInfoByAppAndStream(mediaInfo, app, stream, tracks, null); 42 + public StreamInfo getStreamInfoByAppAndStream(MediaServerItem mediaInfo, String app, String stream, Object tracks, String callId) {
  43 + return getStreamInfoByAppAndStream(mediaInfo, app, stream, tracks, null, callId);
41 } 44 }
42 45
43 @Override 46 @Override
44 - public StreamInfo getStreamInfoByAppAndStreamWithCheck(String app, String stream, String mediaServerId, String addr) { 47 + public StreamInfo getStreamInfoByAppAndStreamWithCheck(String app, String stream, String mediaServerId, String addr, boolean authority) {
45 StreamInfo streamInfo = null; 48 StreamInfo streamInfo = null;
46 if (mediaServerId == null) { 49 if (mediaServerId == null) {
47 mediaServerId = mediaConfig.getId(); 50 mediaServerId = mediaConfig.getId();
48 } 51 }
49 - MediaServerItem mediaInfo = mediaServerService.getOne(mediaServerId);; 52 + MediaServerItem mediaInfo = mediaServerService.getOne(mediaServerId);
50 if (mediaInfo == null) { 53 if (mediaInfo == null) {
51 return null; 54 return null;
52 } 55 }
  56 + StreamAuthorityInfo streamAuthorityInfo = redisCatchStorage.getStreamAuthorityInfo(app, stream);
  57 + if (streamAuthorityInfo == null) {
  58 + return null;
  59 + }
53 JSONObject mediaList = zlmresTfulUtils.getMediaList(mediaInfo, app, stream); 60 JSONObject mediaList = zlmresTfulUtils.getMediaList(mediaInfo, app, stream);
54 if (mediaList != null) { 61 if (mediaList != null) {
55 if (mediaList.getInteger("code") == 0) { 62 if (mediaList.getInteger("code") == 0) {
@@ -59,7 +66,12 @@ public class MediaServiceImpl implements IMediaService { @@ -59,7 +66,12 @@ public class MediaServiceImpl implements IMediaService {
59 } 66 }
60 JSONObject mediaJSON = JSON.parseObject(JSON.toJSONString(data.get(0)), JSONObject.class); 67 JSONObject mediaJSON = JSON.parseObject(JSON.toJSONString(data.get(0)), JSONObject.class);
61 JSONArray tracks = mediaJSON.getJSONArray("tracks"); 68 JSONArray tracks = mediaJSON.getJSONArray("tracks");
62 - streamInfo = getStreamInfoByAppAndStream(mediaInfo, app, stream, tracks); 69 + if (authority) {
  70 + streamInfo = getStreamInfoByAppAndStream(mediaInfo, app, stream, tracks, streamAuthorityInfo.getCallId());
  71 + }else {
  72 + streamInfo = getStreamInfoByAppAndStream(mediaInfo, app, stream, tracks, null);
  73 + }
  74 +
63 } 75 }
64 } 76 }
65 return streamInfo; 77 return streamInfo;
@@ -68,8 +80,8 @@ public class MediaServiceImpl implements IMediaService { @@ -68,8 +80,8 @@ public class MediaServiceImpl implements IMediaService {
68 80
69 81
70 @Override 82 @Override
71 - public StreamInfo getStreamInfoByAppAndStreamWithCheck(String app, String stream, String mediaServerId) {  
72 - return getStreamInfoByAppAndStreamWithCheck(app, stream, mediaServerId, null); 83 + public StreamInfo getStreamInfoByAppAndStreamWithCheck(String app, String stream, String mediaServerId, boolean authority) {
  84 + return getStreamInfoByAppAndStreamWithCheck(app, stream, mediaServerId, null, authority);
73 } 85 }
74 86
75 @Override 87 @Override
@@ -78,41 +90,43 @@ public class MediaServiceImpl implements IMediaService { @@ -78,41 +90,43 @@ public class MediaServiceImpl implements IMediaService {
78 } 90 }
79 91
80 @Override 92 @Override
81 - public StreamInfo getStreamInfoByAppAndStream(MediaServerItem mediaInfo, String app, String stream, Object tracks, String addr, boolean isPlay) { 93 + public StreamInfo getStreamInfoByAppAndStream(MediaServerItem mediaInfo, String app, String stream, Object tracks, String addr, String callId, boolean isPlay) {
82 StreamInfo streamInfoResult = new StreamInfo(); 94 StreamInfo streamInfoResult = new StreamInfo();
83 streamInfoResult.setStream(stream); 95 streamInfoResult.setStream(stream);
84 streamInfoResult.setApp(app); 96 streamInfoResult.setApp(app);
85 if (addr == null) { 97 if (addr == null) {
86 addr = mediaInfo.getStreamIp(); 98 addr = mediaInfo.getStreamIp();
87 } 99 }
  100 + streamInfoResult.setIp(addr);
88 streamInfoResult.setMediaServerId(mediaInfo.getId()); 101 streamInfoResult.setMediaServerId(mediaInfo.getId());
89 - streamInfoResult.setRtmp(String.format("rtmp://%s:%s/%s/%s", addr, mediaInfo.getRtmpPort(), app, stream)); 102 + String callIdParam = StringUtils.isEmpty(callId)?"":"?callId=" + callId;
  103 + streamInfoResult.setRtmp(String.format("rtmp://%s:%s/%s/%s%s", addr, mediaInfo.getRtmpPort(), app, stream, callIdParam));
90 if (mediaInfo.getRtmpSSlPort() != 0) { 104 if (mediaInfo.getRtmpSSlPort() != 0) {
91 - streamInfoResult.setRtmps(String.format("rtmps://%s:%s/%s/%s", addr, mediaInfo.getRtmpSSlPort(), app, stream)); 105 + streamInfoResult.setRtmps(String.format("rtmps://%s:%s/%s/%s%s", addr, mediaInfo.getRtmpSSlPort(), app, stream, callIdParam));
92 } 106 }
93 - streamInfoResult.setRtsp(String.format("rtsp://%s:%s/%s/%s", addr, mediaInfo.getRtspPort(), app, stream)); 107 + streamInfoResult.setRtsp(String.format("rtsp://%s:%s/%s/%s%s", addr, mediaInfo.getRtspPort(), app, stream, callIdParam));
94 if (mediaInfo.getRtspSSLPort() != 0) { 108 if (mediaInfo.getRtspSSLPort() != 0) {
95 - streamInfoResult.setRtsps(String.format("rtsps://%s:%s/%s/%s", addr, mediaInfo.getRtspSSLPort(), app, stream)); 109 + streamInfoResult.setRtsps(String.format("rtsps://%s:%s/%s/%s%s", addr, mediaInfo.getRtspSSLPort(), app, stream, callIdParam));
96 } 110 }
97 - streamInfoResult.setFlv(String.format("http://%s:%s/%s/%s.live.flv", addr, mediaInfo.getHttpPort(), app, stream));  
98 - streamInfoResult.setWs_flv(String.format("ws://%s:%s/%s/%s.live.flv", addr, mediaInfo.getHttpPort(), app, stream));  
99 - streamInfoResult.setHls(String.format("http://%s:%s/%s/%s/hls.m3u8", addr, mediaInfo.getHttpPort(), app, stream));  
100 - streamInfoResult.setWs_hls(String.format("ws://%s:%s/%s/%s/hls.m3u8", addr, mediaInfo.getHttpPort(), app, stream));  
101 - streamInfoResult.setFmp4(String.format("http://%s:%s/%s/%s.live.mp4", addr, mediaInfo.getHttpPort(), app, stream));  
102 - streamInfoResult.setWs_fmp4(String.format("ws://%s:%s/%s/%s.live.mp4", addr, mediaInfo.getHttpPort(), app, stream));  
103 - streamInfoResult.setTs(String.format("http://%s:%s/%s/%s.live.ts", addr, mediaInfo.getHttpPort(), app, stream));  
104 - streamInfoResult.setWs_ts(String.format("ws://%s:%s/%s/%s.live.ts", addr, mediaInfo.getHttpPort(), app, stream)); 111 + streamInfoResult.setFlv(String.format("http://%s:%s/%s/%s.live.flv%s", addr, mediaInfo.getHttpPort(), app, stream, callIdParam));
  112 + streamInfoResult.setWs_flv(String.format("ws://%s:%s/%s/%s.live.flv%s", addr, mediaInfo.getHttpPort(), app, stream, callIdParam));
  113 + streamInfoResult.setHls(String.format("http://%s:%s/%s/%s/hls.m3u8%s", addr, mediaInfo.getHttpPort(), app, stream, callIdParam));
  114 + streamInfoResult.setWs_hls(String.format("ws://%s:%s/%s/%s/hls.m3u8%s", addr, mediaInfo.getHttpPort(), app, stream, callIdParam));
  115 + streamInfoResult.setFmp4(String.format("http://%s:%s/%s/%s.live.mp4%s", addr, mediaInfo.getHttpPort(), app, stream, callIdParam));
  116 + streamInfoResult.setWs_fmp4(String.format("ws://%s:%s/%s/%s.live.mp4%s", addr, mediaInfo.getHttpPort(), app, stream, callIdParam));
  117 + streamInfoResult.setTs(String.format("http://%s:%s/%s/%s.live.ts%s", addr, mediaInfo.getHttpPort(), app, stream, callIdParam));
  118 + streamInfoResult.setWs_ts(String.format("ws://%s:%s/%s/%s.live.ts%s", addr, mediaInfo.getHttpPort(), app, stream, callIdParam));
105 if (mediaInfo.getHttpSSlPort() != 0) { 119 if (mediaInfo.getHttpSSlPort() != 0) {
106 - streamInfoResult.setHttps_flv(String.format("https://%s:%s/%s/%s.live.flv", addr, mediaInfo.getHttpSSlPort(), app, stream));  
107 - streamInfoResult.setWss_flv(String.format("wss://%s:%s/%s/%s.live.flv", addr, mediaInfo.getHttpSSlPort(), app, stream));  
108 - streamInfoResult.setHttps_hls(String.format("https://%s:%s/%s/%s/hls.m3u8", addr, mediaInfo.getHttpSSlPort(), app, stream));  
109 - streamInfoResult.setWss_hls(String.format("wss://%s:%s/%s/%s/hls.m3u8", addr, mediaInfo.getHttpSSlPort(), app, stream));  
110 - streamInfoResult.setHttps_fmp4(String.format("https://%s:%s/%s/%s.live.mp4", addr, mediaInfo.getHttpSSlPort(), app, stream));  
111 - streamInfoResult.setWss_fmp4(String.format("wss://%s:%s/%s/%s.live.mp4", addr, mediaInfo.getHttpSSlPort(), app, stream));  
112 - streamInfoResult.setHttps_ts(String.format("https://%s:%s/%s/%s.live.ts", addr, mediaInfo.getHttpSSlPort(), app, stream));  
113 - streamInfoResult.setWss_ts(String.format("wss://%s:%s/%s/%s.live.ts", addr, mediaInfo.getHttpSSlPort(), app, stream));  
114 - streamInfoResult.setWss_ts(String.format("wss://%s:%s/%s/%s.live.ts", addr, mediaInfo.getHttpSSlPort(), app, stream));  
115 - streamInfoResult.setRtc(String.format("https://%s:%s/index/api/webrtc?app=%s&stream=%s&type=%s", mediaInfo.getStreamIp(), mediaInfo.getHttpSSlPort(), app, stream, isPlay?"play":"push")); 120 + streamInfoResult.setHttps_flv(String.format("https://%s:%s/%s/%s.live.flv%s", addr, mediaInfo.getHttpSSlPort(), app, stream, callIdParam));
  121 + streamInfoResult.setWss_flv(String.format("wss://%s:%s/%s/%s.live.flv%s", addr, mediaInfo.getHttpSSlPort(), app, stream, callIdParam));
  122 + streamInfoResult.setHttps_hls(String.format("https://%s:%s/%s/%s/hls.m3u8%s", addr, mediaInfo.getHttpSSlPort(), app, stream, callIdParam));
  123 + streamInfoResult.setWss_hls(String.format("wss://%s:%s/%s/%s/hls.m3u8%s", addr, mediaInfo.getHttpSSlPort(), app, stream, callIdParam));
  124 + streamInfoResult.setHttps_fmp4(String.format("https://%s:%s/%s/%s.live.mp4%s", addr, mediaInfo.getHttpSSlPort(), app, stream, callIdParam));
  125 + streamInfoResult.setWss_fmp4(String.format("wss://%s:%s/%s/%s.live.mp4%s", addr, mediaInfo.getHttpSSlPort(), app, stream, callIdParam));
  126 + streamInfoResult.setHttps_ts(String.format("https://%s:%s/%s/%s.live.ts%s", addr, mediaInfo.getHttpSSlPort(), app, stream, callIdParam));
  127 + streamInfoResult.setWss_ts(String.format("wss://%s:%s/%s/%s.live.ts%s", addr, mediaInfo.getHttpSSlPort(), app, stream, callIdParam));
  128 + streamInfoResult.setWss_ts(String.format("wss://%s:%s/%s/%s.live.ts%s", addr, mediaInfo.getHttpSSlPort(), app, stream, callIdParam));
  129 + streamInfoResult.setRtc(String.format("https://%s:%s/index/api/webrtc?app=%s&stream=%s&type=%s%s", mediaInfo.getStreamIp(), mediaInfo.getHttpSSlPort(), app, stream, isPlay?"play":"push", StringUtils.isEmpty(callId)?"":"&callId=" + callId));
116 } 130 }
117 131
118 streamInfoResult.setTracks(tracks); 132 streamInfoResult.setTracks(tracks);
src/main/java/com/genersoft/iot/vmp/service/impl/PlayServiceImpl.java
@@ -637,7 +637,7 @@ public class PlayServiceImpl implements IPlayService { @@ -637,7 +637,7 @@ public class PlayServiceImpl implements IPlayService {
637 public StreamInfo onPublishHandler(MediaServerItem mediaServerItem, JSONObject resonse, String deviceId, String channelId) { 637 public StreamInfo onPublishHandler(MediaServerItem mediaServerItem, JSONObject resonse, String deviceId, String channelId) {
638 String streamId = resonse.getString("stream"); 638 String streamId = resonse.getString("stream");
639 JSONArray tracks = resonse.getJSONArray("tracks"); 639 JSONArray tracks = resonse.getJSONArray("tracks");
640 - StreamInfo streamInfo = mediaService.getStreamInfoByAppAndStream(mediaServerItem,"rtp", streamId, tracks); 640 + StreamInfo streamInfo = mediaService.getStreamInfoByAppAndStream(mediaServerItem,"rtp", streamId, tracks, null);
641 streamInfo.setDeviceID(deviceId); 641 streamInfo.setDeviceID(deviceId);
642 streamInfo.setChannelId(channelId); 642 streamInfo.setChannelId(channelId);
643 return streamInfo; 643 return streamInfo;
src/main/java/com/genersoft/iot/vmp/service/impl/RedisAlarmMsgListener.java
@@ -41,6 +41,7 @@ public class RedisAlarmMsgListener implements MessageListener { @@ -41,6 +41,7 @@ public class RedisAlarmMsgListener implements MessageListener {
41 ParentPlatform platform = storage.queryParentPlatByServerGBId(gbId); 41 ParentPlatform platform = storage.queryParentPlatByServerGBId(gbId);
42 42
43 DeviceAlarm deviceAlarm = new DeviceAlarm(); 43 DeviceAlarm deviceAlarm = new DeviceAlarm();
  44 + deviceAlarm.setCreateTime(DateUtil.getNow());
44 deviceAlarm.setChannelId(gbId); 45 deviceAlarm.setChannelId(gbId);
45 deviceAlarm.setAlarmDescription(alarmChannelMessage.getAlarmDescription()); 46 deviceAlarm.setAlarmDescription(alarmChannelMessage.getAlarmDescription());
46 deviceAlarm.setAlarmMethod("" + alarmChannelMessage.getAlarmSn()); 47 deviceAlarm.setAlarmMethod("" + alarmChannelMessage.getAlarmSn());
src/main/java/com/genersoft/iot/vmp/service/impl/RedisGpsMsgListener.java
@@ -25,9 +25,6 @@ public class RedisGpsMsgListener implements MessageListener { @@ -25,9 +25,6 @@ public class RedisGpsMsgListener implements MessageListener {
25 25
26 @Override 26 @Override
27 public void onMessage(@NotNull Message message, byte[] bytes) { 27 public void onMessage(@NotNull Message message, byte[] bytes) {
28 - if (logger.isDebugEnabled()) {  
29 - logger.debug("收到来自REDIS的GPS通知: {}", new String(message.getBody()));  
30 - }  
31 GPSMsgInfo gpsMsgInfo = JSON.parseObject(message.getBody(), GPSMsgInfo.class); 28 GPSMsgInfo gpsMsgInfo = JSON.parseObject(message.getBody(), GPSMsgInfo.class);
32 redisCatchStorage.updateGpsMsgInfo(gpsMsgInfo); 29 redisCatchStorage.updateGpsMsgInfo(gpsMsgInfo);
33 } 30 }
src/main/java/com/genersoft/iot/vmp/service/impl/StreamProxyServiceImpl.java
@@ -230,11 +230,12 @@ public class StreamProxyServiceImpl implements IStreamProxyService { @@ -230,11 +230,12 @@ public class StreamProxyServiceImpl implements IStreamProxyService {
230 public boolean start(String app, String stream) { 230 public boolean start(String app, String stream) {
231 boolean result = false; 231 boolean result = false;
232 StreamProxyItem streamProxy = videoManagerStorager.queryStreamProxy(app, stream); 232 StreamProxyItem streamProxy = videoManagerStorager.queryStreamProxy(app, stream);
233 - if (!streamProxy.isEnable() && streamProxy != null) { 233 + if (!streamProxy.isEnable() ) {
234 JSONObject jsonObject = addStreamProxyToZlm(streamProxy); 234 JSONObject jsonObject = addStreamProxyToZlm(streamProxy);
235 if (jsonObject == null) { 235 if (jsonObject == null) {
236 return false; 236 return false;
237 } 237 }
  238 + System.out.println(jsonObject);
238 if (jsonObject.getInteger("code") == 0) { 239 if (jsonObject.getInteger("code") == 0) {
239 result = true; 240 result = true;
240 streamProxy.setEnable(true); 241 streamProxy.setEnable(true);
@@ -250,7 +251,7 @@ public class StreamProxyServiceImpl implements IStreamProxyService { @@ -250,7 +251,7 @@ public class StreamProxyServiceImpl implements IStreamProxyService {
250 StreamProxyItem streamProxyDto = videoManagerStorager.queryStreamProxy(app, stream); 251 StreamProxyItem streamProxyDto = videoManagerStorager.queryStreamProxy(app, stream);
251 if (streamProxyDto != null && streamProxyDto.isEnable()) { 252 if (streamProxyDto != null && streamProxyDto.isEnable()) {
252 JSONObject jsonObject = removeStreamProxyFromZlm(streamProxyDto); 253 JSONObject jsonObject = removeStreamProxyFromZlm(streamProxyDto);
253 - if (jsonObject.getInteger("code") == 0) { 254 + if (jsonObject != null && jsonObject.getInteger("code") == 0) {
254 streamProxyDto.setEnable(false); 255 streamProxyDto.setEnable(false);
255 result = videoManagerStorager.updateStreamProxy(streamProxyDto); 256 result = videoManagerStorager.updateStreamProxy(streamProxyDto);
256 } 257 }
@@ -318,7 +319,7 @@ public class StreamProxyServiceImpl implements IStreamProxyService { @@ -318,7 +319,7 @@ public class StreamProxyServiceImpl implements IStreamProxyService {
318 } 319 }
319 streamProxyMapper.deleteAutoRemoveItemByMediaServerId(mediaServerId); 320 streamProxyMapper.deleteAutoRemoveItemByMediaServerId(mediaServerId);
320 // 其他的流设置离线 321 // 其他的流设置离线
321 - streamProxyMapper.updateStatusByMediaServerId(false, mediaServerId); 322 + streamProxyMapper.updateStatusByMediaServerId(mediaServerId, false);
322 String type = "PULL"; 323 String type = "PULL";
323 324
324 // 发送redis消息 325 // 发送redis消息
@@ -345,7 +346,7 @@ public class StreamProxyServiceImpl implements IStreamProxyService { @@ -345,7 +346,7 @@ public class StreamProxyServiceImpl implements IStreamProxyService {
345 346
346 @Override 347 @Override
347 public int updateStatus(boolean status, String app, String stream) { 348 public int updateStatus(boolean status, String app, String stream) {
348 - return streamProxyMapper.updateStatus(status, app, stream); 349 + return streamProxyMapper.updateStatus(app, stream, status);
349 } 350 }
350 351
351 private void syncPullStream(String mediaServerId){ 352 private void syncPullStream(String mediaServerId){
src/main/java/com/genersoft/iot/vmp/service/impl/StreamPushServiceImpl.java
@@ -15,6 +15,7 @@ import com.genersoft.iot.vmp.service.IMediaServerService; @@ -15,6 +15,7 @@ import com.genersoft.iot.vmp.service.IMediaServerService;
15 import com.genersoft.iot.vmp.service.IStreamPushService; 15 import com.genersoft.iot.vmp.service.IStreamPushService;
16 import com.genersoft.iot.vmp.storager.IRedisCatchStorage; 16 import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
17 import com.genersoft.iot.vmp.storager.dao.*; 17 import com.genersoft.iot.vmp.storager.dao.*;
  18 +import com.genersoft.iot.vmp.utils.DateUtil;
18 import com.github.pagehelper.PageHelper; 19 import com.github.pagehelper.PageHelper;
19 import com.github.pagehelper.PageInfo; 20 import com.github.pagehelper.PageInfo;
20 import org.slf4j.Logger; 21 import org.slf4j.Logger;
@@ -38,6 +39,9 @@ public class StreamPushServiceImpl implements IStreamPushService { @@ -38,6 +39,9 @@ public class StreamPushServiceImpl implements IStreamPushService {
38 private StreamPushMapper streamPushMapper; 39 private StreamPushMapper streamPushMapper;
39 40
40 @Autowired 41 @Autowired
  42 + private StreamProxyMapper streamProxyMapper;
  43 +
  44 + @Autowired
41 private ParentPlatformMapper parentPlatformMapper; 45 private ParentPlatformMapper parentPlatformMapper;
42 46
43 @Autowired 47 @Autowired
@@ -102,7 +106,7 @@ public class StreamPushServiceImpl implements IStreamPushService { @@ -102,7 +106,7 @@ public class StreamPushServiceImpl implements IStreamPushService {
102 streamPushItem.setOriginType(item.getOriginType()); 106 streamPushItem.setOriginType(item.getOriginType());
103 streamPushItem.setOriginTypeStr(item.getOriginTypeStr()); 107 streamPushItem.setOriginTypeStr(item.getOriginTypeStr());
104 streamPushItem.setOriginUrl(item.getOriginUrl()); 108 streamPushItem.setOriginUrl(item.getOriginUrl());
105 - streamPushItem.setCreateStamp(item.getCreateStamp() * 1000); 109 + streamPushItem.setCreateTime(DateUtil.getNow());
106 streamPushItem.setAliveSecond(item.getAliveSecond()); 110 streamPushItem.setAliveSecond(item.getAliveSecond());
107 streamPushItem.setStatus(true); 111 streamPushItem.setStatus(true);
108 streamPushItem.setStreamType("push"); 112 streamPushItem.setStreamType("push");
@@ -127,7 +131,7 @@ public class StreamPushServiceImpl implements IStreamPushService { @@ -127,7 +131,7 @@ public class StreamPushServiceImpl implements IStreamPushService {
127 public boolean saveToGB(GbStream stream) { 131 public boolean saveToGB(GbStream stream) {
128 stream.setStreamType("push"); 132 stream.setStreamType("push");
129 stream.setStatus(true); 133 stream.setStatus(true);
130 - stream.setCreateStamp(System.currentTimeMillis()); 134 + stream.setCreateTime(DateUtil.getNow());
131 int add = gbStreamMapper.add(stream); 135 int add = gbStreamMapper.add(stream);
132 136
133 // 查找开启了全部直播流共享的上级平台 137 // 查找开启了全部直播流共享的上级平台
@@ -284,7 +288,8 @@ public class StreamPushServiceImpl implements IStreamPushService { @@ -284,7 +288,8 @@ public class StreamPushServiceImpl implements IStreamPushService {
284 streamPushMapper.deleteWithoutGBId(mediaServerId); 288 streamPushMapper.deleteWithoutGBId(mediaServerId);
285 gbStreamMapper.deleteWithoutGBId("push", mediaServerId); 289 gbStreamMapper.deleteWithoutGBId("push", mediaServerId);
286 // 其他的流设置未启用 290 // 其他的流设置未启用
287 - gbStreamMapper.updateStatusByMediaServerId(mediaServerId, false); 291 + streamPushMapper.updateStatusByMediaServerId(mediaServerId, false);
  292 + streamProxyMapper.updateStatusByMediaServerId(mediaServerId, false);
288 // 发送流停止消息 293 // 发送流停止消息
289 String type = "PUSH"; 294 String type = "PUSH";
290 // 发送redis消息 295 // 发送redis消息
@@ -317,7 +322,7 @@ public class StreamPushServiceImpl implements IStreamPushService { @@ -317,7 +322,7 @@ public class StreamPushServiceImpl implements IStreamPushService {
317 streamPushItem.setStreamType("push"); 322 streamPushItem.setStreamType("push");
318 streamPushItem.setStatus(true); 323 streamPushItem.setStatus(true);
319 streamPushItem.setGbId("34020000004111" + gbId); 324 streamPushItem.setGbId("34020000004111" + gbId);
320 - streamPushItem.setCreateStamp(System.currentTimeMillis()); 325 + streamPushItem.setCreateTime(DateUtil.getNow());
321 gbId ++; 326 gbId ++;
322 } 327 }
323 int limitCount = 30; 328 int limitCount = 30;
src/main/java/com/genersoft/iot/vmp/service/impl/StreamPushUploadFileHandler.java
@@ -4,6 +4,7 @@ import com.alibaba.excel.context.AnalysisContext; @@ -4,6 +4,7 @@ import com.alibaba.excel.context.AnalysisContext;
4 import com.alibaba.excel.event.AnalysisEventListener; 4 import com.alibaba.excel.event.AnalysisEventListener;
5 import com.genersoft.iot.vmp.media.zlm.dto.StreamPushItem; 5 import com.genersoft.iot.vmp.media.zlm.dto.StreamPushItem;
6 import com.genersoft.iot.vmp.service.IStreamPushService; 6 import com.genersoft.iot.vmp.service.IStreamPushService;
  7 +import com.genersoft.iot.vmp.utils.DateUtil;
7 import com.genersoft.iot.vmp.vmanager.bean.StreamPushExcelDto; 8 import com.genersoft.iot.vmp.vmanager.bean.StreamPushExcelDto;
8 import com.google.common.collect.BiMap; 9 import com.google.common.collect.BiMap;
9 import com.google.common.collect.HashBiMap; 10 import com.google.common.collect.HashBiMap;
@@ -94,7 +95,7 @@ public class StreamPushUploadFileHandler extends AnalysisEventListener&lt;StreamPus @@ -94,7 +95,7 @@ public class StreamPushUploadFileHandler extends AnalysisEventListener&lt;StreamPus
94 streamPushItem.setGbId(streamPushExcelDto.getGbId()); 95 streamPushItem.setGbId(streamPushExcelDto.getGbId());
95 streamPushItem.setStatus(false); 96 streamPushItem.setStatus(false);
96 streamPushItem.setStreamType("push"); 97 streamPushItem.setStreamType("push");
97 - streamPushItem.setCreateStamp(System.currentTimeMillis()); 98 + streamPushItem.setCreateTime(DateUtil.getNow());
98 streamPushItem.setMediaServerId(defaultMediaServerId); 99 streamPushItem.setMediaServerId(defaultMediaServerId);
99 streamPushItem.setName(streamPushExcelDto.getName()); 100 streamPushItem.setName(streamPushExcelDto.getName());
100 streamPushItem.setOriginType(2); 101 streamPushItem.setOriginType(2);
src/main/java/com/genersoft/iot/vmp/service/impl/UserServiceImpl.java
@@ -5,6 +5,7 @@ import com.genersoft.iot.vmp.storager.dao.UserMapper; @@ -5,6 +5,7 @@ import com.genersoft.iot.vmp.storager.dao.UserMapper;
5 import com.genersoft.iot.vmp.storager.dao.dto.User; 5 import com.genersoft.iot.vmp.storager.dao.dto.User;
6 import org.springframework.beans.factory.annotation.Autowired; 6 import org.springframework.beans.factory.annotation.Autowired;
7 import org.springframework.stereotype.Service; 7 import org.springframework.stereotype.Service;
  8 +import org.springframework.util.StringUtils;
8 9
9 import java.util.List; 10 import java.util.List;
10 11
@@ -55,4 +56,12 @@ public class UserServiceImpl implements IUserService { @@ -55,4 +56,12 @@ public class UserServiceImpl implements IUserService {
55 } 56 }
56 57
57 58
  59 + @Override
  60 + public boolean checkPushAuthority(String callId, String sign) {
  61 + if (StringUtils.isEmpty(callId)) {
  62 + return userMapper.checkPushAuthorityByCallId(sign).size() > 0;
  63 + }else {
  64 + return userMapper.checkPushAuthorityByCallIdAndSign(callId, sign).size() > 0;
  65 + }
  66 + }
58 } 67 }
src/main/java/com/genersoft/iot/vmp/storager/IRedisCatchStorage.java
@@ -3,9 +3,7 @@ package com.genersoft.iot.vmp.storager; @@ -3,9 +3,7 @@ package com.genersoft.iot.vmp.storager;
3 import com.alibaba.fastjson.JSONObject; 3 import com.alibaba.fastjson.JSONObject;
4 import com.genersoft.iot.vmp.common.StreamInfo; 4 import com.genersoft.iot.vmp.common.StreamInfo;
5 import com.genersoft.iot.vmp.gb28181.bean.*; 5 import com.genersoft.iot.vmp.gb28181.bean.*;
6 -import com.genersoft.iot.vmp.media.zlm.dto.MediaItem;  
7 -import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem;  
8 -import com.genersoft.iot.vmp.media.zlm.dto.StreamPushItem; 6 +import com.genersoft.iot.vmp.media.zlm.dto.*;
9 import com.genersoft.iot.vmp.service.bean.GPSMsgInfo; 7 import com.genersoft.iot.vmp.service.bean.GPSMsgInfo;
10 import com.genersoft.iot.vmp.service.bean.MessageForPushChannel; 8 import com.genersoft.iot.vmp.service.bean.MessageForPushChannel;
11 import com.genersoft.iot.vmp.service.bean.SSRCInfo; 9 import com.genersoft.iot.vmp.service.bean.SSRCInfo;
@@ -213,4 +211,26 @@ public interface IRedisCatchStorage { @@ -213,4 +211,26 @@ public interface IRedisCatchStorage {
213 */ 211 */
214 public boolean deviceIsOnline(String deviceId); 212 public boolean deviceIsOnline(String deviceId);
215 213
  214 + /**
  215 + * 存储推流的鉴权信息
  216 + * @param app 应用名
  217 + * @param stream 流
  218 + * @param streamAuthorityInfo 鉴权信息
  219 + */
  220 + void updateStreamAuthorityInfo(String app, String stream, StreamAuthorityInfo streamAuthorityInfo);
  221 +
  222 + /**
  223 + * 移除推流的鉴权信息
  224 + * @param app 应用名
  225 + * @param streamId 流
  226 + */
  227 + void removeStreamAuthorityInfo(String app, String streamId);
  228 +
  229 + /**
  230 + * 获取推流的鉴权信息
  231 + * @param app 应用名
  232 + * @param stream 流
  233 + * @return
  234 + */
  235 + StreamAuthorityInfo getStreamAuthorityInfo(String app, String stream);
216 } 236 }
src/main/java/com/genersoft/iot/vmp/storager/IVideoManagerStorage.java
@@ -372,14 +372,16 @@ public interface IVideoManagerStorage { @@ -372,14 +372,16 @@ public interface IVideoManagerStorage {
372 372
373 /** 373 /**
374 * 设置流离线 374 * 设置流离线
375 - * @param app  
376 - * @param streamId  
377 */ 375 */
378 - int mediaOutline(String app, String streamId); 376 + int mediaOffline(String app, String streamId);
  377 +
  378 + /**
  379 + * 设置流上线
  380 + */
  381 + int mediaOnline(String app, String streamId);
379 382
380 /** 383 /**
381 * 设置平台在线/离线 384 * 设置平台在线/离线
382 - * @param online  
383 */ 385 */
384 void updateParentPlatformStatus(String platformGbID, boolean online); 386 void updateParentPlatformStatus(String platformGbID, boolean online);
385 387
@@ -463,5 +465,5 @@ public interface IVideoManagerStorage { @@ -463,5 +465,5 @@ public interface IVideoManagerStorage {
463 465
464 List<ChannelSourceInfo> getChannelSource(String platformId, String gbId); 466 List<ChannelSourceInfo> getChannelSource(String platformId, String gbId);
465 467
466 - void updateChannelPotion(String deviceId, String channelId, double longitude, double latitude); 468 + void updateChannelPosition(DeviceChannel deviceChannel);
467 } 469 }
src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceAlarmMapper.java
@@ -15,8 +15,8 @@ import java.util.List; @@ -15,8 +15,8 @@ import java.util.List;
15 @Repository 15 @Repository
16 public interface DeviceAlarmMapper { 16 public interface DeviceAlarmMapper {
17 17
18 - @Insert("INSERT INTO device_alarm (deviceId, channelId, alarmPriority, alarmMethod, alarmTime, alarmDescription, longitude, latitude, alarmType ) " +  
19 - "VALUES ('${deviceId}', '${channelId}', '${alarmPriority}', '${alarmMethod}', '${alarmTime}', '${alarmDescription}', ${longitude}, ${latitude}, '${alarmType}')") 18 + @Insert("INSERT INTO device_alarm (deviceId, channelId, alarmPriority, alarmMethod, alarmTime, alarmDescription, longitude, latitude, alarmType , createTime ) " +
  19 + "VALUES ('${deviceId}', '${channelId}', '${alarmPriority}', '${alarmMethod}', '${alarmTime}', '${alarmDescription}', ${longitude}, ${latitude}, '${alarmType}', '${createTime}')")
20 int add(DeviceAlarm alarm); 20 int add(DeviceAlarm alarm);
21 21
22 22
src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceChannelMapper.java
@@ -19,11 +19,11 @@ public interface DeviceChannelMapper { @@ -19,11 +19,11 @@ public interface DeviceChannelMapper {
19 @Insert("INSERT INTO device_channel (channelId, deviceId, name, manufacture, model, owner, civilCode, block, " + 19 @Insert("INSERT INTO device_channel (channelId, deviceId, name, manufacture, model, owner, civilCode, block, " +
20 "address, parental, parentId, safetyWay, registerWay, certNum, certifiable, errCode, secrecy, " + 20 "address, parental, parentId, safetyWay, registerWay, certNum, certifiable, errCode, secrecy, " +
21 "ipAddress, port, password, PTZType, status, streamId, longitude, latitude, longitudeGcj02, latitudeGcj02, " + 21 "ipAddress, port, password, PTZType, status, streamId, longitude, latitude, longitudeGcj02, latitudeGcj02, " +
22 - "longitudeWgs84, latitudeWgs84, createTime, updateTime, businessGroupId) " + 22 + "longitudeWgs84, latitudeWgs84, createTime, updateTime, businessGroupId, gpsTime) " +
23 "VALUES ('${channelId}', '${deviceId}', '${name}', '${manufacture}', '${model}', '${owner}', '${civilCode}', '${block}'," + 23 "VALUES ('${channelId}', '${deviceId}', '${name}', '${manufacture}', '${model}', '${owner}', '${civilCode}', '${block}'," +
24 "'${address}', ${parental}, '${parentId}', ${safetyWay}, ${registerWay}, '${certNum}', ${certifiable}, ${errCode}, '${secrecy}', " + 24 "'${address}', ${parental}, '${parentId}', ${safetyWay}, ${registerWay}, '${certNum}', ${certifiable}, ${errCode}, '${secrecy}', " +
25 "'${ipAddress}', ${port}, '${password}', ${PTZType}, ${status}, '${streamId}', ${longitude}, ${latitude}, ${longitudeGcj02}, " + 25 "'${ipAddress}', ${port}, '${password}', ${PTZType}, ${status}, '${streamId}', ${longitude}, ${latitude}, ${longitudeGcj02}, " +
26 - "${latitudeGcj02}, ${longitudeWgs84}, ${latitudeWgs84},'${createTime}', '${updateTime}', '${businessGroupId}')") 26 + "${latitudeGcj02}, ${longitudeWgs84}, ${latitudeWgs84},'${createTime}', '${updateTime}', '${businessGroupId}', '${gpsTime}')")
27 int add(DeviceChannel channel); 27 int add(DeviceChannel channel);
28 28
29 @Update(value = {" <script>" + 29 @Update(value = {" <script>" +
@@ -58,6 +58,7 @@ public interface DeviceChannelMapper { @@ -58,6 +58,7 @@ public interface DeviceChannelMapper {
58 "<if test='longitudeWgs84 != null'>, longitudeWgs84=${longitudeWgs84}</if>" + 58 "<if test='longitudeWgs84 != null'>, longitudeWgs84=${longitudeWgs84}</if>" +
59 "<if test='latitudeWgs84 != null'>, latitudeWgs84=${latitudeWgs84}</if>" + 59 "<if test='latitudeWgs84 != null'>, latitudeWgs84=${latitudeWgs84}</if>" +
60 "<if test='businessGroupId != null'>, businessGroupId=#{businessGroupId}</if>" + 60 "<if test='businessGroupId != null'>, businessGroupId=#{businessGroupId}</if>" +
  61 + "<if test='gpsTime != null'>, gpsTime=#{gpsTime}</if>" +
61 "WHERE deviceId='${deviceId}' AND channelId='${channelId}'"+ 62 "WHERE deviceId='${deviceId}' AND channelId='${channelId}'"+
62 " </script>"}) 63 " </script>"})
63 int update(DeviceChannel channel); 64 int update(DeviceChannel channel);
@@ -147,7 +148,7 @@ public interface DeviceChannelMapper { @@ -147,7 +148,7 @@ public interface DeviceChannelMapper {
147 "(channelId, deviceId, name, manufacture, model, owner, civilCode, block, subCount, " + 148 "(channelId, deviceId, name, manufacture, model, owner, civilCode, block, subCount, " +
148 " address, parental, parentId, safetyWay, registerWay, certNum, certifiable, errCode, secrecy, " + 149 " address, parental, parentId, safetyWay, registerWay, certNum, certifiable, errCode, secrecy, " +
149 " ipAddress, port, password, PTZType, status, streamId, longitude, latitude, longitudeGcj02, latitudeGcj02, " + 150 " ipAddress, port, password, PTZType, status, streamId, longitude, latitude, longitudeGcj02, latitudeGcj02, " +
150 - " longitudeWgs84, latitudeWgs84, createTime, updateTime, businessGroupId) " + 151 + " longitudeWgs84, latitudeWgs84, createTime, updateTime, businessGroupId, gpsTime) " +
151 "values " + 152 "values " +
152 "<foreach collection='addChannels' index='index' item='item' separator=','> " + 153 "<foreach collection='addChannels' index='index' item='item' separator=','> " +
153 "('${item.channelId}', '${item.deviceId}', '${item.name}', '${item.manufacture}', '${item.model}', " + 154 "('${item.channelId}', '${item.deviceId}', '${item.name}', '${item.manufacture}', '${item.model}', " +
@@ -157,7 +158,7 @@ public interface DeviceChannelMapper { @@ -157,7 +158,7 @@ public interface DeviceChannelMapper {
157 "'${item.ipAddress}', ${item.port}, '${item.password}', ${item.PTZType}, ${item.status}, " + 158 "'${item.ipAddress}', ${item.port}, '${item.password}', ${item.PTZType}, ${item.status}, " +
158 "'${item.streamId}', ${item.longitude}, ${item.latitude},${item.longitudeGcj02}, " + 159 "'${item.streamId}', ${item.longitude}, ${item.latitude},${item.longitudeGcj02}, " +
159 "${item.latitudeGcj02},${item.longitudeWgs84}, ${item.latitudeWgs84},'${item.createTime}', '${item.updateTime}', " + 160 "${item.latitudeGcj02},${item.longitudeWgs84}, ${item.latitudeWgs84},'${item.createTime}', '${item.updateTime}', " +
160 - "'${item.businessGroupId}') " + 161 + "'${item.businessGroupId}', '${item.gpsTime}') " +
161 "</foreach> " + 162 "</foreach> " +
162 "ON DUPLICATE KEY UPDATE " + 163 "ON DUPLICATE KEY UPDATE " +
163 "updateTime=VALUES(updateTime), " + 164 "updateTime=VALUES(updateTime), " +
@@ -189,7 +190,8 @@ public interface DeviceChannelMapper { @@ -189,7 +190,8 @@ public interface DeviceChannelMapper {
189 "latitudeGcj02=VALUES(latitudeGcj02), " + 190 "latitudeGcj02=VALUES(latitudeGcj02), " +
190 "longitudeWgs84=VALUES(longitudeWgs84), " + 191 "longitudeWgs84=VALUES(longitudeWgs84), " +
191 "latitudeWgs84=VALUES(latitudeWgs84), " + 192 "latitudeWgs84=VALUES(latitudeWgs84), " +
192 - "businessGroupId=VALUES(businessGroupId) " + 193 + "businessGroupId=VALUES(businessGroupId), " +
  194 + "gpsTime=VALUES(gpsTime)" +
193 "</script>") 195 "</script>")
194 int batchAdd(List<DeviceChannel> addChannels); 196 int batchAdd(List<DeviceChannel> addChannels);
195 197
@@ -228,6 +230,7 @@ public interface DeviceChannelMapper { @@ -228,6 +230,7 @@ public interface DeviceChannelMapper {
228 "<if test='item.longitudeWgs84 != null'>, longitudeWgs84=${item.longitudeWgs84}</if>" + 230 "<if test='item.longitudeWgs84 != null'>, longitudeWgs84=${item.longitudeWgs84}</if>" +
229 "<if test='item.latitudeWgs84 != null'>, latitudeWgs84=${item.latitudeWgs84}</if>" + 231 "<if test='item.latitudeWgs84 != null'>, latitudeWgs84=${item.latitudeWgs84}</if>" +
230 "<if test='item.businessGroupId != null'>, businessGroupId=#{item.businessGroupId}</if>" + 232 "<if test='item.businessGroupId != null'>, businessGroupId=#{item.businessGroupId}</if>" +
  233 + "<if test='item.gpsTime != null'>, gpsTime=#{item.gpsTime}</if>" +
231 "WHERE deviceId='${item.deviceId}' AND channelId='${item.channelId}'"+ 234 "WHERE deviceId='${item.deviceId}' AND channelId='${item.channelId}'"+
232 "</foreach>" + 235 "</foreach>" +
233 "</script>"}) 236 "</script>"})
@@ -276,8 +279,20 @@ public interface DeviceChannelMapper { @@ -276,8 +279,20 @@ public interface DeviceChannelMapper {
276 " and channelId = #{channelId}") 279 " and channelId = #{channelId}")
277 int updateChannelSubCount(String deviceId, String channelId); 280 int updateChannelSubCount(String deviceId, String channelId);
278 281
279 - @Update(value = {"UPDATE device_channel SET latitude=${latitude}, longitude=${longitude} WHERE deviceId=#{deviceId} AND channelId=#{channelId}"})  
280 - void updatePotion(String deviceId, String channelId, double longitude, double latitude); 282 + @Update(value = {" <script>" +
  283 + "UPDATE device_channel " +
  284 + "SET " +
  285 + "latitude=${latitude}, " +
  286 + "longitude=${longitude}, " +
  287 + "longitudeGcj02=${longitudeGcj02}, " +
  288 + "latitudeGcj02=${latitudeGcj02}, " +
  289 + "longitudeWgs84=${longitudeWgs84}, " +
  290 + "latitudeWgs84=${latitudeWgs84}, " +
  291 + "gpsTime='${gpsTime}' " +
  292 + "WHERE deviceId=#{deviceId} " +
  293 + " <if test='channelId != null' > AND channelId=#{channelId}</if>" +
  294 + " </script>"})
  295 + void updatePosition(DeviceChannel deviceChannel);
281 296
282 @Select("SELECT * FROM device_channel WHERE length(trim(streamId)) > 0") 297 @Select("SELECT * FROM device_channel WHERE length(trim(streamId)) > 0")
283 List<DeviceChannel> getAllChannelInPlay(); 298 List<DeviceChannel> getAllChannelInPlay();
@@ -313,4 +328,6 @@ public interface DeviceChannelMapper { @@ -313,4 +328,6 @@ public interface DeviceChannelMapper {
313 328
314 @Select("select * from device_channel where deviceId=#{deviceId} and SUBSTRING(channelId, 11, 3)=#{typeCode}") 329 @Select("select * from device_channel where deviceId=#{deviceId} and SUBSTRING(channelId, 11, 3)=#{typeCode}")
315 List<DeviceChannel> getBusinessGroups(String deviceId, String typeCode); 330 List<DeviceChannel> getBusinessGroups(String deviceId, String typeCode);
  331 +
  332 +
316 } 333 }
src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceMobilePositionMapper.java
@@ -4,19 +4,18 @@ import java.util.List; @@ -4,19 +4,18 @@ import java.util.List;
4 4
5 import com.genersoft.iot.vmp.gb28181.bean.MobilePosition; 5 import com.genersoft.iot.vmp.gb28181.bean.MobilePosition;
6 import org.apache.ibatis.annotations.*; 6 import org.apache.ibatis.annotations.*;
7 -//import org.springframework.stereotype.Repository;  
8 7
9 @Mapper 8 @Mapper
10 -//@Repository  
11 public interface DeviceMobilePositionMapper { 9 public interface DeviceMobilePositionMapper {
12 10
13 - @Insert("INSERT INTO device_mobile_position (deviceId,channelId, deviceName, time, longitude, latitude, altitude, speed, direction, reportSource, geodeticSystem, cnLng, cnLat) " +  
14 - "VALUES ('${deviceId}','${channelId}', '${deviceName}', '${time}', ${longitude}, ${latitude}, ${altitude}, ${speed}, ${direction}, '${reportSource}', '${geodeticSystem}', '${cnLng}', '${cnLat}')") 11 + @Insert("INSERT INTO device_mobile_position (deviceId,channelId, deviceName, time, longitude, latitude, altitude, speed, direction, reportSource, longitudeGcj02, latitudeGcj02, longitudeWgs84, latitudeWgs84, createTime) " +
  12 + "VALUES ('${deviceId}','${channelId}', '${deviceName}', '${time}', ${longitude}, ${latitude}, ${altitude}, ${speed}, ${direction}, '${reportSource}', ${longitudeGcj02}, ${latitudeGcj02}, ${longitudeWgs84}, ${latitudeWgs84}, '${createTime}')")
15 int insertNewPosition(MobilePosition mobilePosition); 13 int insertNewPosition(MobilePosition mobilePosition);
16 14
17 @Select(value = {" <script>" + 15 @Select(value = {" <script>" +
18 "SELECT * FROM device_mobile_position" + 16 "SELECT * FROM device_mobile_position" +
19 - " WHERE deviceId = #{deviceId} and channelId = #{channelId} " + 17 + " WHERE deviceId = #{deviceId}" +
  18 + "<if test=\"channelId != null\"> and channelId = #{channelId}</if>" +
20 "<if test=\"startTime != null\"> AND time&gt;=#{startTime}</if>" + 19 "<if test=\"startTime != null\"> AND time&gt;=#{startTime}</if>" +
21 "<if test=\"endTime != null\"> AND time&lt;=#{endTime}</if>" + 20 "<if test=\"endTime != null\"> AND time&lt;=#{endTime}</if>" +
22 " ORDER BY time ASC" + 21 " ORDER BY time ASC" +
src/main/java/com/genersoft/iot/vmp/storager/dao/GbStreamMapper.java
@@ -15,10 +15,10 @@ import java.util.List; @@ -15,10 +15,10 @@ import java.util.List;
15 public interface GbStreamMapper { 15 public interface GbStreamMapper {
16 16
17 @Insert("REPLACE INTO gb_stream (app, stream, gbId, name, " + 17 @Insert("REPLACE INTO gb_stream (app, stream, gbId, name, " +
18 - "longitude, latitude, streamType, mediaServerId, status, createStamp) VALUES" + 18 + "longitude, latitude, streamType, mediaServerId, status, createTime) VALUES" +
19 "('${app}', '${stream}', '${gbId}', '${name}', " + 19 "('${app}', '${stream}', '${gbId}', '${name}', " +
20 "'${longitude}', '${latitude}', '${streamType}', " + 20 "'${longitude}', '${latitude}', '${streamType}', " +
21 - "'${mediaServerId}', ${status}, ${createStamp})") 21 + "'${mediaServerId}', ${status}, '${createTime}')")
22 @Options(useGeneratedKeys = true, keyProperty = "gbStreamId", keyColumn = "gbStreamId") 22 @Options(useGeneratedKeys = true, keyProperty = "gbStreamId", keyColumn = "gbStreamId")
23 int add(GbStream gbStream); 23 int add(GbStream gbStream);
24 24
@@ -68,7 +68,7 @@ public interface GbStreamMapper { @@ -68,7 +68,7 @@ public interface GbStreamMapper {
68 List<GbStream> selectAll(String platformId, String catalogId, String query, Boolean pushing, String mediaServerId); 68 List<GbStream> selectAll(String platformId, String catalogId, String query, Boolean pushing, String mediaServerId);
69 69
70 @Select("SELECT * FROM gb_stream WHERE app=#{app} AND stream=#{stream}") 70 @Select("SELECT * FROM gb_stream WHERE app=#{app} AND stream=#{stream}")
71 - StreamProxyItem selectOne(String app, String stream); 71 + GbStream selectOne(String app, String stream);
72 72
73 @Select("SELECT * FROM gb_stream WHERE gbId=#{gbId}") 73 @Select("SELECT * FROM gb_stream WHERE gbId=#{gbId}")
74 List<GbStream> selectByGBId(String gbId); 74 List<GbStream> selectByGBId(String gbId);
@@ -88,16 +88,6 @@ public interface GbStreamMapper { @@ -88,16 +88,6 @@ public interface GbStreamMapper {
88 "ON gs.gbStreamId = pgs.gbStreamId WHERE pgs.gbStreamId is NULL") 88 "ON gs.gbStreamId = pgs.gbStreamId WHERE pgs.gbStreamId is NULL")
89 List<GbStream> queryStreamNotInPlatform(); 89 List<GbStream> queryStreamNotInPlatform();
90 90
91 - @Update("UPDATE gb_stream " +  
92 - "SET status=${status} " +  
93 - "WHERE app=#{app} AND stream=#{stream}")  
94 - int setStatus(String app, String stream, boolean status);  
95 -  
96 - @Update("UPDATE gb_stream " +  
97 - "SET status=${status} " +  
98 - "WHERE mediaServerId=#{mediaServerId} ")  
99 - void updateStatusByMediaServerId(String mediaServerId, boolean status);  
100 -  
101 @Delete("DELETE FROM gb_stream WHERE streamType=#{type} AND gbId=NULL AND mediaServerId=#{mediaServerId}") 91 @Delete("DELETE FROM gb_stream WHERE streamType=#{type} AND gbId=NULL AND mediaServerId=#{mediaServerId}")
102 void deleteWithoutGBId(String type, String mediaServerId); 92 void deleteWithoutGBId(String type, String mediaServerId);
103 93
@@ -120,12 +110,12 @@ public interface GbStreamMapper { @@ -120,12 +110,12 @@ public interface GbStreamMapper {
120 @Insert("<script> " + 110 @Insert("<script> " +
121 "INSERT IGNORE into gb_stream " + 111 "INSERT IGNORE into gb_stream " +
122 "(app, stream, gbId, name, " + 112 "(app, stream, gbId, name, " +
123 - "longitude, latitude, streamType, mediaServerId, status, createStamp)" + 113 + "longitude, latitude, streamType, mediaServerId, status, createTime)" +
124 "values " + 114 "values " +
125 "<foreach collection='subList' index='index' item='item' separator=','> " + 115 "<foreach collection='subList' index='index' item='item' separator=','> " +
126 "('${item.app}', '${item.stream}', '${item.gbId}', '${item.name}', " + 116 "('${item.app}', '${item.stream}', '${item.gbId}', '${item.name}', " +
127 "'${item.longitude}', '${item.latitude}', '${item.streamType}', " + 117 "'${item.longitude}', '${item.latitude}', '${item.streamType}', " +
128 - "'${item.mediaServerId}', ${item.status}, ${item.createStamp}) "+ 118 + "'${item.mediaServerId}', ${item.status}, '${item.createTime}') "+
129 "</foreach> " + 119 "</foreach> " +
130 "</script>") 120 "</script>")
131 @Options(useGeneratedKeys = true, keyProperty = "gbStreamId", keyColumn = "gbStreamId") 121 @Options(useGeneratedKeys = true, keyProperty = "gbStreamId", keyColumn = "gbStreamId")
src/main/java/com/genersoft/iot/vmp/storager/dao/ParentPlatformMapper.java
@@ -16,10 +16,10 @@ public interface ParentPlatformMapper { @@ -16,10 +16,10 @@ public interface ParentPlatformMapper {
16 16
17 @Insert("INSERT INTO parent_platform (enable, name, serverGBId, serverGBDomain, serverIP, serverPort, deviceGBId, deviceIp, " + 17 @Insert("INSERT INTO parent_platform (enable, name, serverGBId, serverGBDomain, serverIP, serverPort, deviceGBId, deviceIp, " +
18 " devicePort, username, password, expires, keepTimeout, transport, characterSet, ptz, rtcp, " + 18 " devicePort, username, password, expires, keepTimeout, transport, characterSet, ptz, rtcp, " +
19 - " status, shareAllLiveStream, startOfflinePush, catalogId, administrativeDivision, catalogGroup) " + 19 + " status, shareAllLiveStream, startOfflinePush, catalogId, administrativeDivision, catalogGroup, createTime, updateTime) " +
20 " VALUES (${enable}, '${name}', '${serverGBId}', '${serverGBDomain}', '${serverIP}', ${serverPort}, '${deviceGBId}', '${deviceIp}', " + 20 " VALUES (${enable}, '${name}', '${serverGBId}', '${serverGBDomain}', '${serverIP}', ${serverPort}, '${deviceGBId}', '${deviceIp}', " +
21 " '${devicePort}', '${username}', '${password}', '${expires}', '${keepTimeout}', '${transport}', '${characterSet}', ${ptz}, ${rtcp}, " + 21 " '${devicePort}', '${username}', '${password}', '${expires}', '${keepTimeout}', '${transport}', '${characterSet}', ${ptz}, ${rtcp}, " +
22 - " ${status}, ${shareAllLiveStream}, ${startOfflinePush}, #{catalogId}, #{administrativeDivision}, #{catalogGroup})") 22 + " ${status}, ${shareAllLiveStream}, ${startOfflinePush}, #{catalogId}, #{administrativeDivision}, #{catalogGroup}, #{createTime}, #{updateTime})")
23 int addParentPlatform(ParentPlatform parentPlatform); 23 int addParentPlatform(ParentPlatform parentPlatform);
24 24
25 @Update("UPDATE parent_platform " + 25 @Update("UPDATE parent_platform " +
@@ -45,6 +45,8 @@ public interface ParentPlatformMapper { @@ -45,6 +45,8 @@ public interface ParentPlatformMapper {
45 "startOfflinePush=${startOfflinePush}, " + 45 "startOfflinePush=${startOfflinePush}, " +
46 "catalogGroup=#{catalogGroup}, " + 46 "catalogGroup=#{catalogGroup}, " +
47 "administrativeDivision=#{administrativeDivision}, " + 47 "administrativeDivision=#{administrativeDivision}, " +
  48 + "createTime=#{createTime}, " +
  49 + "updateTime=#{updateTime}, " +
48 "catalogId=#{catalogId} " + 50 "catalogId=#{catalogId} " +
49 "WHERE id=#{id}") 51 "WHERE id=#{id}")
50 int updateParentPlatform(ParentPlatform parentPlatform); 52 int updateParentPlatform(ParentPlatform parentPlatform);
@@ -86,10 +88,10 @@ public interface ParentPlatformMapper { @@ -86,10 +88,10 @@ public interface ParentPlatformMapper {
86 88
87 @Update(value = {" <script>" + 89 @Update(value = {" <script>" +
88 "UPDATE parent_platform " + 90 "UPDATE parent_platform " +
89 - "SET catalogId=#{catalogId}" + 91 + "SET catalogId=#{catalogId}, updateTime=#{updateTime}" +
90 "WHERE serverGBId=#{platformId}"+ 92 "WHERE serverGBId=#{platformId}"+
91 "</script>"}) 93 "</script>"})
92 - int setDefaultCatalog(String platformId, String catalogId); 94 + int setDefaultCatalog(String platformId, String catalogId, String updateTime);
93 95
94 @Select("select 'channel' as name, count(pgc.platformId) count from platform_gb_channel pgc left join device_channel dc on dc.id = pgc.deviceChannelId where pgc.platformId=#{platformId} and dc.channelId =#{gbId} " + 96 @Select("select 'channel' as name, count(pgc.platformId) count from platform_gb_channel pgc left join device_channel dc on dc.id = pgc.deviceChannelId where pgc.platformId=#{platformId} and dc.channelId =#{gbId} " +
95 "union " + 97 "union " +
src/main/java/com/genersoft/iot/vmp/storager/dao/StreamProxyMapper.java
@@ -62,12 +62,12 @@ public interface StreamProxyMapper { @@ -62,12 +62,12 @@ public interface StreamProxyMapper {
62 @Update("UPDATE stream_proxy " + 62 @Update("UPDATE stream_proxy " +
63 "SET status=#{status} " + 63 "SET status=#{status} " +
64 "WHERE mediaServerId=#{mediaServerId}") 64 "WHERE mediaServerId=#{mediaServerId}")
65 - void updateStatusByMediaServerId(boolean status, String mediaServerId); 65 + void updateStatusByMediaServerId(String mediaServerId, boolean status);
66 66
67 @Update("UPDATE stream_proxy " + 67 @Update("UPDATE stream_proxy " +
68 "SET status=${status} " + 68 "SET status=${status} " +
69 "WHERE app=#{app} AND stream=#{stream}") 69 "WHERE app=#{app} AND stream=#{stream}")
70 - int updateStatus(boolean status, String app, String stream); 70 + int updateStatus(String app, String stream, boolean status);
71 71
72 @Delete("DELETE FROM stream_proxy WHERE enable_remove_none_reader=true AND mediaServerId=#{mediaServerId}") 72 @Delete("DELETE FROM stream_proxy WHERE enable_remove_none_reader=true AND mediaServerId=#{mediaServerId}")
73 void deleteAutoRemoveItemByMediaServerId(String mediaServerId); 73 void deleteAutoRemoveItemByMediaServerId(String mediaServerId);
src/main/java/com/genersoft/iot/vmp/storager/dao/StreamPushMapper.java
@@ -14,21 +14,23 @@ import java.util.List; @@ -14,21 +14,23 @@ import java.util.List;
14 public interface StreamPushMapper { 14 public interface StreamPushMapper {
15 15
16 @Insert("INSERT INTO stream_push (app, stream, totalReaderCount, originType, originTypeStr, " + 16 @Insert("INSERT INTO stream_push (app, stream, totalReaderCount, originType, originTypeStr, " +
17 - "createStamp, aliveSecond, mediaServerId, serverId) VALUES" + 17 + "pushTime, aliveSecond, mediaServerId, serverId, updateTime, createTime) VALUES" +
18 "('${app}', '${stream}', '${totalReaderCount}', '${originType}', '${originTypeStr}', " + 18 "('${app}', '${stream}', '${totalReaderCount}', '${originType}', '${originTypeStr}', " +
19 - "'${createStamp}', '${aliveSecond}', '${mediaServerId}' , '${serverId}' )") 19 + "'${pushTime}', '${aliveSecond}', '${mediaServerId}' , '${serverId}' , '${updateTime}' , '${createTime}' )")
20 int add(StreamPushItem streamPushItem); 20 int add(StreamPushItem streamPushItem);
21 21
22 - @Update("UPDATE stream_push " +  
23 - "SET app=#{app}," +  
24 - "stream=#{stream}," +  
25 - "mediaServerId=#{mediaServerId}," +  
26 - "totalReaderCount=#{totalReaderCount}, " +  
27 - "originType=#{originType}," +  
28 - "originTypeStr=#{originTypeStr}, " +  
29 - "createStamp=#{createStamp}, " +  
30 - "aliveSecond=#{aliveSecond} " +  
31 - "WHERE app=#{app} AND stream=#{stream}") 22 +
  23 + @Update(value = {" <script>" +
  24 + "UPDATE stream_push " +
  25 + "SET updateTime='${updateTime}'" +
  26 + "<if test=\"mediaServerId != null\">, mediaServerId='${mediaServerId}'</if>" +
  27 + "<if test=\"totalReaderCount != null\">, totalReaderCount='${totalReaderCount}'</if>" +
  28 + "<if test=\"originType != null\">, originType=${originType}</if>" +
  29 + "<if test=\"originTypeStr != null\">, originTypeStr='${originTypeStr}'</if>" +
  30 + "<if test=\"pushTime != null\">, pushTime='${pushTime}'</if>" +
  31 + "<if test=\"aliveSecond != null\">, aliveSecond='${aliveSecond}'</if>" +
  32 + "WHERE app=#{app} AND stream=#{stream}"+
  33 + " </script>"})
32 int update(StreamPushItem streamPushItem); 34 int update(StreamPushItem streamPushItem);
33 35
34 @Delete("DELETE FROM stream_push WHERE app=#{app} AND stream=#{stream}") 36 @Delete("DELETE FROM stream_push WHERE app=#{app} AND stream=#{stream}")
@@ -62,7 +64,7 @@ public interface StreamPushMapper { @@ -62,7 +64,7 @@ public interface StreamPushMapper {
62 @Select(value = {" <script>" + 64 @Select(value = {" <script>" +
63 "SELECT " + 65 "SELECT " +
64 "st.*, " + 66 "st.*, " +
65 - "gs.gbId, gs.status, gs.name, gs.longitude, gs.latitude, gs.gbStreamId " + 67 + "gs.gbId, gs.name, gs.longitude, gs.latitude, gs.gbStreamId " +
66 "from " + 68 "from " +
67 "stream_push st " + 69 "stream_push st " +
68 "LEFT JOIN gb_stream gs " + 70 "LEFT JOIN gb_stream gs " +
@@ -70,25 +72,25 @@ public interface StreamPushMapper { @@ -70,25 +72,25 @@ public interface StreamPushMapper {
70 "WHERE " + 72 "WHERE " +
71 "1=1 " + 73 "1=1 " +
72 " <if test='query != null'> AND (st.app LIKE '%${query}%' OR st.stream LIKE '%${query}%' OR gs.gbId LIKE '%${query}%' OR gs.name LIKE '%${query}%')</if> " + 74 " <if test='query != null'> AND (st.app LIKE '%${query}%' OR st.stream LIKE '%${query}%' OR gs.gbId LIKE '%${query}%' OR gs.name LIKE '%${query}%')</if> " +
73 - " <if test='pushing == true' > AND (gs.gbId is null OR gs.status=1)</if>" +  
74 - " <if test='pushing == false' > AND gs.status=0</if>" + 75 + " <if test='pushing == true' > AND (gs.gbId is null OR st.status=1)</if>" +
  76 + " <if test='pushing == false' > AND st.status=0</if>" +
75 " <if test='mediaServerId != null' > AND st.mediaServerId=#{mediaServerId} </if>" + 77 " <if test='mediaServerId != null' > AND st.mediaServerId=#{mediaServerId} </if>" +
76 - "order by st.createStamp desc" + 78 + "order by st.createTime desc" +
77 " </script>"}) 79 " </script>"})
78 List<StreamPushItem> selectAllForList(String query, Boolean pushing, String mediaServerId); 80 List<StreamPushItem> selectAllForList(String query, Boolean pushing, String mediaServerId);
79 81
80 - @Select("SELECT st.*, gs.gbId, gs.status, gs.name, gs.longitude, gs.latitude FROM stream_push st LEFT JOIN gb_stream gs on st.app = gs.app AND st.stream = gs.stream order by st.createStamp desc") 82 + @Select("SELECT st.*, gs.gbId, gs.name, gs.longitude, gs.latitude FROM stream_push st LEFT JOIN gb_stream gs on st.app = gs.app AND st.stream = gs.stream order by st.createTime desc")
81 List<StreamPushItem> selectAll(); 83 List<StreamPushItem> selectAll();
82 84
83 - @Select("SELECT st.*, gs.gbId, gs.status, gs.name, gs.longitude, gs.latitude FROM stream_push st LEFT JOIN gb_stream gs on st.app = gs.app AND st.stream = gs.stream WHERE st.app=#{app} AND st.stream=#{stream}") 85 + @Select("SELECT st.*, gs.gbId, gs.name, gs.longitude, gs.latitude FROM stream_push st LEFT JOIN gb_stream gs on st.app = gs.app AND st.stream = gs.stream WHERE st.app=#{app} AND st.stream=#{stream}")
84 StreamPushItem selectOne(String app, String stream); 86 StreamPushItem selectOne(String app, String stream);
85 87
86 @Insert("<script>" + 88 @Insert("<script>" +
87 "Insert IGNORE INTO stream_push (app, stream, totalReaderCount, originType, originTypeStr, " + 89 "Insert IGNORE INTO stream_push (app, stream, totalReaderCount, originType, originTypeStr, " +
88 - "createStamp, aliveSecond, mediaServerId) " + 90 + "createTime, aliveSecond, mediaServerId) " +
89 "VALUES <foreach collection='streamPushItems' item='item' index='index' separator=','>" + 91 "VALUES <foreach collection='streamPushItems' item='item' index='index' separator=','>" +
90 "( '${item.app}', '${item.stream}', '${item.totalReaderCount}', #{item.originType}, " + 92 "( '${item.app}', '${item.stream}', '${item.totalReaderCount}', #{item.originType}, " +
91 - "'${item.originTypeStr}',#{item.createStamp}, #{item.aliveSecond}, '${item.mediaServerId}' )" + 93 + "'${item.originTypeStr}',#{item.createTime}, #{item.aliveSecond}, '${item.mediaServerId}' )" +
92 " </foreach>" + 94 " </foreach>" +
93 "</script>") 95 "</script>")
94 @Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id") 96 @Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
@@ -106,4 +108,13 @@ public interface StreamPushMapper { @@ -106,4 +108,13 @@ public interface StreamPushMapper {
106 @Select("SELECT sp.* FROM stream_push sp left join gb_stream gs on gs.app = sp.app and gs.stream= sp.stream WHERE sp.mediaServerId=#{mediaServerId} and gs.gbId is null") 108 @Select("SELECT sp.* FROM stream_push sp left join gb_stream gs on gs.app = sp.app and gs.stream= sp.stream WHERE sp.mediaServerId=#{mediaServerId} and gs.gbId is null")
107 List<StreamPushItem> selectAllByMediaServerIdWithOutGbID(String mediaServerId); 109 List<StreamPushItem> selectAllByMediaServerIdWithOutGbID(String mediaServerId);
108 110
  111 + @Update("UPDATE stream_push " +
  112 + "SET status=${status} " +
  113 + "WHERE app=#{app} AND stream=#{stream}")
  114 + int updateStatus(String app, String stream, boolean status);
  115 +
  116 + @Update("UPDATE stream_push " +
  117 + "SET status=#{status} " +
  118 + "WHERE mediaServerId=#{mediaServerId}")
  119 + void updateStatusByMediaServerId(String mediaServerId, boolean status);
109 } 120 }
src/main/java/com/genersoft/iot/vmp/storager/dao/UserMapper.java
@@ -10,13 +10,14 @@ import java.util.List; @@ -10,13 +10,14 @@ import java.util.List;
10 @Repository 10 @Repository
11 public interface UserMapper { 11 public interface UserMapper {
12 12
13 - @Insert("INSERT INTO user (username, password, roleId, createTime, updateTime) VALUES" +  
14 - "('${username}', '${password}', '${role.id}', '${createTime}', '${updateTime}')") 13 + @Insert("INSERT INTO user (username, password, roleId, pushKey, createTime, updateTime) VALUES" +
  14 + "('${username}', '${password}', '${role.id}', '${pushKey}', '${createTime}', '${updateTime}')")
15 int add(User user); 15 int add(User user);
16 16
17 @Update(value = {" <script>" + 17 @Update(value = {" <script>" +
18 "UPDATE user " + 18 "UPDATE user " +
19 "SET updateTime='${updateTime}' " + 19 "SET updateTime='${updateTime}' " +
  20 + "<if test=\"pushKey != null\">, pushKey='${pushKey}'</if>" +
20 "<if test=\"role != null\">, roleId='${role.id}'</if>" + 21 "<if test=\"role != null\">, roleId='${role.id}'</if>" +
21 "<if test=\"password != null\">, password='${password}'</if>" + 22 "<if test=\"password != null\">, password='${password}'</if>" +
22 "<if test=\"username != null\">, username='${username}'</if>" + 23 "<if test=\"username != null\">, username='${username}'</if>" +
@@ -48,4 +49,10 @@ public interface UserMapper { @@ -48,4 +49,10 @@ public interface UserMapper {
48 @Select("select u.*, r.id as roleID, r.name as roleName, r.authority as roleAuthority , r.createTime as roleCreateTime , r.updateTime as roleUpdateTime FROM user u, user_role r WHERE u.roleId=r.id") 49 @Select("select u.*, r.id as roleID, r.name as roleName, r.authority as roleAuthority , r.createTime as roleCreateTime , r.updateTime as roleUpdateTime FROM user u, user_role r WHERE u.roleId=r.id")
49 @ResultMap(value="roleMap") 50 @ResultMap(value="roleMap")
50 List<User> selectAll(); 51 List<User> selectAll();
  52 +
  53 + @Select("select * from (select user.*, concat('${callId}_', pushKey) as str1 from user) as u where md5(u.str1) = '${sign}'")
  54 + List<User> checkPushAuthorityByCallIdAndSign(String callId, String sign);
  55 +
  56 + @Select("select * from user where md5(pushKey) = '${sign}'")
  57 + List<User> checkPushAuthorityByCallId(String sign);
51 } 58 }
src/main/java/com/genersoft/iot/vmp/storager/dao/dto/User.java
@@ -7,6 +7,7 @@ public class User { @@ -7,6 +7,7 @@ public class User {
7 private String password; 7 private String password;
8 private String createTime; 8 private String createTime;
9 private String updateTime; 9 private String updateTime;
  10 + private String pushKey;
10 private Role role; 11 private Role role;
11 12
12 public int getId() { 13 public int getId() {
@@ -56,4 +57,12 @@ public class User { @@ -56,4 +57,12 @@ public class User {
56 public void setRole(Role role) { 57 public void setRole(Role role) {
57 this.role = role; 58 this.role = role;
58 } 59 }
  60 +
  61 + public String getPushKey() {
  62 + return pushKey;
  63 + }
  64 +
  65 + public void setPushKey(String pushKey) {
  66 + this.pushKey = pushKey;
  67 + }
59 } 68 }
src/main/java/com/genersoft/iot/vmp/storager/impl/RedisCatchStorageImpl.java
@@ -9,6 +9,8 @@ import com.genersoft.iot.vmp.conf.UserSetting; @@ -9,6 +9,8 @@ import com.genersoft.iot.vmp.conf.UserSetting;
9 import com.genersoft.iot.vmp.gb28181.bean.*; 9 import com.genersoft.iot.vmp.gb28181.bean.*;
10 import com.genersoft.iot.vmp.media.zlm.dto.MediaItem; 10 import com.genersoft.iot.vmp.media.zlm.dto.MediaItem;
11 import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem; 11 import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem;
  12 +import com.genersoft.iot.vmp.media.zlm.dto.OnPublishHookParam;
  13 +import com.genersoft.iot.vmp.media.zlm.dto.StreamAuthorityInfo;
12 import com.genersoft.iot.vmp.service.bean.GPSMsgInfo; 14 import com.genersoft.iot.vmp.service.bean.GPSMsgInfo;
13 import com.genersoft.iot.vmp.service.bean.MessageForPushChannel; 15 import com.genersoft.iot.vmp.service.bean.MessageForPushChannel;
14 import com.genersoft.iot.vmp.service.bean.ThirdPartyGB; 16 import com.genersoft.iot.vmp.service.bean.ThirdPartyGB;
@@ -20,6 +22,7 @@ import org.slf4j.Logger; @@ -20,6 +22,7 @@ import org.slf4j.Logger;
20 import org.slf4j.LoggerFactory; 22 import org.slf4j.LoggerFactory;
21 import org.springframework.beans.factory.annotation.Autowired; 23 import org.springframework.beans.factory.annotation.Autowired;
22 import org.springframework.stereotype.Component; 24 import org.springframework.stereotype.Component;
  25 +import org.springframework.util.StringUtils;
23 26
24 import java.util.*; 27 import java.util.*;
25 28
@@ -599,6 +602,26 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { @@ -599,6 +602,26 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage {
599 } 602 }
600 603
601 @Override 604 @Override
  605 + public void updateStreamAuthorityInfo(String app, String stream, StreamAuthorityInfo streamAuthorityInfo) {
  606 + String key = VideoManagerConstants.MEDIA_STREAM_AUTHORITY + userSetting.getServerId() + "_" + app+ "_" + stream;
  607 + redis.set(key, streamAuthorityInfo);
  608 + }
  609 +
  610 + @Override
  611 + public void removeStreamAuthorityInfo(String app, String stream) {
  612 + String key = VideoManagerConstants.MEDIA_STREAM_AUTHORITY + userSetting.getServerId() + "_" + app+ "_" + stream ;
  613 + redis.del(key);
  614 + }
  615 +
  616 + @Override
  617 + public StreamAuthorityInfo getStreamAuthorityInfo(String app, String stream) {
  618 + String key = VideoManagerConstants.MEDIA_STREAM_AUTHORITY + userSetting.getServerId() + "_" + app+ "_" + stream ;
  619 + return (StreamAuthorityInfo) redis.get(key);
  620 +
  621 + }
  622 +
  623 +
  624 + @Override
602 public MediaItem getStreamInfo(String app, String streamId, String mediaServerId) { 625 public MediaItem getStreamInfo(String app, String streamId, String mediaServerId) {
603 String scanKey = VideoManagerConstants.WVP_SERVER_STREAM_PREFIX + userSetting.getServerId() + "_*_" + app + "_" + streamId + "_" + mediaServerId; 626 String scanKey = VideoManagerConstants.WVP_SERVER_STREAM_PREFIX + userSetting.getServerId() + "_*_" + app + "_" + streamId + "_" + mediaServerId;
604 627
@@ -682,4 +705,6 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { @@ -682,4 +705,6 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage {
682 public boolean deviceIsOnline(String deviceId) { 705 public boolean deviceIsOnline(String deviceId) {
683 return getDevice(deviceId).getOnline() == 1; 706 return getDevice(deviceId).getOnline() == 1;
684 } 707 }
  708 +
  709 +
685 } 710 }
src/main/java/com/genersoft/iot/vmp/storager/impl/VideoManagerStorageImpl.java
@@ -472,6 +472,9 @@ public class VideoManagerStorageImpl implements IVideoManagerStorage { @@ -472,6 +472,9 @@ public class VideoManagerStorageImpl implements IVideoManagerStorage {
472 */ 472 */
473 @Override 473 @Override
474 public synchronized boolean insertMobilePosition(MobilePosition mobilePosition) { 474 public synchronized boolean insertMobilePosition(MobilePosition mobilePosition) {
  475 + if (mobilePosition.getDeviceId().equals(mobilePosition.getChannelId())) {
  476 + mobilePosition.setChannelId(null);
  477 + }
475 return deviceMobilePositionMapper.insertNewPosition(mobilePosition) > 0; 478 return deviceMobilePositionMapper.insertNewPosition(mobilePosition) > 0;
476 } 479 }
477 480
@@ -711,7 +714,6 @@ public class VideoManagerStorageImpl implements IVideoManagerStorage { @@ -711,7 +714,6 @@ public class VideoManagerStorageImpl implements IVideoManagerStorage {
711 streamProxyItem.setStatus(true); 714 streamProxyItem.setStatus(true);
712 String now = DateUtil.getNow(); 715 String now = DateUtil.getNow();
713 streamProxyItem.setCreateTime(now); 716 streamProxyItem.setCreateTime(now);
714 - streamProxyItem.setCreateStamp(System.currentTimeMillis());  
715 try { 717 try {
716 if (streamProxyMapper.add(streamProxyItem) > 0) { 718 if (streamProxyMapper.add(streamProxyItem) > 0) {
717 if (!StringUtils.isEmpty(streamProxyItem.getGbId())) { 719 if (!StringUtils.isEmpty(streamProxyItem.getGbId())) {
@@ -846,7 +848,7 @@ public class VideoManagerStorageImpl implements IVideoManagerStorage { @@ -846,7 +848,7 @@ public class VideoManagerStorageImpl implements IVideoManagerStorage {
846 streamPushMapper.addAll(streamPushItems); 848 streamPushMapper.addAll(streamPushItems);
847 // TODO 待优化 849 // TODO 待优化
848 for (int i = 0; i < streamPushItems.size(); i++) { 850 for (int i = 0; i < streamPushItems.size(); i++) {
849 - int onlineResult = gbStreamMapper.setStatus(streamPushItems.get(i).getApp(), streamPushItems.get(i).getStream(), true); 851 + int onlineResult = mediaOnline(streamPushItems.get(i).getApp(), streamPushItems.get(i).getStream());
850 if (onlineResult > 0) { 852 if (onlineResult > 0) {
851 // 发送上线通知 853 // 发送上线通知
852 eventPublisher.catalogEventPublishForStream(null, streamPushItems.get(i), CatalogEvent.ON); 854 eventPublisher.catalogEventPublishForStream(null, streamPushItems.get(i), CatalogEvent.ON);
@@ -854,11 +856,13 @@ public class VideoManagerStorageImpl implements IVideoManagerStorage { @@ -854,11 +856,13 @@ public class VideoManagerStorageImpl implements IVideoManagerStorage {
854 } 856 }
855 } 857 }
856 858
  859 +
  860 +
857 @Override 861 @Override
858 public void updateMedia(StreamPushItem streamPushItem) { 862 public void updateMedia(StreamPushItem streamPushItem) {
859 streamPushMapper.del(streamPushItem.getApp(), streamPushItem.getStream()); 863 streamPushMapper.del(streamPushItem.getApp(), streamPushItem.getStream());
860 streamPushMapper.add(streamPushItem); 864 streamPushMapper.add(streamPushItem);
861 - gbStreamMapper.setStatus(streamPushItem.getApp(), streamPushItem.getStream(), true); 865 + mediaOffline(streamPushItem.getApp(), streamPushItem.getStream());
862 866
863 if(!StringUtils.isEmpty(streamPushItem.getGbId() )){ 867 if(!StringUtils.isEmpty(streamPushItem.getGbId() )){
864 // 查找开启了全部直播流共享的上级平台 868 // 查找开启了全部直播流共享的上级平台
@@ -895,8 +899,26 @@ public class VideoManagerStorageImpl implements IVideoManagerStorage { @@ -895,8 +899,26 @@ public class VideoManagerStorageImpl implements IVideoManagerStorage {
895 } 899 }
896 900
897 @Override 901 @Override
898 - public int mediaOutline(String app, String streamId) {  
899 - return gbStreamMapper.setStatus(app, streamId, false); 902 + public int mediaOffline(String app, String stream) {
  903 + GbStream gbStream = gbStreamMapper.selectOne(app, stream);
  904 + int result;
  905 + if ("proxy".equals(gbStream.getStreamType())) {
  906 + result = streamProxyMapper.updateStatus(app, stream, false);
  907 + }else {
  908 + result = streamPushMapper.updateStatus(app, stream, false);
  909 + }
  910 + return result;
  911 + }
  912 +
  913 + public int mediaOnline(String app, String stream) {
  914 + GbStream gbStream = gbStreamMapper.selectOne(app, stream);
  915 + int result;
  916 + if ("proxy".equals(gbStream.getStreamType())) {
  917 + result = streamProxyMapper.updateStatus(app, stream, true);
  918 + }else {
  919 + result = streamPushMapper.updateStatus(app, stream, true);
  920 + }
  921 + return result;
900 } 922 }
901 923
902 @Override 924 @Override
@@ -1006,7 +1028,7 @@ public class VideoManagerStorageImpl implements IVideoManagerStorage { @@ -1006,7 +1028,7 @@ public class VideoManagerStorageImpl implements IVideoManagerStorage {
1006 1028
1007 @Override 1029 @Override
1008 public int setDefaultCatalog(String platformId, String catalogId) { 1030 public int setDefaultCatalog(String platformId, String catalogId) {
1009 - return platformMapper.setDefaultCatalog(platformId, catalogId); 1031 + return platformMapper.setDefaultCatalog(platformId, catalogId, DateUtil.getNow());
1010 } 1032 }
1011 1033
1012 @Override 1034 @Override
@@ -1119,7 +1141,14 @@ public class VideoManagerStorageImpl implements IVideoManagerStorage { @@ -1119,7 +1141,14 @@ public class VideoManagerStorageImpl implements IVideoManagerStorage {
1119 } 1141 }
1120 1142
1121 @Override 1143 @Override
1122 - public void updateChannelPotion(String deviceId, String channelId, double longitude, double latitude) {  
1123 - deviceChannelMapper.updatePotion(deviceId, channelId, longitude, latitude); 1144 + public void updateChannelPosition(DeviceChannel deviceChannel) {
  1145 + if (deviceChannel.getChannelId().equals(deviceChannel.getDeviceId())) {
  1146 + deviceChannel.setChannelId(null);
  1147 + }
  1148 + if (deviceChannel.getGpsTime() == null) {
  1149 + deviceChannel.setGpsTime(DateUtil.getNow());
  1150 + }
  1151 +
  1152 + deviceChannelMapper.updatePosition(deviceChannel);
1124 } 1153 }
1125 } 1154 }
src/main/java/com/genersoft/iot/vmp/utils/SystemInfoUtils.java
@@ -8,7 +8,6 @@ import oshi.hardware.NetworkIF; @@ -8,7 +8,6 @@ import oshi.hardware.NetworkIF;
8 import oshi.software.os.OperatingSystem; 8 import oshi.software.os.OperatingSystem;
9 import oshi.util.FormatUtil; 9 import oshi.util.FormatUtil;
10 10
11 -import java.text.DecimalFormat;  
12 import java.util.HashMap; 11 import java.util.HashMap;
13 import java.util.List; 12 import java.util.List;
14 import java.util.Map; 13 import java.util.Map;
src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/MobilePosition/MobilePositionController.java
@@ -63,12 +63,13 @@ public class MobilePositionController { @@ -63,12 +63,13 @@ public class MobilePositionController {
63 @ApiOperation("查询历史轨迹") 63 @ApiOperation("查询历史轨迹")
64 @ApiImplicitParams({ 64 @ApiImplicitParams({
65 @ApiImplicitParam(name = "deviceId", value = "设备ID", required = true, dataTypeClass = String.class), 65 @ApiImplicitParam(name = "deviceId", value = "设备ID", required = true, dataTypeClass = String.class),
66 - @ApiImplicitParam(name = "start", value = "开始时间", required = true, dataTypeClass = String.class),  
67 - @ApiImplicitParam(name = "end", value = "结束时间", required = true, dataTypeClass = String.class), 66 + @ApiImplicitParam(name = "channelId", value = "通道ID", required = false, dataTypeClass = String.class),
  67 + @ApiImplicitParam(name = "start", value = "开始时间", required = false, dataTypeClass = String.class),
  68 + @ApiImplicitParam(name = "end", value = "结束时间", required = false, dataTypeClass = String.class),
68 }) 69 })
69 - @GetMapping("/history/{deviceId}/{channelId}") 70 + @GetMapping("/history/{deviceId}")
70 public ResponseEntity<WVPResult<List<MobilePosition>>> positions(@PathVariable String deviceId, 71 public ResponseEntity<WVPResult<List<MobilePosition>>> positions(@PathVariable String deviceId,
71 - @PathVariable String channelId, 72 + @RequestParam(required = false) String channelId,
72 @RequestParam(required = false) String start, 73 @RequestParam(required = false) String start,
73 @RequestParam(required = false) String end) { 74 @RequestParam(required = false) String end) {
74 // if (logger.isDebugEnabled()) { 75 // if (logger.isDebugEnabled()) {
src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/media/MediaController.java
1 package com.genersoft.iot.vmp.vmanager.gb28181.media; 1 package com.genersoft.iot.vmp.vmanager.gb28181.media;
2 2
3 import com.genersoft.iot.vmp.common.StreamInfo; 3 import com.genersoft.iot.vmp.common.StreamInfo;
  4 +import com.genersoft.iot.vmp.conf.security.SecurityUtils;
  5 +import com.genersoft.iot.vmp.conf.security.dto.LoginUser;
  6 +import com.genersoft.iot.vmp.media.zlm.dto.OnPublishHookParam;
  7 +import com.genersoft.iot.vmp.media.zlm.dto.StreamAuthorityInfo;
4 import com.genersoft.iot.vmp.service.IMediaServerService; 8 import com.genersoft.iot.vmp.service.IMediaServerService;
5 import com.genersoft.iot.vmp.service.IStreamPushService; 9 import com.genersoft.iot.vmp.service.IStreamPushService;
6 import com.genersoft.iot.vmp.service.IMediaService; 10 import com.genersoft.iot.vmp.service.IMediaService;
  11 +import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
7 import com.genersoft.iot.vmp.storager.IVideoManagerStorage; 12 import com.genersoft.iot.vmp.storager.IVideoManagerStorage;
8 import com.genersoft.iot.vmp.vmanager.bean.WVPResult; 13 import com.genersoft.iot.vmp.vmanager.bean.WVPResult;
9 import io.swagger.annotations.Api; 14 import io.swagger.annotations.Api;
@@ -16,6 +21,8 @@ import org.springframework.beans.factory.annotation.Autowired; @@ -16,6 +21,8 @@ import org.springframework.beans.factory.annotation.Autowired;
16 import org.springframework.stereotype.Controller; 21 import org.springframework.stereotype.Controller;
17 import org.springframework.web.bind.annotation.*; 22 import org.springframework.web.bind.annotation.*;
18 23
  24 +import javax.servlet.http.HttpServletRequest;
  25 +
19 26
20 @Api(tags = "媒体流相关") 27 @Api(tags = "媒体流相关")
21 @Controller 28 @Controller
@@ -26,17 +33,11 @@ public class MediaController { @@ -26,17 +33,11 @@ public class MediaController {
26 private final static Logger logger = LoggerFactory.getLogger(MediaController.class); 33 private final static Logger logger = LoggerFactory.getLogger(MediaController.class);
27 34
28 @Autowired 35 @Autowired
29 - private IVideoManagerStorage storager;  
30 -  
31 - @Autowired  
32 - private IStreamPushService streamPushService; 36 + private IRedisCatchStorage redisCatchStorage;
33 37
34 @Autowired 38 @Autowired
35 private IMediaService mediaService; 39 private IMediaService mediaService;
36 40
37 - @Autowired  
38 - private IMediaServerService mediaServerService;  
39 -  
40 41
41 /** 42 /**
42 * 根据应用名和流id获取播放地址 43 * 根据应用名和流id获取播放地址
@@ -52,13 +53,47 @@ public class MediaController { @@ -52,13 +53,47 @@ public class MediaController {
52 }) 53 })
53 @GetMapping(value = "/stream_info_by_app_and_stream") 54 @GetMapping(value = "/stream_info_by_app_and_stream")
54 @ResponseBody 55 @ResponseBody
55 - public WVPResult<StreamInfo> getStreamInfoByAppAndStream(@RequestParam String app, @RequestParam String stream, @RequestParam(required = false) String mediaServerId){  
56 - StreamInfo streamInfoByAppAndStreamWithCheck = mediaService.getStreamInfoByAppAndStreamWithCheck(app, stream, mediaServerId); 56 + public WVPResult<StreamInfo> getStreamInfoByAppAndStream(HttpServletRequest request, @RequestParam String app,
  57 + @RequestParam String stream,
  58 + @RequestParam(required = false) String mediaServerId,
  59 + @RequestParam(required = false) String callId,
  60 + @RequestParam(required = false) Boolean useSourceIpAsStreamIp){
  61 + boolean authority = false;
  62 + if (callId != null) {
  63 + // 权限校验
  64 + StreamAuthorityInfo streamAuthorityInfo = redisCatchStorage.getStreamAuthorityInfo(app, stream);
  65 + if (streamAuthorityInfo.getCallId().equals(callId)) {
  66 + authority = true;
  67 + }else {
  68 + WVPResult<StreamInfo> result = new WVPResult<>();
  69 + result.setCode(401);
  70 + result.setMsg("fail");
  71 + return result;
  72 + }
  73 + }else {
  74 + // 是否登陆用户, 登陆用户返回完整信息
  75 + LoginUser userInfo = SecurityUtils.getUserInfo();
  76 + if (userInfo!= null) {
  77 + authority = true;
  78 + }
  79 + }
  80 +
  81 + StreamInfo streamInfo;
  82 +
  83 + if (useSourceIpAsStreamIp != null && useSourceIpAsStreamIp) {
  84 + String host = request.getHeader("Host");
  85 + String localAddr = host.split(":")[0];
  86 + logger.info("使用{}作为返回流的ip", localAddr);
  87 + streamInfo = mediaService.getStreamInfoByAppAndStreamWithCheck(app, stream, mediaServerId, localAddr, authority);
  88 + }else {
  89 + streamInfo = mediaService.getStreamInfoByAppAndStreamWithCheck(app, stream, mediaServerId, authority);
  90 + }
  91 +
57 WVPResult<StreamInfo> result = new WVPResult<>(); 92 WVPResult<StreamInfo> result = new WVPResult<>();
58 - if (streamInfoByAppAndStreamWithCheck != null){ 93 + if (streamInfo != null){
59 result.setCode(0); 94 result.setCode(0);
60 result.setMsg("scccess"); 95 result.setMsg("scccess");
61 - result.setData(streamInfoByAppAndStreamWithCheck); 96 + result.setData(streamInfo);
62 }else { 97 }else {
63 result.setCode(-1); 98 result.setCode(-1);
64 result.setMsg("fail"); 99 result.setMsg("fail");
src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/platform/PlatformController.java
@@ -11,6 +11,7 @@ import com.genersoft.iot.vmp.gb28181.bean.SubscribeHolder; @@ -11,6 +11,7 @@ import com.genersoft.iot.vmp.gb28181.bean.SubscribeHolder;
11 import com.genersoft.iot.vmp.gb28181.transmit.cmd.ISIPCommanderForPlatform; 11 import com.genersoft.iot.vmp.gb28181.transmit.cmd.ISIPCommanderForPlatform;
12 import com.genersoft.iot.vmp.storager.IRedisCatchStorage; 12 import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
13 import com.genersoft.iot.vmp.storager.IVideoManagerStorage; 13 import com.genersoft.iot.vmp.storager.IVideoManagerStorage;
  14 +import com.genersoft.iot.vmp.utils.DateUtil;
14 import com.genersoft.iot.vmp.vmanager.bean.WVPResult; 15 import com.genersoft.iot.vmp.vmanager.bean.WVPResult;
15 import com.genersoft.iot.vmp.vmanager.gb28181.platform.bean.ChannelReduce; 16 import com.genersoft.iot.vmp.vmanager.gb28181.platform.bean.ChannelReduce;
16 import com.genersoft.iot.vmp.vmanager.gb28181.platform.bean.UpdateChannelParam; 17 import com.genersoft.iot.vmp.vmanager.gb28181.platform.bean.UpdateChannelParam;
@@ -169,6 +170,8 @@ public class PlatformController { @@ -169,6 +170,8 @@ public class PlatformController {
169 wvpResult.setMsg("平台 " + parentPlatform.getServerGBId() + " 已存在"); 170 wvpResult.setMsg("平台 " + parentPlatform.getServerGBId() + " 已存在");
170 return new ResponseEntity<>(wvpResult, HttpStatus.OK); 171 return new ResponseEntity<>(wvpResult, HttpStatus.OK);
171 } 172 }
  173 + parentPlatform.setCreateTime(DateUtil.getNow());
  174 + parentPlatform.setUpdateTime(DateUtil.getNow());
172 boolean updateResult = storager.updateParentPlatform(parentPlatform); 175 boolean updateResult = storager.updateParentPlatform(parentPlatform);
173 176
174 if (updateResult) { 177 if (updateResult) {
@@ -232,7 +235,7 @@ public class PlatformController { @@ -232,7 +235,7 @@ public class PlatformController {
232 } 235 }
233 parentPlatform.setCharacterSet(parentPlatform.getCharacterSet().toUpperCase()); 236 parentPlatform.setCharacterSet(parentPlatform.getCharacterSet().toUpperCase());
234 ParentPlatform parentPlatformOld = storager.queryParentPlatByServerGBId(parentPlatform.getServerGBId()); 237 ParentPlatform parentPlatformOld = storager.queryParentPlatByServerGBId(parentPlatform.getServerGBId());
235 - 238 + parentPlatform.setUpdateTime(DateUtil.getNow());
236 boolean updateResult = storager.updateParentPlatform(parentPlatform); 239 boolean updateResult = storager.updateParentPlatform(parentPlatform);
237 240
238 if (updateResult) { 241 if (updateResult) {
src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/play/PlayController.java
@@ -197,7 +197,7 @@ public class PlayController { @@ -197,7 +197,7 @@ public class PlayController {
197 JSONObject data = jsonObject.getJSONObject("data"); 197 JSONObject data = jsonObject.getJSONObject("data");
198 if (data != null) { 198 if (data != null) {
199 result.put("key", data.getString("key")); 199 result.put("key", data.getString("key"));
200 - StreamInfo streamInfoResult = mediaService.getStreamInfoByAppAndStreamWithCheck("convert", streamId, mediaInfo.getId()); 200 + StreamInfo streamInfoResult = mediaService.getStreamInfoByAppAndStreamWithCheck("convert", streamId, mediaInfo.getId(), false);
201 result.put("data", streamInfoResult); 201 result.put("data", streamInfoResult);
202 } 202 }
203 }else { 203 }else {
src/main/java/com/genersoft/iot/vmp/vmanager/streamProxy/StreamProxyController.java
@@ -131,6 +131,9 @@ public class StreamProxyController { @@ -131,6 +131,9 @@ public class StreamProxyController {
131 public Object start(String app, String stream){ 131 public Object start(String app, String stream){
132 logger.info("启用代理: " + app + "/" + stream); 132 logger.info("启用代理: " + app + "/" + stream);
133 boolean result = streamProxyService.start(app, stream); 133 boolean result = streamProxyService.start(app, stream);
  134 + if (!result) {
  135 + logger.info("启用代理失败: " + app + "/" + stream);
  136 + }
134 return result?"success":"fail"; 137 return result?"success":"fail";
135 } 138 }
136 139
src/main/java/com/genersoft/iot/vmp/vmanager/streamPush/StreamPushController.java
@@ -3,11 +3,16 @@ package com.genersoft.iot.vmp.vmanager.streamPush; @@ -3,11 +3,16 @@ package com.genersoft.iot.vmp.vmanager.streamPush;
3 import com.alibaba.excel.EasyExcel; 3 import com.alibaba.excel.EasyExcel;
4 import com.alibaba.excel.ExcelReader; 4 import com.alibaba.excel.ExcelReader;
5 import com.alibaba.excel.read.metadata.ReadSheet; 5 import com.alibaba.excel.read.metadata.ReadSheet;
  6 +import com.genersoft.iot.vmp.common.StreamInfo;
  7 +import com.genersoft.iot.vmp.conf.security.SecurityUtils;
  8 +import com.genersoft.iot.vmp.conf.security.dto.LoginUser;
6 import com.genersoft.iot.vmp.gb28181.bean.GbStream; 9 import com.genersoft.iot.vmp.gb28181.bean.GbStream;
7 import com.genersoft.iot.vmp.gb28181.transmit.callback.DeferredResultHolder; 10 import com.genersoft.iot.vmp.gb28181.transmit.callback.DeferredResultHolder;
8 import com.genersoft.iot.vmp.gb28181.transmit.callback.RequestMessage; 11 import com.genersoft.iot.vmp.gb28181.transmit.callback.RequestMessage;
  12 +import com.genersoft.iot.vmp.media.zlm.dto.StreamAuthorityInfo;
9 import com.genersoft.iot.vmp.media.zlm.dto.StreamPushItem; 13 import com.genersoft.iot.vmp.media.zlm.dto.StreamPushItem;
10 import com.genersoft.iot.vmp.service.IMediaServerService; 14 import com.genersoft.iot.vmp.service.IMediaServerService;
  15 +import com.genersoft.iot.vmp.service.IMediaService;
11 import com.genersoft.iot.vmp.service.IStreamPushService; 16 import com.genersoft.iot.vmp.service.IStreamPushService;
12 import com.genersoft.iot.vmp.service.impl.StreamPushUploadFileHandler; 17 import com.genersoft.iot.vmp.service.impl.StreamPushUploadFileHandler;
13 import com.genersoft.iot.vmp.vmanager.bean.BatchGBStreamParam; 18 import com.genersoft.iot.vmp.vmanager.bean.BatchGBStreamParam;
@@ -30,6 +35,7 @@ import org.springframework.web.bind.annotation.*; @@ -30,6 +35,7 @@ import org.springframework.web.bind.annotation.*;
30 import org.springframework.web.context.request.async.DeferredResult; 35 import org.springframework.web.context.request.async.DeferredResult;
31 import org.springframework.web.multipart.MultipartFile; 36 import org.springframework.web.multipart.MultipartFile;
32 37
  38 +import javax.servlet.http.HttpServletRequest;
33 import java.io.IOException; 39 import java.io.IOException;
34 import java.io.InputStream; 40 import java.io.InputStream;
35 import java.util.HashMap; 41 import java.util.HashMap;
@@ -54,6 +60,9 @@ public class StreamPushController { @@ -54,6 +60,9 @@ public class StreamPushController {
54 @Autowired 60 @Autowired
55 private DeferredResultHolder resultHolder; 61 private DeferredResultHolder resultHolder;
56 62
  63 + @Autowired
  64 + private IMediaService mediaService;
  65 +
57 @ApiOperation("推流列表查询") 66 @ApiOperation("推流列表查询")
58 @ApiImplicitParams({ 67 @ApiImplicitParams({
59 @ApiImplicitParam(name="page", value = "当前页", required = true, dataTypeClass = Integer.class), 68 @ApiImplicitParam(name="page", value = "当前页", required = true, dataTypeClass = Integer.class),
@@ -237,5 +246,43 @@ public class StreamPushController { @@ -237,5 +246,43 @@ public class StreamPushController {
237 return result; 246 return result;
238 } 247 }
239 248
  249 + /**
  250 + * 获取推流播放地址
  251 + * @param app 应用名
  252 + * @param stream 流id
  253 + * @return
  254 + */
  255 + @ApiOperation("获取推流播放地址")
  256 + @ApiImplicitParams({
  257 + @ApiImplicitParam(name = "app", value = "应用名", dataTypeClass = String.class),
  258 + @ApiImplicitParam(name = "stream", value = "流id", dataTypeClass = String.class),
  259 + @ApiImplicitParam(name = "mediaServerId", value = "媒体服务器id", dataTypeClass = String.class, required = false),
  260 + })
  261 + @GetMapping(value = "/getPlayUrl")
  262 + @ResponseBody
  263 + public WVPResult<StreamInfo> getPlayUrl(HttpServletRequest request, @RequestParam String app,
  264 + @RequestParam String stream,
  265 + @RequestParam(required = false) String mediaServerId){
  266 + boolean authority = false;
  267 + // 是否登陆用户, 登陆用户返回完整信息
  268 + LoginUser userInfo = SecurityUtils.getUserInfo();
  269 + if (userInfo!= null) {
  270 + authority = true;
  271 + }
  272 +
  273 + StreamInfo streamInfo = mediaService.getStreamInfoByAppAndStreamWithCheck(app, stream, mediaServerId, authority);
  274 +
  275 + WVPResult<StreamInfo> result = new WVPResult<>();
  276 + if (streamInfo != null){
  277 + result.setCode(0);
  278 + result.setMsg("scccess");
  279 + result.setData(streamInfo);
  280 + }else {
  281 + result.setCode(-1);
  282 + result.setMsg("fail");
  283 + }
  284 + return result;
  285 + }
  286 +
240 287
241 } 288 }
src/main/resources/all-application.yml
@@ -185,8 +185,6 @@ user-settings: @@ -185,8 +185,6 @@ user-settings:
185 record-sip: true 185 record-sip: true
186 # 是否将日志存储进数据库 186 # 是否将日志存储进数据库
187 logInDatebase: true 187 logInDatebase: true
188 - # 第三方匹配,用于从stream钟获取有效信息  
189 - thirdPartyGBIdReg: "[\\s\\S]*"  
190 188
191 # 在线文档: swagger-ui(生产环境建议关闭) 189 # 在线文档: swagger-ui(生产环境建议关闭)
192 swagger-ui: 190 swagger-ui:
web_src/src/components/PushVideoList.vue
@@ -187,7 +187,7 @@ export default { @@ -187,7 +187,7 @@ export default {
187 this.getListLoading = true; 187 this.getListLoading = true;
188 this.$axios({ 188 this.$axios({
189 method: 'get', 189 method: 'get',
190 - url: '/api/media/stream_info_by_app_and_stream', 190 + url: '/api/push/getPlayUrl',
191 params: { 191 params: {
192 app: row.app, 192 app: row.app,
193 stream: row.stream, 193 stream: row.stream,
web_src/src/components/StreamProxyList.vue
@@ -87,7 +87,7 @@ @@ -87,7 +87,7 @@
87 <el-divider direction="vertical"></el-divider> 87 <el-divider direction="vertical"></el-divider>
88 <el-button size="medium" icon="el-icon-switch-button" type="text" v-if="scope.row.enable" @click="stop(scope.row)">停用</el-button> 88 <el-button size="medium" icon="el-icon-switch-button" type="text" v-if="scope.row.enable" @click="stop(scope.row)">停用</el-button>
89 <el-divider direction="vertical"></el-divider> 89 <el-divider direction="vertical"></el-divider>
90 - <el-button size="medium" icon="el-icon-check" type="text" :loading="startBtnLaoding" v-if="!scope.row.enable" @click="start(scope.row)">启用</el-button> 90 + <el-button size="medium" icon="el-icon-check" type="text" :loading="scope.row.startBtnLoading" v-if="!scope.row.enable" @click="start(scope.row)">启用</el-button>
91 <el-divider v-if="!scope.row.enable" direction="vertical"></el-divider> 91 <el-divider v-if="!scope.row.enable" direction="vertical"></el-divider>
92 <el-button size="medium" icon="el-icon-delete" type="text" style="color: #f56c6c" @click="deleteStreamProxy(scope.row)">删除</el-button> 92 <el-button size="medium" icon="el-icon-delete" type="text" style="color: #f56c6c" @click="deleteStreamProxy(scope.row)">删除</el-button>
93 </template> 93 </template>
@@ -132,7 +132,7 @@ @@ -132,7 +132,7 @@
132 count:15, 132 count:15,
133 total:0, 133 total:0,
134 getListLoading: false, 134 getListLoading: false,
135 - startBtnLaoding: false 135 + startBtnLoading: false
136 }; 136 };
137 }, 137 },
138 computed: { 138 computed: {
@@ -169,7 +169,10 @@ @@ -169,7 +169,10 @@
169 } 169 }
170 }).then(function (res) { 170 }).then(function (res) {
171 that.total = res.data.total; 171 that.total = res.data.total;
172 - that.streamProxyList = res.data.list; 172 + for (let i = 0; i < res.data.list.length; i++) {
  173 + res.data.list[i]["startBtnLoading"] = false;
  174 + }
  175 + that.streamProxyList = res.data.list;
173 that.getListLoading = false; 176 that.getListLoading = false;
174 }).catch(function (error) { 177 }).catch(function (error) {
175 console.log(error); 178 console.log(error);
@@ -263,7 +266,7 @@ @@ -263,7 +266,7 @@
263 start: function(row){ 266 start: function(row){
264 let that = this; 267 let that = this;
265 this.getListLoading = true; 268 this.getListLoading = true;
266 - this.startBtnLaoding = true; 269 + this.$set(row, 'startBtnLoading', true)
267 this.$axios({ 270 this.$axios({
268 method: 'get', 271 method: 'get',
269 url:`/api/proxy/start`, 272 url:`/api/proxy/start`,
@@ -273,7 +276,7 @@ @@ -273,7 +276,7 @@
273 } 276 }
274 }).then(function (res) { 277 }).then(function (res) {
275 that.getListLoading = false; 278 that.getListLoading = false;
276 - that.startBtnLaoding = false; 279 + that.$set(row, 'startBtnLoading', false)
277 if (res.data == "success"){ 280 if (res.data == "success"){
278 that.initData() 281 that.initData()
279 }else { 282 }else {
@@ -287,7 +290,7 @@ @@ -287,7 +290,7 @@
287 }).catch(function (error) { 290 }).catch(function (error) {
288 console.log(error); 291 console.log(error);
289 that.getListLoading = false; 292 that.getListLoading = false;
290 - that.startBtnLaoding = false; 293 + that.$set(row, 'startBtnLoading', false)
291 }); 294 });
292 }, 295 },
293 stop: function(row){ 296 stop: function(row){
web_src/src/components/common/MapComponent.vue
@@ -11,6 +11,7 @@ import VectorSource from &#39;ol/source/Vector&#39;; @@ -11,6 +11,7 @@ import VectorSource from &#39;ol/source/Vector&#39;;
11 import Tile from 'ol/layer/Tile'; 11 import Tile from 'ol/layer/Tile';
12 import VectorLayer from 'ol/layer/Vector'; 12 import VectorLayer from 'ol/layer/Vector';
13 import Style from 'ol/style/Style'; 13 import Style from 'ol/style/Style';
  14 +import Stroke from 'ol/style/Stroke';
14 import Icon from 'ol/style/Icon'; 15 import Icon from 'ol/style/Icon';
15 import View from 'ol/View'; 16 import View from 'ol/View';
16 import Feature from 'ol/Feature'; 17 import Feature from 'ol/Feature';
@@ -230,7 +231,12 @@ export default { @@ -230,7 +231,12 @@ export default {
230 } 231 }
231 let line = new LineString(points) 232 let line = new LineString(points)
232 let lineFeature = new Feature(line); 233 let lineFeature = new Feature(line);
233 - 234 + lineFeature.setStyle(new Style({
  235 + stroke: new Stroke({
  236 + width: 4 ,
  237 + color: "#0c6d6a",
  238 + })
  239 + }))
234 let source = new VectorSource(); 240 let source = new VectorSource();
235 source.addFeature(lineFeature); 241 source.addFeature(lineFeature);
236 let vectorLayer = new VectorLayer({ 242 let vectorLayer = new VectorLayer({
web_src/src/components/dialog/queryTrace.vue
@@ -10,8 +10,8 @@ @@ -10,8 +10,8 @@
10 @close="close()" 10 @close="close()"
11 > 11 >
12 <div v-loading="isLoging"> 12 <div v-loading="isLoging">
13 - <el-date-picker v-model="searchFrom" type="datetime" placeholder="选择开始日期时间" default-time="00:00:00" size="mini" style="width: 11rem;" align="right" :picker-options="pickerOptions"></el-date-picker>  
14 - <el-date-picker v-model="searchTo" type="datetime" placeholder="选择结束日期时间" default-time="00:00:00" size="mini" style="width: 11rem;" align="right" :picker-options="pickerOptions"></el-date-picker> 13 + <el-date-picker v-model="searchFrom" type="datetime" placeholder="选择开始日期时间" default-time="00:00:00" value-format="yyyy-MM-dd HH:mm:ss" size="mini" style="width: 11rem;" align="right" :picker-options="pickerOptions"></el-date-picker>
  14 + <el-date-picker v-model="searchTo" type="datetime" placeholder="选择结束日期时间" default-time="00:00:00" value-format="yyyy-MM-dd HH:mm:ss" size="mini" style="width: 11rem;" align="right" :picker-options="pickerOptions"></el-date-picker>
15 <el-button icon="el-icon-search" size="mini" type="primary" @click="onSubmit">查询</el-button> 15 <el-button icon="el-icon-search" size="mini" type="primary" @click="onSubmit">查询</el-button>
16 </div> 16 </div>
17 17
@@ -72,7 +72,11 @@ export default { @@ -72,7 +72,11 @@ export default {
72 onSubmit: function () { 72 onSubmit: function () {
73 console.log("onSubmit"); 73 console.log("onSubmit");
74 this.isLoging = true; 74 this.isLoging = true;
75 - this.$axios.get(`/api/position/history/${this.channel.deviceId}/${this.channel.channelId}`, { 75 + let url = `/api/position/history/${this.channel.deviceId}?start=${this.searchFrom}&end=${this.searchTo}`;
  76 + if (this.channel.channelId) {
  77 + url+="&channelId=${this.channel.channelId}"
  78 + }
  79 + this.$axios.get(url, {
76 }).then((res)=> { 80 }).then((res)=> {
77 this.isLoging = false; 81 this.isLoging = false;
78 if (typeof this.callback == "function") { 82 if (typeof this.callback == "function") {
web_src/src/components/map.vue
@@ -186,6 +186,14 @@ export default { @@ -186,6 +186,14 @@ export default {
186 this.deviceService.getAllSubChannel(false, data.deviceId, data.channelId, this.channelsHandler) 186 this.deviceService.getAllSubChannel(false, data.deviceId, data.channelId, this.channelsHandler)
187 } 187 }
188 } 188 }
  189 + },
  190 + {
  191 + label: "查询轨迹",
  192 + icon: "el-icon-map-location",
  193 + disabled: false,
  194 + onClick: () => {
  195 + this.getTrace(data)
  196 + }
189 } 197 }
190 ], 198 ],
191 event, // 鼠标事件信息 199 event, // 鼠标事件信息
@@ -320,8 +328,8 @@ export default { @@ -320,8 +328,8 @@ export default {
320 } else { 328 } else {
321 let positions = []; 329 let positions = [];
322 for (let i = 0; i < channelPositions.length; i++) { 330 for (let i = 0; i < channelPositions.length; i++) {
323 - if (channelPositions[i].cnLng * channelPositions[i].cnLat > 0) {  
324 - positions.push([channelPositions[i].cnLng, channelPositions[i].cnLat]) 331 + if (channelPositions[i][this.longitudeStr] * channelPositions[i][this.latitudeStr] > 0) {
  332 + positions.push([channelPositions[i][this.longitudeStr], channelPositions[i][this.latitudeStr]])
325 } 333 }
326 334
327 } 335 }
web_src/src/layout/UiHeader.vue
@@ -13,17 +13,20 @@ @@ -13,17 +13,20 @@
13 <el-menu-item index="/cloudRecord">云端录像</el-menu-item> 13 <el-menu-item index="/cloudRecord">云端录像</el-menu-item>
14 <el-menu-item index="/mediaServerManger">节点管理</el-menu-item> 14 <el-menu-item index="/mediaServerManger">节点管理</el-menu-item>
15 <el-menu-item index="/parentPlatformList/15/1">国标级联</el-menu-item> 15 <el-menu-item index="/parentPlatformList/15/1">国标级联</el-menu-item>
16 - <el-menu-item @click="openDoc">在线文档</el-menu-item> 16 +
17 <!-- <el-submenu index="/setting">--> 17 <!-- <el-submenu index="/setting">-->
18 <!-- <template slot="title">系统设置</template>--> 18 <!-- <template slot="title">系统设置</template>-->
19 <!-- <el-menu-item index="/setting/web">WEB服务</el-menu-item>--> 19 <!-- <el-menu-item index="/setting/web">WEB服务</el-menu-item>-->
20 <!-- <el-menu-item index="/setting/sip">国标服务</el-menu-item>--> 20 <!-- <el-menu-item index="/setting/sip">国标服务</el-menu-item>-->
21 <!-- <el-menu-item index="/setting/media">媒体服务</el-menu-item>--> 21 <!-- <el-menu-item index="/setting/media">媒体服务</el-menu-item>-->
22 <!-- </el-submenu>--> 22 <!-- </el-submenu>-->
23 - <el-switch v-model="alarmNotify" active-text="报警信息推送" @change="alarmNotifyChannge"></el-switch>  
24 <!-- <el-menu-item style="float: right;" @click="loginout">退出</el-menu-item>--> 23 <!-- <el-menu-item style="float: right;" @click="loginout">退出</el-menu-item>-->
25 <el-submenu index="" style="float: right;"> 24 <el-submenu index="" style="float: right;">
26 <template slot="title">欢迎,{{ this.$cookies.get("session").username }}</template> 25 <template slot="title">欢迎,{{ this.$cookies.get("session").username }}</template>
  26 + <el-menu-item @click="openDoc">在线文档</el-menu-item>
  27 + <el-menu-item >
  28 + <el-switch v-model="alarmNotify" inactive-text="报警信息推送" @change="alarmNotifyChannge"></el-switch>
  29 + </el-menu-item>
27 <el-menu-item @click="changePassword">修改密码</el-menu-item> 30 <el-menu-item @click="changePassword">修改密码</el-menu-item>
28 <el-menu-item @click="loginout">注销</el-menu-item> 31 <el-menu-item @click="loginout">注销</el-menu-item>
29 </el-submenu> 32 </el-submenu>
@@ -145,7 +148,10 @@ export default { @@ -145,7 +148,10 @@ export default {
145 </script> 148 </script>
146 <style> 149 <style>
147 #UiHeader .el-switch__label { 150 #UiHeader .el-switch__label {
148 - color: white; 151 + color: white ;
  152 +}
  153 +.el-menu--popup .el-menu-item .el-switch .el-switch__label {
  154 + color: white !important;
149 } 155 }
150 #UiHeader .el-switch__label.is-active{ 156 #UiHeader .el-switch__label.is-active{
151 color: #409EFF; 157 color: #409EFF;