Merge remote-tracking branch 'origin/wvp-28181-2.0' into liujie-20220712
# Conflicts:
# src/main/java/com/genersoft/iot/vmp/service/IMediaService.java
# src/main/java/com/genersoft/iot/vmp/service/impl/MediaServiceImpl.java
59个文件已修改
6个文件已添加
1 文件已重命名
| | |
| | | -- MySQL dump 10.13 Distrib 8.0.29, for Linux (x86_64) |
| | | -- |
| | | -- Host: 127.0.0.1 Database: wvp3 |
| | | -- Host: 127.0.0.1 Database: wvp2 |
| | | -- ------------------------------------------------------ |
| | | -- Server version 8.0.29-0ubuntu0.22.04.2 |
| | | |
| | |
| | | /*!40101 SET @saved_cs_client = @@character_set_client */; |
| | | /*!50503 SET character_set_client = utf8mb4 */; |
| | | CREATE TABLE `device` ( |
| | | `id` int NOT NULL AUTO_INCREMENT, |
| | | `deviceId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, |
| | | `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, |
| | | `manufacturer` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, |
| | | `model` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, |
| | | `firmware` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, |
| | | `transport` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, |
| | | `streamMode` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, |
| | | `online` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, |
| | | `registerTime` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, |
| | | `keepaliveTime` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, |
| | | `ip` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, |
| | | `createTime` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, |
| | | `updateTime` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, |
| | | `port` int NOT NULL, |
| | | `expires` int NOT NULL, |
| | | `subscribeCycleForCatalog` int NOT NULL, |
| | | `hostAddress` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, |
| | | `charset` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, |
| | | `subscribeCycleForMobilePosition` int DEFAULT NULL, |
| | | `mobilePositionSubmissionInterval` int DEFAULT '5', |
| | | `subscribeCycleForAlarm` int DEFAULT NULL, |
| | | `ssrcCheck` int DEFAULT '0', |
| | | `geoCoordSys` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, |
| | | `treeType` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, |
| | | PRIMARY KEY (`id`) USING BTREE, |
| | | UNIQUE KEY `device_deviceId_uindex` (`deviceId`) USING BTREE |
| | | ) ENGINE=InnoDB AUTO_INCREMENT=32 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC; |
| | | `id` int NOT NULL AUTO_INCREMENT, |
| | | `deviceId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, |
| | | `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, |
| | | `manufacturer` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, |
| | | `model` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, |
| | | `firmware` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, |
| | | `transport` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, |
| | | `streamMode` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, |
| | | `online` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, |
| | | `registerTime` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, |
| | | `keepaliveTime` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, |
| | | `ip` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, |
| | | `createTime` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, |
| | | `updateTime` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, |
| | | `port` int NOT NULL, |
| | | `expires` int NOT NULL, |
| | | `subscribeCycleForCatalog` int NOT NULL, |
| | | `hostAddress` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, |
| | | `charset` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, |
| | | `subscribeCycleForMobilePosition` int DEFAULT NULL, |
| | | `mobilePositionSubmissionInterval` int DEFAULT '5', |
| | | `subscribeCycleForAlarm` int DEFAULT NULL, |
| | | `ssrcCheck` int DEFAULT '0', |
| | | `geoCoordSys` varchar(50) COLLATE utf8mb4_general_ci NOT NULL, |
| | | `treeType` varchar(50) COLLATE utf8mb4_general_ci NOT NULL, |
| | | PRIMARY KEY (`id`) USING BTREE, |
| | | UNIQUE KEY `device_deviceId_uindex` (`deviceId`) USING BTREE |
| | | ) ENGINE=InnoDB AUTO_INCREMENT=42 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC; |
| | | /*!40101 SET character_set_client = @saved_cs_client */; |
| | | |
| | | -- |
| | |
| | | /*!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) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, |
| | | `channelId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, |
| | | `alarmPriority` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, |
| | | `alarmMethod` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, |
| | | `alarmTime` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, |
| | | `alarmDescription` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, |
| | | `longitude` double DEFAULT NULL, |
| | | `latitude` double DEFAULT NULL, |
| | | `alarmType` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, |
| | | PRIMARY KEY (`id`) USING BTREE |
| | | `id` int NOT NULL AUTO_INCREMENT, |
| | | `deviceId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, |
| | | `channelId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, |
| | | `alarmPriority` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, |
| | | `alarmMethod` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, |
| | | `alarmTime` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, |
| | | `alarmDescription` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, |
| | | `longitude` double DEFAULT NULL, |
| | | `latitude` double DEFAULT NULL, |
| | | `alarmType` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, |
| | | `createTime` varchar(50) COLLATE utf8mb4_general_ci DEFAULT NULL, |
| | | PRIMARY KEY (`id`) USING BTREE |
| | | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC; |
| | | /*!40101 SET character_set_client = @saved_cs_client */; |
| | | |
| | |
| | | /*!40101 SET @saved_cs_client = @@character_set_client */; |
| | | /*!50503 SET character_set_client = utf8mb4 */; |
| | | CREATE TABLE `device_channel` ( |
| | | `id` int NOT NULL AUTO_INCREMENT, |
| | | `channelId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, |
| | | `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, |
| | | `manufacture` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, |
| | | `model` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, |
| | | `owner` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, |
| | | `civilCode` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, |
| | | `block` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, |
| | | `address` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, |
| | | `parentId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, |
| | | `safetyWay` int DEFAULT NULL, |
| | | `registerWay` int DEFAULT NULL, |
| | | `certNum` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, |
| | | `certifiable` int DEFAULT NULL, |
| | | `errCode` int DEFAULT NULL, |
| | | `endTime` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, |
| | | `secrecy` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, |
| | | `ipAddress` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, |
| | | `port` int DEFAULT NULL, |
| | | `password` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, |
| | | `PTZType` int DEFAULT NULL, |
| | | `status` int DEFAULT NULL, |
| | | `longitude` double DEFAULT NULL, |
| | | `latitude` double DEFAULT NULL, |
| | | `streamId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, |
| | | `deviceId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, |
| | | `parental` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, |
| | | `hasAudio` bit(1) DEFAULT NULL, |
| | | `createTime` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, |
| | | `updateTime` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, |
| | | `subCount` int DEFAULT '0', |
| | | `longitudeGcj02` double DEFAULT NULL, |
| | | `latitudeGcj02` double DEFAULT NULL, |
| | | `longitudeWgs84` double DEFAULT NULL, |
| | | `latitudeWgs84` double DEFAULT NULL, |
| | | `businessGroupId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, |
| | | PRIMARY KEY (`id`) USING BTREE, |
| | | UNIQUE KEY `device_channel_id_uindex` (`id`) USING BTREE, |
| | | UNIQUE KEY `device_channel_pk` (`channelId`,`deviceId`) USING BTREE |
| | | ) ENGINE=InnoDB AUTO_INCREMENT=19314 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC; |
| | | `id` int NOT NULL AUTO_INCREMENT, |
| | | `channelId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, |
| | | `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, |
| | | `manufacture` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, |
| | | `model` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, |
| | | `owner` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, |
| | | `civilCode` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, |
| | | `block` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, |
| | | `address` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, |
| | | `parentId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, |
| | | `safetyWay` int DEFAULT NULL, |
| | | `registerWay` int DEFAULT NULL, |
| | | `certNum` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, |
| | | `certifiable` int DEFAULT NULL, |
| | | `errCode` int DEFAULT NULL, |
| | | `endTime` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, |
| | | `secrecy` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, |
| | | `ipAddress` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, |
| | | `port` int DEFAULT NULL, |
| | | `password` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, |
| | | `PTZType` int DEFAULT NULL, |
| | | `status` int DEFAULT NULL, |
| | | `longitude` double DEFAULT NULL, |
| | | `latitude` double DEFAULT NULL, |
| | | `streamId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, |
| | | `deviceId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, |
| | | `parental` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, |
| | | `hasAudio` bit(1) DEFAULT NULL, |
| | | `createTime` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, |
| | | `updateTime` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, |
| | | `subCount` int DEFAULT '0', |
| | | `longitudeGcj02` double DEFAULT NULL, |
| | | `latitudeGcj02` double DEFAULT NULL, |
| | | `longitudeWgs84` double DEFAULT NULL, |
| | | `latitudeWgs84` double DEFAULT NULL, |
| | | `businessGroupId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, |
| | | `gpsTime` varchar(50) COLLATE utf8mb4_general_ci DEFAULT NULL, |
| | | PRIMARY KEY (`id`) USING BTREE, |
| | | UNIQUE KEY `device_channel_id_uindex` (`id`) USING BTREE, |
| | | UNIQUE KEY `device_channel_pk` (`channelId`,`deviceId`) USING BTREE |
| | | ) ENGINE=InnoDB AUTO_INCREMENT=19331 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC; |
| | | /*!40101 SET character_set_client = @saved_cs_client */; |
| | | |
| | | -- |
| | |
| | | /*!40101 SET @saved_cs_client = @@character_set_client */; |
| | | /*!50503 SET character_set_client = utf8mb4 */; |
| | | CREATE TABLE `device_mobile_position` ( |
| | | `id` int NOT NULL AUTO_INCREMENT, |
| | | `deviceId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, |
| | | `channelId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, |
| | | `deviceName` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, |
| | | `time` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci 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) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, |
| | | `geodeticSystem` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, |
| | | `cnLng` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, |
| | | `cnLat` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, |
| | | PRIMARY KEY (`id`) USING BTREE |
| | | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC; |
| | | `id` int NOT NULL AUTO_INCREMENT, |
| | | `deviceId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, |
| | | `channelId` varchar(50) COLLATE utf8mb4_general_ci DEFAULT NULL, |
| | | `deviceName` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, |
| | | `time` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci 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) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, |
| | | `longitudeGcj02` double DEFAULT NULL, |
| | | `latitudeGcj02` double DEFAULT NULL, |
| | | `longitudeWgs84` double DEFAULT NULL, |
| | | `latitudeWgs84` double DEFAULT NULL, |
| | | `createTime` varchar(50) COLLATE utf8mb4_general_ci DEFAULT NULL, |
| | | PRIMARY KEY (`id`) USING BTREE |
| | | ) ENGINE=InnoDB AUTO_INCREMENT=6751 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC; |
| | | /*!40101 SET character_set_client = @saved_cs_client */; |
| | | |
| | | -- |
| | |
| | | /*!40101 SET @saved_cs_client = @@character_set_client */; |
| | | /*!50503 SET character_set_client = utf8mb4 */; |
| | | CREATE TABLE `gb_stream` ( |
| | | `gbStreamId` int NOT NULL AUTO_INCREMENT, |
| | | `app` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, |
| | | `stream` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, |
| | | `gbId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, |
| | | `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, |
| | | `longitude` double DEFAULT NULL, |
| | | `latitude` double DEFAULT NULL, |
| | | `streamType` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, |
| | | `mediaServerId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, |
| | | `status` int DEFAULT NULL, |
| | | `createStamp` bigint DEFAULT NULL, |
| | | PRIMARY KEY (`gbStreamId`) USING BTREE, |
| | | UNIQUE KEY `app` (`app`,`stream`) USING BTREE, |
| | | UNIQUE KEY `gbId` (`gbId`) USING BTREE |
| | | ) ENGINE=InnoDB AUTO_INCREMENT=301679 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC; |
| | | `gbStreamId` int NOT NULL AUTO_INCREMENT, |
| | | `app` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, |
| | | `stream` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, |
| | | `gbId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, |
| | | `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, |
| | | `longitude` double DEFAULT NULL, |
| | | `latitude` double DEFAULT NULL, |
| | | `streamType` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, |
| | | `mediaServerId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, |
| | | `createTime` varchar(50) COLLATE utf8mb4_general_ci DEFAULT NULL, |
| | | `gpsTime` varchar(50) COLLATE utf8mb4_general_ci DEFAULT NULL, |
| | | PRIMARY KEY (`gbStreamId`) USING BTREE, |
| | | UNIQUE KEY `app` (`app`,`stream`) USING BTREE, |
| | | UNIQUE KEY `gbId` (`gbId`) USING BTREE |
| | | ) ENGINE=InnoDB AUTO_INCREMENT=301681 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC; |
| | | /*!40101 SET character_set_client = @saved_cs_client */; |
| | | |
| | | -- |
| | |
| | | /*!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) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, |
| | | `type` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, |
| | | `uri` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, |
| | | `address` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, |
| | | `result` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, |
| | | `timing` bigint NOT NULL, |
| | | `username` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, |
| | | `createTime` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, |
| | | PRIMARY KEY (`id`) USING BTREE |
| | | ) ENGINE=InnoDB AUTO_INCREMENT=21611 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC; |
| | | `id` int NOT NULL AUTO_INCREMENT, |
| | | `name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, |
| | | `type` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, |
| | | `uri` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, |
| | | `address` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, |
| | | `result` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, |
| | | `timing` bigint NOT NULL, |
| | | `username` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, |
| | | `createTime` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, |
| | | PRIMARY KEY (`id`) USING BTREE |
| | | ) ENGINE=InnoDB AUTO_INCREMENT=34997 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC; |
| | | /*!40101 SET character_set_client = @saved_cs_client */; |
| | | |
| | | -- |
| | |
| | | /*!40101 SET @saved_cs_client = @@character_set_client */; |
| | | /*!50503 SET character_set_client = utf8mb4 */; |
| | | CREATE TABLE `media_server` ( |
| | | `id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, |
| | | `ip` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, |
| | | `hookIp` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, |
| | | `sdpIp` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, |
| | | `streamIp` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci 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) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, |
| | | `streamNoneReaderDelayMS` int NOT NULL, |
| | | `rtpEnable` int NOT NULL, |
| | | `rtpPortRange` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, |
| | | `sendRtpPortRange` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, |
| | | `recordAssistPort` int NOT NULL, |
| | | `defaultServer` int NOT NULL, |
| | | `createTime` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, |
| | | `updateTime` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, |
| | | `hookAliveInterval` int NOT NULL, |
| | | PRIMARY KEY (`id`) USING BTREE, |
| | | UNIQUE KEY `media_server_i` (`ip`,`httpPort`) USING BTREE |
| | | `id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, |
| | | `ip` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, |
| | | `hookIp` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, |
| | | `sdpIp` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, |
| | | `streamIp` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci 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) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, |
| | | `streamNoneReaderDelayMS` int NOT NULL, |
| | | `rtpEnable` int NOT NULL, |
| | | `rtpPortRange` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, |
| | | `sendRtpPortRange` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, |
| | | `recordAssistPort` int NOT NULL, |
| | | `defaultServer` int NOT NULL, |
| | | `createTime` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, |
| | | `updateTime` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, |
| | | `hookAliveInterval` int NOT NULL, |
| | | PRIMARY KEY (`id`) USING BTREE, |
| | | UNIQUE KEY `media_server_i` (`ip`,`httpPort`) USING BTREE |
| | | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC; |
| | | /*!40101 SET character_set_client = @saved_cs_client */; |
| | | |
| | |
| | | /*!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) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, |
| | | `serverGBId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, |
| | | `serverGBDomain` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, |
| | | `serverIP` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, |
| | | `serverPort` int DEFAULT NULL, |
| | | `deviceGBId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, |
| | | `deviceIp` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, |
| | | `devicePort` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, |
| | | `username` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, |
| | | `password` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, |
| | | `expires` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, |
| | | `keepTimeout` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, |
| | | `transport` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, |
| | | `characterSet` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, |
| | | `catalogId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, |
| | | `ptz` int DEFAULT NULL, |
| | | `rtcp` int DEFAULT NULL, |
| | | `status` bit(1) DEFAULT NULL, |
| | | `shareAllLiveStream` int DEFAULT NULL, |
| | | `startOfflinePush` int DEFAULT '0', |
| | | `administrativeDivision` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, |
| | | `catalogGroup` int DEFAULT '1', |
| | | PRIMARY KEY (`id`) USING BTREE, |
| | | UNIQUE KEY `parent_platform_id_uindex` (`id`) USING BTREE, |
| | | UNIQUE KEY `parent_platform_pk` (`serverGBId`) USING BTREE |
| | | ) ENGINE=InnoDB AUTO_INCREMENT=31 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC; |
| | | `id` int NOT NULL AUTO_INCREMENT, |
| | | `enable` int DEFAULT NULL, |
| | | `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, |
| | | `serverGBId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, |
| | | `serverGBDomain` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, |
| | | `serverIP` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, |
| | | `serverPort` int DEFAULT NULL, |
| | | `deviceGBId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, |
| | | `deviceIp` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, |
| | | `devicePort` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, |
| | | `username` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, |
| | | `password` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, |
| | | `expires` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, |
| | | `keepTimeout` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, |
| | | `transport` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, |
| | | `characterSet` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, |
| | | `catalogId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, |
| | | `ptz` int DEFAULT NULL, |
| | | `rtcp` int DEFAULT NULL, |
| | | `status` bit(1) DEFAULT NULL, |
| | | `shareAllLiveStream` int DEFAULT NULL, |
| | | `startOfflinePush` int DEFAULT '0', |
| | | `administrativeDivision` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, |
| | | `catalogGroup` int DEFAULT '1', |
| | | `createTime` varchar(50) COLLATE utf8mb4_general_ci DEFAULT NULL, |
| | | `updateTime` varchar(50) COLLATE utf8mb4_general_ci DEFAULT NULL, |
| | | PRIMARY KEY (`id`) USING BTREE, |
| | | UNIQUE KEY `parent_platform_id_uindex` (`id`) USING BTREE, |
| | | UNIQUE KEY `parent_platform_pk` (`serverGBId`) USING BTREE |
| | | ) ENGINE=InnoDB AUTO_INCREMENT=33 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC; |
| | | /*!40101 SET character_set_client = @saved_cs_client */; |
| | | |
| | | -- |
| | |
| | | /*!40101 SET @saved_cs_client = @@character_set_client */; |
| | | /*!50503 SET character_set_client = utf8mb4 */; |
| | | CREATE TABLE `platform_catalog` ( |
| | | `id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, |
| | | `platformId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, |
| | | `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, |
| | | `parentId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, |
| | | PRIMARY KEY (`id`) USING BTREE |
| | | `id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, |
| | | `platformId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, |
| | | `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, |
| | | `parentId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, |
| | | PRIMARY KEY (`id`) USING BTREE |
| | | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC; |
| | | /*!40101 SET character_set_client = @saved_cs_client */; |
| | | |
| | |
| | | /*!40101 SET @saved_cs_client = @@character_set_client */; |
| | | /*!50503 SET character_set_client = utf8mb4 */; |
| | | CREATE TABLE `platform_gb_channel` ( |
| | | `id` int NOT NULL AUTO_INCREMENT, |
| | | `platformId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, |
| | | `catalogId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, |
| | | `deviceChannelId` int NOT NULL, |
| | | PRIMARY KEY (`id`) USING BTREE |
| | | `id` int NOT NULL AUTO_INCREMENT, |
| | | `platformId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, |
| | | `catalogId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, |
| | | `deviceChannelId` int NOT NULL, |
| | | PRIMARY KEY (`id`) USING BTREE |
| | | ) ENGINE=InnoDB AUTO_INCREMENT=4889 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC; |
| | | /*!40101 SET character_set_client = @saved_cs_client */; |
| | | |
| | |
| | | /*!40101 SET @saved_cs_client = @@character_set_client */; |
| | | /*!50503 SET character_set_client = utf8mb4 */; |
| | | CREATE TABLE `platform_gb_stream` ( |
| | | `platformId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, |
| | | `catalogId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, |
| | | `gbStreamId` int NOT NULL, |
| | | `id` int NOT NULL AUTO_INCREMENT, |
| | | PRIMARY KEY (`id`) USING BTREE, |
| | | UNIQUE KEY `platform_gb_stream_pk` (`platformId`,`catalogId`,`gbStreamId`) USING BTREE |
| | | `platformId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, |
| | | `catalogId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, |
| | | `gbStreamId` int NOT NULL, |
| | | `id` int NOT NULL AUTO_INCREMENT, |
| | | PRIMARY KEY (`id`) USING BTREE, |
| | | UNIQUE KEY `platform_gb_stream_pk` (`platformId`,`catalogId`,`gbStreamId`) USING BTREE |
| | | ) ENGINE=InnoDB AUTO_INCREMENT=302077 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC; |
| | | /*!40101 SET character_set_client = @saved_cs_client */; |
| | | |
| | |
| | | /*!40101 SET @saved_cs_client = @@character_set_client */; |
| | | /*!50503 SET character_set_client = utf8mb4 */; |
| | | CREATE TABLE `stream_proxy` ( |
| | | `id` int NOT NULL AUTO_INCREMENT, |
| | | `type` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, |
| | | `app` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, |
| | | `stream` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, |
| | | `url` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, |
| | | `src_url` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, |
| | | `dst_url` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, |
| | | `timeout_ms` int DEFAULT NULL, |
| | | `ffmpeg_cmd_key` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, |
| | | `rtp_type` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, |
| | | `mediaServerId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, |
| | | `enable_hls` bit(1) DEFAULT NULL, |
| | | `enable_mp4` bit(1) DEFAULT NULL, |
| | | `enable` bit(1) NOT NULL, |
| | | `status` bit(1) NOT NULL, |
| | | `enable_remove_none_reader` bit(1) NOT NULL, |
| | | `createTime` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, |
| | | `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, |
| | | PRIMARY KEY (`id`) USING BTREE, |
| | | UNIQUE KEY `stream_proxy_pk` (`app`,`stream`) USING BTREE |
| | | ) ENGINE=InnoDB AUTO_INCREMENT=61 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC; |
| | | `id` int NOT NULL AUTO_INCREMENT, |
| | | `type` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, |
| | | `app` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, |
| | | `stream` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, |
| | | `url` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, |
| | | `src_url` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, |
| | | `dst_url` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, |
| | | `timeout_ms` int DEFAULT NULL, |
| | | `ffmpeg_cmd_key` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, |
| | | `rtp_type` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, |
| | | `mediaServerId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, |
| | | `enable_hls` bit(1) DEFAULT NULL, |
| | | `enable_mp4` bit(1) DEFAULT NULL, |
| | | `enable` bit(1) NOT NULL, |
| | | `status` bit(1) NOT NULL, |
| | | `enable_remove_none_reader` bit(1) NOT NULL, |
| | | `createTime` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, |
| | | `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, |
| | | `updateTime` varchar(50) COLLATE utf8mb4_general_ci DEFAULT NULL, |
| | | PRIMARY KEY (`id`) USING BTREE, |
| | | UNIQUE KEY `stream_proxy_pk` (`app`,`stream`) USING BTREE |
| | | ) ENGINE=InnoDB AUTO_INCREMENT=66 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC; |
| | | /*!40101 SET character_set_client = @saved_cs_client */; |
| | | |
| | | -- |
| | |
| | | /*!40101 SET @saved_cs_client = @@character_set_client */; |
| | | /*!50503 SET character_set_client = utf8mb4 */; |
| | | CREATE TABLE `stream_push` ( |
| | | `id` int NOT NULL AUTO_INCREMENT, |
| | | `app` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, |
| | | `stream` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, |
| | | `totalReaderCount` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, |
| | | `originType` int DEFAULT NULL, |
| | | `originTypeStr` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, |
| | | `createStamp` bigint DEFAULT NULL, |
| | | `aliveSecond` int DEFAULT NULL, |
| | | `mediaServerId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, |
| | | `serverId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, |
| | | PRIMARY KEY (`id`) USING BTREE, |
| | | UNIQUE KEY `stream_push_pk` (`app`,`stream`) USING BTREE |
| | | ) ENGINE=InnoDB AUTO_INCREMENT=305291 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC; |
| | | `id` int NOT NULL AUTO_INCREMENT, |
| | | `app` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, |
| | | `stream` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, |
| | | `totalReaderCount` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, |
| | | `originType` int DEFAULT NULL, |
| | | `originTypeStr` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, |
| | | `createTime` varchar(50) COLLATE utf8mb4_general_ci DEFAULT NULL, |
| | | `aliveSecond` int DEFAULT NULL, |
| | | `mediaServerId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, |
| | | `serverId` varchar(50) COLLATE utf8mb4_general_ci NOT NULL, |
| | | `pushTime` varchar(50) COLLATE utf8mb4_general_ci DEFAULT NULL, |
| | | `updateTime` varchar(50) COLLATE utf8mb4_general_ci DEFAULT NULL, |
| | | `status` int DEFAULT NULL, |
| | | PRIMARY KEY (`id`) USING BTREE, |
| | | UNIQUE KEY `stream_push_pk` (`app`,`stream`) USING BTREE |
| | | ) ENGINE=InnoDB AUTO_INCREMENT=305315 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC; |
| | | /*!40101 SET character_set_client = @saved_cs_client */; |
| | | |
| | | -- |
| | |
| | | /*!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) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, |
| | | `password` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, |
| | | `roleId` int NOT NULL, |
| | | `createTime` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, |
| | | `updateTime` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, |
| | | PRIMARY KEY (`id`) USING BTREE, |
| | | UNIQUE KEY `user_username_uindex` (`username`) USING BTREE |
| | | `id` int NOT NULL AUTO_INCREMENT, |
| | | `username` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, |
| | | `password` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, |
| | | `roleId` int NOT NULL, |
| | | `createTime` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, |
| | | `updateTime` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, |
| | | `pushKey` varchar(50) COLLATE utf8mb4_general_ci DEFAULT NULL, |
| | | PRIMARY KEY (`id`) USING BTREE, |
| | | UNIQUE KEY `user_username_uindex` (`username`) USING BTREE |
| | | ) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC; |
| | | /*!40101 SET character_set_client = @saved_cs_client */; |
| | | |
| | |
| | | |
| | | 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'); |
| | | INSERT INTO `user` VALUES (1,'admin','21232f297a57a5a743894a0e4a801fc3',1,'2021 - 04 - 13 14:14:57','2021 - 04 - 13 14:14:57','453df297a57a5a7438934sda801fc3'); |
| | | /*!40000 ALTER TABLE `user` ENABLE KEYS */; |
| | | UNLOCK TABLES; |
| | | |
| | |
| | | /*!40101 SET @saved_cs_client = @@character_set_client */; |
| | | /*!50503 SET character_set_client = utf8mb4 */; |
| | | CREATE TABLE `user_role` ( |
| | | `id` int NOT NULL AUTO_INCREMENT, |
| | | `name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, |
| | | `authority` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, |
| | | `createTime` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, |
| | | `updateTime` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, |
| | | PRIMARY KEY (`id`) USING BTREE |
| | | `id` int NOT NULL AUTO_INCREMENT, |
| | | `name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, |
| | | `authority` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, |
| | | `createTime` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, |
| | | `updateTime` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, |
| | | PRIMARY KEY (`id`) USING BTREE |
| | | ) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC; |
| | | /*!40101 SET character_set_client = @saved_cs_client */; |
| | | |
| | |
| | | /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; |
| | | /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; |
| | | |
| | | -- Dump completed on 2022-06-26 17:33:30 |
| | | -- Dump completed on 2022-07-11 17:32:51 |
| | |
| | | |
| | | alter table stream_push |
| | | add serverId varchar(50) not null; |
| | | |
| | | alter table device |
| | | add geoCoordSys varchar(50) not null; |
| | | alter table device |
| | | add treeType varchar(50) not null; |
| | | update device set device.geoCoordSys='WGS84'; |
| | | update device set device.treeType='CivilCode'; |
| | | |
| | | alter table device_channel |
| | | add longitudeGcj02 double default null; |
| | | alter table device_channel |
| | |
| | | add latitudeWgs84 double default null; |
| | | alter table device_channel |
| | | add businessGroupId varchar(50) default null; |
| | | alter table device_channel |
| | | add gpsTime varchar(50) default null; |
| | | |
| | | |
| | | alter table device_mobile_position |
| | | change cnLng longitudeGcj02 double default null; |
| | | alter table device_mobile_position |
| | | change cnLat latitudeGcj02 double default null; |
| | | alter table device_mobile_position |
| | | add longitudeWgs84 double default null; |
| | | alter table device_mobile_position |
| | | add latitudeWgs84 double default null; |
| | | alter table device_mobile_position |
| | | drop geodeticSystem; |
| | | alter table device_mobile_position |
| | | add createTime varchar(50) default null; |
| | | |
| | | alter table device_alarm |
| | | add createTime varchar(50) default null; |
| | | |
| | | alter table gb_stream |
| | | change createStamp createTime varchar(50) default null; |
| | | |
| | | alter table parent_platform |
| | | add createTime varchar(50) default null; |
| | | alter table parent_platform |
| | | add updateTime varchar(50) default null; |
| | | |
| | | alter table stream_proxy |
| | | add updateTime varchar(50) default null; |
| | | |
| | | alter table stream_push |
| | | add pushTime varchar(50) default null; |
| | | alter table stream_push |
| | | add status int DEFAULT NULL; |
| | | alter table stream_push |
| | | add updateTime varchar(50) default null; |
| | | alter table stream_push |
| | | change createStamp createTime varchar(50) default null; |
| | | |
| | | alter table gb_stream |
| | | drop column status; |
| | | |
| | | alter table user |
| | | add pushKey varchar(50) default null; |
| | | |
| | |
| | | private String deviceID; |
| | | private String channelId; |
| | | private String flv; |
| | | |
| | | private String ip; |
| | | |
| | | private String https_flv; |
| | | private String ws_flv; |
| | | private String wss_flv; |
| | |
| | | public void setProgress(double progress) { |
| | | this.progress = progress; |
| | | } |
| | | |
| | | public String getIp() { |
| | | return ip; |
| | | } |
| | | |
| | | public void setIp(String ip) { |
| | | this.ip = ip; |
| | | } |
| | | } |
| | |
| | |
|
| | | public static final String MEDIA_TRANSACTION_USED_PREFIX = "VMP_MEDIA_TRANSACTION_";
|
| | |
|
| | | public static final String MEDIA_STREAM_AUTHORITY = "MEDIA_STREAM_AUTHORITY_";
|
| | |
|
| | | public static final String SIP_CSEQ_PREFIX = "VMP_SIP_CSEQ_";
|
| | |
|
| | | public static final String SIP_SN_PREFIX = "VMP_SIP_SN_";
|
| | |
| | | public static final String SYSTEM_INFO_NET_PREFIX = "VMP_SYSTEM_INFO_NET_";
|
| | |
|
| | |
|
| | |
|
| | |
|
| | | //************************** redis 消息*********************************
|
| | |
|
| | | // 流变化的通知
|
| | |
| | | // 接收推流设备的GPS变化通知
|
| | | public static final String VM_MSG_GPS = "VM_MSG_GPS";
|
| | |
|
| | | // 接收推流设备的GPS变化通知
|
| | | public static final String VM_MSG_PUSH_STREAM_STATUS_CHANGE = "VM_MSG_PUSH_STREAM_STATUS_CHANGE";
|
| | |
|
| | | // redis 消息通知设备推流到平台
|
| | | public static final String VM_MSG_STREAM_PUSH_REQUESTED = "VM_MSG_STREAM_PUSH_REQUESTED";
|
| | |
|
| | | // redis 消息请求所有的在线通道
|
| | | public static final String VM_MSG_GET_ALL_ONLINE_REQUESTED = "VM_MSG_GET_ALL_ONLINE_REQUESTED";
|
| | |
|
| | | // 移动位置订阅通知
|
| | | public static final String VM_MSG_SUBSCRIBE_MOBILE_POSITION = "mobileposition";
|
| | |
|
| | |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.context.annotation.Bean; |
| | | import org.springframework.scheduling.annotation.Scheduled; |
| | | import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | |
| | | |
| | | public void stop(String key) { |
| | | if (futureMap.get(key) != null && !futureMap.get(key).isCancelled()) { |
| | | // Runnable runnable = runnableMap.get(key); |
| | | // if (runnable instanceof ISubscribeTask) { |
| | | // ISubscribeTask subscribeTask = (ISubscribeTask) runnable; |
| | | // subscribeTask.stop(); |
| | | // } |
| | | futureMap.get(key).cancel(false); |
| | | futureMap.remove(key); |
| | | runnableMap.remove(key); |
| | | } |
| | | } |
| | | |
| | |
| | | public Runnable get(String key) { |
| | | return runnableMap.get(key); |
| | | } |
| | | |
| | | /** |
| | | * 每五分钟检查失效的任务,并移除 |
| | | */ |
| | | @Scheduled(cron="0 0/5 * * * ?") |
| | | public void execute(){ |
| | | if (futureMap.size() > 0) { |
| | | for (String key : futureMap.keySet()) { |
| | | if (futureMap.get(key).isDone()) { |
| | | futureMap.remove(key); |
| | | runnableMap.remove(key); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | */
|
| | | private String alarmType;
|
| | |
|
| | | private String createTime;
|
| | |
|
| | |
|
| | | public String getId() {
|
| | | return id;
|
| | |
| | | public void setChannelId(String channelId) {
|
| | | this.channelId = channelId;
|
| | | }
|
| | |
|
| | | public String getCreateTime() {
|
| | | return createTime;
|
| | | }
|
| | |
|
| | | public void setCreateTime(String createTime) {
|
| | | this.createTime = createTime;
|
| | | }
|
| | | }
|
| | |
| | | */ |
| | | private String businessGroupId; |
| | | |
| | | /** |
| | | * GPS的更新时间 |
| | | */ |
| | | private String gpsTime; |
| | | |
| | | public int getId() { |
| | | return id; |
| | | } |
| | |
| | | public void setBusinessGroupId(String businessGroupId) { |
| | | this.businessGroupId = businessGroupId; |
| | | } |
| | | |
| | | public String getGpsTime() { |
| | | return gpsTime; |
| | | } |
| | | |
| | | public void setGpsTime(String gpsTime) { |
| | | this.gpsTime = gpsTime; |
| | | } |
| | | } |
| | |
| | | private double latitude; |
| | | private String streamType; |
| | | private boolean status; |
| | | /** |
| | | * GMT unix系统时间戳,单位秒 |
| | | */ |
| | | public Long createStamp; |
| | | |
| | | public String createTime; |
| | | |
| | | @Override |
| | | public Integer getGbStreamId() { |
| | |
| | | this.mediaServerId = mediaServerId; |
| | | } |
| | | |
| | | |
| | | public Long getCreateStamp() { |
| | | return createStamp; |
| | | public String getCreateTime() { |
| | | return createTime; |
| | | } |
| | | |
| | | public void setCreateStamp(Long createStamp) { |
| | | this.createStamp = createStamp; |
| | | public void setCreateTime(String createTime) { |
| | | this.createTime = createTime; |
| | | } |
| | | } |
| | |
| | | private String reportSource; |
| | | |
| | | /** |
| | | * 国内地理坐标系(GCJ-02 / BD-09) |
| | | */ |
| | | private String GeodeticSystem; |
| | | |
| | | /** |
| | | * 国内坐标系:经度坐标 |
| | | */ |
| | | private String cnLng; |
| | | private double longitudeGcj02; |
| | | |
| | | /** |
| | | * 国内坐标系:纬度坐标 |
| | | */ |
| | | private String cnLat; |
| | | private double latitudeGcj02; |
| | | |
| | | /** |
| | | * 国内坐标系:经度坐标 |
| | | */ |
| | | private double longitudeWgs84; |
| | | |
| | | /** |
| | | * 国内坐标系:纬度坐标 |
| | | */ |
| | | private double latitudeWgs84; |
| | | |
| | | /** |
| | | * 创建时间 |
| | | */ |
| | | private String createTime; |
| | | |
| | | |
| | | public String getDeviceId() { |
| | |
| | | this.reportSource = reportSource; |
| | | } |
| | | |
| | | public String getGeodeticSystem() { |
| | | return GeodeticSystem; |
| | | } |
| | | |
| | | public void setGeodeticSystem(String geodeticSystem) { |
| | | GeodeticSystem = geodeticSystem; |
| | | } |
| | | |
| | | public String getCnLng() { |
| | | return cnLng; |
| | | } |
| | | |
| | | public void setCnLng(String cnLng) { |
| | | this.cnLng = cnLng; |
| | | } |
| | | |
| | | public String getCnLat() { |
| | | return cnLat; |
| | | } |
| | | |
| | | public void setCnLat(String cnLat) { |
| | | this.cnLat = cnLat; |
| | | } |
| | | |
| | | public String getChannelId() { |
| | | return channelId; |
| | | } |
| | |
| | | public void setChannelId(String channelId) { |
| | | this.channelId = channelId; |
| | | } |
| | | |
| | | public double getLongitudeGcj02() { |
| | | return longitudeGcj02; |
| | | } |
| | | |
| | | public void setLongitudeGcj02(double longitudeGcj02) { |
| | | this.longitudeGcj02 = longitudeGcj02; |
| | | } |
| | | |
| | | public double getLatitudeGcj02() { |
| | | return latitudeGcj02; |
| | | } |
| | | |
| | | public void setLatitudeGcj02(double latitudeGcj02) { |
| | | this.latitudeGcj02 = latitudeGcj02; |
| | | } |
| | | |
| | | public double getLongitudeWgs84() { |
| | | return longitudeWgs84; |
| | | } |
| | | |
| | | public void setLongitudeWgs84(double longitudeWgs84) { |
| | | this.longitudeWgs84 = longitudeWgs84; |
| | | } |
| | | |
| | | public double getLatitudeWgs84() { |
| | | return latitudeWgs84; |
| | | } |
| | | |
| | | public void setLatitudeWgs84(double latitudeWgs84) { |
| | | this.latitudeWgs84 = latitudeWgs84; |
| | | } |
| | | |
| | | public String getCreateTime() { |
| | | return createTime; |
| | | } |
| | | |
| | | public void setCreateTime(String createTime) { |
| | | this.createTime = createTime; |
| | | } |
| | | } |
| | |
| | | */ |
| | | private String administrativeDivision; |
| | | |
| | | /** |
| | | * 更新时间 |
| | | */ |
| | | private String updateTime; |
| | | |
| | | /** |
| | | * 创建时间 |
| | | */ |
| | | private String createTime; |
| | | |
| | | public Integer getId() { |
| | | return id; |
| | | } |
| | |
| | | public void setAdministrativeDivision(String administrativeDivision) { |
| | | this.administrativeDivision = administrativeDivision; |
| | | } |
| | | |
| | | public String getUpdateTime() { |
| | | return updateTime; |
| | | } |
| | | |
| | | public void setUpdateTime(String updateTime) { |
| | | this.updateTime = updateTime; |
| | | } |
| | | |
| | | public String getCreateTime() { |
| | | return createTime; |
| | | } |
| | | |
| | | public void setCreateTime(String createTime) { |
| | | this.createTime = createTime; |
| | | } |
| | | } |
| File was renamed from src/main/java/com/genersoft/iot/vmp/domain/req/PresetQuerySipReq.java |
| | |
| | | package com.genersoft.iot.vmp.domain.req; |
| | | package com.genersoft.iot.vmp.gb28181.bean; |
| | | |
| | | |
| | | /** |
| | |
| | | Element rootElement = getRootElement(evt); |
| | | |
| | | MobilePosition mobilePosition = new MobilePosition(); |
| | | mobilePosition.setCreateTime(DateUtil.getNow()); |
| | | Element deviceIdElement = rootElement.element("DeviceID"); |
| | | String channelId = deviceIdElement.getTextTrim().toString(); |
| | | Device device = redisCatchStorage.getDevice(deviceId); |
| | |
| | | mobilePosition.getLongitude(), mobilePosition.getLatitude()); |
| | | mobilePosition.setReportSource("Mobile Position"); |
| | | // 默认来源坐标系为WGS-84处理 |
| | | Double[] gcj02Point = Coordtransform.WGS84ToGCJ02(mobilePosition.getLongitude(), mobilePosition.getLatitude()); |
| | | logger.info("GCJ02坐标:" + gcj02Point[0] + ", " + gcj02Point[1]); |
| | | mobilePosition.setGeodeticSystem("GCJ-02"); |
| | | mobilePosition.setCnLng(gcj02Point[0] + ""); |
| | | mobilePosition.setCnLat(gcj02Point[1] + ""); |
| | | if (!userSetting.getSavePositionHistory()) { |
| | | storager.clearMobilePositionsByDeviceId(deviceId); |
| | | if ("WGS84".equals(device.getGeoCoordSys())) { |
| | | mobilePosition.setLongitudeWgs84(mobilePosition.getLongitude()); |
| | | mobilePosition.setLatitudeWgs84(mobilePosition.getLatitude()); |
| | | Double[] position = Coordtransform.WGS84ToGCJ02(mobilePosition.getLongitude(), mobilePosition.getLatitude()); |
| | | mobilePosition.setLongitudeGcj02(position[0]); |
| | | mobilePosition.setLatitudeGcj02(position[1]); |
| | | }else if ("GCJ02".equals(device.getGeoCoordSys())) { |
| | | mobilePosition.setLongitudeGcj02(mobilePosition.getLongitude()); |
| | | mobilePosition.setLatitudeGcj02(mobilePosition.getLatitude()); |
| | | Double[] position = Coordtransform.GCJ02ToWGS84(mobilePosition.getLongitude(), mobilePosition.getLatitude()); |
| | | mobilePosition.setLongitudeWgs84(position[0]); |
| | | mobilePosition.setLatitudeWgs84(position[1]); |
| | | }else { |
| | | mobilePosition.setLongitudeGcj02(0.00); |
| | | mobilePosition.setLatitudeGcj02(0.00); |
| | | mobilePosition.setLongitudeWgs84(0.00); |
| | | mobilePosition.setLatitudeWgs84(0.00); |
| | | } |
| | | storager.insertMobilePosition(mobilePosition); |
| | | storager.updateChannelPotion(deviceId, channelId, mobilePosition.getLongitude(), mobilePosition.getLatitude() ); |
| | | if (userSetting.getSavePositionHistory()) { |
| | | storager.insertMobilePosition(mobilePosition); |
| | | } |
| | | |
| | | // 更新device channel 的经纬度 |
| | | DeviceChannel deviceChannel = new DeviceChannel(); |
| | | deviceChannel.setDeviceId(device.getDeviceId()); |
| | | deviceChannel.setChannelId(channelId); |
| | | deviceChannel.setLongitude(mobilePosition.getLongitude()); |
| | | deviceChannel.setLatitude(mobilePosition.getLatitude()); |
| | | deviceChannel.setLongitudeWgs84(mobilePosition.getLongitudeWgs84()); |
| | | deviceChannel.setLatitudeWgs84(mobilePosition.getLatitudeWgs84()); |
| | | deviceChannel.setLongitudeGcj02(mobilePosition.getLongitudeGcj02()); |
| | | deviceChannel.setLatitudeGcj02(mobilePosition.getLatitudeGcj02()); |
| | | deviceChannel.setGpsTime(mobilePosition.getTime()); |
| | | storager.updateChannelPosition(deviceChannel); |
| | | // 发送redis消息。 通知位置信息的变化 |
| | | JSONObject jsonObject = new JSONObject(); |
| | | jsonObject.put("time", time); |
| | |
| | | return; |
| | | } |
| | | try { |
| | | FromHeader fromHeader = (FromHeader) evt.getRequest().getHeader(FromHeader.NAME); |
| | | String deviceId = SipUtils.getUserIdFromFromHeader(fromHeader); |
| | | |
| | | Element rootElement = getRootElement(evt); |
| | | Element deviceIdElement = rootElement.element("DeviceID"); |
| | | String deviceId = deviceIdElement.getText().toString(); |
| | | String channelId = deviceIdElement.getText().toString(); |
| | | |
| | | Device device = redisCatchStorage.getDevice(deviceId); |
| | | if (device == null) { |
| | |
| | | logger.info("[收到Notify-Alarm]:{}/{}", device.getDeviceId(), deviceAlarm.getChannelId()); |
| | | if ("4".equals(deviceAlarm.getAlarmMethod())) { |
| | | MobilePosition mobilePosition = new MobilePosition(); |
| | | mobilePosition.setCreateTime(DateUtil.getNow()); |
| | | mobilePosition.setDeviceId(deviceAlarm.getDeviceId()); |
| | | mobilePosition.setTime(deviceAlarm.getAlarmTime()); |
| | | mobilePosition.setLongitude(deviceAlarm.getLongitude()); |
| | | mobilePosition.setLatitude(deviceAlarm.getLatitude()); |
| | | mobilePosition.setReportSource("GPS Alarm"); |
| | | // 默认来源坐标系为WGS-84处理 |
| | | Double[] gcj02Point = Coordtransform.WGS84ToGCJ02(mobilePosition.getLongitude(), mobilePosition.getLatitude()); |
| | | logger.info("GCJ02坐标:" + gcj02Point[0] + ", " + gcj02Point[1]); |
| | | mobilePosition.setGeodeticSystem("GCJ-02"); |
| | | mobilePosition.setCnLng(gcj02Point[0] + ""); |
| | | mobilePosition.setCnLat(gcj02Point[1] + ""); |
| | | if (!userSetting.getSavePositionHistory()) { |
| | | storager.clearMobilePositionsByDeviceId(deviceId); |
| | | if ("WGS84".equals(device.getGeoCoordSys())) { |
| | | mobilePosition.setLongitudeWgs84(mobilePosition.getLongitude()); |
| | | mobilePosition.setLatitudeWgs84(mobilePosition.getLatitude()); |
| | | Double[] position = Coordtransform.WGS84ToGCJ02(mobilePosition.getLongitude(), mobilePosition.getLatitude()); |
| | | mobilePosition.setLongitudeGcj02(position[0]); |
| | | mobilePosition.setLatitudeGcj02(position[1]); |
| | | }else if ("GCJ02".equals(device.getGeoCoordSys())) { |
| | | mobilePosition.setLongitudeGcj02(mobilePosition.getLongitude()); |
| | | mobilePosition.setLatitudeGcj02(mobilePosition.getLatitude()); |
| | | Double[] position = Coordtransform.GCJ02ToWGS84(mobilePosition.getLongitude(), mobilePosition.getLatitude()); |
| | | mobilePosition.setLongitudeWgs84(position[0]); |
| | | mobilePosition.setLatitudeWgs84(position[1]); |
| | | }else { |
| | | mobilePosition.setLongitudeGcj02(0.00); |
| | | mobilePosition.setLatitudeGcj02(0.00); |
| | | mobilePosition.setLongitudeWgs84(0.00); |
| | | mobilePosition.setLatitudeWgs84(0.00); |
| | | } |
| | | storager.insertMobilePosition(mobilePosition); |
| | | if (userSetting.getSavePositionHistory()) { |
| | | storager.insertMobilePosition(mobilePosition); |
| | | } |
| | | // 更新device channel 的经纬度 |
| | | DeviceChannel deviceChannel = new DeviceChannel(); |
| | | deviceChannel.setDeviceId(device.getDeviceId()); |
| | | deviceChannel.setChannelId(channelId); |
| | | deviceChannel.setLongitude(mobilePosition.getLongitude()); |
| | | deviceChannel.setLatitude(mobilePosition.getLatitude()); |
| | | deviceChannel.setLongitudeWgs84(mobilePosition.getLongitudeWgs84()); |
| | | deviceChannel.setLatitudeWgs84(mobilePosition.getLatitudeWgs84()); |
| | | deviceChannel.setLongitudeGcj02(mobilePosition.getLongitudeGcj02()); |
| | | deviceChannel.setLatitudeGcj02(mobilePosition.getLatitudeGcj02()); |
| | | deviceChannel.setGpsTime(mobilePosition.getTime()); |
| | | storager.updateChannelPosition(deviceChannel); |
| | | } |
| | | // TODO: 需要实现存储报警信息、报警分类 |
| | | |
| | |
| | | Element deviceIdElement = rootElement.element("DeviceID"); |
| | | String channelId = deviceIdElement.getText().toString(); |
| | | |
| | | |
| | | DeviceAlarm deviceAlarm = new DeviceAlarm(); |
| | | deviceAlarm.setCreateTime(DateUtil.getNow()); |
| | | deviceAlarm.setDeviceId(device.getDeviceId()); |
| | | deviceAlarm.setChannelId(channelId); |
| | | deviceAlarm.setAlarmPriority(getText(rootElement, "AlarmPriority")); |
| | |
| | | if (!StringUtils.isEmpty(deviceAlarm.getAlarmMethod())) { |
| | | if ( deviceAlarm.getAlarmMethod().contains(DeviceAlarmMethod.GPS.getVal() + "")) { |
| | | MobilePosition mobilePosition = new MobilePosition(); |
| | | mobilePosition.setCreateTime(DateUtil.getNow()); |
| | | mobilePosition.setDeviceId(deviceAlarm.getDeviceId()); |
| | | mobilePosition.setTime(deviceAlarm.getAlarmTime()); |
| | | mobilePosition.setLongitude(deviceAlarm.getLongitude()); |
| | | mobilePosition.setLatitude(deviceAlarm.getLatitude()); |
| | | mobilePosition.setReportSource("GPS Alarm"); |
| | | // 默认来源坐标系为WGS-84处理 |
| | | Double[] gcj02Point = Coordtransform.WGS84ToGCJ02(mobilePosition.getLongitude(), mobilePosition.getLatitude()); |
| | | logger.info("GCJ02坐标:" + gcj02Point[0] + ", " + gcj02Point[1]); |
| | | mobilePosition.setGeodeticSystem("GCJ-02"); |
| | | mobilePosition.setCnLng(gcj02Point[0] + ""); |
| | | mobilePosition.setCnLat(gcj02Point[1] + ""); |
| | | if (!userSetting.getSavePositionHistory()) { |
| | | storager.clearMobilePositionsByDeviceId(device.getDeviceId()); |
| | | if ("WGS84".equals(device.getGeoCoordSys())) { |
| | | mobilePosition.setLongitudeWgs84(mobilePosition.getLongitude()); |
| | | mobilePosition.setLatitudeWgs84(mobilePosition.getLatitude()); |
| | | Double[] position = Coordtransform.WGS84ToGCJ02(mobilePosition.getLongitude(), mobilePosition.getLatitude()); |
| | | mobilePosition.setLongitudeGcj02(position[0]); |
| | | mobilePosition.setLatitudeGcj02(position[1]); |
| | | }else if ("GCJ02".equals(device.getGeoCoordSys())) { |
| | | mobilePosition.setLongitudeGcj02(mobilePosition.getLongitude()); |
| | | mobilePosition.setLatitudeGcj02(mobilePosition.getLatitude()); |
| | | Double[] position = Coordtransform.GCJ02ToWGS84(mobilePosition.getLongitude(), mobilePosition.getLatitude()); |
| | | mobilePosition.setLongitudeWgs84(position[0]); |
| | | mobilePosition.setLatitudeWgs84(position[1]); |
| | | }else { |
| | | mobilePosition.setLongitudeGcj02(0.00); |
| | | mobilePosition.setLatitudeGcj02(0.00); |
| | | mobilePosition.setLongitudeWgs84(0.00); |
| | | mobilePosition.setLatitudeWgs84(0.00); |
| | | } |
| | | storager.insertMobilePosition(mobilePosition); |
| | | if (userSetting.getSavePositionHistory()) { |
| | | storager.insertMobilePosition(mobilePosition); |
| | | } |
| | | // 更新device channel 的经纬度 |
| | | DeviceChannel deviceChannel = new DeviceChannel(); |
| | | deviceChannel.setDeviceId(device.getDeviceId()); |
| | | deviceChannel.setChannelId(channelId); |
| | | deviceChannel.setLongitude(mobilePosition.getLongitude()); |
| | | deviceChannel.setLatitude(mobilePosition.getLatitude()); |
| | | deviceChannel.setLongitudeWgs84(mobilePosition.getLongitudeWgs84()); |
| | | deviceChannel.setLatitudeWgs84(mobilePosition.getLatitudeWgs84()); |
| | | deviceChannel.setLongitudeGcj02(mobilePosition.getLongitudeGcj02()); |
| | | deviceChannel.setLatitudeGcj02(mobilePosition.getLatitudeGcj02()); |
| | | deviceChannel.setGpsTime(mobilePosition.getTime()); |
| | | storager.updateChannelPosition(deviceChannel); |
| | | } |
| | | } |
| | | if (!StringUtils.isEmpty(deviceAlarm.getDeviceId())) { |
| | |
| | | |
| | | |
| | | DeviceAlarm deviceAlarm = new DeviceAlarm(); |
| | | deviceAlarm.setCreateTime(DateUtil.getNow()); |
| | | deviceAlarm.setDeviceId(parentPlatform.getServerGBId()); |
| | | deviceAlarm.setChannelId(channelId); |
| | | deviceAlarm.setAlarmPriority(getText(rootElement, "AlarmPriority")); |
| | |
| | | package com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.notify.cmd; |
| | | |
| | | import com.genersoft.iot.vmp.conf.UserSetting; |
| | | import com.genersoft.iot.vmp.gb28181.bean.BaiduPoint; |
| | | import com.genersoft.iot.vmp.gb28181.bean.Device; |
| | | import com.genersoft.iot.vmp.gb28181.bean.MobilePosition; |
| | | import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform; |
| | | import com.genersoft.iot.vmp.gb28181.bean.*; |
| | | import com.genersoft.iot.vmp.gb28181.transmit.event.request.SIPRequestProcessorParent; |
| | | import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.IMessageHandler; |
| | | import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.notify.NotifyMessageHandler; |
| | | import com.genersoft.iot.vmp.gb28181.utils.Coordtransform; |
| | | import com.genersoft.iot.vmp.gb28181.utils.NumericUtil; |
| | | import com.genersoft.iot.vmp.storager.IVideoManagerStorage; |
| | | import com.genersoft.iot.vmp.utils.DateUtil; |
| | | import com.genersoft.iot.vmp.utils.GpsUtil; |
| | | import org.dom4j.DocumentException; |
| | | import org.dom4j.Element; |
| | |
| | | rootElement = getRootElement(evt, device.getCharset()); |
| | | |
| | | MobilePosition mobilePosition = new MobilePosition(); |
| | | mobilePosition.setCreateTime(DateUtil.getNow()); |
| | | if (!StringUtils.isEmpty(device.getName())) { |
| | | mobilePosition.setDeviceName(device.getName()); |
| | | } |
| | |
| | | mobilePosition.setAltitude(0.0); |
| | | } |
| | | mobilePosition.setReportSource("Mobile Position"); |
| | | // 默认来源坐标系为WGS-84处理 |
| | | Double[] gcj02Point = Coordtransform.WGS84ToGCJ02(mobilePosition.getLongitude(), mobilePosition.getLatitude()); |
| | | logger.info("GCJ02坐标:" + gcj02Point[0] + ", " + gcj02Point[1]); |
| | | mobilePosition.setGeodeticSystem("GCJ-02"); |
| | | mobilePosition.setCnLng(gcj02Point[0] + ""); |
| | | mobilePosition.setCnLat(gcj02Point[1] + ""); |
| | | if (!userSetting.getSavePositionHistory()) { |
| | | storager.clearMobilePositionsByDeviceId(device.getDeviceId()); |
| | | if ("WGS84".equals(device.getGeoCoordSys())) { |
| | | mobilePosition.setLongitudeWgs84(mobilePosition.getLongitude()); |
| | | mobilePosition.setLatitudeWgs84(mobilePosition.getLatitude()); |
| | | Double[] position = Coordtransform.WGS84ToGCJ02(mobilePosition.getLongitude(), mobilePosition.getLatitude()); |
| | | mobilePosition.setLongitudeGcj02(position[0]); |
| | | mobilePosition.setLatitudeGcj02(position[1]); |
| | | }else if ("GCJ02".equals(device.getGeoCoordSys())) { |
| | | mobilePosition.setLongitudeGcj02(mobilePosition.getLongitude()); |
| | | mobilePosition.setLatitudeGcj02(mobilePosition.getLatitude()); |
| | | Double[] position = Coordtransform.GCJ02ToWGS84(mobilePosition.getLongitude(), mobilePosition.getLatitude()); |
| | | mobilePosition.setLongitudeWgs84(position[0]); |
| | | mobilePosition.setLatitudeWgs84(position[1]); |
| | | }else { |
| | | mobilePosition.setLongitudeGcj02(0.00); |
| | | mobilePosition.setLatitudeGcj02(0.00); |
| | | mobilePosition.setLongitudeWgs84(0.00); |
| | | mobilePosition.setLatitudeWgs84(0.00); |
| | | } |
| | | storager.insertMobilePosition(mobilePosition); |
| | | if (userSetting.getSavePositionHistory()) { |
| | | storager.insertMobilePosition(mobilePosition); |
| | | } |
| | | // 更新device channel 的经纬度 |
| | | DeviceChannel deviceChannel = new DeviceChannel(); |
| | | deviceChannel.setDeviceId(device.getDeviceId()); |
| | | deviceChannel.setChannelId(mobilePosition.getChannelId()); |
| | | deviceChannel.setLongitude(mobilePosition.getLongitude()); |
| | | deviceChannel.setLatitude(mobilePosition.getLatitude()); |
| | | deviceChannel.setLongitudeWgs84(mobilePosition.getLongitudeWgs84()); |
| | | deviceChannel.setLatitudeWgs84(mobilePosition.getLatitudeWgs84()); |
| | | deviceChannel.setLongitudeGcj02(mobilePosition.getLongitudeGcj02()); |
| | | deviceChannel.setLatitudeGcj02(mobilePosition.getLatitudeGcj02()); |
| | | deviceChannel.setGpsTime(mobilePosition.getTime()); |
| | | storager.updateChannelPosition(deviceChannel); |
| | | //回复 200 OK |
| | | responseAck(evt, Response.OK); |
| | | } catch (DocumentException | SipException | InvalidArgumentException | ParseException e) { |
| | |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 处理设备位置的更新 |
| | | * |
| | | * @param evt, itemDevice |
| | | */ |
| | | private void processNotifyMobilePosition(RequestEvent evt, Element itemDevice) { |
| | | try { |
| | | // 回复 200 OK |
| | | Element rootElement = getRootElement(evt); |
| | | MobilePosition mobilePosition = new MobilePosition(); |
| | | Element deviceIdElement = rootElement.element("DeviceID"); |
| | | String deviceId = deviceIdElement.getTextTrim().toString(); |
| | | Device device = redisCatchStorage.getDevice(deviceId); |
| | | if (device != null) { |
| | | if (!StringUtils.isEmpty(device.getName())) { |
| | | mobilePosition.setDeviceName(device.getName()); |
| | | } |
| | | } |
| | | mobilePosition.setDeviceId(XmlUtil.getText(rootElement, "DeviceID")); |
| | | |
| | | String time = XmlUtil.getText(itemDevice, "Time"); |
| | | if(time==null){ |
| | | time = XmlUtil.getText(itemDevice, "EndTime"); |
| | | } |
| | | mobilePosition.setTime(time); |
| | | String longitude = XmlUtil.getText(itemDevice, "Longitude"); |
| | | if(longitude!=null) { |
| | | mobilePosition.setLongitude(Double.parseDouble(longitude)); |
| | | } |
| | | String latitude = XmlUtil.getText(itemDevice, "Latitude"); |
| | | if(latitude!=null) { |
| | | mobilePosition.setLatitude(Double.parseDouble(latitude)); |
| | | } |
| | | if (NumericUtil.isDouble(XmlUtil.getText(itemDevice, "Speed"))) { |
| | | mobilePosition.setSpeed(Double.parseDouble(XmlUtil.getText(itemDevice, "Speed"))); |
| | | } else { |
| | | mobilePosition.setSpeed(0.0); |
| | | } |
| | | if (NumericUtil.isDouble(XmlUtil.getText(itemDevice, "Direction"))) { |
| | | mobilePosition.setDirection(Double.parseDouble(XmlUtil.getText(itemDevice, "Direction"))); |
| | | } else { |
| | | mobilePosition.setDirection(0.0); |
| | | } |
| | | if (NumericUtil.isDouble(XmlUtil.getText(itemDevice, "Altitude"))) { |
| | | mobilePosition.setAltitude(Double.parseDouble(XmlUtil.getText(itemDevice, "Altitude"))); |
| | | } else { |
| | | mobilePosition.setAltitude(0.0); |
| | | } |
| | | mobilePosition.setReportSource("Mobile Position"); |
| | | // 默认来源坐标系为WGS-84处理 |
| | | Double[] gcj02Point = Coordtransform.WGS84ToGCJ02(mobilePosition.getLongitude(), mobilePosition.getLatitude()); |
| | | logger.info("GCJ02坐标:" + gcj02Point[0] + ", " + gcj02Point[1]); |
| | | mobilePosition.setGeodeticSystem("GCJ-02"); |
| | | mobilePosition.setCnLng(gcj02Point[0] + ""); |
| | | mobilePosition.setCnLat(gcj02Point[1] + ""); |
| | | if (!userSetting.getSavePositionHistory()) { |
| | | storager.clearMobilePositionsByDeviceId(deviceId); |
| | | } |
| | | storager.insertMobilePosition(mobilePosition); |
| | | responseAck(evt, Response.OK); |
| | | } catch (DocumentException | SipException | InvalidArgumentException | ParseException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | public SyncStatus getChannelSyncProgress(String deviceId) { |
| | | if (catalogDataCatch.get(deviceId) == null) { |
| | | return null; |
| | |
| | | package com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.response.cmd; |
| | | |
| | | import com.genersoft.iot.vmp.conf.UserSetting; |
| | | import com.genersoft.iot.vmp.gb28181.bean.BaiduPoint; |
| | | import com.genersoft.iot.vmp.gb28181.bean.Device; |
| | | import com.genersoft.iot.vmp.gb28181.bean.MobilePosition; |
| | | import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform; |
| | | import com.genersoft.iot.vmp.gb28181.bean.*; |
| | | import com.genersoft.iot.vmp.gb28181.transmit.event.request.SIPRequestProcessorParent; |
| | | import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.IMessageHandler; |
| | | import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.response.ResponseMessageHandler; |
| | | import com.genersoft.iot.vmp.gb28181.utils.Coordtransform; |
| | | import com.genersoft.iot.vmp.gb28181.utils.NumericUtil; |
| | | import com.genersoft.iot.vmp.storager.IVideoManagerStorage; |
| | | import com.genersoft.iot.vmp.utils.DateUtil; |
| | | import com.genersoft.iot.vmp.utils.GpsUtil; |
| | | import org.dom4j.DocumentException; |
| | | import org.dom4j.Element; |
| | |
| | | rootElement = getRootElement(evt, device.getCharset()); |
| | | |
| | | MobilePosition mobilePosition = new MobilePosition(); |
| | | mobilePosition.setCreateTime(DateUtil.getNow()); |
| | | if (!StringUtils.isEmpty(device.getName())) { |
| | | mobilePosition.setDeviceName(device.getName()); |
| | | } |
| | |
| | | mobilePosition.setAltitude(0.0); |
| | | } |
| | | mobilePosition.setReportSource("Mobile Position"); |
| | | // 默认来源坐标系为WGS-84处理 |
| | | Double[] gcj02Point = Coordtransform.WGS84ToGCJ02(mobilePosition.getLongitude(), mobilePosition.getLatitude()); |
| | | logger.info("GCJ02坐标:" + gcj02Point[0] + ", " + gcj02Point[1]); |
| | | mobilePosition.setGeodeticSystem("GCJ-02"); |
| | | mobilePosition.setCnLng(gcj02Point[0] + ""); |
| | | mobilePosition.setCnLat(gcj02Point[1] + ""); |
| | | if (!userSetting.getSavePositionHistory()) { |
| | | storager.clearMobilePositionsByDeviceId(device.getDeviceId()); |
| | | if ("WGS84".equals(device.getGeoCoordSys())) { |
| | | mobilePosition.setLongitudeWgs84(mobilePosition.getLongitude()); |
| | | mobilePosition.setLatitudeWgs84(mobilePosition.getLatitude()); |
| | | Double[] position = Coordtransform.WGS84ToGCJ02(mobilePosition.getLongitude(), mobilePosition.getLatitude()); |
| | | mobilePosition.setLongitudeGcj02(position[0]); |
| | | mobilePosition.setLatitudeGcj02(position[1]); |
| | | }else if ("GCJ02".equals(device.getGeoCoordSys())) { |
| | | mobilePosition.setLongitudeGcj02(mobilePosition.getLongitude()); |
| | | mobilePosition.setLatitudeGcj02(mobilePosition.getLatitude()); |
| | | Double[] position = Coordtransform.GCJ02ToWGS84(mobilePosition.getLongitude(), mobilePosition.getLatitude()); |
| | | mobilePosition.setLongitudeWgs84(position[0]); |
| | | mobilePosition.setLatitudeWgs84(position[1]); |
| | | }else { |
| | | mobilePosition.setLongitudeGcj02(0.00); |
| | | mobilePosition.setLatitudeGcj02(0.00); |
| | | mobilePosition.setLongitudeWgs84(0.00); |
| | | mobilePosition.setLatitudeWgs84(0.00); |
| | | } |
| | | storager.insertMobilePosition(mobilePosition); |
| | | if (userSetting.getSavePositionHistory()) { |
| | | storager.insertMobilePosition(mobilePosition); |
| | | } |
| | | // 更新device channel 的经纬度 |
| | | DeviceChannel deviceChannel = new DeviceChannel(); |
| | | deviceChannel.setDeviceId(device.getDeviceId()); |
| | | deviceChannel.setChannelId(mobilePosition.getChannelId()); |
| | | deviceChannel.setLongitude(mobilePosition.getLongitude()); |
| | | deviceChannel.setLatitude(mobilePosition.getLatitude()); |
| | | deviceChannel.setLongitudeWgs84(mobilePosition.getLongitudeWgs84()); |
| | | deviceChannel.setLatitudeWgs84(mobilePosition.getLatitudeWgs84()); |
| | | deviceChannel.setLongitudeGcj02(mobilePosition.getLongitudeGcj02()); |
| | | deviceChannel.setLatitudeGcj02(mobilePosition.getLatitudeGcj02()); |
| | | deviceChannel.setGpsTime(mobilePosition.getTime()); |
| | | storager.updateChannelPosition(deviceChannel); |
| | | //回复 200 OK |
| | | responseAck(evt, Response.OK); |
| | | } catch (DocumentException | SipException | InvalidArgumentException | ParseException e) { |
| | |
| | | package com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.response.cmd; |
| | | |
| | | import com.genersoft.iot.vmp.domain.req.PresetQuerySipReq; |
| | | import com.genersoft.iot.vmp.gb28181.bean.PresetQuerySipReq; |
| | | import com.genersoft.iot.vmp.gb28181.bean.*; |
| | | import com.genersoft.iot.vmp.gb28181.transmit.callback.DeferredResultHolder; |
| | | import com.genersoft.iot.vmp.gb28181.transmit.callback.RequestMessage; |
| | |
| | | import com.alibaba.fastjson.JSONObject;
|
| | | import com.genersoft.iot.vmp.gb28181.bean.Device;
|
| | | import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel;
|
| | | import com.genersoft.iot.vmp.utils.DateUtil;
|
| | | import org.dom4j.Attribute;
|
| | | import org.dom4j.Document;
|
| | | import org.dom4j.DocumentException;
|
| | |
| | | } else {
|
| | | deviceChannel.setLatitude(0.00);
|
| | | }
|
| | | deviceChannel.setGpsTime(DateUtil.getNow());
|
| | | if (deviceChannel.getLongitude()*deviceChannel.getLatitude() > 0) {
|
| | | if ("WGS84".equals(device.getGeoCoordSys())) {
|
| | | deviceChannel.setLongitudeWgs84(deviceChannel.getLongitude());
|
| | |
| | | package com.genersoft.iot.vmp.media.zlm;
|
| | |
|
| | | import java.util.ArrayList;
|
| | | import java.util.HashMap;
|
| | | import java.util.List;
|
| | | import java.util.Map;
|
| | |
|
| | | import com.alibaba.fastjson.JSON;
|
| | | import com.genersoft.iot.vmp.common.StreamInfo;
|
| | |
| | | import org.springframework.beans.factory.annotation.Autowired;
|
| | | import org.springframework.http.HttpStatus;
|
| | | import org.springframework.http.ResponseEntity;
|
| | | import org.springframework.util.StringUtils;
|
| | | import org.springframework.web.bind.annotation.PostMapping;
|
| | | import org.springframework.web.bind.annotation.RequestBody;
|
| | | import org.springframework.web.bind.annotation.RequestMapping;
|
| | |
| | |
|
| | | @Autowired
|
| | | private UserSetting userSetting;
|
| | |
|
| | | @Autowired
|
| | | private IUserService userService;
|
| | |
|
| | | @Autowired
|
| | | private VideoStreamSessionManager sessionManager;
|
| | |
| | | */
|
| | | @ResponseBody
|
| | | @PostMapping(value = "/on_play", produces = "application/json;charset=UTF-8")
|
| | | public ResponseEntity<String> onPlay(@RequestBody JSONObject json){
|
| | | |
| | | public ResponseEntity<String> onPlay(@RequestBody OnPlayHookParam param){
|
| | |
|
| | | JSONObject json = (JSONObject)JSON.toJSON(param);
|
| | |
|
| | | if (logger.isDebugEnabled()) {
|
| | | logger.debug("[ ZLM HOOK ]on_play API调用,参数:" + json.toString());
|
| | | logger.debug("[ ZLM HOOK ]on_play API调用,参数:" + JSON.toJSONString(param));
|
| | | }
|
| | | String mediaServerId = json.getString("mediaServerId");
|
| | | String mediaServerId = param.getMediaServerId();
|
| | | ZLMHttpHookSubscribe.Event subscribe = this.subscribe.getSubscribe(ZLMHttpHookSubscribe.HookType.on_play, json);
|
| | | if (subscribe != null ) {
|
| | | MediaServerItem mediaInfo = mediaServerService.getOne(mediaServerId);
|
| | |
| | | }
|
| | | }
|
| | | JSONObject ret = new JSONObject();
|
| | | if (!"rtp".equals(param.getApp())) {
|
| | | Map<String, String> paramMap = urlParamToMap(param.getParams());
|
| | | StreamAuthorityInfo streamAuthorityInfo = redisCatchStorage.getStreamAuthorityInfo(param.getApp(), param.getStream());
|
| | | if (streamAuthorityInfo == null
|
| | | || (streamAuthorityInfo.getCallId() != null && !streamAuthorityInfo.getCallId().equals(paramMap.get("callId")))) {
|
| | | ret.put("code", 401);
|
| | | ret.put("msg", "Unauthorized");
|
| | | return new ResponseEntity<>(ret.toString(),HttpStatus.OK);
|
| | | }
|
| | | }
|
| | |
|
| | | ret.put("code", 0);
|
| | | ret.put("msg", "success");
|
| | | return new ResponseEntity<String>(ret.toString(),HttpStatus.OK);
|
| | | return new ResponseEntity<>(ret.toString(),HttpStatus.OK);
|
| | | }
|
| | |
|
| | | /**
|
| | |
| | | */
|
| | | @ResponseBody
|
| | | @PostMapping(value = "/on_publish", produces = "application/json;charset=UTF-8")
|
| | | public ResponseEntity<String> onPublish(@RequestBody JSONObject json) {
|
| | | public ResponseEntity<String> onPublish(@RequestBody OnPublishHookParam param) {
|
| | |
|
| | | JSONObject json = (JSONObject) JSON.toJSON(param);
|
| | |
|
| | | logger.info("[ ZLM HOOK ]on_publish API调用,参数:" + json.toString());
|
| | | JSONObject ret = new JSONObject();
|
| | | if (!"rtp".equals(param.getApp())) {
|
| | | // 推流鉴权
|
| | | if (param.getParams() == null) {
|
| | | logger.info("推流鉴权失败: 缺少不要参数:sign=md5(user表的pushKey)");
|
| | | ret.put("code", 401);
|
| | | ret.put("msg", "Unauthorized");
|
| | | return new ResponseEntity<>(ret.toString(), HttpStatus.OK);
|
| | | }
|
| | | Map<String, String> paramMap = urlParamToMap(param.getParams());
|
| | | String sign = paramMap.get("sign");
|
| | | if (sign == null) {
|
| | | logger.info("推流鉴权失败: 缺少不要参数:sign=md5(user表的pushKey)");
|
| | | ret.put("code", 401);
|
| | | ret.put("msg", "Unauthorized");
|
| | | return new ResponseEntity<>(ret.toString(), HttpStatus.OK);
|
| | | }
|
| | | // 推流自定义播放鉴权码
|
| | | String callId = paramMap.get("callId");
|
| | | // 鉴权配置
|
| | | boolean hasAuthority = userService.checkPushAuthority(callId, sign);
|
| | | if (!hasAuthority) {
|
| | | logger.info("推流鉴权失败: sign 无权限: callId={}. sign={}", callId, sign);
|
| | | ret.put("code", 401);
|
| | | ret.put("msg", "Unauthorized");
|
| | | return new ResponseEntity<>(ret.toString(), HttpStatus.OK);
|
| | | }
|
| | | StreamAuthorityInfo streamAuthorityInfo = StreamAuthorityInfo.getInstanceByHook(param);
|
| | | streamAuthorityInfo.setCallId(callId);
|
| | | streamAuthorityInfo.setSign(sign);
|
| | | // 鉴权通过
|
| | | redisCatchStorage.updateStreamAuthorityInfo(param.getApp(), param.getStream(), streamAuthorityInfo);
|
| | | }
|
| | |
|
| | | ret.put("code", 0);
|
| | | ret.put("msg", "success");
|
| | | ret.put("enable_hls", true);
|
| | | if (json.getInteger("originType") == 1
|
| | | || json.getInteger("originType") == 2
|
| | | || json.getInteger("originType") == 3) {
|
| | | if (!"rtp".equals(param.getApp())) {
|
| | | ret.put("enable_audio", true);
|
| | | }
|
| | |
|
| | |
| | | ret.put("msg", "zlm not register");
|
| | | }
|
| | | }
|
| | | String app = json.getString("app");
|
| | | String stream = json.getString("stream");
|
| | | if ("rtp".equals(app)) {
|
| | |
|
| | | if ("rtp".equals(param.getApp())) {
|
| | | ret.put("enable_mp4", userSetting.getRecordSip());
|
| | | }else {
|
| | | ret.put("enable_mp4", userSetting.isRecordPushLive());
|
| | | }
|
| | | List<SsrcTransaction> ssrcTransactionForAll = sessionManager.getSsrcTransactionForAll(null, null, null, stream);
|
| | | List<SsrcTransaction> ssrcTransactionForAll = sessionManager.getSsrcTransactionForAll(null, null, null, param.getStream());
|
| | | if (ssrcTransactionForAll != null && ssrcTransactionForAll.size() == 1) {
|
| | | String deviceId = ssrcTransactionForAll.get(0).getDeviceId();
|
| | | String channelId = ssrcTransactionForAll.get(0).getChannelId();
|
| | |
| | | ret.put("enable_mp4", true);
|
| | | ret.put("enable_audio", true);
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | |
|
| | | return new ResponseEntity<String>(ret.toString(), HttpStatus.OK);
|
| | | }
|
| | | |
| | |
|
| | |
|
| | |
|
| | | /**
|
| | | * 录制mp4完成后通知事件;此事件对回复不敏感。
|
| | | *
|
| | |
| | | if (logger.isDebugEnabled()) {
|
| | | logger.debug("[ ZLM HOOK ]on_shell_login API调用,参数:" + json.toString());
|
| | | }
|
| | | // TODO 如果是带有rtpstream则开启按需拉流
|
| | | // String app = json.getString("app");
|
| | | // String stream = json.getString("stream");
|
| | | String mediaServerId = json.getString("mediaServerId");
|
| | | ZLMHttpHookSubscribe.Event subscribe = this.subscribe.getSubscribe(ZLMHttpHookSubscribe.HookType.on_shell_login, json);
|
| | | if (subscribe != null ) {
|
| | |
| | | }
|
| | | // 流消失移除redis play
|
| | | String app = item.getApp();
|
| | | String streamId = item.getStream();
|
| | | String stream = item.getStream();
|
| | | String schema = item.getSchema();
|
| | | List<MediaItem.MediaTrack> tracks = item.getTracks();
|
| | | boolean regist = item.isRegist();
|
| | | if (regist) {
|
| | | StreamAuthorityInfo streamAuthorityInfo = redisCatchStorage.getStreamAuthorityInfo(app, stream);
|
| | | if (streamAuthorityInfo == null) {
|
| | | streamAuthorityInfo = StreamAuthorityInfo.getInstanceByHook(item);
|
| | | }else {
|
| | | streamAuthorityInfo.setOriginType(item.getOriginType());
|
| | | streamAuthorityInfo.setOriginTypeStr(item.getOriginTypeStr());
|
| | | }
|
| | | redisCatchStorage.updateStreamAuthorityInfo(app, stream, streamAuthorityInfo);
|
| | | }else {
|
| | | redisCatchStorage.removeStreamAuthorityInfo(app, stream);
|
| | | }
|
| | | if ("rtmp".equals(schema)){
|
| | | logger.info("on_stream_changed:注册->{}, app->{}, stream->{}", regist, app, streamId);
|
| | | logger.info("on_stream_changed:注册->{}, app->{}, stream->{}", regist, app, stream);
|
| | | if (regist) {
|
| | | mediaServerService.addCount(mediaServerId);
|
| | | }else {
|
| | |
| | | if (item.getOriginType() == OriginType.PULL.ordinal()
|
| | | || item.getOriginType() == OriginType.FFMPEG_PULL.ordinal()) {
|
| | | // 设置拉流代理上线/离线
|
| | | streamProxyService.updateStatus(regist, app, streamId);
|
| | | streamProxyService.updateStatus(regist, app, stream);
|
| | | }
|
| | | if ("rtp".equals(app) && !regist ) {
|
| | | StreamInfo streamInfo = redisCatchStorage.queryPlayByStreamId(streamId);
|
| | | StreamInfo streamInfo = redisCatchStorage.queryPlayByStreamId(stream);
|
| | | if (streamInfo!=null){
|
| | | redisCatchStorage.stopPlay(streamInfo);
|
| | | storager.stopPlay(streamInfo.getDeviceID(), streamInfo.getChannelId());
|
| | | }else{
|
| | | streamInfo = redisCatchStorage.queryPlayback(null, null, streamId, null);
|
| | | streamInfo = redisCatchStorage.queryPlayback(null, null, stream, null);
|
| | | if (streamInfo != null) {
|
| | | redisCatchStorage.stopPlayback(streamInfo.getDeviceID(), streamInfo.getChannelId(),
|
| | | streamInfo.getStream(), null);
|
| | |
| | |
|
| | | if (mediaServerItem != null){
|
| | | if (regist) {
|
| | | StreamPushItem streamPushItem = null;
|
| | | StreamInfo streamInfoByAppAndStream = mediaService.getStreamInfoByAppAndStream(mediaServerItem, app, streamId, tracks);
|
| | | StreamAuthorityInfo streamAuthorityInfo = redisCatchStorage.getStreamAuthorityInfo(app, stream);
|
| | | StreamInfo streamInfoByAppAndStream = mediaService.getStreamInfoByAppAndStream(mediaServerItem,
|
| | | app, stream, tracks, streamAuthorityInfo.getCallId());
|
| | | item.setStreamInfo(streamInfoByAppAndStream);
|
| | |
|
| | | redisCatchStorage.addStream(mediaServerItem, type, app, streamId, item);
|
| | | redisCatchStorage.addStream(mediaServerItem, type, app, stream, item);
|
| | | if (item.getOriginType() == OriginType.RTSP_PUSH.ordinal()
|
| | | || item.getOriginType() == OriginType.RTMP_PUSH.ordinal()
|
| | | || item.getOriginType() == OriginType.RTC_PUSH.ordinal() ) {
|
| | |
| | |
|
| | | }else {
|
| | | // 兼容流注销时类型从redis记录获取
|
| | | MediaItem mediaItem = redisCatchStorage.getStreamInfo(app, streamId, mediaServerId);
|
| | | MediaItem mediaItem = redisCatchStorage.getStreamInfo(app, stream, mediaServerId);
|
| | | if (mediaItem != null) {
|
| | | type = OriginType.values()[mediaItem.getOriginType()].getType();
|
| | | redisCatchStorage.removeStream(mediaServerItem.getId(), type, app, streamId);
|
| | | redisCatchStorage.removeStream(mediaServerItem.getId(), type, app, stream);
|
| | | }
|
| | | GbStream gbStream = storager.getGbStream(app, streamId);
|
| | | GbStream gbStream = storager.getGbStream(app, stream);
|
| | | if (gbStream != null) {
|
| | | // eventPublisher.catalogEventPublishForStream(null, gbStream, CatalogEvent.OFF);
|
| | | }
|
| | | zlmMediaListManager.removeMedia(app, streamId);
|
| | | zlmMediaListManager.removeMedia(app, stream);
|
| | | }
|
| | | if (type != null) {
|
| | | // 发送流变化redis消息
|
| | | JSONObject jsonObject = new JSONObject();
|
| | | jsonObject.put("serverId", userSetting.getServerId());
|
| | | jsonObject.put("app", app);
|
| | | jsonObject.put("stream", streamId);
|
| | | jsonObject.put("stream", stream);
|
| | | jsonObject.put("register", regist);
|
| | | jsonObject.put("mediaServerId", mediaServerId);
|
| | | redisCatchStorage.sendStreamChangeMsg(type, jsonObject);
|
| | |
| | | @ResponseBody
|
| | | @PostMapping(value = "/on_stream_none_reader", produces = "application/json;charset=UTF-8")
|
| | | public ResponseEntity<String> onStreamNoneReader(@RequestBody JSONObject json){
|
| | | |
| | | if (logger.isDebugEnabled()) {
|
| | | logger.debug("[ ZLM HOOK ]on_stream_none_reader API调用,参数:" + json.toString());
|
| | | }
|
| | |
|
| | | logger.info("[ ZLM HOOK ]on_stream_none_reader API调用,参数:" + json.toString());
|
| | | String mediaServerId = json.getString("mediaServerId");
|
| | | String streamId = json.getString("stream");
|
| | | String app = json.getString("app");
|
| | |
| | | ret.put("msg", "success");
|
| | | return new ResponseEntity<String>(ret.toString(),HttpStatus.OK);
|
| | | }
|
| | |
|
| | | private Map<String, String> urlParamToMap(String params) {
|
| | | HashMap<String, String> map = new HashMap<>();
|
| | | if (StringUtils.isEmpty(params)) {
|
| | | return map;
|
| | | }
|
| | | String[] paramsArray = params.split("&");
|
| | | if (paramsArray.length == 0) {
|
| | | return map;
|
| | | }
|
| | | for (String param : paramsArray) {
|
| | | String[] paramArray = param.split("=");
|
| | | if (paramArray.length == 2){
|
| | | map.put(paramArray[0], paramArray[1]);
|
| | | }
|
| | | }
|
| | | return map;
|
| | | }
|
| | | }
|
| | |
| | | import com.genersoft.iot.vmp.storager.dao.GbStreamMapper; |
| | | import com.genersoft.iot.vmp.storager.dao.PlatformGbStreamMapper; |
| | | import com.genersoft.iot.vmp.storager.dao.StreamPushMapper; |
| | | import com.genersoft.iot.vmp.utils.DateUtil; |
| | | import org.checkerframework.checker.units.qual.C; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | |
| | | public StreamPushItem addPush(MediaItem mediaItem) { |
| | | // 查找此直播流是否存在redis预设gbId |
| | | StreamPushItem transform = streamPushService.transform(mediaItem); |
| | | // 从streamId取出查询关键值 |
| | | Pattern pattern = Pattern.compile(userSetting.getThirdPartyGBIdReg()); |
| | | Matcher matcher = pattern.matcher(mediaItem.getStream());// 指定要匹配的字符串 |
| | | String queryKey = null; |
| | | if (matcher.find()) { //此处find()每次被调用后,会偏移到下一个匹配 |
| | | queryKey = matcher.group(); |
| | | } |
| | | if (queryKey != null) { |
| | | ThirdPartyGB thirdPartyGB = redisCatchStorage.queryMemberNoGBId(queryKey); |
| | | if (thirdPartyGB != null && !StringUtils.isEmpty(thirdPartyGB.getNationalStandardNo())) { |
| | | transform.setGbId(thirdPartyGB.getNationalStandardNo()); |
| | | transform.setName(thirdPartyGB.getName()); |
| | | } |
| | | } |
| | | if (!StringUtils.isEmpty(transform.getGbId())) { |
| | | // 如果这个国标ID已经给了其他推流且流已离线,则移除其他推流 |
| | | List<GbStream> gbStreams = gbStreamMapper.selectByGBId(transform.getGbId()); |
| | | if (gbStreams.size() > 0) { |
| | | for (GbStream gbStream : gbStreams) { |
| | | // 出现使用相同国标Id的视频流时,使用新流替换旧流, |
| | | if (queryKey != null && gbStream.getApp().equals(mediaItem.getApp())) { |
| | | Matcher matcherForStream = pattern.matcher(gbStream.getStream()); |
| | | String queryKeyForStream = null; |
| | | if (matcherForStream.find()) { //此处find()每次被调用后,会偏移到下一个匹配 |
| | | queryKeyForStream = matcherForStream.group(); |
| | | } |
| | | if (queryKeyForStream == null || !queryKeyForStream.equals(queryKey)) { |
| | | // 此时不是同一个流 |
| | | gbStreamMapper.del(gbStream.getApp(), gbStream.getStream()); |
| | | if (!gbStream.isStatus()) { |
| | | streamPushMapper.del(gbStream.getApp(), gbStream.getStream()); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | List<GbStream> gbStreamList = gbStreamMapper.selectByGBId(transform.getGbId()); |
| | | if (gbStreamList != null && gbStreamList.size() == 1) { |
| | | transform.setGbStreamId(gbStreamList.get(0).getGbStreamId()); |
| | | transform.setPlatformId(gbStreamList.get(0).getPlatformId()); |
| | | transform.setCatalogId(gbStreamList.get(0).getCatalogId()); |
| | | transform.setGbId(gbStreamList.get(0).getGbId()); |
| | | gbStreamMapper.update(transform); |
| | | streamPushMapper.del(gbStreamList.get(0).getApp(), gbStreamList.get(0).getStream()); |
| | | }else { |
| | | transform.setCreateStamp(System.currentTimeMillis()); |
| | | gbStreamMapper.add(transform); |
| | | } |
| | | if (transform != null) { |
| | | if (channelOnlineEvents.get(transform.getGbId()) != null) { |
| | | channelOnlineEvents.get(transform.getGbId()).run(transform.getApp(), transform.getStream(), transform.getServerId()); |
| | | channelOnlineEvents.remove(transform.getGbId()); |
| | | } |
| | | } |
| | | StreamPushItem pushInDb = streamPushService.getPush(mediaItem.getApp(), mediaItem.getStream()); |
| | | transform.setUpdateTime(DateUtil.getNow()); |
| | | transform.setPushTime(DateUtil.getNow()); |
| | | if (pushInDb == null) { |
| | | transform.setCreateTime(DateUtil.getNow()); |
| | | streamPushMapper.add(transform); |
| | | }else { |
| | | streamPushMapper.update(transform); |
| | | |
| | | |
| | | // if (!StringUtils.isEmpty(pushInDb.getGbId())) { |
| | | // List<GbStream> gbStreamList = gbStreamMapper.selectByGBId(transform.getGbId()); |
| | | // if (gbStreamList != null && gbStreamList.size() == 1) { |
| | | // transform.setGbStreamId(gbStreamList.get(0).getGbStreamId()); |
| | | // transform.setPlatformId(gbStreamList.get(0).getPlatformId()); |
| | | // transform.setCatalogId(gbStreamList.get(0).getCatalogId()); |
| | | // transform.setGbId(gbStreamList.get(0).getGbId()); |
| | | // gbStreamMapper.update(transform); |
| | | // streamPushMapper.del(gbStreamList.get(0).getApp(), gbStreamList.get(0).getStream()); |
| | | // }else { |
| | | // transform.setCreateTime(DateUtil.getNow()); |
| | | // transform.setUpdateTime(DateUtil.getNow()); |
| | | // gbStreamMapper.add(transform); |
| | | // } |
| | | // 通知通道上线 |
| | | // if (transform != null) { |
| | | // if (channelOnlineEvents.get(transform.getGbId()) != null) { |
| | | // channelOnlineEvents.get(transform.getGbId()).run(transform.getApp(), transform.getStream(), transform.getServerId()); |
| | | // channelOnlineEvents.remove(transform.getGbId()); |
| | | // } |
| | | // } |
| | | // } |
| | | } |
| | | |
| | | storager.updateMedia(transform); |
| | | |
| | | |
| | | return transform; |
| | | } |
| | | |
| | |
| | | |
| | | public int removeMedia(String app, String streamId) { |
| | | // 查找是否关联了国标, 关联了不删除, 置为离线 |
| | | StreamProxyItem streamProxyItem = gbStreamMapper.selectOne(app, streamId); |
| | | int result = 0; |
| | | if (streamProxyItem == null) { |
| | | GbStream gbStream = gbStreamMapper.selectOne(app, streamId); |
| | | int result; |
| | | if (gbStream == null) { |
| | | result = storager.removeMedia(app, streamId); |
| | | }else { |
| | | // TODO 暂不设置为离线 |
| | | result =storager.mediaOutline(app, streamId); |
| | | result =storager.mediaOffline(app, streamId); |
| | | } |
| | | return result; |
| | | } |
| | |
| | | String stream = UUID.randomUUID().toString(); |
| | | param.put("enable_tcp", 1); |
| | | param.put("stream_id", stream); |
| | | param.put("port", 0); |
| | | // param.put("port", 0); |
| | | JSONObject openRtpServerResultJson = zlmresTfulUtils.openRtpServer(mediaServerItem, param); |
| | | |
| | | if (openRtpServerResultJson != null) { |
| | |
| | | } |
| | | |
| | | Map<String, Object> param = new HashMap<>(); |
| | | // 推流端口设置0则使用随机端口 |
| | | |
| | | param.put("enable_tcp", 1); |
| | | param.put("stream_id", streamId); |
| | | // 推流端口设置0则使用随机端口 |
| | | param.put("port", 0); |
| | | param.put("ssrc", ssrc); |
| | | JSONObject openRtpServerResultJson = zlmresTfulUtils.openRtpServer(mediaServerItem, param); |
| New file |
| | |
| | | package com.genersoft.iot.vmp.media.zlm.dto; |
| | | |
| | | /** |
| | | * zlm hook事件的参数 |
| | | * @author lin |
| | | */ |
| | | public class HookParam { |
| | | private String mediaServerId; |
| | | |
| | | public String getMediaServerId() { |
| | | return mediaServerId; |
| | | } |
| | | |
| | | public void setMediaServerId(String mediaServerId) { |
| | | this.mediaServerId = mediaServerId; |
| | | } |
| | | } |
| New file |
| | |
| | | package com.genersoft.iot.vmp.media.zlm.dto; |
| | | |
| | | /** |
| | | * zlm hook事件中的on_play事件的参数 |
| | | * @author lin |
| | | */ |
| | | public class OnPlayHookParam extends HookParam{ |
| | | private String id; |
| | | private String app; |
| | | private String stream; |
| | | private String ip; |
| | | private String params; |
| | | private int port; |
| | | private String schema; |
| | | private String vhost; |
| | | |
| | | |
| | | public String getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(String id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public String getApp() { |
| | | return app; |
| | | } |
| | | |
| | | public void setApp(String app) { |
| | | this.app = app; |
| | | } |
| | | |
| | | public String getStream() { |
| | | return stream; |
| | | } |
| | | |
| | | public void setStream(String stream) { |
| | | this.stream = stream; |
| | | } |
| | | |
| | | public String getIp() { |
| | | return ip; |
| | | } |
| | | |
| | | public void setIp(String ip) { |
| | | this.ip = ip; |
| | | } |
| | | |
| | | public String getParams() { |
| | | return params; |
| | | } |
| | | |
| | | public void setParams(String params) { |
| | | this.params = params; |
| | | } |
| | | |
| | | public int getPort() { |
| | | return port; |
| | | } |
| | | |
| | | public void setPort(int port) { |
| | | this.port = port; |
| | | } |
| | | |
| | | public String getSchema() { |
| | | return schema; |
| | | } |
| | | |
| | | public void setSchema(String schema) { |
| | | this.schema = schema; |
| | | } |
| | | |
| | | public String getVhost() { |
| | | return vhost; |
| | | } |
| | | |
| | | public void setVhost(String vhost) { |
| | | this.vhost = vhost; |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | package com.genersoft.iot.vmp.media.zlm.dto; |
| | | |
| | | /** |
| | | * zlm hook事件中的on_publish事件的参数 |
| | | * @author lin |
| | | */ |
| | | public class OnPublishHookParam extends HookParam{ |
| | | private String id; |
| | | private String app; |
| | | private String stream; |
| | | private String ip; |
| | | private String params; |
| | | private int port; |
| | | private String schema; |
| | | private String vhost; |
| | | |
| | | |
| | | public String getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(String id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public String getApp() { |
| | | return app; |
| | | } |
| | | |
| | | public void setApp(String app) { |
| | | this.app = app; |
| | | } |
| | | |
| | | public String getStream() { |
| | | return stream; |
| | | } |
| | | |
| | | public void setStream(String stream) { |
| | | this.stream = stream; |
| | | } |
| | | |
| | | public String getIp() { |
| | | return ip; |
| | | } |
| | | |
| | | public void setIp(String ip) { |
| | | this.ip = ip; |
| | | } |
| | | |
| | | public String getParams() { |
| | | return params; |
| | | } |
| | | |
| | | public void setParams(String params) { |
| | | this.params = params; |
| | | } |
| | | |
| | | public int getPort() { |
| | | return port; |
| | | } |
| | | |
| | | public void setPort(int port) { |
| | | this.port = port; |
| | | } |
| | | |
| | | public String getSchema() { |
| | | return schema; |
| | | } |
| | | |
| | | public void setSchema(String schema) { |
| | | this.schema = schema; |
| | | } |
| | | |
| | | public String getVhost() { |
| | | return vhost; |
| | | } |
| | | |
| | | public void setVhost(String vhost) { |
| | | this.vhost = vhost; |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | package com.genersoft.iot.vmp.media.zlm.dto; |
| | | |
| | | /** |
| | | * 流的鉴权信息 |
| | | * @author lin |
| | | */ |
| | | public class StreamAuthorityInfo { |
| | | |
| | | private String id; |
| | | private String app; |
| | | private String stream; |
| | | |
| | | /** |
| | | * 产生源类型, |
| | | * unknown = 0, |
| | | * rtmp_push=1, |
| | | * rtsp_push=2, |
| | | * rtp_push=3, |
| | | * pull=4, |
| | | * ffmpeg_pull=5, |
| | | * mp4_vod=6, |
| | | * device_chn=7 |
| | | */ |
| | | private int originType; |
| | | |
| | | /** |
| | | * 产生源类型的字符串描述 |
| | | */ |
| | | private String originTypeStr; |
| | | |
| | | /** |
| | | * 推流时自定义的播放鉴权ID |
| | | */ |
| | | private String callId; |
| | | |
| | | /** |
| | | * 推流的鉴权签名 |
| | | */ |
| | | private String sign; |
| | | |
| | | public String getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(String id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public String getApp() { |
| | | return app; |
| | | } |
| | | |
| | | public void setApp(String app) { |
| | | this.app = app; |
| | | } |
| | | |
| | | public String getStream() { |
| | | return stream; |
| | | } |
| | | |
| | | public void setStream(String stream) { |
| | | this.stream = stream; |
| | | } |
| | | |
| | | public int getOriginType() { |
| | | return originType; |
| | | } |
| | | |
| | | public void setOriginType(int originType) { |
| | | this.originType = originType; |
| | | } |
| | | |
| | | public String getOriginTypeStr() { |
| | | return originTypeStr; |
| | | } |
| | | |
| | | public void setOriginTypeStr(String originTypeStr) { |
| | | this.originTypeStr = originTypeStr; |
| | | } |
| | | |
| | | public String getCallId() { |
| | | return callId; |
| | | } |
| | | |
| | | public void setCallId(String callId) { |
| | | this.callId = callId; |
| | | } |
| | | |
| | | public String getSign() { |
| | | return sign; |
| | | } |
| | | |
| | | public void setSign(String sign) { |
| | | this.sign = sign; |
| | | } |
| | | |
| | | public static StreamAuthorityInfo getInstanceByHook(OnPublishHookParam hookParam) { |
| | | StreamAuthorityInfo streamAuthorityInfo = new StreamAuthorityInfo(); |
| | | streamAuthorityInfo.setApp(hookParam.getApp()); |
| | | streamAuthorityInfo.setStream(hookParam.getStream()); |
| | | streamAuthorityInfo.setId(hookParam.getId()); |
| | | return streamAuthorityInfo; |
| | | } |
| | | |
| | | public static StreamAuthorityInfo getInstanceByHook(MediaItem mediaItem) { |
| | | StreamAuthorityInfo streamAuthorityInfo = new StreamAuthorityInfo(); |
| | | streamAuthorityInfo.setApp(mediaItem.getApp()); |
| | | streamAuthorityInfo.setStream(mediaItem.getStream()); |
| | | streamAuthorityInfo.setId(mediaItem.getMediaServerId()); |
| | | streamAuthorityInfo.setOriginType(mediaItem.getOriginType()); |
| | | streamAuthorityInfo.setOriginTypeStr(mediaItem.getOriginTypeStr()); |
| | | return streamAuthorityInfo; |
| | | } |
| | | } |
| | |
| | | package com.genersoft.iot.vmp.media.zlm.dto; |
| | | |
| | | import com.genersoft.iot.vmp.gb28181.bean.GbStream; |
| | | import com.genersoft.iot.vmp.utils.DateUtil; |
| | | import org.jetbrains.annotations.NotNull; |
| | | import org.springframework.util.unit.DataUnit; |
| | | |
| | | import java.util.List; |
| | | |
| | |
| | | */ |
| | | private String serverId; |
| | | |
| | | /** |
| | | * 推流时间 |
| | | */ |
| | | private String pushTime; |
| | | |
| | | /** |
| | | * 更新时间 |
| | | */ |
| | | private String updateTime; |
| | | |
| | | /** |
| | | * 创建时间 |
| | | */ |
| | | private String createTime; |
| | | |
| | | public String getVhost() { |
| | | return vhost; |
| | | } |
| | |
| | | |
| | | @Override |
| | | public int compareTo(@NotNull StreamPushItem streamPushItem) { |
| | | return Long.valueOf(super.createStamp - streamPushItem.getCreateStamp().intValue()).intValue(); |
| | | return Long.valueOf(DateUtil.yyyy_MM_dd_HH_mm_ssToTimestamp(super.createTime) |
| | | - DateUtil.yyyy_MM_dd_HH_mm_ssToTimestamp(streamPushItem.getCreateTime())).intValue(); |
| | | } |
| | | |
| | | public static class MediaSchema { |
| | |
| | | public void setServerId(String serverId) { |
| | | this.serverId = serverId; |
| | | } |
| | | |
| | | |
| | | public String getPushTime() { |
| | | return pushTime; |
| | | } |
| | | |
| | | public void setPushTime(String pushTime) { |
| | | this.pushTime = pushTime; |
| | | } |
| | | |
| | | public String getUpdateTime() { |
| | | return updateTime; |
| | | } |
| | | |
| | | public void setUpdateTime(String updateTime) { |
| | | this.updateTime = updateTime; |
| | | } |
| | | |
| | | @Override |
| | | public String getCreateTime() { |
| | | return createTime; |
| | | } |
| | | |
| | | @Override |
| | | public void setCreateTime(String createTime) { |
| | | this.createTime = createTime; |
| | | } |
| | | } |
| | | |
| | |
| | | * @param stream |
| | | * @return |
| | | */ |
| | | StreamInfo getStreamInfoByAppAndStreamWithCheck(String app, String stream, String mediaServerId,String addr); |
| | | StreamInfo getStreamInfoByAppAndStreamWithCheck(String app, String stream, String mediaServerId,String addr, boolean authority); |
| | | |
| | | |
| | | /** |
| | |
| | | * @param stream |
| | | * @return |
| | | */ |
| | | StreamInfo getStreamInfoByAppAndStreamWithCheck(String app, String stream, String mediaServerId); |
| | | StreamInfo getStreamInfoByAppAndStreamWithCheck(String app, String stream, String mediaServerId, boolean authority); |
| | | |
| | | /** |
| | | * 根据应用名和流ID获取播放地址, 只是地址拼接 |
| | |
| | | * @param stream |
| | | * @return |
| | | */ |
| | | StreamInfo getStreamInfoByAppAndStream(MediaServerItem mediaServerItem, String app, String stream, Object tracks); |
| | | StreamInfo getStreamInfoByAppAndStream(MediaServerItem mediaServerItem, String app, String stream, Object tracks, String callId); |
| | | |
| | | /** |
| | | * 根据应用名和流ID获取播放地址, 只是地址拼接,返回的ip使用远程访问ip,适用与zlm与wvp在一台主机的情况 |
| | |
| | | * @param stream |
| | | * @return |
| | | */ |
| | | StreamInfo getStreamInfoByAppAndStream(MediaServerItem mediaInfo, String app, String stream, Object tracks, String addr); |
| | | StreamInfo getStreamInfoByAppAndStream(MediaServerItem mediaInfo, String app, String stream, Object tracks, String addr, String callId); |
| | | StreamInfo getStreamInfoByAppAndStream(MediaServerItem mediaInfo, String app, String stream, Object tracks, String addr, boolean isPlay); |
| | | } |
| | |
| | | List<User> getAllUsers(); |
| | | |
| | | int updateUsers(User user); |
| | | |
| | | boolean checkPushAuthority(String callId, String sign); |
| | | } |
| New file |
| | |
| | | package com.genersoft.iot.vmp.service.bean; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 收到redis通知修改推流通道状态 |
| | | * @author lin |
| | | */ |
| | | public class PushStreamStatusChangeFromRedisDto { |
| | | |
| | | private boolean setAllOffline; |
| | | |
| | | private List<StreamPushItemFromRedis> onlineStreams; |
| | | |
| | | private List<StreamPushItemFromRedis> offlineStreams; |
| | | |
| | | |
| | | public boolean isSetAllOffline() { |
| | | return setAllOffline; |
| | | } |
| | | |
| | | public void setSetAllOffline(boolean setAllOffline) { |
| | | this.setAllOffline = setAllOffline; |
| | | } |
| | | |
| | | public List<StreamPushItemFromRedis> getOnlineStreams() { |
| | | return onlineStreams; |
| | | } |
| | | |
| | | public void setOnlineStreams(List<StreamPushItemFromRedis> onlineStreams) { |
| | | this.onlineStreams = onlineStreams; |
| | | } |
| | | |
| | | public List<StreamPushItemFromRedis> getOfflineStreams() { |
| | | return offlineStreams; |
| | | } |
| | | |
| | | public void setOfflineStreams(List<StreamPushItemFromRedis> offlineStreams) { |
| | | this.offlineStreams = offlineStreams; |
| | | } |
| | | } |
| New file |
| | |
| | | package com.genersoft.iot.vmp.service.bean; |
| | | |
| | | |
| | | public class StreamPushItemFromRedis { |
| | | private String app; |
| | | private String stream; |
| | | private long timeStamp; |
| | | |
| | | public String getApp() { |
| | | return app; |
| | | } |
| | | |
| | | public void setApp(String app) { |
| | | this.app = app; |
| | | } |
| | | |
| | | public String getStream() { |
| | | return stream; |
| | | } |
| | | |
| | | public void setStream(String stream) { |
| | | this.stream = stream; |
| | | } |
| | | |
| | | public long getTimeStamp() { |
| | | return timeStamp; |
| | | } |
| | | |
| | | public void setTimeStamp(long timeStamp) { |
| | | this.timeStamp = timeStamp; |
| | | } |
| | | } |
| | | |
| | | |
| | |
| | | if (gbStream.getGbId() != null) { |
| | | gbStreams.add(gbStream); |
| | | }else { |
| | | StreamProxyItem streamProxyItem = gbStreamMapper.selectOne(gbStream.getApp(), gbStream.getStream()); |
| | | if (streamProxyItem != null && streamProxyItem.getGbId() != null){ |
| | | gbStreams.add(streamProxyItem); |
| | | GbStream gbStreamIndb = gbStreamMapper.selectOne(gbStream.getApp(), gbStream.getStream()); |
| | | if (gbStreamIndb != null && gbStreamIndb.getGbId() != null){ |
| | | gbStreams.add(gbStreamIndb); |
| | | } |
| | | } |
| | | sendCatalogMsgs(gbStreams, type); |
| | |
| | | import com.genersoft.iot.vmp.conf.MediaConfig; |
| | | import com.genersoft.iot.vmp.media.zlm.ZLMRESTfulUtils; |
| | | import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem; |
| | | import com.genersoft.iot.vmp.media.zlm.dto.OnPublishHookParam; |
| | | import com.genersoft.iot.vmp.media.zlm.dto.StreamAuthorityInfo; |
| | | import com.genersoft.iot.vmp.service.IMediaServerService; |
| | | import com.genersoft.iot.vmp.storager.IRedisCatchStorage; |
| | | import com.genersoft.iot.vmp.storager.IVideoManagerStorage; |
| | | import com.genersoft.iot.vmp.service.IMediaService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.util.StringUtils; |
| | | |
| | | @Service |
| | | public class MediaServiceImpl implements IMediaService { |
| | |
| | | |
| | | |
| | | @Override |
| | | public StreamInfo getStreamInfoByAppAndStream(MediaServerItem mediaInfo, String app, String stream, Object tracks) { |
| | | return getStreamInfoByAppAndStream(mediaInfo, app, stream, tracks, null); |
| | | public StreamInfo getStreamInfoByAppAndStream(MediaServerItem mediaInfo, String app, String stream, Object tracks, String callId) { |
| | | return getStreamInfoByAppAndStream(mediaInfo, app, stream, tracks, null, callId); |
| | | } |
| | | |
| | | @Override |
| | | public StreamInfo getStreamInfoByAppAndStreamWithCheck(String app, String stream, String mediaServerId, String addr) { |
| | | public StreamInfo getStreamInfoByAppAndStreamWithCheck(String app, String stream, String mediaServerId, String addr, boolean authority) { |
| | | StreamInfo streamInfo = null; |
| | | if (mediaServerId == null) { |
| | | mediaServerId = mediaConfig.getId(); |
| | | } |
| | | MediaServerItem mediaInfo = mediaServerService.getOne(mediaServerId);; |
| | | MediaServerItem mediaInfo = mediaServerService.getOne(mediaServerId); |
| | | if (mediaInfo == null) { |
| | | return null; |
| | | } |
| | | StreamAuthorityInfo streamAuthorityInfo = redisCatchStorage.getStreamAuthorityInfo(app, stream); |
| | | if (streamAuthorityInfo == null) { |
| | | return null; |
| | | } |
| | | JSONObject mediaList = zlmresTfulUtils.getMediaList(mediaInfo, app, stream); |
| | |
| | | } |
| | | JSONObject mediaJSON = JSON.parseObject(JSON.toJSONString(data.get(0)), JSONObject.class); |
| | | JSONArray tracks = mediaJSON.getJSONArray("tracks"); |
| | | streamInfo = getStreamInfoByAppAndStream(mediaInfo, app, stream, tracks); |
| | | if (authority) { |
| | | streamInfo = getStreamInfoByAppAndStream(mediaInfo, app, stream, tracks, streamAuthorityInfo.getCallId()); |
| | | }else { |
| | | streamInfo = getStreamInfoByAppAndStream(mediaInfo, app, stream, tracks, null); |
| | | } |
| | | |
| | | } |
| | | } |
| | | return streamInfo; |
| | |
| | | |
| | | |
| | | @Override |
| | | public StreamInfo getStreamInfoByAppAndStreamWithCheck(String app, String stream, String mediaServerId) { |
| | | return getStreamInfoByAppAndStreamWithCheck(app, stream, mediaServerId, null); |
| | | public StreamInfo getStreamInfoByAppAndStreamWithCheck(String app, String stream, String mediaServerId, boolean authority) { |
| | | return getStreamInfoByAppAndStreamWithCheck(app, stream, mediaServerId, null, authority); |
| | | } |
| | | |
| | | @Override |
| | |
| | | } |
| | | |
| | | @Override |
| | | public StreamInfo getStreamInfoByAppAndStream(MediaServerItem mediaInfo, String app, String stream, Object tracks, String addr, boolean isPlay) { |
| | | public StreamInfo getStreamInfoByAppAndStream(MediaServerItem mediaInfo, String app, String stream, Object tracks, String addr, String callId, boolean isPlay) { |
| | | StreamInfo streamInfoResult = new StreamInfo(); |
| | | streamInfoResult.setStream(stream); |
| | | streamInfoResult.setApp(app); |
| | | if (addr == null) { |
| | | addr = mediaInfo.getStreamIp(); |
| | | } |
| | | streamInfoResult.setIp(addr); |
| | | streamInfoResult.setMediaServerId(mediaInfo.getId()); |
| | | streamInfoResult.setRtmp(String.format("rtmp://%s:%s/%s/%s", addr, mediaInfo.getRtmpPort(), app, stream)); |
| | | String callIdParam = StringUtils.isEmpty(callId)?"":"?callId=" + callId; |
| | | streamInfoResult.setRtmp(String.format("rtmp://%s:%s/%s/%s%s", addr, mediaInfo.getRtmpPort(), app, stream, callIdParam)); |
| | | if (mediaInfo.getRtmpSSlPort() != 0) { |
| | | streamInfoResult.setRtmps(String.format("rtmps://%s:%s/%s/%s", addr, mediaInfo.getRtmpSSlPort(), app, stream)); |
| | | streamInfoResult.setRtmps(String.format("rtmps://%s:%s/%s/%s%s", addr, mediaInfo.getRtmpSSlPort(), app, stream, callIdParam)); |
| | | } |
| | | streamInfoResult.setRtsp(String.format("rtsp://%s:%s/%s/%s", addr, mediaInfo.getRtspPort(), app, stream)); |
| | | streamInfoResult.setRtsp(String.format("rtsp://%s:%s/%s/%s%s", addr, mediaInfo.getRtspPort(), app, stream, callIdParam)); |
| | | if (mediaInfo.getRtspSSLPort() != 0) { |
| | | streamInfoResult.setRtsps(String.format("rtsps://%s:%s/%s/%s", addr, mediaInfo.getRtspSSLPort(), app, stream)); |
| | | streamInfoResult.setRtsps(String.format("rtsps://%s:%s/%s/%s%s", addr, mediaInfo.getRtspSSLPort(), app, stream, callIdParam)); |
| | | } |
| | | streamInfoResult.setFlv(String.format("http://%s:%s/%s/%s.live.flv", addr, mediaInfo.getHttpPort(), app, stream)); |
| | | streamInfoResult.setWs_flv(String.format("ws://%s:%s/%s/%s.live.flv", addr, mediaInfo.getHttpPort(), app, stream)); |
| | | streamInfoResult.setHls(String.format("http://%s:%s/%s/%s/hls.m3u8", addr, mediaInfo.getHttpPort(), app, stream)); |
| | | streamInfoResult.setWs_hls(String.format("ws://%s:%s/%s/%s/hls.m3u8", addr, mediaInfo.getHttpPort(), app, stream)); |
| | | streamInfoResult.setFmp4(String.format("http://%s:%s/%s/%s.live.mp4", addr, mediaInfo.getHttpPort(), app, stream)); |
| | | streamInfoResult.setWs_fmp4(String.format("ws://%s:%s/%s/%s.live.mp4", addr, mediaInfo.getHttpPort(), app, stream)); |
| | | streamInfoResult.setTs(String.format("http://%s:%s/%s/%s.live.ts", addr, mediaInfo.getHttpPort(), app, stream)); |
| | | streamInfoResult.setWs_ts(String.format("ws://%s:%s/%s/%s.live.ts", addr, mediaInfo.getHttpPort(), app, stream)); |
| | | streamInfoResult.setFlv(String.format("http://%s:%s/%s/%s.live.flv%s", addr, mediaInfo.getHttpPort(), app, stream, callIdParam)); |
| | | streamInfoResult.setWs_flv(String.format("ws://%s:%s/%s/%s.live.flv%s", addr, mediaInfo.getHttpPort(), app, stream, callIdParam)); |
| | | streamInfoResult.setHls(String.format("http://%s:%s/%s/%s/hls.m3u8%s", addr, mediaInfo.getHttpPort(), app, stream, callIdParam)); |
| | | streamInfoResult.setWs_hls(String.format("ws://%s:%s/%s/%s/hls.m3u8%s", addr, mediaInfo.getHttpPort(), app, stream, callIdParam)); |
| | | streamInfoResult.setFmp4(String.format("http://%s:%s/%s/%s.live.mp4%s", addr, mediaInfo.getHttpPort(), app, stream, callIdParam)); |
| | | streamInfoResult.setWs_fmp4(String.format("ws://%s:%s/%s/%s.live.mp4%s", addr, mediaInfo.getHttpPort(), app, stream, callIdParam)); |
| | | streamInfoResult.setTs(String.format("http://%s:%s/%s/%s.live.ts%s", addr, mediaInfo.getHttpPort(), app, stream, callIdParam)); |
| | | streamInfoResult.setWs_ts(String.format("ws://%s:%s/%s/%s.live.ts%s", addr, mediaInfo.getHttpPort(), app, stream, callIdParam)); |
| | | if (mediaInfo.getHttpSSlPort() != 0) { |
| | | streamInfoResult.setHttps_flv(String.format("https://%s:%s/%s/%s.live.flv", addr, mediaInfo.getHttpSSlPort(), app, stream)); |
| | | streamInfoResult.setWss_flv(String.format("wss://%s:%s/%s/%s.live.flv", addr, mediaInfo.getHttpSSlPort(), app, stream)); |
| | | streamInfoResult.setHttps_hls(String.format("https://%s:%s/%s/%s/hls.m3u8", addr, mediaInfo.getHttpSSlPort(), app, stream)); |
| | | streamInfoResult.setWss_hls(String.format("wss://%s:%s/%s/%s/hls.m3u8", addr, mediaInfo.getHttpSSlPort(), app, stream)); |
| | | streamInfoResult.setHttps_fmp4(String.format("https://%s:%s/%s/%s.live.mp4", addr, mediaInfo.getHttpSSlPort(), app, stream)); |
| | | streamInfoResult.setWss_fmp4(String.format("wss://%s:%s/%s/%s.live.mp4", addr, mediaInfo.getHttpSSlPort(), app, stream)); |
| | | streamInfoResult.setHttps_ts(String.format("https://%s:%s/%s/%s.live.ts", addr, mediaInfo.getHttpSSlPort(), app, stream)); |
| | | streamInfoResult.setWss_ts(String.format("wss://%s:%s/%s/%s.live.ts", addr, mediaInfo.getHttpSSlPort(), app, stream)); |
| | | streamInfoResult.setWss_ts(String.format("wss://%s:%s/%s/%s.live.ts", addr, mediaInfo.getHttpSSlPort(), app, stream)); |
| | | streamInfoResult.setRtc(String.format("https://%s:%s/index/api/webrtc?app=%s&stream=%s&type=%s", mediaInfo.getStreamIp(), mediaInfo.getHttpSSlPort(), app, stream, isPlay?"play":"push")); |
| | | streamInfoResult.setHttps_flv(String.format("https://%s:%s/%s/%s.live.flv%s", addr, mediaInfo.getHttpSSlPort(), app, stream, callIdParam)); |
| | | streamInfoResult.setWss_flv(String.format("wss://%s:%s/%s/%s.live.flv%s", addr, mediaInfo.getHttpSSlPort(), app, stream, callIdParam)); |
| | | streamInfoResult.setHttps_hls(String.format("https://%s:%s/%s/%s/hls.m3u8%s", addr, mediaInfo.getHttpSSlPort(), app, stream, callIdParam)); |
| | | streamInfoResult.setWss_hls(String.format("wss://%s:%s/%s/%s/hls.m3u8%s", addr, mediaInfo.getHttpSSlPort(), app, stream, callIdParam)); |
| | | streamInfoResult.setHttps_fmp4(String.format("https://%s:%s/%s/%s.live.mp4%s", addr, mediaInfo.getHttpSSlPort(), app, stream, callIdParam)); |
| | | streamInfoResult.setWss_fmp4(String.format("wss://%s:%s/%s/%s.live.mp4%s", addr, mediaInfo.getHttpSSlPort(), app, stream, callIdParam)); |
| | | streamInfoResult.setHttps_ts(String.format("https://%s:%s/%s/%s.live.ts%s", addr, mediaInfo.getHttpSSlPort(), app, stream, callIdParam)); |
| | | streamInfoResult.setWss_ts(String.format("wss://%s:%s/%s/%s.live.ts%s", addr, mediaInfo.getHttpSSlPort(), app, stream, callIdParam)); |
| | | streamInfoResult.setWss_ts(String.format("wss://%s:%s/%s/%s.live.ts%s", addr, mediaInfo.getHttpSSlPort(), app, stream, callIdParam)); |
| | | streamInfoResult.setRtc(String.format("https://%s:%s/index/api/webrtc?app=%s&stream=%s&type=%s%s", mediaInfo.getStreamIp(), mediaInfo.getHttpSSlPort(), app, stream, isPlay?"play":"push", StringUtils.isEmpty(callId)?"":"&callId=" + callId)); |
| | | } |
| | | |
| | | streamInfoResult.setTracks(tracks); |
| | |
| | | public StreamInfo onPublishHandler(MediaServerItem mediaServerItem, JSONObject resonse, String deviceId, String channelId) { |
| | | String streamId = resonse.getString("stream"); |
| | | JSONArray tracks = resonse.getJSONArray("tracks"); |
| | | StreamInfo streamInfo = mediaService.getStreamInfoByAppAndStream(mediaServerItem,"rtp", streamId, tracks); |
| | | StreamInfo streamInfo = mediaService.getStreamInfoByAppAndStream(mediaServerItem,"rtp", streamId, tracks, null); |
| | | streamInfo.setDeviceID(deviceId); |
| | | streamInfo.setChannelId(channelId); |
| | | return streamInfo; |
| | |
| | | ParentPlatform platform = storage.queryParentPlatByServerGBId(gbId); |
| | | |
| | | DeviceAlarm deviceAlarm = new DeviceAlarm(); |
| | | deviceAlarm.setCreateTime(DateUtil.getNow()); |
| | | deviceAlarm.setChannelId(gbId); |
| | | deviceAlarm.setAlarmDescription(alarmChannelMessage.getAlarmDescription()); |
| | | deviceAlarm.setAlarmMethod("" + alarmChannelMessage.getAlarmSn()); |
| | |
| | | |
| | | @Override |
| | | public void onMessage(@NotNull Message message, byte[] bytes) { |
| | | if (logger.isDebugEnabled()) { |
| | | logger.debug("收到来自REDIS的GPS通知: {}", new String(message.getBody())); |
| | | } |
| | | GPSMsgInfo gpsMsgInfo = JSON.parseObject(message.getBody(), GPSMsgInfo.class); |
| | | redisCatchStorage.updateGpsMsgInfo(gpsMsgInfo); |
| | | } |
| | |
| | | public boolean start(String app, String stream) { |
| | | boolean result = false; |
| | | StreamProxyItem streamProxy = videoManagerStorager.queryStreamProxy(app, stream); |
| | | if (!streamProxy.isEnable() && streamProxy != null) { |
| | | if (!streamProxy.isEnable() ) { |
| | | JSONObject jsonObject = addStreamProxyToZlm(streamProxy); |
| | | if (jsonObject == null) { |
| | | return false; |
| | | } |
| | | System.out.println(jsonObject); |
| | | if (jsonObject.getInteger("code") == 0) { |
| | | result = true; |
| | | streamProxy.setEnable(true); |
| | |
| | | StreamProxyItem streamProxyDto = videoManagerStorager.queryStreamProxy(app, stream); |
| | | if (streamProxyDto != null && streamProxyDto.isEnable()) { |
| | | JSONObject jsonObject = removeStreamProxyFromZlm(streamProxyDto); |
| | | if (jsonObject.getInteger("code") == 0) { |
| | | if (jsonObject != null && jsonObject.getInteger("code") == 0) { |
| | | streamProxyDto.setEnable(false); |
| | | result = videoManagerStorager.updateStreamProxy(streamProxyDto); |
| | | } |
| | |
| | | } |
| | | streamProxyMapper.deleteAutoRemoveItemByMediaServerId(mediaServerId); |
| | | // 其他的流设置离线 |
| | | streamProxyMapper.updateStatusByMediaServerId(false, mediaServerId); |
| | | streamProxyMapper.updateStatusByMediaServerId(mediaServerId, false); |
| | | String type = "PULL"; |
| | | |
| | | // 发送redis消息 |
| | |
| | | |
| | | @Override |
| | | public int updateStatus(boolean status, String app, String stream) { |
| | | return streamProxyMapper.updateStatus(status, app, stream); |
| | | return streamProxyMapper.updateStatus(app, stream, status); |
| | | } |
| | | |
| | | private void syncPullStream(String mediaServerId){ |
| | |
| | | import com.genersoft.iot.vmp.service.IStreamPushService; |
| | | import com.genersoft.iot.vmp.storager.IRedisCatchStorage; |
| | | import com.genersoft.iot.vmp.storager.dao.*; |
| | | import com.genersoft.iot.vmp.utils.DateUtil; |
| | | import com.github.pagehelper.PageHelper; |
| | | import com.github.pagehelper.PageInfo; |
| | | import org.slf4j.Logger; |
| | |
| | | |
| | | @Autowired |
| | | private StreamPushMapper streamPushMapper; |
| | | |
| | | @Autowired |
| | | private StreamProxyMapper streamProxyMapper; |
| | | |
| | | @Autowired |
| | | private ParentPlatformMapper parentPlatformMapper; |
| | |
| | | streamPushItem.setOriginType(item.getOriginType()); |
| | | streamPushItem.setOriginTypeStr(item.getOriginTypeStr()); |
| | | streamPushItem.setOriginUrl(item.getOriginUrl()); |
| | | streamPushItem.setCreateStamp(item.getCreateStamp() * 1000); |
| | | streamPushItem.setCreateTime(DateUtil.getNow()); |
| | | streamPushItem.setAliveSecond(item.getAliveSecond()); |
| | | streamPushItem.setStatus(true); |
| | | streamPushItem.setStreamType("push"); |
| | |
| | | public boolean saveToGB(GbStream stream) { |
| | | stream.setStreamType("push"); |
| | | stream.setStatus(true); |
| | | stream.setCreateStamp(System.currentTimeMillis()); |
| | | stream.setCreateTime(DateUtil.getNow()); |
| | | int add = gbStreamMapper.add(stream); |
| | | |
| | | // 查找开启了全部直播流共享的上级平台 |
| | |
| | | streamPushMapper.deleteWithoutGBId(mediaServerId); |
| | | gbStreamMapper.deleteWithoutGBId("push", mediaServerId); |
| | | // 其他的流设置未启用 |
| | | gbStreamMapper.updateStatusByMediaServerId(mediaServerId, false); |
| | | streamPushMapper.updateStatusByMediaServerId(mediaServerId, false); |
| | | streamProxyMapper.updateStatusByMediaServerId(mediaServerId, false); |
| | | // 发送流停止消息 |
| | | String type = "PUSH"; |
| | | // 发送redis消息 |
| | |
| | | streamPushItem.setStreamType("push"); |
| | | streamPushItem.setStatus(true); |
| | | streamPushItem.setGbId("34020000004111" + gbId); |
| | | streamPushItem.setCreateStamp(System.currentTimeMillis()); |
| | | streamPushItem.setCreateTime(DateUtil.getNow()); |
| | | gbId ++; |
| | | } |
| | | int limitCount = 30; |
| | |
| | | import com.alibaba.excel.event.AnalysisEventListener; |
| | | import com.genersoft.iot.vmp.media.zlm.dto.StreamPushItem; |
| | | import com.genersoft.iot.vmp.service.IStreamPushService; |
| | | import com.genersoft.iot.vmp.utils.DateUtil; |
| | | import com.genersoft.iot.vmp.vmanager.bean.StreamPushExcelDto; |
| | | import com.google.common.collect.BiMap; |
| | | import com.google.common.collect.HashBiMap; |
| | |
| | | streamPushItem.setGbId(streamPushExcelDto.getGbId()); |
| | | streamPushItem.setStatus(false); |
| | | streamPushItem.setStreamType("push"); |
| | | streamPushItem.setCreateStamp(System.currentTimeMillis()); |
| | | streamPushItem.setCreateTime(DateUtil.getNow()); |
| | | streamPushItem.setMediaServerId(defaultMediaServerId); |
| | | streamPushItem.setName(streamPushExcelDto.getName()); |
| | | streamPushItem.setOriginType(2); |
| | |
| | | import com.genersoft.iot.vmp.storager.dao.dto.User; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.util.StringUtils; |
| | | |
| | | import java.util.List; |
| | | |
| | |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public boolean checkPushAuthority(String callId, String sign) { |
| | | if (StringUtils.isEmpty(callId)) { |
| | | return userMapper.checkPushAuthorityByCallId(sign).size() > 0; |
| | | }else { |
| | | return userMapper.checkPushAuthorityByCallIdAndSign(callId, sign).size() > 0; |
| | | } |
| | | } |
| | | } |
| | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.genersoft.iot.vmp.common.StreamInfo; |
| | | import com.genersoft.iot.vmp.gb28181.bean.*; |
| | | import com.genersoft.iot.vmp.media.zlm.dto.MediaItem; |
| | | import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem; |
| | | import com.genersoft.iot.vmp.media.zlm.dto.StreamPushItem; |
| | | import com.genersoft.iot.vmp.media.zlm.dto.*; |
| | | import com.genersoft.iot.vmp.service.bean.GPSMsgInfo; |
| | | import com.genersoft.iot.vmp.service.bean.MessageForPushChannel; |
| | | import com.genersoft.iot.vmp.service.bean.SSRCInfo; |
| | |
| | | */ |
| | | public boolean deviceIsOnline(String deviceId); |
| | | |
| | | /** |
| | | * 存储推流的鉴权信息 |
| | | * @param app 应用名 |
| | | * @param stream 流 |
| | | * @param streamAuthorityInfo 鉴权信息 |
| | | */ |
| | | void updateStreamAuthorityInfo(String app, String stream, StreamAuthorityInfo streamAuthorityInfo); |
| | | |
| | | /** |
| | | * 移除推流的鉴权信息 |
| | | * @param app 应用名 |
| | | * @param streamId 流 |
| | | */ |
| | | void removeStreamAuthorityInfo(String app, String streamId); |
| | | |
| | | /** |
| | | * 获取推流的鉴权信息 |
| | | * @param app 应用名 |
| | | * @param stream 流 |
| | | * @return |
| | | */ |
| | | StreamAuthorityInfo getStreamAuthorityInfo(String app, String stream); |
| | | } |
| | |
| | | |
| | | /** |
| | | * 设置流离线 |
| | | * @param app |
| | | * @param streamId |
| | | */ |
| | | int mediaOutline(String app, String streamId); |
| | | int mediaOffline(String app, String streamId); |
| | | |
| | | /** |
| | | * 设置流上线 |
| | | */ |
| | | int mediaOnline(String app, String streamId); |
| | | |
| | | /** |
| | | * 设置平台在线/离线 |
| | | * @param online |
| | | */ |
| | | void updateParentPlatformStatus(String platformGbID, boolean online); |
| | | |
| | |
| | | |
| | | List<ChannelSourceInfo> getChannelSource(String platformId, String gbId); |
| | | |
| | | void updateChannelPotion(String deviceId, String channelId, double longitude, double latitude); |
| | | void updateChannelPosition(DeviceChannel deviceChannel); |
| | | } |
| | |
| | | @Repository |
| | | public interface DeviceAlarmMapper { |
| | | |
| | | @Insert("INSERT INTO device_alarm (deviceId, channelId, alarmPriority, alarmMethod, alarmTime, alarmDescription, longitude, latitude, alarmType ) " + |
| | | "VALUES ('${deviceId}', '${channelId}', '${alarmPriority}', '${alarmMethod}', '${alarmTime}', '${alarmDescription}', ${longitude}, ${latitude}, '${alarmType}')") |
| | | @Insert("INSERT INTO device_alarm (deviceId, channelId, alarmPriority, alarmMethod, alarmTime, alarmDescription, longitude, latitude, alarmType , createTime ) " + |
| | | "VALUES ('${deviceId}', '${channelId}', '${alarmPriority}', '${alarmMethod}', '${alarmTime}', '${alarmDescription}', ${longitude}, ${latitude}, '${alarmType}', '${createTime}')") |
| | | int add(DeviceAlarm alarm); |
| | | |
| | | |
| | |
| | | @Insert("INSERT INTO device_channel (channelId, deviceId, name, manufacture, model, owner, civilCode, block, " + |
| | | "address, parental, parentId, safetyWay, registerWay, certNum, certifiable, errCode, secrecy, " + |
| | | "ipAddress, port, password, PTZType, status, streamId, longitude, latitude, longitudeGcj02, latitudeGcj02, " + |
| | | "longitudeWgs84, latitudeWgs84, createTime, updateTime, businessGroupId) " + |
| | | "longitudeWgs84, latitudeWgs84, createTime, updateTime, businessGroupId, gpsTime) " + |
| | | "VALUES ('${channelId}', '${deviceId}', '${name}', '${manufacture}', '${model}', '${owner}', '${civilCode}', '${block}'," + |
| | | "'${address}', ${parental}, '${parentId}', ${safetyWay}, ${registerWay}, '${certNum}', ${certifiable}, ${errCode}, '${secrecy}', " + |
| | | "'${ipAddress}', ${port}, '${password}', ${PTZType}, ${status}, '${streamId}', ${longitude}, ${latitude}, ${longitudeGcj02}, " + |
| | | "${latitudeGcj02}, ${longitudeWgs84}, ${latitudeWgs84},'${createTime}', '${updateTime}', '${businessGroupId}')") |
| | | "${latitudeGcj02}, ${longitudeWgs84}, ${latitudeWgs84},'${createTime}', '${updateTime}', '${businessGroupId}', '${gpsTime}')") |
| | | int add(DeviceChannel channel); |
| | | |
| | | @Update(value = {" <script>" + |
| | |
| | | "<if test='longitudeWgs84 != null'>, longitudeWgs84=${longitudeWgs84}</if>" + |
| | | "<if test='latitudeWgs84 != null'>, latitudeWgs84=${latitudeWgs84}</if>" + |
| | | "<if test='businessGroupId != null'>, businessGroupId=#{businessGroupId}</if>" + |
| | | "<if test='gpsTime != null'>, gpsTime=#{gpsTime}</if>" + |
| | | "WHERE deviceId='${deviceId}' AND channelId='${channelId}'"+ |
| | | " </script>"}) |
| | | int update(DeviceChannel channel); |
| | |
| | | "(channelId, deviceId, name, manufacture, model, owner, civilCode, block, subCount, " + |
| | | " address, parental, parentId, safetyWay, registerWay, certNum, certifiable, errCode, secrecy, " + |
| | | " ipAddress, port, password, PTZType, status, streamId, longitude, latitude, longitudeGcj02, latitudeGcj02, " + |
| | | " longitudeWgs84, latitudeWgs84, createTime, updateTime, businessGroupId) " + |
| | | " longitudeWgs84, latitudeWgs84, createTime, updateTime, businessGroupId, gpsTime) " + |
| | | "values " + |
| | | "<foreach collection='addChannels' index='index' item='item' separator=','> " + |
| | | "('${item.channelId}', '${item.deviceId}', '${item.name}', '${item.manufacture}', '${item.model}', " + |
| | |
| | | "'${item.ipAddress}', ${item.port}, '${item.password}', ${item.PTZType}, ${item.status}, " + |
| | | "'${item.streamId}', ${item.longitude}, ${item.latitude},${item.longitudeGcj02}, " + |
| | | "${item.latitudeGcj02},${item.longitudeWgs84}, ${item.latitudeWgs84},'${item.createTime}', '${item.updateTime}', " + |
| | | "'${item.businessGroupId}') " + |
| | | "'${item.businessGroupId}', '${item.gpsTime}') " + |
| | | "</foreach> " + |
| | | "ON DUPLICATE KEY UPDATE " + |
| | | "updateTime=VALUES(updateTime), " + |
| | |
| | | "latitudeGcj02=VALUES(latitudeGcj02), " + |
| | | "longitudeWgs84=VALUES(longitudeWgs84), " + |
| | | "latitudeWgs84=VALUES(latitudeWgs84), " + |
| | | "businessGroupId=VALUES(businessGroupId) " + |
| | | "businessGroupId=VALUES(businessGroupId), " + |
| | | "gpsTime=VALUES(gpsTime)" + |
| | | "</script>") |
| | | int batchAdd(List<DeviceChannel> addChannels); |
| | | |
| | |
| | | "<if test='item.longitudeWgs84 != null'>, longitudeWgs84=${item.longitudeWgs84}</if>" + |
| | | "<if test='item.latitudeWgs84 != null'>, latitudeWgs84=${item.latitudeWgs84}</if>" + |
| | | "<if test='item.businessGroupId != null'>, businessGroupId=#{item.businessGroupId}</if>" + |
| | | "<if test='item.gpsTime != null'>, gpsTime=#{item.gpsTime}</if>" + |
| | | "WHERE deviceId='${item.deviceId}' AND channelId='${item.channelId}'"+ |
| | | "</foreach>" + |
| | | "</script>"}) |
| | |
| | | " and channelId = #{channelId}") |
| | | int updateChannelSubCount(String deviceId, String channelId); |
| | | |
| | | @Update(value = {"UPDATE device_channel SET latitude=${latitude}, longitude=${longitude} WHERE deviceId=#{deviceId} AND channelId=#{channelId}"}) |
| | | void updatePotion(String deviceId, String channelId, double longitude, double latitude); |
| | | @Update(value = {" <script>" + |
| | | "UPDATE device_channel " + |
| | | "SET " + |
| | | "latitude=${latitude}, " + |
| | | "longitude=${longitude}, " + |
| | | "longitudeGcj02=${longitudeGcj02}, " + |
| | | "latitudeGcj02=${latitudeGcj02}, " + |
| | | "longitudeWgs84=${longitudeWgs84}, " + |
| | | "latitudeWgs84=${latitudeWgs84}, " + |
| | | "gpsTime='${gpsTime}' " + |
| | | "WHERE deviceId=#{deviceId} " + |
| | | " <if test='channelId != null' > AND channelId=#{channelId}</if>" + |
| | | " </script>"}) |
| | | void updatePosition(DeviceChannel deviceChannel); |
| | | |
| | | @Select("SELECT * FROM device_channel WHERE length(trim(streamId)) > 0") |
| | | List<DeviceChannel> getAllChannelInPlay(); |
| | |
| | | |
| | | @Select("select * from device_channel where deviceId=#{deviceId} and SUBSTRING(channelId, 11, 3)=#{typeCode}") |
| | | List<DeviceChannel> getBusinessGroups(String deviceId, String typeCode); |
| | | |
| | | |
| | | } |
| | |
| | | |
| | | import com.genersoft.iot.vmp.gb28181.bean.MobilePosition; |
| | | import org.apache.ibatis.annotations.*; |
| | | //import org.springframework.stereotype.Repository; |
| | | |
| | | @Mapper |
| | | //@Repository |
| | | public interface DeviceMobilePositionMapper { |
| | | |
| | | @Insert("INSERT INTO device_mobile_position (deviceId,channelId, deviceName, time, longitude, latitude, altitude, speed, direction, reportSource, geodeticSystem, cnLng, cnLat) " + |
| | | "VALUES ('${deviceId}','${channelId}', '${deviceName}', '${time}', ${longitude}, ${latitude}, ${altitude}, ${speed}, ${direction}, '${reportSource}', '${geodeticSystem}', '${cnLng}', '${cnLat}')") |
| | | @Insert("INSERT INTO device_mobile_position (deviceId,channelId, deviceName, time, longitude, latitude, altitude, speed, direction, reportSource, longitudeGcj02, latitudeGcj02, longitudeWgs84, latitudeWgs84, createTime) " + |
| | | "VALUES ('${deviceId}','${channelId}', '${deviceName}', '${time}', ${longitude}, ${latitude}, ${altitude}, ${speed}, ${direction}, '${reportSource}', ${longitudeGcj02}, ${latitudeGcj02}, ${longitudeWgs84}, ${latitudeWgs84}, '${createTime}')") |
| | | int insertNewPosition(MobilePosition mobilePosition); |
| | | |
| | | @Select(value = {" <script>" + |
| | | "SELECT * FROM device_mobile_position" + |
| | | " WHERE deviceId = #{deviceId} and channelId = #{channelId} " + |
| | | " WHERE deviceId = #{deviceId}" + |
| | | "<if test=\"channelId != null\"> and channelId = #{channelId}</if>" + |
| | | "<if test=\"startTime != null\"> AND time>=#{startTime}</if>" + |
| | | "<if test=\"endTime != null\"> AND time<=#{endTime}</if>" + |
| | | " ORDER BY time ASC" + |
| | |
| | | public interface GbStreamMapper { |
| | | |
| | | @Insert("REPLACE INTO gb_stream (app, stream, gbId, name, " + |
| | | "longitude, latitude, streamType, mediaServerId, status, createStamp) VALUES" + |
| | | "longitude, latitude, streamType, mediaServerId, status, createTime) VALUES" + |
| | | "('${app}', '${stream}', '${gbId}', '${name}', " + |
| | | "'${longitude}', '${latitude}', '${streamType}', " + |
| | | "'${mediaServerId}', ${status}, ${createStamp})") |
| | | "'${mediaServerId}', ${status}, '${createTime}')") |
| | | @Options(useGeneratedKeys = true, keyProperty = "gbStreamId", keyColumn = "gbStreamId") |
| | | int add(GbStream gbStream); |
| | | |
| | |
| | | List<GbStream> selectAll(String platformId, String catalogId, String query, Boolean pushing, String mediaServerId); |
| | | |
| | | @Select("SELECT * FROM gb_stream WHERE app=#{app} AND stream=#{stream}") |
| | | StreamProxyItem selectOne(String app, String stream); |
| | | GbStream selectOne(String app, String stream); |
| | | |
| | | @Select("SELECT * FROM gb_stream WHERE gbId=#{gbId}") |
| | | List<GbStream> selectByGBId(String gbId); |
| | |
| | | @Select("SELECT gs.* FROM gb_stream gs LEFT JOIN platform_gb_stream pgs " + |
| | | "ON gs.gbStreamId = pgs.gbStreamId WHERE pgs.gbStreamId is NULL") |
| | | List<GbStream> queryStreamNotInPlatform(); |
| | | |
| | | @Update("UPDATE gb_stream " + |
| | | "SET status=${status} " + |
| | | "WHERE app=#{app} AND stream=#{stream}") |
| | | int setStatus(String app, String stream, boolean status); |
| | | |
| | | @Update("UPDATE gb_stream " + |
| | | "SET status=${status} " + |
| | | "WHERE mediaServerId=#{mediaServerId} ") |
| | | void updateStatusByMediaServerId(String mediaServerId, boolean status); |
| | | |
| | | @Delete("DELETE FROM gb_stream WHERE streamType=#{type} AND gbId=NULL AND mediaServerId=#{mediaServerId}") |
| | | void deleteWithoutGBId(String type, String mediaServerId); |
| | |
| | | @Insert("<script> " + |
| | | "INSERT IGNORE into gb_stream " + |
| | | "(app, stream, gbId, name, " + |
| | | "longitude, latitude, streamType, mediaServerId, status, createStamp)" + |
| | | "longitude, latitude, streamType, mediaServerId, status, createTime)" + |
| | | "values " + |
| | | "<foreach collection='subList' index='index' item='item' separator=','> " + |
| | | "('${item.app}', '${item.stream}', '${item.gbId}', '${item.name}', " + |
| | | "'${item.longitude}', '${item.latitude}', '${item.streamType}', " + |
| | | "'${item.mediaServerId}', ${item.status}, ${item.createStamp}) "+ |
| | | "'${item.mediaServerId}', ${item.status}, '${item.createTime}') "+ |
| | | "</foreach> " + |
| | | "</script>") |
| | | @Options(useGeneratedKeys = true, keyProperty = "gbStreamId", keyColumn = "gbStreamId") |
| | |
| | | |
| | | @Insert("INSERT INTO parent_platform (enable, name, serverGBId, serverGBDomain, serverIP, serverPort, deviceGBId, deviceIp, " + |
| | | " devicePort, username, password, expires, keepTimeout, transport, characterSet, ptz, rtcp, " + |
| | | " status, shareAllLiveStream, startOfflinePush, catalogId, administrativeDivision, catalogGroup) " + |
| | | " status, shareAllLiveStream, startOfflinePush, catalogId, administrativeDivision, catalogGroup, createTime, updateTime) " + |
| | | " VALUES (${enable}, '${name}', '${serverGBId}', '${serverGBDomain}', '${serverIP}', ${serverPort}, '${deviceGBId}', '${deviceIp}', " + |
| | | " '${devicePort}', '${username}', '${password}', '${expires}', '${keepTimeout}', '${transport}', '${characterSet}', ${ptz}, ${rtcp}, " + |
| | | " ${status}, ${shareAllLiveStream}, ${startOfflinePush}, #{catalogId}, #{administrativeDivision}, #{catalogGroup})") |
| | | " ${status}, ${shareAllLiveStream}, ${startOfflinePush}, #{catalogId}, #{administrativeDivision}, #{catalogGroup}, #{createTime}, #{updateTime})") |
| | | int addParentPlatform(ParentPlatform parentPlatform); |
| | | |
| | | @Update("UPDATE parent_platform " + |
| | |
| | | "startOfflinePush=${startOfflinePush}, " + |
| | | "catalogGroup=#{catalogGroup}, " + |
| | | "administrativeDivision=#{administrativeDivision}, " + |
| | | "createTime=#{createTime}, " + |
| | | "updateTime=#{updateTime}, " + |
| | | "catalogId=#{catalogId} " + |
| | | "WHERE id=#{id}") |
| | | int updateParentPlatform(ParentPlatform parentPlatform); |
| | |
| | | |
| | | @Update(value = {" <script>" + |
| | | "UPDATE parent_platform " + |
| | | "SET catalogId=#{catalogId}" + |
| | | "SET catalogId=#{catalogId}, updateTime=#{updateTime}" + |
| | | "WHERE serverGBId=#{platformId}"+ |
| | | "</script>"}) |
| | | int setDefaultCatalog(String platformId, String catalogId); |
| | | int setDefaultCatalog(String platformId, String catalogId, String updateTime); |
| | | |
| | | @Select("select 'channel' as name, count(pgc.platformId) count from platform_gb_channel pgc left join device_channel dc on dc.id = pgc.deviceChannelId where pgc.platformId=#{platformId} and dc.channelId =#{gbId} " + |
| | | "union " + |
| | |
| | | @Update("UPDATE stream_proxy " + |
| | | "SET status=#{status} " + |
| | | "WHERE mediaServerId=#{mediaServerId}") |
| | | void updateStatusByMediaServerId(boolean status, String mediaServerId); |
| | | void updateStatusByMediaServerId(String mediaServerId, boolean status); |
| | | |
| | | @Update("UPDATE stream_proxy " + |
| | | "SET status=${status} " + |
| | | "WHERE app=#{app} AND stream=#{stream}") |
| | | int updateStatus(boolean status, String app, String stream); |
| | | int updateStatus(String app, String stream, boolean status); |
| | | |
| | | @Delete("DELETE FROM stream_proxy WHERE enable_remove_none_reader=true AND mediaServerId=#{mediaServerId}") |
| | | void deleteAutoRemoveItemByMediaServerId(String mediaServerId); |
| | |
| | | public interface StreamPushMapper { |
| | | |
| | | @Insert("INSERT INTO stream_push (app, stream, totalReaderCount, originType, originTypeStr, " + |
| | | "createStamp, aliveSecond, mediaServerId, serverId) VALUES" + |
| | | "pushTime, aliveSecond, mediaServerId, serverId, updateTime, createTime) VALUES" + |
| | | "('${app}', '${stream}', '${totalReaderCount}', '${originType}', '${originTypeStr}', " + |
| | | "'${createStamp}', '${aliveSecond}', '${mediaServerId}' , '${serverId}' )") |
| | | "'${pushTime}', '${aliveSecond}', '${mediaServerId}' , '${serverId}' , '${updateTime}' , '${createTime}' )") |
| | | int add(StreamPushItem streamPushItem); |
| | | |
| | | @Update("UPDATE stream_push " + |
| | | "SET app=#{app}," + |
| | | "stream=#{stream}," + |
| | | "mediaServerId=#{mediaServerId}," + |
| | | "totalReaderCount=#{totalReaderCount}, " + |
| | | "originType=#{originType}," + |
| | | "originTypeStr=#{originTypeStr}, " + |
| | | "createStamp=#{createStamp}, " + |
| | | "aliveSecond=#{aliveSecond} " + |
| | | "WHERE app=#{app} AND stream=#{stream}") |
| | | |
| | | @Update(value = {" <script>" + |
| | | "UPDATE stream_push " + |
| | | "SET updateTime='${updateTime}'" + |
| | | "<if test=\"mediaServerId != null\">, mediaServerId='${mediaServerId}'</if>" + |
| | | "<if test=\"totalReaderCount != null\">, totalReaderCount='${totalReaderCount}'</if>" + |
| | | "<if test=\"originType != null\">, originType=${originType}</if>" + |
| | | "<if test=\"originTypeStr != null\">, originTypeStr='${originTypeStr}'</if>" + |
| | | "<if test=\"pushTime != null\">, pushTime='${pushTime}'</if>" + |
| | | "<if test=\"aliveSecond != null\">, aliveSecond='${aliveSecond}'</if>" + |
| | | "WHERE app=#{app} AND stream=#{stream}"+ |
| | | " </script>"}) |
| | | int update(StreamPushItem streamPushItem); |
| | | |
| | | @Delete("DELETE FROM stream_push WHERE app=#{app} AND stream=#{stream}") |
| | |
| | | @Select(value = {" <script>" + |
| | | "SELECT " + |
| | | "st.*, " + |
| | | "gs.gbId, gs.status, gs.name, gs.longitude, gs.latitude, gs.gbStreamId " + |
| | | "gs.gbId, gs.name, gs.longitude, gs.latitude, gs.gbStreamId " + |
| | | "from " + |
| | | "stream_push st " + |
| | | "LEFT JOIN gb_stream gs " + |
| | |
| | | "WHERE " + |
| | | "1=1 " + |
| | | " <if test='query != null'> AND (st.app LIKE '%${query}%' OR st.stream LIKE '%${query}%' OR gs.gbId LIKE '%${query}%' OR gs.name LIKE '%${query}%')</if> " + |
| | | " <if test='pushing == true' > AND (gs.gbId is null OR gs.status=1)</if>" + |
| | | " <if test='pushing == false' > AND gs.status=0</if>" + |
| | | " <if test='pushing == true' > AND (gs.gbId is null OR st.status=1)</if>" + |
| | | " <if test='pushing == false' > AND st.status=0</if>" + |
| | | " <if test='mediaServerId != null' > AND st.mediaServerId=#{mediaServerId} </if>" + |
| | | "order by st.createStamp desc" + |
| | | "order by st.createTime desc" + |
| | | " </script>"}) |
| | | List<StreamPushItem> selectAllForList(String query, Boolean pushing, String mediaServerId); |
| | | |
| | | @Select("SELECT st.*, gs.gbId, gs.status, gs.name, gs.longitude, gs.latitude FROM stream_push st LEFT JOIN gb_stream gs on st.app = gs.app AND st.stream = gs.stream order by st.createStamp desc") |
| | | @Select("SELECT st.*, gs.gbId, gs.name, gs.longitude, gs.latitude FROM stream_push st LEFT JOIN gb_stream gs on st.app = gs.app AND st.stream = gs.stream order by st.createTime desc") |
| | | List<StreamPushItem> selectAll(); |
| | | |
| | | @Select("SELECT st.*, gs.gbId, gs.status, gs.name, gs.longitude, gs.latitude FROM stream_push st LEFT JOIN gb_stream gs on st.app = gs.app AND st.stream = gs.stream WHERE st.app=#{app} AND st.stream=#{stream}") |
| | | @Select("SELECT st.*, gs.gbId, gs.name, gs.longitude, gs.latitude FROM stream_push st LEFT JOIN gb_stream gs on st.app = gs.app AND st.stream = gs.stream WHERE st.app=#{app} AND st.stream=#{stream}") |
| | | StreamPushItem selectOne(String app, String stream); |
| | | |
| | | @Insert("<script>" + |
| | | "Insert IGNORE INTO stream_push (app, stream, totalReaderCount, originType, originTypeStr, " + |
| | | "createStamp, aliveSecond, mediaServerId) " + |
| | | "createTime, aliveSecond, mediaServerId) " + |
| | | "VALUES <foreach collection='streamPushItems' item='item' index='index' separator=','>" + |
| | | "( '${item.app}', '${item.stream}', '${item.totalReaderCount}', #{item.originType}, " + |
| | | "'${item.originTypeStr}',#{item.createStamp}, #{item.aliveSecond}, '${item.mediaServerId}' )" + |
| | | "'${item.originTypeStr}',#{item.createTime}, #{item.aliveSecond}, '${item.mediaServerId}' )" + |
| | | " </foreach>" + |
| | | "</script>") |
| | | @Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id") |
| | |
| | | @Select("SELECT sp.* FROM stream_push sp left join gb_stream gs on gs.app = sp.app and gs.stream= sp.stream WHERE sp.mediaServerId=#{mediaServerId} and gs.gbId is null") |
| | | List<StreamPushItem> selectAllByMediaServerIdWithOutGbID(String mediaServerId); |
| | | |
| | | @Update("UPDATE stream_push " + |
| | | "SET status=${status} " + |
| | | "WHERE app=#{app} AND stream=#{stream}") |
| | | int updateStatus(String app, String stream, boolean status); |
| | | |
| | | @Update("UPDATE stream_push " + |
| | | "SET status=#{status} " + |
| | | "WHERE mediaServerId=#{mediaServerId}") |
| | | void updateStatusByMediaServerId(String mediaServerId, boolean status); |
| | | } |
| | |
| | | @Repository |
| | | public interface UserMapper { |
| | | |
| | | @Insert("INSERT INTO user (username, password, roleId, createTime, updateTime) VALUES" + |
| | | "('${username}', '${password}', '${role.id}', '${createTime}', '${updateTime}')") |
| | | @Insert("INSERT INTO user (username, password, roleId, pushKey, createTime, updateTime) VALUES" + |
| | | "('${username}', '${password}', '${role.id}', '${pushKey}', '${createTime}', '${updateTime}')") |
| | | int add(User user); |
| | | |
| | | @Update(value = {" <script>" + |
| | | "UPDATE user " + |
| | | "SET updateTime='${updateTime}' " + |
| | | "<if test=\"pushKey != null\">, pushKey='${pushKey}'</if>" + |
| | | "<if test=\"role != null\">, roleId='${role.id}'</if>" + |
| | | "<if test=\"password != null\">, password='${password}'</if>" + |
| | | "<if test=\"username != null\">, username='${username}'</if>" + |
| | |
| | | @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<User> selectAll(); |
| | | |
| | | @Select("select * from (select user.*, concat('${callId}_', pushKey) as str1 from user) as u where md5(u.str1) = '${sign}'") |
| | | List<User> checkPushAuthorityByCallIdAndSign(String callId, String sign); |
| | | |
| | | @Select("select * from user where md5(pushKey) = '${sign}'") |
| | | List<User> checkPushAuthorityByCallId(String sign); |
| | | } |
| | |
| | | private String password; |
| | | private String createTime; |
| | | private String updateTime; |
| | | private String pushKey; |
| | | private Role role; |
| | | |
| | | public int getId() { |
| | |
| | | public void setRole(Role role) { |
| | | this.role = role; |
| | | } |
| | | |
| | | public String getPushKey() { |
| | | return pushKey; |
| | | } |
| | | |
| | | public void setPushKey(String pushKey) { |
| | | this.pushKey = pushKey; |
| | | } |
| | | } |
| | |
| | | import com.genersoft.iot.vmp.gb28181.bean.*; |
| | | import com.genersoft.iot.vmp.media.zlm.dto.MediaItem; |
| | | import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem; |
| | | import com.genersoft.iot.vmp.media.zlm.dto.OnPublishHookParam; |
| | | import com.genersoft.iot.vmp.media.zlm.dto.StreamAuthorityInfo; |
| | | import com.genersoft.iot.vmp.service.bean.GPSMsgInfo; |
| | | import com.genersoft.iot.vmp.service.bean.MessageForPushChannel; |
| | | import com.genersoft.iot.vmp.service.bean.ThirdPartyGB; |
| | |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.util.StringUtils; |
| | | |
| | | import java.util.*; |
| | | |
| | |
| | | } |
| | | |
| | | @Override |
| | | public void updateStreamAuthorityInfo(String app, String stream, StreamAuthorityInfo streamAuthorityInfo) { |
| | | String key = VideoManagerConstants.MEDIA_STREAM_AUTHORITY + userSetting.getServerId() + "_" + app+ "_" + stream; |
| | | redis.set(key, streamAuthorityInfo); |
| | | } |
| | | |
| | | @Override |
| | | public void removeStreamAuthorityInfo(String app, String stream) { |
| | | String key = VideoManagerConstants.MEDIA_STREAM_AUTHORITY + userSetting.getServerId() + "_" + app+ "_" + stream ; |
| | | redis.del(key); |
| | | } |
| | | |
| | | @Override |
| | | public StreamAuthorityInfo getStreamAuthorityInfo(String app, String stream) { |
| | | String key = VideoManagerConstants.MEDIA_STREAM_AUTHORITY + userSetting.getServerId() + "_" + app+ "_" + stream ; |
| | | return (StreamAuthorityInfo) redis.get(key); |
| | | |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public MediaItem getStreamInfo(String app, String streamId, String mediaServerId) { |
| | | String scanKey = VideoManagerConstants.WVP_SERVER_STREAM_PREFIX + userSetting.getServerId() + "_*_" + app + "_" + streamId + "_" + mediaServerId; |
| | | |
| | |
| | | public boolean deviceIsOnline(String deviceId) { |
| | | return getDevice(deviceId).getOnline() == 1; |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | */ |
| | | @Override |
| | | public synchronized boolean insertMobilePosition(MobilePosition mobilePosition) { |
| | | if (mobilePosition.getDeviceId().equals(mobilePosition.getChannelId())) { |
| | | mobilePosition.setChannelId(null); |
| | | } |
| | | return deviceMobilePositionMapper.insertNewPosition(mobilePosition) > 0; |
| | | } |
| | | |
| | |
| | | streamProxyItem.setStatus(true); |
| | | String now = DateUtil.getNow(); |
| | | streamProxyItem.setCreateTime(now); |
| | | streamProxyItem.setCreateStamp(System.currentTimeMillis()); |
| | | try { |
| | | if (streamProxyMapper.add(streamProxyItem) > 0) { |
| | | if (!StringUtils.isEmpty(streamProxyItem.getGbId())) { |
| | |
| | | streamPushMapper.addAll(streamPushItems); |
| | | // TODO 待优化 |
| | | for (int i = 0; i < streamPushItems.size(); i++) { |
| | | int onlineResult = gbStreamMapper.setStatus(streamPushItems.get(i).getApp(), streamPushItems.get(i).getStream(), true); |
| | | int onlineResult = mediaOnline(streamPushItems.get(i).getApp(), streamPushItems.get(i).getStream()); |
| | | if (onlineResult > 0) { |
| | | // 发送上线通知 |
| | | eventPublisher.catalogEventPublishForStream(null, streamPushItems.get(i), CatalogEvent.ON); |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | @Override |
| | | public void updateMedia(StreamPushItem streamPushItem) { |
| | | streamPushMapper.del(streamPushItem.getApp(), streamPushItem.getStream()); |
| | | streamPushMapper.add(streamPushItem); |
| | | gbStreamMapper.setStatus(streamPushItem.getApp(), streamPushItem.getStream(), true); |
| | | mediaOffline(streamPushItem.getApp(), streamPushItem.getStream()); |
| | | |
| | | if(!StringUtils.isEmpty(streamPushItem.getGbId() )){ |
| | | // 查找开启了全部直播流共享的上级平台 |
| | |
| | | } |
| | | |
| | | @Override |
| | | public int mediaOutline(String app, String streamId) { |
| | | return gbStreamMapper.setStatus(app, streamId, false); |
| | | public int mediaOffline(String app, String stream) { |
| | | GbStream gbStream = gbStreamMapper.selectOne(app, stream); |
| | | int result; |
| | | if ("proxy".equals(gbStream.getStreamType())) { |
| | | result = streamProxyMapper.updateStatus(app, stream, false); |
| | | }else { |
| | | result = streamPushMapper.updateStatus(app, stream, false); |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | public int mediaOnline(String app, String stream) { |
| | | GbStream gbStream = gbStreamMapper.selectOne(app, stream); |
| | | int result; |
| | | if ("proxy".equals(gbStream.getStreamType())) { |
| | | result = streamProxyMapper.updateStatus(app, stream, true); |
| | | }else { |
| | | result = streamPushMapper.updateStatus(app, stream, true); |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | @Override |
| | |
| | | |
| | | @Override |
| | | public int setDefaultCatalog(String platformId, String catalogId) { |
| | | return platformMapper.setDefaultCatalog(platformId, catalogId); |
| | | return platformMapper.setDefaultCatalog(platformId, catalogId, DateUtil.getNow()); |
| | | } |
| | | |
| | | @Override |
| | |
| | | } |
| | | |
| | | @Override |
| | | public void updateChannelPotion(String deviceId, String channelId, double longitude, double latitude) { |
| | | deviceChannelMapper.updatePotion(deviceId, channelId, longitude, latitude); |
| | | public void updateChannelPosition(DeviceChannel deviceChannel) { |
| | | if (deviceChannel.getChannelId().equals(deviceChannel.getDeviceId())) { |
| | | deviceChannel.setChannelId(null); |
| | | } |
| | | if (deviceChannel.getGpsTime() == null) { |
| | | deviceChannel.setGpsTime(DateUtil.getNow()); |
| | | } |
| | | |
| | | deviceChannelMapper.updatePosition(deviceChannel); |
| | | } |
| | | } |
| | |
| | | import oshi.software.os.OperatingSystem; |
| | | import oshi.util.FormatUtil; |
| | | |
| | | import java.text.DecimalFormat; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | |
| | | @ApiOperation("查询历史轨迹") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "deviceId", value = "设备ID", required = true, dataTypeClass = String.class), |
| | | @ApiImplicitParam(name = "start", value = "开始时间", required = true, dataTypeClass = String.class), |
| | | @ApiImplicitParam(name = "end", value = "结束时间", required = true, dataTypeClass = String.class), |
| | | @ApiImplicitParam(name = "channelId", value = "通道ID", required = false, dataTypeClass = String.class), |
| | | @ApiImplicitParam(name = "start", value = "开始时间", required = false, dataTypeClass = String.class), |
| | | @ApiImplicitParam(name = "end", value = "结束时间", required = false, dataTypeClass = String.class), |
| | | }) |
| | | @GetMapping("/history/{deviceId}/{channelId}") |
| | | @GetMapping("/history/{deviceId}") |
| | | public ResponseEntity<WVPResult<List<MobilePosition>>> positions(@PathVariable String deviceId, |
| | | @PathVariable String channelId, |
| | | @RequestParam(required = false) String channelId, |
| | | @RequestParam(required = false) String start, |
| | | @RequestParam(required = false) String end) { |
| | | // if (logger.isDebugEnabled()) { |
| | |
| | | package com.genersoft.iot.vmp.vmanager.gb28181.media; |
| | | |
| | | import com.genersoft.iot.vmp.common.StreamInfo; |
| | | import com.genersoft.iot.vmp.conf.security.SecurityUtils; |
| | | import com.genersoft.iot.vmp.conf.security.dto.LoginUser; |
| | | import com.genersoft.iot.vmp.media.zlm.dto.OnPublishHookParam; |
| | | import com.genersoft.iot.vmp.media.zlm.dto.StreamAuthorityInfo; |
| | | import com.genersoft.iot.vmp.service.IMediaServerService; |
| | | import com.genersoft.iot.vmp.service.IStreamPushService; |
| | | import com.genersoft.iot.vmp.service.IMediaService; |
| | | import com.genersoft.iot.vmp.storager.IRedisCatchStorage; |
| | | import com.genersoft.iot.vmp.storager.IVideoManagerStorage; |
| | | import com.genersoft.iot.vmp.vmanager.bean.WVPResult; |
| | | import io.swagger.annotations.Api; |
| | |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | |
| | | |
| | | @Api(tags = "媒体流相关") |
| | | @Controller |
| | |
| | | private final static Logger logger = LoggerFactory.getLogger(MediaController.class); |
| | | |
| | | @Autowired |
| | | private IVideoManagerStorage storager; |
| | | |
| | | @Autowired |
| | | private IStreamPushService streamPushService; |
| | | private IRedisCatchStorage redisCatchStorage; |
| | | |
| | | @Autowired |
| | | private IMediaService mediaService; |
| | | |
| | | @Autowired |
| | | private IMediaServerService mediaServerService; |
| | | |
| | | |
| | | /** |
| | |
| | | }) |
| | | @GetMapping(value = "/stream_info_by_app_and_stream") |
| | | @ResponseBody |
| | | public WVPResult<StreamInfo> getStreamInfoByAppAndStream(@RequestParam String app, @RequestParam String stream, @RequestParam(required = false) String mediaServerId){ |
| | | StreamInfo streamInfoByAppAndStreamWithCheck = mediaService.getStreamInfoByAppAndStreamWithCheck(app, stream, mediaServerId); |
| | | public WVPResult<StreamInfo> getStreamInfoByAppAndStream(HttpServletRequest request, @RequestParam String app, |
| | | @RequestParam String stream, |
| | | @RequestParam(required = false) String mediaServerId, |
| | | @RequestParam(required = false) String callId, |
| | | @RequestParam(required = false) Boolean useSourceIpAsStreamIp){ |
| | | boolean authority = false; |
| | | if (callId != null) { |
| | | // 权限校验 |
| | | StreamAuthorityInfo streamAuthorityInfo = redisCatchStorage.getStreamAuthorityInfo(app, stream); |
| | | if (streamAuthorityInfo.getCallId().equals(callId)) { |
| | | authority = true; |
| | | }else { |
| | | WVPResult<StreamInfo> result = new WVPResult<>(); |
| | | result.setCode(401); |
| | | result.setMsg("fail"); |
| | | return result; |
| | | } |
| | | }else { |
| | | // 是否登陆用户, 登陆用户返回完整信息 |
| | | LoginUser userInfo = SecurityUtils.getUserInfo(); |
| | | if (userInfo!= null) { |
| | | authority = true; |
| | | } |
| | | } |
| | | |
| | | StreamInfo streamInfo; |
| | | |
| | | if (useSourceIpAsStreamIp != null && useSourceIpAsStreamIp) { |
| | | String host = request.getHeader("Host"); |
| | | String localAddr = host.split(":")[0]; |
| | | logger.info("使用{}作为返回流的ip", localAddr); |
| | | streamInfo = mediaService.getStreamInfoByAppAndStreamWithCheck(app, stream, mediaServerId, localAddr, authority); |
| | | }else { |
| | | streamInfo = mediaService.getStreamInfoByAppAndStreamWithCheck(app, stream, mediaServerId, authority); |
| | | } |
| | | |
| | | WVPResult<StreamInfo> result = new WVPResult<>(); |
| | | if (streamInfoByAppAndStreamWithCheck != null){ |
| | | if (streamInfo != null){ |
| | | result.setCode(0); |
| | | result.setMsg("scccess"); |
| | | result.setData(streamInfoByAppAndStreamWithCheck); |
| | | result.setData(streamInfo); |
| | | }else { |
| | | result.setCode(-1); |
| | | result.setMsg("fail"); |
| | |
| | | import com.genersoft.iot.vmp.gb28181.transmit.cmd.ISIPCommanderForPlatform; |
| | | import com.genersoft.iot.vmp.storager.IRedisCatchStorage; |
| | | import com.genersoft.iot.vmp.storager.IVideoManagerStorage; |
| | | import com.genersoft.iot.vmp.utils.DateUtil; |
| | | import com.genersoft.iot.vmp.vmanager.bean.WVPResult; |
| | | import com.genersoft.iot.vmp.vmanager.gb28181.platform.bean.ChannelReduce; |
| | | import com.genersoft.iot.vmp.vmanager.gb28181.platform.bean.UpdateChannelParam; |
| | |
| | | wvpResult.setMsg("平台 " + parentPlatform.getServerGBId() + " 已存在"); |
| | | return new ResponseEntity<>(wvpResult, HttpStatus.OK); |
| | | } |
| | | parentPlatform.setCreateTime(DateUtil.getNow()); |
| | | parentPlatform.setUpdateTime(DateUtil.getNow()); |
| | | boolean updateResult = storager.updateParentPlatform(parentPlatform); |
| | | |
| | | if (updateResult) { |
| | |
| | | } |
| | | parentPlatform.setCharacterSet(parentPlatform.getCharacterSet().toUpperCase()); |
| | | ParentPlatform parentPlatformOld = storager.queryParentPlatByServerGBId(parentPlatform.getServerGBId()); |
| | | |
| | | parentPlatform.setUpdateTime(DateUtil.getNow()); |
| | | boolean updateResult = storager.updateParentPlatform(parentPlatform); |
| | | |
| | | if (updateResult) { |
| | |
| | | JSONObject data = jsonObject.getJSONObject("data"); |
| | | if (data != null) { |
| | | result.put("key", data.getString("key")); |
| | | StreamInfo streamInfoResult = mediaService.getStreamInfoByAppAndStreamWithCheck("convert", streamId, mediaInfo.getId()); |
| | | StreamInfo streamInfoResult = mediaService.getStreamInfoByAppAndStreamWithCheck("convert", streamId, mediaInfo.getId(), false); |
| | | result.put("data", streamInfoResult); |
| | | } |
| | | }else { |
| | |
| | | public Object start(String app, String stream){ |
| | | logger.info("启用代理: " + app + "/" + stream); |
| | | boolean result = streamProxyService.start(app, stream); |
| | | if (!result) { |
| | | logger.info("启用代理失败: " + app + "/" + stream); |
| | | } |
| | | return result?"success":"fail"; |
| | | } |
| | | |
| | |
| | | import com.alibaba.excel.EasyExcel; |
| | | import com.alibaba.excel.ExcelReader; |
| | | import com.alibaba.excel.read.metadata.ReadSheet; |
| | | import com.genersoft.iot.vmp.common.StreamInfo; |
| | | import com.genersoft.iot.vmp.conf.security.SecurityUtils; |
| | | import com.genersoft.iot.vmp.conf.security.dto.LoginUser; |
| | | import com.genersoft.iot.vmp.gb28181.bean.GbStream; |
| | | import com.genersoft.iot.vmp.gb28181.transmit.callback.DeferredResultHolder; |
| | | import com.genersoft.iot.vmp.gb28181.transmit.callback.RequestMessage; |
| | | import com.genersoft.iot.vmp.media.zlm.dto.StreamAuthorityInfo; |
| | | import com.genersoft.iot.vmp.media.zlm.dto.StreamPushItem; |
| | | import com.genersoft.iot.vmp.service.IMediaServerService; |
| | | import com.genersoft.iot.vmp.service.IMediaService; |
| | | import com.genersoft.iot.vmp.service.IStreamPushService; |
| | | import com.genersoft.iot.vmp.service.impl.StreamPushUploadFileHandler; |
| | | import com.genersoft.iot.vmp.vmanager.bean.BatchGBStreamParam; |
| | |
| | | import org.springframework.web.context.request.async.DeferredResult; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.io.IOException; |
| | | import java.io.InputStream; |
| | | import java.util.HashMap; |
| | |
| | | |
| | | @Autowired |
| | | private DeferredResultHolder resultHolder; |
| | | |
| | | @Autowired |
| | | private IMediaService mediaService; |
| | | |
| | | @ApiOperation("推流列表查询") |
| | | @ApiImplicitParams({ |
| | |
| | | return result; |
| | | } |
| | | |
| | | /** |
| | | * 获取推流播放地址 |
| | | * @param app 应用名 |
| | | * @param stream 流id |
| | | * @return |
| | | */ |
| | | @ApiOperation("获取推流播放地址") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "app", value = "应用名", dataTypeClass = String.class), |
| | | @ApiImplicitParam(name = "stream", value = "流id", dataTypeClass = String.class), |
| | | @ApiImplicitParam(name = "mediaServerId", value = "媒体服务器id", dataTypeClass = String.class, required = false), |
| | | }) |
| | | @GetMapping(value = "/getPlayUrl") |
| | | @ResponseBody |
| | | public WVPResult<StreamInfo> getPlayUrl(HttpServletRequest request, @RequestParam String app, |
| | | @RequestParam String stream, |
| | | @RequestParam(required = false) String mediaServerId){ |
| | | boolean authority = false; |
| | | // 是否登陆用户, 登陆用户返回完整信息 |
| | | LoginUser userInfo = SecurityUtils.getUserInfo(); |
| | | if (userInfo!= null) { |
| | | authority = true; |
| | | } |
| | | |
| | | StreamInfo streamInfo = mediaService.getStreamInfoByAppAndStreamWithCheck(app, stream, mediaServerId, authority); |
| | | |
| | | WVPResult<StreamInfo> result = new WVPResult<>(); |
| | | if (streamInfo != null){ |
| | | result.setCode(0); |
| | | result.setMsg("scccess"); |
| | | result.setData(streamInfo); |
| | | }else { |
| | | result.setCode(-1); |
| | | result.setMsg("fail"); |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | record-sip: true |
| | | # 是否将日志存储进数据库 |
| | | logInDatebase: true |
| | | # 第三方匹配,用于从stream钟获取有效信息 |
| | | thirdPartyGBIdReg: "[\\s\\S]*" |
| | | |
| | | # 在线文档: swagger-ui(生产环境建议关闭) |
| | | swagger-ui: |
| | |
| | | this.getListLoading = true; |
| | | this.$axios({ |
| | | method: 'get', |
| | | url: '/api/media/stream_info_by_app_and_stream', |
| | | url: '/api/push/getPlayUrl', |
| | | params: { |
| | | app: row.app, |
| | | stream: row.stream, |
| | |
| | | <el-divider direction="vertical"></el-divider> |
| | | <el-button size="medium" icon="el-icon-switch-button" type="text" v-if="scope.row.enable" @click="stop(scope.row)">停用</el-button> |
| | | <el-divider direction="vertical"></el-divider> |
| | | <el-button size="medium" icon="el-icon-check" type="text" :loading="startBtnLaoding" v-if="!scope.row.enable" @click="start(scope.row)">启用</el-button> |
| | | <el-button size="medium" icon="el-icon-check" type="text" :loading="scope.row.startBtnLoading" v-if="!scope.row.enable" @click="start(scope.row)">启用</el-button> |
| | | <el-divider v-if="!scope.row.enable" direction="vertical"></el-divider> |
| | | <el-button size="medium" icon="el-icon-delete" type="text" style="color: #f56c6c" @click="deleteStreamProxy(scope.row)">删除</el-button> |
| | | </template> |
| | |
| | | count:15, |
| | | total:0, |
| | | getListLoading: false, |
| | | startBtnLaoding: false |
| | | startBtnLoading: false |
| | | }; |
| | | }, |
| | | computed: { |
| | |
| | | } |
| | | }).then(function (res) { |
| | | that.total = res.data.total; |
| | | that.streamProxyList = res.data.list; |
| | | for (let i = 0; i < res.data.list.length; i++) { |
| | | res.data.list[i]["startBtnLoading"] = false; |
| | | } |
| | | that.streamProxyList = res.data.list; |
| | | that.getListLoading = false; |
| | | }).catch(function (error) { |
| | | console.log(error); |
| | |
| | | start: function(row){ |
| | | let that = this; |
| | | this.getListLoading = true; |
| | | this.startBtnLaoding = true; |
| | | this.$set(row, 'startBtnLoading', true) |
| | | this.$axios({ |
| | | method: 'get', |
| | | url:`/api/proxy/start`, |
| | |
| | | } |
| | | }).then(function (res) { |
| | | that.getListLoading = false; |
| | | that.startBtnLaoding = false; |
| | | that.$set(row, 'startBtnLoading', false) |
| | | if (res.data == "success"){ |
| | | that.initData() |
| | | }else { |
| | |
| | | }).catch(function (error) { |
| | | console.log(error); |
| | | that.getListLoading = false; |
| | | that.startBtnLaoding = false; |
| | | that.$set(row, 'startBtnLoading', false) |
| | | }); |
| | | }, |
| | | stop: function(row){ |
| | |
| | | import Tile from 'ol/layer/Tile'; |
| | | import VectorLayer from 'ol/layer/Vector'; |
| | | import Style from 'ol/style/Style'; |
| | | import Stroke from 'ol/style/Stroke'; |
| | | import Icon from 'ol/style/Icon'; |
| | | import View from 'ol/View'; |
| | | import Feature from 'ol/Feature'; |
| | |
| | | } |
| | | let line = new LineString(points) |
| | | let lineFeature = new Feature(line); |
| | | |
| | | lineFeature.setStyle(new Style({ |
| | | stroke: new Stroke({ |
| | | width: 4 , |
| | | color: "#0c6d6a", |
| | | }) |
| | | })) |
| | | let source = new VectorSource(); |
| | | source.addFeature(lineFeature); |
| | | let vectorLayer = new VectorLayer({ |
| | |
| | | @close="close()" |
| | | > |
| | | <div v-loading="isLoging"> |
| | | <el-date-picker v-model="searchFrom" type="datetime" placeholder="选择开始日期时间" default-time="00:00:00" size="mini" style="width: 11rem;" align="right" :picker-options="pickerOptions"></el-date-picker> |
| | | <el-date-picker v-model="searchTo" type="datetime" placeholder="选择结束日期时间" default-time="00:00:00" size="mini" style="width: 11rem;" align="right" :picker-options="pickerOptions"></el-date-picker> |
| | | <el-date-picker v-model="searchFrom" type="datetime" placeholder="选择开始日期时间" default-time="00:00:00" value-format="yyyy-MM-dd HH:mm:ss" size="mini" style="width: 11rem;" align="right" :picker-options="pickerOptions"></el-date-picker> |
| | | <el-date-picker v-model="searchTo" type="datetime" placeholder="选择结束日期时间" default-time="00:00:00" value-format="yyyy-MM-dd HH:mm:ss" size="mini" style="width: 11rem;" align="right" :picker-options="pickerOptions"></el-date-picker> |
| | | <el-button icon="el-icon-search" size="mini" type="primary" @click="onSubmit">查询</el-button> |
| | | </div> |
| | | |
| | |
| | | onSubmit: function () { |
| | | console.log("onSubmit"); |
| | | this.isLoging = true; |
| | | this.$axios.get(`/api/position/history/${this.channel.deviceId}/${this.channel.channelId}`, { |
| | | let url = `/api/position/history/${this.channel.deviceId}?start=${this.searchFrom}&end=${this.searchTo}`; |
| | | if (this.channel.channelId) { |
| | | url+="&channelId=${this.channel.channelId}" |
| | | } |
| | | this.$axios.get(url, { |
| | | }).then((res)=> { |
| | | this.isLoging = false; |
| | | if (typeof this.callback == "function") { |
| | |
| | | this.deviceService.getAllSubChannel(false, data.deviceId, data.channelId, this.channelsHandler) |
| | | } |
| | | } |
| | | }, |
| | | { |
| | | label: "查询轨迹", |
| | | icon: "el-icon-map-location", |
| | | disabled: false, |
| | | onClick: () => { |
| | | this.getTrace(data) |
| | | } |
| | | } |
| | | ], |
| | | event, // 鼠标事件信息 |
| | |
| | | } else { |
| | | let positions = []; |
| | | for (let i = 0; i < channelPositions.length; i++) { |
| | | if (channelPositions[i].cnLng * channelPositions[i].cnLat > 0) { |
| | | positions.push([channelPositions[i].cnLng, channelPositions[i].cnLat]) |
| | | if (channelPositions[i][this.longitudeStr] * channelPositions[i][this.latitudeStr] > 0) { |
| | | positions.push([channelPositions[i][this.longitudeStr], channelPositions[i][this.latitudeStr]]) |
| | | } |
| | | |
| | | } |
| | |
| | | <el-menu-item index="/cloudRecord">云端录像</el-menu-item> |
| | | <el-menu-item index="/mediaServerManger">节点管理</el-menu-item> |
| | | <el-menu-item index="/parentPlatformList/15/1">国标级联</el-menu-item> |
| | | <el-menu-item @click="openDoc">在线文档</el-menu-item> |
| | | |
| | | <!-- <el-submenu index="/setting">--> |
| | | <!-- <template slot="title">系统设置</template>--> |
| | | <!-- <el-menu-item index="/setting/web">WEB服务</el-menu-item>--> |
| | | <!-- <el-menu-item index="/setting/sip">国标服务</el-menu-item>--> |
| | | <!-- <el-menu-item index="/setting/media">媒体服务</el-menu-item>--> |
| | | <!-- </el-submenu>--> |
| | | <el-switch v-model="alarmNotify" active-text="报警信息推送" @change="alarmNotifyChannge"></el-switch> |
| | | <!-- <el-menu-item style="float: right;" @click="loginout">退出</el-menu-item>--> |
| | | <el-submenu index="" style="float: right;"> |
| | | <template slot="title">欢迎,{{ this.$cookies.get("session").username }}</template> |
| | | <el-menu-item @click="openDoc">在线文档</el-menu-item> |
| | | <el-menu-item > |
| | | <el-switch v-model="alarmNotify" inactive-text="报警信息推送" @change="alarmNotifyChannge"></el-switch> |
| | | </el-menu-item> |
| | | <el-menu-item @click="changePassword">修改密码</el-menu-item> |
| | | <el-menu-item @click="loginout">注销</el-menu-item> |
| | | </el-submenu> |
| | |
| | | </script> |
| | | <style> |
| | | #UiHeader .el-switch__label { |
| | | color: white; |
| | | color: white ; |
| | | } |
| | | .el-menu--popup .el-menu-item .el-switch .el-switch__label { |
| | | color: white !important; |
| | | } |
| | | #UiHeader .el-switch__label.is-active{ |
| | | color: #409EFF; |