diff --git a/sql/dump-wvp-202201051515.sql b/sql/dump-wvp-202201051515.sql deleted file mode 100644 index 84590e49..00000000 --- a/sql/dump-wvp-202201051515.sql +++ /dev/null @@ -1,540 +0,0 @@ --- 此脚本采用dbeaver导出 --- MySQL dump 10.13 Distrib 8.0.27, for Linux (x86_64) --- --- Host: localhost Database: wvp --- ------------------------------------------------------ --- Server version 8.0.27-0ubuntu0.20.04.1 - -/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; -/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; -/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; -/*!50503 SET NAMES utf8mb4 */; -/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; -/*!40103 SET TIME_ZONE='+00:00' */; -/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; -/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; -/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; -/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; - --- --- Table structure for table `device` --- - -DROP TABLE IF EXISTS `device`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; -CREATE TABLE `device` ( - `deviceId` varchar(50) NOT NULL, - `name` varchar(255) DEFAULT NULL, - `manufacturer` varchar(255) DEFAULT NULL, - `model` varchar(255) DEFAULT NULL, - `firmware` varchar(255) DEFAULT NULL, - `transport` varchar(50) DEFAULT NULL, - `streamMode` varchar(50) DEFAULT NULL, - `online` varchar(50) DEFAULT NULL, - `registerTime` varchar(50) DEFAULT NULL, - `keepaliveTime` varchar(50) DEFAULT NULL, - `ip` varchar(50) NOT NULL, - `createTime` varchar(50) NOT NULL, - `updateTime` varchar(50) NOT NULL, - `port` int NOT NULL, - `expires` int NOT NULL, - `subscribeCycleForCatalog` int NOT NULL, - `hostAddress` varchar(50) NOT NULL, - `charset` varchar(50) NOT NULL, - PRIMARY KEY (`deviceId`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Dumping data for table `device` --- - -LOCK TABLES `device` WRITE; -/*!40000 ALTER TABLE `device` DISABLE KEYS */; -INSERT INTO `device` VALUES ('34020000001320000005','IPC-HFW4433M-I2','Dahua','IPC-HFW4433M-I2','2.622.0000000.31.R,2017-12-14','UDP','UDP','1','2022-01-05 15:08:26','2022-01-05 15:15:26','192.168.1.100','2022-01-05 15:08:26','2022-01-05 15:15:26',5060,3600,0,'192.168.1.100:5060','gb2312'),('34020000002000000005','DH-NVR5864-I','Dahua','DH-NVR5864-I','4.001.0000000.3,2020-10-22','UDP','UDP','1','2022-01-05 14:07:36','2022-01-05 15:15:25','192.168.1.19','2022-01-05 15:08:25','2022-01-05 15:15:25',5060,3600,0,'192.168.1.19:5060','gb2312'),('44010000001110008008',NULL,'Mercury','MIPC368(P)W-4','1.0.1 Build 210304 Rel.60784n','UDP','UDP','1','2022-01-05 15:08:35','2022-01-05 15:14:35','192.168.1.17','2022-01-05 15:08:35','2022-01-05 15:14:35',5060,36000,0,'192.168.1.17:5060','gb2312'); -/*!40000 ALTER TABLE `device` ENABLE KEYS */; -UNLOCK TABLES; - --- --- Table structure for table `device_alarm` --- - -DROP TABLE IF EXISTS `device_alarm`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; -CREATE TABLE `device_alarm` ( - `id` int NOT NULL AUTO_INCREMENT, - `deviceId` varchar(50) NOT NULL, - `channelId` varchar(50) NOT NULL, - `alarmPriority` varchar(50) NOT NULL, - `alarmMethod` varchar(50) DEFAULT NULL, - `alarmTime` varchar(50) NOT NULL, - `alarmDescription` varchar(255) DEFAULT NULL, - `longitude` double DEFAULT NULL, - `latitude` double DEFAULT NULL, - `alarmType` varchar(50) DEFAULT NULL, - PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Dumping data for table `device_alarm` --- - -LOCK TABLES `device_alarm` WRITE; -/*!40000 ALTER TABLE `device_alarm` DISABLE KEYS */; -/*!40000 ALTER TABLE `device_alarm` ENABLE KEYS */; -UNLOCK TABLES; - --- --- Table structure for table `device_channel` --- - -DROP TABLE IF EXISTS `device_channel`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; -CREATE TABLE `device_channel` ( - `channelId` varchar(50) NOT NULL, - `name` varchar(255) DEFAULT NULL, - `manufacture` varchar(50) DEFAULT NULL, - `model` varchar(50) DEFAULT NULL, - `owner` varchar(50) DEFAULT NULL, - `civilCode` varchar(50) DEFAULT NULL, - `block` varchar(50) DEFAULT NULL, - `address` varchar(50) DEFAULT NULL, - `parentId` varchar(50) DEFAULT NULL, - `safetyWay` int DEFAULT NULL, - `registerWay` int DEFAULT NULL, - `certNum` varchar(50) DEFAULT NULL, - `certifiable` int DEFAULT NULL, - `errCode` int DEFAULT NULL, - `endTime` varchar(50) DEFAULT NULL, - `secrecy` varchar(50) DEFAULT NULL, - `ipAddress` varchar(50) DEFAULT NULL, - `port` int DEFAULT NULL, - `password` varchar(255) DEFAULT NULL, - `PTZType` int DEFAULT NULL, - `status` int DEFAULT NULL, - `longitude` double DEFAULT NULL, - `latitude` double DEFAULT NULL, - `streamId` varchar(50) DEFAULT NULL, - `deviceId` varchar(50) NOT NULL, - `parental` varchar(50) DEFAULT NULL, - `hasAudio` bit(1) DEFAULT NULL, - `createTime` varchar(50) NOT NULL, - `updateTime` varchar(50) NOT NULL, - PRIMARY KEY (`channelId`,`deviceId`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Dumping data for table `device_channel` --- - -LOCK TABLES `device_channel` WRITE; -/*!40000 ALTER TABLE `device_channel` DISABLE KEYS */; -INSERT INTO `device_channel` VALUES ('34020000001310000001','IPC','Dahua','IPC-HFW4433M-I2','0','340200','','axy','34020000001320000005',0,1,'',0,0,NULL,'0','',0,'',0,1,0,0,'','34020000001320000005','0',NULL,'2022-01-05 15:11:21','2022-01-05 15:11:21'),('34020000001310000001','通道1','Dahua','DH-NVR5864-I','0','340200','','axy','34020000002000000005',0,1,'',0,0,NULL,'0','192.168.1.17',37777,'',0,1,0,0,'','34020000002000000005','0',NULL,'2022-01-05 15:11:25','2022-01-05 15:11:25'),('34020000001310000065','GB_Chn_065','Dahua','DH-NVR5864-I','0','340200','','axy','34020000002000000005',0,1,'',0,0,NULL,'0','',0,'',0,1,0,0,'','34020000002000000005','0',NULL,'2022-01-05 15:11:25','2022-01-05 15:11:25'),('34020000001320000001','IPCamera 01','Mercury','MIPC368(P)W-4','Owner','CivilCode','','Address','',0,1,'',0,0,NULL,'0','',0,'',0,1,0,0,'','44010000001110008008','0',NULL,'2022-01-05 15:11:26','2022-01-05 15:11:26'); -/*!40000 ALTER TABLE `device_channel` ENABLE KEYS */; -UNLOCK TABLES; - --- --- Table structure for table `device_mobile_position` --- - -DROP TABLE IF EXISTS `device_mobile_position`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; -CREATE TABLE `device_mobile_position` ( - `deviceId` varchar(50) NOT NULL, - `channelId` varchar(50) NOT NULL, - `deviceName` varchar(255) DEFAULT NULL, - `time` varchar(50) NOT NULL, - `longitude` double NOT NULL, - `latitude` double NOT NULL, - `altitude` double DEFAULT NULL, - `speed` double DEFAULT NULL, - `direction` double DEFAULT NULL, - `reportSource` varchar(50) DEFAULT NULL, - `geodeticSystem` varchar(50) DEFAULT NULL, - `cnLng` varchar(50) DEFAULT NULL, - `cnLat` varchar(50) DEFAULT NULL, - PRIMARY KEY (`deviceId`,`time`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Dumping data for table `device_mobile_position` --- - -LOCK TABLES `device_mobile_position` WRITE; -/*!40000 ALTER TABLE `device_mobile_position` DISABLE KEYS */; -/*!40000 ALTER TABLE `device_mobile_position` ENABLE KEYS */; -UNLOCK TABLES; - --- --- Table structure for table `gb_stream` --- - -DROP TABLE IF EXISTS `gb_stream`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; -CREATE TABLE `gb_stream` ( - `app` varchar(255) NOT NULL, - `stream` varchar(255) NOT NULL, - `gbId` varchar(50) NOT NULL, - `name` varchar(255) DEFAULT NULL, - `longitude` double DEFAULT NULL, - `latitude` double DEFAULT NULL, - `streamType` varchar(50) DEFAULT NULL, - `mediaServerId` varchar(50) DEFAULT NULL, - `status` int DEFAULT NULL, - PRIMARY KEY (`app`,`stream`,`gbId`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Dumping data for table `gb_stream` --- - -LOCK TABLES `gb_stream` WRITE; -/*!40000 ALTER TABLE `gb_stream` DISABLE KEYS */; -INSERT INTO `gb_stream` VALUES ('1000','10000001_52869999','77777777777777777777','shoulei1111',0,0,'push','XR1LEpKlfQtSg9Z1',1); -/*!40000 ALTER TABLE `gb_stream` ENABLE KEYS */; -UNLOCK TABLES; - --- --- Table structure for table `log` --- - -DROP TABLE IF EXISTS `log`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; -CREATE TABLE `log` ( - `id` int NOT NULL AUTO_INCREMENT, - `name` varchar(50) NOT NULL, - `type` varchar(50) NOT NULL, - `uri` varchar(200) NOT NULL, - `address` varchar(50) NOT NULL, - `result` varchar(50) NOT NULL, - `timing` bigint NOT NULL, - `username` varchar(50) NOT NULL, - `createTime` varchar(50) NOT NULL, - PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=21 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Dumping data for table `log` --- - -LOCK TABLES `log` WRITE; -/*!40000 ALTER TABLE `log` DISABLE KEYS */; -INSERT INTO `log` VALUES (1,'登录','GET','/api/user/login','127.0.0.1','200 OK',245,'admin','2022-01-05 15:09:06'),(2,'添加上级平台','POST','/api/platform/save','127.0.0.1','200 OK',88,'admin','2022-01-05 15:09:24'),(3,'[设备查询] 同步设备通道','POST','/api/device/query/devices/34020000001320000005/sync','127.0.0.1','200 OK',17,'admin','2022-01-05 15:11:21'),(4,'[设备查询] 同步设备通道','POST','/api/device/query/devices/34020000002000000005/sync','127.0.0.1','200 OK',4,'admin','2022-01-05 15:11:25'),(5,'[设备查询] 同步设备通道','POST','/api/device/query/devices/44010000001110008008/sync','127.0.0.1','200 OK',4,'admin','2022-01-05 15:11:26'),(6,'向上级平台添加国标通道','POST','/api/platform/update_channel_for_gb','127.0.0.1','200 OK',52,'admin','2022-01-05 15:11:32'),(7,'从上级平台移除国标通道','DELETE','/api/platform/del_channel_for_gb','127.0.0.1','200 OK',35,'admin','2022-01-05 15:11:34'),(8,'向上级平台添加国标通道','POST','/api/platform/update_channel_for_gb','127.0.0.1','200 OK',39,'admin','2022-01-05 15:11:35'),(9,'从上级平台移除国标通道','DELETE','/api/platform/del_channel_for_gb','127.0.0.1','200 OK',46,'admin','2022-01-05 15:14:00'),(10,'向上级平台添加国标通道','POST','/api/platform/update_channel_for_gb','127.0.0.1','200 OK',59,'admin','2022-01-05 15:14:01'),(11,'添加通道与国标的关联','POST','/api/gbStream/add','127.0.0.1','200 OK',12,'admin','2022-01-05 15:14:16'),(12,'添加通道与国标的关联','POST','/api/gbStream/add','127.0.0.1','200 OK',8,'admin','2022-01-05 15:14:17'),(13,'添加通道与国标的关联','POST','/api/gbStream/add','127.0.0.1','200 OK',6,'admin','2022-01-05 15:14:19'),(14,'添加通道与国标的关联','POST','/api/gbStream/add','127.0.0.1','200 OK',8,'admin','2022-01-05 15:14:19'),(15,'移除通道与国标的关联','DELETE','/api/gbStream/del','127.0.0.1','200 OK',11,'admin','2022-01-05 15:14:21'),(16,'添加通道与国标的关联','POST','/api/gbStream/add','127.0.0.1','200 OK',42,'admin','2022-01-05 15:14:24'),(17,'移除通道与国标的关联','DELETE','/api/gbStream/del','127.0.0.1','200 OK',43,'admin','2022-01-05 15:14:25'),(18,'添加通道与国标的关联','POST','/api/gbStream/add','127.0.0.1','200 OK',9,'admin','2022-01-05 15:14:27'),(19,'添加通道与国标的关联','POST','/api/gbStream/add','127.0.0.1','200 OK',9,'admin','2022-01-05 15:14:37'),(20,'添加通道与国标的关联','POST','/api/gbStream/add','127.0.0.1','200 OK',10,'admin','2022-01-05 15:14:38'); -/*!40000 ALTER TABLE `log` ENABLE KEYS */; -UNLOCK TABLES; - --- --- Table structure for table `media_server` --- - -DROP TABLE IF EXISTS `media_server`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; -CREATE TABLE `media_server` ( - `id` varchar(255) NOT NULL, - `ip` varchar(50) NOT NULL, - `hookIp` varchar(50) NOT NULL, - `sdpIp` varchar(50) NOT NULL, - `streamIp` varchar(50) NOT NULL, - `httpPort` int NOT NULL, - `httpSSlPort` int NOT NULL, - `rtmpPort` int NOT NULL, - `rtmpSSlPort` int NOT NULL, - `rtpProxyPort` int NOT NULL, - `rtspPort` int NOT NULL, - `rtspSSLPort` int NOT NULL, - `autoConfig` int NOT NULL, - `secret` varchar(50) NOT NULL, - `streamNoneReaderDelayMS` int NOT NULL, - `rtpEnable` int NOT NULL, - `rtpPortRange` varchar(50) NOT NULL, - `sendRtpPortRange` varchar(50) NOT NULL, - `recordAssistPort` int NOT NULL, - `defaultServer` int NOT NULL, - `createTime` varchar(50) NOT NULL, - `updateTime` varchar(50) NOT NULL, - `hookAliveInterval` int NOT NULL, - PRIMARY KEY (`id`), - UNIQUE KEY `media_server_i` (`ip`,`httpPort`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Dumping data for table `media_server` --- - -LOCK TABLES `media_server` WRITE; -/*!40000 ALTER TABLE `media_server` DISABLE KEYS */; -INSERT INTO `media_server` VALUES ('XR1LEpKlfQtSg9Z1','192.168.1.3','127.0.0.1','192.168.1.3','192.168.1.3',6080,0,10935,0,10000,10554,0,1,'035c73f7-bb6b-4889-a715-d9eb2d1925cc',100000,1,'30000,30500','30000,30500',18081,1,'2022-01-05 15:08:27','2022-01-05 15:08:27',10); -/*!40000 ALTER TABLE `media_server` ENABLE KEYS */; -UNLOCK TABLES; - --- --- Table structure for table `parent_platform` --- - -DROP TABLE IF EXISTS `parent_platform`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; -CREATE TABLE `parent_platform` ( - `id` int NOT NULL AUTO_INCREMENT, - `enable` int DEFAULT NULL, - `name` varchar(255) DEFAULT NULL, - `serverGBId` varchar(50) NOT NULL, - `serverGBDomain` varchar(50) DEFAULT NULL, - `serverIP` varchar(50) DEFAULT NULL, - `serverPort` int DEFAULT NULL, - `deviceGBId` varchar(50) NOT NULL, - `deviceIp` varchar(50) DEFAULT NULL, - `devicePort` varchar(50) DEFAULT NULL, - `username` varchar(255) DEFAULT NULL, - `password` varchar(50) DEFAULT NULL, - `expires` varchar(50) DEFAULT NULL, - `keepTimeout` varchar(50) DEFAULT NULL, - `transport` varchar(50) DEFAULT NULL, - `characterSet` varchar(50) DEFAULT NULL, - `catalogId` varchar(50) NOT NULL, - `ptz` int DEFAULT NULL, - `rtcp` int DEFAULT NULL, - `status` bit(1) DEFAULT NULL, - `shareAllLiveStream` int DEFAULT NULL, - PRIMARY KEY (`id`,`serverGBId`) -) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Dumping data for table `parent_platform` --- - -LOCK TABLES `parent_platform` WRITE; -/*!40000 ALTER TABLE `parent_platform` DISABLE KEYS */; -INSERT INTO `parent_platform` VALUES (1,1,'1112','1111111111111','1111111111','11.11.11.11',111111,'34020000002110000015','192.168.1.3','5060','34020000002110000015','12345678','300','60','UDP','GB2312','1111111111111',1,0,_binary '\0',1); -/*!40000 ALTER TABLE `parent_platform` ENABLE KEYS */; -UNLOCK TABLES; - --- --- Table structure for table `platform_catalog` --- - -DROP TABLE IF EXISTS `platform_catalog`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; -CREATE TABLE `platform_catalog` ( - `id` varchar(50) NOT NULL, - `platformId` varchar(50) NOT NULL, - `name` varchar(255) NOT NULL, - `parentId` varchar(50) DEFAULT NULL, - PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Dumping data for table `platform_catalog` --- - -LOCK TABLES `platform_catalog` WRITE; -/*!40000 ALTER TABLE `platform_catalog` DISABLE KEYS */; -INSERT INTO `platform_catalog` VALUES ('1111111111','1111111111111','11122','1111111111111'); -/*!40000 ALTER TABLE `platform_catalog` ENABLE KEYS */; -UNLOCK TABLES; - --- --- Table structure for table `platform_gb_channel` --- - -DROP TABLE IF EXISTS `platform_gb_channel`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; -CREATE TABLE `platform_gb_channel` ( - `channelId` varchar(50) NOT NULL, - `deviceId` varchar(50) NOT NULL, - `platformId` varchar(50) NOT NULL, - `deviceAndChannelId` varchar(50) NOT NULL, - `catalogId` varchar(50) NOT NULL, - PRIMARY KEY (`deviceAndChannelId`,`platformId`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Dumping data for table `platform_gb_channel` --- - -LOCK TABLES `platform_gb_channel` WRITE; -/*!40000 ALTER TABLE `platform_gb_channel` DISABLE KEYS */; -INSERT INTO `platform_gb_channel` VALUES ('34020000001310000001','34020000001320000005','1111111111111','34020000001320000005_34020000001310000001','1111111111'),('34020000001310000001','34020000002000000005','1111111111111','34020000002000000005_34020000001310000001','1111111111'),('34020000001310000065','34020000002000000005','1111111111111','34020000002000000005_34020000001310000065','1111111111'),('34020000001320000001','44010000001110008008','1111111111111','44010000001110008008_34020000001320000001','1111111111'); -/*!40000 ALTER TABLE `platform_gb_channel` ENABLE KEYS */; -UNLOCK TABLES; - --- --- Table structure for table `platform_gb_stream` --- - -DROP TABLE IF EXISTS `platform_gb_stream`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; -CREATE TABLE `platform_gb_stream` ( - `platformId` varchar(50) NOT NULL, - `app` varchar(255) NOT NULL, - `stream` varchar(255) NOT NULL, - `catalogId` varchar(50) NOT NULL, - PRIMARY KEY (`platformId`,`app`,`stream`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Dumping data for table `platform_gb_stream` --- - -LOCK TABLES `platform_gb_stream` WRITE; -/*!40000 ALTER TABLE `platform_gb_stream` DISABLE KEYS */; -INSERT INTO `platform_gb_stream` VALUES ('1111111111111','1000','10000001_52869999','1111111111'); -/*!40000 ALTER TABLE `platform_gb_stream` ENABLE KEYS */; -UNLOCK TABLES; - --- --- Table structure for table `role` --- - -DROP TABLE IF EXISTS `role`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; -CREATE TABLE `role` ( - `id` int NOT NULL AUTO_INCREMENT, - `name` text NOT NULL, - `authority` text NOT NULL, - `createTime` varchar(50) NOT NULL, - `updateTime` varchar(50) NOT NULL, - PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Dumping data for table `role` --- - -LOCK TABLES `role` WRITE; -/*!40000 ALTER TABLE `role` DISABLE KEYS */; -INSERT INTO `role` VALUES (1,'admin','0','2021-04-13 14:14:57','2021-04-13 14:14:57'); -/*!40000 ALTER TABLE `role` ENABLE KEYS */; -UNLOCK TABLES; - --- --- Table structure for table `stream_proxy` --- - -DROP TABLE IF EXISTS `stream_proxy`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; -CREATE TABLE `stream_proxy` ( - `type` varchar(50) NOT NULL, - `app` varchar(255) NOT NULL, - `stream` varchar(255) NOT NULL, - `url` varchar(255) DEFAULT NULL, - `src_url` varchar(255) DEFAULT NULL, - `dst_url` varchar(255) DEFAULT NULL, - `timeout_ms` int DEFAULT NULL, - `ffmpeg_cmd_key` varchar(255) DEFAULT NULL, - `rtp_type` varchar(50) DEFAULT NULL, - `mediaServerId` varchar(50) DEFAULT NULL, - `enable_hls` bit(1) DEFAULT NULL, - `enable_mp4` bit(1) DEFAULT NULL, - `enable` bit(1) NOT NULL, - `enable_remove_none_reader` bit(1) NOT NULL, - `createTime` varchar(50) NOT NULL, - PRIMARY KEY (`app`,`stream`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Dumping data for table `stream_proxy` --- - -LOCK TABLES `stream_proxy` WRITE; -/*!40000 ALTER TABLE `stream_proxy` DISABLE KEYS */; -/*!40000 ALTER TABLE `stream_proxy` ENABLE KEYS */; -UNLOCK TABLES; - --- --- Table structure for table `stream_push` --- - -DROP TABLE IF EXISTS `stream_push`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; -CREATE TABLE `stream_push` ( - `app` varchar(255) NOT NULL, - `stream` varchar(255) NOT NULL, - `totalReaderCount` varchar(50) DEFAULT NULL, - `originType` int DEFAULT NULL, - `originTypeStr` varchar(50) DEFAULT NULL, - `createStamp` int DEFAULT NULL, - `aliveSecond` int DEFAULT NULL, - `mediaServerId` varchar(50) DEFAULT NULL, - PRIMARY KEY (`app`,`stream`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Dumping data for table `stream_push` --- - -LOCK TABLES `stream_push` WRITE; -/*!40000 ALTER TABLE `stream_push` DISABLE KEYS */; -INSERT INTO `stream_push` VALUES ('1000','10000001_52869999','0',2,'rtsp_push',1641366850,0,'XR1LEpKlfQtSg9Z1'); -/*!40000 ALTER TABLE `stream_push` ENABLE KEYS */; -UNLOCK TABLES; - --- --- Table structure for table `user` --- - -DROP TABLE IF EXISTS `user`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; -CREATE TABLE `user` ( - `id` int NOT NULL AUTO_INCREMENT, - `username` varchar(255) NOT NULL, - `password` varchar(255) NOT NULL, - `roleId` int NOT NULL, - `createTime` varchar(50) NOT NULL, - `updateTime` varchar(50) NOT NULL, - PRIMARY KEY (`id`), - UNIQUE KEY `user_username_uindex` (`username`) -) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Dumping data for table `user` --- - -LOCK TABLES `user` WRITE; -/*!40000 ALTER TABLE `user` DISABLE KEYS */; -INSERT INTO `user` VALUES (1,'admin','21232f297a57a5a743894a0e4a801fc3',1,'2021-04-13 14:14:57','2021-04-13 14:14:57'); -/*!40000 ALTER TABLE `user` ENABLE KEYS */; -UNLOCK TABLES; - --- --- Dumping routines for database 'wvp' --- -/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; - -/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; -/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; -/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; -/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; -/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; -/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; -/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; - --- Dump completed on 2022-01-05 15:15:35 diff --git a/sql/mysql.sql b/sql/mysql.sql index 8cbd4934..65693750 100644 --- a/sql/mysql.sql +++ b/sql/mysql.sql @@ -1,268 +1,529 @@ --- auto-generated definition - - -CREATE DATABASE IF NOT EXISTS `wvp` /*!40100 DEFAULT CHARACTER SET utf8mb3 COLLATE utf8mb3_bin */; - -use wvp; - -create table device -( - deviceId varchar(50) not null - primary key, - name varchar(255) null, - manufacturer varchar(255) null, - model varchar(255) null, - firmware varchar(255) null, - transport varchar(50) null, - streamMode varchar(50) null, - online varchar(50) null, - registerTime varchar(50) null, - keepaliveTime varchar(50) null, - ip varchar(50) not null, - createTime varchar(50) not null, - updateTime varchar(50) not null, - port int not null, - expires int not null, - subscribeCycleForCatalog int not null, - hostAddress varchar(50) not null, - charset varchar(50) not null -); - -create table device_channel -( - channelId varchar(50) not null, - name varchar(255) null, - manufacture varchar(50) null, - model varchar(50) null, - owner varchar(50) null, - civilCode varchar(50) null, - block varchar(50) null, - address varchar(50) null, - parentId varchar(50) null, - safetyWay int null, - registerWay int null, - certNum varchar(50) null, - certifiable int null, - errCode int null, - endTime varchar(50) null, - secrecy varchar(50) null, - ipAddress varchar(50) null, - port int null, - password varchar(255) null, - PTZType int null, - status int null, - longitude double null, - latitude double null, - streamId varchar(50) null, - deviceId varchar(50) not null, - parental varchar(50) null, - hasAudio bit null, - createTime varchar(50) not null, - updateTime varchar(50) not null, - primary key (channelId, deviceId) -); - -create table device_alarm -( - id int auto_increment - primary key, - deviceId varchar(50) not null, - channelId varchar(50) not null, - alarmPriority varchar(50) not null, - alarmMethod varchar(50), - alarmTime varchar(50) not null, - alarmDescription varchar(255), - longitude double null, - latitude double null, - alarmType varchar(50) -); - -create table log -( - id int auto_increment - primary key, - name varchar(50) not null, - type varchar(50) not null, - uri varchar(200) not null, - address varchar(50) not null, - result varchar(50) not null, - timing bigint not null, - username varchar(50) not null, - createTime varchar(50) not null -); - -create table device_mobile_position -( - deviceId varchar(50) not null, - channelId varchar(50) not null, - deviceName varchar(255) null, - time varchar(50) not null, - longitude double not null, - latitude double not null, - altitude double null, - speed double null, - direction double null, - reportSource varchar(50) null, - geodeticSystem varchar(50) null, - cnLng varchar(50) null, - cnLat varchar(50) null, - primary key (deviceId, time) -); - -create table gb_stream -( - app varchar(255) not null, - stream varchar(255) not null, - gbId varchar(50) not null, - name varchar(255) null, - longitude double null, - latitude double null, - streamType varchar(50) null, - mediaServerId varchar(50) null, - status int null, - primary key (app, stream, gbId) -); - -create table media_server -( - id varchar(255) not null - primary key, - ip varchar(50) not null, - hookIp varchar(50) not null, - sdpIp varchar(50) not null, - streamIp varchar(50) not null, - httpPort int not null, - httpSSlPort int not null, - rtmpPort int not null, - rtmpSSlPort int not null, - rtpProxyPort int not null, - rtspPort int not null, - rtspSSLPort int not null, - autoConfig int not null, - secret varchar(50) not null, - streamNoneReaderDelayMS int not null, - rtpEnable int not null, - rtpPortRange varchar(50) not null, - sendRtpPortRange varchar(50) not null, - recordAssistPort int not null, - defaultServer int not null, - createTime varchar(50) not null, - updateTime varchar(50) not null, - hookAliveInterval int not null, - constraint media_server_i - unique (ip, httpPort) -); - -create table parent_platform -( - id int auto_increment, - enable int null, - name varchar(255) null, - serverGBId varchar(50) not null, - serverGBDomain varchar(50) null, - serverIP varchar(50) null, - serverPort int null, - deviceGBId varchar(50) not null, - deviceIp varchar(50) null, - devicePort varchar(50) null, - username varchar(255) null, - password varchar(50) null, - expires varchar(50) null, - keepTimeout varchar(50) null, - transport varchar(50) null, - characterSet varchar(50) null, - catalogId varchar(50) not null, - ptz int null, - rtcp int null, - status bit null, - shareAllLiveStream int null, - primary key (id, serverGBId) -); - - -create table platform_catalog -( - id varchar(50) primary key, - platformId varchar(50) not null, - name varchar(255) not null, - parentId varchar(50) -); - -create table platform_gb_channel -( - channelId varchar(50) not null, - deviceId varchar(50) not null, - platformId varchar(50) not null, - deviceAndChannelId varchar(50) not null, - catalogId varchar(50) not null, - primary key (deviceAndChannelId, platformId) -); - -create table platform_gb_stream -( - platformId varchar(50) not null, - app varchar(255) not null, - stream varchar(255) not null, - catalogId varchar(50) not null, - primary key (platformId, app, stream) -); - -create table stream_proxy -( - type varchar(50) not null, - app varchar(255) not null, - stream varchar(255) not null, - url varchar(255) null, - src_url varchar(255) null, - dst_url varchar(255) null, - timeout_ms int null, - ffmpeg_cmd_key varchar(255) null, - rtp_type varchar(50) null, - mediaServerId varchar(50) null, - enable_hls bit null, - enable_mp4 bit null, - enable bit not null, - enable_remove_none_reader bit not null, - createTime varchar(50) not null, - primary key (app, stream) -); - -create table stream_push -( - app varchar(255) not null, - stream varchar(255) not null, - totalReaderCount varchar(50) null, - originType int null, - originTypeStr varchar(50) null, - createStamp int null, - aliveSecond int null, - mediaServerId varchar(50) null, - primary key (app, stream) -); - -create table user -( - id int auto_increment - primary key, - username varchar(255) not null, - password varchar(255) not null, - roleId int not null, - createTime varchar(50) not null, - updateTime varchar(50) not null -); - -create unique index user_username_uindex - on user (username); - -insert into user (username, password, roleId, createTime, updateTime) values ('admin', '21232f297a57a5a743894a0e4a801fc3', '1', '2021-04-13 14:14:57', '2021-04-13 14:14:57'); - -create table role ( - id int auto_increment - primary key, - name TEXT NOT NULL, - authority TEXT NOT NULL, - createTime varchar(50) not null, - updateTime varchar(50) not null -); -insert into role (id, name, authority, createTime, updateTime) values ('1', 'admin', '0', '2021-04-13 14:14:57', '2021-04-13 14:14:57'); +-- MySQL dump 10.13 Distrib 8.0.27, for Linux (x86_64) +-- +-- Host: 192.168.1.242 Database: wvp +-- ------------------------------------------------------ +-- Server version 5.7.22 +/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; +/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; +/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; +/*!50503 SET NAMES utf8mb4 */; +/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; +/*!40103 SET TIME_ZONE='+00:00' */; +/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; +/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; +/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; + +-- +-- Table structure for table `device` +-- + +DROP TABLE IF EXISTS `device`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!50503 SET character_set_client = utf8mb4 */; +CREATE TABLE `device` ( + `deviceId` varchar(50) NOT NULL, + `name` varchar(255) DEFAULT NULL, + `manufacturer` varchar(255) DEFAULT NULL, + `model` varchar(255) DEFAULT NULL, + `firmware` varchar(255) DEFAULT NULL, + `transport` varchar(50) DEFAULT NULL, + `streamMode` varchar(50) DEFAULT NULL, + `online` varchar(50) DEFAULT NULL, + `registerTime` varchar(50) DEFAULT NULL, + `keepaliveTime` varchar(50) DEFAULT NULL, + `ip` varchar(50) NOT NULL, + `createTime` varchar(50) NOT NULL, + `updateTime` varchar(50) NOT NULL, + `port` int(11) NOT NULL, + `expires` int(11) NOT NULL, + `subscribeCycleForCatalog` int(11) NOT NULL, + `hostAddress` varchar(50) NOT NULL, + `charset` varchar(50) NOT NULL, + PRIMARY KEY (`deviceId`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `device` +-- + +LOCK TABLES `device` WRITE; +/*!40000 ALTER TABLE `device` DISABLE KEYS */; +/*!40000 ALTER TABLE `device` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `device_alarm` +-- + +DROP TABLE IF EXISTS `device_alarm`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!50503 SET character_set_client = utf8mb4 */; +CREATE TABLE `device_alarm` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `deviceId` varchar(50) NOT NULL, + `channelId` varchar(50) NOT NULL, + `alarmPriority` varchar(50) NOT NULL, + `alarmMethod` varchar(50) DEFAULT NULL, + `alarmTime` varchar(50) NOT NULL, + `alarmDescription` varchar(255) DEFAULT NULL, + `longitude` double DEFAULT NULL, + `latitude` double DEFAULT NULL, + `alarmType` varchar(50) DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `device_alarm` +-- + +LOCK TABLES `device_alarm` WRITE; +/*!40000 ALTER TABLE `device_alarm` DISABLE KEYS */; +/*!40000 ALTER TABLE `device_alarm` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `device_channel` +-- + +DROP TABLE IF EXISTS `device_channel`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!50503 SET character_set_client = utf8mb4 */; +CREATE TABLE `device_channel` ( + `channelId` varchar(50) NOT NULL, + `name` varchar(255) DEFAULT NULL, + `manufacture` varchar(50) DEFAULT NULL, + `model` varchar(50) DEFAULT NULL, + `owner` varchar(50) DEFAULT NULL, + `civilCode` varchar(50) DEFAULT NULL, + `block` varchar(50) DEFAULT NULL, + `address` varchar(50) DEFAULT NULL, + `parentId` varchar(50) DEFAULT NULL, + `safetyWay` int(11) DEFAULT NULL, + `registerWay` int(11) DEFAULT NULL, + `certNum` varchar(50) DEFAULT NULL, + `certifiable` int(11) DEFAULT NULL, + `errCode` int(11) DEFAULT NULL, + `endTime` varchar(50) DEFAULT NULL, + `secrecy` varchar(50) DEFAULT NULL, + `ipAddress` varchar(50) DEFAULT NULL, + `port` int(11) DEFAULT NULL, + `password` varchar(255) DEFAULT NULL, + `PTZType` int(11) DEFAULT NULL, + `status` int(11) DEFAULT NULL, + `longitude` double DEFAULT NULL, + `latitude` double DEFAULT NULL, + `streamId` varchar(50) DEFAULT NULL, + `deviceId` varchar(50) NOT NULL, + `parental` varchar(50) DEFAULT NULL, + `hasAudio` bit(1) DEFAULT NULL, + `createTime` varchar(50) NOT NULL, + `updateTime` varchar(50) NOT NULL, + PRIMARY KEY (`channelId`,`deviceId`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `device_channel` +-- + +LOCK TABLES `device_channel` WRITE; +/*!40000 ALTER TABLE `device_channel` DISABLE KEYS */; +/*!40000 ALTER TABLE `device_channel` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `device_mobile_position` +-- + +DROP TABLE IF EXISTS `device_mobile_position`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!50503 SET character_set_client = utf8mb4 */; +CREATE TABLE `device_mobile_position` ( + `deviceId` varchar(50) NOT NULL, + `channelId` varchar(50) NOT NULL, + `deviceName` varchar(255) DEFAULT NULL, + `time` varchar(50) NOT NULL, + `longitude` double NOT NULL, + `latitude` double NOT NULL, + `altitude` double DEFAULT NULL, + `speed` double DEFAULT NULL, + `direction` double DEFAULT NULL, + `reportSource` varchar(50) DEFAULT NULL, + `geodeticSystem` varchar(50) DEFAULT NULL, + `cnLng` varchar(50) DEFAULT NULL, + `cnLat` varchar(50) DEFAULT NULL, + PRIMARY KEY (`deviceId`,`time`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `device_mobile_position` +-- + +LOCK TABLES `device_mobile_position` WRITE; +/*!40000 ALTER TABLE `device_mobile_position` DISABLE KEYS */; +/*!40000 ALTER TABLE `device_mobile_position` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `gb_stream` +-- + +DROP TABLE IF EXISTS `gb_stream`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!50503 SET character_set_client = utf8mb4 */; +CREATE TABLE `gb_stream` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `app` varchar(255) NOT NULL, + `stream` varchar(255) NOT NULL, + `gbId` varchar(50) NOT NULL, + `name` varchar(255) DEFAULT NULL, + `longitude` double DEFAULT NULL, + `latitude` double DEFAULT NULL, + `streamType` varchar(50) DEFAULT NULL, + `mediaServerId` varchar(50) DEFAULT NULL, + `status` int(11) DEFAULT NULL, + `createStamp` bigint(20) DEFAULT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `app` (`app`,`stream`), + UNIQUE KEY `gbId` (`gbId`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `gb_stream` +-- + +LOCK TABLES `gb_stream` WRITE; +/*!40000 ALTER TABLE `gb_stream` DISABLE KEYS */; +/*!40000 ALTER TABLE `gb_stream` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `log` +-- + +DROP TABLE IF EXISTS `log`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!50503 SET character_set_client = utf8mb4 */; +CREATE TABLE `log` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `name` varchar(50) NOT NULL, + `type` varchar(50) NOT NULL, + `uri` varchar(200) NOT NULL, + `address` varchar(50) NOT NULL, + `result` varchar(50) NOT NULL, + `timing` bigint(20) NOT NULL, + `username` varchar(50) NOT NULL, + `createTime` varchar(50) NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `log` +-- + +LOCK TABLES `log` WRITE; +/*!40000 ALTER TABLE `log` DISABLE KEYS */; +/*!40000 ALTER TABLE `log` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `media_server` +-- + +DROP TABLE IF EXISTS `media_server`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!50503 SET character_set_client = utf8mb4 */; +CREATE TABLE `media_server` ( + `id` varchar(255) NOT NULL, + `ip` varchar(50) NOT NULL, + `hookIp` varchar(50) NOT NULL, + `sdpIp` varchar(50) NOT NULL, + `streamIp` varchar(50) NOT NULL, + `httpPort` int(11) NOT NULL, + `httpSSlPort` int(11) NOT NULL, + `rtmpPort` int(11) NOT NULL, + `rtmpSSlPort` int(11) NOT NULL, + `rtpProxyPort` int(11) NOT NULL, + `rtspPort` int(11) NOT NULL, + `rtspSSLPort` int(11) NOT NULL, + `autoConfig` int(11) NOT NULL, + `secret` varchar(50) NOT NULL, + `streamNoneReaderDelayMS` int(11) NOT NULL, + `rtpEnable` int(11) NOT NULL, + `rtpPortRange` varchar(50) NOT NULL, + `sendRtpPortRange` varchar(50) NOT NULL, + `recordAssistPort` int(11) NOT NULL, + `defaultServer` int(11) NOT NULL, + `createTime` varchar(50) NOT NULL, + `updateTime` varchar(50) NOT NULL, + `hookAliveInterval` int(11) NOT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `media_server_i` (`ip`,`httpPort`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `media_server` +-- + +LOCK TABLES `media_server` WRITE; +/*!40000 ALTER TABLE `media_server` DISABLE KEYS */; +/*!40000 ALTER TABLE `media_server` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `parent_platform` +-- + +DROP TABLE IF EXISTS `parent_platform`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!50503 SET character_set_client = utf8mb4 */; +CREATE TABLE `parent_platform` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `enable` int(11) DEFAULT NULL, + `name` varchar(255) DEFAULT NULL, + `serverGBId` varchar(50) NOT NULL, + `serverGBDomain` varchar(50) DEFAULT NULL, + `serverIP` varchar(50) DEFAULT NULL, + `serverPort` int(11) DEFAULT NULL, + `deviceGBId` varchar(50) NOT NULL, + `deviceIp` varchar(50) DEFAULT NULL, + `devicePort` varchar(50) DEFAULT NULL, + `username` varchar(255) DEFAULT NULL, + `password` varchar(50) DEFAULT NULL, + `expires` varchar(50) DEFAULT NULL, + `keepTimeout` varchar(50) DEFAULT NULL, + `transport` varchar(50) DEFAULT NULL, + `characterSet` varchar(50) DEFAULT NULL, + `catalogId` varchar(50) NOT NULL, + `ptz` int(11) DEFAULT NULL, + `rtcp` int(11) DEFAULT NULL, + `status` bit(1) DEFAULT NULL, + `shareAllLiveStream` int(11) DEFAULT NULL, + PRIMARY KEY (`id`,`serverGBId`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `parent_platform` +-- + +LOCK TABLES `parent_platform` WRITE; +/*!40000 ALTER TABLE `parent_platform` DISABLE KEYS */; +/*!40000 ALTER TABLE `parent_platform` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `platform_catalog` +-- + +DROP TABLE IF EXISTS `platform_catalog`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!50503 SET character_set_client = utf8mb4 */; +CREATE TABLE `platform_catalog` ( + `id` varchar(50) NOT NULL, + `platformId` varchar(50) NOT NULL, + `name` varchar(255) NOT NULL, + `parentId` varchar(50) DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `platform_catalog` +-- + +LOCK TABLES `platform_catalog` WRITE; +/*!40000 ALTER TABLE `platform_catalog` DISABLE KEYS */; +/*!40000 ALTER TABLE `platform_catalog` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `platform_gb_channel` +-- + +DROP TABLE IF EXISTS `platform_gb_channel`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!50503 SET character_set_client = utf8mb4 */; +CREATE TABLE `platform_gb_channel` ( + `channelId` varchar(50) NOT NULL, + `deviceId` varchar(50) NOT NULL, + `platformId` varchar(50) NOT NULL, + `deviceAndChannelId` varchar(50) NOT NULL, + `catalogId` varchar(50) NOT NULL, + PRIMARY KEY (`deviceAndChannelId`,`platformId`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `platform_gb_channel` +-- + +LOCK TABLES `platform_gb_channel` WRITE; +/*!40000 ALTER TABLE `platform_gb_channel` DISABLE KEYS */; +/*!40000 ALTER TABLE `platform_gb_channel` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `platform_gb_stream` +-- + +DROP TABLE IF EXISTS `platform_gb_stream`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!50503 SET character_set_client = utf8mb4 */; +CREATE TABLE `platform_gb_stream` ( + `platformId` varchar(50) NOT NULL, + `app` varchar(255) NOT NULL, + `stream` varchar(255) NOT NULL, + `catalogId` varchar(50) NOT NULL, + PRIMARY KEY (`platformId`,`app`,`stream`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `platform_gb_stream` +-- + +LOCK TABLES `platform_gb_stream` WRITE; +/*!40000 ALTER TABLE `platform_gb_stream` DISABLE KEYS */; +/*!40000 ALTER TABLE `platform_gb_stream` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `user_role` +-- + +DROP TABLE IF EXISTS `user_role`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!50503 SET character_set_client = utf8mb4 */; +CREATE TABLE `user_role` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `name` varchar(50) NOT NULL, + `authority` varchar(50) NOT NULL, + `createTime` varchar(50) NOT NULL, + `updateTime` varchar(50) NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `user_role` +-- + +LOCK TABLES `user_role` WRITE; +/*!40000 ALTER TABLE `user_role` DISABLE KEYS */; +INSERT INTO `user_role` VALUES (1,'admin','0','2021-04-13 14:14:57','2021-04-13 14:14:57'); +/*!40000 ALTER TABLE `user_role` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `stream_proxy` +-- + +DROP TABLE IF EXISTS `stream_proxy`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!50503 SET character_set_client = utf8mb4 */; +CREATE TABLE `stream_proxy` ( + `type` varchar(50) NOT NULL, + `app` varchar(255) NOT NULL, + `stream` varchar(255) NOT NULL, + `url` varchar(255) DEFAULT NULL, + `src_url` varchar(255) DEFAULT NULL, + `dst_url` varchar(255) DEFAULT NULL, + `timeout_ms` int(11) DEFAULT NULL, + `ffmpeg_cmd_key` varchar(255) DEFAULT NULL, + `rtp_type` varchar(50) DEFAULT NULL, + `mediaServerId` varchar(50) DEFAULT NULL, + `enable_hls` bit(1) DEFAULT NULL, + `enable_mp4` bit(1) DEFAULT NULL, + `enable` bit(1) NOT NULL, + `enable_remove_none_reader` bit(1) NOT NULL, + `createTime` varchar(50) NOT NULL, + PRIMARY KEY (`app`,`stream`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `stream_proxy` +-- + +LOCK TABLES `stream_proxy` WRITE; +/*!40000 ALTER TABLE `stream_proxy` DISABLE KEYS */; +/*!40000 ALTER TABLE `stream_proxy` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `stream_push` +-- + +DROP TABLE IF EXISTS `stream_push`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!50503 SET character_set_client = utf8mb4 */; +CREATE TABLE `stream_push` ( + `app` varchar(255) NOT NULL, + `stream` varchar(255) NOT NULL, + `totalReaderCount` varchar(50) DEFAULT NULL, + `originType` int(11) DEFAULT NULL, + `originTypeStr` varchar(50) DEFAULT NULL, + `createStamp` bigint(20) DEFAULT NULL, + `aliveSecond` int(11) DEFAULT NULL, + `mediaServerId` varchar(50) DEFAULT NULL, + PRIMARY KEY (`app`,`stream`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `stream_push` +-- + +LOCK TABLES `stream_push` WRITE; +/*!40000 ALTER TABLE `stream_push` DISABLE KEYS */; +/*!40000 ALTER TABLE `stream_push` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `user` +-- + +DROP TABLE IF EXISTS `user`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!50503 SET character_set_client = utf8mb4 */; +CREATE TABLE `user` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `username` varchar(255) NOT NULL, + `password` varchar(255) NOT NULL, + `roleId` int(11) NOT NULL, + `createTime` varchar(50) NOT NULL, + `updateTime` varchar(50) NOT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `user_username_uindex` (`username`) +) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `user` +-- + +LOCK TABLES `user` WRITE; +/*!40000 ALTER TABLE `user` DISABLE KEYS */; +INSERT INTO `user` VALUES (1,'admin','21232f297a57a5a743894a0e4a801fc3',1,'2021-04-13 14:14:57','2021-04-13 14:14:57'); +/*!40000 ALTER TABLE `user` ENABLE KEYS */; +UNLOCK TABLES; +/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; + +/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; +/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; +/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; +/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; +/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; +/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; + +-- Dump completed on 2022-01-25 15:36:42 diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/bean/GbStream.java b/src/main/java/com/genersoft/iot/vmp/gb28181/bean/GbStream.java index a1ce8ca9..37e636ba 100644 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/bean/GbStream.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/bean/GbStream.java @@ -14,6 +14,10 @@ public class GbStream extends PlatformGbStream{ private double latitude; private String streamType; private boolean status; + /** + * GMT unix系统时间戳,单位秒 + */ + public Long createStamp; public String getApp() { return app; @@ -86,4 +90,13 @@ public class GbStream extends PlatformGbStream{ public void setMediaServerId(String mediaServerId) { this.mediaServerId = mediaServerId; } + + + public Long getCreateStamp() { + return createStamp; + } + + public void setCreateStamp(Long createStamp) { + this.createStamp = createStamp; + } } diff --git a/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMMediaListManager.java b/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMMediaListManager.java index a6c30cf9..a15e01a4 100644 --- a/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMMediaListManager.java +++ b/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMMediaListManager.java @@ -138,6 +138,7 @@ public class ZLMMediaListManager { if (gbStreamMapper.selectOne(transform.getApp(), transform.getStream()) != null) { gbStreamMapper.update(transform); }else { + transform.setCreateStamp(System.currentTimeMillis()); gbStreamMapper.add(transform); } } diff --git a/src/main/java/com/genersoft/iot/vmp/media/zlm/dto/StreamPushItem.java b/src/main/java/com/genersoft/iot/vmp/media/zlm/dto/StreamPushItem.java index 73e162af..d3c9b1bd 100644 --- a/src/main/java/com/genersoft/iot/vmp/media/zlm/dto/StreamPushItem.java +++ b/src/main/java/com/genersoft/iot/vmp/media/zlm/dto/StreamPushItem.java @@ -56,11 +56,6 @@ public class StreamPushItem extends GbStream implements Comparable deviceChannelList = new ArrayList<>(); for (GbStream gbStream : gbStreams) { - platformGbStreamMapper.delByAppAndStream(gbStream.getApp(), gbStream.getStream()); + platformGbStreamMapper.delByAppAndStreamAndPlatform(gbStream.getApp(), gbStream.getStream(), platformId); DeviceChannel deviceChannel = new DeviceChannel(); deviceChannel.setChannelId(gbStream.getGbId()); deviceChannelList.add(deviceChannel); diff --git a/src/main/java/com/genersoft/iot/vmp/service/impl/StreamProxyServiceImpl.java b/src/main/java/com/genersoft/iot/vmp/service/impl/StreamProxyServiceImpl.java index 1c8f191f..13277c21 100644 --- a/src/main/java/com/genersoft/iot/vmp/service/impl/StreamProxyServiceImpl.java +++ b/src/main/java/com/genersoft/iot/vmp/service/impl/StreamProxyServiceImpl.java @@ -146,20 +146,23 @@ public class StreamProxyServiceImpl implements IStreamProxyService { result.append(", 关联国标平台[ " + param.getPlatformGbId() + " ]失败"); } } - // 查找开启了全部直播流共享的上级平台 - List parentPlatforms = parentPlatformMapper.selectAllAhareAllLiveStream(); - if (parentPlatforms.size() > 0) { - for (ParentPlatform parentPlatform : parentPlatforms) { - param.setPlatformId(parentPlatform.getServerGBId()); - param.setCatalogId(parentPlatform.getCatalogId()); - String stream = param.getStream(); - StreamProxyItem streamProxyItems = platformGbStreamMapper.selectOne(param.getApp(), stream, parentPlatform.getServerGBId()); - if (streamProxyItems == null) { - platformGbStreamMapper.add(param); - eventPublisher.catalogEventPublishForStream(parentPlatform.getServerGBId(), param, CatalogEvent.ADD); + if (!StringUtils.isEmpty(param.getGbId())) { + // 查找开启了全部直播流共享的上级平台 + List parentPlatforms = parentPlatformMapper.selectAllAhareAllLiveStream(); + if (parentPlatforms.size() > 0) { + for (ParentPlatform parentPlatform : parentPlatforms) { + param.setPlatformId(parentPlatform.getServerGBId()); + param.setCatalogId(parentPlatform.getCatalogId()); + String stream = param.getStream(); + StreamProxyItem streamProxyItems = platformGbStreamMapper.selectOne(param.getApp(), stream, parentPlatform.getServerGBId()); + if (streamProxyItems == null) { + platformGbStreamMapper.add(param); + eventPublisher.catalogEventPublishForStream(parentPlatform.getServerGBId(), param, CatalogEvent.ADD); + } } } } + wvpResult.setMsg(result.toString()); return wvpResult; } diff --git a/src/main/java/com/genersoft/iot/vmp/service/impl/StreamPushServiceImpl.java b/src/main/java/com/genersoft/iot/vmp/service/impl/StreamPushServiceImpl.java index ebfa124b..d3d32499 100644 --- a/src/main/java/com/genersoft/iot/vmp/service/impl/StreamPushServiceImpl.java +++ b/src/main/java/com/genersoft/iot/vmp/service/impl/StreamPushServiceImpl.java @@ -125,6 +125,7 @@ public class StreamPushServiceImpl implements IStreamPushService { public boolean saveToGB(GbStream stream) { stream.setStreamType("push"); stream.setStatus(true); + stream.setCreateStamp(System.currentTimeMillis()); int add = gbStreamMapper.add(stream); // 查找开启了全部直播流共享的上级平台 @@ -305,6 +306,7 @@ public class StreamPushServiceImpl implements IStreamPushService { streamPushItem.setStreamType("push"); streamPushItem.setStatus(true); streamPushItem.setGbId("34020000004111" + gbId); + streamPushItem.setCreateStamp(System.currentTimeMillis()); gbId ++; } int limitCount = 30; diff --git a/src/main/java/com/genersoft/iot/vmp/service/impl/StreamPushUploadFileHandler.java b/src/main/java/com/genersoft/iot/vmp/service/impl/StreamPushUploadFileHandler.java index 16924df3..586b5b49 100644 --- a/src/main/java/com/genersoft/iot/vmp/service/impl/StreamPushUploadFileHandler.java +++ b/src/main/java/com/genersoft/iot/vmp/service/impl/StreamPushUploadFileHandler.java @@ -56,7 +56,7 @@ public class StreamPushUploadFileHandler extends AnalysisEventListener selectAll(String platformId); @Select("SELECT * FROM gb_stream WHERE app=#{app} AND stream=#{stream}") @@ -87,12 +87,12 @@ public interface GbStreamMapper { @Insert("") void batchAdd(List subList); diff --git a/src/main/java/com/genersoft/iot/vmp/storager/dao/PlatformGbStreamMapper.java b/src/main/java/com/genersoft/iot/vmp/storager/dao/PlatformGbStreamMapper.java index a07e68ee..a9f85104 100644 --- a/src/main/java/com/genersoft/iot/vmp/storager/dao/PlatformGbStreamMapper.java +++ b/src/main/java/com/genersoft/iot/vmp/storager/dao/PlatformGbStreamMapper.java @@ -73,6 +73,6 @@ public interface PlatformGbStreamMapper { " ") List queryPlatFormListForGBWithGBId(String app, String stream, List platforms); - @Select("SELECT * FROM platform_gb_stream WHERE app=#{app} AND stream=#{stream} AND platformId=#{platformId}") - int delByAppAndStreamAndPlatform(String app, String streamId, String platformId); + @Delete("DELETE FROM platform_gb_stream WHERE app=#{app} AND stream=#{stream} AND platformId=#{platformId}") + int delByAppAndStreamAndPlatform(String app, String stream, String platformId); } diff --git a/src/main/java/com/genersoft/iot/vmp/storager/dao/RoleMapper.java b/src/main/java/com/genersoft/iot/vmp/storager/dao/RoleMapper.java index be20a695..66a60b95 100644 --- a/src/main/java/com/genersoft/iot/vmp/storager/dao/RoleMapper.java +++ b/src/main/java/com/genersoft/iot/vmp/storager/dao/RoleMapper.java @@ -11,12 +11,12 @@ import java.util.List; @Repository public interface RoleMapper { - @Insert("INSERT INTO role (name, authority, createTime, updateTime) VALUES" + + @Insert("INSERT INTO user_role (name, authority, createTime, updateTime) VALUES" + "('${name}', '${authority}', '${createTime}', '${updateTime}')") int add(Role role); @Update(value = {" "}) int update(Role role); - @Delete("DELETE FROM role WHERE id != 1 and id=#{id}") + @Delete("DELETE FROM user_role WHERE id != 1 and id=#{id}") int delete(int id); - @Select("select * FROM role WHERE id=#{id}") + @Select("select * FROM user_role WHERE id=#{id}") Role selectById(int id); - @Select("select * FROM role") + @Select("select * FROM user_role") List selectAll(); } diff --git a/src/main/java/com/genersoft/iot/vmp/storager/dao/StreamPushMapper.java b/src/main/java/com/genersoft/iot/vmp/storager/dao/StreamPushMapper.java index 9a5d3be6..e072e274 100644 --- a/src/main/java/com/genersoft/iot/vmp/storager/dao/StreamPushMapper.java +++ b/src/main/java/com/genersoft/iot/vmp/storager/dao/StreamPushMapper.java @@ -53,8 +53,8 @@ public interface StreamPushMapper { "REPLACE INTO stream_push (app, stream, totalReaderCount, originType, originTypeStr, " + "createStamp, aliveSecond, mediaServerId) " + "VALUES " + - "( '${item.app}', '${item.stream}', '${item.totalReaderCount}', '${item.originType}', " + - "'${item.originTypeStr}','${item.createStamp}', '${item.aliveSecond}', '${item.mediaServerId}' )" + + "( '${item.app}', '${item.stream}', '${item.totalReaderCount}', #{item.originType}, " + + "'${item.originTypeStr}',#{item.createStamp}, #{item.aliveSecond}, '${item.mediaServerId}' )" + " " + "") void addAll(List streamPushItems); diff --git a/src/main/java/com/genersoft/iot/vmp/storager/dao/UserMapper.java b/src/main/java/com/genersoft/iot/vmp/storager/dao/UserMapper.java index 7eb71e6a..addb27d0 100644 --- a/src/main/java/com/genersoft/iot/vmp/storager/dao/UserMapper.java +++ b/src/main/java/com/genersoft/iot/vmp/storager/dao/UserMapper.java @@ -27,7 +27,7 @@ public interface UserMapper { @Delete("DELETE FROM user WHERE id != 1 and id=#{id}") int delete(int id); - @Select("select user.*, role.id roleID, role.name roleName, role.authority roleAuthority , role.createTime roleCreateTime , role.updateTime roleUpdateTime FROM user, role WHERE user.roleId=role.id and user.username=#{username} AND user.password=#{password}") + @Select("select u.*, r.id as roleID, r.name as roleName, r.authority as roleAuthority , r.createTime as roleCreateTime , r.updateTime as roleUpdateTime FROM user u, user_role r WHERE u.roleId=r.id and u.username=#{username} AND u.password=#{password}") @Results(id = "roleMap", value = { @Result(column = "roleID", property = "role.id"), @Result(column = "roleName", property = "role.name"), @@ -37,15 +37,15 @@ public interface UserMapper { }) User select(String username, String password); - @Select("select user.*, role.id roleID, role.name roleName, role.authority roleAuthority, role.createTime roleCreateTime , role.updateTime roleUpdateTime FROM user, role WHERE user.roleId=role.id and user.id=#{id}") + @Select("select u.*, r.id as roleID, r.name as roleName, r.authority as roleAuthority , r.createTime as roleCreateTime , r.updateTime as roleUpdateTime FROM user u, user_role r WHERE u.roleId=r.id and u.id=#{id}") @ResultMap(value="roleMap") User selectById(int id); - @Select("select user.*, role.id roleID, role.name roleName, role.authority roleAuthority, role.createTime roleCreateTime , role.updateTime roleUpdateTime FROM user, role WHERE user.roleId=role.id and username=#{username}") + @Select("select u.*, r.id as roleID, r.name as roleName, r.authority as roleAuthority , r.createTime as roleCreateTime , r.updateTime as roleUpdateTime FROM user u, user_role r WHERE u.roleId=r.id and u.username=#{username}") @ResultMap(value="roleMap") User getUserByUsername(String username); - @Select("select user.*, role.id roleID, role.name roleName, role.authority roleAuthority, role.createTime roleCreateTime , role.updateTime roleUpdateTime FROM user, role WHERE user.roleId=role.id") + @Select("select u.*, r.id as roleID, r.name as roleName, r.authority as roleAuthority , r.createTime as roleCreateTime , r.updateTime as roleUpdateTime FROM user u, user_role r WHERE u.roleId=r.id") @ResultMap(value="roleMap") List selectAll(); } diff --git a/src/main/java/com/genersoft/iot/vmp/storager/impl/VideoManagerStoragerImpl.java b/src/main/java/com/genersoft/iot/vmp/storager/impl/VideoManagerStoragerImpl.java index dc4d497c..98f3594e 100644 --- a/src/main/java/com/genersoft/iot/vmp/storager/impl/VideoManagerStoragerImpl.java +++ b/src/main/java/com/genersoft/iot/vmp/storager/impl/VideoManagerStoragerImpl.java @@ -679,6 +679,7 @@ public class VideoManagerStoragerImpl implements IVideoManagerStorager { streamProxyItem.setStatus(true); String now = this.format.format(System.currentTimeMillis()); streamProxyItem.setCreateTime(now); + streamProxyItem.setCreateStamp(System.currentTimeMillis()); try { if (gbStreamMapper.add(streamProxyItem)<0 || streamProxyMapper.add(streamProxyItem) < 0) { //事务回滚 diff --git a/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/platform/PlatformController.java b/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/platform/PlatformController.java index c486b42e..1111ff7d 100644 --- a/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/platform/PlatformController.java +++ b/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/platform/PlatformController.java @@ -86,6 +86,65 @@ public class PlatformController { return storager.queryParentPlatformList(page, count); } + /** + * 添加上级平台信息 + * @param parentPlatform + * @return + */ + @ApiOperation("添加上级平台信息") + @ApiImplicitParams({ + @ApiImplicitParam(name = "parentPlatform", value = "上级平台信息", dataTypeClass = ParentPlatform.class), + }) + @PostMapping("/add") + @ResponseBody + public ResponseEntity> addPlatform(@RequestBody ParentPlatform parentPlatform){ + + if (logger.isDebugEnabled()) { + logger.debug("保存上级平台信息API调用"); + } + WVPResult wvpResult = new WVPResult<>(); + if (StringUtils.isEmpty(parentPlatform.getName()) + ||StringUtils.isEmpty(parentPlatform.getServerGBId()) + ||StringUtils.isEmpty(parentPlatform.getServerGBDomain()) + ||StringUtils.isEmpty(parentPlatform.getServerIP()) + ||StringUtils.isEmpty(parentPlatform.getServerPort()) + ||StringUtils.isEmpty(parentPlatform.getDeviceGBId()) + ||StringUtils.isEmpty(parentPlatform.getExpires()) + ||StringUtils.isEmpty(parentPlatform.getKeepTimeout()) + ||StringUtils.isEmpty(parentPlatform.getTransport()) + ||StringUtils.isEmpty(parentPlatform.getCharacterSet()) + ){ + wvpResult.setCode(-1); + wvpResult.setMsg("missing parameters"); + return new ResponseEntity<>(wvpResult, HttpStatus.BAD_REQUEST); + } + + ParentPlatform parentPlatformOld = storager.queryParentPlatByServerGBId(parentPlatform.getServerGBId()); + if (parentPlatformOld != null) { + wvpResult.setCode(-1); + wvpResult.setMsg("平台 "+parentPlatform.getServerGBId()+" 已存在"); + return new ResponseEntity<>(wvpResult, HttpStatus.OK); + } + boolean updateResult = storager.updateParentPlatform(parentPlatform); + + if (updateResult) { + // 保存时启用就发送注册 + if (parentPlatform.isEnable()) { + // 只要保存就发送注册 + commanderForPlatform.register(parentPlatform, null, null); + } else if (parentPlatformOld != null && parentPlatformOld.isEnable() && !parentPlatform.isEnable()){ // 关闭启用时注销 + commanderForPlatform.unregister(parentPlatform, null, null); + } + wvpResult.setCode(0); + wvpResult.setMsg("success"); + return new ResponseEntity<>(wvpResult, HttpStatus.OK); + } else { + wvpResult.setCode(-1); + wvpResult.setMsg("写入数据库失败"); + return new ResponseEntity<>(wvpResult, HttpStatus.OK); + } + } + /** * 保存上级平台信息 * @param parentPlatform @@ -97,11 +156,12 @@ public class PlatformController { }) @PostMapping("/save") @ResponseBody - public ResponseEntity savePlatform(@RequestBody ParentPlatform parentPlatform){ + public ResponseEntity> savePlatform(@RequestBody ParentPlatform parentPlatform){ if (logger.isDebugEnabled()) { logger.debug("保存上级平台信息API调用"); } + WVPResult wvpResult = new WVPResult<>(); if (StringUtils.isEmpty(parentPlatform.getName()) ||StringUtils.isEmpty(parentPlatform.getServerGBId()) ||StringUtils.isEmpty(parentPlatform.getServerGBDomain()) @@ -113,11 +173,10 @@ public class PlatformController { ||StringUtils.isEmpty(parentPlatform.getTransport()) ||StringUtils.isEmpty(parentPlatform.getCharacterSet()) ){ - return new ResponseEntity<>("missing parameters", HttpStatus.BAD_REQUEST); + wvpResult.setCode(-1); + wvpResult.setMsg("missing parameters"); + return new ResponseEntity<>(wvpResult, HttpStatus.BAD_REQUEST); } - // TODO 检查是否已经存在,且注册成功, 如果注册成功,需要先注销之前再,修改并注册 - - // ParentPlatform parentPlatformOld = storager.queryParentPlatById(parentPlatform.getDeviceGBId()); ParentPlatform parentPlatformOld = storager.queryParentPlatByServerGBId(parentPlatform.getServerGBId()); boolean updateResult = storager.updateParentPlatform(parentPlatform); @@ -130,9 +189,13 @@ public class PlatformController { } else if (parentPlatformOld != null && parentPlatformOld.isEnable() && !parentPlatform.isEnable()){ // 关闭启用时注销 commanderForPlatform.unregister(parentPlatform, null, null); } - return new ResponseEntity<>("success", HttpStatus.OK); + wvpResult.setCode(0); + wvpResult.setMsg("success"); + return new ResponseEntity<>(wvpResult, HttpStatus.OK); } else { - return new ResponseEntity<>("fail", HttpStatus.OK); + wvpResult.setCode(0); + wvpResult.setMsg("写入数据库失败"); + return new ResponseEntity<>(wvpResult, HttpStatus.OK); } } diff --git a/src/main/java/com/genersoft/iot/vmp/vmanager/streamPush/StreamPushController.java b/src/main/java/com/genersoft/iot/vmp/vmanager/streamPush/StreamPushController.java index c0fafd3f..3ea207a3 100644 --- a/src/main/java/com/genersoft/iot/vmp/vmanager/streamPush/StreamPushController.java +++ b/src/main/java/com/genersoft/iot/vmp/vmanager/streamPush/StreamPushController.java @@ -118,13 +118,12 @@ public class StreamPushController { @ResponseBody public DeferredResult>> uploadChannelFile(@RequestParam(value = "file") MultipartFile file){ - // 最多处理文件一个小时 DeferredResult>> result = new DeferredResult<>(60*60*1000L); // 录像查询以channelId作为deviceId查询 String key = DeferredResultHolder.UPLOAD_FILE_CHANNEL; String uuid = UUID.randomUUID().toString(); - + logger.info("通道导入文件类型: {}",file.getContentType() ); if (file.isEmpty()) { logger.warn("通道导入文件为空"); WVPResult wvpResult = new WVPResult<>(); @@ -133,6 +132,23 @@ public class StreamPushController { result.setResult(ResponseEntity.status(HttpStatus.BAD_REQUEST).body(wvpResult)); return result; } + if (file.getContentType() == null) { + WVPResult wvpResult = new WVPResult<>(); + wvpResult.setCode(-1); + wvpResult.setMsg("无法识别文件类型"); + result.setResult(ResponseEntity.status(HttpStatus.BAD_REQUEST).body(wvpResult)); + return result; + } +// if (!file.getContentType().endsWith(".xls") +// && !file.getContentType().endsWith(".csv") +// && !file.getContentType().endsWith(".xlsx") ) { +// logger.warn("通道导入文件类型错误: {}",file.getContentType() ); +// WVPResult wvpResult = new WVPResult<>(); +// wvpResult.setCode(-1); +// wvpResult.setMsg("文件类型错误,请使用"); +// result.setResult(ResponseEntity.status(HttpStatus.BAD_REQUEST).body(wvpResult)); +// return result; +// } // 同时只处理一个文件 if (resultHolder.exist(key, null)) { logger.warn("已有导入任务正在执行"); @@ -162,30 +178,43 @@ public class StreamPushController { } catch (IOException e) { e.printStackTrace(); } - //传入参数 - ExcelReader excelReader = EasyExcel.read(inputStream, StreamPushExcelDto.class, - new StreamPushUploadFileHandler(streamPushService, mediaServerService.getDefaultMediaServer().getId(), (errorStreams, errorGBs)->{ - logger.info("通道导入成功,存在重复App+Stream为{}个,存在国标ID为{}个", errorStreams.size(), errorGBs.size()); - RequestMessage msg = new RequestMessage(); - msg.setKey(key); - WVPResult>> wvpResult = new WVPResult<>(); - if (errorStreams.size() == 0 && errorGBs.size() == 0) { - wvpResult.setCode(0); - wvpResult.setMsg("成功"); - }else { - wvpResult.setCode(1); - wvpResult.setMsg("导入成功。但是存在重复数据"); - Map> errorData = new HashMap<>(); - errorData.put("gbId", errorGBs); - errorData.put("stream", errorStreams); - wvpResult.setData(errorData); - } - msg.setData(wvpResult); - resultHolder.invokeAllResult(msg); - })).build(); - ReadSheet readSheet = EasyExcel.readSheet(0).build(); - excelReader.read(readSheet); - excelReader.finish(); + try { + //传入参数 + ExcelReader excelReader = EasyExcel.read(inputStream, StreamPushExcelDto.class, + new StreamPushUploadFileHandler(streamPushService, mediaServerService.getDefaultMediaServer().getId(), (errorStreams, errorGBs)->{ + logger.info("通道导入成功,存在重复App+Stream为{}个,存在国标ID为{}个", errorStreams.size(), errorGBs.size()); + RequestMessage msg = new RequestMessage(); + msg.setKey(key); + WVPResult>> wvpResult = new WVPResult<>(); + if (errorStreams.size() == 0 && errorGBs.size() == 0) { + wvpResult.setCode(0); + wvpResult.setMsg("成功"); + }else { + wvpResult.setCode(1); + wvpResult.setMsg("导入成功。但是存在重复数据"); + Map> errorData = new HashMap<>(); + errorData.put("gbId", errorGBs); + errorData.put("stream", errorStreams); + wvpResult.setData(errorData); + } + msg.setData(wvpResult); + resultHolder.invokeAllResult(msg); + })).build(); + ReadSheet readSheet = EasyExcel.readSheet(0).build(); + excelReader.read(readSheet); + excelReader.finish(); + }catch (Exception e) { + logger.warn("通道导入失败:", e); + RequestMessage msg = new RequestMessage(); + msg.setKey(key); + WVPResult wvpResult = new WVPResult<>(); + wvpResult.setCode(-1); + wvpResult.setMsg("通道导入失败: " + e.getMessage() ); + msg.setData(wvpResult); + resultHolder.invokeAllResult(msg); + } + + return result; } diff --git a/src/main/resources/all-application.yml b/src/main/resources/all-application.yml index c0b2919b..4d49661a 100644 --- a/src/main/resources/all-application.yml +++ b/src/main/resources/all-application.yml @@ -5,6 +5,11 @@ spring: + # [可选]上传文件大小限制 + servlet: + multipart: + max-file-size: 10MB + max-request-size: 100MB # REDIS数据库配置 redis: # [必须修改] Redis服务器IP, REDIS安装在本机的,使用127.0.0.1 @@ -176,4 +181,4 @@ swagger-ui: version: version: "@project.version@" description: "@project.description@" - artifact-id: "@project.artifactId@" \ No newline at end of file + artifact-id: "@project.artifactId@" diff --git a/src/main/resources/application-dev.yml b/src/main/resources/application-dev.yml index d0c039c8..1051d967 100644 --- a/src/main/resources/application-dev.yml +++ b/src/main/resources/application-dev.yml @@ -1,5 +1,5 @@ spring: - # 上传文件大小限制 + # [可选]上传文件大小限制 servlet: multipart: max-file-size: 10MB @@ -19,23 +19,12 @@ spring: # [可选] jdbc数据库配置, 项目使用sqlite作为数据库,一般不需要配置 datasource: # 使用mysql 打开23-28行注释, 删除29-36行 - # name: wvp - # url: jdbc:mysql://127.0.0.1:3306/wvp?useUnicode=true&characterEncoding=UTF8&rewriteBatchedStatements=true&allowMultiQueries=true - # username: - # password: - # type: com.alibaba.druid.pool.DruidDataSource - # driver-class-name: com.mysql.cj.jdbc.Driver - name: eiot - url: jdbc:sqlite::resource:wvp.sqlite + name: wvp + url: jdbc:mysql://127.0.0.1:3306/wvp?useUnicode=true&characterEncoding=UTF8&rewriteBatchedStatements=true&allowMultiQueries=true username: password: type: com.alibaba.druid.pool.DruidDataSource - driver-class-name: org.sqlite.JDBC - journal_mode: WAL - synchronous: NORMAL - transaction_mode: IMMEDIATE - max-active: 1 - min-idle: 1 + driver-class-name: com.mysql.cj.jdbc.Driver # [可选] WVP监听的HTTP端口, 网页和接口调用都是这个端口 server: diff --git a/src/main/resources/application-docker.yml b/src/main/resources/application-docker.yml index 56efb463..2f6992fe 100644 --- a/src/main/resources/application-docker.yml +++ b/src/main/resources/application-docker.yml @@ -19,23 +19,12 @@ spring: # [可选] jdbc数据库配置, 项目使用sqlite作为数据库,一般不需要配置 datasource: # 使用mysql 打开23-28行注释, 删除29-36行 - # name: wvp - # url: jdbc:mysql://127.0.0.1:3306/wvp?useUnicode=true&characterEncoding=UTF8&rewriteBatchedStatements=true&allowMultiQueries=true - # username: - # password: - # type: com.alibaba.druid.pool.DruidDataSource - # driver-class-name: com.mysql.cj.jdbc.Driver - name: eiot - url: jdbc:sqlite::resource:wvp.sqlite - username: - password: - type: com.alibaba.druid.pool.DruidDataSource - driver-class-name: org.sqlite.JDBC - journal_mode: WAL - synchronous: NORMAL - transaction_mode: IMMEDIATE - max-active: 1 - min-idle: 1 + name: wvp + url: jdbc:mysql://127.0.0.1:3306/wvp?useUnicode=true&characterEncoding=UTF8&rewriteBatchedStatements=true&allowMultiQueries=true + username: root + password: root + type: com.alibaba.druid.pool.DruidDataSource + driver-class-name: com.mysql.cj.jdbc.Driver # [可选] WVP监听的HTTP端口, 网页和接口调用都是这个端口 server: diff --git a/src/main/resources/wvp.sqlite b/src/main/resources/wvp.sqlite deleted file mode 100644 index 37eefca6..00000000 Binary files a/src/main/resources/wvp.sqlite and /dev/null differ diff --git a/web_src/src/components/dialog/chooseChannelForCatalog.vue b/web_src/src/components/dialog/chooseChannelForCatalog.vue index 4e4339f5..5133caa5 100644 --- a/web_src/src/components/dialog/chooseChannelForCatalog.vue +++ b/web_src/src/components/dialog/chooseChannelForCatalog.vue @@ -91,16 +91,6 @@ export default { if (typeof(callback) === 'function') { callback(res.data.data) } - // - - // if (typeof (this.$refs.tree.setCurrentKey) == "undefined") { - // this.$refs.tree.setCurrentKey(this.defaultCatalogId) - // let data = this.$refs.tree.getCurrentNode() - // if (data != null && data.id === this.defaultCatalogId) { - // this.currentCatalogChange(data, this.$refs.tree.getNode(data.id)) - // } - // } - } }) .catch(function (error) { @@ -126,18 +116,6 @@ export default { let node = this.$refs.tree.getNode(id); this.refreshCatalog(node); } - // if (nodeIds !== null) { - // let refreshNode = {} - // for (let i = 0; i < nodeIds.length; i++) { - // let node = this.$refs.tree.getNode(nodeIds[i]); - // refreshNode[node.parent.data.id] = node.parent - // } - // if (Object.values(refreshNode).length > 0) { - // for (let j = 0; j < Object.values(refreshNode).length; j++) { - // this.refreshCatalog(Object.values(refreshNode)[j]); - // } - // } - // } }, editCatalog: function (data, node){ let that = this; @@ -261,7 +239,15 @@ export default { disabled: node.level === 1, divided: true, onClick: () => { - this.removeCatalog(data.id, node) + this.$confirm('确定删除?', '提示', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning' + }).then(() => { + this.removeCatalog(data.id, node) + }).catch(() => { + + }); } }, { diff --git a/web_src/src/components/dialog/platformEdit.vue b/web_src/src/components/dialog/platformEdit.vue index 62a6957f..38a2aef7 100644 --- a/web_src/src/components/dialog/platformEdit.vue +++ b/web_src/src/components/dialog/platformEdit.vue @@ -116,6 +116,7 @@ export default { showDialog: false, isLoging: false, onSubmit_text: "立即创建", + saveUrl: "/api/platform/save", platform: { id: null, @@ -163,6 +164,7 @@ export default { var that = this; if (platform == null) { this.onSubmit_text = "立即创建"; + this.saveUrl = "/api/platform/add"; this.$axios({ method: 'get', url:`/api/platform/server_config` @@ -198,6 +200,7 @@ export default { this.platform.shareAllLiveStream = platform.shareAllLiveStream; this.platform.catalogId = platform.catalogId; this.onSubmit_text = "保存"; + this.saveUrl = "/api/platform/save"; } this.showDialog = true; this.listChangeCallback = callback; @@ -212,14 +215,13 @@ export default { this.platform.username = this.platform.deviceGBId ; }, onSubmit: function () { - console.log("onSubmit"); var that = this; that.$axios({ method: 'post', - url:`/api/platform/save`, + url: this.saveUrl, data: that.platform }).then(function (res) { - if (res.data == "success") { + if (res.data.code === 0) { that.$message({ showClose: true, message: "保存成功", @@ -229,6 +231,12 @@ export default { if (that.listChangeCallback != null) { that.listChangeCallback(); } + }else { + that.$message({ + showClose: true, + message: res.data.msg, + type: "error", + }); } }).catch(function (error) { console.log(error);