Merge branch 'postgresql' into wvp-28181-2.0

This commit is contained in:
648540858 2023-05-29 09:25:45 +08:00
commit 5639719879
62 changed files with 1780 additions and 1549 deletions

BIN
doc/_media/logo.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 102 KiB

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

21
pom.xml
View File

@ -135,11 +135,30 @@
<version>8.0.30</version> <version>8.0.30</version>
</dependency> </dependency>
<!--postgresql-->
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>42.5.1</version>
</dependency>
<!-- kingbase人大金仓 -->
<!-- 手动下载驱动后安装 -->
<!-- mvn install:install-file -Dfile=/home/lin/soft/kingbase/jdbc-aarch/kingbase8-8.6.0.jar -DgroupId=com.kingbase -DartifactId=kingbase8 -Dversion=8.6.0 -Dpackaging=jar
-->
<dependency>
<groupId>com.kingbase</groupId>
<artifactId>kingbase8</artifactId>
<version>8.6.0</version>
<scope>system</scope>
<systemPath>${basedir}/libs/jdbc-aarch/kingbase8-8.6.0.jar</systemPath>
</dependency>
<!--Mybatis分页插件 --> <!--Mybatis分页插件 -->
<dependency> <dependency>
<groupId>com.github.pagehelper</groupId> <groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper-spring-boot-starter</artifactId> <artifactId>pagehelper-spring-boot-starter</artifactId>
<version>1.4.3</version> <version>1.4.6</version>
</dependency> </dependency>
<!--在线文档 --> <!--在线文档 -->

479
sql/2.6.8升级2.6.9.sql Normal file
View File

@ -0,0 +1,479 @@
alter table device
change deviceId device_id varchar(50) not null;
alter table device
change streamMode stream_mode varchar(50) null;
alter table device
change registerTime register_time varchar(50) null;
alter table device
change keepaliveTime keepalive_time varchar(50) null;
alter table device
change createTime create_time varchar(50) not null;
alter table device
change updateTime update_time varchar(50) not null;
alter table device
change subscribeCycleForCatalog subscribe_cycle_for_catalog bool default false;
alter table device
change subscribeCycleForMobilePosition subscribe_cycle_for_mobile_position bool default false;
alter table device
change mobilePositionSubmissionInterval mobile_position_submission_interval int default 5 not null;
alter table device
change subscribeCycleForAlarm subscribe_cycle_for_alarm bool default false;
alter table device
change hostAddress host_address varchar(50) null;
alter table device
change ssrcCheck ssrc_check bool default false;
alter table device
change geoCoordSys geo_coord_sys varchar(50) not null;
alter table device
change treeType tree_type varchar(50) not null;
alter table device
change mediaServerId media_server_id varchar(50) default 'auto' null;
alter table device
change sdpIp sdp_ip varchar(50) null;
alter table device
change localIp local_ip varchar(50) null;
alter table device
change asMessageChannel as_message_channel bool default false;
alter table device
change keepaliveIntervalTime keepalive_interval_time int null;
alter table device
change online on_line varchar(50) null;
alter table device_alarm
change deviceId device_id varchar(50) not null;
alter table device_alarm
change channelId channel_id varchar(50) not null;
alter table device_alarm
change alarmPriority alarm_priority varchar(50) not null;
alter table device_alarm
change alarmMethod alarm_method varchar(50) null;
alter table device_alarm
change alarmTime alarm_time varchar(50) not null;
alter table device_alarm
change alarmDescription alarm_description varchar(255) null;
alter table device_alarm
change alarmType alarm_type varchar(50) null;
alter table device_alarm
change createTime create_time varchar(50) null;
alter table device_channel
change channelId channel_id varchar(50) not null;
alter table device_channel
change civilCode civil_code varchar(50) null;
alter table device_channel
change parentId parent_id varchar(50) null;
alter table device_channel
change safetyWay safety_way int null;
alter table device_channel
change registerWay register_way int null;
alter table device_channel
change certNum cert_num varchar(50) null;
alter table device_channel
change errCode err_code int null;
alter table device_channel
change endTime end_time varchar(50) null;
alter table device_channel
change ipAddress ip_address varchar(50) null;
alter table device_channel
change PTZType ptz_type int null;
alter table device_channel
change status status bool default false;
alter table device_channel
change streamId stream_id varchar(50) null;
alter table device_channel
change deviceId device_id varchar(50) not null;
alter table device_channel
change hasAudio has_audio bool default false;
alter table device_channel
change createTime create_time varchar(50) not null;
alter table device_channel
change updateTime update_time varchar(50) not null;
alter table device_channel
change subCount sub_count int default 0 null;
alter table device_channel
change longitudeGcj02 longitude_gcj02 double null;
alter table device_channel
change latitudeGcj02 latitude_gcj02 double null;
alter table device_channel
change longitudeWgs84 longitude_wgs84 double null;
alter table device_channel
change latitudeWgs84 latitude_wgs84 double null;
alter table device_channel
change businessGroupId business_group_id varchar(50) null;
alter table device_channel
change gpsTime gps_time varchar(50) null;
alter table device_mobile_position
change deviceId device_id varchar(50) not null;
alter table device_mobile_position
change channelId channel_id varchar(50) not null;
alter table device_mobile_position
change deviceName device_name varchar(255) null;
alter table device_mobile_position
change reportSource report_source varchar(50) null;
alter table device_mobile_position
change longitudeGcj02 longitude_gcj02 double null;
alter table device_mobile_position
change latitudeGcj02 latitude_gcj02 double null;
alter table device_mobile_position
change longitudeWgs84 longitude_wgs84 double null;
alter table device_mobile_position
change latitudeWgs84 latitude_wgs84 double null;
alter table device_mobile_position
change createTime create_time varchar(50) null;
alter table gb_stream
add constraint gb_stream_pk
primary key (gbStreamId);
alter table gb_stream
change gbStreamId gb_stream_id int auto_increment;
alter table gb_stream
change gbId gb_id varchar(50) not null;
alter table gb_stream
change streamType stream_type varchar(50) null;
alter table gb_stream
change mediaServerId media_server_id varchar(50) null;
alter table gb_stream
change createTime create_time varchar(50) null;
alter table log
change createTime create_time varchar(50) not null;
alter table media_server
change hookIp hook_ip varchar(50) not null;
alter table media_server
change sdpIp sdp_ip varchar(50) not null;
alter table media_server
change streamIp stream_ip varchar(50) not null;
alter table media_server
change httpPort http_port int not null;
alter table media_server
change httpSSlPort http_ssl_port int not null;
alter table media_server
change rtmpPort rtmp_port int not null;
alter table media_server
change rtmpSSlPort rtmp_ssl_port int not null;
alter table media_server
change rtpProxyPort rtp_proxy_port int not null;
alter table media_server
change rtspPort rtsp_port int not null;
alter table media_server
change rtspSSLPort rtsp_ssl_port int not null;
alter table media_server
change autoConfig auto_config bool default true;
alter table media_server
change rtpEnable rtp_enable bool default false;
alter table media_server
change rtpPortRange rtp_port_range varchar(50) not null;
alter table media_server
change recordAssistPort record_assist_port int not null;
alter table media_server
change defaultServer default_server bool default false;
alter table media_server
change createTime create_time varchar(50) not null;
alter table media_server
change updateTime update_time varchar(50) not null;
alter table media_server
change hookAliveInterval hook_alive_interval int not null;
alter table parent_platform
change serverGBId server_gb_id varchar(50) not null;
alter table parent_platform
change serverGBDomain server_gb_domain varchar(50) null;
alter table parent_platform
change serverIP server_ip varchar(50) null;
alter table parent_platform
change serverPort server_port int null;
alter table parent_platform
change deviceGBId device_gb_id varchar(50) not null;
alter table parent_platform
change deviceIp device_ip varchar(50) null;
alter table parent_platform
change devicePort device_port varchar(50) null;
alter table parent_platform
change keepTimeout keep_timeout varchar(50) null;
alter table parent_platform
change characterSet character_set varchar(50) null;
alter table parent_platform
change catalogId catalog_id varchar(50) not null;
alter table parent_platform
change startOfflinePush start_offline_push bool default false;
alter table parent_platform
change administrativeDivision administrative_division varchar(50) not null;
alter table parent_platform
change catalogGroup catalog_group int default 1 null;
alter table parent_platform
change createTime create_time varchar(50) null;
alter table parent_platform
change updateTime update_time varchar(50) null;
alter table parent_platform
change treeType tree_type varchar(50) not null;
alter table parent_platform
change asMessageChannel as_message_channel bool default false;
alter table parent_platform
change enable enable bool default false;
alter table parent_platform
change ptz ptz bool default false;
alter table parent_platform
change rtcp rtcp bool default false;
alter table parent_platform
change status status bool default false;
alter table parent_platform
change status status bool default false;
alter table platform_catalog
change platformId platform_id varchar(50) not null;
alter table platform_catalog
change parentId parent_id varchar(50) null;
alter table platform_catalog
change civilCode civil_code varchar(50) null;
alter table platform_catalog
change businessGroupId business_group_id varchar(50) null;
alter table platform_gb_channel
change platformId platform_id varchar(50) not null;
alter table platform_gb_channel
change catalogId catalog_id varchar(50) not null;
alter table platform_gb_channel
change deviceChannelId device_channel_id int not null;
alter table platform_gb_stream
change platformId platform_id varchar(50) not null;
alter table platform_gb_stream
change catalogId catalog_id varchar(50) not null;
alter table platform_gb_stream
change gbStreamId gb_stream_id int not null;
alter table stream_proxy
change mediaServerId media_server_id varchar(50) null;
alter table stream_proxy
change createTime create_time varchar(50) not null;
alter table stream_proxy
change updateTime update_time varchar(50) null;
alter table stream_proxy
change enable_remove_none_reader enable_remove_none_reader bool default false;
alter table stream_proxy
change enable_disable_none_reader enable_disable_none_reader bool default false;
alter table stream_proxy
change enable_audio enable_audio bool default false;
alter table stream_proxy
change enable_mp4 enable_mp4 bool default false;
alter table stream_proxy
change enable enable bool default false;
alter table stream_push
change totalReaderCount total_reader_count varchar(50) null;
alter table stream_push
change originType origin_type int null;
alter table stream_push
change originTypeStr origin_type_str varchar(50) null;
alter table stream_push
change createTime create_time varchar(50) null;
alter table stream_push
change aliveSecond alive_second int null;
alter table stream_push
change mediaServerId media_server_id varchar(50) null;
alter table stream_push
change status status bool default false;
alter table stream_push
change pushTime push_time varchar(50) null;
alter table stream_push
change updateTime update_time varchar(50) null;
alter table stream_push
change pushIng push_ing bool default false;
alter table stream_push
change status status bool default false;
alter table stream_push
change self self bool default false;
alter table stream_push
drop column serverId;
alter table user
change roleId role_id int not null;
alter table user
change createTime create_time varchar(50) not null;
alter table user
change updateTime update_time varchar(50) not null;
alter table user
change pushKey push_key varchar(50) null;
alter table user_role
change createTime create_time varchar(50) not null;
alter table user_role
change updateTime update_time varchar(50) not null;
rename table device to wvp_device;
rename table device_alarm to wvp_device_alarm;
rename table device_channel to wvp_device_channel;
rename table device_mobile_position to wvp_device_mobile_position;
rename table gb_stream to wvp_gb_stream;
rename table log to wvp_log;
rename table media_server to wvp_media_server;
rename table parent_platform to wvp_platform;
rename table platform_catalog to wvp_platform_catalog;
rename table platform_gb_channel to wvp_platform_gb_channel;
rename table platform_gb_stream to wvp_platform_gb_stream;
rename table stream_proxy to wvp_stream_proxy;
rename table stream_push to wvp_stream_push;
rename table user to wvp_user;
rename table user_role to wvp_user_role;

View File

@ -1,13 +1,13 @@
delete from device; delete from wvp-device;
delete from device_alarm; delete from wvp-device_alarm;
delete from device_channel; delete from wvp-device_channel;
delete from device_mobile_position; delete from wvp-device_mobile_position;
delete from gb_stream; delete from wvp-gb_stream;
delete from log; delete from wvp-log;
delete from media_server; delete from wvp-media_server;
delete from parent_platform; delete from wvp-parent_platform;
delete from platform_catalog; delete from wvp-platform_catalog;
delete from platform_gb_channel; delete from wvp-platform_gb_channel;
delete from platform_gb_stream; delete from wvp-platform_gb_stream;
delete from stream_proxy; delete from wvp-stream_proxy;
delete from stream_push; delete from wvp-stream_push;

View File

