Commit f5fcc79a2c7e6379a73b14ba4e366ad1654e9475

Authored by 648540858
1 parent 0da45229

优化国标树型展示

Showing 29 changed files with 1340 additions and 536 deletions
sql/mysql.sql
1   --- MariaDB dump 10.19 Distrib 10.7.3-MariaDB, for Linux (x86_64)
  1 +-- MySQL dump 10.13 Distrib 8.0.29, for Linux (x86_64)
2 2 --
3 3 -- Host: 127.0.0.1 Database: wvp3
4 4 -- ------------------------------------------------------
5   --- Server version 8.0.0-dmr
  5 +-- Server version 8.0.29-0ubuntu0.22.04.2
6 6  
7 7 /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
8 8 /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
9 9 /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
10   -/*!40101 SET NAMES utf8mb4 */;
  10 +/*!50503 SET NAMES utf8mb4 */;
11 11 /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
12 12 /*!40103 SET TIME_ZONE='+00:00' */;
13 13 /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
... ... @@ -21,34 +21,36 @@
21 21  
22 22 DROP TABLE IF EXISTS `device`;
23 23 /*!40101 SET @saved_cs_client = @@character_set_client */;
24   -/*!40101 SET character_set_client = utf8 */;
  24 +/*!50503 SET character_set_client = utf8mb4 */;
25 25 CREATE TABLE `device` (
26   - `id` int(11) NOT NULL AUTO_INCREMENT,
27   - `deviceId` varchar(50) NOT NULL,
28   - `name` varchar(255) DEFAULT NULL,
29   - `manufacturer` varchar(255) DEFAULT NULL,
30   - `model` varchar(255) DEFAULT NULL,
31   - `firmware` varchar(255) DEFAULT NULL,
32   - `transport` varchar(50) DEFAULT NULL,
33   - `streamMode` varchar(50) DEFAULT NULL,
34   - `online` varchar(50) DEFAULT NULL,
35   - `registerTime` varchar(50) DEFAULT NULL,
36   - `keepaliveTime` varchar(50) DEFAULT NULL,
37   - `ip` varchar(50) NOT NULL,
38   - `createTime` varchar(50) NOT NULL,
39   - `updateTime` varchar(50) NOT NULL,
40   - `port` int(11) NOT NULL,
41   - `expires` int(11) NOT NULL,
42   - `subscribeCycleForCatalog` int(11) NOT NULL,
43   - `subscribeCycleForMobilePosition` int(11) NOT NULL,
44   - `mobilePositionSubmissionInterval` int(11) NOT NULL DEFAULT '5',
45   - `subscribeCycleForAlarm` int(11) NOT NULL,
46   - `hostAddress` varchar(50) NOT NULL,
47   - `charset` varchar(50) NOT NULL,
48   - `ssrcCheck` int(11) DEFAULT '0',
49   - PRIMARY KEY (`id`),
50   - UNIQUE KEY `device_deviceId_uindex` (`deviceId`)
51   -) ENGINE=InnoDB AUTO_INCREMENT=47 DEFAULT CHARSET=utf8mb4;
  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;
52 54 /*!40101 SET character_set_client = @saved_cs_client */;
53 55  
54 56 --
... ... @@ -66,20 +68,20 @@ UNLOCK TABLES;
66 68  
67 69 DROP TABLE IF EXISTS `device_alarm`;
68 70 /*!40101 SET @saved_cs_client = @@character_set_client */;
69   -/*!40101 SET character_set_client = utf8 */;
  71 +/*!50503 SET character_set_client = utf8mb4 */;
70 72 CREATE TABLE `device_alarm` (
71   - `id` int(11) NOT NULL AUTO_INCREMENT,
72   - `deviceId` varchar(50) NOT NULL,
73   - `channelId` varchar(50) NOT NULL,
74   - `alarmPriority` varchar(50) NOT NULL,
75   - `alarmMethod` varchar(50) DEFAULT NULL,
76   - `alarmTime` varchar(50) NOT NULL,
77   - `alarmDescription` varchar(255) DEFAULT NULL,
78   - `longitude` double DEFAULT NULL,
79   - `latitude` double DEFAULT NULL,
80   - `alarmType` varchar(50) DEFAULT NULL,
81   - PRIMARY KEY (`id`) USING BTREE
82   -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC;
  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
  84 +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC;
83 85 /*!40101 SET character_set_client = @saved_cs_client */;
84 86  
85 87 --
... ... @@ -97,43 +99,48 @@ UNLOCK TABLES;
97 99  
98 100 DROP TABLE IF EXISTS `device_channel`;
99 101 /*!40101 SET @saved_cs_client = @@character_set_client */;
100   -/*!40101 SET character_set_client = utf8 */;
  102 +/*!50503 SET character_set_client = utf8mb4 */;
101 103 CREATE TABLE `device_channel` (
102   - `id` int(11) NOT NULL AUTO_INCREMENT,
103   - `channelId` varchar(50) NOT NULL,
104   - `name` varchar(255) DEFAULT NULL,
105   - `manufacture` varchar(50) DEFAULT NULL,
106   - `model` varchar(50) DEFAULT NULL,
107   - `owner` varchar(50) DEFAULT NULL,
108   - `civilCode` varchar(50) DEFAULT NULL,
109   - `block` varchar(50) DEFAULT NULL,
110   - `address` varchar(50) DEFAULT NULL,
111   - `parentId` varchar(50) DEFAULT NULL,
112   - `safetyWay` int(11) DEFAULT NULL,
113   - `registerWay` int(11) DEFAULT NULL,
114   - `certNum` varchar(50) DEFAULT NULL,
115   - `certifiable` int(11) DEFAULT NULL,
116   - `errCode` int(11) DEFAULT NULL,
117   - `endTime` varchar(50) DEFAULT NULL,
118   - `secrecy` varchar(50) DEFAULT NULL,
119   - `ipAddress` varchar(50) DEFAULT NULL,
120   - `port` int(11) DEFAULT NULL,
121   - `password` varchar(255) DEFAULT NULL,
122   - `PTZType` int(11) DEFAULT NULL,
123   - `status` int(11) DEFAULT NULL,
124   - `longitude` double DEFAULT NULL,
125   - `latitude` double DEFAULT NULL,
126   - `streamId` varchar(50) DEFAULT NULL,
127   - `deviceId` varchar(50) NOT NULL,
128   - `parental` varchar(50) DEFAULT NULL,
129   - `hasAudio` bit(1) DEFAULT NULL,
130   - `createTime` varchar(50) NOT NULL,
131   - `updateTime` varchar(50) NOT NULL,
132   - `subCount` int(11) DEFAULT '0',
133   - PRIMARY KEY (`id`),
134   - UNIQUE KEY `device_channel_id_uindex` (`id`),
135   - UNIQUE KEY `device_channel_pk` (`channelId`,`deviceId`)
136   -) ENGINE=InnoDB AUTO_INCREMENT=81657 DEFAULT CHARSET=utf8mb4;
  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;
137 144 /*!40101 SET character_set_client = @saved_cs_client */;
138 145  
139 146 --
... ... @@ -151,24 +158,24 @@ UNLOCK TABLES;
151 158  
152 159 DROP TABLE IF EXISTS `device_mobile_position`;
153 160 /*!40101 SET @saved_cs_client = @@character_set_client */;
154   -/*!40101 SET character_set_client = utf8 */;
  161 +/*!50503 SET character_set_client = utf8mb4 */;
155 162 CREATE TABLE `device_mobile_position` (
156   - `id` int(11) NOT NULL AUTO_INCREMENT,
157   - `deviceId` varchar(50) NOT NULL,
158   - `channelId` varchar(50) NOT NULL,
159   - `deviceName` varchar(255) DEFAULT NULL,
160   - `time` varchar(50) NOT NULL,
161   - `longitude` double NOT NULL,
162   - `latitude` double NOT NULL,
163   - `altitude` double DEFAULT NULL,
164   - `speed` double DEFAULT NULL,
165   - `direction` double DEFAULT NULL,
166   - `reportSource` varchar(50) DEFAULT NULL,
167   - `geodeticSystem` varchar(50) DEFAULT NULL,
168   - `cnLng` varchar(50) DEFAULT NULL,
169   - `cnLat` varchar(50) DEFAULT NULL,
170   - PRIMARY KEY (`id`)
171   -) ENGINE=InnoDB AUTO_INCREMENT=6108 DEFAULT CHARSET=utf8mb4;
  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;
172 179 /*!40101 SET character_set_client = @saved_cs_client */;
173 180  
174 181 --
... ... @@ -186,23 +193,23 @@ UNLOCK TABLES;
186 193  
187 194 DROP TABLE IF EXISTS `gb_stream`;
188 195 /*!40101 SET @saved_cs_client = @@character_set_client */;
189   -/*!40101 SET character_set_client = utf8 */;
  196 +/*!50503 SET character_set_client = utf8mb4 */;
190 197 CREATE TABLE `gb_stream` (
191   - `gbStreamId` int(11) NOT NULL AUTO_INCREMENT,
192   - `app` varchar(255) NOT NULL,
193   - `stream` varchar(255) NOT NULL,
194   - `gbId` varchar(50) NOT NULL,
195   - `name` varchar(255) DEFAULT NULL,
196   - `longitude` double DEFAULT NULL,
197   - `latitude` double DEFAULT NULL,
198   - `streamType` varchar(50) DEFAULT NULL,
199   - `mediaServerId` varchar(50) DEFAULT NULL,
200   - `status` int(11) DEFAULT NULL,
201   - `createStamp` bigint(20) DEFAULT NULL,
202   - PRIMARY KEY (`gbStreamId`) USING BTREE,
203   - UNIQUE KEY `app` (`app`,`stream`) USING BTREE,
204   - UNIQUE KEY `gbId` (`gbId`) USING BTREE
205   -) ENGINE=InnoDB AUTO_INCREMENT=300769 DEFAULT CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC;
  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;
206 213 /*!40101 SET character_set_client = @saved_cs_client */;
207 214  
208 215 --
... ... @@ -220,19 +227,19 @@ UNLOCK TABLES;
220 227  
221 228 DROP TABLE IF EXISTS `log`;
222 229 /*!40101 SET @saved_cs_client = @@character_set_client */;
223   -/*!40101 SET character_set_client = utf8 */;
  230 +/*!50503 SET character_set_client = utf8mb4 */;
224 231 CREATE TABLE `log` (
225   - `id` int(11) NOT NULL AUTO_INCREMENT,
226   - `name` varchar(50) NOT NULL,
227   - `type` varchar(50) NOT NULL,
228   - `uri` varchar(200) NOT NULL,
229   - `address` varchar(50) NOT NULL,
230   - `result` varchar(50) NOT NULL,
231   - `timing` bigint(20) NOT NULL,
232   - `username` varchar(50) NOT NULL,
233   - `createTime` varchar(50) NOT NULL,
234   - PRIMARY KEY (`id`) USING BTREE
235   -) ENGINE=InnoDB AUTO_INCREMENT=1552 DEFAULT CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC;
  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 243 /*!40101 SET character_set_client = @saved_cs_client */;
237 244  
238 245 --
... ... @@ -250,34 +257,34 @@ UNLOCK TABLES;
250 257  
251 258 DROP TABLE IF EXISTS `media_server`;
252 259 /*!40101 SET @saved_cs_client = @@character_set_client */;
253   -/*!40101 SET character_set_client = utf8 */;
  260 +/*!50503 SET character_set_client = utf8mb4 */;
254 261 CREATE TABLE `media_server` (
255   - `id` varchar(255) NOT NULL,
256   - `ip` varchar(50) NOT NULL,
257   - `hookIp` varchar(50) NOT NULL,
258   - `sdpIp` varchar(50) NOT NULL,
259   - `streamIp` varchar(50) NOT NULL,
260   - `httpPort` int(11) NOT NULL,
261   - `httpSSlPort` int(11) NOT NULL,
262   - `rtmpPort` int(11) NOT NULL,
263   - `rtmpSSlPort` int(11) NOT NULL,
264   - `rtpProxyPort` int(11) NOT NULL,
265   - `rtspPort` int(11) NOT NULL,
266   - `rtspSSLPort` int(11) NOT NULL,
267   - `autoConfig` int(11) NOT NULL,
268   - `secret` varchar(50) NOT NULL,
269   - `streamNoneReaderDelayMS` int(11) NOT NULL,
270   - `rtpEnable` int(11) NOT NULL,
271   - `rtpPortRange` varchar(50) NOT NULL,
272   - `sendRtpPortRange` varchar(50) NOT NULL,
273   - `recordAssistPort` int(11) NOT NULL,
274   - `defaultServer` int(11) NOT NULL,
275   - `createTime` varchar(50) NOT NULL,
276   - `updateTime` varchar(50) NOT NULL,
277   - `hookAliveInterval` int(11) NOT NULL,
278   - PRIMARY KEY (`id`) USING BTREE,
279   - UNIQUE KEY `media_server_i` (`ip`,`httpPort`) USING BTREE
280   -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC;
  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
  287 +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC;
281 288 /*!40101 SET character_set_client = @saved_cs_client */;
282 289  
283 290 --
... ... @@ -295,36 +302,36 @@ UNLOCK TABLES;
295 302  
296 303 DROP TABLE IF EXISTS `parent_platform`;
297 304 /*!40101 SET @saved_cs_client = @@character_set_client */;
298   -/*!40101 SET character_set_client = utf8 */;
  305 +/*!50503 SET character_set_client = utf8mb4 */;
299 306 CREATE TABLE `parent_platform` (
300   - `id` int(11) NOT NULL AUTO_INCREMENT,
301   - `enable` int(11) DEFAULT NULL,
302   - `name` varchar(255) DEFAULT NULL,
303   - `serverGBId` varchar(50) NOT NULL,
304   - `serverGBDomain` varchar(50) DEFAULT NULL,
305   - `serverIP` varchar(50) DEFAULT NULL,
306   - `serverPort` int(11) DEFAULT NULL,
307   - `deviceGBId` varchar(50) NOT NULL,
308   - `deviceIp` varchar(50) DEFAULT NULL,
309   - `devicePort` varchar(50) DEFAULT NULL,
310   - `username` varchar(255) DEFAULT NULL,
311   - `password` varchar(50) DEFAULT NULL,
312   - `expires` varchar(50) DEFAULT NULL,
313   - `keepTimeout` varchar(50) DEFAULT NULL,
314   - `transport` varchar(50) DEFAULT NULL,
315   - `characterSet` varchar(50) DEFAULT NULL,
316   - `catalogId` varchar(50) NOT NULL,
317   - `ptz` int(11) DEFAULT NULL,
318   - `rtcp` int(11) DEFAULT NULL,
319   - `status` bit(1) DEFAULT NULL,
320   - `shareAllLiveStream` int(11) DEFAULT NULL,
321   - `startOfflinePush` int(11) DEFAULT '0',
322   - `administrativeDivision` varchar(50) NOT NULL,
323   - `catalogGroup` int(11) DEFAULT '1',
324   - PRIMARY KEY (`id`),
325   - UNIQUE KEY `parent_platform_id_uindex` (`id`),
326   - UNIQUE KEY `parent_platform_pk` (`serverGBId`)
327   -) ENGINE=InnoDB AUTO_INCREMENT=25 DEFAULT CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC;
  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;
328 335 /*!40101 SET character_set_client = @saved_cs_client */;
329 336  
330 337 --
... ... @@ -342,14 +349,14 @@ UNLOCK TABLES;
342 349  
343 350 DROP TABLE IF EXISTS `platform_catalog`;
344 351 /*!40101 SET @saved_cs_client = @@character_set_client */;
345   -/*!40101 SET character_set_client = utf8 */;
  352 +/*!50503 SET character_set_client = utf8mb4 */;
346 353 CREATE TABLE `platform_catalog` (
347   - `id` varchar(50) NOT NULL,
348   - `platformId` varchar(50) NOT NULL,
349   - `name` varchar(255) NOT NULL,
350   - `parentId` varchar(50) DEFAULT NULL,
351   - PRIMARY KEY (`id`) USING BTREE
352   -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC;
  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
  359 +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC;
353 360 /*!40101 SET character_set_client = @saved_cs_client */;
354 361  
355 362 --
... ... @@ -367,14 +374,14 @@ UNLOCK TABLES;
367 374  
368 375 DROP TABLE IF EXISTS `platform_gb_channel`;
369 376 /*!40101 SET @saved_cs_client = @@character_set_client */;
370   -/*!40101 SET character_set_client = utf8 */;
  377 +/*!50503 SET character_set_client = utf8mb4 */;
371 378 CREATE TABLE `platform_gb_channel` (
372   - `id` int(11) NOT NULL AUTO_INCREMENT,
373   - `platformId` varchar(50) NOT NULL,
374   - `catalogId` varchar(50) NOT NULL,
375   - `deviceChannelId` int(11) NOT NULL,
376   - PRIMARY KEY (`id`)
377   -) ENGINE=InnoDB AUTO_INCREMENT=250 DEFAULT CHARSET=utf8mb4;
  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
  384 +) ENGINE=InnoDB AUTO_INCREMENT=4889 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC;
378 385 /*!40101 SET character_set_client = @saved_cs_client */;
379 386  
380 387 --
... ... @@ -392,15 +399,15 @@ UNLOCK TABLES;
392 399  
393 400 DROP TABLE IF EXISTS `platform_gb_stream`;
394 401 /*!40101 SET @saved_cs_client = @@character_set_client */;
395   -/*!40101 SET character_set_client = utf8 */;
  402 +/*!50503 SET character_set_client = utf8mb4 */;
396 403 CREATE TABLE `platform_gb_stream` (
397   - `platformId` varchar(50) NOT NULL,
398   - `catalogId` varchar(50) NOT NULL,
399   - `gbStreamId` int(11) NOT NULL,
400   - `id` int(11) NOT NULL AUTO_INCREMENT,
401   - PRIMARY KEY (`id`),
402   - UNIQUE KEY `platform_gb_stream_pk` (`platformId`,`catalogId`,`gbStreamId`)
403   -) ENGINE=InnoDB AUTO_INCREMENT=301210 DEFAULT CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC;
  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 +) ENGINE=InnoDB AUTO_INCREMENT=302077 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC;
404 411 /*!40101 SET character_set_client = @saved_cs_client */;
405 412  
406 413 --
... ... @@ -418,29 +425,29 @@ UNLOCK TABLES;
418 425  
419 426 DROP TABLE IF EXISTS `stream_proxy`;
420 427 /*!40101 SET @saved_cs_client = @@character_set_client */;
421   -/*!40101 SET character_set_client = utf8 */;
  428 +/*!50503 SET character_set_client = utf8mb4 */;
422 429 CREATE TABLE `stream_proxy` (
423   - `id` int(11) NOT NULL AUTO_INCREMENT,
424   - `type` varchar(50) NOT NULL,
425   - `app` varchar(255) NOT NULL,
426   - `stream` varchar(255) NOT NULL,
427   - `url` varchar(255) DEFAULT NULL,
428   - `src_url` varchar(255) DEFAULT NULL,
429   - `dst_url` varchar(255) DEFAULT NULL,
430   - `timeout_ms` int(11) DEFAULT NULL,
431   - `ffmpeg_cmd_key` varchar(255) DEFAULT NULL,
432   - `rtp_type` varchar(50) DEFAULT NULL,
433   - `mediaServerId` varchar(50) DEFAULT NULL,
434   - `enable_hls` bit(1) DEFAULT NULL,
435   - `enable_mp4` bit(1) DEFAULT NULL,
436   - `enable` bit(1) NOT NULL,
437   - `status` bit(1) NOT NULL,
438   - `enable_remove_none_reader` bit(1) NOT NULL,
439   - `createTime` varchar(50) NOT NULL,
440   - `name` varchar(255) DEFAULT NULL,
441   - PRIMARY KEY (`id`),
442   - UNIQUE KEY `stream_proxy_pk` (`app`,`stream`)
443   -) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=utf8mb4;
  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;
444 451 /*!40101 SET character_set_client = @saved_cs_client */;
445 452  
446 453 --
... ... @@ -458,21 +465,21 @@ UNLOCK TABLES;
458 465  
459 466 DROP TABLE IF EXISTS `stream_push`;
460 467 /*!40101 SET @saved_cs_client = @@character_set_client */;
461   -/*!40101 SET character_set_client = utf8 */;
  468 +/*!50503 SET character_set_client = utf8mb4 */;
462 469 CREATE TABLE `stream_push` (
463   - `id` int(11) NOT NULL AUTO_INCREMENT,
464   - `app` varchar(255) NOT NULL,
465   - `stream` varchar(255) NOT NULL,
466   - `totalReaderCount` varchar(50) DEFAULT NULL,
467   - `originType` int(11) DEFAULT NULL,
468   - `originTypeStr` varchar(50) DEFAULT NULL,
469   - `createStamp` bigint(20) DEFAULT NULL,
470   - `aliveSecond` int(11) DEFAULT NULL,
471   - `mediaServerId` varchar(50) DEFAULT NULL,
472   - `serverId` varchar(50) not NULL,
473   - PRIMARY KEY (`id`),
474   - UNIQUE KEY `stream_push_pk` (`app`,`stream`)
475   -) ENGINE=InnoDB AUTO_INCREMENT=300838 DEFAULT CHARSET=utf8mb4;
  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;
476 483 /*!40101 SET character_set_client = @saved_cs_client */;
477 484  
478 485 --
... ... @@ -490,17 +497,17 @@ UNLOCK TABLES;
490 497  
491 498 DROP TABLE IF EXISTS `user`;
492 499 /*!40101 SET @saved_cs_client = @@character_set_client */;
493   -/*!40101 SET character_set_client = utf8 */;
  500 +/*!50503 SET character_set_client = utf8mb4 */;
494 501 CREATE TABLE `user` (
495   - `id` int(11) NOT NULL AUTO_INCREMENT,
496   - `username` varchar(255) NOT NULL,
497   - `password` varchar(255) NOT NULL,
498   - `roleId` int(11) NOT NULL,
499   - `createTime` varchar(50) NOT NULL,
500   - `updateTime` varchar(50) NOT NULL,
501   - PRIMARY KEY (`id`) USING BTREE,
502   - UNIQUE KEY `user_username_uindex` (`username`) USING BTREE
503   -) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC;
  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
  510 +) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC;
