Commit 1dbb559b388831b5f15e690d0b33d24b1faaa983

Authored by 648540858
1 parent 94688534

优化文件导入判断

sql/mysql.sql
1 -  
2 -  
3 -CREATE DATABASE IF NOT EXISTS `wvp` /*!40100 DEFAULT CHARACTER SET utf8mb3 COLLATE utf8mb3_bin */;  
4 -  
5 -use wvp;  
6 -  
7 -create table device  
8 -(  
9 - deviceId varchar(50) not null  
10 - primary key,  
11 - name varchar(255) null,  
12 - manufacturer varchar(255) null,  
13 - model varchar(255) null,  
14 - firmware varchar(255) null,  
15 - transport varchar(50) null,  
16 - streamMode varchar(50) null,  
17 - online varchar(50) null,  
18 - registerTime varchar(50) null,  
19 - keepaliveTime varchar(50) null,  
20 - ip varchar(50) not null,  
21 - createTime varchar(50) not null,  
22 - updateTime varchar(50) not null,  
23 - port int not null,  
24 - expires int not null,  
25 - subscribeCycleForCatalog int not null,  
26 - hostAddress varchar(50) not null,  
27 - charset varchar(50) not null  
28 -);  
29 -  
30 -create table device_channel  
31 -(  
32 - channelId varchar(50) not null,  
33 - name varchar(255) null,  
34 - manufacture varchar(50) null,  
35 - model varchar(50) null,  
36 - owner varchar(50) null,  
37 - civilCode varchar(50) null,  
38 - block varchar(50) null,  
39 - address varchar(50) null,  
40 - parentId varchar(50) null,  
41 - safetyWay int null,  
42 - registerWay int null,  
43 - certNum varchar(50) null,  
44 - certifiable int null,  
45 - errCode int null,  
46 - endTime varchar(50) null,  
47 - secrecy varchar(50) null,  
48 - ipAddress varchar(50) null,  
49 - port int null,  
50 - password varchar(255) null,  
51 - PTZType int null,  
52 - status int null,  
53 - longitude double null,  
54 - latitude double null,  
55 - streamId varchar(50) null,  
56 - deviceId varchar(50) not null,  
57 - parental varchar(50) null,  
58 - hasAudio bit null,  
59 - createTime varchar(50) not null,  
60 - updateTime varchar(50) not null,  
61 - primary key (channelId, deviceId)  
62 -);  
63 -  
64 -create table device_alarm  
65 -(  
66 - id int auto_increment  
67 - primary key,  
68 - deviceId varchar(50) not null,  
69 - channelId varchar(50) not null,  
70 - alarmPriority varchar(50) not null,  
71 - alarmMethod varchar(50),  
72 - alarmTime varchar(50) not null,  
73 - alarmDescription varchar(255),  
74 - longitude double null,  
75 - latitude double null,  
76 - alarmType varchar(50)  
77 -);  
78 -  
79 -create table log  
80 -(  
81 - id int auto_increment  
82 - primary key,  
83 - name varchar(50) not null,  
84 - type varchar(50) not null,  
85 - uri varchar(200) not null,  
86 - address varchar(50) not null,  
87 - result varchar(50) not null,  
88 - timing bigint not null,  
89 - username varchar(50) not null,  
90 - createTime varchar(50) not null  
91 -);  
92 -  
93 -create table device_mobile_position  
94 -(  
95 - deviceId varchar(50) not null,  
96 - channelId varchar(50) not null,  
97 - deviceName varchar(255) null,  
98 - time varchar(50) not null,  
99 - longitude double not null,  
100 - latitude double not null,  
101 - altitude double null,  
102 - speed double null,  
103 - direction double null,  
104 - reportSource varchar(50) null,  
105 - geodeticSystem varchar(50) null,  
106 - cnLng varchar(50) null,  
107 - cnLat varchar(50) null,  
108 - primary key (deviceId, time)  
109 -);  
110 -  
111 -create table gb_stream  
112 -(  
113 - id int auto_increment,  
114 - app varchar(255) not null,  
115 - stream varchar(255) not null,  
116 - gbId varchar(50) not null,  
117 - name varchar(255) null,  
118 - longitude double null,  
119 - latitude double null,  
120 - streamType varchar(50) null,  
121 - mediaServerId varchar(50) null,  
122 - status int null,  
123 - createStamp int null,  
124 - primary key (app, stream, gbId)  
125 -);  
126 -  
127 -create table media_server  
128 -(  
129 - id varchar(255) not null  
130 - primary key,  
131 - ip varchar(50) not null,  
132 - hookIp varchar(50) not null,  
133 - sdpIp varchar(50) not null,  
134 - streamIp varchar(50) not null,  
135 - httpPort int not null,  
136 - httpSSlPort int not null,  
137 - rtmpPort int not null,  
138 - rtmpSSlPort int not null,  
139 - rtpProxyPort int not null,  
140 - rtspPort int not null,  
141 - rtspSSLPort int not null,  
142 - autoConfig int not null,  
143 - secret varchar(50) not null,  
144 - streamNoneReaderDelayMS int not null,  
145 - rtpEnable int not null,  
146 - rtpPortRange varchar(50) not null,  
147 - sendRtpPortRange varchar(50) not null,  
148 - recordAssistPort int not null,  
149 - defaultServer int not null,  
150 - createTime varchar(50) not null,  
151 - updateTime varchar(50) not null,  
152 - hookAliveInterval int not null,  
153 - constraint media_server_i  
154 - unique (ip, httpPort)  
155 -);  
156 -  
157 -create table parent_platform  
158 -(  
159 - id int auto_increment,  
160 - enable int null,  
161 - name varchar(255) null,  
162 - serverGBId varchar(50) not null,  
163 - serverGBDomain varchar(50) null,  
164 - serverIP varchar(50) null,  
165 - serverPort int null,  
166 - deviceGBId varchar(50) not null,  
167 - deviceIp varchar(50) null,  
168 - devicePort varchar(50) null,  
169 - username varchar(255) null,  
170 - password varchar(50) null,  
171 - expires varchar(50) null,  
172 - keepTimeout varchar(50) null,  
173 - transport varchar(50) null,  
174 - characterSet varchar(50) null,  
175 - catalogId varchar(50) not null,  
176 - ptz int null,  
177 - rtcp int null,  
178 - status bit null,  
179 - shareAllLiveStream int null,  
180 - primary key (id, serverGBId)  
181 -);  
182 -  
183 -  
184 -create table platform_catalog  
185 -(  
186 - id varchar(50) primary key,  
187 - platformId varchar(50) not null,  
188 - name varchar(255) not null,  
189 - parentId varchar(50)  
190 -);  
191 -  
192 -create table platform_gb_channel  
193 -(  
194 - channelId varchar(50) not null,  
195 - deviceId varchar(50) not null,  
196 - platformId varchar(50) not null,  
197 - deviceAndChannelId varchar(50) not null,  
198 - catalogId varchar(50) not null,  
199 - primary key (deviceAndChannelId, platformId)  
200 -);  
201 -  
202 -create table platform_gb_stream  
203 -(  
204 - platformId varchar(50) not null,  
205 - app varchar(255) not null,  
206 - stream varchar(255) not null,  
207 - catalogId varchar(50) not null,  
208 - primary key (platformId, app, stream)  
209 -);  
210 -  
211 -create table stream_proxy  
212 -(  
213 - type varchar(50) not null,  
214 - app varchar(255) not null,  
215 - stream varchar(255) not null,  
216 - url varchar(255) null,  
217 - src_url varchar(255) null,  
218 - dst_url varchar(255) null,  
219 - timeout_ms int null,  
220 - ffmpeg_cmd_key varchar(255) null,  
221 - rtp_type varchar(50) null,  
222 - mediaServerId varchar(50) null,  
223 - enable_hls bit null,  
224 - enable_mp4 bit null,  
225 - enable bit not null,  
226 - enable_remove_none_reader bit not null,  
227 - createTime varchar(50) not null,  
228 - primary key (app, stream)  
229 -);  
230 -  
231 -create table stream_push  
232 -(  
233 - app varchar(255) not null,  
234 - stream varchar(255) not null,  
235 - totalReaderCount varchar(50) null,  
236 - originType int null,  
237 - originTypeStr varchar(50) null,  
238 - createStamp int null,  
239 - aliveSecond int null,  
240 - mediaServerId varchar(50) null,  
241 - primary key (app, stream)  
242 -);  
243 -  
244 -create table user  
245 -(  
246 - id int auto_increment  
247 - primary key,  
248 - username varchar(255) not null,  
249 - password varchar(255) not null,  
250 - roleId int not null,  
251 - createTime varchar(50) not null,  
252 - updateTime varchar(50) not null  
253 -);  
254 -  
255 -create unique index user_username_uindex  
256 - on user (username);  
257 -  
258 -insert into user (username, password, roleId, createTime, updateTime) values ('admin', '21232f297a57a5a743894a0e4a801fc3', '1', '2021-04-13 14:14:57', '2021-04-13 14:14:57');  
259 -  
260 -create table role (  
261 - id int auto_increment  
262 - primary key,  
263 - name varchar(50) NOT NULL,  
264 - authority varchar(50) NOT NULL,  
265 - createTime varchar(50) not null,  
266 - updateTime varchar(50) not null  
267 -);  
268 -insert into role (id, name, authority, createTime, updateTime) values ('1', 'admin', '0', '2021-04-13 14:14:57', '2021-04-13 14:14:57'); 1 +-- MySQL dump 10.13 Distrib 8.0.27, for Linux (x86_64)
  2 +--
  3 +-- Host: 192.168.1.242 Database: wvp
  4 +-- ------------------------------------------------------
  5 +-- Server version 5.7.22