@ -1,580 +1,287 @@
-- MySQL dump 10.13 Distrib 8.0.31, for Linux (x86_64) /*建表*/
-- create table wvp_device (
-- Host: 127.0.0.1 Database: wvp id serial primary key ,
-- ------------------------------------------------------ device_id character varying(50) not null ,
-- Server version 8.0.30 name character varying(255),
manufacturer character varying(255),
model character varying(255),
firmware character varying(255),
transport character varying(50),
stream_mode character varying(50),
on_line bool default false,
register_time character varying(50),
keepalive_time character varying(50),
ip character varying(50),
create_time character varying(50),
update_time character varying(50),
port integer,
expires integer,
subscribe_cycle_for_catalog integer DEFAULT 0,
subscribe_cycle_for_mobile_position integer DEFAULT 0,
mobile_position_submission_interval integer DEFAULT 5,
subscribe_cycle_for_alarm integer DEFAULT 0,
host_address character varying(50),
charset character varying(50),
ssrc_check bool default false,
geo_coord_sys character varying(50),
tree_type character varying(50),
media_server_id character varying(50),
custom_name character varying(255),
sdp_ip character varying(50),
local_ip character varying(50),
password character varying(255),
as_message_channel bool default false,
keepalive_interval_time integer,
constraint uk_device_device unique (device_id)
);
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; create table wvp_device_alarm (
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; id serial primary key ,
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; device_id character varying(50) not null,
/*!50503 SET NAMES utf8mb4 */; channel_id character varying(50) not null,
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; alarm_priority character varying(50),
/*!40103 SET TIME_ZONE='+00:00' */; alarm_method character varying(50),
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; alarm_time character varying(50),
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; alarm_description character varying(255),
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; longitude double precision,
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; latitude double precision,
alarm_type character varying(50),
create_time character varying(50) not null
);
-- create table wvp_device_channel (
-- Table structure for table `device` id serial primary key ,
-- channel_id character varying(50) not null,
name character varying(255),
manufacture character varying(50),
model character varying(50),
owner character varying(50),
civil_code character varying(50),
block character varying(50),
address character varying(50),
parent_id character varying(50),
safety_way integer,
register_way integer,
cert_num character varying(50),
certifiable integer,
err_code integer,
end_time character varying(50),
secrecy character varying(50),
ip_address character varying(50),
port integer,
password character varying(255),
ptz_type integer,
status bool default false,
longitude double precision,
latitude double precision,
stream_id character varying(50),
device_id character varying(50) not null,
parental character varying(50),
has_audio bool default false,
create_time character varying(50) not null,
update_time character varying(50) not null,
sub_count integer,
longitude_gcj02 double precision,
latitude_gcj02 double precision,
longitude_wgs84 double precision,
latitude_wgs84 double precision,
business_group_id character varying(50),
gps_time character varying(50),
constraint uk_wvp_device_channel_unique_device_channel unique (device_id, channel_id)
);
DROP TABLE IF EXISTS `device`; create table wvp_device_mobile_position (
/*!40101 SET @saved_cs_client = @@character_set_client */; id serial primary key,
/*!50503 SET character_set_client = utf8mb4 */; device_id character varying(50) not null,
CREATE TABLE `device` ( channel_id character varying(50) not null,
`id` int NOT NULL AUTO_INCREMENT, device_name character varying(255),
`deviceId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, time character varying(50),
`name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, longitude double precision,
`manufacturer` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, latitude double precision,
`model` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, altitude double precision,
`firmware` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, speed double precision,
`transport` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, direction double precision,
`streamMode` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, report_source character varying(50),
`online` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, longitude_gcj02 double precision,
`mediaServerId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, latitude_gcj02 double precision,
`registerTime` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, longitude_wgs84 double precision,
`keepaliveTime` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, latitude_wgs84 double precision,
`ip` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, create_time character varying(50)
`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 DEFAULT NULL,
`expires` int DEFAULT NULL,
`keepaliveIntervalTime` int DEFAULT NULL,
`subscribeCycleForCatalog` int DEFAULT NULL,
`hostAddress` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT 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',
`asMessageChannel` 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,
`custom_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
`password` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
`sdpIp` varchar(50) COLLATE utf8mb4_general_ci DEFAULT NULL,
`localIp` varchar(50) COLLATE utf8mb4_general_ci DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `device_deviceId_uindex` (`deviceId`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
-- create table wvp_gb_stream (
-- Dumping data for table `device` gb_stream_id serial primary key,
-- app character varying(255) not null,
stream character varying(255) not null,
gb_id character varying(50) not null,
name character varying(255),
longitude double precision,
latitude double precision,
stream_type character varying(50),
media_server_id character varying(50),
create_time character varying(50),
constraint uk_gb_stream_unique_gb_id unique (gb_id),
constraint uk_gb_stream_unique_app_stream unique (app, stream)
);
LOCK TABLES `device` WRITE; create table wvp_log (
/*!40000 ALTER TABLE `device` DISABLE KEYS */; id serial primary key ,
/*!40000 ALTER TABLE `device` ENABLE KEYS */; name character varying(50),
UNLOCK TABLES; type character varying(50),
uri character varying(200),
address character varying(50),
result character varying(50),
timing bigint,
username character varying(50),
create_time character varying(50)
);
-- create table wvp_media_server (
-- Table structure for table `device_alarm` id character varying(255) primary key ,
-- ip character varying(50),
hook_ip character varying(50),
sdp_ip character varying(50),
stream_ip character varying(50),
http_port integer,
http_ssl_port integer,
rtmp_port integer,
rtmp_ssl_port integer,
rtp_proxy_port integer,
rtsp_port integer,
rtsp_ssl_port integer,
auto_config bool default false,
secret character varying(50),
rtp_enable bool default false,
rtp_port_range character varying(50),
record_assist_port integer,
default_server bool default false,
create_time character varying(50),
update_time character varying(50),
hook_alive_interval integer,
constraint uk_media_server_unique_ip_http_port unique (ip, http_port)
);
DROP TABLE IF EXISTS `device_alarm`; create table wvp_platform (
/*!40101 SET @saved_cs_client = @@character_set_client */; id serial primary key ,
/*!50503 SET character_set_client = utf8mb4 */; enable bool default false,
CREATE TABLE `device_alarm` ( name character varying(255),
`id` int NOT NULL AUTO_INCREMENT, server_gb_id character varying(50),
`deviceId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, server_gb_domain character varying(50),
`channelId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, server_ip character varying(50),
`alarmPriority` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, server_port integer,
`alarmMethod` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, device_gb_id character varying(50),
`alarmTime` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, device_ip character varying(50),
`alarmDescription` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, device_port character varying(50),
`longitude` double DEFAULT NULL, username character varying(255),
`latitude` double DEFAULT NULL, password character varying(50),
`alarmType` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, expires character varying(50),
`createTime` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, keep_timeout character varying(50),
PRIMARY KEY (`id`) USING BTREE transport character varying(50),
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC; character_set character varying(50),
/*!40101 SET character_set_client = @saved_cs_client */; catalog_id character varying(50),
ptz bool default false,
rtcp bool default false,
status bool default false,
start_offline_push bool default false,
administrative_division character varying(50),
catalog_group integer,
create_time character varying(50),
update_time character varying(50),
tree_type character varying(50),
as_message_channel bool default false,
constraint uk_platform_unique_server_gb_id unique (server_gb_id)
);
-- create table wvp_platform_catalog (
-- Dumping data for table `device_alarm` id character varying(50),
-- platform_id character varying(50),
name character varying(255),
parent_id character varying(50),
civil_code character varying(50),
business_group_id character varying(50),
constraint uk_platform_catalog_id_platform_id unique (id, platform_id)
);
LOCK TABLES `device_alarm` WRITE; create table wvp_platform_gb_channel (
/*!40000 ALTER TABLE `device_alarm` DISABLE KEYS */; id serial primary key ,
/*!40000 ALTER TABLE `device_alarm` ENABLE KEYS */; platform_id character varying(50),
UNLOCK TABLES; catalog_id character varying(50),
device_channel_id integer,
constraint uk_platform_gb_channel_platform_id_catalog_id_device_channel_id unique (platform_id, catalog_id, device_channel_id)
);
-- create table wvp_platform_gb_stream (
-- Table structure for table `device_channel` id serial primary key,
-- platform_id character varying(50),
catalog_id character varying(50),
gb_stream_id integer,
constraint uk_platform_gb_stream_platform_id_catalog_id_gb_stream_id unique (platform_id, catalog_id, gb_stream_id)
);
DROP TABLE IF EXISTS `device_channel`; create table wvp_stream_proxy (
/*!40101 SET @saved_cs_client = @@character_set_client */; id serial primary key,
/*!50503 SET character_set_client = utf8mb4 */; type character varying(50),
CREATE TABLE `device_channel` ( app character varying(255),
`id` int NOT NULL AUTO_INCREMENT, stream character varying(255),
`channelId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, url character varying(255),
`name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, src_url character varying(255),
`manufacture` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, dst_url character varying(255),
`model` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, timeout_ms integer,
`owner` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, ffmpeg_cmd_key character varying(255),
`civilCode` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, rtp_type character varying(50),
`block` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, media_server_id character varying(50),
`address` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, enable_audio bool default false,
`parentId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, enable_mp4 bool default false,
`safetyWay` int DEFAULT NULL, enable bool default false,
`registerWay` int DEFAULT NULL, status boolean,
`certNum` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, enable_remove_none_reader bool default false,
`certifiable` int DEFAULT NULL, create_time character varying(50),
`errCode` int DEFAULT NULL, name character varying(255),
`endTime` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, update_time character varying(50),
`secrecy` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, enable_disable_none_reader bool default false,
`ipAddress` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, constraint uk_stream_proxy_app_stream unique (app, stream)
`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) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `device_channel_id_uindex` (`id`),
UNIQUE KEY `device_channel_pk` (`channelId`,`deviceId`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
-- create table wvp_stream_push (
-- Dumping data for table `device_channel` id serial primary key,
-- app character varying(255),
stream character varying(255),
total_reader_count character varying(50),
origin_type integer,
origin_type_str character varying(50),
create_time character varying(50),
alive_second integer,
media_server_id character varying(50),
push_time character varying(50),
status bool default false,
update_time character varying(50),
push_ing bool default false,
self bool default false,
constraint uk_stream_push_app_stream unique (app, stream)
);
LOCK TABLES `device_channel` WRITE; create table wvp_user (
/*!40000 ALTER TABLE `device_channel` DISABLE KEYS */; id serial primary key,
/*!40000 ALTER TABLE `device_channel` ENABLE KEYS */; username character varying(255),
UNLOCK TABLES; password character varying(255),
role_id integer,
create_time character varying(50),
update_time character varying(50),
push_key character varying(50),
constraint uk_user_username unique (username)
);
-- create table wvp_user_role (
-- Table structure for table `device_mobile_position` id serial primary key,
-- name character varying(50),
authority character varying(50),
create_time character varying(50),
update_time character varying(50)
);
DROP TABLE IF EXISTS `device_mobile_position`; /*初始数据*/
/*!40101 SET @saved_cs_client = @@character_set_client */; INSERT INTO wvp_user VALUES (1, 'admin','21232f297a57a5a743894a0e4a801fc3',1,'2021-04-13 14:14:57','2021-04-13 14:14:57','3e80d1762a324d5b0ff636e0bd16f1e3');
/*!50503 SET character_set_client = utf8mb4 */; INSERT INTO wvp_user_role VALUES (1, 'admin','0','2021-04-13 14:14:57','2021-04-13 14:14:57');
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,
`longitudeGcj02` double DEFAULT NULL,
`latitudeGcj02` double DEFAULT NULL,
`longitudeWgs84` double DEFAULT NULL,
`latitudeWgs84` double DEFAULT NULL,
`createTime` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `device_mobile_position`
--
LOCK TABLES `device_mobile_position` WRITE;
/*!40000 ALTER TABLE `device_mobile_position` DISABLE KEYS */;
/*!40000 ALTER TABLE `device_mobile_position` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `gb_stream`
--
DROP TABLE IF EXISTS `gb_stream`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `gb_stream` (
`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) CHARACTER SET utf8mb4 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=1 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `gb_stream`
--
LOCK TABLES `gb_stream` WRITE;
/*!40000 ALTER TABLE `gb_stream` DISABLE KEYS */;
/*!40000 ALTER TABLE `gb_stream` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `log`
--
DROP TABLE IF EXISTS `log`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `log` (
`id` int 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=1 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `log`
--
LOCK TABLES `log` WRITE;
/*!40000 ALTER TABLE `log` DISABLE KEYS */;
/*!40000 ALTER TABLE `log` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `media_server`
--
DROP TABLE IF EXISTS `media_server`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `media_server` (
`id` varchar(255) 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,
`rtpEnable` int NOT NULL,
`rtpPortRange` 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 */;
--
-- Dumping data for table `media_server`
--
LOCK TABLES `media_server` WRITE;
/*!40000 ALTER TABLE `media_server` DISABLE KEYS */;
/*!40000 ALTER TABLE `media_server` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `parent_platform`
--
DROP TABLE IF EXISTS `parent_platform`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `parent_platform` (
`id` int 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,
`asMessageChannel` int DEFAULT '0',
`status` bit(1) 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) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
`updateTime` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
`treeType` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `parent_platform_id_uindex` (`id`),
UNIQUE KEY `parent_platform_pk` (`serverGBId`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `parent_platform`
--
LOCK TABLES `parent_platform` WRITE;
/*!40000 ALTER TABLE `parent_platform` DISABLE KEYS */;
/*!40000 ALTER TABLE `parent_platform` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `platform_catalog`
--
DROP TABLE IF EXISTS `platform_catalog`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `platform_catalog` (
`id` varchar(50) 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,
`civilCode` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
`businessGroupId` 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 */;
--
-- Dumping data for table `platform_catalog`
--
LOCK TABLES `platform_catalog` WRITE;
/*!40000 ALTER TABLE `platform_catalog` DISABLE KEYS */;
/*!40000 ALTER TABLE `platform_catalog` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `platform_gb_channel`
--
DROP TABLE IF EXISTS `platform_gb_channel`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `platform_gb_channel` (
`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`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `platform_gb_channel`
--
LOCK TABLES `platform_gb_channel` WRITE;
/*!40000 ALTER TABLE `platform_gb_channel` DISABLE KEYS */;
/*!40000 ALTER TABLE `platform_gb_channel` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `platform_gb_stream`
--
DROP TABLE IF EXISTS `platform_gb_stream`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `platform_gb_stream` (
`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,
`gbStreamId` int NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `platform_gb_stream_pk` (`platformId`,`catalogId`,`gbStreamId`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `platform_gb_stream`
--
LOCK TABLES `platform_gb_stream` WRITE;
/*!40000 ALTER TABLE `platform_gb_stream` DISABLE KEYS */;
/*!40000 ALTER TABLE `platform_gb_stream` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `stream_proxy`
--
DROP TABLE IF EXISTS `stream_proxy`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `stream_proxy` (
`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_audio` 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) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
`enable_disable_none_reader` bit(1) DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `stream_proxy_pk` (`app`,`stream`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `stream_proxy`
--
LOCK TABLES `stream_proxy` WRITE;
/*!40000 ALTER TABLE `stream_proxy` DISABLE KEYS */;
/*!40000 ALTER TABLE `stream_proxy` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `stream_push`
--
DROP TABLE IF EXISTS `stream_push`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `stream_push` (
`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) CHARACTER SET utf8mb4 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) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
`pushTime` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
`status` int DEFAULT NULL,
`updateTime` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
`pushIng` int DEFAULT NULL,
`self` int DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `stream_push_pk` (`app`,`stream`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `stream_push`
--
LOCK TABLES `stream_push` WRITE;
/*!40000 ALTER TABLE `stream_push` DISABLE KEYS */;
/*!40000 ALTER TABLE `stream_push` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `user`
--
DROP TABLE IF EXISTS `user`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `user` (
`id` int NOT NULL AUTO_INCREMENT,
`username` varchar(255) 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) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
PRIMARY KEY (`id`) USING BTREE,
UNIQUE KEY `user_username_uindex` (`username`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `user`
--
LOCK TABLES `user` WRITE;
/*!40000 ALTER TABLE `user` DISABLE KEYS */;
INSERT INTO `user` VALUES (1,'admin','21232f297a57a5a743894a0e4a801fc3',1,'2021-04-13 14:14:57','2021-04-13 14:14:57','3e80d1762a324d5b0ff636e0bd16f1e3');
/*!40000 ALTER TABLE `user` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `user_role`
--
DROP TABLE IF EXISTS `user_role`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `user_role` (
`id` int 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=1 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `user_role`
--
LOCK TABLES `user_role` WRITE;
/*!40000 ALTER TABLE `user_role` DISABLE KEYS */;
INSERT INTO `user_role` VALUES (1,'admin','0','2021-04-13 14:14:57','2021-04-13 14:14:57');
/*!40000 ALTER TABLE `user_role` ENABLE KEYS */;
UNLOCK TABLES;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-- Dump completed on 2022-11-29 11:47:46

View File

@ -77,8 +77,8 @@ public class Device {
/** /**
* 在线 * 在线
*/ */
@Schema(description = "是否在线,1为在线0为离线") @Schema(description = "是否在线,true为在线false为离线")
private int online; private boolean onLine;
/** /**
@ -140,7 +140,7 @@ public class Device {
/** /**
* 目录订阅周期0为不订阅 * 目录订阅周期0为不订阅
*/ */
@Schema(description = "目录订阅周期,0为不订阅") @Schema(description = "目录订阅周期,o为不订阅")
private int subscribeCycleForCatalog; private int subscribeCycleForCatalog;
/** /**
@ -286,12 +286,12 @@ public class Device {
this.hostAddress = hostAddress; this.hostAddress = hostAddress;
} }
public int getOnline() { public boolean isOnLine() {
return online; return onLine;
} }
public void setOnline(int online) { public void setOnLine(boolean onLine) {
this.online = online; this.onLine = onLine;
} }
public int getChannelCount() { public int getChannelCount() {

View File

@ -172,7 +172,7 @@ public class DeviceChannel {
* 遇到过NVR下的IPC下发信令可以推流 但是 Status 响应 OFF * 遇到过NVR下的IPC下发信令可以推流 但是 Status 响应 OFF
*/ */
@Schema(description = "在线/离线, 1在线,0离线") @Schema(description = "在线/离线, 1在线,0离线")
private int status; private boolean status;
/** /**
* 经度 * 经度
@ -455,11 +455,11 @@ public class DeviceChannel {
this.PTZTypeText = PTZTypeText; this.PTZTypeText = PTZTypeText;
} }
public int getStatus() { public boolean isStatus() {
return status; return status;
} }
public void setStatus(int status) { public void setStatus(boolean status) {
this.status = status; this.status = status;
} }

View File

@ -10,7 +10,7 @@ import io.swagger.v3.oas.annotations.media.Schema;
public class GbStream extends PlatformGbStream{ public class GbStream extends PlatformGbStream{
@Schema(description = "ID") @Schema(description = "ID")
private Integer gbStreamId; private int gbStreamId;
@Schema(description = "应用名") @Schema(description = "应用名")
private String app; private String app;
@Schema(description = "流ID") @Schema(description = "流ID")

View File

@ -5,7 +5,7 @@ import io.swagger.v3.oas.annotations.media.Schema;
public class PlatformGbStream { public class PlatformGbStream {
@Schema(description = "ID") @Schema(description = "ID")
private Integer gbStreamId; private int gbStreamId;
@Schema(description = "平台ID") @Schema(description = "平台ID")
private String platformId; private String platformId;

View File

@ -66,7 +66,7 @@ public interface ISIPCommanderForPlatform {
* @param fromTag * @param fromTag
* @return * @return
*/ */
void deviceStatusResponse(ParentPlatform parentPlatform,String channelId, String sn, String fromTag,int status) throws SipException, InvalidArgumentException, ParseException; void deviceStatusResponse(ParentPlatform parentPlatform,String channelId, String sn, String fromTag,boolean status) throws SipException, InvalidArgumentException, ParseException;
/** /**
* 向上级回复移动位置订阅消息 * 向上级回复移动位置订阅消息

View File

@ -221,7 +221,7 @@ public class SIPCommanderFroPlatform implements ISIPCommanderForPlatform {
if (!channel.getChannelId().equals(parentPlatform.getDeviceGBId())) { if (!channel.getChannelId().equals(parentPlatform.getDeviceGBId())) {
catalogXml.append("<Parental>" + channel.getParental() + "</Parental>\r\n"); catalogXml.append("<Parental>" + channel.getParental() + "</Parental>\r\n");
if (channel.getParental() == 0) { if (channel.getParental() == 0) {
catalogXml.append("<Status>" + (channel.getStatus() == 0 ? "OFF" : "ON") + "</Status>\r\n"); catalogXml.append("<Status>" + (channel.isStatus() ? "ON" : "OFF") + "</Status>\r\n");
} }
} }
if (channel.getParental() == 0) { if (channel.getParental() == 0) {
@ -250,7 +250,7 @@ public class SIPCommanderFroPlatform implements ISIPCommanderForPlatform {
catalogXml.append("<Port>" + channel.getPort() + "</Port>\r\n"); catalogXml.append("<Port>" + channel.getPort() + "</Port>\r\n");
catalogXml.append("<Password>" + channel.getPort() + "</Password>\r\n"); catalogXml.append("<Password>" + channel.getPort() + "</Password>\r\n");
catalogXml.append("<PTZType>" + channel.getPTZType() + "</PTZType>\r\n"); catalogXml.append("<PTZType>" + channel.getPTZType() + "</PTZType>\r\n");
catalogXml.append("<Status>" + (channel.getStatus() == 1?"ON":"OFF") + "</Status>\r\n"); catalogXml.append("<Status>" + (channel.isStatus() ? "ON":"OFF") + "</Status>\r\n");
catalogXml.append("<Longitude>" + catalogXml.append("<Longitude>" +
(channel.getLongitudeWgs84() != 0? channel.getLongitudeWgs84():channel.getLongitude()) (channel.getLongitudeWgs84() != 0? channel.getLongitudeWgs84():channel.getLongitude())
+ "</Longitude>\r\n"); + "</Longitude>\r\n");
@ -377,11 +377,11 @@ public class SIPCommanderFroPlatform implements ISIPCommanderForPlatform {
* @return * @return
*/ */
@Override @Override
public void deviceStatusResponse(ParentPlatform parentPlatform,String channelId, String sn, String fromTag,int status) throws SipException, InvalidArgumentException, ParseException { public void deviceStatusResponse(ParentPlatform parentPlatform,String channelId, String sn, String fromTag,boolean status) throws SipException, InvalidArgumentException, ParseException {
if (parentPlatform == null) { if (parentPlatform == null) {
return ; return ;
} }
String statusStr = (status==1)?"ONLINE":"OFFLINE"; String statusStr = (status)?"ONLINE":"OFFLINE";
String characterSet = parentPlatform.getCharacterSet(); String characterSet = parentPlatform.getCharacterSet();
StringBuffer deviceStatusXml = new StringBuffer(600); StringBuffer deviceStatusXml = new StringBuffer(600);
deviceStatusXml.append("<?xml version=\"1.0\" encoding=\"" + characterSet + "\"?>\r\n") deviceStatusXml.append("<?xml version=\"1.0\" encoding=\"" + characterSet + "\"?>\r\n")
@ -542,7 +542,7 @@ public class SIPCommanderFroPlatform implements ISIPCommanderForPlatform {
catalogXml.append("<Manufacturer>" + channel.getManufacture() + "</Manufacturer>\r\n") catalogXml.append("<Manufacturer>" + channel.getManufacture() + "</Manufacturer>\r\n")
.append("<Secrecy>" + channel.getSecrecy() + "</Secrecy>\r\n") .append("<Secrecy>" + channel.getSecrecy() + "</Secrecy>\r\n")
.append("<RegisterWay>" + channel.getRegisterWay() + "</RegisterWay>\r\n") .append("<RegisterWay>" + channel.getRegisterWay() + "</RegisterWay>\r\n")
.append("<Status>" + (channel.getStatus() == 0 ? "OFF" : "ON") + "</Status>\r\n"); .append("<Status>" + (channel.isStatus() ? "ON" : "OFF") + "</Status>\r\n");
if (channel.getChannelType() != 2) { // 业务分组/虚拟组织/行政区划 不设置以下属性 if (channel.getChannelType() != 2) { // 业务分组/虚拟组织/行政区划 不设置以下属性
catalogXml.append("<Model>" + channel.getModel() + "</Model>\r\n") catalogXml.append("<Model>" + channel.getModel() + "</Model>\r\n")

View File

@ -65,7 +65,7 @@ public class NotifyRequestForCatalogProcessor extends SIPRequestProcessorParent
String deviceId = SipUtils.getUserIdFromFromHeader(fromHeader); String deviceId = SipUtils.getUserIdFromFromHeader(fromHeader);
Device device = redisCatchStorage.getDevice(deviceId); Device device = redisCatchStorage.getDevice(deviceId);
if (device == null || device.getOnline() == 0) { if (device == null || !device.isOnLine()) {
logger.warn("[收到目录订阅]{}, 但是设备已经离线", (device != null ? device.getDeviceId():"" )); logger.warn("[收到目录订阅]{}, 但是设备已经离线", (device != null ? device.getDeviceId():"" ));
return; return;
} }

View File

@ -372,7 +372,7 @@ public class NotifyRequestProcessor extends SIPRequestProcessorParent implements
String deviceId = SipUtils.getUserIdFromFromHeader(fromHeader); String deviceId = SipUtils.getUserIdFromFromHeader(fromHeader);
Device device = redisCatchStorage.getDevice(deviceId); Device device = redisCatchStorage.getDevice(deviceId);
if (device == null || device.getOnline() == 0) { if (device == null || !device.isOnLine()) {
logger.warn("[收到目录订阅]{}, 但是设备已经离线", (device != null ? device.getDeviceId():"" )); logger.warn("[收到目录订阅]{}, 但是设备已经离线", (device != null ? device.getDeviceId():"" ));
return; return;
} }

View File

@ -166,7 +166,7 @@ public class RegisterRequestProcessor extends SIPRequestProcessorParent implemen
device.setGeoCoordSys("WGS84"); device.setGeoCoordSys("WGS84");
device.setTreeType("CivilCode"); device.setTreeType("CivilCode");
device.setDeviceId(deviceId); device.setDeviceId(deviceId);
device.setOnline(0); device.setOnLine(false);
} }
device.setIp(remoteAddressInfo.getIp()); device.setIp(remoteAddressInfo.getIp());
device.setPort(remoteAddressInfo.getPort()); device.setPort(remoteAddressInfo.getPort());

View File

@ -83,12 +83,12 @@ public class KeepaliveNotifyMessageHandler extends SIPRequestProcessorParent imp
device.setKeepaliveTime(DateUtil.getNow()); device.setKeepaliveTime(DateUtil.getNow());
if (device.getOnline() == 1) { if (device.isOnLine()) {
deviceService.updateDevice(device); deviceService.updateDevice(device);
}else { }else {
// 对于已经离线的设备判断他的注册是否已经过期 // 对于已经离线的设备判断他的注册是否已经过期
if (!deviceService.expire(device)){ if (!deviceService.expire(device)){
device.setOnline(0); device.setOnLine(false);
deviceService.online(device, null); deviceService.online(device, null);
} }
} }

View File

@ -77,7 +77,7 @@ public class DeviceStatusQueryMessageHandler extends SIPRequestProcessorParent i
return; return;
} }
try { try {
cmderFroPlatform.deviceStatusResponse(parentPlatform,channelId, sn, fromHeader.getTag(),deviceChannel.getStatus()); cmderFroPlatform.deviceStatusResponse(parentPlatform,channelId, sn, fromHeader.getTag(),deviceChannel.isStatus());
} catch (SipException | InvalidArgumentException | ParseException e) { } catch (SipException | InvalidArgumentException | ParseException e) {
logger.error("[命令发送失败] 国标级联 DeviceStatus查询回复: {}", e.getMessage()); logger.error("[命令发送失败] 国标级联 DeviceStatus查询回复: {}", e.getMessage());
} }

View File

@ -1,18 +1,13 @@
package com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.response.cmd; package com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.response.cmd;
import com.genersoft.iot.vmp.common.VideoManagerConstants;
import com.genersoft.iot.vmp.conf.SipConfig;
import com.genersoft.iot.vmp.gb28181.bean.Device; import com.genersoft.iot.vmp.gb28181.bean.Device;
import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform; import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform;
import com.genersoft.iot.vmp.gb28181.event.EventPublisher;
import com.genersoft.iot.vmp.gb28181.transmit.callback.DeferredResultHolder; import com.genersoft.iot.vmp.gb28181.transmit.callback.DeferredResultHolder;
import com.genersoft.iot.vmp.gb28181.transmit.callback.RequestMessage; import com.genersoft.iot.vmp.gb28181.transmit.callback.RequestMessage;
import com.genersoft.iot.vmp.gb28181.transmit.event.request.SIPRequestProcessorParent; 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.IMessageHandler;
import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.response.ResponseMessageHandler; import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.response.ResponseMessageHandler;
import com.genersoft.iot.vmp.service.IDeviceService; import com.genersoft.iot.vmp.service.IDeviceService;
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
import com.genersoft.iot.vmp.storager.IVideoManagerStorage;
import gov.nist.javax.sip.message.SIPRequest; import gov.nist.javax.sip.message.SIPRequest;
import org.dom4j.DocumentException; import org.dom4j.DocumentException;
import org.dom4j.Element; import org.dom4j.Element;
@ -59,7 +54,7 @@ public class DeviceInfoResponseMessageHandler extends SIPRequestProcessorParent
public void handForDevice(RequestEvent evt, Device device, Element rootElement) { public void handForDevice(RequestEvent evt, Device device, Element rootElement) {
logger.debug("接收到DeviceInfo应答消息"); logger.debug("接收到DeviceInfo应答消息");
// 检查设备是否存在 不存在则不回复 // 检查设备是否存在 不存在则不回复
if (device == null || device.getOnline() == 0) { if (device == null || !device.isOnLine()) {
logger.warn("[接收到DeviceInfo应答消息,但是设备已经离线]" + (device != null ? device.getDeviceId():"" )); logger.warn("[接收到DeviceInfo应答消息,但是设备已经离线]" + (device != null ? device.getDeviceId():"" ));
return; return;
} }

View File

@ -255,7 +255,7 @@ public class XmlUtil {
} }
if (channelType.equals(ChannelType.CivilCode)) { if (channelType.equals(ChannelType.CivilCode)) {
// 行政区划其他字段没必要识别了默认在线即可 // 行政区划其他字段没必要识别了默认在线即可
deviceChannel.setStatus(1); deviceChannel.setStatus(true);
deviceChannel.setParental(1); deviceChannel.setParental(1);
deviceChannel.setCreateTime(DateUtil.getNow()); deviceChannel.setCreateTime(DateUtil.getNow());
deviceChannel.setUpdateTime(DateUtil.getNow()); deviceChannel.setUpdateTime(DateUtil.getNow());
@ -309,7 +309,7 @@ public class XmlUtil {
deviceChannel.setBusinessGroupId(businessGroupID); deviceChannel.setBusinessGroupId(businessGroupID);
if (channelType.equals(ChannelType.BusinessGroup) || channelType.equals(ChannelType.VirtualOrganization)) { if (channelType.equals(ChannelType.BusinessGroup) || channelType.equals(ChannelType.VirtualOrganization)) {
// 业务分组和虚拟组织 其他字段没必要识别了默认在线即可 // 业务分组和虚拟组织 其他字段没必要识别了默认在线即可
deviceChannel.setStatus(1); deviceChannel.setStatus(true);
deviceChannel.setParental(1); deviceChannel.setParental(1);
deviceChannel.setCreateTime(DateUtil.getNow()); deviceChannel.setCreateTime(DateUtil.getNow());
deviceChannel.setUpdateTime(DateUtil.getNow()); deviceChannel.setUpdateTime(DateUtil.getNow());
@ -322,13 +322,13 @@ public class XmlUtil {
String status = statusElement.getTextTrim().trim(); String status = statusElement.getTextTrim().trim();
// ONLINE OFFLINE HIKVISION DS-7716N-E4 NVR的兼容性处理 // ONLINE OFFLINE HIKVISION DS-7716N-E4 NVR的兼容性处理
if (status.equals("ON") || status.equals("On") || status.equals("ONLINE") || status.equals("OK")) { if (status.equals("ON") || status.equals("On") || status.equals("ONLINE") || status.equals("OK")) {
deviceChannel.setStatus(1); deviceChannel.setStatus(true);
} }
if (status.equals("OFF") || status.equals("Off") || status.equals("OFFLINE")) { if (status.equals("OFF") || status.equals("Off") || status.equals("OFFLINE")) {
deviceChannel.setStatus(0); deviceChannel.setStatus(false);
} }
}else { }else {
deviceChannel.setStatus(1); deviceChannel.setStatus(true);
} }
// 识别自带的目录标识 // 识别自带的目录标识
String parental = XmlUtil.getText(itemDevice, "Parental"); String parental = XmlUtil.getText(itemDevice, "Parental");

View File

@ -191,13 +191,13 @@ public class ZLMHttpHookListener {
if (userSetting.getPushAuthority()) { if (userSetting.getPushAuthority()) {
// 推流鉴权 // 推流鉴权
if (param.getParams() == null) { if (param.getParams() == null) {
logger.info("推流鉴权失败: 缺少要参数sign=md5(user表的pushKey)"); logger.info("推流鉴权失败: 缺少要参数sign=md5(user表的pushKey)");
return new HookResultForOnPublish(401, "Unauthorized"); return new HookResultForOnPublish(401, "Unauthorized");
} }
Map<String, String> paramMap = urlParamToMap(param.getParams()); Map<String, String> paramMap = urlParamToMap(param.getParams());
String sign = paramMap.get("sign"); String sign = paramMap.get("sign");
if (sign == null) { if (sign == null) {
logger.info("推流鉴权失败: 缺少要参数sign=md5(user表的pushKey)"); logger.info("推流鉴权失败: 缺少要参数sign=md5(user表的pushKey)");
return new HookResultForOnPublish(401, "Unauthorized"); return new HookResultForOnPublish(401, "Unauthorized");
} }
// 推流自定义播放鉴权码 // 推流自定义播放鉴权码

View File

@ -325,5 +325,65 @@ public class StreamPushItem extends GbStream implements Comparable<StreamPushIte
public void setSelf(boolean self) { public void setSelf(boolean self) {
this.self = self; this.self = self;
} }
// @Override
// public Integer getGbStreamId() {
// return super.getGbStreamId();
// }
//
// @Override
// public void setGbStreamId(Integer gbStreamId) {
// super.setGbStreamId(gbStreamId);
// }
//
//
// public String getGbId() {
// return super.getGbId();
// }
//
// public void setGbId(String gbId) {
// super.setGbId(gbId);
// }
//
// public String getName() {
// return super.getName();
// }
//
// public void setName(String name) {
// super.setName(name);
// }
//
// public double getLongitude() {
// return super.getLongitude();
// }
//
// public void setLongitude(double longitude) {
// super.setLongitude(longitude);
// }
//
// public double getLatitude() {
// return super.getLatitude();
// }
//
// public void setLatitude(double latitude) {
// super.setLatitude(latitude);
// }
//
// public String getStreamType() {
// return super.getStreamType();
// }
//
// public void setStreamType(String streamType) {
// super.setStreamType(streamType);
// }
//
// public boolean isStatus() {
// return super.isStatus();
// }
//
// public void setStatus(boolean status) {
// super.setStatus(status);
// }
} }

View File

@ -2,7 +2,7 @@ package com.genersoft.iot.vmp.service;
import com.genersoft.iot.vmp.gb28181.bean.Device; import com.genersoft.iot.vmp.gb28181.bean.Device;
import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel; import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel;
import com.genersoft.iot.vmp.vmanager.bean.ResourceBaceInfo; import com.genersoft.iot.vmp.vmanager.bean.ResourceBaseInfo;
import com.genersoft.iot.vmp.vmanager.gb28181.platform.bean.ChannelReduce; import com.genersoft.iot.vmp.vmanager.gb28181.platform.bean.ChannelReduce;
import java.util.List; import java.util.List;
@ -38,7 +38,7 @@ public interface IDeviceChannelService {
* 获取统计信息 * 获取统计信息
* @return * @return
*/ */
ResourceBaceInfo getOverview(); ResourceBaseInfo getOverview();
/** /**
* 查询所有未分配的通道 * 查询所有未分配的通道

View File

@ -5,7 +5,7 @@ import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel;
import com.genersoft.iot.vmp.gb28181.bean.SipTransactionInfo; import com.genersoft.iot.vmp.gb28181.bean.SipTransactionInfo;
import com.genersoft.iot.vmp.gb28181.bean.SyncStatus; import com.genersoft.iot.vmp.gb28181.bean.SyncStatus;
import com.genersoft.iot.vmp.vmanager.bean.BaseTree; import com.genersoft.iot.vmp.vmanager.bean.BaseTree;
import com.genersoft.iot.vmp.vmanager.bean.ResourceBaceInfo; import com.genersoft.iot.vmp.vmanager.bean.ResourceBaseInfo;
import java.util.List; import java.util.List;
@ -162,7 +162,7 @@ public interface IDeviceService {
* 获取统计信息 * 获取统计信息
* @return * @return
*/ */
ResourceBaceInfo getOverview(); ResourceBaseInfo getOverview();
/** /**
* 获取所有设备 * 获取所有设备

View File

@ -1,8 +0,0 @@
package com.genersoft.iot.vmp.service;
import com.genersoft.iot.vmp.storager.dao.dto.RecordInfo;
import com.github.pagehelper.PageInfo;
public interface IRecordInfoServer {
PageInfo<RecordInfo> getRecordList(int page, int count);
}

View File

@ -4,7 +4,7 @@ import com.alibaba.fastjson2.JSONObject;
import com.genersoft.iot.vmp.common.StreamInfo; import com.genersoft.iot.vmp.common.StreamInfo;
import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem; import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem;
import com.genersoft.iot.vmp.media.zlm.dto.StreamProxyItem; import com.genersoft.iot.vmp.media.zlm.dto.StreamProxyItem;
import com.genersoft.iot.vmp.vmanager.bean.ResourceBaceInfo; import com.genersoft.iot.vmp.vmanager.bean.ResourceBaseInfo;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
public interface IStreamProxyService { public interface IStreamProxyService {
@ -108,6 +108,6 @@ public interface IStreamProxyService {
* 获取统计信息 * 获取统计信息
* @return * @return
*/ */
ResourceBaceInfo getOverview(); ResourceBaseInfo getOverview();
} }

View File

@ -5,7 +5,7 @@ import com.genersoft.iot.vmp.media.zlm.dto.hook.OnStreamChangedHookParam;
import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem; 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.StreamPushItem;
import com.genersoft.iot.vmp.service.bean.StreamPushItemFromRedis; import com.genersoft.iot.vmp.service.bean.StreamPushItemFromRedis;
import com.genersoft.iot.vmp.vmanager.bean.ResourceBaceInfo; import com.genersoft.iot.vmp.vmanager.bean.ResourceBaseInfo;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import java.util.List; import java.util.List;
@ -113,5 +113,5 @@ public interface IStreamPushService {
* 获取统计信息 * 获取统计信息
* @return * @return
*/ */
ResourceBaceInfo getOverview(); ResourceBaseInfo getOverview();
} }

View File

@ -11,7 +11,7 @@ import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
import com.genersoft.iot.vmp.storager.dao.DeviceChannelMapper; import com.genersoft.iot.vmp.storager.dao.DeviceChannelMapper;
import com.genersoft.iot.vmp.storager.dao.DeviceMapper; import com.genersoft.iot.vmp.storager.dao.DeviceMapper;
import com.genersoft.iot.vmp.utils.DateUtil; import com.genersoft.iot.vmp.utils.DateUtil;
import com.genersoft.iot.vmp.vmanager.bean.ResourceBaceInfo; import com.genersoft.iot.vmp.vmanager.bean.ResourceBaseInfo;
import com.genersoft.iot.vmp.vmanager.gb28181.platform.bean.ChannelReduce; import com.genersoft.iot.vmp.vmanager.gb28181.platform.bean.ChannelReduce;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@ -175,8 +175,12 @@ public class DeviceChannelServiceImpl implements IDeviceChannelService {
} }
@Override @Override
public ResourceBaceInfo getOverview() { public ResourceBaseInfo getOverview() {
return channelMapper.getOverview();
int online = channelMapper.getOnlineCount();
int total = channelMapper.getAllChannelCount();
return new ResourceBaseInfo(total, online);
} }

View File

@ -20,7 +20,7 @@ import com.genersoft.iot.vmp.storager.dao.DeviceMapper;
import com.genersoft.iot.vmp.storager.dao.PlatformChannelMapper; import com.genersoft.iot.vmp.storager.dao.PlatformChannelMapper;
import com.genersoft.iot.vmp.utils.DateUtil; import com.genersoft.iot.vmp.utils.DateUtil;
import com.genersoft.iot.vmp.vmanager.bean.BaseTree; import com.genersoft.iot.vmp.vmanager.bean.BaseTree;
import com.genersoft.iot.vmp.vmanager.bean.ResourceBaceInfo; import com.genersoft.iot.vmp.vmanager.bean.ResourceBaseInfo;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -118,7 +118,7 @@ public class DeviceServiceImpl implements IDeviceService {
// 第一次上线 或则设备之前是离线状态--进行通道同步和设备信息查询 // 第一次上线 或则设备之前是离线状态--进行通道同步和设备信息查询
if (device.getCreateTime() == null) { if (device.getCreateTime() == null) {
device.setOnline(1); device.setOnLine(true);
device.setCreateTime(now); device.setCreateTime(now);
logger.info("[设备上线,首次注册]: {},查询设备信息以及通道信息", device.getDeviceId()); logger.info("[设备上线,首次注册]: {},查询设备信息以及通道信息", device.getDeviceId());
deviceMapper.add(device); deviceMapper.add(device);
@ -130,8 +130,8 @@ public class DeviceServiceImpl implements IDeviceService {
} }
sync(device); sync(device);
}else { }else {
if(device.getOnline() == 0){ if(!device.isOnLine()){
device.setOnline(1); device.setOnLine(true);
device.setCreateTime(now); device.setCreateTime(now);
deviceMapper.update(device); deviceMapper.update(device);
redisCatchStorage.updateDevice(device); redisCatchStorage.updateDevice(device);
@ -185,7 +185,7 @@ public class DeviceServiceImpl implements IDeviceService {
} }
String registerExpireTaskKey = VideoManagerConstants.REGISTER_EXPIRE_TASK_KEY_PREFIX + deviceId; String registerExpireTaskKey = VideoManagerConstants.REGISTER_EXPIRE_TASK_KEY_PREFIX + deviceId;
dynamicTask.stop(registerExpireTaskKey); dynamicTask.stop(registerExpireTaskKey);
device.setOnline(0); device.setOnLine(false);
redisCatchStorage.updateDevice(device); redisCatchStorage.updateDevice(device);
deviceMapper.update(device); deviceMapper.update(device);
//进行通道离线 //进行通道离线
@ -231,7 +231,7 @@ public class DeviceServiceImpl implements IDeviceService {
} }
logger.info("[移除目录订阅]: {}", device.getDeviceId()); logger.info("[移除目录订阅]: {}", device.getDeviceId());
String taskKey = device.getDeviceId() + "catalog"; String taskKey = device.getDeviceId() + "catalog";
if (device.getOnline() == 1) { if (device.isOnLine()) {
Runnable runnable = dynamicTask.get(taskKey); Runnable runnable = dynamicTask.get(taskKey);
if (runnable instanceof ISubscribeTask) { if (runnable instanceof ISubscribeTask) {
ISubscribeTask subscribeTask = (ISubscribeTask) runnable; ISubscribeTask subscribeTask = (ISubscribeTask) runnable;
@ -264,7 +264,7 @@ public class DeviceServiceImpl implements IDeviceService {
} }
logger.info("[移除移动位置订阅]: {}", device.getDeviceId()); logger.info("[移除移动位置订阅]: {}", device.getDeviceId());
String taskKey = device.getDeviceId() + "mobile_position"; String taskKey = device.getDeviceId() + "mobile_position";
if (device.getOnline() == 1) { if (device.isOnLine()) {
Runnable runnable = dynamicTask.get(taskKey); Runnable runnable = dynamicTask.get(taskKey);
if (runnable instanceof ISubscribeTask) { if (runnable instanceof ISubscribeTask) {
ISubscribeTask subscribeTask = (ISubscribeTask) runnable; ISubscribeTask subscribeTask = (ISubscribeTask) runnable;
@ -331,7 +331,7 @@ public class DeviceServiceImpl implements IDeviceService {
@Override @Override
public void checkDeviceStatus(Device device) { public void checkDeviceStatus(Device device) {
if (device == null || device.getOnline() == 0) { if (device == null || !device.isOnLine()) {
return; return;
} }
try { try {
@ -535,7 +535,7 @@ public class DeviceServiceImpl implements IDeviceService {
if (haveChannel) { if (haveChannel) {
// 查询那些civilCode不在通道中的不规范通道放置在根目录 // 查询那些civilCode不在通道中的不规范通道放置在根目录
List<DeviceChannel> nonstandardNode = deviceChannelMapper.getChannelWithoutCiviCode(deviceId); List<DeviceChannel> nonstandardNode = deviceChannelMapper.getChannelWithoutCivilCode(deviceId);
if (nonstandardNode != null && nonstandardNode.size() > 0) { if (nonstandardNode != null && nonstandardNode.size() > 0) {
result.addAll(nonstandardNode); result.addAll(nonstandardNode);
} }
@ -568,7 +568,7 @@ public class DeviceServiceImpl implements IDeviceService {
@Override @Override
public void addDevice(Device device) { public void addDevice(Device device) {
device.setOnline(0); device.setOnLine(false);
device.setCreateTime(DateUtil.getNow()); device.setCreateTime(DateUtil.getNow());
device.setUpdateTime(DateUtil.getNow()); device.setUpdateTime(DateUtil.getNow());
deviceMapper.addCustomDevice(device); deviceMapper.addCustomDevice(device);
@ -652,8 +652,10 @@ public class DeviceServiceImpl implements IDeviceService {
} }
@Override @Override
public ResourceBaceInfo getOverview() { public ResourceBaseInfo getOverview() {
return deviceMapper.getOverview(); List<Device> onlineDevices = deviceMapper.getOnlineDevices();
List<Device> all = deviceMapper.getAll();
return new ResourceBaseInfo(all.size(), onlineDevices.size());
} }
@Override @Override

View File

@ -110,7 +110,7 @@ public class GbStreamServiceImpl implements IGbStreamService {
deviceChannel.setLatitude(gbStream.getLatitude()); deviceChannel.setLatitude(gbStream.getLatitude());
deviceChannel.setDeviceId(platform.getDeviceGBId()); deviceChannel.setDeviceId(platform.getDeviceGBId());
deviceChannel.setManufacture("wvp-pro"); deviceChannel.setManufacture("wvp-pro");
deviceChannel.setStatus(gbStream.isStatus()?1:0); deviceChannel.setStatus(gbStream.isStatus());
deviceChannel.setRegisterWay(1); deviceChannel.setRegisterWay(1);
deviceChannel.setCivilCode(platform.getAdministrativeDivision()); deviceChannel.setCivilCode(platform.getAdministrativeDivision());
@ -218,7 +218,7 @@ public class GbStreamServiceImpl implements IGbStreamService {
}else { }else {
status = gbStreamMapper.selectStatusForPush(gbStream.getApp(), gbStream.getStream()); status = gbStreamMapper.selectStatusForPush(gbStream.getApp(), gbStream.getStream());
} }
deviceChannel.setStatus((status != null && status )?1:0); deviceChannel.setStatus(status != null && status);
deviceChannel.setRegisterWay(1); deviceChannel.setRegisterWay(1);
deviceChannel.setCivilCode(platform.getAdministrativeDivision()); deviceChannel.setCivilCode(platform.getAdministrativeDivision());

View File

@ -685,7 +685,7 @@ public class MediaServerServiceImpl implements IMediaServerService {
// 缓存不存在从数据库查询如果数据库不存在则是错误的 // 缓存不存在从数据库查询如果数据库不存在则是错误的
mediaServerItem = getOneFromDatabase(mediaServerId); mediaServerItem = getOneFromDatabase(mediaServerId);
if (mediaServerItem == null) { if (mediaServerItem == null) {
logger.warn("[更新ZLM 保活信息]失败,未找到流媒体信息"); logger.warn("[更新ZLM 保活信息] 流媒体{}尚未加入使用,请检查节点中是否含有此流媒体 ", mediaServerId);
return; return;
} }
// zlm连接重试 // zlm连接重试

View File

@ -1,25 +0,0 @@
package com.genersoft.iot.vmp.service.impl;
import com.genersoft.iot.vmp.service.IRecordInfoServer;
import com.genersoft.iot.vmp.storager.dao.RecordInfoDao;
import com.genersoft.iot.vmp.storager.dao.dto.RecordInfo;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class RecordInfoServerImpl implements IRecordInfoServer {
@Autowired
private RecordInfoDao recordInfoDao;
@Override
public PageInfo<RecordInfo> getRecordList(int page, int count) {
PageHelper.startPage(page, count);
List<RecordInfo> all = recordInfoDao.selectAll();
return new PageInfo<>(all);
}
}

View File

@ -23,7 +23,7 @@ import com.genersoft.iot.vmp.storager.dao.PlatformGbStreamMapper;
import com.genersoft.iot.vmp.storager.dao.StreamProxyMapper; import com.genersoft.iot.vmp.storager.dao.StreamProxyMapper;
import com.genersoft.iot.vmp.utils.DateUtil; import com.genersoft.iot.vmp.utils.DateUtil;
import com.genersoft.iot.vmp.vmanager.bean.ErrorCode; import com.genersoft.iot.vmp.vmanager.bean.ErrorCode;
import com.genersoft.iot.vmp.vmanager.bean.ResourceBaceInfo; import com.genersoft.iot.vmp.vmanager.bean.ResourceBaseInfo;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@ -332,7 +332,7 @@ public class StreamProxyServiceImpl implements IStreamProxyService {
@Override @Override
public void zlmServerOnline(String mediaServerId) { public void zlmServerOnline(String mediaServerId) {
// 移除开启了无人观看自动移除的流 // 移除开启了无人观看自动移除的流
List<StreamProxyItem> streamProxyItemList = streamProxyMapper.selecAutoRemoveItemByMediaServerId(mediaServerId); List<StreamProxyItem> streamProxyItemList = streamProxyMapper.selectAutoRemoveItemByMediaServerId(mediaServerId);
if (streamProxyItemList.size() > 0) { if (streamProxyItemList.size() > 0) {
gbStreamMapper.batchDel(streamProxyItemList); gbStreamMapper.batchDel(streamProxyItemList);
} }
@ -360,7 +360,7 @@ public class StreamProxyServiceImpl implements IStreamProxyService {
@Override @Override
public void zlmServerOffline(String mediaServerId) { public void zlmServerOffline(String mediaServerId) {
// 移除开启了无人观看自动移除的流 // 移除开启了无人观看自动移除的流
List<StreamProxyItem> streamProxyItemList = streamProxyMapper.selecAutoRemoveItemByMediaServerId(mediaServerId); List<StreamProxyItem> streamProxyItemList = streamProxyMapper.selectAutoRemoveItemByMediaServerId(mediaServerId);
if (streamProxyItemList.size() > 0) { if (streamProxyItemList.size() > 0) {
gbStreamMapper.batchDel(streamProxyItemList); gbStreamMapper.batchDel(streamProxyItemList);
} }
@ -438,7 +438,11 @@ public class StreamProxyServiceImpl implements IStreamProxyService {
} }
@Override @Override
public ResourceBaceInfo getOverview() { public ResourceBaseInfo getOverview() {
return streamProxyMapper.getOverview();
int total = streamProxyMapper.getAllCount();
int online = streamProxyMapper.getOnline();
return new ResourceBaseInfo(total, online);
} }
} }

View File

@ -20,7 +20,7 @@ import com.genersoft.iot.vmp.service.bean.StreamPushItemFromRedis;
import com.genersoft.iot.vmp.storager.IRedisCatchStorage; import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
import com.genersoft.iot.vmp.storager.dao.*; import com.genersoft.iot.vmp.storager.dao.*;
import com.genersoft.iot.vmp.utils.DateUtil; import com.genersoft.iot.vmp.utils.DateUtil;
import com.genersoft.iot.vmp.vmanager.bean.ResourceBaceInfo; import com.genersoft.iot.vmp.vmanager.bean.ResourceBaseInfo;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import org.slf4j.Logger; import org.slf4j.Logger;
@ -531,7 +531,10 @@ public class StreamPushServiceImpl implements IStreamPushService {
} }
@Override @Override
public ResourceBaceInfo getOverview() { public ResourceBaseInfo getOverview() {
return streamPushMapper.getOverview(userSetting.isUsePushingAsStatus()); int total = streamPushMapper.getAllCount();
int online = streamPushMapper.getAllOnline(userSetting.isUsePushingAsStatus());
return new ResourceBaseInfo(total, online);
} }
} }

View File

@ -9,7 +9,6 @@ import com.genersoft.iot.vmp.vmanager.bean.StreamPushExcelDto;
import com.google.common.collect.BiMap; import com.google.common.collect.BiMap;
import com.google.common.collect.HashBiMap; import com.google.common.collect.HashBiMap;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
import org.springframework.util.StringUtils;
import java.util.*; import java.util.*;
@ -33,38 +32,43 @@ public class StreamPushUploadFileHandler extends AnalysisEventListener<StreamPus
/** /**
* 用于存储不加过滤的所有数据 * 用于存储不加过滤的所有数据
*/ */
private List<StreamPushItem> streamPushItems = new ArrayList<>(); private final List<StreamPushItem> streamPushItems = new ArrayList<>();
/** /**
* 用于存储更具APP+Stream过滤后的数据可以直接存入stream_push表与gb_stream表 * 用于存储更具APP+Stream过滤后的数据可以直接存入stream_push表与gb_stream表
*/ */
private Map<String,StreamPushItem> streamPushItemForSave = new HashMap<>(); private final Map<String,StreamPushItem> streamPushItemForSave = new HashMap<>();
/** /**
* 用于存储按照APP+Stream为KEY 平台ID+目录Id 为value的数据用于存储到gb_stream表后获取app+Stream对应的平台与目录信息然后存入关联表 * 用于存储按照APP+Stream为KEY 平台ID+目录Id 为value的数据用于存储到gb_stream表后获取app+Stream对应的平台与目录信息然后存入关联表
*/ */
private Map<String, List<String[]>> streamPushItemsForPlatform = new HashMap<>(); private final Map<String, List<String[]>> streamPushItemsForPlatform = new HashMap<>();
/** /**
* 用于判断文件是否存在重复的app+Stream+平台ID * 用于判断文件是否存在重复的app+Stream+平台ID
*/ */
private Set<String> streamPushStreamSet = new HashSet<>(); private final Set<String> streamPushStreamSet = new HashSet<>();
/** /**
* 用于存储APP+Stream->国标ID 的数据结构, 数据一一对应全局判断APP+Stream->国标ID是否存在不对应 * 用于存储APP+Stream->国标ID 的数据结构, 数据一一对应全局判断APP+Stream->国标ID是否存在不对应
*/ */
private BiMap<String,String> gBMap = HashBiMap.create(); private final BiMap<String,String> gBMap = HashBiMap.create();
/**
* 用于存储APP+Stream-> 在数据库中的数据
*/
private final BiMap<String,String> pushMapInDb = HashBiMap.create();
/** /**
* 记录错误的APP+Stream * 记录错误的APP+Stream
*/ */
private List<String> errorStreamList = new ArrayList<>(); private final List<String> errorStreamList = new ArrayList<>();
/** /**
* 记录错误的国标ID * 记录错误的国标ID
*/ */
private List<String> errorGBList = new ArrayList<>(); private final List<String> errorInfoList = new ArrayList<>();
/** /**
* 读取数量计数器 * 读取数量计数器
@ -75,6 +79,13 @@ public class StreamPushUploadFileHandler extends AnalysisEventListener<StreamPus
this.pushService = pushService; this.pushService = pushService;
this.defaultMediaServerId = defaultMediaServerId; this.defaultMediaServerId = defaultMediaServerId;
this.errorDataHandler = errorDataHandler; this.errorDataHandler = errorDataHandler;
// 获取数据库已有的数据已经存在的则忽略
List<String> allAppAndStreams = pushService.getAllAppAndStream();
if (allAppAndStreams.size() > 0) {
for (String allAppAndStream : allAppAndStreams) {
pushMapInDb.put(allAppAndStream, allAppAndStream);
}
}
} }
public interface ErrorDataHandler{ public interface ErrorDataHandler{
@ -88,26 +99,30 @@ public class StreamPushUploadFileHandler extends AnalysisEventListener<StreamPus
|| ObjectUtils.isEmpty(streamPushExcelDto.getGbId())) { || ObjectUtils.isEmpty(streamPushExcelDto.getGbId())) {
return; return;
} }
Integer rowIndex = analysisContext.readRowHolder().getRowIndex();
if (gBMap.get(streamPushExcelDto.getApp() + streamPushExcelDto.getStream()) == null) { if (gBMap.get(streamPushExcelDto.getApp() + streamPushExcelDto.getStream()) == null) {
try { try {
gBMap.put(streamPushExcelDto.getApp() + streamPushExcelDto.getStream(), streamPushExcelDto.getGbId()); gBMap.put(streamPushExcelDto.getApp() + streamPushExcelDto.getStream(), streamPushExcelDto.getGbId());
}catch (IllegalArgumentException e) { }catch (IllegalArgumentException e) {
errorGBList.add(streamPushExcelDto.getGbId() + "(不同的app+stream使用了相同的国标ID)"); errorInfoList.add("行:" + rowIndex + ", " + streamPushExcelDto.getGbId() + " 国标ID重复使用");
return; return;
} }
}else { }else {
if (!gBMap.get(streamPushExcelDto.getApp() + streamPushExcelDto.getStream()).equals(streamPushExcelDto.getGbId())) { if (!gBMap.get(streamPushExcelDto.getApp() + streamPushExcelDto.getStream()).equals(streamPushExcelDto.getGbId())) {
errorGBList.add(streamPushExcelDto.getGbId() + "(同一组app+stream使用了不同的国标ID)"); errorInfoList.add("行:" + rowIndex + ", " + streamPushExcelDto.getGbId() + " 同样的应用名和流ID使用了不同的国标ID");
return; return;
} }
} }
if (streamPushStreamSet.contains(streamPushExcelDto.getApp() + streamPushExcelDto.getStream() + streamPushExcelDto.getPlatformId())) { if (streamPushStreamSet.contains(streamPushExcelDto.getApp() + streamPushExcelDto.getStream() + streamPushExcelDto.getPlatformId())) {
errorStreamList.add(streamPushExcelDto.getApp() + "/" + streamPushExcelDto.getStream()+ "/" + errorStreamList.add("行:" + rowIndex + ", " + streamPushExcelDto.getApp() + "/" + streamPushExcelDto.getStream()+ " 平台信息重复");
streamPushExcelDto.getPlatformId() + "(同一组app+stream添加在了同一个平台下)");
return; return;
}else { }else {
if (pushMapInDb.get(streamPushExcelDto.getApp()+streamPushExcelDto.getStream()) != null) {
errorStreamList.add("行:" + rowIndex + ", " + streamPushExcelDto.getApp() + "/" + streamPushExcelDto.getStream()+ " 数据已存在");
return;
}
streamPushStreamSet.add(streamPushExcelDto.getApp()+streamPushExcelDto.getStream() + streamPushExcelDto.getPlatformId()); streamPushStreamSet.add(streamPushExcelDto.getApp()+streamPushExcelDto.getStream() + streamPushExcelDto.getPlatformId());
} }
@ -165,7 +180,7 @@ public class StreamPushUploadFileHandler extends AnalysisEventListener<StreamPus
gBMap.clear(); gBMap.clear();
streamPushStreamSet.clear(); streamPushStreamSet.clear();
streamPushItemsForPlatform.clear(); streamPushItemsForPlatform.clear();
errorDataHandler.handle(errorStreamList, errorGBList); errorDataHandler.handle(errorStreamList, errorInfoList);
} }
private void saveData(){ private void saveData(){

View File

@ -7,8 +7,7 @@ import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils; import org.springframework.util.DigestUtils;
import org.springframework.util.StringUtils;
import java.util.List; import java.util.List;
@ -61,11 +60,23 @@ public class UserServiceImpl implements IUserService {
@Override @Override
public boolean checkPushAuthority(String callId, String sign) { public boolean checkPushAuthority(String callId, String sign) {
if (ObjectUtils.isEmpty(callId)) {
return userMapper.checkPushAuthorityByCallId(sign).size() > 0; List<User> users = userMapper.getUsers();
}else { if (users.size() == 0) {
return userMapper.checkPushAuthorityByCallIdAndSign(callId, sign).size() > 0; return false;
} }
for (User user : users) {
if (user.getPushKey() == null) {
continue;
}
String checkStr = callId == null? user.getPushKey():(callId + "_" + user.getPushKey()) ;
System.out.println(checkStr);
String checkSign = DigestUtils.md5DigestAsHex(checkStr.getBytes());
if (checkSign.equals(sign)) {
return true;
}
}
return false;
} }
@Override @Override

View File

@ -16,32 +16,32 @@ import java.util.List;
@Repository @Repository
public interface DeviceAlarmMapper { public interface DeviceAlarmMapper {
@Insert("INSERT INTO device_alarm (deviceId, channelId, alarmPriority, alarmMethod, alarmTime, alarmDescription, longitude, latitude, alarmType , createTime ) " + @Insert("INSERT INTO wvp_device_alarm (device_id, channel_id, alarm_priority, alarm_method, alarm_time, alarm_description, longitude, latitude, alarm_type , create_time ) " +
"VALUES (#{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); int add(DeviceAlarm alarm);
@Select( value = {" <script>" + @Select( value = {" <script>" +
" SELECT * FROM device_alarm " + " SELECT * FROM wvp_device_alarm " +
" WHERE 1=1 " + " WHERE 1=1 " +
" <if test=\"deviceId != null\" > AND deviceId = #{deviceId}</if>" + " <if test=\"deviceId != null\" > AND device_id = #{deviceId}</if>" +
" <if test=\"alarmPriority != null\" > AND alarmPriority = #{alarmPriority} </if>" + " <if test=\"alarmPriority != null\" > AND alarm_priority = #{alarmPriority} </if>" +
" <if test=\"alarmMethod != null\" > AND alarmMethod = #{alarmMethod} </if>" + " <if test=\"alarmMethod != null\" > AND alarm_method = #{alarmMethod} </if>" +
" <if test=\"alarmType != null\" > AND alarmType = #{alarmType} </if>" + " <if test=\"alarmType != null\" > AND alarm_type = #{alarmType} </if>" +
" <if test=\"startTime != null\" > AND alarmTime &gt;= #{startTime} </if>" + " <if test=\"startTime != null\" > AND alarm_time &gt;= #{startTime} </if>" +
" <if test=\"endTime != null\" > AND alarmTime &lt;= #{endTime} </if>" + " <if test=\"endTime != null\" > AND alarm_time &lt;= #{endTime} </if>" +
" ORDER BY alarmTime ASC " + " ORDER BY alarm_time ASC " +
" </script>"}) " </script>"})
List<DeviceAlarm> query(String deviceId, String alarmPriority, String alarmMethod, List<DeviceAlarm> query(String deviceId, String alarmPriority, String alarmMethod,
String alarmType, String startTime, String endTime); String alarmType, String startTime, String endTime);
@Delete(" <script>" + @Delete(" <script>" +
"DELETE FROM device_alarm WHERE 1=1 " + "DELETE FROM wvp_device_alarm WHERE 1=1 " +
" <if test=\"deviceIdList != null and id == null \" > AND deviceId in " + " <if test=\"deviceIdList != null and id == null \" > AND device_id in " +
"<foreach collection='deviceIdList' item='item' open='(' separator=',' close=')' > #{item}</foreach>" + "<foreach collection='deviceIdList' item='item' open='(' separator=',' close=')' > #{item}</foreach>" +
"</if>" + "</if>" +
" <if test=\"time != null and id == null \" > AND alarmTime &lt;= #{time}</if>" + " <if test=\"time != null and id == null \" > AND alarm_time &lt;= #{time}</if>" +
" <if test=\"id != null\" > AND id = #{id}</if>" + " <if test=\"id != null\" > AND id = #{id}</if>" +
" </script>" " </script>"
) )

View File

@ -3,7 +3,6 @@ package com.genersoft.iot.vmp.storager.dao;
import com.genersoft.iot.vmp.gb28181.bean.Device; import com.genersoft.iot.vmp.gb28181.bean.Device;
import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel; import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel;
import com.genersoft.iot.vmp.gb28181.bean.DeviceChannelInPlatform; import com.genersoft.iot.vmp.gb28181.bean.DeviceChannelInPlatform;
import com.genersoft.iot.vmp.vmanager.bean.ResourceBaceInfo;
import com.genersoft.iot.vmp.vmanager.gb28181.platform.bean.ChannelReduce; import com.genersoft.iot.vmp.vmanager.gb28181.platform.bean.ChannelReduce;
import com.genersoft.iot.vmp.web.gb28181.dto.DeviceChannelExtend; import com.genersoft.iot.vmp.web.gb28181.dto.DeviceChannelExtend;
import org.apache.ibatis.annotations.*; import org.apache.ibatis.annotations.*;
@ -18,10 +17,10 @@ import java.util.List;
@Repository @Repository
public interface DeviceChannelMapper { public interface DeviceChannelMapper {
@Insert("INSERT INTO device_channel (channelId, deviceId, name, manufacture, model, owner, civilCode, block, " + @Insert("INSERT INTO wvp_device_channel (channel_id, device_id, name, manufacture, model, owner, civil_code, block, " +
"address, parental, parentId, safetyWay, registerWay, certNum, certifiable, errCode, secrecy, " + "address, parental, parent_id, safety_way, register_way, cert_num, certifiable, err_code, secrecy, " +
"ipAddress, port, password, PTZType, status, streamId, longitude, latitude, longitudeGcj02, latitudeGcj02, " + "ip_address, port, password, ptz_type, status, stream_id, longitude, latitude, longitude_gcj02, latitude_gcj02, " +
"longitudeWgs84, latitudeWgs84, hasAudio, createTime, updateTime, businessGroupId, gpsTime) " + "longitude_wgs84, latitude_wgs84, has_audio, create_time, update_time, business_group_id, gps_time) " +
"VALUES (#{channelId}, #{deviceId}, #{name}, #{manufacture}, #{model}, #{owner}, #{civilCode}, #{block}," + "VALUES (#{channelId}, #{deviceId}, #{name}, #{manufacture}, #{model}, #{owner}, #{civilCode}, #{block}," +
"#{address}, #{parental}, #{parentId}, #{safetyWay}, #{registerWay}, #{certNum}, #{certifiable}, #{errCode}, #{secrecy}, " + "#{address}, #{parental}, #{parentId}, #{safetyWay}, #{registerWay}, #{certNum}, #{certifiable}, #{errCode}, #{secrecy}, " +
"#{ipAddress}, #{port}, #{password}, #{PTZType}, #{status}, #{streamId}, #{longitude}, #{latitude}, #{longitudeGcj02}, " + "#{ipAddress}, #{port}, #{password}, #{PTZType}, #{status}, #{streamId}, #{longitude}, #{latitude}, #{longitudeGcj02}, " +
@ -29,39 +28,39 @@ public interface DeviceChannelMapper {
int add(DeviceChannel channel); int add(DeviceChannel channel);
@Update(value = {" <script>" + @Update(value = {" <script>" +
"UPDATE device_channel " + "UPDATE wvp_device_channel " +
"SET updateTime=#{updateTime}" + "SET update_time=#{updateTime}" +
"<if test='name != null'>, name=#{name}</if>" + "<if test='name != null'>, name=#{name}</if>" +
"<if test='manufacture != null'>, manufacture=#{manufacture}</if>" + "<if test='manufacture != null'>, manufacture=#{manufacture}</if>" +
"<if test='model != null'>, model=#{model}</if>" + "<if test='model != null'>, model=#{model}</if>" +
"<if test='owner != null'>, owner=#{owner}</if>" + "<if test='owner != null'>, owner=#{owner}</if>" +
"<if test='civilCode != null'>, civilCode=#{civilCode}</if>" + "<if test='civilCode != null'>, civil_code=#{civilCode}</if>" +
"<if test='block != null'>, block=#{block}</if>" + "<if test='block != null'>, block=#{block}</if>" +
"<if test='address != null'>, address=#{address}</if>" + "<if test='address != null'>, address=#{address}</if>" +
"<if test='parental != null'>, parental=#{parental}</if>" + "<if test='parental != null'>, parental=#{parental}</if>" +
"<if test='parentId != null'>, parentId=#{parentId}</if>" + "<if test='parentId != null'>, parent_id=#{parentId}</if>" +
"<if test='safetyWay != null'>, safetyWay=#{safetyWay}</if>" + "<if test='safetyWay != null'>, safety_way=#{safetyWay}</if>" +
"<if test='registerWay != null'>, registerWay=#{registerWay}</if>" + "<if test='registerWay != null'>, register_way=#{registerWay}</if>" +
"<if test='certNum != null'>, certNum=#{certNum}</if>" + "<if test='certNum != null'>, cert_num=#{certNum}</if>" +
"<if test='certifiable != null'>, certifiable=#{certifiable}</if>" + "<if test='certifiable != null'>, certifiable=#{certifiable}</if>" +
"<if test='errCode != null'>, errCode=#{errCode}</if>" + "<if test='errCode != null'>, err_code=#{errCode}</if>" +
"<if test='secrecy != null'>, secrecy=#{secrecy}</if>" + "<if test='secrecy != null'>, secrecy=#{secrecy}</if>" +
"<if test='ipAddress != null'>, ipAddress=#{ipAddress}</if>" + "<if test='ipAddress != null'>, ip_address=#{ipAddress}</if>" +
"<if test='port != null'>, port=#{port}</if>" + "<if test='port != null'>, port=#{port}</if>" +
"<if test='password != null'>, password=#{password}</if>" + "<if test='password != null'>, password=#{password}</if>" +
"<if test='PTZType != null'>, PTZType=#{PTZType}</if>" + "<if test='PTZType != null'>, ptz_type=#{PTZType}</if>" +
"<if test='status != null'>, status=#{status}</if>" + "<if test='status != null'>, status=#{status}</if>" +
"<if test='streamId != null'>, streamId=#{streamId}</if>" + "<if test='streamId != null'>, stream_id=#{streamId}</if>" +
"<if test='hasAudio != null'>, hasAudio=#{hasAudio}</if>" + "<if test='hasAudio != null'>, has_audio=#{hasAudio}</if>" +
"<if test='longitude != null'>, longitude=#{longitude}</if>" + "<if test='longitude != null'>, longitude=#{longitude}</if>" +
"<if test='latitude != null'>, latitude=#{latitude}</if>" + "<if test='latitude != null'>, latitude=#{latitude}</if>" +
"<if test='longitudeGcj02 != null'>, longitudeGcj02=#{longitudeGcj02}</if>" + "<if test='longitudeGcj02 != null'>, longitude_gcj02=#{longitudeGcj02}</if>" +
"<if test='latitudeGcj02 != null'>, latitudeGcj02=#{latitudeGcj02}</if>" + "<if test='latitudeGcj02 != null'>, latitude_gcj02=#{latitudeGcj02}</if>" +
"<if test='longitudeWgs84 != null'>, longitudeWgs84=#{longitudeWgs84}</if>" + "<if test='longitudeWgs84 != null'>, longitude_wgs84=#{longitudeWgs84}</if>" +
"<if test='latitudeWgs84 != null'>, latitudeWgs84=#{latitudeWgs84}</if>" + "<if test='latitudeWgs84 != null'>, latitude_wgs84=#{latitudeWgs84}</if>" +
"<if test='businessGroupId != null'>, businessGroupId=#{businessGroupId}</if>" + "<if test='businessGroupId != null'>, business_group_id=#{businessGroupId}</if>" +
"<if test='gpsTime != null'>, gpsTime=#{gpsTime}</if>" + "<if test='gpsTime != null'>, gps_time=#{gpsTime}</if>" +
"WHERE deviceId=#{deviceId} AND channelId=#{channelId}"+ "WHERE device_id=#{deviceId} AND channel_id=#{channelId}"+
" </script>"}) " </script>"})
int update(DeviceChannel channel); int update(DeviceChannel channel);
@ -69,42 +68,42 @@ public interface DeviceChannelMapper {
"SELECT " + "SELECT " +
"dc.* " + "dc.* " +
"from " + "from " +
"device_channel dc " + "wvp_device_channel dc " +
"WHERE " + "WHERE " +
"dc.deviceId = #{deviceId} " + "dc.device_id = #{deviceId} " +
" <if test='query != null'> AND (dc.channelId LIKE concat('%',#{query},'%') OR dc.name LIKE concat('%',#{query},'%') OR dc.name LIKE concat('%',#{query},'%'))</if> " + " <if test='query != null'> AND (dc.channel_id LIKE concat('%',#{query},'%') OR dc.name LIKE concat('%',#{query},'%') OR dc.name LIKE concat('%',#{query},'%'))</if> " +
" <if test='parentChannelId != null'> AND (dc.parentId=#{parentChannelId} OR dc.civilCode = #{parentChannelId}) </if> " + " <if test='parentChannelId != null'> AND (dc.parent_id=#{parentChannelId} OR dc.civil_code = #{parentChannelId}) </if> " +
" <if test='online == true' > AND dc.status=1</if>" + " <if test='online == true' > AND dc.status= true</if>" +
" <if test='online == false' > AND dc.status=0</if>" + " <if test='online == false' > AND dc.status= false</if>" +
" <if test='hasSubChannel == true' > AND dc.subCount > 0 </if>" + " <if test='hasSubChannel == true' > AND dc.sub_count > 0 </if>" +
" <if test='hasSubChannel == false' > AND dc.subCount = 0 </if>" + " <if test='hasSubChannel == false' > AND dc.sub_count = 0 </if>" +
"<if test='channelIds != null'> AND dc.channelId in <foreach item='item' index='index' collection='channelIds' open='(' separator=',' close=')'>" + "<if test='channelIds != null'> AND dc.channel_id in <foreach item='item' index='index' collection='channelIds' open='(' separator=',' close=')'>" +
"#{item} " + "#{item} " +
"</foreach> </if>" + "</foreach> </if>" +
"ORDER BY dc.channelId " + "ORDER BY dc.channel_id " +
" </script>"}) " </script>"})
List<DeviceChannel> queryChannels(String deviceId, String parentChannelId, String query, Boolean hasSubChannel, Boolean online, List<String> channelIds); List<DeviceChannel> queryChannels(String deviceId, String parentChannelId, String query, Boolean hasSubChannel, Boolean online, List<String> channelIds);
@Select(value = {" <script>" + @Select(value = {" <script>" +
"SELECT " + "SELECT " +
"dc.*, " + "dc.*, " +
"de.name as deviceName, " + "de.name as device_name, " +
"de.online as deviceOnline " + "de.on_line as device_online " +
"from " + "from " +
"device_channel dc " + "wvp_device_channel dc " +
"LEFT JOIN device de ON dc.deviceId = de.deviceId " + "LEFT JOIN wvp_device de ON dc.device_id = de.device_id " +
"WHERE 1=1" + "WHERE 1=1" +
" <if test='deviceId != null'> AND dc.deviceId = #{deviceId} </if> " + " <if test='deviceId != null'> AND dc.device_id = #{deviceId} </if> " +
" <if test='query != null'> AND (dc.channelId LIKE '%${query}%' OR dc.name LIKE '%${query}%' OR dc.name LIKE '%${query}%')</if> " + " <if test='query != null'> AND (dc.channel_id LIKE '%${query}%' OR dc.name LIKE '%${query}%' OR dc.name LIKE '%${query}%')</if> " +
" <if test='parentChannelId != null'> AND dc.parentId=#{parentChannelId} </if> " + " <if test='parentChannelId != null'> AND dc.parent_id=#{parentChannelId} </if> " +
" <if test='online == true' > AND dc.status=1</if>" + " <if test='online == true' > AND dc.status=true</if>" +
" <if test='online == false' > AND dc.status=0</if>" + " <if test='online == false' > AND dc.status=false</if>" +
" <if test='hasSubChannel == true' > AND dc.subCount > 0 </if>" + " <if test='hasSubChannel == true' > AND dc.sub_count > 0 </if>" +
" <if test='hasSubChannel == false' > AND dc.subCount = 0 </if>" + " <if test='hasSubChannel == false' > AND dc.sub_count = 0 </if>" +
"<if test='channelIds != null'> AND dc.channelId in <foreach item='item' index='index' collection='channelIds' open='(' separator=',' close=')'>" + "<if test='channelIds != null'> AND dc.channel_id in <foreach item='item' index='index' collection='channelIds' open='(' separator=',' close=')'>" +
"#{item} " + "#{item} " +
"</foreach> </if>" + "</foreach> </if>" +
"ORDER BY dc.channelId ASC" + "ORDER BY dc.channel_id ASC" +
" </script>"}) " </script>"})
List<DeviceChannelExtend> queryChannelsWithDeviceInfo(String deviceId, String parentChannelId, String query, Boolean hasSubChannel, Boolean online, List<String> channelIds); List<DeviceChannelExtend> queryChannelsWithDeviceInfo(String deviceId, String parentChannelId, String query, Boolean hasSubChannel, Boolean online, List<String> channelIds);
@ -112,151 +111,97 @@ public interface DeviceChannelMapper {
@Select(value = {" <script>" + @Select(value = {" <script>" +
"SELECT " + "SELECT " +
"dc.*, " + "dc.*, " +
"de.name as deviceName, " + "de.name as device_name, " +
"de.online as deviceOnline " + "de.on_line as device_online " +
"from " + "from " +
"device_channel dc " + "wvp_device_channel dc " +
"LEFT JOIN device de ON dc.deviceId = de.deviceId " + "LEFT JOIN wvp_device de ON dc.device_id = de.device_id " +
"WHERE 1=1" + "WHERE 1=1" +
" <if test='deviceId != null'> AND dc.deviceId = #{deviceId} </if> " + " <if test='deviceId != null'> AND dc.device_id = #{deviceId} </if> " +
" <if test='query != null'> AND (dc.channelId LIKE '%${query}%' OR dc.name LIKE '%${query}%' OR dc.name LIKE '%${query}%')</if> " + " <if test='query != null'> AND (dc.channel_id LIKE '%${query}%' OR dc.name LIKE '%${query}%' OR dc.name LIKE '%${query}%')</if> " +
" <if test='parentChannelId != null'> AND dc.parentId=#{parentChannelId} </if> " + " <if test='parentChannelId != null'> AND dc.parent_id=#{parentChannelId} </if> " +
" <if test='online == true' > AND dc.status=1</if>" + " <if test='online == true' > AND dc.status=true</if>" +
" <if test='online == false' > AND dc.status=0</if>" + " <if test='online == false' > AND dc.status=false</if>" +
" <if test='hasSubChannel == true' > AND dc.subCount > 0 </if>" + " <if test='hasSubChannel == true' > AND dc.sub_count > 0 </if>" +
" <if test='hasSubChannel == false' > AND dc.subCount = 0 </if>" + " <if test='hasSubChannel == false' > AND dc.sub_count = 0 </if>" +
"<if test='channelIds != null'> AND dc.channelId in <foreach item='item' index='index' collection='channelIds' open='(' separator=',' close=')'>" + "<if test='channelIds != null'> AND dc.channel_id in <foreach item='item' index='index' collection='channelIds' open='(' separator=',' close=')'>" +
"#{item} " + "#{item} " +
"</foreach> </if>" + "</foreach> </if>" +
"ORDER BY dc.channelId ASC " + "ORDER BY dc.channel_id ASC " +
"Limit #{limit} OFFSET #{start}" + "Limit #{limit} OFFSET #{start}" +
" </script>"}) " </script>"})
List<DeviceChannelExtend> queryChannelsByDeviceIdWithStartAndLimit(String deviceId,List<String> channelIds, String parentChannelId, String query, List<DeviceChannelExtend> queryChannelsByDeviceIdWithStartAndLimit(String deviceId,List<String> channelIds, String parentChannelId, String query,
Boolean hasSubChannel, Boolean online, int start, int limit); Boolean hasSubChannel, Boolean online, int start, int limit);
@Select("SELECT * FROM device_channel WHERE deviceId=#{deviceId} AND channelId=#{channelId}") @Select("SELECT * FROM wvp_device_channel WHERE device_id=#{deviceId} AND channel_id=#{channelId}")
DeviceChannel queryChannel(String deviceId, String channelId); DeviceChannel queryChannel(String deviceId, String channelId);
@Delete("DELETE FROM device_channel WHERE deviceId=#{deviceId}") @Delete("DELETE FROM wvp_device_channel WHERE device_id=#{deviceId}")
int cleanChannelsByDeviceId(String deviceId); int cleanChannelsByDeviceId(String deviceId);
@Delete("DELETE FROM device_channel WHERE deviceId=#{deviceId} AND channelId=#{channelId}") @Delete("DELETE FROM wvp_device_channel WHERE device_id=#{deviceId} AND channel_id=#{channelId}")
int del(String deviceId, String channelId); int del(String deviceId, String channelId);
@Update(value = {"UPDATE device_channel SET streamId=null WHERE deviceId=#{deviceId} AND channelId=#{channelId}"}) @Update(value = {"UPDATE wvp_device_channel SET stream_id=null WHERE device_id=#{deviceId} AND channel_id=#{channelId}"})
void stopPlay(String deviceId, String channelId); void stopPlay(String deviceId, String channelId);
@Update(value = {"UPDATE device_channel SET streamId=#{streamId} WHERE deviceId=#{deviceId} AND channelId=#{channelId}"}) @Update(value = {"UPDATE wvp_device_channel SET stream_id=#{streamId} WHERE device_id=#{deviceId} AND channel_id=#{channelId}"})
void startPlay(String deviceId, String channelId, String streamId); void startPlay(String deviceId, String channelId, String streamId);
@Select(value = {" <script>" + @Select(value = {" <script>" +
"SELECT " + "SELECT " +
" dc.id,\n" + " dc.id,\n" +
" dc.channelId,\n" + " dc.channel_id,\n" +
" dc.deviceId,\n" + " dc.device_id,\n" +
" dc.name,\n" + " dc.name,\n" +
" de.manufacturer,\n" + " de.manufacturer,\n" +
" de.hostAddress,\n" + " de.host_address,\n" +
" dc.subCount,\n" + " dc.sub_count,\n" +
" pgc.platformId as platformId,\n" + " pgc.platform_id as platform_id,\n" +
" pgc.catalogId as catalogId " + " pgc.catalog_id as catalog_id " +
" FROM device_channel dc " + " FROM wvp_device_channel dc " +
" LEFT JOIN device de ON dc.deviceId = de.deviceId " + " LEFT JOIN wvp_device de ON dc.device_id = de.device_id " +
" LEFT JOIN platform_gb_channel pgc on pgc.deviceChannelId = dc.id " + " LEFT JOIN wvp_platform_gb_channel pgc on pgc.device_channel_id = dc.id " +
" WHERE 1=1 " + " WHERE 1=1 " +
" <if test='query != null'> AND (dc.channelId LIKE concat('%',#{query},'%') OR dc.name LIKE concat('%',#{query},'%') OR dc.name LIKE concat('%',#{query},'%'))</if> " + " <if test='query != null'> AND (dc.channel_id LIKE concat('%',#{query},'%') OR dc.name LIKE concat('%',#{query},'%') OR dc.name LIKE concat('%',#{query},'%'))</if> " +
" <if test='online == true' > AND dc.status=1</if> " + " <if test='online == true' > AND dc.status=true</if> " +
" <if test='online == false' > AND dc.status=0</if> " + " <if test='online == false' > AND dc.status=false</if> " +
" <if test='hasSubChannel!= null and hasSubChannel == true' > AND dc.subCount > 0</if> " + " <if test='hasSubChannel!= null and has_sub_channel == true' > AND dc.sub_count > 0</if> " +
" <if test='hasSubChannel!= null and hasSubChannel == false' > AND dc.subCount = 0</if> " + " <if test='hasSubChannel!= null and has_sub_channel == false' > AND dc.sub_count = 0</if> " +
" <if test='catalogId == null ' > AND dc.id not in (select deviceChannelId from platform_gb_channel where platformId=#{platformId} ) </if> " + " <if test='catalogId == null ' > AND dc.id not in (select device_channel_id from wvp_platform_gb_channel where platform_id=#{platformId} ) </if> " +
" <if test='catalogId != null ' > AND pgc.platformId = #{platformId} and pgc.catalogId=#{catalogId} </if> " + " <if test='catalogId != null ' > AND pgc.platform_id = #{platformId} and pgc.catalog_id=#{catalogId} </if> " +
" ORDER BY dc.deviceId, dc.channelId ASC" + " ORDER BY dc.device_id, dc.channel_id ASC" +
" </script>"}) " </script>"})
List<ChannelReduce> queryChannelListInAll(String query, Boolean online, Boolean hasSubChannel, String platformId, String catalogId); List<ChannelReduce> queryChannelListInAll(String query, Boolean online, Boolean hasSubChannel, String platformId, String catalogId);
@Select(value = {" <script>" + @Select(value = {" <script>" +
"SELECT " + "SELECT " +
" dc.*,\n" + " dc.*,\n" +
" pgc.platformId as platformId,\n" + " pgc.platform_id as platform_id,\n" +
" pgc.catalogId as catalogId " + " pgc.catalog_id as catalog_id " +
" FROM device_channel dc " + " FROM wvp_device_channel dc " +
" LEFT JOIN platform_gb_channel pgc on pgc.deviceChannelId = dc.id " + " LEFT JOIN wvp_platform_gb_channel pgc on pgc.device_channel_id = dc.id " +
" WHERE pgc.platformId = #{platformId} " + " WHERE pgc.platform_id = #{platformId} " +
" ORDER BY dc.deviceId, dc.channelId ASC" + " ORDER BY dc.device_id, dc.channel_id ASC" +
" </script>"}) " </script>"})
List<DeviceChannelInPlatform> queryChannelByPlatformId(String platformId); List<DeviceChannelInPlatform> queryChannelByPlatformId(String platformId);
@Select("SELECT * FROM device_channel WHERE channelId=#{channelId}") @Select("SELECT * FROM wvp_device_channel WHERE channel_id=#{channelId}")
List<DeviceChannel> queryChannelByChannelId( String channelId); List<DeviceChannel> queryChannelByChannelId( String channelId);
@Update(value = {"UPDATE device_channel SET status=0 WHERE deviceId=#{deviceId} AND channelId=#{channelId}"}) @Update(value = {"UPDATE wvp_device_channel SET status=false WHERE device_id=#{deviceId} AND channel_id=#{channelId}"})
void offline(String deviceId, String channelId); void offline(String deviceId, String channelId);
@Update(value = {"UPDATE device_channel SET status=0 WHERE deviceId=#{deviceId}"}) @Update(value = {"UPDATE wvp_device_channel SET status=fasle WHERE device_id=#{deviceId}"})
void offlineByDeviceId(String deviceId); void offlineByDeviceId(String deviceId);
// @Insert("<script> " +
// "insert into device_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, hasAudio, createTime, updateTime, businessGroupId, gpsTime) " +
// "values " +
// "<foreach collection='addChannels' index='index' item='item' separator=','> " +
// "(#{item.channelId}, #{item.deviceId}, #{item.name}, #{item.manufacture}, #{item.model}, " +
// "#{item.owner}, #{item.civilCode}, #{item.block},#{item.subCount}," +
// "#{item.address}, #{item.parental}, #{item.parentId}, #{item.safetyWay}, #{item.registerWay}, " +
// "#{item.certNum}, #{item.certifiable}, #{item.errCode}, #{item.secrecy}, " +
// "#{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.hasAudio}, now(), now(), " +
// "#{item.businessGroupId}, #{item.gpsTime}) " +
// "</foreach> " +
// "ON DUPLICATE KEY UPDATE " +
// "updateTime=VALUES(updateTime), " +
// "name=VALUES(name), " +
// "manufacture=VALUES(manufacture), " +
// "model=VALUES(model), " +
// "owner=VALUES(owner), " +
// "civilCode=VALUES(civilCode), " +
// "block=VALUES(block), " +
// "subCount=VALUES(subCount), " +
// "address=VALUES(address), " +
// "parental=VALUES(parental), " +
// "parentId=VALUES(parentId), " +
// "safetyWay=VALUES(safetyWay), " +
// "registerWay=VALUES(registerWay), " +
// "certNum=VALUES(certNum), " +
// "certifiable=VALUES(certifiable), " +
// "errCode=VALUES(errCode), " +
// "secrecy=VALUES(secrecy), " +
// "ipAddress=VALUES(ipAddress), " +
// "port=VALUES(port), " +
// "password=VALUES(password), " +
// "PTZType=VALUES(PTZType), " +
// "status=VALUES(status), " +
// "streamId=VALUES(streamId), " +
// "longitude=VALUES(longitude), " +
// "latitude=VALUES(latitude), " +
// "longitudeGcj02=VALUES(longitudeGcj02), " +
// "latitudeGcj02=VALUES(latitudeGcj02), " +
// "longitudeWgs84=VALUES(longitudeWgs84), " +
// "latitudeWgs84=VALUES(latitudeWgs84), " +
// "hasAudio=VALUES(hasAudio), " +
// "businessGroupId=VALUES(businessGroupId), " +
// "gpsTime=VALUES(gpsTime)" +
// "</script>")
// int batchAdd(List<DeviceChannel> addChannels);
@Insert("<script> " + @Insert("<script> " +
"insert into device_channel " + "insert into wvp_device_channel " +
"(channelId, deviceId, name, manufacture, model, owner, civilCode, block, subCount, " + "(channel_id, device_id, name, manufacture, model, owner, civil_code, block, sub_count, " +
" address, parental, parentId, safetyWay, registerWay, certNum, certifiable, errCode, secrecy, " + " address, parental, parent_id, safety_way, register_way, cert_num, certifiable, err_code, secrecy, " +
" ipAddress, port, password, PTZType, status, streamId, longitude, latitude, longitudeGcj02, latitudeGcj02, " + " ip_address,port,password,ptz_type,status,stream_id,longitude,latitude,longitude_gcj02,latitude_gcj02,"+
" longitudeWgs84, latitudeWgs84, hasAudio, createTime, updateTime, businessGroupId, gpsTime) " + " longitude_wgs84,latitude_wgs84,has_audio,create_time,update_time,business_group_id,gps_time)"+
"values " + "values " +
"<foreach collection='addChannels' index='index' item='item' separator=','> " + "<foreach collection='addChannels' index='index' item='item' separator=','> " +
"(#{item.channelId}, #{item.deviceId}, #{item.name}, #{item.manufacture}, #{item.model}, " + "(#{item.channelId}, #{item.deviceId}, #{item.name}, #{item.manufacture}, #{item.model}, " +
@ -273,11 +218,11 @@ public interface DeviceChannelMapper {
@Insert("<script> " + @Insert("<script> " +
"insert into device_channel " + "insert into wvp_device_channel " +
"(channelId, deviceId, name, manufacture, model, owner, civilCode, block, subCount, " + "(channel_id,device_id,name,manufacture,model,owner,civil_code,block,sub_count,"+
" address, parental, parentId, safetyWay, registerWay, certNum, certifiable, errCode, secrecy, " + " address,parental,parent_id,safety_way,register_way,cert_num,certifiable,err_code,secrecy,"+
" ipAddress, port, password, PTZType, status, streamId, longitude, latitude, longitudeGcj02, latitudeGcj02, " + " ip_address,port,password,ptz_type,status,stream_id,longitude,latitude,longitude_gcj02,latitude_gcj02,"+
" longitudeWgs84, latitudeWgs84, hasAudio, createTime, updateTime, businessGroupId, gpsTime) " + " longitude_wgs84,latitude_wgs84,has_audio,create_time,update_time,business_group_id,gps_time)"+
"values " + "values " +
"<foreach collection='addChannels' index='index' item='item' separator=','> " + "<foreach collection='addChannels' index='index' item='item' separator=','> " +
"(#{item.channelId}, #{item.deviceId}, #{item.name}, #{item.manufacture}, #{item.model}, " + "(#{item.channelId}, #{item.deviceId}, #{item.name}, #{item.manufacture}, #{item.model}, " +
@ -290,215 +235,219 @@ public interface DeviceChannelMapper {
"#{item.businessGroupId}, #{item.gpsTime}) " + "#{item.businessGroupId}, #{item.gpsTime}) " +
"</foreach> " + "</foreach> " +
"ON DUPLICATE KEY UPDATE " + "ON DUPLICATE KEY UPDATE " +
"updateTime=VALUES(updateTime), " + "update_time=VALUES(update_time), " +
"name=VALUES(name), " + "name=VALUES(name), " +
"manufacture=VALUES(manufacture), " + "manufacture=VALUES(manufacture), " +
"model=VALUES(model), " + "model=VALUES(model), " +
"owner=VALUES(owner), " + "owner=VALUES(owner), " +
"civilCode=VALUES(civilCode), " + "civil_code=VALUES(civil_code), " +
"block=VALUES(block), " + "block=VALUES(block), " +
"subCount=VALUES(subCount), " + "sub_count=VALUES(sub_count), " +
"address=VALUES(address), " + "address=VALUES(address), " +
"parental=VALUES(parental), " + "parental=VALUES(parental), " +
"parentId=VALUES(parentId), " + "parent_id=VALUES(parent_id), " +
"safetyWay=VALUES(safetyWay), " + "safety_way=VALUES(safety_way), " +
"registerWay=VALUES(registerWay), " + "register_way=VALUES(register_way), " +
"certNum=VALUES(certNum), " + "cert_num=VALUES(cert_num), " +
"certifiable=VALUES(certifiable), " + "certifiable=VALUES(certifiable), " +
"errCode=VALUES(errCode), " + "err_code=VALUES(err_code), " +
"secrecy=VALUES(secrecy), " + "secrecy=VALUES(secrecy), " +
"ipAddress=VALUES(ipAddress), " + "ip_address=VALUES(ip_address), " +
"port=VALUES(port), " + "port=VALUES(port), " +
"password=VALUES(password), " + "password=VALUES(password), " +
"PTZType=VALUES(PTZType), " + "ptz_type=VALUES(ptz_type), " +
"status=VALUES(status), " + "status=VALUES(status), " +
"streamId=VALUES(streamId), " + "stream_id=VALUES(stream_id), " +
"longitude=VALUES(longitude), " + "longitude=VALUES(longitude), " +
"latitude=VALUES(latitude), " + "latitude=VALUES(latitude), " +
"longitudeGcj02=VALUES(longitudeGcj02), " + "longitude_gcj02=VALUES(longitude_gcj02), " +
"latitudeGcj02=VALUES(latitudeGcj02), " + "latitude_gcj02=VALUES(latitude_gcj02), " +
"longitudeWgs84=VALUES(longitudeWgs84), " + "longitude_wgs84=VALUES(longitude_wgs84), " +
"latitudeWgs84=VALUES(latitudeWgs84), " + "latitude_wgs84=VALUES(latitude_wgs84), " +
"hasAudio=VALUES(hasAudio), " + "has_audio=VALUES(has_audio), " +
"businessGroupId=VALUES(businessGroupId), " + "business_group_id=VALUES(business_group_id), " +
"gpsTime=VALUES(gpsTime)" + "gps_time=VALUES(gps_time)" +
"</script>") "</script>")
int batchAddOrUpdate(List<DeviceChannel> addChannels); int batchAddOrUpdate(List<DeviceChannel> addChannels);
@Update(value = {"UPDATE device_channel SET status=1 WHERE deviceId=#{deviceId} AND channelId=#{channelId}"}) @Update(value = {"UPDATE wvp_device_channel SET status=true WHERE device_id=#{deviceId} AND channel_id=#{channelId}"})
void online(String deviceId, String channelId); void online(String deviceId, String channelId);
@Update({"<script>" + @Update({"<script>" +
"<foreach collection='updateChannels' item='item' separator=';'>" + "<foreach collection='updateChannels' item='item' separator=';'>" +
" UPDATE" + " UPDATE" +
" device_channel" + " wvp_device_channel" +
" SET updateTime=#{item.updateTime}" + " SET update_time=#{item.updateTime}" +
"<if test='item.name != null'>, name=#{item.name}</if>" + "<if test='item.name != null'>, name=#{item.name}</if>" +
"<if test='item.manufacture != null'>, manufacture=#{item.manufacture}</if>" + "<if test='item.manufacture != null'>, manufacture=#{item.manufacture}</if>" +
"<if test='item.model != null'>, model=#{item.model}</if>" + "<if test='item.model != null'>, model=#{item.model}</if>" +
"<if test='item.owner != null'>, owner=#{item.owner}</if>" + "<if test='item.owner != null'>, owner=#{item.owner}</if>" +
"<if test='item.civilCode != null'>, civilCode=#{item.civilCode}</if>" + "<if test='item.civilCode != null'>, civil_code=#{item.civilCode}</if>" +
"<if test='item.block != null'>, block=#{item.block}</if>" + "<if test='item.block != null'>, block=#{item.block}</if>" +
"<if test='item.subCount != null'>, subCount=#{item.subCount}</if>" + "<if test='item.subCount != null'>, sub_count=#{item.subCount}</if>" +
"<if test='item.address != null'>, address=#{item.address}</if>" + "<if test='item.address != null'>, address=#{item.address}</if>" +
"<if test='item.parental != null'>, parental=#{item.parental}</if>" + "<if test='item.parental != null'>, parental=#{item.parental}</if>" +
"<if test='item.parentId != null'>, parentId=#{item.parentId}</if>" + "<if test='item.parentId != null'>, parent_id=#{item.parentId}</if>" +
"<if test='item.safetyWay != null'>, safetyWay=#{item.safetyWay}</if>" + "<if test='item.safetyWay != null'>, safety_way=#{item.safetyWay}</if>" +
"<if test='item.registerWay != null'>, registerWay=#{item.registerWay}</if>" + "<if test='item.registerWay != null'>, register_way=#{item.registerWay}</if>" +
"<if test='item.certNum != null'>, certNum=#{item.certNum}</if>" + "<if test='item.certNum != null'>, cert_num=#{item.certNum}</if>" +
"<if test='item.certifiable != null'>, certifiable=#{item.certifiable}</if>" + "<if test='item.certifiable != null'>, certifiable=#{item.certifiable}</if>" +
"<if test='item.errCode != null'>, errCode=#{item.errCode}</if>" + "<if test='item.errCode != null'>, err_code=#{item.errCode}</if>" +
"<if test='item.secrecy != null'>, secrecy=#{item.secrecy}</if>" + "<if test='item.secrecy != null'>, secrecy=#{item.secrecy}</if>" +
"<if test='item.ipAddress != null'>, ipAddress=#{item.ipAddress}</if>" + "<if test='item.ipAddress != null'>, ip_address=#{item.ipAddress}</if>" +
"<if test='item.port != null'>, port=#{item.port}</if>" + "<if test='item.port != null'>, port=#{item.port}</if>" +
"<if test='item.password != null'>, password=#{item.password}</if>" + "<if test='item.password != null'>, password=#{item.password}</if>" +
"<if test='item.PTZType != null'>, PTZType=#{item.PTZType}</if>" + "<if test='item.PTZType != null'>, ptz_type=#{item.PTZType}</if>" +
"<if test='item.status != null'>, status=#{item.status}</if>" + "<if test='item.status != null'>, status=#{item.status}</if>" +
"<if test='item.streamId != null'>, streamId=#{item.streamId}</if>" + "<if test='item.streamId != null'>, stream_id=#{item.streamId}</if>" +
"<if test='item.hasAudio != null'>, hasAudio=#{item.hasAudio}</if>" + "<if test='item.hasAudio != null'>, has_audio=#{item.hasAudio}</if>" +
"<if test='item.longitude != null'>, longitude=#{item.longitude}</if>" + "<if test='item.longitude != null'>, longitude=#{item.longitude}</if>" +
"<if test='item.latitude != null'>, latitude=#{item.latitude}</if>" + "<if test='item.latitude != null'>, latitude=#{item.latitude}</if>" +
"<if test='item.longitudeGcj02 != null'>, longitudeGcj02=#{item.longitudeGcj02}</if>" + "<if test='item.longitudeGcj02 != null'>, longitude_gcj02=#{item.longitudeGcj02}</if>" +
"<if test='item.latitudeGcj02 != null'>, latitudeGcj02=#{item.latitudeGcj02}</if>" + "<if test='item.latitudeGcj02 != null'>, latitude_gcj02=#{item.latitudeGcj02}</if>" +
"<if test='item.longitudeWgs84 != null'>, longitudeWgs84=#{item.longitudeWgs84}</if>" + "<if test='item.longitudeWgs84 != null'>, longitude_wgs84=#{item.longitudeWgs84}</if>" +
"<if test='item.latitudeWgs84 != null'>, latitudeWgs84=#{item.latitudeWgs84}</if>" + "<if test='item.latitudeWgs84 != null'>, latitude_wgs84=#{item.latitudeWgs84}</if>" +
"<if test='item.businessGroupId != null'>, businessGroupId=#{item.businessGroupId}</if>" + "<if test='item.businessGroupId != null'>, business_group_id=#{item.businessGroupId}</if>" +
"<if test='item.gpsTime != null'>, gpsTime=#{item.gpsTime}</if>" + "<if test='item.gpsTime != null'>, gps_time=#{item.gpsTime}</if>" +
"<if test='item.id > 0'>WHERE id=#{item.id}</if>" + "<if test='item.id > 0'>WHERE id=#{item.id}</if>" +
"<if test='item.id == 0'>WHERE deviceId=#{item.deviceId} AND channelId=#{item.channelId}</if>" + "<if test='item.id == 0'>WHERE device_id=#{item.deviceId} AND channel_id=#{item.channelId}</if>" +
"</foreach>" + "</foreach>" +
"</script>"}) "</script>"})
int batchUpdate(List<DeviceChannel> updateChannels); int batchUpdate(List<DeviceChannel> updateChannels);
@Select("SELECT * FROM device_channel WHERE deviceId=#{deviceId} AND status=1") @Select("SELECT * FROM wvp_device_channel WHERE device_id=#{deviceId} AND status=true")
List<DeviceChannel> queryOnlineChannelsByDeviceId(String deviceId); List<DeviceChannel> queryOnlineChannelsByDeviceId(String deviceId);
@Delete(value = {" <script>" + @Delete(value = {" <script>" +
"DELETE " + "DELETE " +
"from " + "from " +
"device_channel " + "wvp_device_channel " +
"WHERE " + "WHERE " +
"deviceId = #{deviceId} " + "device_id = #{deviceId} " +
" AND channelId NOT IN " + " AND channel_id NOT IN " +
"<foreach collection='channels' item='item' open='(' separator=',' close=')' > #{item.channelId}</foreach>" + "<foreach collection='channels' item='item' open='(' separator=',' close=')' > #{item.channelId}</foreach>" +
" </script>"}) " </script>"})
int cleanChannelsNotInList(String deviceId, List<DeviceChannel> channels); int cleanChannelsNotInList(String deviceId, List<DeviceChannel> channels);
@Update(" update device_channel" + @Update(" update wvp_device_channel" +
" set subCount = (select *" + " set sub_count = (select *" +
" from (select count(0)" + " from (select count(0)" +
" from device_channel" + " from wvp_device_channel" +
" where deviceId = #{deviceId} and parentId = #{channelId}) as temp)" + " where device_id = #{deviceId} and parent_id = #{channelId}) as temp)" +
" where deviceId = #{deviceId} " + " where device_id = #{deviceId} " +
" and channelId = #{channelId}") " and channel_id = #{channelId}")
int updateChannelSubCount(String deviceId, String channelId); int updateChannelSubCount(String deviceId, String channelId);
@Update(value = {" <script>" + @Update(value = {" <script>" +
"UPDATE device_channel " + "UPDATE wvp_device_channel " +
"SET " + "SET " +
"latitude=#{latitude}, " + "latitude=#{latitude}, " +
"longitude=#{longitude}, " + "longitude=#{longitude}, " +
"longitudeGcj02=#{longitudeGcj02}, " + "longitude_gcj02=#{longitudeGcj02}, " +
"latitudeGcj02=#{latitudeGcj02}, " + "latitude_gcj02=#{latitudeGcj02}, " +
"longitudeWgs84=#{longitudeWgs84}, " + "longitude_wgs84=#{longitudeWgs84}, " +
"latitudeWgs84=#{latitudeWgs84}, " + "latitude_wgs84=#{latitudeWgs84}, " +
"gpsTime=#{gpsTime} " + "gps_time=#{gpsTime} " +
"WHERE deviceId=#{deviceId} " + "WHERE device_id=#{deviceId} " +
" <if test='channelId != null' > AND channelId=#{channelId}</if>" + " <if test='channelId != null' > AND channel_id=#{channelId}</if>" +
" </script>"}) " </script>"})
void updatePosition(DeviceChannel deviceChannel); void updatePosition(DeviceChannel deviceChannel);
@Select("SELECT * FROM device_channel WHERE length(trim(streamId)) > 0") @Select("SELECT * FROM wvp_device_channel WHERE length(trim(stream_id)) > 0")
List<DeviceChannel> getAllChannelInPlay(); List<DeviceChannel> getAllChannelInPlay();
@Select("select * from device_channel where longitude*latitude > 0 and deviceId = #{deviceId}") @Select("select * from wvp_device_channel where longitude*latitude > 0 and device_id = #{deviceId}")
List<DeviceChannel> getAllChannelWithCoordinate(String deviceId); List<DeviceChannel> getAllChannelWithCoordinate(String deviceId);
@Select(value = {" <script>" + @Select(value = {" <script>" +
"select * " + "select * " +
"from device_channel " + "from wvp_device_channel " +
"where deviceId=#{deviceId}" + "where device_id=#{deviceId}" +
" <if test='parentId != null and length != null' > and parentId = #{parentId} or left(channelId, LENGTH(#{parentId})) = #{parentId} and length(channelId)=#{length} </if>" + " <if test='parentId != null and length != null' > and parent_id= #{parentId} or left(channel_id, LENGTH(#{parentId})) = #{parentId} and length(channel_id)=#{length} </if>" +
" <if test='parentId == null and length != null' > and parentId = #{parentId} or length(channelId)=#{length} </if>" + " <if test='parentId == null and length != null' > and parent_id= #{parentId} or length(channel_id)=#{length} </if>" +
" <if test='parentId == null and length == null' > and parentId = #{parentId} </if>" + " <if test='parentId == null and length == null' > and parent_id= #{parentId} </if>" +
" <if test='parentId != null and length == null' > and parentId = #{parentId} or left(channelId, LENGTH(#{parentId})) = #{parentId} </if>" + " <if test='parentId != null and length == null' > and parent_id= #{parentId} or left(channel_id, LENGTH(#{parentId})) = #{parentId} </if>" +
" </script>"}) " </script>"})
List<DeviceChannel> getChannelsWithCivilCodeAndLength(String deviceId, String parentId, Integer length); List<DeviceChannel> getChannelsWithCivilCodeAndLength(String deviceId, String parentId, Integer length);
@Select(value = {" <script>" + @Select(value = {" <script>" +
"select * " + "select * " +
"from device_channel " + "from wvp_device_channel " +
"where deviceId=#{deviceId} and length(channelId)>14 and civilCode=#{parentId}" + "where device_id=#{deviceId} and length(channel_id)>14 and civil_code=#{parentId}" +
" </script>"}) " </script>"})
List<DeviceChannel> getChannelsByCivilCode(String deviceId, String parentId); List<DeviceChannel> getChannelsByCivilCode(String deviceId, String parentId);
@Select("select min(length(channelId)) as minLength " + @Select("select min(length(channel_id)) as minLength " +
"from device_channel " + "from wvp_device_channel " +
"where deviceId=#{deviceId}") "where device_id=#{deviceId}")
Integer getChannelMinLength(String deviceId); Integer getChannelMinLength(String deviceId);
@Select("select * from device_channel where deviceId=#{deviceId} and civilCode not in " + @Select("select * from wvp_device_channel where device_id=#{deviceId} and civil_code not in " +
"(select civilCode from device_channel where deviceId=#{deviceId} group by civilCode)") "(select civil_code from wvp_device_channel where device_id=#{deviceId} group by civil_code)")
List<DeviceChannel> getChannelWithoutCiviCode(String deviceId); List<DeviceChannel> getChannelWithoutCivilCode(String deviceId);
@Select("select * from device_channel where deviceId=#{deviceId} and SUBSTRING(channelId, 11, 3)=#{typeCode}") @Select("select * from wvp_device_channel where device_id=#{deviceId} and SUBSTRING(channel_id, 11, 3)=#{typeCode}")
List<DeviceChannel> getBusinessGroups(String deviceId, String typeCode); List<DeviceChannel> getBusinessGroups(String deviceId, String typeCode);
@Select("select dc.id, dc.channelId, dc.deviceId, dc.name, dc.manufacture,dc.model,dc.owner, pc.civilCode,dc.block, " + @Select("select dc.id, dc.channel_id, dc.device_id, dc.name, dc.manufacture,dc.model,dc.owner, pc.civil_code,dc.block, " +
" dc.address, '0' as parental,'0' as channelType, pc.id as parentId, dc.safetyWay, dc.registerWay,dc.certNum, dc.certifiable, " + " dc.address, '0' as parental,'0' as channel_type, pc.id as parent_id, dc.safety_way, dc.register_way,dc.cert_num, dc.certifiable, " +
" dc.errCode,dc.endTime, dc.secrecy, dc.ipAddress, dc.port, dc.PTZType, dc.password, dc.status, " + " dc.err_code,dc.end_time, dc.secrecy, dc.ip_address, dc.port, dc.ptz_type, dc.password, dc.status, " +
" dc.longitudeWgs84 as longitude, dc.latitudeWgs84 as latitude, pc.businessGroupId " + " dc.longitude_wgs84 as longitude, dc.latitude_wgs84 as latitude, pc.business_group_id " +
" from device_channel dc" + " from wvp_device_channel dc" +
" left join platform_gb_channel pgc on dc.id = pgc.deviceChannelId" + " LEFT JOIN wvp_platform_gb_channel pgc on dc.id = pgc.device_channel_id" +
" left join platform_catalog pc on pgc.catalogId = pc.id and pgc.platformId = pc.platformId" + " LEFT JOIN wvp_platform_catalog pc on pgc.catalog_id = pc.id and pgc.platform_id = pc.platform_id" +
" where pgc.platformId=#{serverGBId}") " where pgc.platform_id=#{serverGBId}")
List<DeviceChannel> queryChannelWithCatalog(String serverGBId); List<DeviceChannel> queryChannelWithCatalog(String serverGBId);
@Select("select * from device_channel where deviceId = #{deviceId}") @Select("select * from wvp_device_channel where device_id = #{deviceId}")
List<DeviceChannel> queryAllChannels(String deviceId); List<DeviceChannel> queryAllChannels(String deviceId);
@Select("select count(1) as total, sum(status) as online from device_channel")
ResourceBaceInfo getOverview();
@Select("select channelId" + @Select("select channelId" +
", deviceId" + ", device_id" +
", latitude" + ", latitude" +
", longitude" + ", longitude"+
", latitudeWgs84" + ",latitude_wgs84"+
", longitudeWgs84" + ",longitude_wgs84"+
", latitudeGcj02" + ",latitude_gcj02"+
", longitudeGcj02 " + ",longitude_gcj02"+
"from device_channel where deviceId = #{deviceId} " + "from wvp_device_channel where device_id = #{deviceId} " +
"and latitude != 0 " + "and latitude != 0 " +
"and longitude != 0 " + "and longitude != 0 " +
"and (latitudeGcj02 = 0 or latitudeWgs84 = 0 or longitudeWgs84 = 0 or longitudeGcj02 = 0)") "and(latitude_gcj02=0 or latitude_wgs84=0 or longitude_wgs84= 0 or longitude_gcj02 = 0)")
List<DeviceChannel> getChannelsWithoutTransform(String deviceId); List<DeviceChannel> getChannelsWithoutTransform(String deviceId);
@Select("select de.* from device de left join device_channel dc on de.deviceId = dc.deviceId where dc.channelId=#{channelId}") @Select("select de.* from wvp_device de left join wvp_device_channel dc on de.device_id = dc.deviceId where dc.channel_id=#{channelId}")
List<Device> getDeviceByChannelId(String channelId); List<Device> getDeviceByChannelId(String channelId);
@Delete({"<script>" + @Delete({"<script>" +
"<foreach collection='deleteChannelList' item='item' separator=';'>" + "<foreach collection='deleteChannelList' item='item' separator=';'>" +
"DELETE FROM device_channel WHERE deviceId=#{item.deviceId} AND channelId=#{item.channelId}" + "DELETE FROM wvp_device_channel WHERE device_id=#{item.deviceId} AND channel_id=#{item.channelId}" +
"</foreach>" + "</foreach>" +
"</script>"}) "</script>"})
int batchDel(List<DeviceChannel> deleteChannelList); int batchDel(List<DeviceChannel> deleteChannelList);
@Update({"<script>" + @Update({"<script>" +
"<foreach collection='channels' item='item' separator=';'>" + "<foreach collection='channels' item='item' separator=';'>" +
"UPDATE device_channel SET status=1 WHERE deviceId=#{item.deviceId} AND channelId=#{item.channelId}" + "UPDATE wvp_device_channel SET status=true WHERE device_id=#{item.deviceId} AND channel_id=#{item.channelId}" +
"</foreach>" + "</foreach>" +
"</script>"}) "</script>"})
int batchOnline(List<DeviceChannel> channels); int batchOnline(List<DeviceChannel> channels);
@Update({"<script>" + @Update({"<script>" +
"<foreach collection='channels' item='item' separator=';'>" + "<foreach collection='channels' item='item' separator=';'>" +
"UPDATE device_channel SET status=0 WHERE deviceId=#{item.deviceId} AND channelId=#{item.channelId}" + "UPDATE wvp_device_channel SET status= false WHERE device_id=#{item.deviceId} AND channel_id=#{item.channelId}" +
"</foreach>" + "</foreach>" +
"</script>"}) "</script>"})
int batchOffline(List<DeviceChannel> channels); int batchOffline(List<DeviceChannel> channels);
@Select("select count(1) from wvp_device_channel where status = true")
int getOnlineCount();
@Select("select count(1) from wvp_device_channel")
int getAllChannelCount();
} }

View File

@ -1,7 +1,6 @@
package com.genersoft.iot.vmp.storager.dao; package com.genersoft.iot.vmp.storager.dao;
import com.genersoft.iot.vmp.gb28181.bean.Device; import com.genersoft.iot.vmp.gb28181.bean.Device;
import com.genersoft.iot.vmp.vmanager.bean.ResourceBaceInfo;
import org.apache.ibatis.annotations.*; import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
@ -15,68 +14,68 @@ import java.util.List;
public interface DeviceMapper { public interface DeviceMapper {
@Select("SELECT " + @Select("SELECT " +
"deviceId, " + "device_id, " +
"coalesce(custom_name, name) as name, " + "coalesce(custom_name, name) as name, " +
"password, " + "password, " +
"manufacturer, " + "manufacturer, " +
"model, " + "model, " +
"firmware, " + "firmware, " +
"transport," + "transport," +
"streamMode," + "stream_mode," +
"ip," + "ip," +
"sdpIp," + "sdp_ip," +
"localIp," + "local_ip," +
"port," + "port," +
"hostAddress," + "host_address," +
"expires," + "expires," +
"registerTime," + "register_time," +
"keepaliveTime," + "keepalive_time," +
"createTime," + "create_time," +
"updateTime," + "update_time," +
"charset," + "charset," +
"subscribeCycleForCatalog," + "subscribe_cycle_for_catalog," +
"subscribeCycleForMobilePosition," + "subscribe_cycle_for_mobile_position," +
"mobilePositionSubmissionInterval," + "mobile_position_submission_interval," +
"subscribeCycleForAlarm," + "subscribe_cycle_for_alarm," +
"ssrcCheck," + "ssrc_check," +
"asMessageChannel," + "as_message_channel," +
"geoCoordSys," + "geo_coord_sys," +
"treeType," + "tree_type," +
"online," + "on_line," +
"mediaServerId," + "media_server_id," +
"(SELECT count(0) FROM device_channel WHERE deviceId=device.deviceId) as channelCount "+ "(SELECT count(0) FROM wvp_device_channel WHERE device_id=wvp_device.device_id) as channel_count "+
" FROM device WHERE deviceId = #{deviceId}") " FROM wvp_device WHERE device_id = #{deviceId}")
Device getDeviceByDeviceId(String deviceId); Device getDeviceByDeviceId(String deviceId);
@Insert("INSERT INTO device (" + @Insert("INSERT INTO wvp_device (" +
"deviceId, " + "device_id, " +
"name, " + "name, " +
"manufacturer, " + "manufacturer, " +
"model, " + "model, " +
"firmware, " + "firmware, " +
"transport," + "transport," +
"streamMode," + "stream_mode," +
"ip," + "ip," +
"sdpIp," + "sdp_ip," +
"localIp," + "local_ip," +
"port," + "port," +
"hostAddress," + "host_address," +
"expires," + "expires," +
"registerTime," + "register_time," +
"keepaliveTime," + "keepalive_time," +
"keepaliveIntervalTime," + "keepalive_interval_time," +
"createTime," + "create_time," +
"updateTime," + "update_time," +
"charset," + "charset," +
"subscribeCycleForCatalog," + "subscribe_cycle_for_catalog," +
"subscribeCycleForMobilePosition," + "subscribe_cycle_for_mobile_position,"+
"mobilePositionSubmissionInterval," + "mobile_position_submission_interval,"+
"subscribeCycleForAlarm," + "subscribe_cycle_for_alarm,"+
"ssrcCheck," + "ssrc_check,"+
"asMessageChannel," + "as_message_channel,"+
"geoCoordSys," + "geo_coord_sys,"+
"treeType," + "tree_type,"+
"online" + "on_line"+
") VALUES (" + ") VALUES (" +
"#{deviceId}," + "#{deviceId}," +
"#{name}," + "#{name}," +
@ -105,172 +104,174 @@ public interface DeviceMapper {
"#{asMessageChannel}," + "#{asMessageChannel}," +
"#{geoCoordSys}," + "#{geoCoordSys}," +
"#{treeType}," + "#{treeType}," +
"#{online}" + "#{onLine}" +
")") ")")
int add(Device device); int add(Device device);
@Update(value = {" <script>" + @Update(value = {" <script>" +
"UPDATE device " + "UPDATE wvp_device " +
"SET updateTime=#{updateTime}" + "SET update_time=#{updateTime}" +
"<if test=\"name != null\">, name=#{name}</if>" + "<if test=\"name != null\">, name=#{name}</if>" +
"<if test=\"manufacturer != null\">, manufacturer=#{manufacturer}</if>" + "<if test=\"manufacturer != null\">, manufacturer=#{manufacturer}</if>" +
"<if test=\"model != null\">, model=#{model}</if>" + "<if test=\"model != null\">, model=#{model}</if>" +
"<if test=\"firmware != null\">, firmware=#{firmware}</if>" + "<if test=\"firmware != null\">, firmware=#{firmware}</if>" +
"<if test=\"transport != null\">, transport=#{transport}</if>" + "<if test=\"transport != null\">, transport=#{transport}</if>" +
"<if test=\"ip != null\">, ip=#{ip}</if>" + "<if test=\"ip != null\">, ip=#{ip}</if>" +
"<if test=\"localIp != null\">, localIp=#{localIp}</if>" + "<if test=\"localIp != null\">, local_ip=#{localIp}</if>" +
"<if test=\"port != null\">, port=#{port}</if>" + "<if test=\"port != null\">, port=#{port}</if>" +
"<if test=\"hostAddress != null\">, hostAddress=#{hostAddress}</if>" + "<if test=\"hostAddress != null\">, host_address=#{hostAddress}</if>" +
"<if test=\"online != null\">, online=#{online}</if>" + "<if test=\"onLine != null\">, on_line=#{onLine}</if>" +
"<if test=\"registerTime != null\">, registerTime=#{registerTime}</if>" + "<if test=\"registerTime != null\">, register_time=#{registerTime}</if>" +
"<if test=\"keepaliveTime != null\">, keepaliveTime=#{keepaliveTime}</if>" + "<if test=\"keepaliveTime != null\">, keepalive_time=#{keepaliveTime}</if>" +
"<if test=\"keepaliveIntervalTime != null\">, keepaliveIntervalTime=#{keepaliveIntervalTime}</if>" + "<if test=\"keepaliveIntervalTime != null\">, keepalive_interval_time=#{keepaliveIntervalTime}</if>" +
"<if test=\"expires != null\">, expires=#{expires}</if>" + "<if test=\"expires != null\">, expires=#{expires}</if>" +
"WHERE deviceId=#{deviceId}"+ "WHERE device_id=#{deviceId}"+
" </script>"}) " </script>"})
int update(Device device); int update(Device device);
@Select( @Select(
" <script>" + " <script>" +
"SELECT " + "SELECT " +
"deviceId, " + "device_id, " +
"coalesce(custom_name, name) as name, " + "coalesce(custom_name, name) as name, " +
"password, " + "password, " +
"manufacturer, " + "manufacturer, " +
"model, " + "model, " +
"firmware, " + "firmware, " +
"transport," + "transport," +
"streamMode," + "stream_mode," +
"ip," + "ip,"+
"sdpIp," + "sdp_ip,"+
"localIp," + "local_ip,"+
"port," + "port,"+
"hostAddress," + "host_address,"+
"expires," + "expires,"+
"registerTime," + "register_time,"+
"keepaliveTime," + "keepalive_time,"+
"createTime," + "create_time,"+
"updateTime," + "update_time,"+
"charset," + "charset,"+
"subscribeCycleForCatalog," + "subscribe_cycle_for_catalog,"+
"subscribeCycleForMobilePosition," + "subscribe_cycle_for_mobile_position,"+
"mobilePositionSubmissionInterval," + "mobile_position_submission_interval,"+
"subscribeCycleForAlarm," + "subscribe_cycle_for_alarm,"+
"ssrcCheck," + "ssrc_check,"+
"asMessageChannel," + "as_message_channel,"+
"geoCoordSys," + "geo_coord_sys,"+
"treeType," + "tree_type,"+
"online," + "on_line,"+
"mediaServerId," + "media_server_id,"+
"(SELECT count(0) FROM device_channel WHERE deviceId=de.deviceId) as channelCount FROM device de" + "(SELECT count(0) FROM wvp_device_channel WHERE device_id=de.device_id) as channel_count " +
"<if test=\"online != null\"> where online=${online}</if>"+ "FROM wvp_device de" +
"<if test=\"onLine != null\"> where on_line=${onLine}</if>"+
" order by create_time desc "+
" </script>" " </script>"
) )
List<Device> getDevices(Boolean online); List<Device> getDevices(Boolean onLine);
@Delete("DELETE FROM device WHERE deviceId=#{deviceId}") @Delete("DELETE FROM wvp_device WHERE device_id=#{deviceId}")
int del(String deviceId); int del(String deviceId);
@Select("SELECT " + @Select("SELECT " +
"deviceId, " + "device_id, " +
"coalesce(custom_name, name) as name, " + "coalesce(custom_name, name) as name, " +
"password, " + "password, " +
"manufacturer, " + "manufacturer, " +
"model, " + "model, " +
"firmware, " + "firmware, " +
"transport," + "transport," +
"streamMode," + "stream_mode," +
"ip," + "ip," +
"sdpIp," + "sdp_ip,"+
"localIp," + "local_ip,"+
"port," + "port,"+
"hostAddress," + "host_address,"+
"expires," + "expires,"+
"registerTime," + "register_time,"+
"keepaliveTime," + "keepalive_time,"+
"createTime," + "create_time,"+
"updateTime," + "update_time,"+
"charset," + "charset,"+
"subscribeCycleForCatalog," + "subscribe_cycle_for_catalog,"+
"subscribeCycleForMobilePosition," + "subscribe_cycle_for_mobile_position,"+
"mobilePositionSubmissionInterval," + "mobile_position_submission_interval,"+
"subscribeCycleForAlarm," + "subscribe_cycle_for_alarm,"+
"ssrcCheck," + "ssrc_check,"+
"asMessageChannel," + "as_message_channel,"+
"geoCoordSys," + "geo_coord_sys,"+
"treeType," + "tree_type,"+
"online " + "on_line"+
" FROM device WHERE online = 1") " FROM wvp_device WHERE on_line = true")
List<Device> getOnlineDevices(); List<Device> getOnlineDevices();
@Select("SELECT " + @Select("SELECT " +
"deviceId, " + "device_id,"+
"coalesce(custom_name, name) as name, " + "coalesce(custom_name,name)as name,"+
"password, " + "password,"+
"manufacturer, " + "manufacturer,"+
"model, " + "model,"+
"firmware, " + "firmware,"+
"transport," + "transport,"+
"streamMode," + "stream_mode,"+
"ip," + "ip,"+
"sdpIp," + "sdp_ip,"+
"localIp," + "local_ip,"+
"port," + "port,"+
"hostAddress," + "host_address,"+
"expires," + "expires,"+
"registerTime," + "register_time,"+
"keepaliveTime," + "keepalive_time,"+
"createTime," + "create_time,"+
"updateTime," + "update_time,"+
"charset," + "charset,"+
"subscribeCycleForCatalog," + "subscribe_cycle_for_catalog,"+
"subscribeCycleForMobilePosition," + "subscribe_cycle_for_mobile_position,"+
"mobilePositionSubmissionInterval," + "mobile_position_submission_interval,"+
"subscribeCycleForAlarm," + "subscribe_cycle_for_alarm,"+
"ssrcCheck," + "ssrc_check,"+
"asMessageChannel," + "as_message_channel,"+
"geoCoordSys," + "geo_coord_sys,"+
"treeType," + "tree_type,"+
"online" + "on_line"+
" FROM device WHERE ip = #{host} AND port=#{port}") " FROM wvp_device WHERE ip = #{host} AND port=#{port}")
Device getDeviceByHostAndPort(String host, int port); Device getDeviceByHostAndPort(String host, int port);
@Update(value = {" <script>" + @Update(value = {" <script>" +
"UPDATE device " + "UPDATE wvp_device " +
"SET updateTime=#{updateTime}" + "SET update_time=#{updateTime}" +
"<if test=\"name != null\">, custom_name=#{name}</if>" + "<if test=\"name != null\">, custom_name=#{name}</if>" +
"<if test=\"password != null\">, password=#{password}</if>" + "<if test=\"password != null\">, password=#{password}</if>" +
"<if test=\"streamMode != null\">, streamMode=#{streamMode}</if>" + "<if test=\"streamMode != null\">, stream_mode=#{streamMode}</if>" +
"<if test=\"ip != null\">, ip=#{ip}</if>" + "<if test=\"ip != null\">, ip=#{ip}</if>" +
"<if test=\"sdpIp != null\">, sdpIp=#{sdpIp}</if>" + "<if test=\"sdpIp != null\">, sdp_ip=#{sdpIp}</if>" +
"<if test=\"port != null\">, port=#{port}</if>" + "<if test=\"port != null\">, port=#{port}</if>" +
"<if test=\"charset != null\">, charset=#{charset}</if>" + "<if test=\"charset != null\">, charset=#{charset}</if>" +
"<if test=\"subscribeCycleForCatalog != null\">, subscribeCycleForCatalog=#{subscribeCycleForCatalog}</if>" + "<if test=\"subscribeCycleForCatalog != null\">, subscribe_cycle_for_catalog=#{subscribeCycleForCatalog}</if>" +
"<if test=\"subscribeCycleForMobilePosition != null\">, subscribeCycleForMobilePosition=#{subscribeCycleForMobilePosition}</if>" + "<if test=\"subscribeCycleForMobilePosition != null\">, subscribe_cycle_for_mobile_position=#{subscribeCycleForMobilePosition}</if>" +
"<if test=\"mobilePositionSubmissionInterval != null\">, mobilePositionSubmissionInterval=#{mobilePositionSubmissionInterval}</if>" + "<if test=\"mobilePositionSubmissionInterval != null\">, mobile_position_submission_interval=#{mobilePositionSubmissionInterval}</if>" +
"<if test=\"subscribeCycleForAlarm != null\">, subscribeCycleForAlarm=#{subscribeCycleForAlarm}</if>" + "<if test=\"subscribeCycleForAlarm != null\">, subscribe_cycle_for_alarm=#{subscribeCycleForAlarm}</if>" +
"<if test=\"ssrcCheck != null\">, ssrcCheck=#{ssrcCheck}</if>" + "<if test=\"ssrcCheck != null\">, ssrc_check=#{ssrcCheck}</if>" +
"<if test=\"asMessageChannel != null\">, asMessageChannel=#{asMessageChannel}</if>" + "<if test=\"asMessageChannel != null\">, as_message_channel=#{asMessageChannel}</if>" +
"<if test=\"geoCoordSys != null\">, geoCoordSys=#{geoCoordSys}</if>" + "<if test=\"geoCoordSys != null\">, geo_coord_sys=#{geoCoordSys}</if>" +
"<if test=\"treeType != null\">, treeType=#{treeType}</if>" + "<if test=\"treeType != null\">, tree_type=#{treeType}</if>" +
"<if test=\"mediaServerId != null\">, mediaServerId=#{mediaServerId}</if>" + "<if test=\"mediaServerId != null\">, media_server_id=#{mediaServerId}</if>" +
"WHERE deviceId=#{deviceId}"+ "WHERE device_id=#{deviceId}"+
" </script>"}) " </script>"})
void updateCustom(Device device); void updateCustom(Device device);
@Insert("INSERT INTO device (" + @Insert("INSERT INTO wvp_device (" +
"deviceId, " + "device_id,"+
"custom_name, " + "custom_name,"+
"password, " + "password,"+
"sdpIp, " + "sdp_ip,"+
"createTime," + "create_time,"+
"updateTime," + "update_time,"+
"charset," + "charset,"+
"ssrcCheck," + "ssrc_check,"+
"asMessageChannel," + "as_message_channel,"+
"geoCoordSys," + "geo_coord_sys,"+
"treeType," + "tree_type,"+
"online," + "on_line,"+
"mediaServerId" + "media_server_id"+
") VALUES (" + ") VALUES (" +
"#{deviceId}," + "#{deviceId}," +
"#{name}," + "#{name}," +
@ -283,17 +284,14 @@ public interface DeviceMapper {
"#{asMessageChannel}," + "#{asMessageChannel}," +
"#{geoCoordSys}," + "#{geoCoordSys}," +
"#{treeType}," + "#{treeType}," +
"#{online}," + "#{onLine}," +
"#{mediaServerId}" + "#{mediaServerId}" +
")") ")")
void addCustomDevice(Device device); void addCustomDevice(Device device);
@Select("select count(1) as total, sum(online) as online from device") @Select("select * FROM wvp_device")
ResourceBaceInfo getOverview();
@Select("select * from device")
List<Device> getAll(); List<Device> getAll();
@Select("select * from device where asMessageChannel = 1") @Select("select * FROM wvp_device where as_message_channel = true")
List<Device> queryDeviceWithAsMessageChannel(); List<Device> queryDeviceWithAsMessageChannel();
} }

View File

@ -11,25 +11,25 @@ import java.util.List;
@Mapper @Mapper
public interface DeviceMobilePositionMapper { public interface DeviceMobilePositionMapper {
@Insert("INSERT INTO device_mobile_position (deviceId,channelId, deviceName, time, longitude, latitude, altitude, speed, direction, reportSource, longitudeGcj02, latitudeGcj02, longitudeWgs84, latitudeWgs84, createTime) " + @Insert("INSERT INTO wvp_device_mobile_position (device_id,channel_id, device_name,time,longitude,latitude,altitude,speed,direction,report_source,longitude_gcj02,latitude_gcj02,longitude_wgs84,latitude_wgs84,create_time)"+
"VALUES (#{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); int insertNewPosition(MobilePosition mobilePosition);
@Select(value = {" <script>" + @Select(value = {" <script>" +
"SELECT * FROM device_mobile_position" + "SELECT * FROM wvp_device_mobile_position" +
" WHERE deviceId = #{deviceId}" + " WHERE device_id = #{deviceId}" +
"<if test=\"channelId != null\"> and channelId = #{channelId}</if>" + "<if test=\"channelId != null\"> and channel_id = #{channelId}</if>" +
"<if test=\"startTime != null\"> AND time&gt;=#{startTime}</if>" + "<if test=\"startTime != null\"> AND time&gt;=#{startTime}</if>" +
"<if test=\"endTime != null\"> AND time&lt;=#{endTime}</if>" + "<if test=\"endTime != null\"> AND time&lt;=#{endTime}</if>" +
" ORDER BY time ASC" + " ORDER BY time ASC" +
" </script>"}) " </script>"})
List<MobilePosition> queryPositionByDeviceIdAndTime(String deviceId, String channelId, String startTime, String endTime); List<MobilePosition> queryPositionByDeviceIdAndTime(String deviceId, String channelId, String startTime, String endTime);
@Select("SELECT * FROM device_mobile_position WHERE deviceId = #{deviceId}" + @Select("SELECT * FROM wvp_device_mobile_position WHERE device_id = #{deviceId}" +
" ORDER BY time DESC LIMIT 1") " ORDER BY time DESC LIMIT 1")
MobilePosition queryLatestPositionByDevice(String deviceId); MobilePosition queryLatestPositionByDevice(String deviceId);
@Delete("DELETE FROM device_mobile_position WHERE deviceId = #{deviceId}") @Delete("DELETE FROM wvp_device_mobile_position WHERE device_id = #{deviceId}")
int clearMobilePositionsByDeviceId(String deviceId); int clearMobilePositionsByDeviceId(String deviceId);
} }

View File

@ -14,94 +14,94 @@ import java.util.List;
@Repository @Repository
public interface GbStreamMapper { public interface GbStreamMapper {
@Insert("REPLACE INTO gb_stream (app, stream, gbId, name, " + @Insert("REPLACE INTO wvp_gb_stream (app, stream, gb_id, name, " +
"longitude, latitude, streamType, mediaServerId, createTime) VALUES" + "longitude, latitude, stream_type,media_server_id,create_time) VALUES" +
"(#{app}, #{stream}, #{gbId}, #{name}, " + "(#{app}, #{stream}, #{gbId}, #{name}, " +
"#{longitude}, #{latitude}, #{streamType}, " + "#{longitude}, #{latitude}, #{streamType}, " +
"#{mediaServerId}, #{createTime})") "#{mediaServerId}, #{createTime})")
@Options(useGeneratedKeys = true, keyProperty = "gbStreamId", keyColumn = "gbStreamId") @Options(useGeneratedKeys = true, keyProperty = "gbStreamId", keyColumn = "gbStreamId")
int add(GbStream gbStream); int add(GbStream gbStream);
@Update("UPDATE gb_stream " + @Update("UPDATE wvp_gb_stream " +
"SET app=#{app}," + "SET app=#{app}," +
"stream=#{stream}," + "stream=#{stream}," +
"gbId=#{gbId}," + "gb_id=#{gbId}," +
"name=#{name}," + "name=#{name}," +
"streamType=#{streamType}," + "stream_type=#{streamType}," +
"longitude=#{longitude}, " + "longitude=#{longitude}, " +
"latitude=#{latitude}," + "latitude=#{latitude}," +
"mediaServerId=#{mediaServerId}" + "media_server_id=#{mediaServerId}" +
"WHERE app=#{app} AND stream=#{stream}") "WHERE app=#{app} AND stream=#{stream}")
int updateByAppAndStream(GbStream gbStream); int updateByAppAndStream(GbStream gbStream);
@Update("UPDATE gb_stream " + @Update("UPDATE wvp_gb_stream " +
"SET app=#{app}," + "SET app=#{app}," +
"stream=#{stream}," + "stream=#{stream}," +
"gbId=#{gbId}," + "gb_id=#{gbId}," +
"name=#{name}," + "name=#{name}," +
"streamType=#{streamType}," + "stream_type=#{streamType}," +
"longitude=#{longitude}, " + "longitude=#{longitude}, " +
"latitude=#{latitude}," + "latitude=#{latitude}," +
"mediaServerId=#{mediaServerId}" + "media_server_id=#{mediaServerId}" +
"WHERE gbStreamId=#{gbStreamId}") "WHERE gb_stream_id=#{gbStreamId}")
int update(GbStream gbStream); int update(GbStream gbStream);
@Delete("DELETE FROM gb_stream WHERE app=#{app} AND stream=#{stream}") @Delete("DELETE FROM wvp_gb_stream WHERE app=#{app} AND stream=#{stream}")
int del(String app, String stream); int del(String app, String stream);
@Select("<script> "+ @Select("<script> "+
"SELECT gs.* FROM gb_stream gs " + "SELECT gs.* FROM wvp_gb_stream gs " +
"WHERE " + "WHERE " +
"1=1 " + "1=1 " +
" <if test='catalogId != null'> AND gs.gbStreamId in" + " <if test='catalogId != null'> AND gs.gb_stream_id in" +
"(select pgs.gbStreamId from platform_gb_stream pgs where pgs.platformId = #{platformId} and pgs.catalogId=#{catalogId})</if> " + "(select pgs.gb_stream_id from wvp_platform_gb_stream pgs where pgs.platform_id = #{platformId} and pgs.catalog_id=#{catalogId})</if> " +
" <if test='catalogId == null'> AND gs.gbStreamId not in" + " <if test='catalogId == null'> AND gs.gb_stream_id not in" +
"(select pgs.gbStreamId from platform_gb_stream pgs where pgs.platformId = #{platformId}) </if> " + "(select pgs.gb_stream_id from wvp_platform_gb_stream pgs where pgs.platform_id = #{platformId}) </if> " +
" <if test='query != null'> AND (gs.app LIKE concat('%',#{query},'%') OR gs.stream LIKE concat('%',#{query},'%') OR gs.gbId LIKE concat('%',#{query},'%') OR gs.name LIKE concat('%',#{query},'%'))</if> " + " <if test='query != null'> AND (gs.app LIKE concat('%',#{query},'%') OR gs.stream LIKE concat('%',#{query},'%') OR gs.gb_id LIKE concat('%',#{query},'%') OR gs.name LIKE concat('%',#{query},'%'))</if> " +
" <if test='mediaServerId != null' > AND gs.mediaServerId=#{mediaServerId} </if>" + " <if test='mediaServerId != null' > AND gs.media_server_id=#{mediaServerId} </if>" +
" order by gs.gbStreamId asc " + " order by gs.gb_stream_id asc " +
"</script>") "</script>")
List<GbStream> selectAll(String platformId, String catalogId, String query, String mediaServerId); List<GbStream> selectAll(String platformId, String catalogId, String query, String mediaServerId);
@Select("SELECT * FROM gb_stream WHERE app=#{app} AND stream=#{stream}") @Select("SELECT * FROM wvp_gb_stream WHERE app=#{app} AND stream=#{stream}")
GbStream selectOne(String app, String stream); GbStream selectOne(String app, String stream);
@Select("SELECT * FROM gb_stream WHERE gbId=#{gbId}") @Select("SELECT * FROM wvp_gb_stream WHERE gb_id=#{gbId}")
List<GbStream> selectByGBId(String gbId); List<GbStream> selectByGBId(String gbId);
@Select("SELECT gs.*, pgs.platformId as platformId, pgs.catalogId as catalogId FROM gb_stream gs " + @Select("SELECT gs.*, pgs.platform_id as platform_id, pgs.catalog_id as catalog_id FROM wvp_gb_stream gs " +
"LEFT JOIN platform_gb_stream pgs ON gs.gbStreamId = pgs.gbStreamId " + "LEFT JOIN wvp_platform_gb_stream pgs ON gs.gb_stream_id = pgs.gb_stream_id " +
"WHERE gs.gbId = #{gbId} AND pgs.platformId = #{platformId}") "WHERE gs.gb_id = #{gbId} AND pgs.platform_id = #{platformId}")
GbStream queryStreamInPlatform(String platformId, String gbId); GbStream queryStreamInPlatform(String platformId, String gbId);
@Select("<script> "+ @Select("<script> "+
"select gt.gbId as channelId, gt.name, 'wvp-pro' as manufacture, st.status, gt.longitude, gt.latitude, pc.id as parentId," + "select gt.gb_id as channel_id, gt.name, 'wvp-pro' as manufacture, st.status, gt.longitude, gt.latitude, pc.id as parent_id," +
" '1' as registerWay, pc.civilCode, 'live' as model, 'wvp-pro' as owner, '0' as parental,'0' as secrecy" + " '1' as register_way, pc.civil_code, 'live' as model, 'wvp-pro' as owner, '0' as parental,'0' as secrecy" +
" from gb_stream gt " + " from wvp_gb_stream gt " +
" left join (" + " left join (" +
" select " + " select " +
" <if test='usPushingAsStatus != true'> sp.status as status, </if>" + " <if test='usPushingAsStatus != true'> sp.status as status, </if>" +
" <if test='usPushingAsStatus == true'> sp.pushIng as status, </if>" + " <if test='usPushingAsStatus == true'> sp.push_ing as status, </if>" +
"sp.app, sp.stream from stream_push sp" + "sp.app, sp.stream from wvp_stream_push sp" +
" union all" + " union all" +
" select spxy.status, spxy.app, spxy.stream from stream_proxy spxy" + " select spxy.status, spxy.app, spxy.stream from wvp_stream_proxy spxy" +
" ) st on st.app = gt.app and st.stream = gt.stream" + " ) st on st.app = gt.app and st.stream = gt.stream" +
" left join platform_gb_stream pgs on gt.gbStreamId = pgs.gbStreamId" + " left join wvp_platform_gb_stream pgs on gt.gb_stream_id = pgs.gb_stream_id" +
" left join platform_catalog pc on pgs.catalogId = pc.id and pgs.platformId = pc.platformId" + " left join wvp_platform_catalog pc on pgs.catalog_id = pc.id and pgs.platform_id = pc.platform_id" +
" where pgs.platformId=#{platformId}" + " where pgs.platform_id=#{platformId}" +
"</script>") "</script>")
List<DeviceChannel> queryGbStreamListInPlatform(String platformId, boolean usPushingAsStatus); List<DeviceChannel> queryGbStreamListInPlatform(String platformId, boolean usPushingAsStatus);
@Select("SELECT gs.* FROM gb_stream gs LEFT JOIN platform_gb_stream pgs " + @Select("SELECT gs.* FROM wvp_gb_stream gs left join wvp_platform_gb_stream pgs " +
"ON gs.gbStreamId = pgs.gbStreamId WHERE pgs.gbStreamId is NULL") "ON gs.gb_stream_id = pgs.gb_stream_id WHERE pgs.gb_stream_id is NULL")
List<GbStream> queryStreamNotInPlatform(); List<GbStream> queryStreamNotInPlatform();
@Delete("DELETE FROM gb_stream WHERE streamType=#{type} AND gbId=NULL AND mediaServerId=#{mediaServerId}") @Delete("DELETE FROM wvp_gb_stream WHERE stream_type=#{type} AND gb_id=NULL AND media_server_id=#{mediaServerId}")
void deleteWithoutGBId(String type, String mediaServerId); void deleteWithoutGBId(String type, String mediaServerId);
@Delete("<script> "+ @Delete("<script> "+
"DELETE FROM gb_stream where " + "DELETE FROM wvp_gb_stream where " +
"<foreach collection='streamProxyItemList' item='item' separator='or'>" + "<foreach collection='streamProxyItemList' item='item' separator='or'>" +
"(app=#{item.app} and stream=#{item.stream}) " + "(app=#{item.app} and stream=#{item.stream}) " +
"</foreach>" + "</foreach>" +
@ -109,7 +109,7 @@ public interface GbStreamMapper {
void batchDel(List<StreamProxyItem> streamProxyItemList); void batchDel(List<StreamProxyItem> streamProxyItemList);
@Delete("<script> "+ @Delete("<script> "+
"DELETE FROM gb_stream where " + "DELETE FROM wvp_gb_stream where " +
"<foreach collection='gbStreams' item='item' separator='or'>" + "<foreach collection='gbStreams' item='item' separator='or'>" +
"(app=#{item.app} and stream=#{item.stream}) " + "(app=#{item.app} and stream=#{item.stream}) " +
"</foreach>" + "</foreach>" +
@ -117,9 +117,9 @@ public interface GbStreamMapper {
void batchDelForGbStream(List<GbStream> gbStreams); void batchDelForGbStream(List<GbStream> gbStreams);
@Insert("<script> " + @Insert("<script> " +
"INSERT IGNORE into gb_stream " + "INSERT into wvp_gb_stream " +
"(app, stream, gbId, name, " + "(app, stream, gb_id, name, " +
"longitude, latitude, streamType, mediaServerId, createTime)" + "longitude, latitude, stream_type,media_server_id,create_time)" +
"values " + "values " +
"<foreach collection='subList' index='index' item='item' separator=','> " + "<foreach collection='subList' index='index' item='item' separator=','> " +
"(#{item.app}, #{item.stream}, #{item.gbId}, #{item.name}, " + "(#{item.app}, #{item.stream}, #{item.gbId}, #{item.name}, " +
@ -127,46 +127,46 @@ public interface GbStreamMapper {
"#{item.mediaServerId}, #{item.createTime}) "+ "#{item.mediaServerId}, #{item.createTime}) "+
"</foreach> " + "</foreach> " +
"</script>") "</script>")
@Options(useGeneratedKeys = true, keyProperty = "gbStreamId", keyColumn = "gbStreamId") @Options(useGeneratedKeys = true, keyProperty = "gbStreamId", keyColumn = "gb_stream_id")
void batchAdd(List<StreamPushItem> subList); void batchAdd(List<StreamPushItem> subList);
@Update({"<script>" + @Update({"<script>" +
"<foreach collection='gpsMsgInfos' item='item' separator=';'>" + "<foreach collection='gpsMsgInfos' item='item' separator=';'>" +
" UPDATE" + " UPDATE" +
" gb_stream" + " wvp_gb_stream" +
" SET longitude=#{item.lng}, latitude=#{item.lat} " + " SET longitude=#{item.lng}, latitude=#{item.lat} " +
"WHERE gbId=#{item.id}"+ "WHERE gb_id=#{item.id}"+
"</foreach>" + "</foreach>" +
"</script>"}) "</script>"})
int updateStreamGPS(List<GPSMsgInfo> gpsMsgInfos); int updateStreamGPS(List<GPSMsgInfo> gpsMsgInfos);
@Select("<script> "+ @Select("<script> "+
"SELECT * FROM gb_stream where " + "SELECT * FROM wvp_gb_stream where " +
"<foreach collection='streamPushItems' item='item' separator='or'>" + "<foreach collection='streamPushItems' item='item' separator='or'>" +
"(app=#{item.app} and stream=#{item.stream}) " + "(app=#{item.app} and stream=#{item.stream}) " +
"</foreach>" + "</foreach>" +
"</script>") "</script>")
List<GbStream> selectAllForAppAndStream(List<StreamPushItem> streamPushItems); List<GbStream> selectAllForAppAndStream(List<StreamPushItem> streamPushItems);
@Update("UPDATE gb_stream " + @Update("UPDATE wvp_gb_stream " +
"SET mediaServerId=#{mediaServerId}" + "SET media_server_id=#{mediaServerId}" +
"WHERE app=#{app} AND stream=#{stream}") "WHERE app=#{app} AND stream=#{stream}")
void updateMediaServer(String app, String stream, String mediaServerId); void updateMediaServer(String app, String stream, String mediaServerId);
@Update("<script> "+ @Update("<script> "+
" <foreach collection='list' item='item' index='index' separator=';'>"+ " <foreach collection='list' item='item' index='index' separator=';'>"+
"UPDATE gb_stream " + "UPDATE wvp_gb_stream " +
" SET name=#{item.name},"+ " SET name=#{item.name},"+
" gbId=#{item.gbId}"+ " gb_id=#{item.gb_id}"+
" WHERE app=#{item.app} and stream=#{item.stream}"+ " WHERE app=#{item.app} and stream=#{item.stream}"+
"</foreach>"+ "</foreach>"+
"</script>") "</script>")
int updateGbIdOrName(List<StreamPushItem> streamPushItemForUpdate); int updateGbIdOrName(List<StreamPushItem> streamPushItemForUpdate);
@Select("SELECT status FROM stream_proxy WHERE app=#{app} AND stream=#{stream}") @Select("SELECT status FROM wvp_stream_proxy WHERE app=#{app} AND stream=#{stream}")
Boolean selectStatusForProxy(String app, String stream); Boolean selectStatusForProxy(String app, String stream);
@Select("SELECT status FROM stream_push WHERE app=#{app} AND stream=#{stream}") @Select("SELECT status FROM wvp_stream_push WHERE app=#{app} AND stream=#{stream}")
Boolean selectStatusForPush(String app, String stream); Boolean selectStatusForPush(String app, String stream);
} }

View File

@ -1,6 +1,5 @@
package com.genersoft.iot.vmp.storager.dao; package com.genersoft.iot.vmp.storager.dao;
import com.genersoft.iot.vmp.gb28181.bean.DeviceAlarm;
import com.genersoft.iot.vmp.storager.dao.dto.LogDto; import com.genersoft.iot.vmp.storager.dao.dto.LogDto;
import org.apache.ibatis.annotations.Delete; import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert; import org.apache.ibatis.annotations.Insert;
@ -17,21 +16,21 @@ import java.util.List;
@Repository @Repository
public interface LogMapper { public interface LogMapper {
@Insert("insert into log ( name, type, uri, address, result, timing, username, createTime) " + @Insert("insert into wvp_log ( name,type,uri,address,result,timing,username,create_time) " +
"values (#{name}, #{type}, #{uri}, #{address}, #{result}, #{timing}, #{username}, #{createTime})") "values (#{name}, #{type}, #{uri}, #{address}, #{result}, #{timing}, #{username}, #{createTime})")
int add(LogDto logDto); int add(LogDto logDto);
@Select(value = {"<script>" + @Select(value = {"<script>" +
" SELECT * FROM log " + " SELECT * FROM wvp_log " +
" WHERE 1=1 " + " WHERE 1=1 " +
" <if test=\"query != null\"> AND (name LIKE concat('%',#{query},'%'))</if> " + " <if test=\"query != null\"> AND (name LIKE concat('%',#{query},'%'))</if> " +
" <if test=\"type != null\" > AND type = #{type}</if>" + " <if test=\"type != null\" > AND type = #{type}</if>" +
" <if test=\"startTime != null\" > AND createTime &gt;= #{startTime} </if>" + " <if test=\"startTime != null\" > AND create_time &gt;= #{startTime} </if>" +
" <if test=\"endTime != null\" > AND createTime &lt;= #{endTime} </if>" + " <if test=\"endTime != null\" > AND create_time &lt;= #{endTime} </if>" +
" ORDER BY createTime DESC " + " ORDER BY create_time DESC " +
" </script>"}) " </script>"})
List<LogDto> query(String query, String type, String startTime, String endTime); List<LogDto> query(String query, String type, String startTime, String endTime);
@Delete("DELETE FROM log") @Delete("DELETE FROM wvp_log")
int clear(); int clear();
} }

View File

@ -11,28 +11,28 @@ import java.util.List;
@Repository @Repository
public interface MediaServerMapper { public interface MediaServerMapper {
@Insert("INSERT INTO media_server (" + @Insert("INSERT INTO wvp_media_server (" +
"id, " + "id,"+
"ip, " + "ip,"+
"hookIp, " + "hook_ip,"+
"sdpIp, " + "sdp_ip,"+
"streamIp, " + "stream_ip,"+
"httpPort, " + "http_port,"+
"httpSSlPort, " + "http_ssl_port,"+
"rtmpPort, " + "rtmp_port,"+
"rtmpSSlPort, " + "rtmp_ssl_port,"+
"rtpProxyPort, " + "rtp_proxy_port,"+
"rtspPort, " + "rtsp_port,"+
"rtspSSLPort, " + "rtsp_ssl_port,"+
"autoConfig, " + "auto_config,"+
"secret, " + "secret,"+
"rtpEnable, " + "rtp_enable,"+
"rtpPortRange, " + "rtp_port_range,"+
"recordAssistPort, " + "record_assist_port,"+
"defaultServer, " + "default_server,"+
"createTime, " + "create_time,"+
"updateTime, " + "update_time,"+
"hookAliveInterval" + "hook_alive_interval"+
") VALUES " + ") VALUES " +
"(" + "(" +
"#{id}, " + "#{id}, " +
@ -59,70 +59,70 @@ public interface MediaServerMapper {
int add(MediaServerItem mediaServerItem); int add(MediaServerItem mediaServerItem);
@Update(value = {" <script>" + @Update(value = {" <script>" +
"UPDATE media_server " + "UPDATE wvp_media_server " +
"SET updateTime=#{updateTime}" + "SET update_time=#{updateTime}" +
"<if test=\"ip != null\">, ip=#{ip}</if>" + "<if test=\"ip != null\">, ip=#{ip}</if>" +
"<if test=\"hookIp != null\">, hookIp=#{hookIp}</if>" + "<if test=\"hookIp != null\">, hook_ip=#{hookIp}</if>" +
"<if test=\"sdpIp != null\">, sdpIp=#{sdpIp}</if>" + "<if test=\"sdpIp != null\">, sdp_ip=#{sdpIp}</if>" +
"<if test=\"streamIp != null\">, streamIp=#{streamIp}</if>" + "<if test=\"streamIp != null\">, stream_ip=#{streamIp}</if>" +
"<if test=\"httpPort != null\">, httpPort=#{httpPort}</if>" + "<if test=\"httpPort != null\">, http_port=#{httpPort}</if>" +
"<if test=\"httpSSlPort != null\">, httpSSlPort=#{httpSSlPort}</if>" + "<if test=\"httpSSlPort != null\">, http_ssl_port=#{httpSSlPort}</if>" +
"<if test=\"rtmpPort != null\">, rtmpPort=#{rtmpPort}</if>" + "<if test=\"rtmpPort != null\">, rtmp_port=#{rtmpPort}</if>" +
"<if test=\"rtmpSSlPort != null\">, rtmpSSlPort=#{rtmpSSlPort}</if>" + "<if test=\"rtmpSSlPort != null\">, rtmp_ssl_port=#{rtmpSSlPort}</if>" +
"<if test=\"rtpProxyPort != null\">, rtpProxyPort=#{rtpProxyPort}</if>" + "<if test=\"rtpProxyPort != null\">, rtp_proxy_port=#{rtpProxyPort}</if>" +
"<if test=\"rtspPort != null\">, rtspPort=#{rtspPort}</if>" + "<if test=\"rtspPort != null\">, rtsp_port=#{rtspPort}</if>" +
"<if test=\"rtspSSLPort != null\">, rtspSSLPort=#{rtspSSLPort}</if>" + "<if test=\"rtspSSLPort != null\">, rtsp_ssl_port=#{rtspSSLPort}</if>" +
"<if test=\"autoConfig != null\">, autoConfig=#{autoConfig}</if>" + "<if test=\"autoConfig != null\">, auto_config=#{autoConfig}</if>" +
"<if test=\"rtpEnable != null\">, rtpEnable=#{rtpEnable}</if>" + "<if test=\"rtpEnable != null\">, rtp_enable=#{rtpEnable}</if>" +
"<if test=\"rtpPortRange != null\">, rtpPortRange=#{rtpPortRange}</if>" + "<if test=\"rtpPortRange != null\">, rtp_port_range=#{rtpPortRange}</if>" +
"<if test=\"secret != null\">, secret=#{secret}</if>" + "<if test=\"secret != null\">, secret=#{secret}</if>" +
"<if test=\"recordAssistPort != null\">, recordAssistPort=#{recordAssistPort}</if>" + "<if test=\"recordAssistPort != null\">, record_assist_port=#{recordAssistPort}</if>" +
"<if test=\"hookAliveInterval != null\">, hookAliveInterval=#{hookAliveInterval}</if>" + "<if test=\"hookAliveInterval != null\">, hook_alive_interval=#{hookAliveInterval}</if>" +
"WHERE id=#{id}"+ "WHERE id=#{id}"+
" </script>"}) " </script>"})
int update(MediaServerItem mediaServerItem); int update(MediaServerItem mediaServerItem);
@Update(value = {" <script>" + @Update(value = {" <script>" +
"UPDATE media_server " + "UPDATE wvp_media_server " +
"SET updateTime=#{updateTime}" + "SET update_time=#{updateTime}" +
"<if test=\"id != null\">, id=#{id}</if>" + "<if test=\"id != null\">, id=#{id}</if>" +
"<if test=\"hookIp != null\">, hookIp=#{hookIp}</if>" + "<if test=\"hookIp != null\">, hook_ip=#{hookIp}</if>" +
"<if test=\"sdpIp != null\">, sdpIp=#{sdpIp}</if>" + "<if test=\"sdpIp != null\">, sdp_ip=#{sdpIp}</if>" +
"<if test=\"streamIp != null\">, streamIp=#{streamIp}</if>" + "<if test=\"streamIp != null\">, stream_ip=#{streamIp}</if>" +
"<if test=\"httpSSlPort != null\">, httpSSlPort=#{httpSSlPort}</if>" + "<if test=\"httpSSlPort != null\">, http_ssl_port=#{httpSSlPort}</if>" +
"<if test=\"rtmpPort != null\">, rtmpPort=#{rtmpPort}</if>" + "<if test=\"rtmpPort != null\">, rtmp_port=#{rtmpPort}</if>" +
"<if test=\"rtmpSSlPort != null\">, rtmpSSlPort=#{rtmpSSlPort}</if>" + "<if test=\"rtmpSSlPort != null\">, rtmp_ssl_port=#{rtmpSSlPort}</if>" +
"<if test=\"rtpProxyPort != null\">, rtpProxyPort=#{rtpProxyPort}</if>" + "<if test=\"rtpProxyPort != null\">, rtp_proxy_port=#{rtpProxyPort}</if>" +
"<if test=\"rtspPort != null\">, rtspPort=#{rtspPort}</if>" + "<if test=\"rtspPort != null\">, rtsp_port=#{rtspPort}</if>" +
"<if test=\"rtspSSLPort != null\">, rtspSSLPort=#{rtspSSLPort}</if>" + "<if test=\"rtspSSLPort != null\">, rtsp_ssl_port=#{rtspSSLPort}</if>" +
"<if test=\"autoConfig != null\">, autoConfig=#{autoConfig}</if>" + "<if test=\"autoConfig != null\">, auto_config=#{autoConfig}</if>" +
"<if test=\"rtpEnable != null\">, rtpEnable=#{rtpEnable}</if>" + "<if test=\"rtpEnable != null\">, rtp_enable=#{rtpEnable}</if>" +
"<if test=\"rtpPortRange != null\">, rtpPortRange=#{rtpPortRange}</if>" + "<if test=\"rtpPortRange != null\">, rtp_port_range=#{rtpPortRange}</if>" +
"<if test=\"secret != null\">, secret=#{secret}</if>" + "<if test=\"secret != null\">, secret=#{secret}</if>" +
"<if test=\"recordAssistPort != null\">, recordAssistPort=#{recordAssistPort}</if>" + "<if test=\"recordAssistPort != null\">, record_assist_port=#{recordAssistPort}</if>" +
"<if test=\"hookAliveInterval != null\">, hookAliveInterval=#{hookAliveInterval}</if>" + "<if test=\"hookAliveInterval != null\">, hook_alive_interval=#{hookAliveInterval}</if>" +
"WHERE ip=#{ip} and httpPort=#{httpPort}"+ "WHERE ip=#{ip} and http_port=#{httpPort}"+
" </script>"}) " </script>"})
int updateByHostAndPort(MediaServerItem mediaServerItem); int updateByHostAndPort(MediaServerItem mediaServerItem);
@Select("SELECT * FROM media_server WHERE id=#{id}") @Select("SELECT * FROM wvp_media_server WHERE id=#{id}")
MediaServerItem queryOne(String id); MediaServerItem queryOne(String id);
@Select("SELECT * FROM media_server") @Select("SELECT * FROM wvp_media_server")
List<MediaServerItem> queryAll(); List<MediaServerItem> queryAll();
@Delete("DELETE FROM media_server WHERE id=#{id}") @Delete("DELETE FROM wvp_media_server WHERE id=#{id}")
void delOne(String id); void delOne(String id);
@Select("DELETE FROM media_server WHERE ip=#{host} and httpPort=#{port}") @Select("DELETE FROM wvp_media_server WHERE ip=#{host} and http_port=#{port}")
void delOneByIPAndPort(String host, int port); void delOneByIPAndPort(String host, int port);
@Delete("DELETE FROM media_server WHERE defaultServer=1") @Delete("DELETE FROM wvp_media_server WHERE default_server=true")
int delDefault(); int delDefault();
@Select("SELECT * FROM media_server WHERE ip=#{host} and httpPort=#{port}") @Select("SELECT * FROM wvp_media_server WHERE ip=#{host} and http_port=#{port}")
MediaServerItem queryOneByHostAndPort(String host, int port); MediaServerItem queryOneByHostAndPort(String host, int port);
@Select("SELECT * FROM media_server WHERE defaultServer=1") @Select("SELECT * FROM wvp_media_server WHERE default_server=true")
MediaServerItem queryDefault(); MediaServerItem queryDefault();
} }

View File

@ -14,88 +14,88 @@ import java.util.List;
@Repository @Repository
public interface ParentPlatformMapper { public interface ParentPlatformMapper {
@Insert("INSERT INTO parent_platform (enable, name, serverGBId, serverGBDomain, serverIP, serverPort, deviceGBId, deviceIp, " + @Insert("INSERT INTO wvp_platform (enable, name, server_gb_id, server_gb_domain, server_ip, server_port,device_gb_id,device_ip,"+
" devicePort, username, password, expires, keepTimeout, transport, characterSet, ptz, rtcp, asMessageChannel, " + "device_port,username,password,expires,keep_timeout,transport,character_set,ptz,rtcp,as_message_channel,"+
" status, startOfflinePush, catalogId, administrativeDivision, catalogGroup, createTime, updateTime, treeType) " + "status,start_offline_push,catalog_id,administrative_division,catalog_group,create_time,update_time,tree_type) " +
" VALUES (#{enable}, #{name}, #{serverGBId}, #{serverGBDomain}, #{serverIP}, #{serverPort}, #{deviceGBId}, #{deviceIp}, " + " VALUES (#{enable}, #{name}, #{serverGBId}, #{serverGBDomain}, #{serverIP}, #{serverPort}, #{deviceGBId}, #{deviceIp}, " +
" #{devicePort}, #{username}, #{password}, #{expires}, #{keepTimeout}, #{transport}, #{characterSet}, #{ptz}, #{rtcp}, #{asMessageChannel}, " + " #{devicePort}, #{username}, #{password}, #{expires}, #{keepTimeout}, #{transport}, #{characterSet}, #{ptz}, #{rtcp}, #{asMessageChannel}, " +
" #{status}, #{startOfflinePush}, #{catalogId}, #{administrativeDivision}, #{catalogGroup}, #{createTime}, #{updateTime}, #{treeType})") " #{status}, #{startOfflinePush}, #{catalogId}, #{administrativeDivision}, #{catalogGroup}, #{createTime}, #{updateTime}, #{treeType})")
int addParentPlatform(ParentPlatform parentPlatform); int addParentPlatform(ParentPlatform parentPlatform);
@Update("UPDATE parent_platform " + @Update("UPDATE wvp_platform " +
"SET enable=#{enable}, " + "SET enable=#{enable}, " +
"name=#{name}," + "name=#{name}," +
"deviceGBId=#{deviceGBId}," + "device_gb_id=#{deviceGBId}," +
"serverGBId=#{serverGBId}, " + "server_gb_id=#{serverGBId}, " +
"serverGBDomain=#{serverGBDomain}, " + "server_gb_domain=#{serverGBDomain}, " +
"serverIP=#{serverIP}," + "server_ip=#{serverIP}," +
"serverPort=#{serverPort}, " + "server_port=#{serverPort}, " +
"deviceIp=#{deviceIp}, " + "device_ip=#{deviceIp}, " +
"devicePort=#{devicePort}, " + "device_port=#{devicePort}, " +
"username=#{username}, " + "username=#{username}, " +
"password=#{password}, " + "password=#{password}, " +
"expires=#{expires}, " + "expires=#{expires}, " +
"keepTimeout=#{keepTimeout}, " + "keep_timeout=#{keepTimeout}, " +
"transport=#{transport}, " + "transport=#{transport}, " +
"characterSet=#{characterSet}, " + "character_set=#{characterSet}, " +
"ptz=#{ptz}, " + "ptz=#{ptz}, " +
"rtcp=#{rtcp}, " + "rtcp=#{rtcp}, " +
"asMessageChannel=#{asMessageChannel}, " + "as_message_channel=#{asMessageChannel}, " +
"status=#{status}, " + "status=#{status}, " +
"startOfflinePush=#{startOfflinePush}, " + "start_offline_push=#{startOfflinePush}, " +
"catalogGroup=#{catalogGroup}, " + "catalog_group=#{catalogGroup}, " +
"administrativeDivision=#{administrativeDivision}, " + "administrative_division=#{administrativeDivision}, " +
"createTime=#{createTime}, " + "create_time=#{createTime}, " +
"updateTime=#{updateTime}, " + "update_time=#{updateTime}, " +
"treeType=#{treeType}, " + "tree_type=#{treeType}, " +
"catalogId=#{catalogId} " + "catalog_id=#{catalogId} " +
"WHERE id=#{id}") "WHERE id=#{id}")
int updateParentPlatform(ParentPlatform parentPlatform); int updateParentPlatform(ParentPlatform parentPlatform);
@Delete("DELETE FROM parent_platform WHERE serverGBId=#{serverGBId}") @Delete("DELETE FROM wvp_platform WHERE server_gb_id=#{serverGBId}")
int delParentPlatform(ParentPlatform parentPlatform); int delParentPlatform(ParentPlatform parentPlatform);
@Select("SELECT *, ((SELECT count(0)\n" + @Select("SELECT *, ((SELECT count(0)\n" +
" FROM platform_gb_channel pc\n" + " FROM wvp_platform_gb_channel pc\n" +
" WHERE pc.platformId = pp.serverGBId)\n" + " WHERE pc.platform_id = pp.server_gb_id)\n" +
" +\n" + " +\n" +
" (SELECT count(0)\n" + " (SELECT count(0)\n" +
" FROM platform_gb_stream pgs\n" + " FROM wvp_platform_gb_stream pgs\n" +
" WHERE pgs.platformId = pp.serverGBId)\n" + " WHERE pgs.platform_id = pp.server_gb_id)\n" +
" +\n" + " +\n" +
" (SELECT count(0)\n" + " (SELECT count(0)\n" +
" FROM platform_catalog pgc\n" + " FROM wvp_platform_catalog pgc\n" +
" WHERE pgc.platformId = pp.serverGBId)) as channelCount\n" + " WHERE pgc.platform_id = pp.server_gb_id)) as channel_count\n" +
"FROM parent_platform pp ") "FROM wvp_platform pp ")
List<ParentPlatform> getParentPlatformList(); List<ParentPlatform> getParentPlatformList();
@Select("SELECT * FROM parent_platform WHERE enable=#{enable} ") @Select("SELECT * FROM wvp_platform WHERE enable=#{enable} ")
List<ParentPlatform> getEnableParentPlatformList(boolean enable); List<ParentPlatform> getEnableParentPlatformList(boolean enable);
@Select("SELECT * FROM parent_platform WHERE enable=1 and asMessageChannel = 1") @Select("SELECT * FROM wvp_platform WHERE enable=true and as_message_channel=true")
List<ParentPlatform> queryEnablePlatformListWithAsMessageChannel(); List<ParentPlatform> queryEnablePlatformListWithAsMessageChannel();
@Select("SELECT * FROM parent_platform WHERE serverGBId=#{platformGbId}") @Select("SELECT * FROM wvp_platform WHERE server_gb_id=#{platformGbId}")
ParentPlatform getParentPlatByServerGBId(String platformGbId); ParentPlatform getParentPlatByServerGBId(String platformGbId);
@Select("SELECT * FROM parent_platform WHERE id=#{id}") @Select("SELECT * FROM wvp_platform WHERE id=#{id}")
ParentPlatform getParentPlatById(int id); ParentPlatform getParentPlatById(int id);
@Update("UPDATE parent_platform SET status=false" ) @Update("UPDATE wvp_platform SET status=false" )
int outlineForAllParentPlatform(); int outlineForAllParentPlatform();
@Update("UPDATE parent_platform SET status=#{online} WHERE serverGBId=#{platformGbID}" ) @Update("UPDATE wvp_platform SET status=#{online} WHERE server_gb_id=#{platformGbID}" )
int updateParentPlatformStatus(String platformGbID, boolean online); int updateParentPlatformStatus(String platformGbID, boolean online);
@Update(value = {" <script>" + @Update(value = {" <script>" +
"UPDATE parent_platform " + "UPDATE wvp_platform " +
"SET catalogId=#{catalogId}, updateTime=#{updateTime}" + "SET catalog_id=#{catalogId}, update_time=#{updateTime}" +
"WHERE serverGBId=#{platformId}"+ "WHERE server_gb_id=#{platformId}"+
"</script>"}) "</script>"})
int setDefaultCatalog(String platformId, String catalogId, String updateTime); 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} " + @Select("select 'channel' as name, count(pgc.platform_id) count from wvp_platform_gb_channel pgc left join wvp_device_channel dc on dc.id = pgc.device_channel_id where pgc.platform_id=#{platform_id} and dc.channel_id =#{gbId} " +
"union " + "union " +
"select 'stream' as name, count(pgs.platformId) count from platform_gb_stream pgs left join gb_stream gs on pgs.gbStreamId = gs.gbStreamId where pgs.platformId=#{platformId} and gs.gbId = #{gbId}") "select 'stream' as name, count(pgs.platform_id) count from wvp_platform_gb_stream pgs left join wvp_gb_stream gs on pgs.gb_stream_id = gs.gb_stream_id where pgs.platform_id=#{platform_id} and gs.gb_id #{gbId}")
List<ChannelSourceInfo> getChannelSource(String platformId, String gbId); List<ChannelSourceInfo> getChannelSource(String platform_id, String gbId);
} }

View File

@ -1,10 +1,7 @@
package com.genersoft.iot.vmp.storager.dao; package com.genersoft.iot.vmp.storager.dao;
import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel; import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel;
import com.genersoft.iot.vmp.gb28181.bean.GbStream;
import com.genersoft.iot.vmp.gb28181.bean.PlatformCatalog; import com.genersoft.iot.vmp.gb28181.bean.PlatformCatalog;
import com.genersoft.iot.vmp.gb28181.bean.PlatformGbStream;
import com.genersoft.iot.vmp.media.zlm.dto.StreamProxyItem;
import org.apache.ibatis.annotations.*; import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
@ -15,22 +12,23 @@ import java.util.List;
@Repository @Repository
public interface PlatformCatalogMapper { public interface PlatformCatalogMapper {
@Insert("INSERT INTO platform_catalog (id, name, platformId, parentId, civilCode, businessGroupId) VALUES" + @Insert("INSERT INTO platform_catalog (id, name, platform_id, parent_id, civil_code, business_group_id) VALUES" +
"(#{id}, #{name}, #{platformId}, #{parentId}, #{civilCode}, #{businessGroupId})") "(#{id}, #{name}, #{platformId}, #{parentId}, #{civilCode}, #{businessGroupId})")
int add(PlatformCatalog platformCatalog); int add(PlatformCatalog platformCatalog);
@Delete("DELETE FROM platform_catalog WHERE id=#{id}") @Delete("DELETE from wvp_platform_catalog WHERE id=#{id}")
int del(String id); int del(String id);
@Delete("DELETE FROM platform_catalog WHERE platformId=#{platformId}") @Delete("DELETE from wvp_platform_catalog WHERE platform_id=#{platformId}")
int delByPlatformId(String platformId); int delByPlatformId(String platformId);
@Select("SELECT pc.*, count(pc2.id) as childrenCount FROM platform_catalog pc " + @Select("SELECT pc.*, count(pc2.id) as children_count from wvp_platform_catalog pc " +
"left join platform_catalog pc2 on pc.id = pc2.parentId " + "left join wvp_platform_catalog pc2 on pc.id = pc2.parent_id " +
"WHERE pc.parentId=#{parentId} AND pc.platformId=#{platformId} group by pc.id") "WHERE pc.parent_id=#{parentId} AND pc.platform_id=#{platformId} " +
"group by pc.id, pc.name, pc.platform_id, pc.business_group_id, pc.civil_code, pc.parent_id")
List<PlatformCatalog> selectByParentId(String platformId, String parentId); List<PlatformCatalog> selectByParentId(String platformId, String parentId);
@Select("SELECT *, (SELECT COUNT(1) from platform_catalog where parentId = pc.id) as childrenCount FROM platform_catalog pc WHERE pc.id=#{id}") @Select("SELECT *, (SELECT COUNT(1) from wvp_platform_catalog where parent_id = pc.id) as children_count from wvp_platform_catalog pc WHERE pc.id=#{id}")
PlatformCatalog select(String id); PlatformCatalog select(String id);
@Update(value = {" <script>" + @Update(value = {" <script>" +
@ -40,17 +38,17 @@ public interface PlatformCatalogMapper {
"</script>"}) "</script>"})
int update(PlatformCatalog platformCatalog); int update(PlatformCatalog platformCatalog);
@Select("SELECT *, (SELECT COUNT(1) from platform_catalog where parentId = pc.id) as childrenCount FROM platform_catalog pc WHERE pc.platformId=#{platformId}") @Select("SELECT *, (SELECT COUNT(1) from wvp_platform_catalog where parent_id = pc.id) as children_count from wvp_platform_catalog pc WHERE pc.platform_id=#{platformId}")
List<PlatformCatalog> selectByPlatForm(String platformId); List<PlatformCatalog> selectByPlatForm(String platformId);
@Select("SELECT pc.* FROM platform_catalog pc WHERE pc.id = (SELECT pp.catalogId from parent_platform pp WHERE pp.serverGBId=#{platformId})") @Select("SELECT pc.* FROM platform_catalog pc WHERE pc.id = (SELECT pp.catalog_id from wvp_platform pp WHERE pp.server_gb_id=#{platformId})")
PlatformCatalog selectDefaultByPlatFormId(String platformId); PlatformCatalog selectDefaultByPlatFormId(String platformId);
@Select("SELECT pc.* FROM platform_catalog pc WHERE pc.id = #{id}") @Select("SELECT pc.* FROM platform_catalog pc WHERE pc.id = #{id}")
PlatformCatalog selectParentCatalog(String id); PlatformCatalog selectParentCatalog(String id);
@Select("SELECT pc.id as channelId, pc.name, pc.civilCode, pc.businessGroupId,'1' as parental, pc.parentId " + @Select("SELECT pc.id as channel_id, pc.name, pc.civil_code, pc.business_group_id,'1' as parental, pc.parent_id " +
" FROM platform_catalog pc WHERE pc.platformId=#{platformId}") " from wvp_platform_catalog pc WHERE pc.platform_id=#{platformId}")
List<DeviceChannel> queryCatalogInPlatform(String platformId); List<DeviceChannel> queryCatalogInPlatform(String platformId);
} }

View File

@ -21,13 +21,13 @@ public interface PlatformChannelMapper {
* 查询列表里已经关联的 * 查询列表里已经关联的
*/ */
@Select("<script> "+ @Select("<script> "+
"SELECT deviceChannelId FROM platform_gb_channel WHERE platformId=#{platformId} AND deviceChannelId in" + "SELECT device_channel_id from wvp_platform_gb_channel WHERE platform_id=#{platformId} AND device_channel_id in" +
"<foreach collection='channelReduces' open='(' item='item' separator=',' close=')'> #{item.id}</foreach>" + "<foreach collection='channelReduces' open='(' item='item' separator=',' close=')'> #{item.id}</foreach>" +
"</script>") "</script>")
List<Integer> findChannelRelatedPlatform(String platformId, List<ChannelReduce> channelReduces); List<Integer> findChannelRelatedPlatform(String platformId, List<ChannelReduce> channelReduces);
@Insert("<script> "+ @Insert("<script> "+
"INSERT INTO platform_gb_channel (platformId, deviceChannelId, catalogId) VALUES" + "INSERT INTO wvp_platform_gb_channel (platform_id, device_channel_id, catalog_id) VALUES" +
"<foreach collection='channelReducesToAdd' item='item' separator=','>" + "<foreach collection='channelReducesToAdd' item='item' separator=','>" +
" (#{platformId}, #{item.id} , #{item.catalogId} )" + " (#{platformId}, #{item.id} , #{item.catalogId} )" +
"</foreach>" + "</foreach>" +
@ -35,50 +35,50 @@ public interface PlatformChannelMapper {
int addChannels(String platformId, List<ChannelReduce> channelReducesToAdd); int addChannels(String platformId, List<ChannelReduce> channelReducesToAdd);
@Delete("<script> "+ @Delete("<script> "+
"DELETE FROM platform_gb_channel WHERE platformId=#{platformId} AND deviceChannelId in" + "DELETE from wvp_platform_gb_channel WHERE platform_id=#{platformId} AND device_channel_id in" +
"<foreach collection='channelReducesToDel' item='item' open='(' separator=',' close=')' > #{item.id}</foreach>" + "<foreach collection='channelReducesToDel' item='item' open='(' separator=',' close=')' > #{item.id}</foreach>" +
"</script>") "</script>")
int delChannelForGB(String platformId, List<ChannelReduce> channelReducesToDel); int delChannelForGB(String platformId, List<ChannelReduce> channelReducesToDel);
@Delete("<script> "+ @Delete("<script> "+
"DELETE FROM platform_gb_channel WHERE deviceChannelId in " + "DELETE from wvp_platform_gb_channel WHERE device_channel_id in " +
"( select temp.deviceChannelId from " + "( select temp.device_channel_id from " +
"(select pgc.deviceChannelId from platform_gb_channel pgc " + "(select pgc.device_channel_id from wvp_platform_gb_channel pgc " +
"left join device_channel dc on dc.id = pgc.deviceChannelId where dc.deviceId =#{deviceId} " + "left join wvp_device_channel dc on dc.id = pgc.device_channel_id where dc.device_id =#{deviceId} " +
") temp)" + ") temp)" +
"</script>") "</script>")
int delChannelForDeviceId(String deviceId); int delChannelForDeviceId(String deviceId);
@Delete("<script> "+ @Delete("<script> "+
"DELETE FROM platform_gb_channel WHERE platformId=#{platformId}" + "DELETE from wvp_platform_gb_channel WHERE platform_id=#{platformId}" +
"</script>") "</script>")
int cleanChannelForGB(String platformId); int cleanChannelForGB(String platformId);
@Select("SELECT dc.* FROM platform_gb_channel pgc left join device_channel dc on dc.id = pgc.deviceChannelId WHERE dc.channelId=#{channelId} and pgc.platformId=#{platformId}") @Select("SELECT dc.* from wvp_platform_gb_channel pgc left join wvp_device_channel dc on dc.id = pgc.device_channel_id WHERE dc.channel_id=#{channelId} and pgc.platform_id=#{platformId}")
List<DeviceChannel> queryChannelInParentPlatform(String platformId, String channelId); List<DeviceChannel> queryChannelInParentPlatform(String platformId, String channelId);
@Select("SELECT dc.* FROM platform_gb_channel pgc left join device_channel dc on dc.id = pgc.deviceChannelId WHERE pgc.platformId=#{platformId} and pgc.catalogId=#{catalogId}") @Select("SELECT dc.* from wvp_platform_gb_channel pgc left join wvp_device_channel dc on dc.id = pgc.device_channel_id WHERE pgc.platform_id=#{platformId} and pgc.catalog_id=#{catalogId}")
List<DeviceChannel> queryAllChannelInCatalog(String platformId, String catalogId); List<DeviceChannel> queryAllChannelInCatalog(String platformId, String catalogId);
@Select(" select dc.channelId as id, dc.name as name, pgc.platformId as platformId, pgc.catalogId as parentId, 0 as childrenCount, 1 as type " + @Select(" select dc.channel_id as id, dc.name as name, pgc.platform_id as platform_id, pgc.catalog_id as parent_id, 0 as children_count, 1 as type " +
" from device_channel dc left join platform_gb_channel pgc on dc.id = pgc.deviceChannelId " + " from wvp_device_channel dc left join wvp_platform_gb_channel pgc on dc.id = pgc.device_channel_id " +
" where pgc.platformId=#{platformId} and pgc.catalogId=#{catalogId}") " where pgc.platform_id=#{platformId} and pgc.catalog_id=#{catalogId}")
List<PlatformCatalog> queryChannelInParentPlatformAndCatalog(String platformId, String catalogId); List<PlatformCatalog> queryChannelInParentPlatformAndCatalog(String platformId, String catalogId);
@Select("select d.*\n" + @Select("select d.*\n" +
"from platform_gb_channel pgc\n" + "from wvp_platform_gb_channel pgc\n" +
" left join device_channel dc on dc.id = pgc.deviceChannelId\n" + " left join wvp_device_channel dc on dc.id = pgc.device_channel_id\n" +
" left join device d on dc.deviceId = d.deviceId\n" + " left join wvp_device d on dc.device_id = d.device_id\n" +
"where dc.channelId = #{channelId} and pgc.platformId=#{platformId}") "where dc.channel_id = #{channelId} and pgc.platform_id=#{platformId}")
List<Device> queryVideoDeviceByPlatformIdAndChannelId(String platformId, String channelId); List<Device> queryVideoDeviceByPlatformIdAndChannelId(String platformId, String channelId);
@Delete("<script> "+ @Delete("<script> "+
"DELETE FROM platform_gb_channel WHERE catalogId=#{id}" + "DELETE from wvp_platform_gb_channel WHERE catalog_id=#{id}" +
"</script>") "</script>")
int delByCatalogId(String id); int delByCatalogId(String id);
@Delete("<script> "+ @Delete("<script> "+
"DELETE FROM platform_gb_channel WHERE catalogId=#{parentId} AND platformId=#{platformId} AND channelId=#{id}" + "DELETE from wvp_platform_gb_channel WHERE catalog_id=#{parentId} AND platform_id=#{platformId} AND channel_id=#{id}" +
"</script>") "</script>")
int delByCatalogIdAndChannelIdAndPlatformId(PlatformCatalog platformCatalog); int delByCatalogIdAndChannelIdAndPlatformId(PlatformCatalog platformCatalog);
@ -86,35 +86,35 @@ public interface PlatformChannelMapper {
"SELECT " + "SELECT " +
"pp.* " + "pp.* " +
"FROM " + "FROM " +
"parent_platform pp " + "wvp_platform pp " +
"left join platform_gb_channel pgc on " + "left join wvp_platform_gb_channel pgc on " +
"pp.serverGBId = pgc.platformId " + "pp.server_gb_id = pgc.platform_id " +
"left join device_channel dc on " + "left join wvp_device_channel dc on " +
"dc.id = pgc.deviceChannelId " + "dc.id = pgc.device_channel_id " +
"WHERE " + "WHERE " +
"dc.channelId = #{channelId} and pp.status = true " + "dc.channel_id = #{channelId} and pp.status = true " +
"AND pp.serverGBId IN" + "AND pp.server_gb_id IN" +
"<foreach collection='platforms' item='item' open='(' separator=',' close=')' > #{item}</foreach>" + "<foreach collection='platforms' item='item' open='(' separator=',' close=')' > #{item}</foreach>" +
"</script> ") "</script> ")
List<ParentPlatform> queryPlatFormListForGBWithGBId(String channelId, List<String> platforms); List<ParentPlatform> queryPlatFormListForGBWithGBId(String channelId, List<String> platforms);
@Delete("<script> " + @Delete("<script> " +
"DELETE FROM platform_gb_channel WHERE platformId=#{serverGBId}" + "DELETE from wvp_platform_gb_channel WHERE platform_id=#{serverGBId}" +
"</script>") "</script>")
void delByPlatformId(String serverGBId); void delByPlatformId(String serverGBId);
@Delete("<script> " + @Delete("<script> " +
"DELETE FROM platform_gb_channel WHERE platformId=#{platformId} and catalogId=#{catalogId}" + "DELETE from wvp_platform_gb_channel WHERE platform_id=#{platformId} and catalog_id=#{catalogId}" +
"</script>") "</script>")
int delChannelForGBByCatalogId(String platformId, String catalogId); int delChannelForGBByCatalogId(String platformId, String catalogId);
@Select("select dc.channelId deviceId,dc.name,d.manufacturer,d.model,d.firmware\n" + @Select("select dc.channel_id dc.device_id,dc.name,d.manufacturer,d.model,d.firmware\n" +
"from platform_gb_channel pgc\n" + "from wvp_platform_gb_channel pgc\n" +
" left join device_channel dc on dc.id = pgc.deviceChannelId\n" + " left join wvp_device_channel dc on dc.id = pgc.device_channel_id\n" +
" left join device d on dc.deviceId = d.deviceId\n" + " left join wvp_device d on dc.device_id = d.device_id\n" +
"where dc.channelId = #{channelId} and pgc.platformId=#{platformId}") "where dc.channel_id = #{channelId} and pgc.platform_id=#{platformId}")
List<Device> queryDeviceInfoByPlatformIdAndChannelId(String platformId, String channelId); List<Device> queryDeviceInfoByPlatformIdAndChannelId(String platformId, String channelId);
@Select("SELECT pgc.platformId FROM platform_gb_channel pgc left join device_channel dc on dc.id = pgc.deviceChannelId WHERE dc.channelId='${channelId}'") @Select("SELECT pgc.platform_id from wvp_platform_gb_channel pgc left join wvp_device_channel dc on dc.id = pgc.device_channel_id WHERE dc.channel_id='${channelId}'")
List<String> queryParentPlatformByChannelId(String channelId); List<String> queryParentPlatformByChannelId(String channelId);
} }

View File

@ -16,82 +16,82 @@ import java.util.List;
@Repository @Repository
public interface PlatformGbStreamMapper { public interface PlatformGbStreamMapper {
@Insert("REPLACE INTO platform_gb_stream (gbStreamId, platformId, catalogId) VALUES" + @Insert("REPLACE INTO wvp_platform_gb_stream (gb_stream_id, platform_id, catalog_id) VALUES" +
"( #{gbStreamId}, #{platformId}, #{catalogId})") "( #{gbStreamId}, #{platformId}, #{catalogId})")
int add(PlatformGbStream platformGbStream); int add(PlatformGbStream platformGbStream);
@Insert("<script> " + @Insert("<script> " +
"INSERT into platform_gb_stream " + "INSERT into wvp_platform_gb_stream " +
"(gbStreamId, platformId, catalogId) " + "(gb_stream_id, platform_id, catalog_id) " +
"values " + "values " +
"<foreach collection='streamPushItems' index='index' item='item' separator=','> " + "<foreach collection='streamPushItems' index='index' item='item' separator=','> " +
"(#{item.gbStreamId}, #{item.platformId}, #{item.catalogId})" + "(#{item.gbStreamId}, #{item.platform_id}, #{item.catalogId})" +
"</foreach> " + "</foreach> " +
"</script>") "</script>")
int batchAdd(List<StreamPushItem> streamPushItems); int batchAdd(List<StreamPushItem> streamPushItems);
@Delete("DELETE FROM platform_gb_stream WHERE gbStreamId = (select gbStreamId from gb_stream where app=#{app} AND stream=#{stream})") @Delete("DELETE from wvp_platform_gb_stream WHERE gb_stream_id = (select gb_stream_id from wvp_gb_stream where app=#{app} AND stream=#{stream})")
int delByAppAndStream(String app, String stream); int delByAppAndStream(String app, String stream);
@Delete("DELETE FROM platform_gb_stream WHERE platformId=#{platformId}") @Delete("DELETE from wvp_platform_gb_stream WHERE platform_id=#{platformId}")
int delByPlatformId(String platformId); int delByPlatformId(String platformId);
@Select("SELECT " + @Select("SELECT " +
"pp.* " + "pp.* " +
"FROM " + "FROM " +
"platform_gb_stream pgs " + "wvp_platform_gb_stream pgs " +
"LEFT JOIN parent_platform pp ON pp.serverGBId = pgs.platformId " + "LEFT JOIN wvp_platform pp ON pp.server_gb_id = pgs.platform_id " +
"LEFT JOIN gb_stream gs ON gs.gbStreamId = pgs.gbStreamId " + "LEFT join wvp_gb_stream gs ON gs.gb_stream_id = pgs.gb_stream_id " +
"WHERE " + "WHERE " +
"gs.app =#{app} " + "gs.app =#{app} " +
"AND gs.stream =#{stream} ") "AND gs.stream =#{stream} ")
List<ParentPlatform> selectByAppAndStream(String app, String stream); List<ParentPlatform> selectByAppAndStream(String app, String stream);
@Select("SELECT pgs.*, gs.gbId FROM platform_gb_stream pgs " + @Select("SELECT pgs.*, gs.gb_id from wvp_platform_gb_stream pgs " +
"LEFT JOIN gb_stream gs ON pgs.gbStreamId = gs.gbStreamId " + "LEFT join wvp_gb_stream gs ON pgs.gb_stream_id = gs.gb_stream_id " +
"WHERE gs.app=#{app} AND gs.stream=#{stream} AND pgs.platformId=#{serverGBId}") "WHERE gs.app=#{app} AND gs.stream=#{stream} AND pgs.platform_id=#{serverGBId}")
StreamProxyItem selectOne(String app, String stream, String serverGBId); StreamProxyItem selectOne(String app, String stream, String serverGBId);
@Select("select gs.* \n" + @Select("select gs.* \n" +
"from gb_stream gs\n" + "from wvp_gb_stream gs\n" +
" left join platform_gb_stream pgs\n" + " left join wvp_platform_gb_stream pgs\n" +
" on gs.gbStreamId = pgs.gbStreamId\n" + " on gs.gb_stream_id = pgs.gb_stream_id\n" +
"where pgs.platformId=#{platformId} and pgs.catalogId=#{catalogId}") "where pgs.platform_id=#{platformId} and pgs.catalog_id=#{catalogId}")
List<GbStream> queryChannelInParentPlatformAndCatalog(String platformId, String catalogId); List<GbStream> queryChannelInParentPlatformAndCatalog(String platformId, String catalogId);
@Select("select gs.gbId as id, gs.name as name, pgs.platformId as platformId, pgs.catalogId as catalogId , 0 as childrenCount, 2 as type\n" + @Select("select gs.gb_id as id, gs.name as name, pgs.platform_id as platform_id, pgs.catalog_id as catalog_id , 0 as children_count, 2 as type\n" +
"from gb_stream gs\n" + "from wvp_gb_stream gs\n" +
" left join platform_gb_stream pgs\n" + " left join wvp_platform_gb_stream pgs\n" +
" on gs.gbStreamId = pgs.gbStreamId\n" + " on gs.gb_stream_id = pgs.gb_stream_id\n" +
"where pgs.platformId=#{platformId} and pgs.catalogId=#{catalogId}") "where pgs.platform_id=#{platformId} and pgs.catalog_id=#{catalogId}")
List<PlatformCatalog> queryChannelInParentPlatformAndCatalogForCatalog(String platformId, String catalogId); List<PlatformCatalog> queryChannelInParentPlatformAndCatalogForCatalog(String platformId, String catalogId);
@Delete("DELETE FROM platform_gb_stream WHERE catalogId=#{id}") @Delete("DELETE from wvp_platform_gb_stream WHERE catalog_id=#{id}")
int delByCatalogId(String id); int delByCatalogId(String id);
@Select("<script> " + @Select("<script> " +
"SELECT " + "SELECT " +
"pp.* " + "pp.* " +
"FROM " + "FROM " +
"parent_platform pp " + "wvp_platform pp " +
"left join platform_gb_stream pgs on " + "left join wvp_platform_gb_stream pgs on " +
"pp.serverGBId = pgs.platformId " + "pp.server_gb_id = pgs.platform_id " +
"left join gb_stream gs " + "left join wvp_gb_stream gs " +
"on gs.gbStreamId = pgs.gbStreamId " + "on gs.gb_stream_id = pgs.gb_stream_id " +
"WHERE " + "WHERE " +
"gs.app = #{app} " + "gs.app = #{app} " +
"AND gs.stream = #{stream}" + "AND gs.stream = #{stream}" +
"AND pp.serverGBId IN" + "AND pp.server_gb_id IN" +
"<foreach collection='platforms' item='item' open='(' separator=',' close=')' > #{item}</foreach>" + "<foreach collection='platforms' item='item' open='(' separator=',' close=')' > #{item}</foreach>" +
"</script> ") "</script> ")
List<ParentPlatform> queryPlatFormListForGBWithGBId(String app, String stream, List<String> platforms); List<ParentPlatform> queryPlatFormListForGBWithGBId(String app, String stream, List<String> platforms);
@Delete("DELETE FROM platform_gb_stream WHERE gbStreamId = (select id from gb_stream where app=#{app} AND stream=#{stream}) AND platformId=#{platformId}") @Delete("DELETE from wvp_platform_gb_stream WHERE gb_stream_id = (select id from wvp_gb_stream where app=#{app} AND stream=#{stream}) AND platform_id=#{platformId}")
int delByAppAndStreamAndPlatform(String app, String stream, String platformId); int delByAppAndStreamAndPlatform(String app, String stream, String platformId);
@Delete("<script> "+ @Delete("<script> "+
"DELETE FROM platform_gb_stream where gbStreamId in " + "DELETE from wvp_platform_gb_stream where gb_stream_id in " +
"<foreach collection='gbStreams' item='item' open='(' separator=',' close=')' >" + "<foreach collection='gbStreams' item='item' open='(' separator=',' close=')' >" +
"#{item.gbStreamId}" + "#{item.gbStreamId}" +
"</foreach>" + "</foreach>" +
@ -99,13 +99,13 @@ public interface PlatformGbStreamMapper {
void delByGbStreams(List<GbStream> gbStreams); void delByGbStreams(List<GbStream> gbStreams);
@Delete("<script> "+ @Delete("<script> "+
"DELETE FROM platform_gb_stream where platformId=#{platformId} and gbStreamId in " + "DELETE from wvp_platform_gb_stream where platform_id=#{platformId} and gb_stream_id in " +
"<foreach collection='gbStreams' item='item' open='(' separator=',' close=')'>" + "<foreach collection='gbStreams' item='item' open='(' separator=',' close=')'>" +
"#{item.gbStreamId} " + "#{item.gbStreamId} " +
"</foreach>" + "</foreach>" +
"</script>") "</script>")
void delByAppAndStreamsByPlatformId(List<GbStream> gbStreams, String platformId); void delByAppAndStreamsByPlatformId(List<GbStream> gbStreams, String platformId);
@Delete("DELETE FROM platform_gb_stream WHERE platformId=#{platformId} and catalogId=#{catalogId}") @Delete("DELETE from wvp_platform_gb_stream WHERE platform_id=#{platformId} and catalog_id=#{catalogId}")
int delByPlatformAndCatalogId(String platformId, String catalogId); int delByPlatformAndCatalogId(String platformId, String catalogId);
} }

View File

@ -1,25 +0,0 @@
package com.genersoft.iot.vmp.storager.dao;
import com.genersoft.iot.vmp.storager.dao.dto.RecordInfo;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;
import java.util.List;
@Mapper
@Repository
public interface RecordInfoDao {
@Insert("INSERT INTO recordInfo (app, stream, mediaServerId, createTime, type, deviceId, channelId, name) VALUES" +
"(#{app}, #{stream}, #{mediaServerId}, datetime('now','localtime')), #{type}, #{deviceId}, #{channelId}, #{name}")
int add(RecordInfo recordInfo);
@Delete("DELETE FROM user WHERE createTime < #{beforeTime}")
int deleteBefore(String beforeTime);
@Select("select * FROM recordInfo")
List<RecordInfo> selectAll();
}

View File

@ -1,7 +1,6 @@
package com.genersoft.iot.vmp.storager.dao; package com.genersoft.iot.vmp.storager.dao;
import com.genersoft.iot.vmp.storager.dao.dto.Role; import com.genersoft.iot.vmp.storager.dao.dto.Role;
import com.genersoft.iot.vmp.storager.dao.dto.User;
import org.apache.ibatis.annotations.*; import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
@ -11,25 +10,25 @@ import java.util.List;
@Repository @Repository
public interface RoleMapper { public interface RoleMapper {
@Insert("INSERT INTO user_role (name, authority, createTime, updateTime) VALUES" + @Insert("INSERT INTO wvp_user_role (name, authority, create_time, update_time) VALUES" +
"(#{name}, #{authority}, #{createTime}, #{updateTime})") "(#{name}, #{authority}, #{createTime}, #{updateTime})")
int add(Role role); int add(Role role);
@Update(value = {" <script>" + @Update(value = {" <script>" +
"UPDATE user_role " + "UPDATE wvp_user_role " +
"SET updateTime=#{updateTime} " + "SET update_time=#{updateTime} " +
"<if test=\"name != null\">, name=#{name}</if>" + "<if test=\"name != null\">, name=#{name}</if>" +
"<if test=\"authority != null\">, authority=#{authority}</if>" + "<if test=\"authority != null\">, authority=#{authority}</if>" +
"WHERE id != 1 and id=#{id}" + "WHERE id != 1 and id=#{id}" +
" </script>"}) " </script>"})
int update(Role role); int update(Role role);
@Delete("DELETE FROM user_role WHERE id != 1 and id=#{id}") @Delete("DELETE from wvp_user_role WHERE id != 1 and id=#{id}")
int delete(int id); int delete(int id);
@Select("select * FROM user_role WHERE id=#{id}") @Select("select * from wvp_user_role WHERE id=#{id}")
Role selectById(int id); Role selectById(int id);
@Select("select * FROM user_role") @Select("select * from wvp_user_role")
List<Role> selectAll(); List<Role> selectAll();
} }

View File

@ -1,7 +1,7 @@
package com.genersoft.iot.vmp.storager.dao; package com.genersoft.iot.vmp.storager.dao;
import com.genersoft.iot.vmp.media.zlm.dto.StreamProxyItem; import com.genersoft.iot.vmp.media.zlm.dto.StreamProxyItem;
import com.genersoft.iot.vmp.vmanager.bean.ResourceBaceInfo; import com.genersoft.iot.vmp.vmanager.bean.ResourceBaseInfo;
import org.apache.ibatis.annotations.*; import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
@ -11,20 +11,20 @@ import java.util.List;
@Repository @Repository
public interface StreamProxyMapper { public interface StreamProxyMapper {
@Insert("INSERT INTO stream_proxy (type, name, app, stream,mediaServerId, url, src_url, dst_url, " + @Insert("INSERT INTO wvp_stream_proxy (type, name, app, stream,media_server_id, url, src_url, dst_url, " +
"timeout_ms, ffmpeg_cmd_key, rtp_type, enable_audio, enable_mp4, enable, status, enable_remove_none_reader, enable_disable_none_reader, createTime) VALUES" + "timeout_ms, ffmpeg_cmd_key, rtp_type, enable_audio, enable_mp4, enable, status, enable_remove_none_reader, enable_disable_none_reader, create_time) VALUES" +
"(#{type}, #{name}, #{app}, #{stream}, #{mediaServerId}, #{url}, #{src_url}, #{dst_url}, " + "(#{type}, #{name}, #{app}, #{stream}, #{mediaServerId}, #{url}, #{src_url}, #{dst_url}, " +
"#{timeout_ms}, #{ffmpeg_cmd_key}, #{rtp_type}, #{enable_audio}, #{enable_mp4}, #{enable}, #{status}, " + "#{timeout_ms}, #{ffmpeg_cmd_key}, #{rtp_type}, #{enable_audio}, #{enable_mp4}, #{enable}, #{status}, " +
"#{enable_remove_none_reader}, #{enable_disable_none_reader}, #{createTime} )") "#{enable_remove_none_reader}, #{enable_disable_none_reader}, #{createTime} )")
int add(StreamProxyItem streamProxyDto); int add(StreamProxyItem streamProxyDto);
@Update("UPDATE stream_proxy " + @Update("UPDATE wvp_stream_proxy " +
"SET type=#{type}, " + "SET type=#{type}, " +
"name=#{name}," + "name=#{name}," +
"app=#{app}," + "app=#{app}," +
"stream=#{stream}," + "stream=#{stream}," +
"url=#{url}, " + "url=#{url}, " +
"mediaServerId=#{mediaServerId}, " + "media_server_id=#{mediaServerId}, " +
"src_url=#{src_url}," + "src_url=#{src_url}," +
"dst_url=#{dst_url}, " + "dst_url=#{dst_url}, " +
"timeout_ms=#{timeout_ms}, " + "timeout_ms=#{timeout_ms}, " +
@ -39,44 +39,51 @@ public interface StreamProxyMapper {
"WHERE app=#{app} AND stream=#{stream}") "WHERE app=#{app} AND stream=#{stream}")
int update(StreamProxyItem streamProxyDto); int update(StreamProxyItem streamProxyDto);
@Delete("DELETE FROM stream_proxy WHERE app=#{app} AND stream=#{stream}") @Delete("DELETE FROM wvp_stream_proxy WHERE app=#{app} AND stream=#{stream}")
int del(String app, String stream); int del(String app, String stream);
@Select("SELECT st.*, pgs.gbId, pgs.name, pgs.longitude, pgs.latitude FROM stream_proxy st LEFT JOIN gb_stream pgs on st.app = pgs.app AND st.stream = pgs.stream order by st.createTime desc") @Select("SELECT st.*, pgs.gb_id, pgs.name, pgs.longitude, pgs.latitude FROM wvp_stream_proxy st LEFT join wvp_gb_stream pgs on st.app = pgs.app AND st.stream = pgs.stream order by st.create_time desc")
List<StreamProxyItem> selectAll(); List<StreamProxyItem> selectAll();
@Select("SELECT st.*, pgs.gbId, pgs.name, pgs.longitude, pgs.latitude FROM stream_proxy st LEFT JOIN gb_stream pgs on st.app = pgs.app AND st.stream = pgs.stream WHERE st.enable=#{enable} order by st.createTime desc") @Select("SELECT st.*, pgs.gb_id, pgs.name, pgs.longitude, pgs.latitude FROM wvp_stream_proxy st LEFT join wvp_gb_stream pgs on st.app = pgs.app AND st.stream = pgs.stream WHERE st.enable=#{enable} order by st.create_time desc")
List<StreamProxyItem> selectForEnable(boolean enable); List<StreamProxyItem> selectForEnable(boolean enable);
@Select("SELECT st.*, pgs.gbId, pgs.name, pgs.longitude, pgs.latitude FROM stream_proxy st LEFT JOIN gb_stream pgs on st.app = pgs.app AND st.stream = pgs.stream WHERE st.app=#{app} AND st.stream=#{stream} order by st.createTime desc") @Select("SELECT st.*, pgs.gb_id, pgs.name, pgs.longitude, pgs.latitude FROM wvp_stream_proxy st LEFT join wvp_gb_stream pgs on st.app = pgs.app AND st.stream = pgs.stream WHERE st.app=#{app} AND st.stream=#{stream} order by st.create_time desc")
StreamProxyItem selectOne(String app, String stream); StreamProxyItem selectOne(String app, String stream);
@Select("SELECT st.*, pgs.gbId, pgs.name, pgs.longitude, pgs.latitude FROM stream_proxy st " + @Select("SELECT st.*, pgs.gb_id, pgs.name, pgs.longitude, pgs.latitude FROM wvp_stream_proxy st " +
"LEFT JOIN gb_stream pgs on st.app = pgs.app AND st.stream = pgs.stream " + "LEFT join wvp_gb_stream pgs on st.app = pgs.app AND st.stream = pgs.stream " +
"WHERE st.enable=#{enable} and st.mediaServerId = #{id} order by st.createTime desc") "WHERE st.enable=#{enable} and st.media_server_id= #{id} order by st.create_time desc")
List<StreamProxyItem> selectForEnableInMediaServer(String id, boolean enable); List<StreamProxyItem> selectForEnableInMediaServer(String id, boolean enable);
@Select("SELECT st.*, pgs.gbId, pgs.name, pgs.longitude, pgs.latitude FROM stream_proxy st " + @Select("SELECT st.*, pgs.gb_id, pgs.name, pgs.longitude, pgs.latitude FROM wvp_stream_proxy st " +
"LEFT JOIN gb_stream pgs on st.app = pgs.app AND st.stream = pgs.stream " + "LEFT join wvp_gb_stream pgs on st.app = pgs.app AND st.stream = pgs.stream " +
"WHERE st.mediaServerId = #{id} order by st.createTime desc") "WHERE st.media_server_id= #{id} order by st.create_time desc")
List<StreamProxyItem> selectInMediaServer(String id); List<StreamProxyItem> selectInMediaServer(String id);
@Update("UPDATE stream_proxy " + @Update("UPDATE wvp_stream_proxy " +
"SET status=#{status} " + "SET status=#{status} " +
"WHERE mediaServerId=#{mediaServerId}") "WHERE media_server_id=#{mediaServerId}")
void updateStatusByMediaServerId(String mediaServerId, boolean status); void updateStatusByMediaServerId(String mediaServerId, boolean status);
@Update("UPDATE stream_proxy " + @Update("UPDATE wvp_stream_proxy " +
"SET status=#{status} " + "SET status=#{status} " +
"WHERE app=#{app} AND stream=#{stream}") "WHERE app=#{app} AND stream=#{stream}")
int updateStatus(String app, String stream, boolean status); int updateStatus(String app, String stream, boolean status);
@Delete("DELETE FROM stream_proxy WHERE enable_remove_none_reader=true AND mediaServerId=#{mediaServerId}") @Delete("DELETE FROM wvp_stream_proxy WHERE enable_remove_none_reader=true AND media_server_id=#{mediaServerId}")
void deleteAutoRemoveItemByMediaServerId(String mediaServerId); void deleteAutoRemoveItemByMediaServerId(String mediaServerId);
@Select("SELECT st.*, pgs.gbId, pgs.name, pgs.longitude, pgs.latitude FROM stream_proxy st LEFT JOIN gb_stream pgs on st.app = pgs.app AND st.stream = pgs.stream WHERE st.enable_remove_none_reader=true AND st.mediaServerId=#{mediaServerId} order by st.createTime desc") @Select("SELECT st.*, pgs.gb_id, pgs.name, pgs.longitude, pgs.latitude FROM wvp_stream_proxy st LEFT join wvp_gb_stream pgs on st.app = pgs.app AND st.stream = pgs.stream WHERE st.enable_remove_none_reader=true AND st.media_server_id=#{mediaServerId} order by st.create_time desc")
List<StreamProxyItem> selecAutoRemoveItemByMediaServerId(String mediaServerId); List<StreamProxyItem> selectAutoRemoveItemByMediaServerId(String mediaServerId);
@Select("select count(1) as total, sum(status) as online from stream_proxy") @Select("select count(1) as total, sum(status) as online from wvp_stream_proxy")
ResourceBaceInfo getOverview(); ResourceBaseInfo getOverview();
@Select("select count(1) from wvp_stream_proxy")
int getAllCount();
@Select("select count(1) from wvp_stream_proxy where status = true")
int getOnline();
} }

View File

@ -3,54 +3,51 @@ package com.genersoft.iot.vmp.storager.dao;
import com.genersoft.iot.vmp.gb28181.bean.GbStream; import com.genersoft.iot.vmp.gb28181.bean.GbStream;
import com.genersoft.iot.vmp.media.zlm.dto.StreamPushItem; import com.genersoft.iot.vmp.media.zlm.dto.StreamPushItem;
import com.genersoft.iot.vmp.service.bean.StreamPushItemFromRedis; import com.genersoft.iot.vmp.service.bean.StreamPushItemFromRedis;
import com.genersoft.iot.vmp.vmanager.bean.ResourceBaceInfo;
import org.apache.ibatis.annotations.*; import org.apache.ibatis.annotations.*;
// import org.omg.PortableInterceptor.INACTIVE;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
import java.util.Collection;
import java.util.List; import java.util.List;
@Mapper @Mapper
@Repository @Repository
public interface StreamPushMapper { public interface StreamPushMapper {
@Insert("INSERT INTO stream_push (app, stream, totalReaderCount, originType, originTypeStr, " + @Insert("INSERT INTO wvp_stream_push (app, stream, total_reader_count, origin_type, origin_type_str, " +
"pushTime, aliveSecond, mediaServerId, serverId, updateTime, createTime, pushIng, self) VALUES" + "push_time, alive_second, media_server_id, update_time, create_time, push_ing, self) VALUES" +
"(#{app}, #{stream}, #{totalReaderCount}, #{originType}, #{originTypeStr}, " + "(#{app}, #{stream}, #{totalReaderCount}, #{originType}, #{originTypeStr}, " +
"#{pushTime}, #{aliveSecond}, #{mediaServerId} , #{serverId} , #{updateTime} , #{createTime}, " + "#{pushTime}, #{aliveSecond}, #{mediaServerId} , #{updateTime} , #{createTime}, " +
"#{pushIng}, #{self} )") "#{pushIng}, #{self} )")
int add(StreamPushItem streamPushItem); int add(StreamPushItem streamPushItem);
@Update(value = {" <script>" + @Update(value = {" <script>" +
"UPDATE stream_push " + "UPDATE wvp_stream_push " +
"SET updateTime=#{updateTime}" + "SET update_time=#{updateTime}" +
"<if test=\"mediaServerId != null\">, mediaServerId=#{mediaServerId}</if>" + "<if test=\"mediaServerId != null\">, media_server_id=#{mediaServerId}</if>" +
"<if test=\"totalReaderCount != null\">, totalReaderCount=#{totalReaderCount}</if>" + "<if test=\"totalReaderCount != null\">, total_reader_count=#{totalReaderCount}</if>" +
"<if test=\"originType != null\">, originType=#{originType}</if>" + "<if test=\"originType != null\">, origin_type=#{originType}</if>" +
"<if test=\"originTypeStr != null\">, originTypeStr=#{originTypeStr}</if>" + "<if test=\"originTypeStr != null\">, origin_type_str=#{originTypeStr}</if>" +
"<if test=\"pushTime != null\">, pushTime=#{pushTime}</if>" + "<if test=\"pushTime != null\">, push_time=#{pushTime}</if>" +
"<if test=\"aliveSecond != null\">, aliveSecond=#{aliveSecond}</if>" + "<if test=\"aliveSecond != null\">, alive_second=#{aliveSecond}</if>" +
"<if test=\"pushIng != null\">, pushIng=#{pushIng}</if>" + "<if test=\"pushIng != null\">, push_ing=#{pushIng}</if>" +
"<if test=\"self != null\">, self=#{self}</if>" + "<if test=\"self != null\">, self=#{self}</if>" +
"WHERE app=#{app} AND stream=#{stream}"+ "WHERE app=#{app} AND stream=#{stream}"+
" </script>"}) " </script>"})
int update(StreamPushItem streamPushItem); int update(StreamPushItem streamPushItem);
@Delete("DELETE FROM stream_push WHERE app=#{app} AND stream=#{stream}") @Delete("DELETE FROM wvp_stream_push WHERE app=#{app} AND stream=#{stream}")
int del(String app, String stream); int del(String app, String stream);
@Delete("<script> "+ @Delete("<script> "+
"DELETE sp FROM stream_push sp left join gb_stream gs on sp.app = gs.app AND sp.stream = gs.stream where " + "DELETE sp FROM wvp_stream_push sp left join wvp_gb_stream gs on sp.app = gs.app AND sp.stream = gs.stream where " +
"<foreach collection='streamPushItems' item='item' separator='or'>" + "<foreach collection='streamPushItems' item='item' separator='or'>" +
"(sp.app=#{item.app} and sp.stream=#{item.stream} and gs.gbId is null) " + "(sp.app=#{item.app} and sp.stream=#{item.stream} and gs.gb_id is null) " +
"</foreach>" + "</foreach>" +
"</script>") "</script>")
int delAllWithoutGBId(List<StreamPushItem> streamPushItems); int delAllWithoutGBId(List<StreamPushItem> streamPushItems);
@Delete("<script> "+ @Delete("<script> "+
"DELETE FROM stream_push where " + "DELETE FROM wvp_stream_push where " +
"<foreach collection='streamPushItems' item='item' separator='or'>" + "<foreach collection='streamPushItems' item='item' separator='or'>" +
"(app=#{item.app} and stream=#{item.stream}) " + "(app=#{item.app} and stream=#{item.stream}) " +
"</foreach>" + "</foreach>" +
@ -58,7 +55,7 @@ public interface StreamPushMapper {
int delAll(List<StreamPushItem> streamPushItems); int delAll(List<StreamPushItem> streamPushItems);
@Delete("<script> "+ @Delete("<script> "+
"DELETE FROM stream_push where " + "DELETE FROM wvp_stream_push where " +
"<foreach collection='gbStreams' item='item' separator='or'>" + "<foreach collection='gbStreams' item='item' separator='or'>" +
"(app=#{item.app} and stream=#{item.stream}) " + "(app=#{item.app} and stream=#{item.stream}) " +
"</foreach>" + "</foreach>" +
@ -69,30 +66,30 @@ public interface StreamPushMapper {
@Select(value = {" <script>" + @Select(value = {" <script>" +
"SELECT " + "SELECT " +
"st.*, " + "st.*, " +
"gs.gbId, gs.name, gs.longitude, gs.latitude, gs.gbStreamId " + "gs.gb_id, gs.name, gs.longitude, gs.latitude, gs.gb_stream_id " +
"from " + "from " +
"stream_push st " + "wvp_stream_push st " +
"LEFT JOIN gb_stream gs " + "LEFT join wvp_gb_stream gs " +
"on st.app = gs.app AND st.stream = gs.stream " + "on st.app = gs.app AND st.stream = gs.stream " +
"WHERE " + "WHERE " +
"1=1 " + "1=1 " +
" <if test='query != null'> AND (st.app LIKE concat('%',#{query},'%') OR st.stream LIKE concat('%',#{query},'%') OR gs.gbId LIKE concat('%',#{query},'%') OR gs.name LIKE concat('%',#{query},'%'))</if> " + " <if test='query != null'> AND (st.app LIKE concat('%',#{query},'%') OR st.stream LIKE concat('%',#{query},'%') OR gs.gb_id LIKE concat('%',#{query},'%') OR gs.name LIKE concat('%',#{query},'%'))</if> " +
" <if test='pushing == true' > AND (gs.gbId is null OR st.pushIng=1)</if>" + " <if test='pushing == true' > AND (gs.gb_id is null OR st.push_ing=1)</if>" +
" <if test='pushing == false' > AND (st.pushIng is null OR st.pushIng=0) </if>" + " <if test='pushing == false' > AND (st.push_ing is null OR st.push_ing=0) </if>" +
" <if test='mediaServerId != null' > AND st.mediaServerId=#{mediaServerId} </if>" + " <if test='mediaServerId != null' > AND st.media_server_id=#{mediaServerId} </if>" +
"order by st.createTime desc" + "order by st.create_time desc" +
" </script>"}) " </script>"})
List<StreamPushItem> selectAllForList(String query, Boolean pushing, String mediaServerId); List<StreamPushItem> selectAllForList(String query, Boolean pushing, String mediaServerId);
@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") @Select("SELECT st.*, gs.gb_id, gs.name, gs.longitude, gs.latitude FROM wvp_stream_push st LEFT join wvp_gb_stream gs on st.app = gs.app AND st.stream = gs.stream order by st.create_time desc")
List<StreamPushItem> selectAll(); List<StreamPushItem> selectAll();
@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}") @Select("SELECT st.*, gs.gb_id, gs.name, gs.longitude, gs.latitude FROM wvp_stream_push st LEFT join wvp_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); StreamPushItem selectOne(String app, String stream);
@Insert("<script>" + @Insert("<script>" +
"Insert IGNORE INTO stream_push (app, stream, totalReaderCount, originType, originTypeStr, " + "Insert INTO wvp_stream_push (app, stream, total_reader_count, origin_type, origin_type_str, " +
"createTime, aliveSecond, mediaServerId, status, pushIng) " + "create_time, alive_second, media_server_id, status, push_ing) " +
"VALUES <foreach collection='streamPushItems' item='item' index='index' separator=','>" + "VALUES <foreach collection='streamPushItems' item='item' index='index' separator=','>" +
"( #{item.app}, #{item.stream}, #{item.totalReaderCount}, #{item.originType}, " + "( #{item.app}, #{item.stream}, #{item.totalReaderCount}, #{item.originType}, " +
"#{item.originTypeStr},#{item.createTime}, #{item.aliveSecond}, #{item.mediaServerId}, #{item.status} ," + "#{item.originTypeStr},#{item.createTime}, #{item.aliveSecond}, #{item.mediaServerId}, #{item.status} ," +
@ -102,37 +99,45 @@ public interface StreamPushMapper {
@Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id") @Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
int addAll(List<StreamPushItem> streamPushItems); int addAll(List<StreamPushItem> streamPushItems);
@Delete("DELETE FROM stream_push") @Delete("DELETE FROM wvp_stream_push")
void clear(); void clear();
@Delete("DELETE 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 ") @Delete("delete" +
" from wvp_stream_push " +
" where id in " +
" (select temp.id from " +
" (select wgs.gb_stream_id as id " +
" from wvp_gb_stream wgs" +
" left join wvp_stream_push sp on sp.id = wgs.gb_stream_id" +
" where wgs.gb_id is null and wgs.media_server_id = #{mediaServerId}) temp)"
)
void deleteWithoutGBId(String mediaServerId); void deleteWithoutGBId(String mediaServerId);
@Select("SELECT * FROM stream_push WHERE mediaServerId=#{mediaServerId}") @Select("SELECT * FROM wvp_stream_push WHERE media_server_id=#{mediaServerId}")
List<StreamPushItem> selectAllByMediaServerId(String mediaServerId); List<StreamPushItem> selectAllByMediaServerId(String mediaServerId);
@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") @Select("SELECT sp.* FROM wvp_stream_push sp left join wvp_gb_stream gs on gs.app = sp.app and gs.stream= sp.stream WHERE sp.media_server_id=#{mediaServerId} and gs.gb_id is null")
List<StreamPushItem> selectAllByMediaServerIdWithOutGbID(String mediaServerId); List<StreamPushItem> selectAllByMediaServerIdWithOutGbID(String mediaServerId);
@Update("UPDATE stream_push " + @Update("UPDATE wvp_stream_push " +
"SET status=#{status} " + "SET status=#{status} " +
"WHERE app=#{app} AND stream=#{stream}") "WHERE app=#{app} AND stream=#{stream}")
int updateStatus(String app, String stream, boolean status); int updateStatus(String app, String stream, boolean status);
@Update("UPDATE stream_push " + @Update("UPDATE wvp_stream_push " +
"SET pushIng=#{pushIng} " + "SET push_ing=#{pushIng} " +
"WHERE app=#{app} AND stream=#{stream}") "WHERE app=#{app} AND stream=#{stream}")
int updatePushStatus(String app, String stream, boolean pushIng); int updatePushStatus(String app, String stream, boolean pushIng);
@Update("UPDATE stream_push " + @Update("UPDATE wvp_stream_push " +
"SET status=#{status} " + "SET status=#{status} " +
"WHERE mediaServerId=#{mediaServerId}") "WHERE media_server_id=#{mediaServerId}")
void updateStatusByMediaServerId(String mediaServerId, boolean status); void updateStatusByMediaServerId(String mediaServerId, boolean status);
@Select("<script> "+ @Select("<script> "+
"SELECT gs.* FROM stream_push sp left join gb_stream gs on sp.app = gs.app AND sp.stream = gs.stream " + "SELECT gs.* FROM wvp_stream_push sp left join wvp_gb_stream gs on sp.app = gs.app AND sp.stream = gs.stream " +
"where sp.status = 1 and (gs.app, gs.stream) in (" + "where sp.status = true and (gs.app, gs.stream) in (" +
"<foreach collection='offlineStreams' item='item' separator=','>" + "<foreach collection='offlineStreams' item='item' separator=','>" +
"(#{item.app}, #{item.stream}) " + "(#{item.app}, #{item.stream}) " +
"</foreach>" + "</foreach>" +
@ -140,7 +145,7 @@ public interface StreamPushMapper {
List<GbStream> getOnlinePusherForGbInList(List<StreamPushItemFromRedis> offlineStreams); List<GbStream> getOnlinePusherForGbInList(List<StreamPushItemFromRedis> offlineStreams);
@Update("<script> "+ @Update("<script> "+
"UPDATE stream_push SET status=0 where (app, stream) in (" + "UPDATE wvp_stream_push SET status=0 where (app, stream) in (" +
"<foreach collection='offlineStreams' item='item' separator=','>" + "<foreach collection='offlineStreams' item='item' separator=','>" +
"(#{item.app}, #{item.stream}) " + "(#{item.app}, #{item.stream}) " +
"</foreach>" + "</foreach>" +
@ -148,7 +153,7 @@ public interface StreamPushMapper {
void offline(List<StreamPushItemFromRedis> offlineStreams); void offline(List<StreamPushItemFromRedis> offlineStreams);
@Select("<script> "+ @Select("<script> "+
"SELECT * FROM stream_push sp left join gb_stream gs on sp.app = gs.app AND sp.stream = gs.stream " + "SELECT * FROM wvp_stream_push sp left join wvp_gb_stream gs on sp.app = gs.app AND sp.stream = gs.stream " +
"where sp.status = 0 and (gs.app, gs.stream) in (" + "where sp.status = 0 and (gs.app, gs.stream) in (" +
"<foreach collection='onlineStreams' item='item' separator=','>" + "<foreach collection='onlineStreams' item='item' separator=','>" +
"(#{item.app}, #{item.stream}) " + "(#{item.app}, #{item.stream}) " +
@ -157,25 +162,36 @@ public interface StreamPushMapper {
List<GbStream> getOfflinePusherForGbInList(List<StreamPushItemFromRedis> onlineStreams); List<GbStream> getOfflinePusherForGbInList(List<StreamPushItemFromRedis> onlineStreams);
@Update("<script> "+ @Update("<script> "+
"UPDATE stream_push SET status=1 where (app, stream) in (" + "UPDATE wvp_stream_push SET status=1 where (app, stream) in (" +
"<foreach collection='onlineStreams' item='item' separator=','>" + "<foreach collection='onlineStreams' item='item' separator=','>" +
"(#{item.app}, #{item.stream}) " + "(#{item.app}, #{item.stream}) " +
"</foreach>" + "</foreach>" +
")</script>") ")</script>")
void online(List<StreamPushItemFromRedis> onlineStreams); void online(List<StreamPushItemFromRedis> onlineStreams);
@Select("SELECT gs.* FROM stream_push sp left join gb_stream gs on sp.app = gs.app AND sp.stream = gs.stream where sp.status = 1") @Select("SELECT gs.* FROM wvp_stream_push sp left join wvp_gb_stream gs on sp.app = gs.app AND sp.stream = gs.stream where sp.status = true")
List<GbStream> getOnlinePusherForGb(); List<GbStream> getOnlinePusherForGb();
@Update("UPDATE stream_push SET status=0") @Update("UPDATE wvp_stream_push SET status=0")
void setAllStreamOffline(); void setAllStreamOffline();
@Select("SELECT CONCAT(app,stream) FROM gb_stream") @Select("SELECT CONCAT(app,stream) from wvp_gb_stream")
List<String> getAllAppAndStream(); List<String> getAllAppAndStream();
@Select("select count(1) from wvp_stream_push ")
int getAllCount();
@Select(value = {" <script>" + @Select(value = {" <script>" +
" <if test='pushIngAsOnline == true'> select count(1) as total, sum(pushIng) as online from stream_push </if>" + " <if test='pushIngAsOnline == true'> select count(1) from wvp_stream_push where push_ing = true </if>" +
" <if test='pushIngAsOnline == false'> select count(1) as total, sum(status) as online from stream_push </if>" + " <if test='pushIngAsOnline == false'> select count(1)from wvp_stream_push where status = true </if>" +
" </script>"}) " </script>"})
ResourceBaceInfo getOverview(boolean pushIngAsOnline); int getAllOnline(Boolean usePushingAsStatus);
@Select("<script> " +
"select app, stream from wvp_stream_push where (app, stream) in " +
"<foreach collection='streamPushItems' item='item' separator=','>" +
"(#{item.app}, #{item.stream}) " +
"</foreach>" +
"</script>")
List<StreamPushItem> getListIn(List<StreamPushItem> streamPushItems);
} }

View File

@ -10,56 +10,50 @@ import java.util.List;
@Repository @Repository
public interface UserMapper { public interface UserMapper {
@Insert("INSERT INTO user (username, password, roleId, pushKey, createTime, updateTime) VALUES" + @Insert("INSERT INTO wvp_user (username, password, role_id, push_key, create_time, update_time) VALUES" +
"(#{username}, #{password}, #{role.id}, #{pushKey}, #{createTime}, #{updateTime})") "(#{username}, #{password}, #{role.id}, #{pushKey}, #{createTime}, #{updateTime})")
int add(User user); int add(User user);
@Update(value = {" <script>" + @Update(value = {" <script>" +
"UPDATE user " + "UPDATE wvp_user " +
"SET updateTime=#{updateTime} " + "SET update_time=#{updateTime} " +
"<if test=\"pushKey != null\">, pushKey=#{pushKey}</if>" + "<if test=\"pushKey != null\">, push_key=#{pushKey}</if>" +
"<if test=\"role != null\">, roleId=#{role.id}</if>" + "<if test=\"role != null\">, role_id=#{role.id}</if>" +
"<if test=\"password != null\">, password=#{password}</if>" + "<if test=\"password != null\">, password=#{password}</if>" +
"<if test=\"username != null\">, username=#{username}</if>" + "<if test=\"username != null\">, username=#{username}</if>" +
"WHERE id=#{id}" + "WHERE id=#{id}" +
" </script>"}) " </script>"})
int update(User user); int update(User user);
@Delete("DELETE FROM user WHERE id != 1 and id=#{id}") @Delete("DELETE from wvp_user WHERE id != 1 and id=#{id}")
int delete(int id); int delete(int id);
@Select("select u.*, r.id as roleID, r.name as roleName, r.authority as roleAuthority , r.createTime as roleCreateTime , r.updateTime as roleUpdateTime FROM user u, user_role r WHERE u.roleId=r.id and u.username=#{username} AND u.password=#{password}") @Select("select u.*, r.id as role_id, r.name as roleName, r.authority as roleAuthority , r.create_time as role_create_time , r.update_time as role_update_time from wvp_user u, wvp_user_role r WHERE u.role_id=r.id and u.username=#{username} AND u.password=#{password}")
@Results(id = "roleMap", value = { @Results(id = "roleMap", value = {
@Result(column = "roleID", property = "role.id"), @Result(column = "role_id", property = "role.id"),
@Result(column = "roleName", property = "role.name"), @Result(column = "role_name", property = "role.name"),
@Result(column = "roleAuthority", property = "role.authority"), @Result(column = "role_authority", property = "role.authority"),
@Result(column = "roleCreateTime", property = "role.createTime"), @Result(column = "role_create_time", property = "role.createTime"),
@Result(column = "roleUpdateTime", property = "role.updateTime") @Result(column = "role_update_time", property = "role.updateTime")
}) })
User select(String username, String password); User select(String username, String password);
@Select("select u.*, r.id as roleID, r.name as roleName, r.authority as roleAuthority , r.createTime as roleCreateTime , r.updateTime as roleUpdateTime FROM user u, user_role r WHERE u.roleId=r.id and u.id=#{id}") @Select("select u.*, r.id as role_id, r.name as role_name, r.authority as role_authority , r.create_time as role_create_time , r.update_time as role_update_time from wvp_user u, wvp_user_role r WHERE u.role_id=r.id and u.id=#{id}")
@ResultMap(value="roleMap") @ResultMap(value="roleMap")
User selectById(int id); User selectById(int id);
@Select("select u.*, r.id as roleID, r.name as roleName, r.authority as roleAuthority , r.createTime as roleCreateTime , r.updateTime as roleUpdateTime FROM user u, user_role r WHERE u.roleId=r.id and u.username=#{username}") @Select("select u.*, r.id as role_id, r.name as role_name, r.authority as role_authority , r.create_time as role_create_time , r.update_time as role_update_time from wvp_user u, wvp_user_role r WHERE u.role_id=r.id and u.username=#{username}")
@ResultMap(value="roleMap") @ResultMap(value="roleMap")
User getUserByUsername(String username); User getUserByUsername(String username);
@Select("select u.*, r.id as roleID, r.name as roleName, r.authority as roleAuthority , r.createTime as roleCreateTime , r.updateTime as roleUpdateTime FROM user u, user_role r WHERE u.roleId=r.id") @Select("select u.*, r.id as role_id, r.name as role_name, r.authority as role_authority , r.create_time as role_create_time , r.update_time as role_update_time from wvp_user u, wvp_user_role r WHERE u.role_id=r.id")
@ResultMap(value="roleMap") @ResultMap(value="roleMap")
List<User> selectAll(); List<User> selectAll();
@Select("select * from (select user.*, concat(concat(#{callId}, '_'), pushKey) as str1 from user) as u where md5(u.str1) = #{sign}") @Select("select u.id, u.username,u.push_key,u.role_id, r.id as role_id, r.name as role_name, r.authority as role_authority , r.create_time as role_create_time , r.update_time as role_update_time from wvp_user u join wvp_user_role r on u.role_id=r.id")
List<User> checkPushAuthorityByCallIdAndSign(String callId, String sign);
@Select("select * from user where md5(pushKey) = #{sign}")
List<User> checkPushAuthorityByCallId(String sign);
@Select("select u.id, u.username,u.pushKey,u.roleId, r.id as roleID, r.name as roleName, r.authority as roleAuthority , r.createTime as roleCreateTime , r.updateTime as roleUpdateTime FROM user u join user_role r on u.roleId=r.id")
@ResultMap(value="roleMap") @ResultMap(value="roleMap")
List<User> getUsers(); List<User> getUsers();
@Update("update user set pushKey=#{pushKey} where id=#{id}") @Update("UPDATE wvp_user set push_key=#{pushKey} where id=#{id}")
int changePushKey(int id, String pushKey); int changePushKey(int id, String pushKey);
} }

View File

@ -561,7 +561,7 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage {
@Override @Override
public boolean deviceIsOnline(String deviceId) { public boolean deviceIsOnline(String deviceId) {
return getDevice(deviceId).getOnline() == 1; return getDevice(deviceId).isOnLine();
} }

View File

@ -123,6 +123,9 @@ public class VideoManagerStorageImpl implements IVideoManagerStorage {
TransactionStatus transactionStatus = dataSourceTransactionManager.getTransaction(transactionDefinition); TransactionStatus transactionStatus = dataSourceTransactionManager.getTransaction(transactionDefinition);
// 数据去重 // 数据去重
List<DeviceChannel> channels = new ArrayList<>(); List<DeviceChannel> channels = new ArrayList<>();
List<DeviceChannel> updateChannels = new ArrayList<>();
List<DeviceChannel> addChannels = new ArrayList<>();
StringBuilder stringBuilder = new StringBuilder(); StringBuilder stringBuilder = new StringBuilder();
Map<String, Integer> subContMap = new HashMap<>(); Map<String, Integer> subContMap = new HashMap<>();
if (deviceChannelList.size() > 0) { if (deviceChannelList.size() > 0) {
@ -131,18 +134,22 @@ public class VideoManagerStorageImpl implements IVideoManagerStorage {
for (DeviceChannel deviceChannel : deviceChannelList) { for (DeviceChannel deviceChannel : deviceChannelList) {
if (!gbIdSet.contains(deviceChannel.getChannelId())) { if (!gbIdSet.contains(deviceChannel.getChannelId())) {
gbIdSet.add(deviceChannel.getChannelId()); gbIdSet.add(deviceChannel.getChannelId());
deviceChannel.setUpdateTime(DateUtil.getNow());
if (allChannelMap.containsKey(deviceChannel.getChannelId())) { if (allChannelMap.containsKey(deviceChannel.getChannelId())) {
deviceChannel.setStreamId(allChannelMap.get(deviceChannel.getChannelId()).getStreamId()); deviceChannel.setStreamId(allChannelMap.get(deviceChannel.getChannelId()).getStreamId());
deviceChannel.setHasAudio(allChannelMap.get(deviceChannel.getChannelId()).isHasAudio()); deviceChannel.setHasAudio(allChannelMap.get(deviceChannel.getChannelId()).isHasAudio());
if (allChannelMap.get(deviceChannel.getChannelId()).getStatus() !=deviceChannel.getStatus()){ if (allChannelMap.get(deviceChannel.getChannelId()).isStatus() !=deviceChannel.isStatus()){
List<String> strings = platformChannelMapper.queryParentPlatformByChannelId(deviceChannel.getChannelId()); List<String> strings = platformChannelMapper.queryParentPlatformByChannelId(deviceChannel.getChannelId());
if (!CollectionUtils.isEmpty(strings)){ if (!CollectionUtils.isEmpty(strings)){
strings.forEach(platformId->{ strings.forEach(platformId->{
eventPublisher.catalogEventPublish(platformId, deviceChannel, deviceChannel.getStatus()==1?CatalogEvent.ON:CatalogEvent.OFF); eventPublisher.catalogEventPublish(platformId, deviceChannel, deviceChannel.isStatus()?CatalogEvent.ON:CatalogEvent.OFF);
}); });
} }
} }
updateChannels.add(deviceChannel);
}else {
deviceChannel.setCreateTime(DateUtil.getNow());
addChannels.add(deviceChannel);
} }
channels.add(deviceChannel); channels.add(deviceChannel);
if (!ObjectUtils.isEmpty(deviceChannel.getParentId())) { if (!ObjectUtils.isEmpty(deviceChannel.getParentId())) {
@ -175,21 +182,36 @@ public class VideoManagerStorageImpl implements IVideoManagerStorage {
} }
try { try {
int cleanChannelsResult = deviceChannelMapper.cleanChannelsNotInList(deviceId, channels); int cleanChannelsResult = deviceChannelMapper.cleanChannelsNotInList(deviceId, channels);
int limitCount = 300; int limitCount = 300;
boolean result = cleanChannelsResult < 0; boolean result = cleanChannelsResult < 0;
if (!result && channels.size() > 0) { if (!result && addChannels.size() > 0) {
if (channels.size() > limitCount) { if (addChannels.size() > limitCount) {
for (int i = 0; i < channels.size(); i += limitCount) { for (int i = 0; i < addChannels.size(); i += limitCount) {
int toIndex = i + limitCount; int toIndex = i + limitCount;
if (i + limitCount > channels.size()) { if (i + limitCount > addChannels.size()) {
toIndex = channels.size(); toIndex = addChannels.size();
} }
result = result || deviceChannelMapper.batchAddOrUpdate(channels.subList(i, toIndex)) < 0; result = result || deviceChannelMapper.batchAdd(addChannels.subList(i, toIndex)) < 0;
} }
}else { }else {
result = result || deviceChannelMapper.batchAddOrUpdate(channels) < 0; result = result || deviceChannelMapper.batchAdd(addChannels) < 0;
} }
} }
if (!result && updateChannels.size() > 0) {
if (updateChannels.size() > limitCount) {
for (int i = 0; i < updateChannels.size(); i += limitCount) {
int toIndex = i + limitCount;
if (i + limitCount > updateChannels.size()) {
toIndex = updateChannels.size();
}
result = result || deviceChannelMapper.batchUpdate(updateChannels.subList(i, toIndex)) < 0;
}
}else {
result = result || deviceChannelMapper.batchUpdate(updateChannels) < 0;
}
}
if (result) { if (result) {
//事务回滚 //事务回滚
dataSourceTransactionManager.rollback(transactionStatus); dataSourceTransactionManager.rollback(transactionStatus);
@ -919,7 +941,7 @@ public class VideoManagerStorageImpl implements IVideoManagerStorage {
deviceChannel.setLatitude(0.0); deviceChannel.setLatitude(0.0);
deviceChannel.setDeviceId(platform.getDeviceGBId()); deviceChannel.setDeviceId(platform.getDeviceGBId());
deviceChannel.setManufacture("wvp-pro"); deviceChannel.setManufacture("wvp-pro");
deviceChannel.setStatus(1); deviceChannel.setStatus(true);
deviceChannel.setParental(1); deviceChannel.setParental(1);
deviceChannel.setRegisterWay(1); deviceChannel.setRegisterWay(1);

View File

@ -1,9 +1,17 @@
package com.genersoft.iot.vmp.vmanager.bean; package com.genersoft.iot.vmp.vmanager.bean;
public class ResourceBaceInfo { public class ResourceBaseInfo {
private int total; private int total;
private int online; private int online;
public ResourceBaseInfo() {
}
public ResourceBaseInfo(int total, int online) {
this.total = total;
this.online = online;
}
public int getTotal() { public int getTotal() {
return total; return total;
} }

View File

@ -2,40 +2,40 @@ package com.genersoft.iot.vmp.vmanager.bean;
public class ResourceInfo { public class ResourceInfo {
private ResourceBaceInfo device; private ResourceBaseInfo device;
private ResourceBaceInfo channel; private ResourceBaseInfo channel;
private ResourceBaceInfo push; private ResourceBaseInfo push;
private ResourceBaceInfo proxy; private ResourceBaseInfo proxy;
public ResourceBaceInfo getDevice() { public ResourceBaseInfo getDevice() {
return device; return device;
} }
public void setDevice(ResourceBaceInfo device) { public void setDevice(ResourceBaseInfo device) {
this.device = device; this.device = device;
} }
public ResourceBaceInfo getChannel() { public ResourceBaseInfo getChannel() {
return channel; return channel;
} }
public void setChannel(ResourceBaceInfo channel) { public void setChannel(ResourceBaseInfo channel) {
this.channel = channel; this.channel = channel;
} }
public ResourceBaceInfo getPush() { public ResourceBaseInfo getPush() {
return push; return push;
} }
public void setPush(ResourceBaceInfo push) { public void setPush(ResourceBaseInfo push) {
this.push = push; this.push = push;
} }
public ResourceBaceInfo getProxy() { public ResourceBaseInfo getProxy() {
return proxy; return proxy;
} }
public void setProxy(ResourceBaceInfo proxy) { public void setProxy(ResourceBaseInfo proxy) {
this.proxy = proxy; this.proxy = proxy;
} }
} }

View File

@ -15,7 +15,7 @@ import com.genersoft.iot.vmp.service.*;
import com.genersoft.iot.vmp.service.bean.MediaServerLoad; import com.genersoft.iot.vmp.service.bean.MediaServerLoad;
import com.genersoft.iot.vmp.storager.IRedisCatchStorage; import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
import com.genersoft.iot.vmp.vmanager.bean.ErrorCode; import com.genersoft.iot.vmp.vmanager.bean.ErrorCode;
import com.genersoft.iot.vmp.vmanager.bean.ResourceBaceInfo; import com.genersoft.iot.vmp.vmanager.bean.ResourceBaseInfo;
import com.genersoft.iot.vmp.vmanager.bean.ResourceInfo; import com.genersoft.iot.vmp.vmanager.bean.ResourceInfo;
import com.genersoft.iot.vmp.vmanager.bean.SystemConfigInfo; import com.genersoft.iot.vmp.vmanager.bean.SystemConfigInfo;
import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Operation;
@ -251,13 +251,13 @@ public class ServerController {
@Operation(summary = "获取负载信息") @Operation(summary = "获取负载信息")
public ResourceInfo getResourceInfo() { public ResourceInfo getResourceInfo() {
ResourceInfo result = new ResourceInfo(); ResourceInfo result = new ResourceInfo();
ResourceBaceInfo deviceInfo = deviceService.getOverview(); ResourceBaseInfo deviceInfo = deviceService.getOverview();
result.setDevice(deviceInfo); result.setDevice(deviceInfo);
ResourceBaceInfo channelInfo = channelService.getOverview(); ResourceBaseInfo channelInfo = channelService.getOverview();
result.setChannel(channelInfo); result.setChannel(channelInfo);
ResourceBaceInfo pushInfo = pushService.getOverview(); ResourceBaseInfo pushInfo = pushService.getOverview();
result.setPush(pushInfo); result.setPush(pushInfo);
ResourceBaceInfo proxyInfo = proxyService.getOverview(); ResourceBaseInfo proxyInfo = proxyService.getOverview();
result.setProxy(proxyInfo); result.setProxy(proxyInfo);
return result; return result;

View File

@ -90,7 +90,7 @@ public class ApiDeviceController {
deviceJsonObject.put("RecvStreamIP", ""); deviceJsonObject.put("RecvStreamIP", "");
deviceJsonObject.put("CatalogInterval", 3600); // 通道目录抓取周期 deviceJsonObject.put("CatalogInterval", 3600); // 通道目录抓取周期
deviceJsonObject.put("SubscribeInterval", device.getSubscribeCycleForCatalog()); // 订阅周期(), 0 表示后台不周期订阅 deviceJsonObject.put("SubscribeInterval", device.getSubscribeCycleForCatalog()); // 订阅周期(), 0 表示后台不周期订阅
deviceJsonObject.put("Online", device.getOnline() == 1); deviceJsonObject.put("Online", device.isOnLine());
deviceJsonObject.put("Password", ""); deviceJsonObject.put("Password", "");
deviceJsonObject.put("MediaTransport", device.getTransport()); deviceJsonObject.put("MediaTransport", device.getTransport());
deviceJsonObject.put("RemoteIP", device.getIp()); deviceJsonObject.put("RemoteIP", device.getIp());
@ -148,7 +148,7 @@ public class ApiDeviceController {
deviceJOSNChannel.put("ID", deviceChannelExtend.getChannelId()); deviceJOSNChannel.put("ID", deviceChannelExtend.getChannelId());
deviceJOSNChannel.put("DeviceID", deviceChannelExtend.getDeviceId()); deviceJOSNChannel.put("DeviceID", deviceChannelExtend.getDeviceId());
deviceJOSNChannel.put("DeviceName", deviceChannelExtend.getDeviceName()); deviceJOSNChannel.put("DeviceName", deviceChannelExtend.getDeviceName());
deviceJOSNChannel.put("DeviceOnline", deviceChannelExtend.getDeviceOnline() == 1); deviceJOSNChannel.put("DeviceOnline", deviceChannelExtend.isDeviceOnline());
deviceJOSNChannel.put("Channel", 0); // TODO 自定义序号 deviceJOSNChannel.put("Channel", 0); // TODO 自定义序号
deviceJOSNChannel.put("Name", deviceChannelExtend.getName()); deviceJOSNChannel.put("Name", deviceChannelExtend.getName());
deviceJOSNChannel.put("Custom", false); deviceJOSNChannel.put("Custom", false);
@ -167,7 +167,7 @@ public class ApiDeviceController {
// 1-IETF RFC3261, // 1-IETF RFC3261,
// 2-基于口令的双向认证, // 2-基于口令的双向认证,
// 3-基于数字证书的双向认证 // 3-基于数字证书的双向认证
deviceJOSNChannel.put("Status", deviceChannelExtend.getStatus() == 1 ? "ON":"OFF"); deviceJOSNChannel.put("Status", deviceChannelExtend.isStatus() ? "ON":"OFF");
deviceJOSNChannel.put("Longitude", deviceChannelExtend.getLongitude()); deviceJOSNChannel.put("Longitude", deviceChannelExtend.getLongitude());
deviceJOSNChannel.put("Latitude", deviceChannelExtend.getLatitude()); deviceJOSNChannel.put("Latitude", deviceChannelExtend.getLatitude());
deviceJOSNChannel.put("PTZType ", deviceChannelExtend.getPTZType()); // 云台类型, 0 - 未知, 1 - 球机, 2 - 半球, deviceJOSNChannel.put("PTZType ", deviceChannelExtend.getPTZType()); // 云台类型, 0 - 未知, 1 - 球机, 2 - 半球,

View File

@ -92,7 +92,7 @@ public class ApiStreamController {
result.put("error","device[ " + serial + " ]未找到"); result.put("error","device[ " + serial + " ]未找到");
resultDeferredResult.setResult(result); resultDeferredResult.setResult(result);
return resultDeferredResult; return resultDeferredResult;
}else if (device.getOnline() == 0) { }else if (!device.isOnLine()) {
JSONObject result = new JSONObject(); JSONObject result = new JSONObject();
result.put("error","device[ " + code + " ]offline"); result.put("error","device[ " + code + " ]offline");
resultDeferredResult.setResult(result); resultDeferredResult.setResult(result);
@ -113,7 +113,7 @@ public class ApiStreamController {
result.put("error","channel[ " + code + " ]未找到"); result.put("error","channel[ " + code + " ]未找到");
resultDeferredResult.setResult(result); resultDeferredResult.setResult(result);
return resultDeferredResult; return resultDeferredResult;
}else if (deviceChannel.getStatus() == 0) { }else if (!deviceChannel.isStatus()) {
JSONObject result = new JSONObject(); JSONObject result = new JSONObject();
result.put("error","channel[ " + code + " ]offline"); result.put("error","channel[ " + code + " ]offline");
resultDeferredResult.setResult(result); resultDeferredResult.setResult(result);

View File

@ -25,7 +25,7 @@ public class DeviceChannelExtend {
private String deviceName; private String deviceName;
private int deviceOnline; private boolean deviceOnline;
/** /**
* 生产厂商 * 生产厂商
@ -146,7 +146,7 @@ public class DeviceChannelExtend {
* <Status>OFF</Status> * <Status>OFF</Status>
* 遇到过NVR下的IPC下发信令可以推流 但是 Status 响应 OFF * 遇到过NVR下的IPC下发信令可以推流 但是 Status 响应 OFF
*/ */
private int status; private boolean status;
/** /**
* 经度 * 经度
@ -417,11 +417,11 @@ public class DeviceChannelExtend {
this.PTZTypeText = PTZTypeText; this.PTZTypeText = PTZTypeText;
} }
public int getStatus() { public boolean isStatus() {
return status; return status;
} }
public void setStatus(int status) { public void setStatus(boolean status) {
this.status = status; this.status = status;
} }
@ -545,11 +545,11 @@ public class DeviceChannelExtend {
this.deviceName = deviceName; this.deviceName = deviceName;
} }
public int getDeviceOnline() { public boolean isDeviceOnline() {
return deviceOnline; return deviceOnline;
} }
public void setDeviceOnline(int deviceOnline) { public void setDeviceOnline(boolean deviceOnline) {
this.deviceOnline = deviceOnline; this.deviceOnline = deviceOnline;
} }
} }