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 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 5 -- Server version 8.0.29-0ubuntu0.22.04.2
6 6  
... ... @@ -23,34 +23,34 @@ DROP TABLE IF EXISTS `device`;
23 23 /*!40101 SET @saved_cs_client = @@character_set_client */;
24 24 /*!50503 SET character_set_client = utf8mb4 */;
25 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 54 /*!40101 SET character_set_client = @saved_cs_client */;
55 55  
56 56 --
... ... @@ -70,17 +70,18 @@ DROP TABLE IF EXISTS `device_alarm`;
70 70 /*!40101 SET @saved_cs_client = @@character_set_client */;
71 71 /*!50503 SET character_set_client = utf8mb4 */;
72 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 85 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC;
85 86 /*!40101 SET character_set_client = @saved_cs_client */;
86 87  
... ... @@ -101,46 +102,47 @@ DROP TABLE IF EXISTS `device_channel`;
101 102 /*!40101 SET @saved_cs_client = @@character_set_client */;
102 103 /*!50503 SET character_set_client = utf8mb4 */;
103 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 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 162 /*!40101 SET @saved_cs_client = @@character_set_client */;
161 163 /*!50503 SET character_set_client = utf8mb4 */;
162 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 183 /*!40101 SET character_set_client = @saved_cs_client */;
180 184  
181 185 --
... ... @@ -195,21 +199,21 @@ DROP TABLE IF EXISTS `gb_stream`;
195 199 /*!40101 SET @saved_cs_client = @@character_set_client */;
196 200 /*!50503 SET character_set_client = utf8mb4 */;
197 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 217 /*!40101 SET character_set_client = @saved_cs_client */;
214 218  
215 219 --
... ... @@ -229,17 +233,17 @@ DROP TABLE IF EXISTS `log`;
229 233 /*!40101 SET @saved_cs_client = @@character_set_client */;
230 234 /*!50503 SET character_set_client = utf8mb4 */;
231 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 247 /*!40101 SET character_set_client = @saved_cs_client */;
244 248  
245 249 --
... ... @@ -259,31 +263,31 @@ DROP TABLE IF EXISTS `media_server`;
259 263 /*!40101 SET @saved_cs_client = @@character_set_client */;
260 264 /*!50503 SET character_set_client = utf8mb4 */;
261 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 291 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC;
288 292 /*!40101 SET character_set_client = @saved_cs_client */;
289 293  
... ... @@ -304,34 +308,36 @@ DROP TABLE IF EXISTS `parent_platform`;
304 308 /*!40101 SET @saved_cs_client = @@character_set_client */;
305 309 /*!50503 SET character_set_client = utf8mb4 */;
306 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 341 /*!40101 SET character_set_client = @saved_cs_client */;
336 342  
337 343 --
... ... @@ -351,11 +357,11 @@ DROP TABLE IF EXISTS `platform_catalog`;
351 357 /*!40101 SET @saved_cs_client = @@character_set_client */;
352 358 /*!50503 SET character_set_client = utf8mb4 */;
353 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 365 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC;
360 366 /*!40101 SET character_set_client = @saved_cs_client */;
361 367  
... ... @@ -376,11 +382,11 @@ DROP TABLE IF EXISTS `platform_gb_channel`;
376 382 /*!40101 SET @saved_cs_client = @@character_set_client */;
377 383 /*!50503 SET character_set_client = utf8mb4 */;
378 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 390 ) ENGINE=InnoDB AUTO_INCREMENT=4889 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC;
385 391 /*!40101 SET character_set_client = @saved_cs_client */;
386 392  
... ... @@ -401,12 +407,12 @@ DROP TABLE IF EXISTS `platform_gb_stream`;
401 407 /*!40101 SET @saved_cs_client = @@character_set_client */;
402 408 /*!50503 SET character_set_client = utf8mb4 */;
403 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 416 ) ENGINE=InnoDB AUTO_INCREMENT=302077 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC;
411 417 /*!40101 SET character_set_client = @saved_cs_client */;
412 418  
... ... @@ -427,27 +433,28 @@ DROP TABLE IF EXISTS `stream_proxy`;
427 433 /*!40101 SET @saved_cs_client = @@character_set_client */;
428 434 /*!50503 SET character_set_client = utf8mb4 */;
429 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 458 /*!40101 SET character_set_client = @saved_cs_client */;
452 459  
453 460 --
... ... @@ -467,19 +474,22 @@ DROP TABLE IF EXISTS `stream_push`;
467 474 /*!40101 SET @saved_cs_client = @@character_set_client */;
468 475 /*!50503 SET character_set_client = utf8mb4 */;
469 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 493 /*!40101 SET character_set_client = @saved_cs_client */;
484 494  
485 495 --
... ... @@ -499,14 +509,15 @@ DROP TABLE IF EXISTS `user`;
499 509 /*!40101 SET @saved_cs_client = @@character_set_client */;
500 510 /*!50503 SET character_set_client = utf8mb4 */;
501 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 521 ) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC;
511 522 /*!40101 SET character_set_client = @saved_cs_client */;
512 523  
... ... @@ -516,7 +527,7 @@ CREATE TABLE `user` (
516 527  
517 528 LOCK TABLES `user` WRITE;
518 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 531 /*!40000 ALTER TABLE `user` ENABLE KEYS */;
521 532 UNLOCK TABLES;
522 533  
... ... @@ -528,12 +539,12 @@ DROP TABLE IF EXISTS `user_role`;
528 539 /*!40101 SET @saved_cs_client = @@character_set_client */;
529 540 /*!50503 SET character_set_client = utf8mb4 */;
530 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 548 ) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC;
538 549 /*!40101 SET character_set_client = @saved_cs_client */;
539 550  
... ... @@ -556,4 +567,4 @@ UNLOCK TABLES;
556 567 /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
557 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 15  
16 16 alter table stream_push
17 17 add serverId varchar(50) not null;
  18 +
18 19 alter table device
19 20 add geoCoordSys varchar(50) not null;
20 21 alter table device
21 22 add treeType varchar(50) not null;
22 23 update device set device.geoCoordSys='WGS84';
23 24 update device set device.treeType='CivilCode';
  25 +
24 26 alter table device_channel
25 27 add longitudeGcj02 double default null;
26 28 alter table device_channel
... ... @@ -31,4 +33,49 @@ alter table device_channel
31 33 add latitudeWgs84 double default null;
32 34 alter table device_channel
33 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 9 private String deviceID;
10 10 private String channelId;
11 11 private String flv;
  12 +
  13 + private String ip;
  14 +