504 511 /*!40101 SET character_set_client = @saved_cs_client */;
505 512  
506 513 --
... ... @@ -509,8 +516,7 @@ CREATE TABLE `user` (
509 516  
510 517 LOCK TABLES `user` WRITE;
511 518 /*!40000 ALTER TABLE `user` DISABLE KEYS */;
512   -INSERT INTO `user` VALUES
513   - (1,'admin','21232f297a57a5a743894a0e4a801fc3',1,'2021 - 04 - 13 14:14:57','2021 - 04 - 13 14:14:57');
  519 +INSERT INTO `user` VALUES (1,'admin','21232f297a57a5a743894a0e4a801fc3',1,'2021 - 04 - 13 14:14:57','2021 - 04 - 13 14:14:57');
514 520 /*!40000 ALTER TABLE `user` ENABLE KEYS */;
515 521 UNLOCK TABLES;
516 522  
... ... @@ -520,15 +526,15 @@ UNLOCK TABLES;
520 526  
521 527 DROP TABLE IF EXISTS `user_role`;
522 528 /*!40101 SET @saved_cs_client = @@character_set_client */;
523   -/*!40101 SET character_set_client = utf8 */;
  529 +/*!50503 SET character_set_client = utf8mb4 */;
524 530 CREATE TABLE `user_role` (
525   - `id` int(11) NOT NULL AUTO_INCREMENT,
526   - `name` varchar(50) NOT NULL,
527   - `authority` varchar(50) NOT NULL,
528   - `createTime` varchar(50) NOT NULL,
529   - `updateTime` varchar(50) NOT NULL,
530   - PRIMARY KEY (`id`) USING BTREE
531   -) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC;
  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
  537 +) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC;