269 6
  7 +/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
  8 +/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
  9 +/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
  10 +/*!50503 SET NAMES utf8mb4 */;
  11 +/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
  12 +/*!40103 SET TIME_ZONE='+00:00' */;
  13 +/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
  14 +/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
  15 +/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
  16 +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
  17 +
  18 +--
  19 +-- Table structure for table `device`
  20 +--
  21 +
  22 +DROP TABLE IF EXISTS `device`;
  23 +/*!40101 SET @saved_cs_client = @@character_set_client */;
  24 +/*!50503 SET character_set_client = utf8mb4 */;
  25 +CREATE TABLE `device` (
  26 + `deviceId` varchar(50) NOT NULL,
  27 + `name` varchar(255) DEFAULT NULL,
  28 + `manufacturer` varchar(255) DEFAULT NULL,
  29 + `model` varchar(255) DEFAULT NULL,
  30 + `firmware` varchar(255) DEFAULT NULL,
  31 + `transport` varchar(50) DEFAULT NULL,
  32 + `streamMode` varchar(50) DEFAULT NULL,
  33 + `online` varchar(50) DEFAULT NULL,
  34 + `registerTime` varchar(50) DEFAULT NULL,
  35 + `keepaliveTime` varchar(50) DEFAULT NULL,
  36 + `ip` varchar(50) NOT NULL,
  37 + `createTime` varchar(50) NOT NULL,
  38 + `updateTime` varchar(50) NOT NULL,
  39 + `port` int(11) NOT NULL,
  40 + `expires` int(11) NOT NULL,
  41 + `subscribeCycleForCatalog` int(11) NOT NULL,
  42 + `hostAddress` varchar(50) NOT NULL,
  43 + `charset` varchar(50) NOT NULL,
  44 + PRIMARY KEY (`deviceId`)
  45 +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
  46 +/*!40101 SET character_set_client = @saved_cs_client */;
  47 +
  48 +--
  49 +-- Dumping data for table `device`
  50 +--
  51 +
  52 +LOCK TABLES `device` WRITE;
  53 +/*!40000 ALTER TABLE `device` DISABLE KEYS */;
  54 +/*!40000 ALTER TABLE `device` ENABLE KEYS */;
  55 +UNLOCK TABLES;
  56 +
  57 +--
  58 +-- Table structure for table `device_alarm`
  59 +--
  60 +
  61 +DROP TABLE IF EXISTS `device_alarm`;
  62 +/*!40101 SET @saved_cs_client = @@character_set_client */;
  63 +/*!50503 SET character_set_client = utf8mb4 */;
  64 +CREATE TABLE `device_alarm` (
  65 + `id` int(11) NOT NULL AUTO_INCREMENT,
  66 + `deviceId` varchar(50) NOT NULL,
  67 + `channelId` varchar(50) NOT NULL,
  68 + `alarmPriority` varchar(50) NOT NULL,
  69 + `alarmMethod` varchar(50) DEFAULT NULL,
  70 + `alarmTime` varchar(50) NOT NULL,
  71 + `alarmDescription` varchar(255) DEFAULT NULL,
  72 + `longitude` double DEFAULT NULL,
  73 + `latitude` double DEFAULT NULL,
  74 + `alarmType` varchar(50) DEFAULT NULL,
  75 + PRIMARY KEY (`id`)
  76 +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
  77 +/*!40101 SET character_set_client = @saved_cs_client */;
  78 +
  79 +--
  80 +-- Dumping data for table `device_alarm`
  81 +--
  82 +
  83 +LOCK TABLES `device_alarm` WRITE;
  84 +/*!40000 ALTER TABLE `device_alarm` DISABLE KEYS */;
  85 +/*!40000 ALTER TABLE `device_alarm` ENABLE KEYS */;
  86 +UNLOCK TABLES;
  87 +
  88 +--
  89 +-- Table structure for table `device_channel`
  90 +--
  91 +
  92 +DROP TABLE IF EXISTS `device_channel`;
  93 +/*!40101 SET @saved_cs_client = @@character_set_client */;
  94 +/*!50503 SET character_set_client = utf8mb4 */;
  95 +CREATE TABLE `device_channel` (
  96 + `channelId` varchar(50) NOT NULL,
  97 + `name` varchar(255) DEFAULT NULL,
  98 + `manufacture` varchar(50) DEFAULT NULL,
  99 + `model` varchar(50) DEFAULT NULL,
  100 + `owner` varchar(50) DEFAULT NULL,
  101 + `civilCode` varchar(50) DEFAULT NULL,
  102 + `block` varchar(50) DEFAULT NULL,
  103 + `address` varchar(50) DEFAULT NULL,
  104 + `parentId` varchar(50) DEFAULT NULL,
  105 + `safetyWay` int(11) DEFAULT NULL,
  106 + `registerWay` int(11) DEFAULT NULL,
  107 + `certNum` varchar(50) DEFAULT NULL,
  108 + `certifiable` int(11) DEFAULT NULL,
  109 + `errCode` int(11) DEFAULT NULL,
  110 + `endTime` varchar(50) DEFAULT NULL,
  111 + `secrecy` varchar(50) DEFAULT NULL,
  112 + `ipAddress` varchar(50) DEFAULT NULL,
  113 + `port` int(11) DEFAULT NULL,
  114 + `password` varchar(255) DEFAULT NULL,
  115 + `PTZType` int(11) DEFAULT NULL,
  116 + `status` int(11) DEFAULT NULL,
  117 + `longitude` double DEFAULT NULL,
  118 + `latitude` double DEFAULT NULL,
  119 + `streamId` varchar(50) DEFAULT NULL,
  120 + `deviceId` varchar(50) NOT NULL,
  121 + `parental` varchar(50) DEFAULT NULL,
  122 + `hasAudio` bit(1) DEFAULT NULL,
  123 + `createTime` varchar(50) NOT NULL,
  124 + `updateTime` varchar(50) NOT NULL,
  125 + PRIMARY KEY (`channelId`,`deviceId`)
  126 +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
  127 +/*!40101 SET character_set_client = @saved_cs_client */;
  128 +
  129 +--
  130 +-- Dumping data for table `device_channel`
  131 +--
  132 +
  133 +LOCK TABLES `device_channel` WRITE;
  134 +/*!40000 ALTER TABLE `device_channel` DISABLE KEYS */;
  135 +/*!40000 ALTER TABLE `device_channel` ENABLE KEYS */;
  136 +UNLOCK TABLES;
  137 +
  138 +--
  139 +-- Table structure for table `device_mobile_position`
  140 +--
  141 +
  142 +DROP TABLE IF EXISTS `device_mobile_position`;
  143 +/*!40101 SET @saved_cs_client = @@character_set_client */;
  144 +/*!50503 SET character_set_client = utf8mb4 */;
  145 +CREATE TABLE `device_mobile_position` (
  146 + `deviceId` varchar(50) NOT NULL,
  147 + `channelId` varchar(50) NOT NULL,
  148 + `deviceName` varchar(255) DEFAULT NULL,
  149 + `time` varchar(50) NOT NULL,
  150 + `longitude` double NOT NULL,
  151 + `latitude` double NOT NULL,
  152 + `altitude` double DEFAULT NULL,
  153 + `speed` double DEFAULT NULL,
  154 + `direction` double DEFAULT NULL,
  155 + `reportSource` varchar(50) DEFAULT NULL,
  156 + `geodeticSystem` varchar(50) DEFAULT NULL,
  157 + `cnLng` varchar(50) DEFAULT NULL,
  158 + `cnLat` varchar(50) DEFAULT NULL,
  159 + PRIMARY KEY (`deviceId`,`time`)
  160 +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
  161 +/*!40101 SET character_set_client = @saved_cs_client */;
  162 +
  163 +--
  164 +-- Dumping data for table `device_mobile_position`
  165 +--
  166 +
  167 +LOCK TABLES `device_mobile_position` WRITE;
  168 +/*!40000 ALTER TABLE `device_mobile_position` DISABLE KEYS */;
  169 +/*!40000 ALTER TABLE `device_mobile_position` ENABLE KEYS */;
  170 +UNLOCK TABLES;
  171 +
  172 +--
  173 +-- Table structure for table `gb_stream`
  174 +--
  175 +
  176 +DROP TABLE IF EXISTS `gb_stream`;
  177 +/*!40101 SET @saved_cs_client = @@character_set_client */;
  178 +/*!50503 SET character_set_client = utf8mb4 */;
  179 +CREATE TABLE `gb_stream` (
  180 + `id` int(11) NOT NULL AUTO_INCREMENT,
  181 + `app` varchar(255) NOT NULL,
  182 + `stream` varchar(255) NOT NULL,
  183 + `gbId` varchar(50) NOT NULL,
  184 + `name` varchar(255) DEFAULT NULL,
  185 + `longitude` double DEFAULT NULL,
  186 + `latitude` double DEFAULT NULL,
  187 + `streamType` varchar(50) DEFAULT NULL,
  188 + `mediaServerId` varchar(50) DEFAULT NULL,
  189 + `status` int(11) DEFAULT NULL,
  190 + `createStamp` bigint(20) DEFAULT NULL,
  191 + PRIMARY KEY (`id`),
  192 + UNIQUE KEY `app` (`app`,`stream`),
  193 + UNIQUE KEY `gbId` (`gbId`)
  194 +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
  195 +/*!40101 SET character_set_client = @saved_cs_client */;
  196 +
  197 +--
  198 +-- Dumping data for table `gb_stream`
  199 +--
  200 +
  201 +LOCK TABLES `gb_stream` WRITE;
  202 +/*!40000 ALTER TABLE `gb_stream` DISABLE KEYS */;
  203 +/*!40000 ALTER TABLE `gb_stream` ENABLE KEYS */;
  204 +UNLOCK TABLES;
  205 +
  206 +--
  207 +-- Table structure for table `log`
  208 +--
  209 +
  210 +DROP TABLE IF EXISTS `log`;
  211 +/*!40101 SET @saved_cs_client = @@character_set_client */;
  212 +/*!50503 SET character_set_client = utf8mb4 */;
  213 +CREATE TABLE `log` (
  214 + `id` int(11) NOT NULL AUTO_INCREMENT,
  215 + `name` varchar(50) NOT NULL,
  216 + `type` varchar(50) NOT NULL,
  217 + `uri` varchar(200) NOT NULL,
  218 + `address` varchar(50) NOT NULL,
  219 + `result` varchar(50) NOT NULL,
  220 + `timing` bigint(20) NOT NULL,
  221 + `username` varchar(50) NOT NULL,
  222 + `createTime` varchar(50) NOT NULL,
  223 + PRIMARY KEY (`id`)
  224 +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
  225 +/*!40101 SET character_set_client = @saved_cs_client */;
  226 +
  227 +--
  228 +-- Dumping data for table `log`
  229 +--
  230 +
  231 +LOCK TABLES `log` WRITE;
  232 +/*!40000 ALTER TABLE `log` DISABLE KEYS */;
  233 +/*!40000 ALTER TABLE `log` ENABLE KEYS */;
  234 +UNLOCK TABLES;
  235 +
  236 +--
  237 +-- Table structure for table `media_server`
  238 +--
  239 +
  240 +DROP TABLE IF EXISTS `media_server`;
  241 +/*!40101 SET @saved_cs_client = @@character_set_client */;
  242 +/*!50503 SET character_set_client = utf8mb4 */;
  243 +CREATE TABLE `media_server` (
  244 + `id` varchar(255) NOT NULL,
  245 + `ip` varchar(50) NOT NULL,
  246 + `hookIp` varchar(50) NOT NULL,
  247 + `sdpIp` varchar(50) NOT NULL,
  248 + `streamIp` varchar(50) NOT NULL,
  249 + `httpPort` int(11) NOT NULL,
  250 + `httpSSlPort` int(11) NOT NULL,
  251 + `rtmpPort` int(11) NOT NULL,
  252 + `rtmpSSlPort` int(11) NOT NULL,
  253 + `rtpProxyPort` int(11) NOT NULL,
  254 + `rtspPort` int(11) NOT NULL,
  255 + `rtspSSLPort` int(11) NOT NULL,
  256 + `autoConfig` int(11) NOT NULL,
  257 + `secret` varchar(50) NOT NULL,
  258 + `streamNoneReaderDelayMS` int(11) NOT NULL,
  259 + `rtpEnable` int(11) NOT NULL,
  260 + `rtpPortRange` varchar(50) NOT NULL,
  261 + `sendRtpPortRange` varchar(50) NOT NULL,
  262 + `recordAssistPort` int(11) NOT NULL,
  263 + `defaultServer` int(11) NOT NULL,
  264 + `createTime` varchar(50) NOT NULL,
  265 + `updateTime` varchar(50) NOT NULL,
  266 + `hookAliveInterval` int(11) NOT NULL,
  267 + PRIMARY KEY (`id`),
  268 + UNIQUE KEY `media_server_i` (`ip`,`httpPort`)
  269 +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
  270 +/*!40101 SET character_set_client = @saved_cs_client */;
  271 +
  272 +--
  273 +-- Dumping data for table `media_server`
  274 +--
  275 +
  276 +LOCK TABLES `media_server` WRITE;
  277 +/*!40000 ALTER TABLE `media_server` DISABLE KEYS */;
  278 +/*!40000 ALTER TABLE `media_server` ENABLE KEYS */;
  279 +UNLOCK TABLES;
  280 +
  281 +--
  282 +-- Table structure for table `parent_platform`
  283 +--
  284 +
  285 +DROP TABLE IF EXISTS `parent_platform`;
  286 +/*!40101 SET @saved_cs_client = @@character_set_client */;
  287 +/*!50503 SET character_set_client = utf8mb4 */;
  288 +CREATE TABLE `parent_platform` (
  289 + `id` int(11) NOT NULL AUTO_INCREMENT,
  290 + `enable` int(11) DEFAULT NULL,
  291 + `name` varchar(255) DEFAULT NULL,
  292 + `serverGBId` varchar(50) NOT NULL,
  293 + `serverGBDomain` varchar(50) DEFAULT NULL,
  294 + `serverIP` varchar(50) DEFAULT NULL,
  295 + `serverPort` int(11) DEFAULT NULL,
  296 + `deviceGBId` varchar(50) NOT NULL,
  297 + `deviceIp` varchar(50) DEFAULT NULL,
  298 + `devicePort` varchar(50) DEFAULT NULL,
  299 + `username` varchar(255) DEFAULT NULL,
  300 + `password` varchar(50) DEFAULT NULL,
  301 + `expires` varchar(50) DEFAULT NULL,
  302 + `keepTimeout` varchar(50) DEFAULT NULL,
  303 + `transport` varchar(50) DEFAULT NULL,
  304 + `characterSet` varchar(50) DEFAULT NULL,
  305 + `catalogId` varchar(50) NOT NULL,
  306 + `ptz` int(11) DEFAULT NULL,
  307 + `rtcp` int(11) DEFAULT NULL,
  308 + `status` bit(1) DEFAULT NULL,
  309 + `shareAllLiveStream` int(11) DEFAULT NULL,
  310 + PRIMARY KEY (`id`,`serverGBId`)
  311 +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
  312 +/*!40101 SET character_set_client = @saved_cs_client */;
  313 +
  314 +--
  315 +-- Dumping data for table `parent_platform`
  316 +--
  317 +
  318 +LOCK TABLES `parent_platform` WRITE;
  319 +/*!40000 ALTER TABLE `parent_platform` DISABLE KEYS */;
  320 +/*!40000 ALTER TABLE `parent_platform` ENABLE KEYS */;
  321 +UNLOCK TABLES;
  322 +
  323 +--
  324 +-- Table structure for table `platform_catalog`
  325 +--
  326 +
  327 +DROP TABLE IF EXISTS `platform_catalog`;
  328 +/*!40101 SET @saved_cs_client = @@character_set_client */;
  329 +/*!50503 SET character_set_client = utf8mb4 */;
  330 +CREATE TABLE `platform_catalog` (
  331 + `id` varchar(50) NOT NULL,
  332 + `platformId` varchar(50) NOT NULL,
  333 + `name` varchar(255) NOT NULL,
  334 + `parentId` varchar(50) DEFAULT NULL,
  335 + PRIMARY KEY (`id`)
  336 +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
  337 +/*!40101 SET character_set_client = @saved_cs_client */;
  338 +
  339 +--
  340 +-- Dumping data for table `platform_catalog`
  341 +--
  342 +
  343 +LOCK TABLES `platform_catalog` WRITE;
  344 +/*!40000 ALTER TABLE `platform_catalog` DISABLE KEYS */;
  345 +/*!40000 ALTER TABLE `platform_catalog` ENABLE KEYS */;
  346 +UNLOCK TABLES;
  347 +
  348 +--
  349 +-- Table structure for table `platform_gb_channel`
  350 +--
  351 +
  352 +DROP TABLE IF EXISTS `platform_gb_channel`;
  353 +/*!40101 SET @saved_cs_client = @@character_set_client */;
  354 +/*!50503 SET character_set_client = utf8mb4 */;
  355 +CREATE TABLE `platform_gb_channel` (
  356 + `channelId` varchar(50) NOT NULL,
  357 + `deviceId` varchar(50) NOT NULL,
  358 + `platformId` varchar(50) NOT NULL,
  359 + `deviceAndChannelId` varchar(50) NOT NULL,
  360 + `catalogId` varchar(50) NOT NULL,
  361 + PRIMARY KEY (`deviceAndChannelId`,`platformId`)
  362 +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
  363 +/*!40101 SET character_set_client = @saved_cs_client */;
  364 +
  365 +--
  366 +-- Dumping data for table `platform_gb_channel`
  367 +--
  368 +
  369 +LOCK TABLES `platform_gb_channel` WRITE;
  370 +/*!40000 ALTER TABLE `platform_gb_channel` DISABLE KEYS */;
  371 +/*!40000 ALTER TABLE `platform_gb_channel` ENABLE KEYS */;
  372 +UNLOCK TABLES;
  373 +
  374 +--
  375 +-- Table structure for table `platform_gb_stream`
  376 +--
  377 +
  378 +DROP TABLE IF EXISTS `platform_gb_stream`;
  379 +/*!40101 SET @saved_cs_client = @@character_set_client */;
  380 +/*!50503 SET character_set_client = utf8mb4 */;
  381 +CREATE TABLE `platform_gb_stream` (
  382 + `platformId` varchar(50) NOT NULL,
  383 + `app` varchar(255) NOT NULL,
  384 + `stream` varchar(255) NOT NULL,
  385 + `catalogId` varchar(50) NOT NULL,
  386 + PRIMARY KEY (`platformId`,`app`,`stream`)
  387 +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
  388 +/*!40101 SET character_set_client = @saved_cs_client */;
  389 +
  390 +--
  391 +-- Dumping data for table `platform_gb_stream`
  392 +--
  393 +
  394 +LOCK TABLES `platform_gb_stream` WRITE;
  395 +/*!40000 ALTER TABLE `platform_gb_stream` DISABLE KEYS */;
  396 +/*!40000 ALTER TABLE `platform_gb_stream` ENABLE KEYS */;
  397 +UNLOCK TABLES;
  398 +
  399 +--
  400 +-- Table structure for table `role`
  401 +--
  402 +
  403 +DROP TABLE IF EXISTS `role`;
  404 +/*!40101 SET @saved_cs_client = @@character_set_client */;
  405 +/*!50503 SET character_set_client = utf8mb4 */;
  406 +CREATE TABLE `role` (
  407 + `id` int(11) NOT NULL AUTO_INCREMENT,
  408 + `name` varchar(50) NOT NULL,
  409 + `authority` varchar(50) NOT NULL,
  410 + `createTime` varchar(50) NOT NULL,
  411 + `updateTime` varchar(50) NOT NULL,
  412 + PRIMARY KEY (`id`)
  413 +) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4;
  414 +/*!40101 SET character_set_client = @saved_cs_client */;
  415 +
  416 +--
  417 +-- Dumping data for table `role`
  418 +--
  419 +
  420 +LOCK TABLES `role` WRITE;
  421 +/*!40000 ALTER TABLE `role` DISABLE KEYS */;
  422 +INSERT INTO `role` VALUES (1,'admin','0','2021-04-13 14:14:57','2021-04-13 14:14:57');
  423 +/*!40000 ALTER TABLE `role` ENABLE KEYS */;
  424 +UNLOCK TABLES;
  425 +
  426 +--
  427 +-- Table structure for table `stream_proxy`
  428 +--
  429 +
  430 +DROP TABLE IF EXISTS `stream_proxy`;
  431 +/*!40101 SET @saved_cs_client = @@character_set_client */;
  432 +/*!50503 SET character_set_client = utf8mb4 */;
  433 +CREATE TABLE `stream_proxy` (
  434 + `type` varchar(50) NOT NULL,
  435 + `app` varchar(255) NOT NULL,
  436 + `stream` varchar(255) NOT NULL,
  437 + `url` varchar(255) DEFAULT NULL,
  438 + `src_url` varchar(255) DEFAULT NULL,
  439 + `dst_url` varchar(255) DEFAULT NULL,
  440 + `timeout_ms` int(11) DEFAULT NULL,
  441 + `ffmpeg_cmd_key` varchar(255) DEFAULT NULL,
  442 + `rtp_type` varchar(50) DEFAULT NULL,
  443 + `mediaServerId` varchar(50) DEFAULT NULL,
  444 + `enable_hls` bit(1) DEFAULT NULL,
  445 + `enable_mp4` bit(1) DEFAULT NULL,
  446 + `enable` bit(1) NOT NULL,
  447 + `enable_remove_none_reader` bit(1) NOT NULL,
  448 + `createTime` varchar(50) NOT NULL,
  449 + PRIMARY KEY (`app`,`stream`)
  450 +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
  451 +/*!40101 SET character_set_client = @saved_cs_client */;
  452 +
  453 +--
  454 +-- Dumping data for table `stream_proxy`
  455 +--
  456 +
  457 +LOCK TABLES `stream_proxy` WRITE;
  458 +/*!40000 ALTER TABLE `stream_proxy` DISABLE KEYS */;
  459 +/*!40000 ALTER TABLE `stream_proxy` ENABLE KEYS */;
  460 +UNLOCK TABLES;
  461 +
  462 +--
  463 +-- Table structure for table `stream_push`
  464 +--
  465 +
  466 +DROP TABLE IF EXISTS `stream_push`;
  467 +/*!40101 SET @saved_cs_client = @@character_set_client */;
  468 +/*!50503 SET character_set_client = utf8mb4 */;
  469 +CREATE TABLE `stream_push` (
  470 + `app` varchar(255) NOT NULL,
  471 + `stream` varchar(255) NOT NULL,
  472 + `totalReaderCount` varchar(50) DEFAULT NULL,
  473 + `originType` int(11) DEFAULT NULL,
  474 + `originTypeStr` varchar(50) DEFAULT NULL,
  475 + `createStamp` bigint(20) DEFAULT NULL,
  476 + `aliveSecond` int(11) DEFAULT NULL,
  477 + `mediaServerId` varchar(50) DEFAULT NULL,
  478 + PRIMARY KEY (`app`,`stream`)
  479 +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
  480 +/*!40101 SET character_set_client = @saved_cs_client */;
  481 +
  482 +--
  483 +-- Dumping data for table `stream_push`
  484 +--
  485 +
  486 +LOCK TABLES `stream_push` WRITE;
  487 +/*!40000 ALTER TABLE `stream_push` DISABLE KEYS */;
  488 +/*!40000 ALTER TABLE `stream_push` ENABLE KEYS */;
  489 +UNLOCK TABLES;
  490 +
  491 +--
  492 +-- Table structure for table `user`
  493 +--
  494 +
  495 +DROP TABLE IF EXISTS `user`;
  496 +/*!40101 SET @saved_cs_client = @@character_set_client */;
  497 +/*!50503 SET character_set_client = utf8mb4 */;
  498 +CREATE TABLE `user` (
  499 + `id` int(11) NOT NULL AUTO_INCREMENT,
  500 + `username` varchar(255) NOT NULL,
  501 + `password` varchar(255) NOT NULL,
  502 + `roleId` int(11) NOT NULL,
  503 + `createTime` varchar(50) NOT NULL,
  504 + `updateTime` varchar(50) NOT NULL,
  505 + PRIMARY KEY (`id`),
  506 + UNIQUE KEY `user_username_uindex` (`username`)
  507 +) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4;
  508 +/*!40101 SET character_set_client = @saved_cs_client */;
  509 +
  510 +--
  511 +-- Dumping data for table `user`
  512 +--
  513 +
  514 +LOCK TABLES `user` WRITE;
  515 +/*!40000 ALTER TABLE `user` DISABLE KEYS */;
  516 +INSERT INTO `user` VALUES (1,'admin','21232f297a57a5a743894a0e4a801fc3',1,'2021-04-13 14:14:57','2021-04-13 14:14:57');
  517 +/*!40000 ALTER TABLE `user` ENABLE KEYS */;
  518 +UNLOCK TABLES;
  519 +/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
  520 +
  521 +/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
  522 +/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
  523 +/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
  524 +/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
  525 +/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
  526 +/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
  527 +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
  528 +
  529 +-- Dump completed on 2022-01-25 15:36:42
src/main/java/com/genersoft/iot/vmp/vmanager/streamPush/StreamPushController.java
@@ -123,7 +123,7 @@ public class StreamPushController { @@ -123,7 +123,7 @@ public class StreamPushController {
123 // 录像查询以channelId作为deviceId查询 123 // 录像查询以channelId作为deviceId查询
124 String key = DeferredResultHolder.UPLOAD_FILE_CHANNEL; 124 String key = DeferredResultHolder.UPLOAD_FILE_CHANNEL;
125 String uuid = UUID.randomUUID().toString(); 125 String uuid = UUID.randomUUID().toString();
126 - 126 + logger.warn("通道导入文件类型: {}",file.getContentType() );
127 if (file.isEmpty()) { 127 if (file.isEmpty()) {
128 logger.warn("通道导入文件为空"); 128 logger.warn("通道导入文件为空");
129 WVPResult<Object> wvpResult = new WVPResult<>(); 129 WVPResult<Object> wvpResult = new WVPResult<>();
@@ -139,16 +139,16 @@ public class StreamPushController { @@ -139,16 +139,16 @@ public class StreamPushController {
139 result.setResult(ResponseEntity.status(HttpStatus.BAD_REQUEST).body(wvpResult)); 139 result.setResult(ResponseEntity.status(HttpStatus.BAD_REQUEST).body(wvpResult));
140 return result; 140 return result;
141 } 141 }
142 - if (!file.getContentType().endsWith(".xls")  
143 - && !file.getContentType().endsWith(".csv")  
144 - && !file.getContentType().endsWith(".xlsx") ) {  
145 - logger.warn("通道导入文件类型错误");  
146 - WVPResult<Object> wvpResult = new WVPResult<>();  
147 - wvpResult.setCode(-1);  
148 - wvpResult.setMsg("文件类型错误,请使用");  
149 - result.setResult(ResponseEntity.status(HttpStatus.BAD_REQUEST).body(wvpResult));  
150 - return result;  
151 - } 142 +// if (!file.getContentType().endsWith(".xls")
  143 +// && !file.getContentType().endsWith(".csv")
  144 +// && !file.getContentType().endsWith(".xlsx") ) {
  145 +// logger.warn("通道导入文件类型错误: {}",file.getContentType() );
  146 +// WVPResult<Object> wvpResult = new WVPResult<>();
  147 +// wvpResult.setCode(-1);
  148 +// wvpResult.setMsg("文件类型错误,请使用");
  149 +// result.setResult(ResponseEntity.status(HttpStatus.BAD_REQUEST).body(wvpResult));
  150 +// return result;
  151 +// }
152 // 同时只处理一个文件 152 // 同时只处理一个文件
153 if (resultHolder.exist(key, null)) { 153 if (resultHolder.exist(key, null)) {
154 logger.warn("已有导入任务正在执行"); 154 logger.warn("已有导入任务正在执行");
@@ -178,30 +178,43 @@ public class StreamPushController { @@ -178,30 +178,43 @@ public class StreamPushController {
178 } catch (IOException e) { 178 } catch (IOException e) {
179 e.printStackTrace(); 179 e.printStackTrace();
180 } 180 }
181 - //传入参数  
182 - ExcelReader excelReader = EasyExcel.read(inputStream, StreamPushExcelDto.class,  
183 - new StreamPushUploadFileHandler(streamPushService, mediaServerService.getDefaultMediaServer().getId(), (errorStreams, errorGBs)->{  
184 - logger.info("通道导入成功,存在重复App+Stream为{}个,存在国标ID为{}个", errorStreams.size(), errorGBs.size());  
185 - RequestMessage msg = new RequestMessage();  
186 - msg.setKey(key);  
187 - WVPResult<Map<String, List<String>>> wvpResult = new WVPResult<>();  
188 - if (errorStreams.size() == 0 && errorGBs.size() == 0) {  
189 - wvpResult.setCode(0);  
190 - wvpResult.setMsg("成功");  
191 - }else {  
192 - wvpResult.setCode(1);  
193 - wvpResult.setMsg("导入成功。但是存在重复数据");  
194 - Map<String, List<String>> errorData = new HashMap<>();  
195 - errorData.put("gbId", errorGBs);  
196 - errorData.put("stream", errorStreams);  
197 - wvpResult.setData(errorData);  
198 - }  
199 - msg.setData(wvpResult);  
200 - resultHolder.invokeAllResult(msg);  
201 - })).build();  
202 - ReadSheet readSheet = EasyExcel.readSheet(0).build();  
203 - excelReader.read(readSheet);  
204 - excelReader.finish(); 181 + try {
  182 + //传入参数
  183 + ExcelReader excelReader = EasyExcel.read(inputStream, StreamPushExcelDto.class,
  184 + new StreamPushUploadFileHandler(streamPushService, mediaServerService.getDefaultMediaServer().getId(), (errorStreams, errorGBs)->{
  185 + logger.info("通道导入成功,存在重复App+Stream为{}个,存在国标ID为{}个", errorStreams.size(), errorGBs.size());
  186 + RequestMessage msg = new RequestMessage();
  187 + msg.setKey(key);
  188 + WVPResult<Map<String, List<String>>> wvpResult = new WVPResult<>();
  189 + if (errorStreams.size() == 0 && errorGBs.size() == 0) {
  190 + wvpResult.setCode(0);
  191 + wvpResult.setMsg("成功");
  192 + }else {
  193 + wvpResult.setCode(1);
  194 + wvpResult.setMsg("导入成功。但是存在重复数据");
  195 + Map<String, List<String>> errorData = new HashMap<>();
  196 + errorData.put("gbId", errorGBs);
  197 + errorData.put("stream", errorStreams);
  198 + wvpResult.setData(errorData);
  199 + }
  200 + msg.setData(wvpResult);
  201 + resultHolder.invokeAllResult(msg);
  202 + })).build();
  203 + ReadSheet readSheet = EasyExcel.readSheet(0).build();
  204 + excelReader.read(readSheet);
  205 + excelReader.finish();
  206 + }catch (Exception e) {
  207 + logger.warn("通道导入失败:", e);
  208 + RequestMessage msg = new RequestMessage();
  209 + msg.setKey(key);
  210 + WVPResult<Object> wvpResult = new WVPResult<>();
  211 + wvpResult.setCode(-1);
  212 + wvpResult.setMsg("通道导入失败: " + e.getMessage() );
  213 + msg.setData(wvpResult);
  214 + resultHolder.invokeAllResult(msg);
  215 + }
  216 +
  217 +
205 return result; 218 return result;
206 } 219 }
207 220