12 15 private String https_flv;
13 16 private String ws_flv;
14 17 private String wss_flv;
... ... @@ -292,4 +295,12 @@ public class StreamInfo {
292 295 public void setProgress(double progress) {
293 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 58  
59 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 63 public static final String SIP_CSEQ_PREFIX = "VMP_SIP_CSEQ_";
62 64  
63 65 public static final String SIP_SN_PREFIX = "VMP_SIP_SN_";
... ... @@ -71,6 +73,8 @@ public class VideoManagerConstants {
71 73 public static final String SYSTEM_INFO_NET_PREFIX = "VMP_SYSTEM_INFO_NET_";
72 74  
73 75  
  76 +
  77 +
74 78 //************************** redis 消息*********************************
75 79  
76 80 // 流变化的通知
... ... @@ -79,9 +83,15 @@ public class VideoManagerConstants {
79 83 // 接收推流设备的GPS变化通知
80 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 89 // redis 消息通知设备推流到平台
83 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 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 5 import org.slf4j.LoggerFactory;
6 6 import org.springframework.beans.factory.annotation.Autowired;
7 7 import org.springframework.context.annotation.Bean;
  8 +import org.springframework.scheduling.annotation.Scheduled;
8 9 import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler;
9 10 import org.springframework.stereotype.Component;
10 11  
... ... @@ -103,12 +104,9 @@ public class DynamicTask {
103 104  
104 105 public void stop(String key) {
105 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 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 121 public Runnable get(String key) {
124 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 77 */
78 78 private String alarmType;
79 79  
  80 + private String createTime;
  81 +
80 82  
81 83 public String getId() {
82 84 return id;
... ... @@ -157,4 +159,12 @@ public class DeviceAlarm {
157 159 public void setChannelId(String channelId) {
158 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 199 */
200 200 private String businessGroupId;
201 201  
  202 + /**
  203 + * GPS的更新时间
  204 + */
  205 + private String gpsTime;
  206 +
202 207 public int getId() {
203 208 return id;
204 209 }
... ... @@ -519,4 +524,12 @@ public class DeviceChannel {
519 524 public void setBusinessGroupId(String businessGroupId) {
520 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 15 private double latitude;
16 16 private String streamType;
17 17 private boolean status;
18   - /**
19   - * GMT unix系统时间戳,单位秒
20   - */
21   - public Long createStamp;
  18 +
  19 + public String createTime;
22 20  
23 21 @Override
24 22 public Integer getGbStreamId() {
... ... @@ -102,12 +100,11 @@ public class GbStream extends PlatformGbStream{
102 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 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 86 public String getDeviceId() {
... ... @@ -145,35 +155,51 @@ public class MobilePosition {
145 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 144 */
145 145 private String administrativeDivision;
146 146  
  147 + /**
  148 + * 更新时间
  149 + */
  150 + private String updateTime;
  151 +
  152 + /**
  153 + * 创建时间
  154 + */
  155 + private String createTime;
  156 +
147 157 public Integer getId() {
148 158 return id;
149 159 }
... ... @@ -368,4 +378,20 @@ public class ParentPlatform {
368 378 public void setAdministrativeDivision(String administrativeDivision) {
369 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 140 Element rootElement = getRootElement(evt);
141 141  
142 142 MobilePosition mobilePosition = new MobilePosition();
  143 + mobilePosition.setCreateTime(DateUtil.getNow());
143 144 Element deviceIdElement = rootElement.element("DeviceID");
144 145 String channelId = deviceIdElement.getTextTrim().toString();
145 146 Device device = redisCatchStorage.getDevice(deviceId);
... ... @@ -173,16 +174,40 @@ public class NotifyRequestProcessor extends SIPRequestProcessorParent implements
173 174 mobilePosition.getLongitude(), mobilePosition.getLatitude());
174 175 mobilePosition.setReportSource("Mobile Position");
175 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 211 // 发送redis消息。 通知位置信息的变化
187 212 JSONObject jsonObject = new JSONObject();
188 213 jsonObject.put("time", time);
... ... @@ -209,9 +234,12 @@ public class NotifyRequestProcessor extends SIPRequestProcessorParent implements
209 234 return;
210 235 }
211 236 try {
  237 + FromHeader fromHeader = (FromHeader) evt.getRequest().getHeader(FromHeader.NAME);
  238 + String deviceId = SipUtils.getUserIdFromFromHeader(fromHeader);
  239 +
212 240 Element rootElement = getRootElement(evt);
213 241 Element deviceIdElement = rootElement.element("DeviceID");
214   - String deviceId = deviceIdElement.getText().toString();
  242 + String channelId = deviceIdElement.getText().toString();
215 243  
216 244 Device device = redisCatchStorage.getDevice(deviceId);
217 245 if (device == null) {
... ... @@ -247,21 +275,45 @@ public class NotifyRequestProcessor extends SIPRequestProcessorParent implements
247 275 logger.info("[收到Notify-Alarm]:{}/{}", device.getDeviceId(), deviceAlarm.getChannelId());
248 276 if ("4".equals(deviceAlarm.getAlarmMethod())) {
249 277 MobilePosition mobilePosition = new MobilePosition();
  278 + mobilePosition.setCreateTime(DateUtil.getNow());
250 279 mobilePosition.setDeviceId(deviceAlarm.getDeviceId());
251 280 mobilePosition.setTime(deviceAlarm.getAlarmTime());
252 281 mobilePosition.setLongitude(deviceAlarm.getLongitude());
253 282 mobilePosition.setLatitude(deviceAlarm.getLatitude());
254 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 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 80 Element deviceIdElement = rootElement.element("DeviceID");
81 81 String channelId = deviceIdElement.getText().toString();
82 82  
83   -
84 83 DeviceAlarm deviceAlarm = new DeviceAlarm();
  84 + deviceAlarm.setCreateTime(DateUtil.getNow());
85 85 deviceAlarm.setDeviceId(device.getDeviceId());
86 86 deviceAlarm.setChannelId(channelId);
87 87 deviceAlarm.setAlarmPriority(getText(rootElement, "AlarmPriority"));
... ... @@ -113,21 +113,45 @@ public class AlarmNotifyMessageHandler extends SIPRequestProcessorParent impleme
113 113 if (!StringUtils.isEmpty(deviceAlarm.getAlarmMethod())) {
114 114 if ( deviceAlarm.getAlarmMethod().contains(DeviceAlarmMethod.GPS.getVal() + "")) {
115 115 MobilePosition mobilePosition = new MobilePosition();
  116 + mobilePosition.setCreateTime(DateUtil.getNow());
116 117 mobilePosition.setDeviceId(deviceAlarm.getDeviceId());
117 118 mobilePosition.setTime(deviceAlarm.getAlarmTime());
118 119 mobilePosition.setLongitude(deviceAlarm.getLongitude());
119 120 mobilePosition.setLatitude(deviceAlarm.getLatitude());
120 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 157 if (!StringUtils.isEmpty(deviceAlarm.getDeviceId())) {
... ... @@ -177,6 +201,7 @@ public class AlarmNotifyMessageHandler extends SIPRequestProcessorParent impleme
177 201  
178 202  
179 203 DeviceAlarm deviceAlarm = new DeviceAlarm();
  204 + deviceAlarm.setCreateTime(DateUtil.getNow());
180 205 deviceAlarm.setDeviceId(parentPlatform.getServerGBId());
181 206 deviceAlarm.setChannelId(channelId);
182 207 deviceAlarm.setAlarmPriority(getText(rootElement, "AlarmPriority"));
... ...
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/notify/cmd/MobilePositionNotifyMessageHandler.java
1 1 package com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.notify.cmd;
2 2  
3 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 5 import com.genersoft.iot.vmp.gb28181.transmit.event.request.SIPRequestProcessorParent;
9 6 import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.IMessageHandler;
10 7 import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.notify.NotifyMessageHandler;
11 8 import com.genersoft.iot.vmp.gb28181.utils.Coordtransform;
12 9 import com.genersoft.iot.vmp.gb28181.utils.NumericUtil;
13 10 import com.genersoft.iot.vmp.storager.IVideoManagerStorage;
  11 +import com.genersoft.iot.vmp.utils.DateUtil;
14 12 import com.genersoft.iot.vmp.utils.GpsUtil;
15 13 import org.dom4j.DocumentException;
16 14 import org.dom4j.Element;
... ... @@ -56,6 +54,7 @@ public class MobilePositionNotifyMessageHandler extends SIPRequestProcessorParen
56 54 rootElement = getRootElement(evt, device.getCharset());
57 55  
58 56 MobilePosition mobilePosition = new MobilePosition();
  57 + mobilePosition.setCreateTime(DateUtil.getNow());
59 58 if (!StringUtils.isEmpty(device.getName())) {
60 59 mobilePosition.setDeviceName(device.getName());
61 60 }
... ... @@ -80,16 +79,39 @@ public class MobilePositionNotifyMessageHandler extends SIPRequestProcessorParen
80 79 mobilePosition.setAltitude(0.0);
81 80 }
82 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 115 //回复 200 OK
94 116 responseAck(evt, Response.OK);
95 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 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 174 public SyncStatus getChannelSyncProgress(String deviceId) {
240 175 if (catalogDataCatch.get(deviceId) == null) {
241 176 return null;
... ...
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/response/cmd/MobilePositionResponseMessageHandler.java
1 1 package com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.response.cmd;
2 2  
3 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 5 import com.genersoft.iot.vmp.gb28181.transmit.event.request.SIPRequestProcessorParent;
9 6 import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.IMessageHandler;
10 7 import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.response.ResponseMessageHandler;
11 8 import com.genersoft.iot.vmp.gb28181.utils.Coordtransform;
12 9 import com.genersoft.iot.vmp.gb28181.utils.NumericUtil;
13 10 import com.genersoft.iot.vmp.storager.IVideoManagerStorage;
  11 +import com.genersoft.iot.vmp.utils.DateUtil;
14 12 import com.genersoft.iot.vmp.utils.GpsUtil;
15 13 import org.dom4j.DocumentException;
16 14 import org.dom4j.Element;
... ... @@ -56,6 +54,7 @@ public class MobilePositionResponseMessageHandler extends SIPRequestProcessorPar
56 54 rootElement = getRootElement(evt, device.getCharset());
57 55  
58 56 MobilePosition mobilePosition = new MobilePosition();
  57 + mobilePosition.setCreateTime(DateUtil.getNow());
59 58 if (!StringUtils.isEmpty(device.getName())) {
60 59 mobilePosition.setDeviceName(device.getName());
61 60 }
... ... @@ -80,16 +79,39 @@ public class MobilePositionResponseMessageHandler extends SIPRequestProcessorPar
80 79 mobilePosition.setAltitude(0.0);
81 80 }
82 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 115 //回复 200 OK
94 116 responseAck(evt, Response.OK);
95 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 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 4 import com.genersoft.iot.vmp.gb28181.bean.*;
5 5 import com.genersoft.iot.vmp.gb28181.transmit.callback.DeferredResultHolder;
6 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 4 import com.alibaba.fastjson.JSONObject;
5 5 import com.genersoft.iot.vmp.gb28181.bean.Device;
6 6 import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel;
  7 +import com.genersoft.iot.vmp.utils.DateUtil;
7 8 import org.dom4j.Attribute;
8 9 import org.dom4j.Document;
9 10 import org.dom4j.DocumentException;
... ... @@ -314,6 +315,7 @@ public class XmlUtil {
314 315 } else {
315 316 deviceChannel.setLatitude(0.00);
316 317 }
  318 + deviceChannel.setGpsTime(DateUtil.getNow());
317 319 if (deviceChannel.getLongitude()*deviceChannel.getLatitude() > 0) {
318 320 if ("WGS84".equals(device.getGeoCoordSys())) {
319 321 deviceChannel.setLongitudeWgs84(deviceChannel.getLongitude());
... ...
src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMHttpHookListener.java
1 1 package com.genersoft.iot.vmp.media.zlm;
2 2  
3   -import java.util.ArrayList;
  3 +import java.util.HashMap;
4 4 import java.util.List;
  5 +import java.util.Map;
5 6  
6 7 import com.alibaba.fastjson.JSON;
7 8 import com.genersoft.iot.vmp.common.StreamInfo;
... ... @@ -21,6 +22,7 @@ import org.slf4j.LoggerFactory;
21 22 import org.springframework.beans.factory.annotation.Autowired;
22 23 import org.springframework.http.HttpStatus;
23 24 import org.springframework.http.ResponseEntity;
  25 +import org.springframework.util.StringUtils;
24 26 import org.springframework.web.bind.annotation.PostMapping;
25 27 import org.springframework.web.bind.annotation.RequestBody;
26 28 import org.springframework.web.bind.annotation.RequestMapping;
... ... @@ -80,6 +82,9 @@ public class ZLMHttpHookListener {
80 82 private UserSetting userSetting;
81 83  
82 84 @Autowired
  85 + private IUserService userService;
  86 +
  87 + @Autowired
83 88 private VideoStreamSessionManager sessionManager;
84 89  
85 90 /**
... ... @@ -151,12 +156,14 @@ public class ZLMHttpHookListener {
151 156 */
152 157 @ResponseBody
153 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 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 167 ZLMHttpHookSubscribe.Event subscribe = this.subscribe.getSubscribe(ZLMHttpHookSubscribe.HookType.on_play, json);
161 168 if (subscribe != null ) {
162 169 MediaServerItem mediaInfo = mediaServerService.getOne(mediaServerId);
... ... @@ -165,9 +172,20 @@ public class ZLMHttpHookListener {
165 172 }
166 173 }
167 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 186 ret.put("code", 0);
169 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 194 */
177 195 @ResponseBody
178 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 201 logger.info("[ ZLM HOOK ]on_publish API调用,参数:" + json.toString());
182 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 236 ret.put("code", 0);
184 237 ret.put("msg", "success");
185 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 240 ret.put("enable_audio", true);
190 241 }
191 242  
... ... @@ -200,14 +251,13 @@ public class ZLMHttpHookListener {
200 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 256 ret.put("enable_mp4", userSetting.getRecordSip());
207 257 }else {
208 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 261 if (ssrcTransactionForAll != null && ssrcTransactionForAll.size() == 1) {
212 262 String deviceId = ssrcTransactionForAll.get(0).getDeviceId();
213 263 String channelId = ssrcTransactionForAll.get(0).getChannelId();
... ... @@ -221,13 +271,14 @@ public class ZLMHttpHookListener {
221 271 ret.put("enable_mp4", true);
222 272 ret.put("enable_audio", true);
223 273 }
224   -
225 274 }
226 275  
227 276  
228 277 return new ResponseEntity<String>(ret.toString(), HttpStatus.OK);
229 278 }
230   -
  279 +
  280 +
  281 +
231 282 /**
232 283 * 录制mp4完成后通知事件;此事件对回复不敏感。
233 284 *
... ... @@ -312,9 +363,6 @@ public class ZLMHttpHookListener {
312 363 if (logger.isDebugEnabled()) {
313 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 366 String mediaServerId = json.getString("mediaServerId");
319 367 ZLMHttpHookSubscribe.Event subscribe = this.subscribe.getSubscribe(ZLMHttpHookSubscribe.HookType.on_shell_login, json);
320 368 if (subscribe != null ) {
... ... @@ -351,12 +399,24 @@ public class ZLMHttpHookListener {
351 399 }
352 400 // 流消失移除redis play
353 401 String app = item.getApp();
354   - String streamId = item.getStream();
  402 + String stream = item.getStream();
355 403 String schema = item.getSchema();
356 404 List<MediaItem.MediaTrack> tracks = item.getTracks();
357 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 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 420 if (regist) {
361 421 mediaServerService.addCount(mediaServerId);
362 422 }else {
... ... @@ -365,15 +425,15 @@ public class ZLMHttpHookListener {
365 425 if (item.getOriginType() == OriginType.PULL.ordinal()
366 426 || item.getOriginType() == OriginType.FFMPEG_PULL.ordinal()) {
367 427 // 设置拉流代理上线/离线
368   - streamProxyService.updateStatus(regist, app, streamId);
  428 + streamProxyService.updateStatus(regist, app, stream);
369 429 }
370 430 if ("rtp".equals(app) && !regist ) {
371   - StreamInfo streamInfo = redisCatchStorage.queryPlayByStreamId(streamId);
  431 + StreamInfo streamInfo = redisCatchStorage.queryPlayByStreamId(stream);
372 432 if (streamInfo!=null){
373 433 redisCatchStorage.stopPlay(streamInfo);
374 434 storager.stopPlay(streamInfo.getDeviceID(), streamInfo.getChannelId());
375 435 }else{
376   - streamInfo = redisCatchStorage.queryPlayback(null, null, streamId, null);
  436 + streamInfo = redisCatchStorage.queryPlayback(null, null, stream, null);
377 437 if (streamInfo != null) {
378 438 redisCatchStorage.stopPlayback(streamInfo.getDeviceID(), streamInfo.getChannelId(),
379 439 streamInfo.getStream(), null);
... ... @@ -387,11 +447,12 @@ public class ZLMHttpHookListener {
387 447  
388 448 if (mediaServerItem != null){
389 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 453 item.setStreamInfo(streamInfoByAppAndStream);
393 454  
394   - redisCatchStorage.addStream(mediaServerItem, type, app, streamId, item);
  455 + redisCatchStorage.addStream(mediaServerItem, type, app, stream, item);
395 456 if (item.getOriginType() == OriginType.RTSP_PUSH.ordinal()
396 457 || item.getOriginType() == OriginType.RTMP_PUSH.ordinal()
397 458 || item.getOriginType() == OriginType.RTC_PUSH.ordinal() ) {
... ... @@ -414,23 +475,23 @@ public class ZLMHttpHookListener {
414 475  
415 476 }else {
416 477 // 兼容流注销时类型从redis记录获取
417   - MediaItem mediaItem = redisCatchStorage.getStreamInfo(app, streamId, mediaServerId);
  478 + MediaItem mediaItem = redisCatchStorage.getStreamInfo(app, stream, mediaServerId);
418 479 if (mediaItem != null) {
419 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 484 if (gbStream != null) {
424 485 // eventPublisher.catalogEventPublishForStream(null, gbStream, CatalogEvent.OFF);
425 486 }
426   - zlmMediaListManager.removeMedia(app, streamId);
  487 + zlmMediaListManager.removeMedia(app, stream);
427 488 }
428 489 if (type != null) {
429 490 // 发送流变化redis消息
430 491 JSONObject jsonObject = new JSONObject();
431 492 jsonObject.put("serverId", userSetting.getServerId());
432 493 jsonObject.put("app", app);
433   - jsonObject.put("stream", streamId);
  494 + jsonObject.put("stream", stream);
434 495 jsonObject.put("register", regist);
435 496 jsonObject.put("mediaServerId", mediaServerId);
436 497 redisCatchStorage.sendStreamChangeMsg(type, jsonObject);
... ... @@ -453,10 +514,8 @@ public class ZLMHttpHookListener {
453 514 @ResponseBody
454 515 @PostMapping(value = "/on_stream_none_reader", produces = "application/json;charset=UTF-8")
455 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 519 String mediaServerId = json.getString("mediaServerId");
461 520 String streamId = json.getString("stream");
462 521 String app = json.getString("app");
... ... @@ -568,4 +627,22 @@ public class ZLMHttpHookListener {
568 627 ret.put("msg", "success");
569 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 12 import com.genersoft.iot.vmp.storager.dao.GbStreamMapper;
13 13 import com.genersoft.iot.vmp.storager.dao.PlatformGbStreamMapper;
14 14 import com.genersoft.iot.vmp.storager.dao.StreamPushMapper;
  15 +import com.genersoft.iot.vmp.utils.DateUtil;
15 16 import org.checkerframework.checker.units.qual.C;
16 17 import org.slf4j.Logger;
17 18 import org.slf4j.LoggerFactory;
... ... @@ -114,63 +115,42 @@ public class ZLMMediaListManager {
114 115 public StreamPushItem addPush(MediaItem mediaItem) {
115 116 // 查找此直播流是否存在redis预设gbId
116 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 154 return transform;
175 155 }
176 156  
... ... @@ -204,13 +184,13 @@ public class ZLMMediaListManager {
204 184  
205 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 190 result = storager.removeMedia(app, streamId);
211 191 }else {
212 192 // TODO 暂不设置为离线
213   - result =storager.mediaOutline(app, streamId);
  193 + result =storager.mediaOffline(app, streamId);
214 194 }
215 195 return result;
216 196 }
... ...
src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMRTPServerFactory.java
... ... @@ -66,7 +66,7 @@ public class ZLMRTPServerFactory {
66 66 String stream = UUID.randomUUID().toString();
67 67 param.put("enable_tcp", 1);
68 68 param.put("stream_id", stream);
69   - param.put("port", 0);
  69 +// param.put("port", 0);
70 70 JSONObject openRtpServerResultJson = zlmresTfulUtils.openRtpServer(mediaServerItem, param);
71 71  
72 72 if (openRtpServerResultJson != null) {
... ... @@ -101,9 +101,10 @@ public class ZLMRTPServerFactory {
101 101 }
102 102  
103 103 Map<String, Object> param = new HashMap<>();
104   - // 推流端口设置0则使用随机端口
  104 +
105 105 param.put("enable_tcp", 1);
106 106 param.put("stream_id", streamId);
  107 + // 推流端口设置0则使用随机端口
107 108 param.put("port", 0);
108 109 param.put("ssrc", ssrc);
109 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 1 package com.genersoft.iot.vmp.media.zlm.dto;
2 2  
3 3 import com.genersoft.iot.vmp.gb28181.bean.GbStream;
  4 +import com.genersoft.iot.vmp.utils.DateUtil;
4 5 import org.jetbrains.annotations.NotNull;
  6 +import org.springframework.util.unit.DataUnit;
5 7  
6 8 import java.util.List;
7 9  
... ... @@ -86,6 +88,21 @@ public class StreamPushItem extends GbStream implements Comparable&lt;StreamPushIte
86 88 */
87 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 106 public String getVhost() {
90 107 return vhost;
91 108 }
... ... @@ -97,7 +114,8 @@ public class StreamPushItem extends GbStream implements Comparable&lt;StreamPushIte
97 114  
98 115 @Override
99 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 121 public static class MediaSchema {
... ... @@ -232,5 +250,32 @@ public class StreamPushItem extends GbStream implements Comparable&lt;StreamPushIte
232 250 public void setServerId(String serverId) {
233 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 15 * @param stream
16 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 24 * @param stream
25 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 30 * 根据应用名和流ID获取播放地址, 只是地址拼接
... ... @@ -32,7 +32,7 @@ public interface IMediaService {
32 32 * @param stream
33 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 38 * 根据应用名和流ID获取播放地址, 只是地址拼接,返回的ip使用远程访问ip,适用与zlm与wvp在一台主机的情况
... ... @@ -40,6 +40,6 @@ public interface IMediaService {
40 40 * @param stream
41 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 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 19 List<User> getAllUsers();
20 20  
21 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 149 if (gbStream.getGbId() != null) {
150 150 gbStreams.add(gbStream);
151 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 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 7 import com.genersoft.iot.vmp.conf.MediaConfig;
8 8 import com.genersoft.iot.vmp.media.zlm.ZLMRESTfulUtils;
9 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 12 import com.genersoft.iot.vmp.service.IMediaServerService;
11 13 import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
12 14 import com.genersoft.iot.vmp.storager.IVideoManagerStorage;
13 15 import com.genersoft.iot.vmp.service.IMediaService;
14 16 import org.springframework.beans.factory.annotation.Autowired;
15 17 import org.springframework.stereotype.Service;
  18 +import org.springframework.util.StringUtils;
16 19  
17 20 @Service
18 21 public class MediaServiceImpl implements IMediaService {
... ... @@ -36,20 +39,24 @@ public class MediaServiceImpl implements IMediaService {
36 39  
37 40  
38 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 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 48 StreamInfo streamInfo = null;
46 49 if (mediaServerId == null) {
47 50 mediaServerId = mediaConfig.getId();
48 51 }
49   - MediaServerItem mediaInfo = mediaServerService.getOne(mediaServerId);;
  52 + MediaServerItem mediaInfo = mediaServerService.getOne(mediaServerId);
50 53 if (mediaInfo == null) {
51 54 return null;
52 55 }
  56 + StreamAuthorityInfo streamAuthorityInfo = redisCatchStorage.getStreamAuthorityInfo(app, stream);
  57 + if (streamAuthorityInfo == null) {
  58 + return null;
  59 + }
53 60 JSONObject mediaList = zlmresTfulUtils.getMediaList(mediaInfo, app, stream);
54 61 if (mediaList != null) {
55 62 if (mediaList.getInteger("code") == 0) {
... ... @@ -59,7 +66,12 @@ public class MediaServiceImpl implements IMediaService {
59 66 }
60 67 JSONObject mediaJSON = JSON.parseObject(JSON.toJSONString(data.get(0)), JSONObject.class);
61 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 77 return streamInfo;
... ... @@ -68,8 +80,8 @@ public class MediaServiceImpl implements IMediaService {
68 80  
69 81  
70 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 87 @Override
... ... @@ -78,41 +90,43 @@ public class MediaServiceImpl implements IMediaService {
78 90 }
79 91  
80 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 94 StreamInfo streamInfoResult = new StreamInfo();
83 95 streamInfoResult.setStream(stream);
84 96 streamInfoResult.setApp(app);
85 97 if (addr == null) {
86 98 addr = mediaInfo.getStreamIp();
87 99 }
  100 + streamInfoResult.setIp(addr);
88 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 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 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 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 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 637 public StreamInfo onPublishHandler(MediaServerItem mediaServerItem, JSONObject resonse, String deviceId, String channelId) {
638 638 String streamId = resonse.getString("stream");
639 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 641 streamInfo.setDeviceID(deviceId);
642 642 streamInfo.setChannelId(channelId);
643 643 return streamInfo;
... ...
src/main/java/com/genersoft/iot/vmp/service/impl/RedisAlarmMsgListener.java
... ... @@ -41,6 +41,7 @@ public class RedisAlarmMsgListener implements MessageListener {
41 41 ParentPlatform platform = storage.queryParentPlatByServerGBId(gbId);
42 42  
43 43 DeviceAlarm deviceAlarm = new DeviceAlarm();
  44 + deviceAlarm.setCreateTime(DateUtil.getNow());
44 45 deviceAlarm.setChannelId(gbId);
45 46 deviceAlarm.setAlarmDescription(alarmChannelMessage.getAlarmDescription());
46 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 25  
26 26 @Override
27 27 public void onMessage(@NotNull Message message, byte[] bytes) {
28   - if (logger.isDebugEnabled()) {
29   - logger.debug("收到来自REDIS的GPS通知: {}", new String(message.getBody()));
30   - }
31 28 GPSMsgInfo gpsMsgInfo = JSON.parseObject(message.getBody(), GPSMsgInfo.class);
32 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 230 public boolean start(String app, String stream) {
231 231 boolean result = false;
232 232 StreamProxyItem streamProxy = videoManagerStorager.queryStreamProxy(app, stream);
233   - if (!streamProxy.isEnable() && streamProxy != null) {
  233 + if (!streamProxy.isEnable() ) {
234 234 JSONObject jsonObject = addStreamProxyToZlm(streamProxy);
235 235 if (jsonObject == null) {
236 236 return false;
237 237 }
  238 + System.out.println(jsonObject);
238 239 if (jsonObject.getInteger("code") == 0) {
239 240 result = true;
240 241 streamProxy.setEnable(true);
... ... @@ -250,7 +251,7 @@ public class StreamProxyServiceImpl implements IStreamProxyService {
250 251 StreamProxyItem streamProxyDto = videoManagerStorager.queryStreamProxy(app, stream);
251 252 if (streamProxyDto != null && streamProxyDto.isEnable()) {
252 253 JSONObject jsonObject = removeStreamProxyFromZlm(streamProxyDto);
253   - if (jsonObject.getInteger("code") == 0) {
  254 + if (jsonObject != null && jsonObject.getInteger("code") == 0) {
254 255 streamProxyDto.setEnable(false);
255 256 result = videoManagerStorager.updateStreamProxy(streamProxyDto);
256 257 }
... ... @@ -318,7 +319,7 @@ public class StreamProxyServiceImpl implements IStreamProxyService {
318 319 }
319 320 streamProxyMapper.deleteAutoRemoveItemByMediaServerId(mediaServerId);
320 321 // 其他的流设置离线
321   - streamProxyMapper.updateStatusByMediaServerId(false, mediaServerId);
  322 + streamProxyMapper.updateStatusByMediaServerId(mediaServerId, false);
322 323 String type = "PULL";
323 324  
324 325 // 发送redis消息
... ... @@ -345,7 +346,7 @@ public class StreamProxyServiceImpl implements IStreamProxyService {
345 346  
346 347 @Override
347 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 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 15 import com.genersoft.iot.vmp.service.IStreamPushService;
16 16 import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
17 17 import com.genersoft.iot.vmp.storager.dao.*;
  18 +import com.genersoft.iot.vmp.utils.DateUtil;
18 19 import com.github.pagehelper.PageHelper;
19 20 import com.github.pagehelper.PageInfo;
20 21 import org.slf4j.Logger;
... ... @@ -38,6 +39,9 @@ public class StreamPushServiceImpl implements IStreamPushService {
38 39 private StreamPushMapper streamPushMapper;
39 40  
40 41 @Autowired
  42 + private StreamProxyMapper streamProxyMapper;
  43 +
  44 + @Autowired
41 45 private ParentPlatformMapper parentPlatformMapper;
42 46  
43 47 @Autowired
... ... @@ -102,7 +106,7 @@ public class StreamPushServiceImpl implements IStreamPushService {
102 106 streamPushItem.setOriginType(item.getOriginType());
103 107 streamPushItem.setOriginTypeStr(item.getOriginTypeStr());
104 108 streamPushItem.setOriginUrl(item.getOriginUrl());
105   - streamPushItem.setCreateStamp(item.getCreateStamp() * 1000);
  109 + streamPushItem.setCreateTime(DateUtil.getNow());
106 110 streamPushItem.setAliveSecond(item.getAliveSecond());
107 111 streamPushItem.setStatus(true);
108 112 streamPushItem.setStreamType("push");
... ... @@ -127,7 +131,7 @@ public class StreamPushServiceImpl implements IStreamPushService {
127 131 public boolean saveToGB(GbStream stream) {
128 132 stream.setStreamType("push");
129 133 stream.setStatus(true);
130   - stream.setCreateStamp(System.currentTimeMillis());
  134 + stream.setCreateTime(DateUtil.getNow());
131 135 int add = gbStreamMapper.add(stream);
132 136  
133 137 // 查找开启了全部直播流共享的上级平台
... ... @@ -284,7 +288,8 @@ public class StreamPushServiceImpl implements IStreamPushService {
284 288 streamPushMapper.deleteWithoutGBId(mediaServerId);
285 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 294 String type = "PUSH";
290 295 // 发送redis消息
... ... @@ -317,7 +322,7 @@ public class StreamPushServiceImpl implements IStreamPushService {
317 322 streamPushItem.setStreamType("push");
318 323 streamPushItem.setStatus(true);
319 324 streamPushItem.setGbId("34020000004111" + gbId);
320   - streamPushItem.setCreateStamp(System.currentTimeMillis());
  325 + streamPushItem.setCreateTime(DateUtil.getNow());
321 326 gbId ++;
322 327 }
323 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 4 import com.alibaba.excel.event.AnalysisEventListener;
5 5 import com.genersoft.iot.vmp.media.zlm.dto.StreamPushItem;
6 6 import com.genersoft.iot.vmp.service.IStreamPushService;
  7 +import com.genersoft.iot.vmp.utils.DateUtil;
7 8 import com.genersoft.iot.vmp.vmanager.bean.StreamPushExcelDto;
8 9 import com.google.common.collect.BiMap;
9 10 import com.google.common.collect.HashBiMap;
... ... @@ -94,7 +95,7 @@ public class StreamPushUploadFileHandler extends AnalysisEventListener&lt;StreamPus
94 95 streamPushItem.setGbId(streamPushExcelDto.getGbId());
95 96 streamPushItem.setStatus(false);
96 97 streamPushItem.setStreamType("push");
97   - streamPushItem.setCreateStamp(System.currentTimeMillis());
  98 + streamPushItem.setCreateTime(DateUtil.getNow());
98 99 streamPushItem.setMediaServerId(defaultMediaServerId);
99 100 streamPushItem.setName(streamPushExcelDto.getName());
100 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 5 import com.genersoft.iot.vmp.storager.dao.dto.User;
6 6 import org.springframework.beans.factory.annotation.Autowired;
7 7 import org.springframework.stereotype.Service;
  8 +import org.springframework.util.StringUtils;
8 9  
9 10 import java.util.List;
10 11  
... ... @@ -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 3 import com.alibaba.fastjson.JSONObject;
4 4 import com.genersoft.iot.vmp.common.StreamInfo;
5 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 7 import com.genersoft.iot.vmp.service.bean.GPSMsgInfo;
10 8 import com.genersoft.iot.vmp.service.bean.MessageForPushChannel;
11 9 import com.genersoft.iot.vmp.service.bean.SSRCInfo;
... ... @@ -213,4 +211,26 @@ public interface IRedisCatchStorage {
213 211 */
214 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 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 386 void updateParentPlatformStatus(String platformGbID, boolean online);
385 387  
... ... @@ -463,5 +465,5 @@ public interface IVideoManagerStorage {
463 465  
464 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 15 @Repository
16 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 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 19 @Insert("INSERT INTO device_channel (channelId, deviceId, name, manufacture, model, owner, civilCode, block, " +
20 20 "address, parental, parentId, safetyWay, registerWay, certNum, certifiable, errCode, secrecy, " +
21 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 23 "VALUES ('${channelId}', '${deviceId}', '${name}', '${manufacture}', '${model}', '${owner}', '${civilCode}', '${block}'," +
24 24 "'${address}', ${parental}, '${parentId}', ${safetyWay}, ${registerWay}, '${certNum}', ${certifiable}, ${errCode}, '${secrecy}', " +
25 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 27 int add(DeviceChannel channel);
28 28  
29 29 @Update(value = {" <script>" +
... ... @@ -58,6 +58,7 @@ public interface DeviceChannelMapper {
58 58 "<if test='longitudeWgs84 != null'>, longitudeWgs84=${longitudeWgs84}</if>" +
59 59 "<if test='latitudeWgs84 != null'>, latitudeWgs84=${latitudeWgs84}</if>" +
60 60 "<if test='businessGroupId != null'>, businessGroupId=#{businessGroupId}</if>" +
  61 + "<if test='gpsTime != null'>, gpsTime=#{gpsTime}</if>" +
61 62 "WHERE deviceId='${deviceId}' AND channelId='${channelId}'"+
62 63 " </script>"})
63 64 int update(DeviceChannel channel);
... ... @@ -147,7 +148,7 @@ public interface DeviceChannelMapper {
147 148 "(channelId, deviceId, name, manufacture, model, owner, civilCode, block, subCount, " +
148 149 " address, parental, parentId, safetyWay, registerWay, certNum, certifiable, errCode, secrecy, " +
149 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 152 "values " +
152 153 "<foreach collection='addChannels' index='index' item='item' separator=','> " +
153 154 "('${item.channelId}', '${item.deviceId}', '${item.name}', '${item.manufacture}', '${item.model}', " +
... ... @@ -157,7 +158,7 @@ public interface DeviceChannelMapper {
157 158 "'${item.ipAddress}', ${item.port}, '${item.password}', ${item.PTZType}, ${item.status}, " +
158 159 "'${item.streamId}', ${item.longitude}, ${item.latitude},${item.longitudeGcj02}, " +
159 160 "${item.latitudeGcj02},${item.longitudeWgs84}, ${item.latitudeWgs84},'${item.createTime}', '${item.updateTime}', " +
160   - "'${item.businessGroupId}') " +
  161 + "'${item.businessGroupId}', '${item.gpsTime}') " +
161 162 "</foreach> " +
162 163 "ON DUPLICATE KEY UPDATE " +
163 164 "updateTime=VALUES(updateTime), " +
... ... @@ -189,7 +190,8 @@ public interface DeviceChannelMapper {
189 190 "latitudeGcj02=VALUES(latitudeGcj02), " +
190 191 "longitudeWgs84=VALUES(longitudeWgs84), " +
191 192 "latitudeWgs84=VALUES(latitudeWgs84), " +
192   - "businessGroupId=VALUES(businessGroupId) " +
  193 + "businessGroupId=VALUES(businessGroupId), " +
  194 + "gpsTime=VALUES(gpsTime)" +
193 195 "</script>")
194 196 int batchAdd(List<DeviceChannel> addChannels);
195 197  
... ... @@ -228,6 +230,7 @@ public interface DeviceChannelMapper {
228 230 "<if test='item.longitudeWgs84 != null'>, longitudeWgs84=${item.longitudeWgs84}</if>" +
229 231 "<if test='item.latitudeWgs84 != null'>, latitudeWgs84=${item.latitudeWgs84}</if>" +
230 232 "<if test='item.businessGroupId != null'>, businessGroupId=#{item.businessGroupId}</if>" +
  233 + "<if test='item.gpsTime != null'>, gpsTime=#{item.gpsTime}</if>" +
231 234 "WHERE deviceId='${item.deviceId}' AND channelId='${item.channelId}'"+
232 235 "</foreach>" +
233 236 "</script>"})
... ... @@ -276,8 +279,20 @@ public interface DeviceChannelMapper {
276 279 " and channelId = #{channelId}")
277 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 297 @Select("SELECT * FROM device_channel WHERE length(trim(streamId)) > 0")
283 298 List<DeviceChannel> getAllChannelInPlay();
... ... @@ -313,4 +328,6 @@ public interface DeviceChannelMapper {
313 328  
314 329 @Select("select * from device_channel where deviceId=#{deviceId} and SUBSTRING(channelId, 11, 3)=#{typeCode}")
315 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 4  
5 5 import com.genersoft.iot.vmp.gb28181.bean.MobilePosition;
6 6 import org.apache.ibatis.annotations.*;
7   -//import org.springframework.stereotype.Repository;
8 7  
9 8 @Mapper
10   -//@Repository
11 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 13 int insertNewPosition(MobilePosition mobilePosition);
16 14  
17 15 @Select(value = {" <script>" +
18 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 19 "<if test=\"startTime != null\"> AND time&gt;=#{startTime}</if>" +
21 20 "<if test=\"endTime != null\"> AND time&lt;=#{endTime}</if>" +
22 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 15 public interface GbStreamMapper {
16 16  
17 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 19 "('${app}', '${stream}', '${gbId}', '${name}', " +
20 20 "'${longitude}', '${latitude}', '${streamType}', " +
21   - "'${mediaServerId}', ${status}, ${createStamp})")
  21 + "'${mediaServerId}', ${status}, '${createTime}')")
22 22 @Options(useGeneratedKeys = true, keyProperty = "gbStreamId", keyColumn = "gbStreamId")
23 23 int add(GbStream gbStream);
24 24  
... ... @@ -68,7 +68,7 @@ public interface GbStreamMapper {
68 68 List<GbStream> selectAll(String platformId, String catalogId, String query, Boolean pushing, String mediaServerId);
69 69  
70 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 73 @Select("SELECT * FROM gb_stream WHERE gbId=#{gbId}")
74 74 List<GbStream> selectByGBId(String gbId);
... ... @@ -88,16 +88,6 @@ public interface GbStreamMapper {
88 88 "ON gs.gbStreamId = pgs.gbStreamId WHERE pgs.gbStreamId is NULL")
89 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 91 @Delete("DELETE FROM gb_stream WHERE streamType=#{type} AND gbId=NULL AND mediaServerId=#{mediaServerId}")
102 92 void deleteWithoutGBId(String type, String mediaServerId);
103 93  
... ... @@ -120,12 +110,12 @@ public interface GbStreamMapper {
120 110 @Insert("<script> " +
121 111 "INSERT IGNORE into gb_stream " +
122 112 "(app, stream, gbId, name, " +
123   - "longitude, latitude, streamType, mediaServerId, status, createStamp)" +
  113 + "longitude, latitude, streamType, mediaServerId, status, createTime)" +
124 114 "values " +
125 115 "<foreach collection='subList' index='index' item='item' separator=','> " +
126 116 "('${item.app}', '${item.stream}', '${item.gbId}', '${item.name}', " +
127 117 "'${item.longitude}', '${item.latitude}', '${item.streamType}', " +
128   - "'${item.mediaServerId}', ${item.status}, ${item.createStamp}) "+
  118 + "'${item.mediaServerId}', ${item.status}, '${item.createTime}') "+
129 119 "</foreach> " +
130 120 "</script>")
131 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 16  
17 17 @Insert("INSERT INTO parent_platform (enable, name, serverGBId, serverGBDomain, serverIP, serverPort, deviceGBId, deviceIp, " +
18 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 20 " VALUES (${enable}, '${name}', '${serverGBId}', '${serverGBDomain}', '${serverIP}', ${serverPort}, '${deviceGBId}', '${deviceIp}', " +
21 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 23 int addParentPlatform(ParentPlatform parentPlatform);
24 24  
25 25 @Update("UPDATE parent_platform " +
... ... @@ -45,6 +45,8 @@ public interface ParentPlatformMapper {
45 45 "startOfflinePush=${startOfflinePush}, " +
46 46 "catalogGroup=#{catalogGroup}, " +
47 47 "administrativeDivision=#{administrativeDivision}, " +
  48 + "createTime=#{createTime}, " +
  49 + "updateTime=#{updateTime}, " +
48 50 "catalogId=#{catalogId} " +
49 51 "WHERE id=#{id}")
50 52 int updateParentPlatform(ParentPlatform parentPlatform);
... ... @@ -86,10 +88,10 @@ public interface ParentPlatformMapper {
86 88  
87 89 @Update(value = {" <script>" +
88 90 "UPDATE parent_platform " +
89   - "SET catalogId=#{catalogId}" +
  91 + "SET catalogId=#{catalogId}, updateTime=#{updateTime}" +
90 92 "WHERE serverGBId=#{platformId}"+
91 93 "</script>"})
92   - int setDefaultCatalog(String platformId, String catalogId);
  94 + int setDefaultCatalog(String platformId, String catalogId, String updateTime);
93 95  
94 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 97 "union " +
... ...
src/main/java/com/genersoft/iot/vmp/storager/dao/StreamProxyMapper.java
... ... @@ -62,12 +62,12 @@ public interface StreamProxyMapper {
62 62 @Update("UPDATE stream_proxy " +
63 63 "SET status=#{status} " +
64 64 "WHERE mediaServerId=#{mediaServerId}")
65   - void updateStatusByMediaServerId(boolean status, String mediaServerId);
  65 + void updateStatusByMediaServerId(String mediaServerId, boolean status);
66 66  
67 67 @Update("UPDATE stream_proxy " +
68 68 "SET status=${status} " +
69 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 72 @Delete("DELETE FROM stream_proxy WHERE enable_remove_none_reader=true AND mediaServerId=#{mediaServerId}")
73 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 14 public interface StreamPushMapper {
15 15  
16 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 18 "('${app}', '${stream}', '${totalReaderCount}', '${originType}', '${originTypeStr}', " +
19   - "'${createStamp}', '${aliveSecond}', '${mediaServerId}' , '${serverId}' )")
  19 + "'${pushTime}', '${aliveSecond}', '${mediaServerId}' , '${serverId}' , '${updateTime}' , '${createTime}' )")
20 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 34 int update(StreamPushItem streamPushItem);
33 35  
34 36 @Delete("DELETE FROM stream_push WHERE app=#{app} AND stream=#{stream}")
... ... @@ -62,7 +64,7 @@ public interface StreamPushMapper {
62 64 @Select(value = {" <script>" +
63 65 "SELECT " +
64 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 68 "from " +
67 69 "stream_push st " +
68 70 "LEFT JOIN gb_stream gs " +
... ... @@ -70,25 +72,25 @@ public interface StreamPushMapper {
70 72 "WHERE " +
71 73 "1=1 " +
72 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 77 " <if test='mediaServerId != null' > AND st.mediaServerId=#{mediaServerId} </if>" +
76   - "order by st.createStamp desc" +
  78 + "order by st.createTime desc" +
77 79 " </script>"})
78 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 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 86 StreamPushItem selectOne(String app, String stream);
85 87  
86 88 @Insert("<script>" +
87 89 "Insert IGNORE INTO stream_push (app, stream, totalReaderCount, originType, originTypeStr, " +
88   - "createStamp, aliveSecond, mediaServerId) " +
  90 + "createTime, aliveSecond, mediaServerId) " +
89 91 "VALUES <foreach collection='streamPushItems' item='item' index='index' separator=','>" +
90 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 94 " </foreach>" +
93 95 "</script>")
94 96 @Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
... ... @@ -106,4 +108,13 @@ public interface StreamPushMapper {
106 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 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 10 @Repository
11 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 15 int add(User user);
16 16  
17 17 @Update(value = {" <script>" +
18 18 "UPDATE user " +
19 19 "SET updateTime='${updateTime}' " +
  20 + "<if test=\"pushKey != null\">, pushKey='${pushKey}'</if>" +
20 21 "<if test=\"role != null\">, roleId='${role.id}'</if>" +
21 22 "<if test=\"password != null\">, password='${password}'</if>" +
22 23 "<if test=\"username != null\">, username='${username}'</if>" +
... ... @@ -48,4 +49,10 @@ public interface UserMapper {
48 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 50 @ResultMap(value="roleMap")
50 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 7 private String password;
8 8 private String createTime;
9 9 private String updateTime;
  10 + private String pushKey;
10 11 private Role role;
11 12  
12 13 public int getId() {
... ... @@ -56,4 +57,12 @@ public class User {
56 57 public void setRole(Role role) {
57 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 9 import com.genersoft.iot.vmp.gb28181.bean.*;
10 10 import com.genersoft.iot.vmp.media.zlm.dto.MediaItem;
11 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 14 import com.genersoft.iot.vmp.service.bean.GPSMsgInfo;
13 15 import com.genersoft.iot.vmp.service.bean.MessageForPushChannel;
14 16 import com.genersoft.iot.vmp.service.bean.ThirdPartyGB;
... ... @@ -20,6 +22,7 @@ import org.slf4j.Logger;
20 22 import org.slf4j.LoggerFactory;
21 23 import org.springframework.beans.factory.annotation.Autowired;
22 24 import org.springframework.stereotype.Component;
  25 +import org.springframework.util.StringUtils;
23 26  
24 27 import java.util.*;
25 28  
... ... @@ -599,6 +602,26 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage {
599 602 }
600 603  
601 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 625 public MediaItem getStreamInfo(String app, String streamId, String mediaServerId) {
603 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 705 public boolean deviceIsOnline(String deviceId) {
683 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 472 */
473 473 @Override
474 474 public synchronized boolean insertMobilePosition(MobilePosition mobilePosition) {
  475 + if (mobilePosition.getDeviceId().equals(mobilePosition.getChannelId())) {
  476 + mobilePosition.setChannelId(null);
  477 + }
475 478 return deviceMobilePositionMapper.insertNewPosition(mobilePosition) > 0;
476 479 }
477 480  
... ... @@ -711,7 +714,6 @@ public class VideoManagerStorageImpl implements IVideoManagerStorage {
711 714 streamProxyItem.setStatus(true);
712 715 String now = DateUtil.getNow();
713 716 streamProxyItem.setCreateTime(now);
714   - streamProxyItem.setCreateStamp(System.currentTimeMillis());
715 717 try {
716 718 if (streamProxyMapper.add(streamProxyItem) > 0) {
717 719 if (!StringUtils.isEmpty(streamProxyItem.getGbId())) {
... ... @@ -846,7 +848,7 @@ public class VideoManagerStorageImpl implements IVideoManagerStorage {
846 848 streamPushMapper.addAll(streamPushItems);
847 849 // TODO 待优化
848 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 852 if (onlineResult > 0) {
851 853 // 发送上线通知
852 854 eventPublisher.catalogEventPublishForStream(null, streamPushItems.get(i), CatalogEvent.ON);
... ... @@ -854,11 +856,13 @@ public class VideoManagerStorageImpl implements IVideoManagerStorage {
854 856 }
855 857 }
856 858  
  859 +
  860 +
857 861 @Override
858 862 public void updateMedia(StreamPushItem streamPushItem) {
859 863 streamPushMapper.del(streamPushItem.getApp(), streamPushItem.getStream());
860 864 streamPushMapper.add(streamPushItem);
861   - gbStreamMapper.setStatus(streamPushItem.getApp(), streamPushItem.getStream(), true);
  865 + mediaOffline(streamPushItem.getApp(), streamPushItem.getStream());
862 866  
863 867 if(!StringUtils.isEmpty(streamPushItem.getGbId() )){
864 868 // 查找开启了全部直播流共享的上级平台
... ... @@ -895,8 +899,26 @@ public class VideoManagerStorageImpl implements IVideoManagerStorage {
895 899 }
896 900  
897 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 924 @Override
... ... @@ -1006,7 +1028,7 @@ public class VideoManagerStorageImpl implements IVideoManagerStorage {
1006 1028  
1007 1029 @Override
1008 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 1034 @Override
... ... @@ -1119,7 +1141,14 @@ public class VideoManagerStorageImpl implements IVideoManagerStorage {
1119 1141 }
1120 1142  
1121 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 8 import oshi.software.os.OperatingSystem;
9 9 import oshi.util.FormatUtil;
10 10  
11   -import java.text.DecimalFormat;
12 11 import java.util.HashMap;
13 12 import java.util.List;
14 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 63 @ApiOperation("查询历史轨迹")
64 64 @ApiImplicitParams({
65 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 71 public ResponseEntity<WVPResult<List<MobilePosition>>> positions(@PathVariable String deviceId,
71   - @PathVariable String channelId,
  72 + @RequestParam(required = false) String channelId,
72 73 @RequestParam(required = false) String start,
73 74 @RequestParam(required = false) String end) {
74 75 // if (logger.isDebugEnabled()) {
... ...
src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/media/MediaController.java
1 1 package com.genersoft.iot.vmp.vmanager.gb28181.media;
2 2  
3 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 8 import com.genersoft.iot.vmp.service.IMediaServerService;
5 9 import com.genersoft.iot.vmp.service.IStreamPushService;
6 10 import com.genersoft.iot.vmp.service.IMediaService;
  11 +import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
7 12 import com.genersoft.iot.vmp.storager.IVideoManagerStorage;
8 13 import com.genersoft.iot.vmp.vmanager.bean.WVPResult;
9 14 import io.swagger.annotations.Api;
... ... @@ -16,6 +21,8 @@ import org.springframework.beans.factory.annotation.Autowired;
16 21 import org.springframework.stereotype.Controller;
17 22 import org.springframework.web.bind.annotation.*;
18 23  
  24 +import javax.servlet.http.HttpServletRequest;
  25 +
19 26  
20 27 @Api(tags = "媒体流相关")
21 28 @Controller
... ... @@ -26,17 +33,11 @@ public class MediaController {
26 33 private final static Logger logger = LoggerFactory.getLogger(MediaController.class);
27 34  
28 35 @Autowired
29   - private IVideoManagerStorage storager;
30   -
31   - @Autowired
32   - private IStreamPushService streamPushService;
  36 + private IRedisCatchStorage redisCatchStorage;
33 37  
34 38 @Autowired
35 39 private IMediaService mediaService;
36 40  
37   - @Autowired
38   - private IMediaServerService mediaServerService;
39   -
40 41  
41 42 /**
42 43 * 根据应用名和流id获取播放地址
... ... @@ -52,13 +53,47 @@ public class MediaController {
52 53 })
53 54 @GetMapping(value = "/stream_info_by_app_and_stream")
54 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 92 WVPResult<StreamInfo> result = new WVPResult<>();
58   - if (streamInfoByAppAndStreamWithCheck != null){
  93 + if (streamInfo != null){
59 94 result.setCode(0);
60 95 result.setMsg("scccess");
61   - result.setData(streamInfoByAppAndStreamWithCheck);
  96 + result.setData(streamInfo);
62 97 }else {
63 98 result.setCode(-1);
64 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 11 import com.genersoft.iot.vmp.gb28181.transmit.cmd.ISIPCommanderForPlatform;
12 12 import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
13 13 import com.genersoft.iot.vmp.storager.IVideoManagerStorage;
  14 +import com.genersoft.iot.vmp.utils.DateUtil;
14 15 import com.genersoft.iot.vmp.vmanager.bean.WVPResult;
15 16 import com.genersoft.iot.vmp.vmanager.gb28181.platform.bean.ChannelReduce;
16 17 import com.genersoft.iot.vmp.vmanager.gb28181.platform.bean.UpdateChannelParam;
... ... @@ -169,6 +170,8 @@ public class PlatformController {
169 170 wvpResult.setMsg("平台 " + parentPlatform.getServerGBId() + " 已存在");
170 171 return new ResponseEntity<>(wvpResult, HttpStatus.OK);
171 172 }
  173 + parentPlatform.setCreateTime(DateUtil.getNow());
  174 + parentPlatform.setUpdateTime(DateUtil.getNow());
172 175 boolean updateResult = storager.updateParentPlatform(parentPlatform);
173 176  
174 177 if (updateResult) {
... ... @@ -232,7 +235,7 @@ public class PlatformController {
232 235 }
233 236 parentPlatform.setCharacterSet(parentPlatform.getCharacterSet().toUpperCase());
234 237 ParentPlatform parentPlatformOld = storager.queryParentPlatByServerGBId(parentPlatform.getServerGBId());
235   -
  238 + parentPlatform.setUpdateTime(DateUtil.getNow());
236 239 boolean updateResult = storager.updateParentPlatform(parentPlatform);
237 240  
238 241 if (updateResult) {
... ...
src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/play/PlayController.java
... ... @@ -197,7 +197,7 @@ public class PlayController {
197 197 JSONObject data = jsonObject.getJSONObject("data");
198 198 if (data != null) {
199 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 201 result.put("data", streamInfoResult);
202 202 }
203 203 }else {
... ...
src/main/java/com/genersoft/iot/vmp/vmanager/streamProxy/StreamProxyController.java
... ... @@ -131,6 +131,9 @@ public class StreamProxyController {
131 131 public Object start(String app, String stream){
132 132 logger.info("启用代理: " + app + "/" + stream);
133 133 boolean result = streamProxyService.start(app, stream);
  134 + if (!result) {
  135 + logger.info("启用代理失败: " + app + "/" + stream);
  136 + }
134 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 3 import com.alibaba.excel.EasyExcel;
4 4 import com.alibaba.excel.ExcelReader;
5 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 9 import com.genersoft.iot.vmp.gb28181.bean.GbStream;
7 10 import com.genersoft.iot.vmp.gb28181.transmit.callback.DeferredResultHolder;
8 11 import com.genersoft.iot.vmp.gb28181.transmit.callback.RequestMessage;
  12 +import com.genersoft.iot.vmp.media.zlm.dto.StreamAuthorityInfo;
9 13 import com.genersoft.iot.vmp.media.zlm.dto.StreamPushItem;
10 14 import com.genersoft.iot.vmp.service.IMediaServerService;
  15 +import com.genersoft.iot.vmp.service.IMediaService;
11 16 import com.genersoft.iot.vmp.service.IStreamPushService;
12 17 import com.genersoft.iot.vmp.service.impl.StreamPushUploadFileHandler;
13 18 import com.genersoft.iot.vmp.vmanager.bean.BatchGBStreamParam;
... ... @@ -30,6 +35,7 @@ import org.springframework.web.bind.annotation.*;
30 35 import org.springframework.web.context.request.async.DeferredResult;
31 36 import org.springframework.web.multipart.MultipartFile;
32 37  
  38 +import javax.servlet.http.HttpServletRequest;
33 39 import java.io.IOException;
34 40 import java.io.InputStream;
35 41 import java.util.HashMap;
... ... @@ -54,6 +60,9 @@ public class StreamPushController {
54 60 @Autowired
55 61 private DeferredResultHolder resultHolder;
56 62  
  63 + @Autowired
  64 + private IMediaService mediaService;
  65 +
57 66 @ApiOperation("推流列表查询")
58 67 @ApiImplicitParams({
59 68 @ApiImplicitParam(name="page", value = "当前页", required = true, dataTypeClass = Integer.class),
... ... @@ -237,5 +246,43 @@ public class StreamPushController {
237 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 185 record-sip: true
186 186 # 是否将日志存储进数据库
187 187 logInDatebase: true
188   - # 第三方匹配,用于从stream钟获取有效信息
189   - thirdPartyGBIdReg: "[\\s\\S]*"
190 188  
191 189 # 在线文档: swagger-ui(生产环境建议关闭)
192 190 swagger-ui:
... ...
web_src/src/components/PushVideoList.vue
... ... @@ -187,7 +187,7 @@ export default {
187 187 this.getListLoading = true;
188 188 this.$axios({
189 189 method: 'get',
190   - url: '/api/media/stream_info_by_app_and_stream',
  190 + url: '/api/push/getPlayUrl',
191 191 params: {
192 192 app: row.app,
193 193 stream: row.stream,
... ...
web_src/src/components/StreamProxyList.vue
... ... @@ -87,7 +87,7 @@
87 87 <el-divider direction="vertical"></el-divider>
88 88 <el-button size="medium" icon="el-icon-switch-button" type="text" v-if="scope.row.enable" @click="stop(scope.row)">停用</el-button>
89 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 91 <el-divider v-if="!scope.row.enable" direction="vertical"></el-divider>
92 92 <el-button size="medium" icon="el-icon-delete" type="text" style="color: #f56c6c" @click="deleteStreamProxy(scope.row)">删除</el-button>
93 93 </template>
... ... @@ -132,7 +132,7 @@
132 132 count:15,
133 133 total:0,
134 134 getListLoading: false,
135   - startBtnLaoding: false
  135 + startBtnLoading: false
136 136 };
137 137 },
138 138 computed: {
... ... @@ -169,7 +169,10 @@
169 169 }
170 170 }).then(function (res) {
171 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 176 that.getListLoading = false;
174 177 }).catch(function (error) {
175 178 console.log(error);
... ... @@ -263,7 +266,7 @@
263 266 start: function(row){
264 267 let that = this;
265 268 this.getListLoading = true;
266   - this.startBtnLaoding = true;
  269 + this.$set(row, 'startBtnLoading', true)
267 270 this.$axios({
268 271 method: 'get',
269 272 url:`/api/proxy/start`,
... ... @@ -273,7 +276,7 @@
273 276 }
274 277 }).then(function (res) {
275 278 that.getListLoading = false;
276   - that.startBtnLaoding = false;
  279 + that.$set(row, 'startBtnLoading', false)
277 280 if (res.data == "success"){
278 281 that.initData()
279 282 }else {
... ... @@ -287,7 +290,7 @@
287 290 }).catch(function (error) {
288 291 console.log(error);
289 292 that.getListLoading = false;
290   - that.startBtnLaoding = false;
  293 + that.$set(row, 'startBtnLoading', false)
291 294 });
292 295 },
293 296 stop: function(row){
... ...
web_src/src/components/common/MapComponent.vue
... ... @@ -11,6 +11,7 @@ import VectorSource from &#39;ol/source/Vector&#39;;
11 11 import Tile from 'ol/layer/Tile';
12 12 import VectorLayer from 'ol/layer/Vector';
13 13 import Style from 'ol/style/Style';
  14 +import Stroke from 'ol/style/Stroke';
14 15 import Icon from 'ol/style/Icon';
15 16 import View from 'ol/View';
16 17 import Feature from 'ol/Feature';
... ... @@ -230,7 +231,12 @@ export default {
230 231 }
231 232 let line = new LineString(points)
232 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 240 let source = new VectorSource();
235 241 source.addFeature(lineFeature);
236 242 let vectorLayer = new VectorLayer({
... ...
web_src/src/components/dialog/queryTrace.vue
... ... @@ -10,8 +10,8 @@
10 10 @close="close()"
11 11 >
12 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 15 <el-button icon="el-icon-search" size="mini" type="primary" @click="onSubmit">查询</el-button>
16 16 </div>
17 17  
... ... @@ -72,7 +72,11 @@ export default {
72 72 onSubmit: function () {
73 73 console.log("onSubmit");
74 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 80 }).then((res)=> {
77 81 this.isLoging = false;
78 82 if (typeof this.callback == "function") {
... ...
web_src/src/components/map.vue
... ... @@ -186,6 +186,14 @@ export default {
186 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 199 event, // 鼠标事件信息
... ... @@ -320,8 +328,8 @@ export default {
320 328 } else {
321 329 let positions = [];
322 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 13 <el-menu-item index="/cloudRecord">云端录像</el-menu-item>
14 14 <el-menu-item index="/mediaServerManger">节点管理</el-menu-item>
15 15 <el-menu-item index="/parentPlatformList/15/1">国标级联</el-menu-item>
16   - <el-menu-item @click="openDoc">在线文档</el-menu-item>
  16 +
17 17 <!-- <el-submenu index="/setting">-->
18 18 <!-- <template slot="title">系统设置</template>-->
19 19 <!-- <el-menu-item index="/setting/web">WEB服务</el-menu-item>-->
20 20 <!-- <el-menu-item index="/setting/sip">国标服务</el-menu-item>-->
21 21 <!-- <el-menu-item index="/setting/media">媒体服务</el-menu-item>-->
22 22 <!-- </el-submenu>-->
23   - <el-switch v-model="alarmNotify" active-text="报警信息推送" @change="alarmNotifyChannge"></el-switch>
24 23 <!-- <el-menu-item style="float: right;" @click="loginout">退出</el-menu-item>-->
25 24 <el-submenu index="" style="float: right;">
26 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 30 <el-menu-item @click="changePassword">修改密码</el-menu-item>
28 31 <el-menu-item @click="loginout">注销</el-menu-item>
29 32 </el-submenu>
... ... @@ -145,7 +148,10 @@ export default {
145 148 </script>
146 149 <style>
147 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 156 #UiHeader .el-switch__label.is-active{
151 157 color: #409EFF;
... ...