532 538 /*!40101 SET character_set_client = @saved_cs_client */;
533 539  
534 540 --
... ... @@ -537,8 +543,7 @@ CREATE TABLE `user_role` (
537 543  
538 544 LOCK TABLES `user_role` WRITE;
539 545 /*!40000 ALTER TABLE `user_role` DISABLE KEYS */;
540   -INSERT INTO `user_role` VALUES
541   - (1,'admin','0','2021-04-13 14:14:57','2021-04-13 14:14:57');
  546 +INSERT INTO `user_role` VALUES (1,'admin','0','2021-04-13 14:14:57','2021-04-13 14:14:57');
542 547 /*!40000 ALTER TABLE `user_role` ENABLE KEYS */;
543 548 UNLOCK TABLES;
544 549 /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
... ... @@ -551,4 +556,4 @@ UNLOCK TABLES;
551 556 /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
552 557 /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
553 558  
554   --- Dump completed on 2022-04-18 10:50:27
  559 +-- Dump completed on 2022-06-26 17:33:30
... ...
sql/update.sql
... ... @@ -2,7 +2,10 @@ alter table stream_push
2 2 add serverId varchar(50) not null;
3 3 alter table device
4 4 add geoCoordSys varchar(50) not null;
  5 +alter table device
  6 + add treeType varchar(50) not null;
5 7 update device set device.geoCoordSys='WGS84';
  8 +update device set device.treeType='CivilCode';
6 9 alter table device_channel
7 10 add longitudeGcj02 double default null;
8 11 alter table device_channel
... ... @@ -11,6 +14,8 @@ alter table device_channel
11 14 add longitudeWgs84 double default null;
12 15 alter table device_channel
13 16 add latitudeWgs84 double default null;
  17 +alter table device_channel
  18 + add businessGroupId varchar(50) default null;
14 19  
15 20  
16 21  
... ...
src/main/java/com/genersoft/iot/vmp/gb28181/bean/ChannelIdType.java 0 → 100644
  1 +package com.genersoft.iot.vmp.gb28181.bean;
  2 +
  3 +/**
  4 + * 国标类型编码,国标编码中11-13位为类型编码
  5 + * 详见 附 录 D 编码规则 A
  6 + * @author lin
  7 + */
  8 +public class ChannelIdType {
  9 + /**
  10 + * 中心信令控制服务器编码
  11 + */
  12 + public final static String CENTRAL_SIGNALING_CONTROL_SERVER = "200";
  13 +
  14 + /**
  15 + * 业务分组编码
  16 + */
  17 + public final static String BUSINESS_GROUP = "215";
  18 +
  19 + /**
  20 + * 虚拟组织编码
  21 + */
  22 + public final static String VIRTUAL_ORGANIZATION = "216";
  23 +}
... ...
src/main/java/com/genersoft/iot/vmp/gb28181/bean/Device.java
... ... @@ -138,6 +138,11 @@ public class Device {
138 138 */
139 139 private String geoCoordSys;
140 140  
  141 + /**
  142 + * 树类型 国标规定了两种树的展现方式 行政区划:CivilCode 和业务分组:BusinessGroup
  143 + */
  144 + private String treeType;
  145 +
141 146  
142 147 public String getDeviceId() {
143 148 return deviceId;
... ... @@ -338,4 +343,12 @@ public class Device {
338 343 public void setGeoCoordSys(String geoCoordSys) {
339 344 this.geoCoordSys = geoCoordSys;
340 345 }
  346 +
  347 + public String getTreeType() {
  348 + return treeType;
  349 + }
  350 +
  351 + public void setTreeType(String treeType) {
  352 + this.treeType = treeType;
  353 + }
341 354 }
... ...
src/main/java/com/genersoft/iot/vmp/gb28181/bean/DeviceChannel.java
... ... @@ -194,6 +194,11 @@ public class DeviceChannel {
194 194 */
195 195 private int channelType;
196 196  
  197 + /**
  198 + * 业务分组
  199 + */
  200 + private String businessGroupId;
  201 +
197 202 public int getId() {
198 203 return id;
199 204 }
... ... @@ -506,4 +511,12 @@ public class DeviceChannel {
506 511 public void setChannelType(int channelType) {
507 512 this.channelType = channelType;
508 513 }
  514 +
  515 + public String getBusinessGroupId() {
  516 + return businessGroupId;
  517 + }
  518 +
  519 + public void setBusinessGroupId(String businessGroupId) {
  520 + this.businessGroupId = businessGroupId;
  521 + }
509 522 }
... ...
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommanderFroPlatform.java
... ... @@ -406,7 +406,10 @@ public class SIPCommanderFroPlatform implements ISIPCommanderForPlatform {
406 406 if (parentPlatform == null) {
407 407 return false;
408 408 }
409   - logger.info("[发送 移动位置订阅] {}/{}->{},{}", parentPlatform.getServerGBId(), gpsMsgInfo.getId(), gpsMsgInfo.getLng(), gpsMsgInfo.getLat());
  409 + if (logger.isDebugEnabled()) {
  410 + logger.debug("[发送 移动位置订阅] {}/{}->{},{}", parentPlatform.getServerGBId(), gpsMsgInfo.getId(), gpsMsgInfo.getLng(), gpsMsgInfo.getLat());
  411 + }
  412 +
410 413 try {
411 414 String characterSet = parentPlatform.getCharacterSet();
412 415 StringBuffer deviceStatusXml = new StringBuffer(600);
... ...
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/RegisterRequestProcessor.java
... ... @@ -141,6 +141,7 @@ public class RegisterRequestProcessor extends SIPRequestProcessorParent implemen
141 141 device.setStreamMode("UDP");
142 142 device.setCharset("GB2312");
143 143 device.setGeoCoordSys("WGS84");
  144 + device.setTreeType("CivilCode");
144 145 device.setDeviceId(deviceId);
145 146 }
146 147 device.setIp(received);
... ...
src/main/java/com/genersoft/iot/vmp/gb28181/utils/XmlUtil.java
... ... @@ -249,23 +249,26 @@ public class XmlUtil {
249 249 }else {
250 250 deviceChannel.setParentId(parentId);
251 251 }
252   - }else {
253   - if (deviceChannel.getChannelId().length() <= 10) { // 此时为行政区划, 上下级行政区划使用DeviceId关联
254   - deviceChannel.setParentId(deviceChannel.getChannelId().substring(0, deviceChannel.getChannelId().length() - 2));
255   - }else if (deviceChannel.getChannelId().length() == 20) {
256   - if (Integer.parseInt(deviceChannel.getChannelId().substring(10, 13)) == 216) { // 虚拟组织
257   - deviceChannel.setParentId(businessGroupID);
258   - }else if (Integer.parseInt(device.getDeviceId().substring(10, 13) )== 118) {//NVR 如果上级设备编号是NVR则直接将NVR的编号设置给通道的上级编号
259   - deviceChannel.setParentId(device.getDeviceId());
260   - }else if (deviceChannel.getCivilCode() != null) {
261   - // 设备, 无parentId的20位是使用CivilCode表示上级的设备,
262   - // 注:215 业务分组是需要有parentId的
263   - deviceChannel.setParentId(deviceChannel.getCivilCode());
264   - }
265   - }else {
266   - deviceChannel.setParentId(deviceChannel.getDeviceId());
267   - }
268 252 }
  253 + deviceChannel.setBusinessGroupId(businessGroupID);
  254 +
  255 +// else {
  256 +// if (deviceChannel.getChannelId().length() <= 10) { // 此时为行政区划, 上下级行政区划使用DeviceId关联
  257 +// deviceChannel.setParentId(deviceChannel.getChannelId().substring(0, deviceChannel.getChannelId().length() - 2));
  258 +// }else if (deviceChannel.getChannelId().length() == 20) {
  259 +// if (Integer.parseInt(deviceChannel.getChannelId().substring(10, 13)) == 216) { // 虚拟组织
  260 +// deviceChannel.setBusinessGroupId(businessGroupID);
  261 +// }else if (Integer.parseInt(device.getDeviceId().substring(10, 13) )== 118) {//NVR 如果上级设备编号是NVR则直接将NVR的编号设置给通道的上级编号
  262 +// deviceChannel.setParentId(device.getDeviceId());
  263 +// }else if (deviceChannel.getCivilCode() != null) {
  264 +// // 设备, 无parentId的20位是使用CivilCode表示上级的设备,
  265 +// // 注:215 业务分组是需要有parentId的
  266 +// deviceChannel.setParentId(deviceChannel.getCivilCode());
  267 +// }
  268 +// }else {
  269 +// deviceChannel.setParentId(deviceChannel.getDeviceId());
  270 +// }
  271 +// }
269 272  
270 273 if (XmlUtil.getText(itemDevice, "SafetyWay") == null
271 274 || XmlUtil.getText(itemDevice, "SafetyWay") == "") {
... ...
src/main/java/com/genersoft/iot/vmp/service/IDeviceService.java
1 1 package com.genersoft.iot.vmp.service;
2 2  
3 3 import com.genersoft.iot.vmp.gb28181.bean.Device;
  4 +import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel;
4 5 import com.genersoft.iot.vmp.gb28181.bean.SyncStatus;
  6 +import com.genersoft.iot.vmp.vmanager.bean.BaseTree;
5 7  
6 8 import java.util.List;
7 9  
... ... @@ -110,4 +112,21 @@ public interface IDeviceService {
110 112 * @param device 设备信息
111 113 */
112 114 void updateDevice(Device device);
  115 +
  116 + /**
  117 + * 树形查询接口
  118 + * @param deviceId 设备ID
  119 + * @param parentId 父ID
  120 + * @param onlyCatalog 只获取目录
  121 + * @return
  122 + */
  123 + List<BaseTree<DeviceChannel>> queryVideoDeviceTree(String deviceId, String parentId, boolean onlyCatalog);
  124 +
  125 + /**
  126 + * 查询树节点下的通道
  127 + * @param deviceId 设备ID
  128 + * @param parentId 父ID
  129 + * @return
  130 + */
  131 + List<DeviceChannel> queryVideoDeviceInTreeNode(String deviceId, String parentId);
113 132 }
... ...
src/main/java/com/genersoft/iot/vmp/service/impl/DeviceServiceImpl.java
1 1 package com.genersoft.iot.vmp.service.impl;
2 2  
3 3 import com.genersoft.iot.vmp.conf.DynamicTask;
4   -import com.genersoft.iot.vmp.gb28181.bean.Device;
5   -import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel;
6   -import com.genersoft.iot.vmp.gb28181.bean.SsrcTransaction;
  4 +import com.genersoft.iot.vmp.gb28181.bean.*;
7 5 import com.genersoft.iot.vmp.gb28181.session.VideoStreamSessionManager;
8 6 import com.genersoft.iot.vmp.gb28181.task.ISubscribeTask;
9 7 import com.genersoft.iot.vmp.gb28181.transmit.cmd.ISIPCommander;
... ... @@ -12,20 +10,23 @@ import com.genersoft.iot.vmp.gb28181.utils.Coordtransform;
12 10 import com.genersoft.iot.vmp.service.IDeviceService;
13 11 import com.genersoft.iot.vmp.gb28181.task.impl.CatalogSubscribeTask;
14 12 import com.genersoft.iot.vmp.gb28181.task.impl.MobilePositionSubscribeTask;
15   -import com.genersoft.iot.vmp.gb28181.bean.SyncStatus;
16 13 import com.genersoft.iot.vmp.service.IMediaServerService;
17 14 import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
18 15 import com.genersoft.iot.vmp.storager.IVideoManagerStorage;
19 16 import com.genersoft.iot.vmp.storager.dao.DeviceChannelMapper;
20 17 import com.genersoft.iot.vmp.storager.dao.DeviceMapper;
21 18 import com.genersoft.iot.vmp.utils.DateUtil;
  19 +import com.genersoft.iot.vmp.vmanager.bean.BaseTree;
22 20 import org.slf4j.Logger;
23 21 import org.slf4j.LoggerFactory;
24 22 import org.springframework.beans.factory.annotation.Autowired;
  23 +import org.springframework.jdbc.support.incrementer.AbstractIdentityColumnMaxValueIncrementer;
25 24 import org.springframework.stereotype.Service;
26 25 import org.springframework.util.StringUtils;
27 26  
28 27 import java.time.Instant;
  28 +import java.util.ArrayList;
  29 +import java.util.Collections;
29 30 import java.util.List;
30 31 import java.util.concurrent.TimeUnit;
31 32  
... ... @@ -341,4 +342,180 @@ public class DeviceServiceImpl implements IDeviceService {
341 342 }
342 343 storage.updateChannels(device.getDeviceId(), deviceChannels);
343 344 }
  345 +
  346 +
  347 + @Override
  348 + public List<BaseTree<DeviceChannel>> queryVideoDeviceTree(String deviceId, String parentId, boolean onlyCatalog) {
  349 + Device device = deviceMapper.getDeviceByDeviceId(deviceId);
  350 + if (device == null) {
  351 + return null;
  352 + }
  353 + if (parentId == null || parentId.equals(deviceId)) {
  354 + // 字根节点开始查询
  355 + List<DeviceChannel> rootNodes = getRootNodes(deviceId, "CivilCode".equals(device.getTreeType()), true, !onlyCatalog);
  356 + return transportChannelsToTree(rootNodes, "");
  357 + }
  358 +
  359 + if ("CivilCode".equals(device.getTreeType())) {
  360 + if (parentId.length()%2 != 0) {
  361 + return null;
  362 + }
  363 + // 使用行政区划展示树
  364 + if (parentId.length() > 10) {
  365 + // TODO 可能是行政区划与业务分组混杂的情形
  366 + return null;
  367 + }
  368 +
  369 + if (parentId.length() == 10 ) {
  370 + if (onlyCatalog) {
  371 + return null;
  372 + }
  373 + // parentId为行业编码, 其下不会再有行政区划
  374 + List<DeviceChannel> channels = deviceChannelMapper.getChannelsByCivilCode(deviceId, parentId);
  375 + List<BaseTree<DeviceChannel>> trees = transportChannelsToTree(channels, parentId);
  376 + return trees;
  377 + }
  378 + // 查询其下的行政区划和摄像机
  379 + List<DeviceChannel> channelsForCivilCode = deviceChannelMapper.getChannelsWithCivilCodeAndLength(deviceId, parentId, parentId.length() + 2);
  380 + if (!onlyCatalog) {
  381 + List<DeviceChannel> channels = deviceChannelMapper.getChannelsByCivilCode(deviceId, parentId);
  382 + channelsForCivilCode.addAll(channels);
  383 + }
  384 + List<BaseTree<DeviceChannel>> trees = transportChannelsToTree(channelsForCivilCode, parentId);
  385 + return trees;
  386 +
  387 + }
  388 + // 使用业务分组展示树
  389 + if ("BusinessGroup".equals(device.getTreeType())) {
  390 + if (parentId.length() < 14 ) {
  391 + return null;
  392 + }
  393 + List<DeviceChannel> deviceChannels = deviceChannelMapper.queryChannels(deviceId, parentId, null, null, null);
  394 + List<BaseTree<DeviceChannel>> trees = transportChannelsToTree(deviceChannels, parentId);
  395 + return trees;
  396 + }
  397 +
  398 + return null;
  399 + }
  400 +
  401 + @Override
  402 + public List<DeviceChannel> queryVideoDeviceInTreeNode(String deviceId, String parentId) {
  403 + Device device = deviceMapper.getDeviceByDeviceId(deviceId);
  404 + if (device == null) {
  405 + return null;
  406 + }
  407 + if (parentId == null || parentId.equals(deviceId)) {
  408 + // 字根节点开始查询
  409 + List<DeviceChannel> rootNodes = getRootNodes(deviceId, "CivilCode".equals(device.getTreeType()), false, true);
  410 + return rootNodes;
  411 + }
  412 +
  413 + if ("CivilCode".equals(device.getTreeType())) {
  414 + if (parentId.length()%2 != 0) {
  415 + return null;
  416 + }
  417 + // 使用行政区划展示树
  418 + if (parentId.length() > 10) {
  419 + // TODO 可能是行政区划与业务分组混杂的情形
  420 + return null;
  421 + }
  422 +
  423 + if (parentId.length() == 10 ) {
  424 + // parentId为行业编码, 其下不会再有行政区划
  425 + List<DeviceChannel> channels = deviceChannelMapper.getChannelsByCivilCode(deviceId, parentId);
  426 + return channels;
  427 + }
  428 + // 查询其下的行政区划和摄像机
  429 + List<DeviceChannel> channels = deviceChannelMapper.getChannelsByCivilCode(deviceId, parentId);
  430 + return channels;
  431 +
  432 + }
  433 + // 使用业务分组展示树
  434 + if ("BusinessGroup".equals(device.getTreeType())) {
  435 + if (parentId.length() < 14 ) {
  436 + return null;
  437 + }
  438 + List<DeviceChannel> deviceChannels = deviceChannelMapper.queryChannels(deviceId, parentId, null, null, null);
  439 + return deviceChannels;
  440 + }
  441 +
  442 + return null;
  443 + }
  444 +
  445 + private List<BaseTree<DeviceChannel>> transportChannelsToTree(List<DeviceChannel> channels, String parentId) {
  446 + if (channels == null) {
  447 + return null;
  448 + }
  449 + List<BaseTree<DeviceChannel>> treeNotes = new ArrayList<>();
  450 + if (channels.size() == 0) {
  451 + return treeNotes;
  452 + }
  453 + for (DeviceChannel channel : channels) {
  454 +
  455 + BaseTree<DeviceChannel> node = new BaseTree<>();
  456 + node.setId(channel.getChannelId());
  457 + node.setDeviceId(channel.getDeviceId());
  458 + node.setName(channel.getName());
  459 + node.setPid(parentId);
  460 + node.setBasicData(channel);
  461 + node.setParent(false);
  462 + if (channel.getChannelId().length() > 8) {
  463 + String gbCodeType = channel.getChannelId().substring(10, 13);
  464 + node.setParent(gbCodeType.equals(ChannelIdType.BUSINESS_GROUP) || gbCodeType.equals(ChannelIdType.VIRTUAL_ORGANIZATION) );
  465 + }else {
  466 + node.setParent(true);
  467 + }
  468 + treeNotes.add(node);
  469 + }
  470 + Collections.sort(treeNotes);
  471 + return treeNotes;
  472 + }
  473 +
  474 + private List<DeviceChannel> getRootNodes(String deviceId, boolean isCivilCode, boolean haveCatalog, boolean haveChannel) {
  475 + if (!haveCatalog && !haveChannel) {
  476 + return null;
  477 + }
  478 + List<DeviceChannel> result = new ArrayList<>();
  479 + if (isCivilCode) {
  480 + // 使用行政区划
  481 + Integer length= deviceChannelMapper.getChannelMinLength(deviceId);
  482 + if (length == null) {
  483 + return null;
  484 + }
  485 + if (length <= 10) {
  486 + if (haveCatalog) {
  487 + List<DeviceChannel> provinceNode = deviceChannelMapper.getChannelsWithCivilCodeAndLength(deviceId, null, length);
  488 + if (provinceNode != null && provinceNode.size() > 0) {
  489 + result.addAll(provinceNode);
  490 + }
  491 + }
  492 +
  493 + if (haveChannel) {
  494 + // 查询那些civilCode不在通道中的不规范通道,放置在根目录
  495 + List<DeviceChannel> nonstandardNode = deviceChannelMapper.getChannelWithoutCiviCode(deviceId);
  496 + if (nonstandardNode != null && nonstandardNode.size() > 0) {
  497 + result.addAll(nonstandardNode);
  498 + }
  499 + }
  500 + }else {
  501 + if (haveChannel) {
  502 + List<DeviceChannel> deviceChannels = deviceChannelMapper.queryChannels(deviceId, null, null, null, null);
  503 + if (deviceChannels != null && deviceChannels.size() > 0) {
  504 + result.addAll(deviceChannels);
  505 + }
  506 + }
  507 + }
  508 +
  509 + }else {
  510 + // 使用业务分组+虚拟组织
  511 +
  512 + // 只获取业务分组
  513 + List<DeviceChannel> deviceChannels = deviceChannelMapper.getBusinessGroups(deviceId, ChannelIdType.BUSINESS_GROUP);
  514 + if (deviceChannels != null && deviceChannels.size() > 0) {
  515 + result.addAll(deviceChannels);
  516 + }
  517 + }
  518 + return result;
  519 + }
  520 +
344 521 }
... ...
src/main/java/com/genersoft/iot/vmp/service/impl/PlayServiceImpl.java
... ... @@ -123,7 +123,7 @@ public class PlayServiceImpl implements IPlayService {
123 123 result.onCompletion(()->{
124 124 // 点播结束时调用截图接口
125 125 // TODO 应该在上流时调用更好,结束也可能是错误结束
126   - String path = "static/static/snap/";
  126 + String path = "snap";
127 127 String fileName = deviceId + "_" + channelId + ".jpg";
128 128 ResponseEntity responseEntity = (ResponseEntity)result.getResult();
129 129 if (responseEntity != null && responseEntity.getStatusCode() == HttpStatus.OK) {
... ... @@ -178,7 +178,6 @@ public class PlayServiceImpl implements IPlayService {
178 178  
179 179 }
180 180  
181   -
182 181 }
183 182 if (streamInfo == null) {
184 183 String streamId = null;
... ...
src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceChannelMapper.java
1 1 package com.genersoft.iot.vmp.storager.dao;
2 2  
  3 +import com.genersoft.iot.vmp.gb28181.bean.Device;
3 4 import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel;
4 5 import com.genersoft.iot.vmp.gb28181.bean.DeviceChannelInPlatform;
5 6 import com.genersoft.iot.vmp.vmanager.gb28181.platform.bean.ChannelReduce;
... ... @@ -17,10 +18,12 @@ public interface DeviceChannelMapper {
17 18  
18 19 @Insert("INSERT INTO device_channel (channelId, deviceId, name, manufacture, model, owner, civilCode, block, " +
19 20 "address, parental, parentId, safetyWay, registerWay, certNum, certifiable, errCode, secrecy, " +
20   - "ipAddress, port, password, PTZType, status, streamId, longitude, latitude, longitudeGcj02, latitudeGcj02, longitudeWgs84, latitudeWgs84, createTime, updateTime) " +
  21 + "ipAddress, port, password, PTZType, status, streamId, longitude, latitude, longitudeGcj02, latitudeGcj02, " +
  22 + "longitudeWgs84, latitudeWgs84, createTime, updateTime, businessGroupId) " +
21 23 "VALUES ('${channelId}', '${deviceId}', '${name}', '${manufacture}', '${model}', '${owner}', '${civilCode}', '${block}'," +
22 24 "'${address}', ${parental}, '${parentId}', ${safetyWay}, ${registerWay}, '${certNum}', ${certifiable}, ${errCode}, '${secrecy}', " +
23   - "'${ipAddress}', ${port}, '${password}', ${PTZType}, ${status}, '${streamId}', ${longitude}, ${latitude}, ${longitudeGcj02}, ${latitudeGcj02}, ${longitudeWgs84}, ${latitudeWgs84},'${createTime}', '${updateTime}')")
  25 + "'${ipAddress}', ${port}, '${password}', ${PTZType}, ${status}, '${streamId}', ${longitude}, ${latitude}, ${longitudeGcj02}, " +
  26 + "${latitudeGcj02}, ${longitudeWgs84}, ${latitudeWgs84},'${createTime}', '${updateTime}', '${businessGroupId}')")
24 27 int add(DeviceChannel channel);
25 28  
26 29 @Update(value = {" <script>" +
... ... @@ -54,6 +57,7 @@ public interface DeviceChannelMapper {
54 57 "<if test='latitudeGcj02 != null'>, latitudeGcj02=${latitudeGcj02}</if>" +
55 58 "<if test='longitudeWgs84 != null'>, longitudeWgs84=${longitudeWgs84}</if>" +
56 59 "<if test='latitudeWgs84 != null'>, latitudeWgs84=${latitudeWgs84}</if>" +
  60 + "<if test='businessGroupId != null'>, businessGroupId=#{businessGroupId}</if>" +
57 61 "WHERE deviceId='${deviceId}' AND channelId='${channelId}'"+
58 62 " </script>"})
59 63 int update(DeviceChannel channel);
... ... @@ -143,7 +147,7 @@ public interface DeviceChannelMapper {
143 147 "(channelId, deviceId, name, manufacture, model, owner, civilCode, block, subCount, " +
144 148 " address, parental, parentId, safetyWay, registerWay, certNum, certifiable, errCode, secrecy, " +
145 149 " ipAddress, port, password, PTZType, status, streamId, longitude, latitude, longitudeGcj02, latitudeGcj02, " +
146   - " longitudeWgs84, latitudeWgs84, createTime, updateTime) " +
  150 + " longitudeWgs84, latitudeWgs84, createTime, updateTime, businessGroupId) " +
147 151 "values " +
148 152 "<foreach collection='addChannels' index='index' item='item' separator=','> " +
149 153 "('${item.channelId}', '${item.deviceId}', '${item.name}', '${item.manufacture}', '${item.model}', " +
... ... @@ -152,7 +156,7 @@ public interface DeviceChannelMapper {
152 156 "'${item.certNum}', ${item.certifiable}, ${item.errCode}, '${item.secrecy}', " +
153 157 "'${item.ipAddress}', ${item.port}, '${item.password}', ${item.PTZType}, ${item.status}, " +
154 158 "'${item.streamId}', ${item.longitude}, ${item.latitude},${item.longitudeGcj02}, " +
155   - "${item.latitudeGcj02},${item.longitudeWgs84}, ${item.latitudeWgs84},'${item.createTime}', '${item.updateTime}')" +
  159 + "${item.latitudeGcj02},${item.longitudeWgs84}, ${item.latitudeWgs84},'${item.createTime}', '${item.updateTime}, '${item.businessGroupId}')" +
156 160 "</foreach> " +
157 161 "ON DUPLICATE KEY UPDATE " +
158 162 "updateTime=VALUES(updateTime), " +
... ... @@ -183,7 +187,8 @@ public interface DeviceChannelMapper {
183 187 "longitudeGcj02=VALUES(longitudeGcj02), " +
184 188 "latitudeGcj02=VALUES(latitudeGcj02), " +
185 189 "longitudeWgs84=VALUES(longitudeWgs84), " +
186   - "latitudeWgs84=VALUES(latitudeWgs84) " +
  190 + "latitudeWgs84=VALUES(latitudeWgs84), " +
  191 + "businessGroupId=VALUES(businessGroupId) " +
187 192 "</script>")
188 193 int batchAdd(List<DeviceChannel> addChannels);
189 194  
... ... @@ -221,6 +226,7 @@ public interface DeviceChannelMapper {
221 226 "<if test='item.latitudeGcj02 != null'>, latitudeGcj02=${item.latitudeGcj02}</if>" +
222 227 "<if test='item.longitudeWgs84 != null'>, longitudeWgs84=${item.longitudeWgs84}</if>" +
223 228 "<if test='item.latitudeWgs84 != null'>, latitudeWgs84=${item.latitudeWgs84}</if>" +
  229 + "<if test='item.businessGroupId != null'>, businessGroupId=${item.businessGroupId}</if>" +
224 230 "WHERE deviceId='${item.deviceId}' AND channelId='${item.channelId}'"+
225 231 "</foreach>" +
226 232 "</script>"})
... ... @@ -277,4 +283,33 @@ public interface DeviceChannelMapper {
277 283  
278 284 @Select("select * from device_channel where longitude*latitude > 0 and deviceId = #{deviceId}")
279 285 List<DeviceChannel> getAllChannelWithCoordinate(String deviceId);
  286 +
  287 +
  288 + @Select(value = {" <script>" +
  289 + "select * " +
  290 + "from device_channel " +
  291 + "where deviceId=#{deviceId}" +
  292 + " <if test='parentId != null' > and left(channelId, ${parentId.length()}) = #{parentId}</if>" +
  293 + " <if test='length != null' > and length(channelId)=${length}</if>" +
  294 + " </script>"})
  295 + List<DeviceChannel> getChannelsWithCivilCodeAndLength(String deviceId, String parentId, Integer length);
  296 +
  297 + @Select(value = {" <script>" +
  298 + "select * " +
  299 + "from device_channel " +
  300 + "where deviceId=#{deviceId} and length(channelId)>14 and civilCode=#{parentId}" +
  301 + " </script>"})
  302 + List<DeviceChannel> getChannelsByCivilCode(String deviceId, String parentId);
  303 +
  304 + @Select("select min(length(channelId)) as minLength " +
  305 + "from device_channel " +
  306 + "where deviceId=#{deviceId}")
  307 + Integer getChannelMinLength(String deviceId);
  308 +
  309 + @Select("select * from device_channel where deviceId=#{deviceId} and civilCode not in " +
  310 + "(select civilCode from device_channel where deviceId=#{deviceId} group by civilCode)")
  311 + List<DeviceChannel> getChannelWithoutCiviCode(String deviceId);
  312 +
  313 + @Select("select * from device_channel where deviceId=#{deviceId} and SUBSTRING(channelId, 11, 3)=#{typeCode}")
  314 + List<DeviceChannel> getBusinessGroups(String deviceId, String typeCode);
280 315 }
... ...
src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceMapper.java
... ... @@ -39,6 +39,7 @@ public interface DeviceMapper {
39 39 "subscribeCycleForAlarm," +
40 40 "ssrcCheck," +
41 41 "geoCoordSys," +
  42 + "treeType," +
42 43 "online" +
43 44 ") VALUES (" +
44 45 "#{deviceId}," +
... ... @@ -63,6 +64,7 @@ public interface DeviceMapper {
63 64 "#{subscribeCycleForAlarm}," +
64 65 "#{ssrcCheck}," +
65 66 "#{geoCoordSys}," +
  67 + "#{treeType}," +
66 68 "#{online}" +
67 69 ")")
68 70 int add(Device device);
... ... @@ -90,6 +92,7 @@ public interface DeviceMapper {
90 92 "<if test=\"subscribeCycleForAlarm != null\">, subscribeCycleForAlarm=${subscribeCycleForAlarm}</if>" +
91 93 "<if test=\"ssrcCheck != null\">, ssrcCheck=${ssrcCheck}</if>" +
92 94 "<if test=\"geoCoordSys != null\">, geoCoordSys=#{geoCoordSys}</if>" +
  95 + "<if test=\"treeType != null\">, treeType=#{treeType}</if>" +
93 96 "WHERE deviceId='${deviceId}'"+
94 97 " </script>"})
95 98 int update(Device device);
... ...
src/main/java/com/genersoft/iot/vmp/vmanager/bean/BaseTree.java 0 → 100644
  1 +package com.genersoft.iot.vmp.vmanager.bean;
  2 +
  3 +import org.jetbrains.annotations.NotNull;
  4 +
  5 +import java.text.Collator;
  6 +import java.util.Comparator;
  7 +
  8 +/**
  9 + * @author lin
  10 + */
  11 +public class BaseTree<T> implements Comparable<BaseTree>{
  12 + private String id;
  13 +
  14 + private String deviceId;
  15 + private String pid;
  16 + private String name;
  17 + private boolean parent;
  18 +
  19 + private T basicData;
  20 +
  21 + public String getId() {
  22 + return id;
  23 + }
  24 +
  25 + public void setId(String id) {
  26 + this.id = id;
  27 + }
  28 +
  29 + public String getDeviceId() {
  30 + return deviceId;
  31 + }
  32 +
  33 + public void setDeviceId(String deviceId) {
  34 + this.deviceId = deviceId;
  35 + }
  36 +
  37 + public String getPid() {
  38 + return pid;
  39 + }
  40 +
  41 + public void setPid(String pid) {
  42 + this.pid = pid;
  43 + }
  44 +
  45 + public String getName() {
  46 + return name;
  47 + }
  48 +
  49 + public void setName(String name) {
  50 + this.name = name;
  51 + }
  52 +
  53 + public T getBasicData() {
  54 + return basicData;
  55 + }
  56 +
  57 + public void setBasicData(T basicData) {
  58 + this.basicData = basicData;
  59 + }
  60 +
  61 + public boolean isParent() {
  62 + return parent;
  63 + }
  64 +
  65 + public void setParent(boolean parent) {
  66 + this.parent = parent;
  67 + }
  68 +
  69 + @Override
  70 + public int compareTo(@NotNull BaseTree treeNode) {
  71 + if (this.parent || treeNode.isParent()) {
  72 + if (!this.parent && !treeNode.isParent()) {
  73 + Comparator cmp = Collator.getInstance(java.util.Locale.CHINA);
  74 + return cmp.compare(treeNode.getName(), this.getName());
  75 + }else {
  76 + if (this.isParent()) {
  77 + return 1;
  78 + }else {
  79 + return -1;
  80 + }
  81 + }
  82 + }else{
  83 + Comparator cmp = Collator.getInstance(java.util.Locale.CHINA);
  84 + return cmp.compare(treeNode.getName(), this.getName());
  85 + }
  86 + }
  87 +}
... ...
src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/device/DeviceQuery.java
... ... @@ -15,6 +15,7 @@ import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommander;
15 15 import com.genersoft.iot.vmp.service.IDeviceService;
16 16 import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
17 17 import com.genersoft.iot.vmp.storager.IVideoManagerStorage;
  18 +import com.genersoft.iot.vmp.vmanager.bean.BaseTree;
18 19 import com.genersoft.iot.vmp.vmanager.bean.WVPResult;
19 20 import com.github.pagehelper.PageInfo;
20 21 import io.swagger.annotations.Api;
... ... @@ -479,4 +480,99 @@ public class DeviceQuery {
479 480 resp.setStatus(HttpServletResponse.SC_NOT_FOUND);
480 481 }
481 482 }
  483 +
  484 + /**
  485 + * 查询国标树
  486 + * @param deviceId 设备ID
  487 + * @param parentId 父ID
  488 + * @param page 当前页
  489 + * @param count 每页条数
  490 + * @return 国标设备
  491 + */
  492 + @ApiOperation("查询国标树")
  493 + @ApiImplicitParams({
  494 + @ApiImplicitParam(name = "deviceId", value = "设备ID", required = true, dataTypeClass = String.class),
  495 + @ApiImplicitParam(name = "parentId", value = "父ID", required = false, dataTypeClass = String.class),
  496 + @ApiImplicitParam(name = "onlyCatalog", value = "只获取目录", required = false, dataTypeClass = Boolean.class),
  497 + @ApiImplicitParam(name="page", value = "当前页", required = true, dataTypeClass = Integer.class),
  498 + @ApiImplicitParam(name="count", value = "每页条数", required = true, dataTypeClass = Integer.class),
  499 + })
  500 + @GetMapping("/tree/{deviceId}")
  501 + public ResponseEntity<PageInfo> getTree(@PathVariable String deviceId, @RequestParam(required = false) String parentId, @RequestParam(required = false) Boolean onlyCatalog, int page, int count){
  502 +
  503 +
  504 + if (page <= 0) {
  505 + page = 1;
  506 + }
  507 + if (onlyCatalog == null) {
  508 + onlyCatalog = false;
  509 + }
  510 +
  511 + List<BaseTree<DeviceChannel>> treeData = deviceService.queryVideoDeviceTree(deviceId, parentId, onlyCatalog);
  512 + if (treeData == null || (page - 1) * count > treeData.size()) {
  513 + PageInfo<BaseTree<DeviceChannel>> pageInfo = new PageInfo<>();
  514 + pageInfo.setPageNum(page);
  515 + pageInfo.setTotal(treeData == null? 0 : treeData.size());
  516 + pageInfo.setSize(0);
  517 + pageInfo.setList(new ArrayList<>());
  518 + return new ResponseEntity<>(pageInfo,HttpStatus.OK);
  519 + }
  520 +
  521 + int toIndex = Math.min(page * count, treeData.size());
  522 + // 处理分页
  523 + List<BaseTree<DeviceChannel>> trees = treeData.subList((page - 1) * count, toIndex);
  524 + PageInfo<BaseTree<DeviceChannel>> pageInfo = new PageInfo<>();
  525 + pageInfo.setPageNum(page);
  526 + pageInfo.setTotal(treeData.size());
  527 + pageInfo.setSize(trees.size());
  528 + pageInfo.setList(trees);
  529 +
  530 + return new ResponseEntity<>(pageInfo,HttpStatus.OK);
  531 + }
  532 +
  533 +
  534 + /**
  535 + * 查询国标树下的通道
  536 + * @param deviceId 设备ID
  537 + * @param parentId 父ID
  538 + * @param page 当前页
  539 + * @param count 每页条数
  540 + * @return 国标设备
  541 + */
  542 + @ApiOperation("查询国标树下的通道")
  543 + @ApiImplicitParams({
  544 + @ApiImplicitParam(name = "deviceId", value = "设备ID", required = true, dataTypeClass = String.class),
  545 + @ApiImplicitParam(name = "parentId", value = "父ID", required = false, dataTypeClass = String.class),
  546 + @ApiImplicitParam(name="page", value = "当前页", required = true, dataTypeClass = Integer.class),
  547 + @ApiImplicitParam(name="count", value = "每页条数", required = true, dataTypeClass = Integer.class),
  548 + })
  549 + @GetMapping("/tree/channel/{deviceId}")
  550 + public ResponseEntity<PageInfo> getChannelInTreeNode(@PathVariable String deviceId, @RequestParam(required = false) String parentId, int page, int count){
  551 +
  552 +
  553 + if (page <= 0) {
  554 + page = 1;
  555 + }
  556 +
  557 + List<DeviceChannel> treeData = deviceService.queryVideoDeviceInTreeNode(deviceId, parentId);
  558 + if (treeData == null || (page - 1) * count > treeData.size()) {
  559 + PageInfo<BaseTree<DeviceChannel>> pageInfo = new PageInfo<>();
  560 + pageInfo.setPageNum(page);
  561 + pageInfo.setTotal(treeData == null? 0 : treeData.size());
  562 + pageInfo.setSize(0);
  563 + pageInfo.setList(new ArrayList<>());
  564 + return new ResponseEntity<>(pageInfo,HttpStatus.OK);
  565 + }
  566 +
  567 + int toIndex = Math.min(page * count, treeData.size());
  568 + // 处理分页
  569 + List<DeviceChannel> trees = treeData.subList((page - 1) * count, toIndex);
  570 + PageInfo<DeviceChannel> pageInfo = new PageInfo<>();
  571 + pageInfo.setPageNum(page);
  572 + pageInfo.setTotal(treeData.size());
  573 + pageInfo.setSize(trees.size());
  574 + pageInfo.setList(trees);
  575 +
  576 + return new ResponseEntity<>(pageInfo,HttpStatus.OK);
  577 + }
482 578 }
... ...
src/main/resources/logback-spring-local.xml
... ... @@ -11,6 +11,11 @@
11 11 <!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符 -->
12 12 <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50}:%L - %msg%n</pattern>
13 13 </encoder>
  14 + <filter class="ch.qos.logback.classic.filter.ThresholdFilter">
  15 + <!--与ThresholdFilter的区别,允许onmatch-->
  16 + <!--设置日志级别 接收info级别的日志-->
  17 + <level>DEBUG</level>
  18 + </filter>
14 19 </appender>
15 20  
16 21 <!-- 按照每天生成日志文件 DEBUG以上级别的日志,仅用于测试环境,正式环境为info级别以上的日志-->
... ...
web_src/package-lock.json
... ... @@ -22,7 +22,9 @@
22 22 "vue-clipboards": "^1.3.0",
23 23 "vue-contextmenujs": "^1.3.13",
24 24 "vue-cookies": "^1.7.4",
25   - "vue-router": "^3.1.6"
  25 + "vue-giant-tree": "^0.1.5",
  26 + "vue-router": "^3.1.6",
  27 + "vue-ztree-2.0": "^1.0.4"
26 28 },
27 29 "devDependencies": {
28 30 "autoprefixer": "^7.1.2",
... ... @@ -50,7 +52,7 @@
50 52 "postcss-url": "^7.2.1",
51 53 "rimraf": "^2.6.0",
52 54 "semver": "^5.3.0",
53   - "shelljs": "^0.7.6",
  55 + "shelljs": "^0.8.5",
54 56 "uglifyjs-webpack-plugin": "^1.1.1",
55 57 "url-loader": "^0.5.8",
56 58 "vue-loader": "^13.3.0",
... ... @@ -116,6 +118,17 @@
116 118 "integrity": "sha512-1HcDas8SEj4z1Wc696tH56G8OlRaH/sqZOynNNB+HF0WOeXPaxTtbYzJY2oEfiUxjSKjhCKr+MvR7dCHcEelug==",
117 119 "dev": true
118 120 },
  121 + "node_modules/@ztree/ztree_v3": {
  122 + "version": "3.5.48",
  123 + "resolved": "https://registry.npmmirror.com/@ztree/ztree_v3/-/ztree_v3-3.5.48.tgz",
  124 + "integrity": "sha512-4dSA1g26T3j/O3I89+r/Palg+a+xwMGRS1etZoggnCGBPoOrwW8VGA3zitJCK/Yd7eEMX+LfKTRJjEGiWpoN3w==",
  125 + "dependencies": {
  126 + "jquery": ">=1.4.4"
  127 + },
  128 + "engines": {
  129 + "node": ">=0.10.0"
  130 + }
  131 + },
119 132 "node_modules/accepts": {
120 133 "version": "1.3.7",
121 134 "resolved": "https://registry.npm.taobao.org/accepts/download/accepts-1.3.7.tgz",
... ... @@ -6034,6 +6047,11 @@
6034 6047 "node": ">=0.10.0"
6035 6048 }
6036 6049 },
  6050 + "node_modules/jquery": {
  6051 + "version": "3.6.0",
  6052 + "resolved": "https://registry.npmmirror.com/jquery/-/jquery-3.6.0.tgz",
  6053 + "integrity": "sha512-JVzAR/AjBvVt2BmYhxRCSYysDsPcssdmTFnzyLEts9qNwmjmu4JTAMYubEfwVOSwpQ1I1sKKFcxhZCI2buerfw=="
  6054 + },
6037 6055 "node_modules/js-base64": {
6038 6056 "version": "2.6.4",
6039 6057 "resolved": "https://registry.npm.taobao.org/js-base64/download/js-base64-2.6.4.tgz?cache=0&sync_timestamp=1599897619557&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fjs-base64%2Fdownload%2Fjs-base64-2.6.4.tgz",
... ... @@ -11655,9 +11673,9 @@
11655 11673 }
11656 11674 },
11657 11675 "node_modules/shelljs": {
11658   - "version": "0.7.8",
11659   - "resolved": "https://registry.npm.taobao.org/shelljs/download/shelljs-0.7.8.tgz",
11660   - "integrity": "sha1-3svPh0sNHl+3LhSxZKloMEjprLM=",
  11676 + "version": "0.8.5",
  11677 + "resolved": "https://registry.npmmirror.com/shelljs/-/shelljs-0.8.5.tgz",
  11678 + "integrity": "sha512-TiwcRcrkhHvbrZbnRcFYMLl30Dfov3HKqzp5tO5b4pt6G/SezKcYhmDg15zXVBswHmctSAQKznqNW2LO5tTDow==",
11661 11679 "dev": true,
11662 11680 "dependencies": {
11663 11681 "glob": "^7.0.0",
... ... @@ -11668,8 +11686,7 @@
11668 11686 "shjs": "bin/shjs"
11669 11687 },
11670 11688 "engines": {
11671   - "iojs": "*",
11672   - "node": ">=0.11.0"
  11689 + "node": ">=4"
11673 11690 }
11674 11691 },
11675 11692 "node_modules/shellwords": {
... ... @@ -13068,6 +13085,15 @@
13068 13085 "resolved": "https://registry.npm.taobao.org/vue-cookies/download/vue-cookies-1.7.4.tgz?cache=0&sync_timestamp=1598941352058&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fvue-cookies%2Fdownload%2Fvue-cookies-1.7.4.tgz",
13069 13086 "integrity": "sha1-0kHQoEMdoHlYN2UdELTXPnyNPo0="
13070 13087 },
  13088 + "node_modules/vue-giant-tree": {
  13089 + "version": "0.1.5",
  13090 + "resolved": "https://registry.npmmirror.com/vue-giant-tree/-/vue-giant-tree-0.1.5.tgz",
  13091 + "integrity": "sha512-P3KEHSZU2NkpWl6frss+sJLO0DLrtarMNLeTV/IGU2/w50rgrlKbKNr/ckK6BBVdWXAJYlYf6HUTNkKvGq5hlg==",
  13092 + "dependencies": {
  13093 + "@ztree/ztree_v3": "^3.5.44",
  13094 + "jquery": "^3.5.1"
  13095 + }
  13096 + },
13071 13097 "node_modules/vue-hot-reload-api": {
13072 13098 "version": "2.3.4",
13073 13099 "resolved": "https://registry.npm.taobao.org/vue-hot-reload-api/download/vue-hot-reload-api-2.3.4.tgz",
... ... @@ -13175,6 +13201,11 @@
13175 13201 "integrity": "sha1-HuO8mhbsv1EYvjNLsV+cRvgvWCU=",
13176 13202 "dev": true
13177 13203 },
  13204 + "node_modules/vue-ztree-2.0": {
  13205 + "version": "1.0.4",
  13206 + "resolved": "https://registry.npmmirror.com/vue-ztree-2.0/-/vue-ztree-2.0-1.0.4.tgz",
  13207 + "integrity": "sha512-d7KZsquEYpM0jD/k1uwOMFCd08L6++7zwRESaL2sF43OtRFCump8BxcLpjusBIHpFadPvOSMMnK5P41y+ZiTlA=="
  13208 + },
13178 13209 "node_modules/watchpack": {
13179 13210 "version": "1.7.4",
13180 13211 "resolved": "https://registry.npm.taobao.org/watchpack/download/watchpack-1.7.4.tgz?cache=0&sync_timestamp=1600385388649&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fwatchpack%2Fdownload%2Fwatchpack-1.7.4.tgz",
... ... @@ -14419,6 +14450,14 @@
14419 14450 "integrity": "sha512-1HcDas8SEj4z1Wc696tH56G8OlRaH/sqZOynNNB+HF0WOeXPaxTtbYzJY2oEfiUxjSKjhCKr+MvR7dCHcEelug==",
14420 14451 "dev": true
14421 14452 },
  14453 + "@ztree/ztree_v3": {
  14454 + "version": "3.5.48",
  14455 + "resolved": "https://registry.npmmirror.com/@ztree/ztree_v3/-/ztree_v3-3.5.48.tgz",
  14456 + "integrity": "sha512-4dSA1g26T3j/O3I89+r/Palg+a+xwMGRS1etZoggnCGBPoOrwW8VGA3zitJCK/Yd7eEMX+LfKTRJjEGiWpoN3w==",
  14457 + "requires": {
  14458 + "jquery": ">=1.4.4"
  14459 + }
  14460 + },
14422 14461 "accepts": {
14423 14462 "version": "1.3.7",
14424 14463 "resolved": "https://registry.npm.taobao.org/accepts/download/accepts-1.3.7.tgz",
... ... @@ -19488,6 +19527,11 @@
19488 19527 "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=",
19489 19528 "dev": true
19490 19529 },
  19530 + "jquery": {
  19531 + "version": "3.6.0",
  19532 + "resolved": "https://registry.npmmirror.com/jquery/-/jquery-3.6.0.tgz",
  19533 + "integrity": "sha512-JVzAR/AjBvVt2BmYhxRCSYysDsPcssdmTFnzyLEts9qNwmjmu4JTAMYubEfwVOSwpQ1I1sKKFcxhZCI2buerfw=="
  19534 + },
19491 19535 "js-base64": {
19492 19536 "version": "2.6.4",
19493 19537 "resolved": "https://registry.npm.taobao.org/js-base64/download/js-base64-2.6.4.tgz?cache=0&sync_timestamp=1599897619557&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fjs-base64%2Fdownload%2Fjs-base64-2.6.4.tgz",
... ... @@ -24156,9 +24200,9 @@
24156 24200 "dev": true
24157 24201 },
24158 24202 "shelljs": {
24159   - "version": "0.7.8",
24160   - "resolved": "https://registry.npm.taobao.org/shelljs/download/shelljs-0.7.8.tgz",
24161   - "integrity": "sha1-3svPh0sNHl+3LhSxZKloMEjprLM=",
  24203 + "version": "0.8.5",
  24204 + "resolved": "https://registry.npmmirror.com/shelljs/-/shelljs-0.8.5.tgz",
  24205 + "integrity": "sha512-TiwcRcrkhHvbrZbnRcFYMLl30Dfov3HKqzp5tO5b4pt6G/SezKcYhmDg15zXVBswHmctSAQKznqNW2LO5tTDow==",
24162 24206 "dev": true,
24163 24207 "requires": {
24164 24208 "glob": "^7.0.0",
... ... @@ -25352,6 +25396,15 @@
25352 25396 "resolved": "https://registry.npm.taobao.org/vue-cookies/download/vue-cookies-1.7.4.tgz?cache=0&sync_timestamp=1598941352058&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fvue-cookies%2Fdownload%2Fvue-cookies-1.7.4.tgz",
25353 25397 "integrity": "sha1-0kHQoEMdoHlYN2UdELTXPnyNPo0="
25354 25398 },
  25399 + "vue-giant-tree": {
  25400 + "version": "0.1.5",
  25401 + "resolved": "https://registry.npmmirror.com/vue-giant-tree/-/vue-giant-tree-0.1.5.tgz",
  25402 + "integrity": "sha512-P3KEHSZU2NkpWl6frss+sJLO0DLrtarMNLeTV/IGU2/w50rgrlKbKNr/ckK6BBVdWXAJYlYf6HUTNkKvGq5hlg==",
  25403 + "requires": {
  25404 + "@ztree/ztree_v3": "^3.5.44",
  25405 + "jquery": "^3.5.1"
  25406 + }
  25407 + },
25355 25408 "vue-hot-reload-api": {
25356 25409 "version": "2.3.4",
25357 25410 "resolved": "https://registry.npm.taobao.org/vue-hot-reload-api/download/vue-hot-reload-api-2.3.4.tgz",
... ... @@ -25448,6 +25501,11 @@
25448 25501 "integrity": "sha1-HuO8mhbsv1EYvjNLsV+cRvgvWCU=",
25449 25502 "dev": true
25450 25503 },
  25504 + "vue-ztree-2.0": {
  25505 + "version": "1.0.4",
  25506 + "resolved": "https://registry.npmmirror.com/vue-ztree-2.0/-/vue-ztree-2.0-1.0.4.tgz",
  25507 + "integrity": "sha512-d7KZsquEYpM0jD/k1uwOMFCd08L6++7zwRESaL2sF43OtRFCump8BxcLpjusBIHpFadPvOSMMnK5P41y+ZiTlA=="
  25508 + },
25451 25509 "watchpack": {
25452 25510 "version": "1.7.4",
25453 25511 "resolved": "https://registry.npm.taobao.org/watchpack/download/watchpack-1.7.4.tgz?cache=0&sync_timestamp=1600385388649&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fwatchpack%2Fdownload%2Fwatchpack-1.7.4.tgz",
... ...
web_src/package.json
... ... @@ -24,7 +24,9 @@
24 24 "vue-clipboards": "^1.3.0",
25 25 "vue-contextmenujs": "^1.3.13",
26 26 "vue-cookies": "^1.7.4",
27   - "vue-router": "^3.1.6"
  27 + "vue-giant-tree": "^0.1.5",
  28 + "vue-router": "^3.1.6",
  29 + "vue-ztree-2.0": "^1.0.4"
28 30 },
29 31 "devDependencies": {
30 32 "autoprefixer": "^7.1.2",
... ...
web_src/src/components/DeviceList.vue
... ... @@ -56,11 +56,11 @@
56 56 @mouseover="getTooltipContent(scope.row.deviceId)">刷新
57 57 </el-button>
58 58 <el-divider direction="vertical"></el-divider>
59   - <el-button type="text" size="medium" icon="el-icon-video-camera" v-bind:disabled="scope.row.online==0"
  59 + <el-button type="text" size="medium" icon="el-icon-video-camera"
60 60 @click="showChannelList(scope.row)">通道
61 61 </el-button>
62 62 <el-divider direction="vertical"></el-divider>
63   - <el-button size="medium" icon="el-icon-location" v-bind:disabled="scope.row.online==0" type="text"
  63 + <el-button size="medium" icon="el-icon-location" type="text"
64 64 @click="showDevicePosition(scope.row)">定位
65 65 </el-button>
66 66 <el-divider direction="vertical"></el-divider>
... ... @@ -192,7 +192,7 @@ export default {
192 192  
193 193 },
194 194 showChannelList: function (row) {
195   - this.$router.push(`/channelList/${row.deviceId}/0/15/1`);
  195 + this.$router.push(`/channelList/${row.deviceId}/0`);
196 196 },
197 197 showDevicePosition: function (row) {
198 198 this.$router.push(`/map?deviceId=${row.deviceId}`);
... ...
web_src/src/components/channelList.vue
... ... @@ -7,104 +7,116 @@
7 7 通道列表
8 8 </div>
9 9 <div class="page-header-btn">
10   - 搜索:
11   - <el-input @input="search" style="margin-right: 1rem; width: auto;" size="mini" placeholder="关键字"
12   - prefix-icon="el-icon-search" v-model="searchSrt" clearable></el-input>
  10 + <div v-if="!showTree" style="display: inline;">
  11 + 搜索:
  12 + <el-input @input="search" style="margin-right: 1rem; width: auto;" size="mini" placeholder="关键字"
  13 + prefix-icon="el-icon-search" v-model="searchSrt" clearable></el-input>
13 14  
14   - 通道类型:
15   - <el-select size="mini" @change="search" style="margin-right: 1rem;" v-model="channelType" placeholder="请选择"
16   - default-first-option>
17   - <el-option label="全部" value=""></el-option>
18   - <el-option label="设备" value="false"></el-option>
19   - <el-option label="子目录" value="true"></el-option>
20   - </el-select>
21   - 在线状态:
22   - <el-select size="mini" style="margin-right: 1rem;" @change="search" v-model="online" placeholder="请选择"
23   - default-first-option>
24   - <el-option label="全部" value=""></el-option>
25   - <el-option label="在线" value="true"></el-option>
26   - <el-option label="离线" value="false"></el-option>
27   - </el-select>
  15 + 通道类型:
  16 + <el-select size="mini" @change="search" style="margin-right: 1rem;" v-model="channelType" placeholder="请选择"
  17 + default-first-option>
  18 + <el-option label="全部" value=""></el-option>
  19 + <el-option label="设备" value="false"></el-option>
  20 + <el-option label="子目录" value="true"></el-option>
  21 + </el-select>
  22 + 在线状态:
  23 + <el-select size="mini" style="margin-right: 1rem;" @change="search" v-model="online" placeholder="请选择"
  24 + default-first-option>
  25 + <el-option label="全部" value=""></el-option>
  26 + <el-option label="在线" value="true"></el-option>
  27 + <el-option label="离线" value="false"></el-option>
  28 + </el-select>
  29 + </div>
28 30 <el-button icon="el-icon-refresh-right" circle size="mini" @click="refresh()"></el-button>
  31 + <el-button v-if="showTree" icon="iconfont icon-list" circle size="mini" @click="switchList()"></el-button>
  32 + <el-button v-if="!showTree" icon="iconfont icon-tree" circle size="mini" @click="switchTree()"></el-button>
29 33 </div>
30 34 </div>
31 35 <devicePlayer ref="devicePlayer" v-loading="isLoging"></devicePlayer>
32   - <!--设备列表-->
33   - <el-table ref="channelListTable" :data="deviceChannelList" :height="winHeight" style="width: 100%" header-row-class-name="table-header">
34   - <el-table-column prop="channelId" label="通道编号" min-width="200">
35   - </el-table-column>
36   - <el-table-column prop="deviceId" label="设备编号" min-width="200">
37   - </el-table-column>
38   - <el-table-column prop="name" label="通道名称" min-width="200">
39   - </el-table-column>
40   - <el-table-column label="快照" min-width="120">
41   - <template v-slot:default="scope">
42   - <el-image
43   - :src="getSnap(scope.row)"
44   - :preview-src-list="getBigSnap(scope.row)"
45   - @error="getSnapErrorEvent(scope.row.deviceId, scope.row.channelId)"
46   - :fit="'contain'"
47   - style="width: 60px">
48   - <div slot="error" class="image-slot">
49   - <i class="el-icon-picture-outline"></i>
50   - </div>
51   - </el-image>
52   - </template>
53   - </el-table-column>
54   - <el-table-column prop="subCount" label="子节点数" min-width="120">
55   - </el-table-column>
56   - <el-table-column prop="manufacture" label="厂家" min-width="120">
57   - </el-table-column>
58   - <el-table-column label="位置信息" min-width="200">
59   - <template slot-scope="scope">
60   - <span v-if="scope.row.longitude*scope.row.latitude > 0">{{ scope.row.longitude }},<br>{{ scope.row.latitude }}</span>
61   - <span v-if="scope.row.longitude*scope.row.latitude === 0">无</span>
62   - </template>
63   - </el-table-column>
64   - <el-table-column prop="ptztypeText" label="云台类型" min-width="120"/>
65   - <el-table-column label="开启音频" min-width="120">
66   - <template slot-scope="scope">
67   - <el-switch @change="updateChannel(scope.row)" v-model="scope.row.hasAudio" active-color="#409EFF">
68   - </el-switch>
69   - </template>
70   - </el-table-column>
71   - <el-table-column label="状态" min-width="120">
72   - <template slot-scope="scope">
73   - <div slot="reference" class="name-wrapper">
74   - <el-tag size="medium" v-if="scope.row.status === 1">在线</el-tag>
75   - <el-tag size="medium" type="info" v-if="scope.row.status === 0">离线</el-tag>
76   - </div>
77   - </template>
78   - </el-table-column>
  36 + <el-container v-loading="isLoging" style="height: 82vh;">
  37 + <el-aside width="auto" style="height: 82vh; background-color: #ffffff; overflow: auto" v-if="showTree" >
  38 + <DeviceTree ref="deviceTree" :device="device" :onlyCatalog="true" :clickEvent="treeNodeClickEvent" ></DeviceTree>
  39 + </el-aside>
  40 + <el-main style="padding: 5px;">
  41 + <el-table ref="channelListTable" :data="deviceChannelList" :height="winHeight" style="width: 100%" header-row-class-name="table-header">
  42 + <el-table-column prop="channelId" label="通道编号" min-width="200">
  43 + </el-table-column>
  44 + <el-table-column prop="deviceId" label="设备编号" min-width="200">
  45 + </el-table-column>
  46 + <el-table-column prop="name" label="通道名称" min-width="200">
  47 + </el-table-column>
  48 + <el-table-column label="快照" min-width="120">
  49 + <template v-slot:default="scope">
  50 + <el-image
  51 + :src="getSnap(scope.row)"
  52 + :preview-src-list="getBigSnap(scope.row)"
  53 + @error="getSnapErrorEvent(scope.row.deviceId, scope.row.channelId)"
  54 + :fit="'contain'"
  55 + style="width: 60px">
  56 + <div slot="error" class="image-slot">
  57 + <i class="el-icon-picture-outline"></i>
  58 + </div>
  59 + </el-image>
  60 + </template>
  61 + </el-table-column>
  62 + <el-table-column prop="subCount" label="子节点数" min-width="120">
  63 + </el-table-column>
  64 + <el-table-column prop="manufacture" label="厂家" min-width="120">
  65 + </el-table-column>
  66 + <el-table-column label="位置信息" min-width="200">
  67 + <template slot-scope="scope">
  68 + <span v-if="scope.row.longitude*scope.row.latitude > 0">{{ scope.row.longitude }},<br>{{ scope.row.latitude }}</span>
  69 + <span v-if="scope.row.longitude*scope.row.latitude === 0">无</span>
  70 + </template>
  71 + </el-table-column>
  72 + <el-table-column prop="ptztypeText" label="云台类型" min-width="120"/>
  73 + <el-table-column label="开启音频" min-width="120">
  74 + <template slot-scope="scope">
  75 + <el-switch @change="updateChannel(scope.row)" v-model="scope.row.hasAudio" active-color="#409EFF">
  76 + </el-switch>
  77 + </template>
  78 + </el-table-column>
  79 + <el-table-column label="状态" min-width="120">
  80 + <template slot-scope="scope">
  81 + <div slot="reference" class="name-wrapper">
  82 + <el-tag size="medium" v-if="scope.row.status === 1">在线</el-tag>
  83 + <el-tag size="medium" type="info" v-if="scope.row.status === 0">离线</el-tag>
  84 + </div>
  85 + </template>
  86 + </el-table-column>
79 87  
80 88  
81   - <el-table-column label="操作" min-width="280" fixed="right">
82   - <template slot-scope="scope">
83   - <!-- <el-button size="mini" icon="el-icon-video-play" v-if="scope.row.parental == 0" @click="sendDevicePush(scope.row)">播放</el-button> -->
84   - <el-button size="medium" icon="el-icon-video-play" type="text" @click="sendDevicePush(scope.row)">播放</el-button>
85   - <el-button size="medium" icon="el-icon-switch-button" type="text" style="color: #f56c6c" v-if="!!scope.row.streamId"
86   - @click="stopDevicePush(scope.row)">停止
87   - </el-button>
88   - <el-divider direction="vertical"></el-divider>
89   - <el-button size="medium" icon="el-icon-s-open" type="text" v-if="scope.row.subCount > 0 || scope.row.parental === 1"
90   - @click="changeSubchannel(scope.row)">查看
91   - </el-button>
92   - <el-divider v-if="scope.row.subCount > 0 || scope.row.parental === 1" direction="vertical"></el-divider>
93   - <el-button size="medium" icon="el-icon-video-camera" type="text" @click="queryRecords(scope.row)">设备录像
94   - </el-button>
95   - </template>
96   - </el-table-column>
97   - </el-table>
98   - <el-pagination
99   - style="float: right"
100   - @size-change="handleSizeChange"
101   - @current-change="currentChange"
102   - :current-page="currentPage"
103   - :page-size="count"
104   - :page-sizes="[15, 25, 35, 50]"
105   - layout="total, sizes, prev, pager, next"
106   - :total="total">
107   - </el-pagination>
  89 + <el-table-column label="操作" min-width="280" fixed="right">
  90 + <template slot-scope="scope">
  91 + <el-button size="medium" v-bind:disabled="device == null || device.online === 0" icon="el-icon-video-play" type="text" @click="sendDevicePush(scope.row)">播放</el-button>
  92 + <el-button size="medium" v-bind:disabled="device == null || device.online === 0" icon="el-icon-switch-button" type="text" style="color: #f56c6c" v-if="!!scope.row.streamId"
  93 + @click="stopDevicePush(scope.row)">停止
  94 + </el-button>
  95 + <el-divider direction="vertical"></el-divider>
  96 + <el-button size="medium" icon="el-icon-s-open" type="text" v-if="scope.row.subCount > 0 || scope.row.parental === 1"
  97 + @click="changeSubchannel(scope.row)">查看
  98 + </el-button>
  99 + <el-divider v-if="scope.row.subCount > 0 || scope.row.parental === 1" direction="vertical"></el-divider>
  100 + <el-button size="medium" v-bind:disabled="device == null || device.online === 0" icon="el-icon-video-camera" type="text" @click="queryRecords(scope.row)">设备录像
  101 + </el-button>
  102 + </template>
  103 + </el-table-column>
  104 + </el-table>
  105 + <el-pagination
  106 + style="float: right"
  107 + @size-change="handleSizeChange"
  108 + @current-change="currentChange"
  109 + :current-page="currentPage"
  110 + :page-size="count"
  111 + :page-sizes="[15, 25, 35, 50]"
  112 + layout="total, sizes, prev, pager, next"
  113 + :total="total">
  114 + </el-pagination>
  115 + </el-main>
  116 + </el-container>
  117 +
  118 + <!--设备列表-->
  119 +
108 120 </div>
109 121 </template>
110 122  
... ... @@ -114,12 +126,14 @@ import uiHeader from &#39;../layout/UiHeader.vue&#39;
114 126 import moment from "moment";
115 127 import DviceService from "./service/DeviceService";
116 128 import DeviceService from "./service/DeviceService";
  129 +import DeviceTree from "./common/DeviceTree";
117 130  
118 131 export default {
119 132 name: 'channelList',
120 133 components: {
121 134 devicePlayer,
122   - uiHeader
  135 + uiHeader,
  136 + DeviceTree
123 137 },
124 138 data() {
125 139 return {
... ... @@ -134,12 +148,13 @@ export default {
134 148 searchSrt: "",
135 149 channelType: "",
136 150 online: "",
137   - winHeight: window.innerHeight - 250,
138   - currentPage: parseInt(this.$route.params.page),
139   - count: parseInt(this.$route.params.count),
  151 + winHeight: window.innerHeight - 200,
  152 + currentPage: 1,
  153 + count: 15,
140 154 total: 0,
141 155 beforeUrl: "/deviceList",
142 156 isLoging: false,
  157 + showTree: false,
143 158 loadSnap: {}
144 159 };
145 160 },
... ... @@ -172,19 +187,16 @@ export default {
172 187 initParam: function () {
173 188 this.deviceId = this.$route.params.deviceId;
174 189 this.parentChannelId = this.$route.params.parentChannelId;
175   - this.currentPage = parseInt(this.$route.params.page);
176   - this.count = parseInt(this.$route.params.count);
  190 + this.currentPage = 1;
  191 + this.count = 15;
177 192 if (this.parentChannelId == "" || this.parentChannelId == 0) {
178 193 this.beforeUrl = "/deviceList"
179 194 }
180 195  
181 196 },
182 197 currentChange: function (val) {
183   - var url = `/${this.$router.currentRoute.name}/${this.deviceId}/${this.parentChannelId}/${this.count}/${val}`
184   - this.$router.push(url).then(() => {
185   - this.initParam();
186   - this.initData();
187   - })
  198 + this.currentPage = val;
  199 + this.initData();
188 200 },
189 201 handleSizeChange: function (val) {
190 202 this.count = val;
... ... @@ -316,28 +328,48 @@ export default {
316 328 })
317 329 },
318 330 showSubchannels: function (channelId) {
319   - let that = this;
  331 + if (!this.showTree) {
  332 + this.$axios({
  333 + method: 'get',
  334 + url: `/api/device/query/sub_channels/${this.deviceId}/${this.parentChannelId}/channels`,
  335 + params: {
  336 + page: this.currentPage,
  337 + count: this.count,
  338 + query: this.searchSrt,
  339 + online: this.online,
  340 + channelType: this.channelType
  341 + }
  342 + }).then( (res) =>{
  343 + this.total = res.data.total;
  344 + this.deviceChannelList = res.data.list;
  345 + // 防止出现表格错位
  346 + this.$nextTick(() => {
  347 + this.$refs.channelListTable.doLayout();
  348 + })
  349 + }).catch(function (error) {
  350 + console.log(error);
  351 + });
  352 + }else {
  353 + this.$axios({
  354 + method: 'get',
  355 + url: `/api/device/query/tree/channel/${this.deviceId}`,
  356 + params: {
  357 + parentId: this.parentChannelId,
  358 + page: this.currentPage,
  359 + count: this.count,
  360 + }
  361 + }).then((res)=> {
  362 + this.total = res.data.total;
  363 + this.deviceChannelList = res.data.list;
  364 + // 防止出现表格错位
  365 + this.$nextTick(() => {
  366 + this.$refs.channelListTable.doLayout();
  367 + })
  368 + }).catch(function (error) {
  369 + console.log(error);
  370 + });
  371 + }
320 372  
321   - this.$axios({
322   - method: 'get',
323   - url: `/api/device/query/sub_channels/${this.deviceId}/${this.parentChannelId}/channels`,
324   - params: {
325   - page: that.currentPage,
326   - count: that.count,
327   - query: that.searchSrt,
328   - online: that.online,
329   - channelType: that.channelType
330   - }
331   - }).then(function (res) {
332   - that.total = res.data.total;
333   - that.deviceChannelList = res.data.list;
334   - // 防止出现表格错位
335   - that.$nextTick(() => {
336   - that.$refs.channelListTable.doLayout();
337   - })
338   - }).catch(function (error) {
339   - console.log(error);
340   - });
341 373 },
342 374 search: function () {
343 375 this.currentPage = 1;
... ... @@ -355,6 +387,29 @@ export default {
355 387 },
356 388 refresh: function () {
357 389 this.initData();
  390 + },
  391 + switchTree: function (){
  392 + this.showTree = true;
  393 + this.deviceChannelList = [];
  394 + this.parentChannelId = 0;
  395 + this.currentPage = 1;
  396 +
  397 + },
  398 + switchList: function (){
  399 + this.showTree = false;
  400 + this.deviceChannelList = [];
  401 + this.parentChannelId = 0;
  402 + this.currentPage = 1;
  403 + this.initData();
  404 + },
  405 + treeNodeClickEvent: function (device, data, isCatalog) {
  406 + console.log(device)
  407 + if (!!!data.channelId) {
  408 + this.parentChannelId = device.deviceId;
  409 + }else {
  410 + this.parentChannelId = data.channelId;
  411 + }
  412 + this.initData();
358 413 }
359 414  
360 415 }
... ...
web_src/src/components/common/DeviceTree.vue
... ... @@ -4,7 +4,7 @@
4 4 <el-header>设备列表</el-header>
5 5 <el-main style="background-color: #ffffff;">
6 6 <div class="device-tree-main-box">
7   - <el-tree :props="defaultProps" :load="loadNode" lazy @node-click="handleNodeClick"@node-contextmenu="handleContextMenu" style="min-width: 100%; display:inline-block !important;">
  7 + <el-tree ref="gdTree" :props="defaultProps" :load="loadNode" lazy @node-click="handleNodeClick"@node-contextmenu="handleContextMenu" node-key="id" style="min-width: 100%; display:inline-block !important;">
8 8 <span class="custom-tree-node" slot-scope="{ node, data }" style="width: 100%">
9 9 <span v-if="node.data.type === 0 && node.data.online" title="在线设备" class="device-online iconfont icon-jiedianleizhukongzhongxin2"></span>
10 10 <span v-if="node.data.type === 0 && !node.data.online " title="离线设备" class="device-offline iconfont icon-jiedianleizhukongzhongxin2"></span>
... ... @@ -47,98 +47,112 @@ export default {
47 47 }
48 48 };
49 49 },
50   - props: ['clickEvent', 'contextMenuEvent'],
  50 + props: ['device', 'onlyCatalog', 'clickEvent', 'contextMenuEvent'],
51 51 methods: {
52 52 handleNodeClick(data,node,element) {
53   - console.log("点击事件")
54   - console.log(data)
  53 + let deviceNode = this.$refs.gdTree.getNode(data.userData.deviceId)
55 54 if(typeof (this.clickEvent) == "function") {
56   - this.clickEvent(data.userData)
  55 + this.clickEvent(deviceNode.data.userData, data.userData, data.type === 2)
57 56 }
58 57 },
59 58 handleContextMenu(event,data,node,element) {
60 59 console.log("右键点击事件")
  60 + let deviceNode = this.$refs.gdTree.getNode(data.userData.deviceId)
61 61 if(typeof (this.contextMenuEvent) == "function") {
62   - this.contextMenuEvent(event, data.userData)
  62 + this.contextMenuEvent(deviceNode.data.userData, event, data.userData, data.type === 2)
63 63 }
64 64 },
65 65 loadNode: function(node, resolve){
  66 + console.log(this.device)
66 67 if (node.level === 0) {
67   - this.deviceService.getAllDeviceList((data)=>{
68   - console.log(data)
69   - if (data.length > 0) {
70   - let nodeList = []
71   - for (let i = 0; i < data.length; i++) {
72   - console.log(data[i].name)
73   - let node = {
74   - name: data[i].name || data[i].deviceId,
75   - isLeaf: false,
76   - id: data[i].deviceId,
77   - type: data[i].online,
78   - online: data[i].online === 1,
79   - userData: data[i]
  68 + if (this.device) {
  69 + let node = {
  70 + name: this.device.name || this.device.deviceId,
  71 + isLeaf: false,
  72 + id: this.device.deviceId,
  73 + type: this.device.online,
  74 + online: this.device.online === 1,
  75 + userData: this.device
  76 + }
  77 + resolve([node])
  78 + }else {
  79 + this.deviceService.getAllDeviceList((data)=>{
  80 + console.log(data)
  81 + if (data.length > 0) {
  82 + let nodeList = []
  83 + for (let i = 0; i < data.length; i++) {
  84 + console.log(data[i].name)
  85 + let node = {
  86 + name: data[i].name || data[i].deviceId,
  87 + isLeaf: false,
  88 + id: data[i].deviceId,
  89 + type: data[i].online,
  90 + online: data[i].online === 1,
  91 + userData: data[i]
  92 + }
  93 + nodeList.push(node);
80 94 }
81   - nodeList.push(node);
  95 + resolve(nodeList)
  96 + }else {
  97 + resolve([])
82 98 }
83   - resolve(nodeList)
84   - }else {
85   - resolve([])
86   - }
87   - }, (list)=>{
  99 + }, (list)=>{
88 100 console.log("设备加载完成")
89   - }, (error)=>{
  101 + }, (error)=>{
90 102  
91   - })
92   - }
93   - if (node.level === 1) {
  103 + })
  104 + }
  105 + }else {
94 106 let channelArray = []
95   - this.deviceService.getAllChannel(true, true, node.data.id, catalogData =>{
  107 +
  108 + this.deviceService.getTree(node.data.userData.deviceId, node.data.id, this.onlyCatalog, catalogData =>{
  109 + console.log(catalogData)
96 110 channelArray = channelArray.concat(catalogData)
97 111 this.channelDataHandler(channelArray, resolve)
98 112 },(endCatalogData) => {
99   - this.deviceService.getAllChannel(false, true, node.data.id, channelData => {
100   - channelArray = channelArray.concat(channelData)
101   - this.channelDataHandler(channelArray, resolve)
102   - }, endChannelList => {
103 113  
104   - })
105   - })
106   - }else if (node.level > 1){
107   - let channelArray = []
108   - this.deviceService.getAllSubChannel(true, node.data.deviceId, node.data.id, (catalogData)=>{
109   - channelArray = channelArray.concat(catalogData)
110   - this.channelDataHandler(channelArray, resolve)
111   - }, (endCatalogData)=>{
112   - this.deviceService.getAllSubChannel(false, node.data.deviceId, node.data.id, (channelData)=>{
113   - channelArray = channelArray.concat(channelData)
114   - this.channelDataHandler(channelArray, resolve)
115   - })
116 114 })
117 115 }
  116 +
118 117 },
119 118 channelDataHandler: function (data, resolve) {
120 119 if (data.length > 0) {
121 120 let nodeList = []
122   - for (let i = 0; i < data.length; i++) {
  121 + for (let i = 0; i <data.length; i++) {
  122 + let item = data[i];
123 123 let type = 3;
124   - if (data[i].subCount > 0 || data[i].parental === 1) {
  124 + if (item.id.length <= 10) {
125 125 type = 2;
126   - }else if (data[i].ptztype === 1 ) { // 1-球机;2-半球;3-固定枪机;4-遥控枪机
127   - type = 4;
128   - }else if (data[i].ptztype === 2) {
129   - type = 5;
130   - }else if (data[i].ptztype === 3 || data[i].ptztype === 4) {
131   - type = 6;
  126 + }else {
  127 + if (item.id.length > 14) {
  128 + let channelType = item.id.substring(10, 13)
  129 + console.log("channelType: " + channelType)
  130 + if (channelType === '215' || channelType === '216') {
  131 + type = 2;
  132 + }
  133 + console.log(type)
  134 + if (item.basicData.ptztype === 1 ) { // 1-球机;2-半球;3-固定枪机;4-遥控枪机
  135 + type = 4;
  136 + }else if (item.basicData.ptztype === 2) {
  137 + type = 5;
  138 + }else if (item.basicData.ptztype === 3 || item.basicData.ptztype === 4) {
  139 + type = 6;
  140 + }
  141 + }else {
  142 + if (item.basicData.subCount > 0 || item.basicData.parental === 1) {
  143 + type = 2;
  144 + }
  145 + }
132 146 }
133 147 let node = {
134   - name: data[i].name || data[i].channelId,
135   - isLeaf: data[i].subCount === 0,
136   - id: data[i].channelId,
137   - deviceId: data[i].deviceId,
  148 + name: item.name || item.basicData.channelId,
  149 + isLeaf: type !== 2,
  150 + id: item.id,
  151 + deviceId: item.deviceId,
138 152 type: type,
139   - online: data[i].status === 1,
140   - hasGPS: data[i].longitude*data[i].latitude !== 0,
141   - userData: data[i]
  153 + online: item.basicData.status === 1,
  154 + hasGPS: item.basicData.longitude*item.basicData.latitude !== 0,
  155 + userData: item.basicData
142 156 }
143 157 nodeList.push(node);
144 158 }
... ... @@ -146,6 +160,9 @@ export default {
146 160 }else {
147 161 resolve([])
148 162 }
  163 + },
  164 + reset: function (){
  165 + this.$forceUpdate();
149 166 }
150 167 },
151 168 destroyed() {
... ...
web_src/src/components/common/DeviceTreeForZtree.vue 0 → 100644
  1 +<template>
  2 + <div id="DeviceTree" style="width: 100%;height: 100%; background-color: #FFFFFF; overflow: auto">
  3 + <el-container>
  4 + <el-header>设备列表</el-header>
  5 + <el-main style="background-color: #ffffff;">
  6 + <div class="device-tree-main-box">
  7 + <tree
  8 + :nodes="nodes"
  9 + @onClick="onClick"
  10 + @onCheck="onCheck"
  11 + @onExpand="onExpand"
  12 + @onCreated="handleCreated"
  13 + />
  14 + </div>
  15 + </el-main>
  16 + </el-container>
  17 + </div>
  18 +</template>
  19 +
  20 +<script>
  21 +import DeviceService from "../service/DeviceService.js";
  22 +import tree from "vue-giant-tree";
  23 +
  24 +export default {
  25 + name: 'DeviceTreeForZtree',
  26 + components: {
  27 + tree
  28 + },
  29 + data() {
  30 + return {
  31 + deviceService: new DeviceService(),
  32 + device: null,
  33 + nodes:[],
  34 + setting: {
  35 + callback: {
  36 + beforeExpand: this.beforeExpand
  37 + },
  38 + // async: {
  39 + // enable: true,
  40 + // type: "get",
  41 + // url: `/api/device/query/tree`,
  42 + // contentType: "application/json",
  43 + // // autoParam: ["pid=parentId"],
  44 + // },
  45 + check: {
  46 + enable: false,
  47 + },
  48 + edit: {
  49 + enable: false,
  50 + }
  51 + },
  52 + defaultProps: {
  53 + children: 'children',
  54 + label: 'name',
  55 + isLeaf: 'isLeaf'
  56 + }
  57 + };
  58 + },
  59 + props: ['clickEvent', 'contextMenuEvent'],
  60 + mounted() {
  61 + this.deviceService.getAllDeviceList((data)=>{
  62 + console.log(data)
  63 + for (let i = 0; i < data.length; i++) {
  64 + console.log(data[i].name)
  65 + let node = {
  66 + name: data[i].name || data[i].deviceId,
  67 + id: data[i].deviceId,
  68 + isParent: true,
  69 + }
  70 + this.nodes.push(node)
  71 + }
  72 + }, (list)=>{
  73 + console.log("设备加载完成")
  74 + })
  75 + },
  76 + methods: {
  77 + onClick(evt, treeId, treeNode) {
  78 + console.log(evt)
  79 + console.log(treeId)
  80 + console.log(treeNode)
  81 + },
  82 + onCheck(evt, treeId, treeNode) {
  83 + console.log(evt)
  84 + },
  85 + beforeExpand(treeId, treeNode) {
  86 + console.log(treeId)
  87 + console.log(treeNode)
  88 + return true;
  89 + },
  90 + onExpand(evt, treeId, treeNode) {
  91 + // console.log(evt)
  92 + // console.log(treeId)
  93 + // console.log(treeNodes)
  94 + },
  95 + handleCreated(ztreeObj) {
  96 + console.log(ztreeObj)
  97 + }
  98 + }
  99 +}
  100 +</script>
  101 +
  102 +<style>
  103 +.device-tree-main-box{
  104 + text-align: left;
  105 +}
  106 +.device-online{
  107 + color: #252525;
  108 +}
  109 +.device-offline{
  110 + color: #727272;
  111 +}
  112 +</style>
... ...
web_src/src/components/dialog/deviceEdit.vue
... ... @@ -42,6 +42,12 @@
42 42 <el-option key="GCJ02" label="GCJ02" value="GCJ02"></el-option>
43 43 </el-select>
44 44 </el-form-item>
  45 + <el-form-item label="目录结构" prop="treeType" >
  46 + <el-select v-model="form.treeType" style="float: left; width: 100%" >
  47 + <el-option key="WGS84" label="行政区划" value="CivilCode"></el-option>
  48 + <el-option key="GCJ02" label="业务分组" value="BusinessGroup"></el-option>
  49 + </el-select>
  50 + </el-form-item>
45 51 <el-form-item label="目录订阅" title="0为取消订阅" prop="subscribeCycleForCatalog" >
46 52 <el-input v-model="form.subscribeCycleForCatalog" clearable ></el-input>
47 53 </el-form-item>
... ...
web_src/src/components/live.vue
... ... @@ -107,20 +107,24 @@ export default {
107 107 console.log(idx);
108 108 this.clear(idx.substring(idx.length - 1))
109 109 },
110   - clickEvent: function (data) {
111   - if (data.channelId && data.subCount == 0) {
112   - this.sendDevicePush(data)
  110 + clickEvent: function (device, data, isCatalog) {
  111 + if (data.channelId && !isCatalog) {
  112 + if (device.online === 0) {
  113 + this.$message.error('设备离线!不允许点播');
  114 + }else {
  115 + this.sendDevicePush(data)
  116 + }
113 117 }
114 118 },
115   - contextMenuEvent: function (data) {
  119 + contextMenuEvent: function (device, event, data, isCatalog) {
116 120  
117 121 },
118 122 //通知设备上传媒体流
119 123 sendDevicePush: function (itemData) {
120   - if (itemData.status === 0) {
121   - this.$message.error('设备离线!');
122   - return
123   - }
  124 + // if (itemData.status === 0) {
  125 + // this.$message.error('设备离线!');
  126 + // return
  127 + // }
124 128 this.save(itemData)
125 129 let deviceId = itemData.deviceId;
126 130 // this.isLoging = true;
... ...
web_src/src/components/map.vue
... ... @@ -16,7 +16,8 @@
16 16 <el-descriptions class="margin-top" :title="channel.name" :column="1" :colon="true" size="mini" :labelStyle="labelStyle" >
17 17 <el-descriptions-item label="编号" >{{channel.channelId}}</el-descriptions-item>
18 18 <el-descriptions-item label="型号">{{channel.model}}</el-descriptions-item>
19   - <el-descriptions-item label="经纬度" >{{channel.longitude}},{{channel.latitude}}</el-descriptions-item>
  19 + <el-descriptions-item label="经度" >{{channel[longitudeStr]}}</el-descriptions-item>
  20 + <el-descriptions-item label="纬度" >{{channel[latitudeStr]}}</el-descriptions-item>
20 21 <el-descriptions-item label="生产厂商">{{channel.manufacture}}</el-descriptions-item>
21 22 <el-descriptions-item label="行政区域" >{{channel.civilCode}}</el-descriptions-item>
22 23 <el-descriptions-item label="设备归属" >{{channel.owner}}</el-descriptions-item>
... ... @@ -28,7 +29,7 @@
28 29 </el-descriptions-item>
29 30 </el-descriptions>
30 31 <div style="padding-top: 10px">
31   - <el-button type="primary" size="small" title="播放" icon="el-icon-video-play" @click="play(channel)"></el-button>
  32 + <el-button v-bind:disabled="device == null || device.online === 0" type="primary" size="small" title="播放" icon="el-icon-video-play" @click="play(channel)"></el-button>
32 33 <el-button type="primary" size="small" title="编辑位置" icon="el-icon-edit" @click="edit(channel)"></el-button>
33 34 <el-button type="primary" size="small" title="轨迹查询" icon="el-icon-map-location" @click="getTrace(channel)"></el-button>
34 35 </div>
... ... @@ -64,11 +65,14 @@ export default {
64 65 layer: null,
65 66 lineLayer: null,
66 67 channel: null,
  68 + device: null,
67 69 infoBoxId: null,
68 70 labelStyle: {
69 71 width: "56px"
70 72 },
71 73 isLoging: false,
  74 + longitudeStr: "longitude",
  75 + latitudeStr: "latitude",
72 76 };
73 77 },
74 78 created() {
... ... @@ -78,17 +82,27 @@ export default {
78 82 setTimeout(()=>{ // 延迟以等待地图加载完成 TODO 后续修改为通过是实际这;状态加回调完成
79 83 this.deviceService.getAllChannel(false, false, this.$route.query.deviceId, this.channelsHandler)
80 84 }, 1000)
81   -
  85 + }
  86 + if (window.mapParam.coordinateSystem == "GCJ-02") {
  87 + this.longitudeStr = "longitudeGcj02";
  88 + this.latitudeStr = "latitudeGcj02";
  89 + }else if (window.mapParam.coordinateSystem == "WGS84") {
  90 + this.longitudeStr = "longitudeWgs84";
  91 + this.latitudeStr = "latitudeWgs84";
  92 + }else {
  93 + this.longitudeStr = "longitude";
  94 + this.latitudeStr = "latitude";
82 95 }
83 96 },
84 97 destroyed() {
85 98  
86 99 },
87 100 methods: {
88   - clickEvent: function (data) {
89   - if (data.channelId && data.subCount == 0) {
  101 + clickEvent: function (device, data, isCatalog) {
  102 + this.device = device;
  103 + if (data.channelId && !isCatalog) {
90 104 // 点击通道
91   - if (data.longitude * data.latitude === 0) {
  105 + if (data[this.longitudeStr] * data[this.latitudeStr] === 0) {
92 106 this.$message.error('未获取到位置信息');
93 107 } else {
94 108 if (this.layer != null) {
... ... @@ -96,26 +110,29 @@ export default {
96 110 }
97 111 this.closeInfoBox()
98 112 this.layer = this.$refs.map.addLayer([{
99   - position: [data.longitude, data.latitude],
  113 + position: [data[this.longitudeStr], data[this.latitudeStr]],
100 114 image: {
101 115 src: this.getImageByChannel(data),
102 116 anchor: [0.5, 1]
103 117 },
104 118 data: data
105 119 }], this.featureClickEvent)
106   - this.$refs.map.panTo([data.longitude, data.latitude], mapParam.maxZoom)
  120 + this.$refs.map.panTo([data[this.longitudeStr], data[this.latitudeStr]], mapParam.maxZoom)
107 121 }
108 122 }
109 123 },
110   - contextmenuEventHandler: function (event, data) {
111   - if (data.channelId && data.subCount == 0) {
  124 + contextmenuEventHandler: function (device, event, data, isCatalog) {
  125 + console.log(device)
  126 + console.log(device.online)
  127 + this.device = device;
  128 + if (data.channelId && !isCatalog) {
112 129 // 点击通道
113 130 this.$contextmenu({
114 131 items: [
115 132 {
116 133 label: "播放",
117 134 icon: "el-icon-video-play",
118   - disabled: false,
  135 + disabled: device.online === 0,
119 136 onClick: () => {
120 137 this.play(data);
121 138 }
... ... @@ -183,22 +200,11 @@ export default {
183 200 this.clean()
184 201 this.closeInfoBox()
185 202 let params = [];
186   - let longitudeStr;
187   - let latitudeStr;
188   - if (window.mapParam.coordinateSystem == "GCJ-02") {
189   - longitudeStr = "longitudeGcj02";
190   - latitudeStr = "latitudeGcj02";
191   - }else if (window.mapParam.coordinateSystem == "WGS84") {
192   - longitudeStr = "longitudeWgs84";
193   - latitudeStr = "latitudeWgs84";
194   - }else {
195   - longitudeStr = "longitude";
196   - latitudeStr = "latitude";
197   - }
  203 +
198 204  
199 205 for (let i = 0; i < channels.length; i++) {
200   - let longitude = channels[i][longitudeStr];
201   - let latitude = channels[i][latitudeStr];
  206 + let longitude = channels[i][this.longitudeStr];
  207 + let latitude = channels[i][this.latitudeStr];
202 208 if (longitude * latitude === 0) {
203 209 continue;
204 210 }
... ... @@ -217,7 +223,7 @@ export default {
217 223 this.layer = this.$refs.map.addLayer(params, this.featureClickEvent)
218 224 console.log(4)
219 225 if (params.length === 1) {
220   - this.$refs.map.panTo([channels[0][longitudeStr], channels[0][latitudeStr]], mapParam.maxZoom)
  226 + this.$refs.map.panTo([channels[0][this.longitudeStr], channels[0][this.latitudeStr]], mapParam.maxZoom)
221 227 } else if (params.length > 1) {
222 228 this.$refs.map.fit(this.layer)
223 229 } else {
... ... @@ -266,19 +272,7 @@ export default {
266 272 this.channel = channels[0]
267 273 }
268 274 this.$nextTick(() => {
269   - let longitudeStr;
270   - let latitudeStr;
271   - if (window.mapParam.coordinateSystem == "GCJ-02") {
272   - longitudeStr = "longitudeGcj02";
273   - latitudeStr = "latitudeGcj02";
274   - }else if (window.mapParam.coordinateSystem == "WGS84") {
275   - longitudeStr = "longitudeWgs84";
276   - latitudeStr = "latitudeWgs84";
277   - }else {
278   - longitudeStr = "longitude";
279   - latitudeStr = "latitude";
280   - }
281   - let position = [this.channel[longitudeStr], this.channel[latitudeStr]];
  275 + let position = [this.channel[this.longitudeStr], this.channel[this.latitudeStr]];
282 276 this.infoBoxId = this.$refs.map.openInfoBox(position, this.$refs.infobox, [0, -50])
283 277 })
284 278 },
... ...
web_src/src/components/service/DeviceService.js
... ... @@ -133,6 +133,49 @@ class DeviceService{
133 133 if (typeof (callback) == "function") callback(res.data)
134 134 }).catch(errorCallback);
135 135 }
  136 +
  137 + getTree(deviceId, id, param3, param4) {
  138 +
  139 + }
  140 +
  141 + getTree(deviceId, parentId, onlyCatalog, callback, endCallback, errorCallback) {
  142 + let currentPage = 1;
  143 + let count = 100;
  144 + let catalogList = []
  145 + this.getTreeIteration(deviceId, parentId, onlyCatalog, catalogList, currentPage, count, callback, endCallback, errorCallback)
  146 + }
  147 +
  148 + getTreeIteration(deviceId, parentId, onlyCatalog, catalogList, currentPage, count, callback, endCallback, errorCallback) {
  149 + this.getTreeInfo(deviceId, parentId, onlyCatalog, currentPage, count, (data) => {
  150 + if (data.list) {
  151 + if (typeof (callback) == "function") callback(data.list)
  152 + catalogList = catalogList.concat(data.list);
  153 + if (catalogList.length < data.total) {
  154 + currentPage ++
  155 + this.getTreeIteration(deviceId, parentId, onlyCatalog, catalogList, currentPage, count, callback, endCallback, errorCallback)
  156 + }else {
  157 + if (typeof (endCallback) == "function") endCallback(catalogList)
  158 + }
  159 + }
  160 + }, errorCallback)
  161 + }
  162 + getTreeInfo(deviceId, parentId, onlyCatalog, currentPage, count, callback, errorCallback) {
  163 + if (onlyCatalog == null || typeof onlyCatalog === "undefined") {
  164 + onlyCatalog = false;
  165 + }
  166 + this.$axios({
  167 + method: 'get',
  168 + url: `/api/device/query/tree/${deviceId}`,
  169 + params:{
  170 + page: currentPage,
  171 + count: count,
  172 + parentId: parentId,
  173 + onlyCatalog: onlyCatalog
  174 + }
  175 + }).then((res) =>{
  176 + if (typeof (callback) == "function") callback(res.data)
  177 + }).catch(errorCallback);
  178 + }
136 179 }
137 180  
138 181 export default DeviceService;
... ...
web_src/src/router/index.js
... ... @@ -59,7 +59,7 @@ export default new VueRouter({
59 59 component: streamProxyList,
60 60 },
61 61 {
62   - path: '/channelList/:deviceId/:parentChannelId/:count/:page',
  62 + path: '/channelList/:deviceId/:parentChannelId/',
63 63 name: 'channelList',
64 64 component: channelList,
65 65 },
... ...
web_src/static/css/iconfont.css
1 1 @font-face {
2 2 font-family: "iconfont"; /* Project id 1291092 */
3   - src: url('iconfont.woff2?t=1650436696596') format('woff2');
  3 + src: url('iconfont.woff2?t=1655453611360') format('woff2'),
  4 + url('iconfont.woff?t=1655453611360') format('woff'),
  5 + url('iconfont.ttf?t=1655453611360') format('truetype');
4 6 }
5 7  
6 8 .iconfont {
... ... @@ -11,6 +13,30 @@
11 13 -moz-osx-font-smoothing: grayscale;
12 14 }
13 15  
  16 +.icon-list:before {
  17 + content: "\e7de";
  18 +}
  19 +
  20 +.icon-tree:before {
  21 + content: "\e7df";
  22 +}
  23 +
  24 +.icon-shipin:before {
  25 + content: "\e7db";
  26 +}
  27 +
  28 +.icon-shipin1:before {
  29 + content: "\e7dc";
  30 +}
  31 +
  32 +.icon-shipin2:before {
  33 + content: "\e7dd";
  34 +}
  35 +
  36 +.icon-LC_icon_gps_fill:before {
  37 + content: "\e7da";
  38 +}
  39 +
14 40 .icon-jiedianleizhukongzhongxin1:before {
15 41 content: "\e9d0";
16 42 }
... ...
web_src/static/css/iconfont.woff2
No preview for this file type