Просмотр исходного кода

Merge branch 'postgresql' into wvp-28181-2.0

648540858 2 лет назад
Родитель
Сommit
5639719879
62 измененных файлов с 1795 добавлено и 1529 удалено
  1. BIN
      doc/_media/logo.jpg
  2. BIN
      libs/jdbc-aarch/kingbase8-8.6.0.jar
  3. BIN
      libs/jdbc-aarch/kingbase8-8.6.0.jre7.jar
  4. BIN
      libs/jdbc-aarch/postgresql-42.2.9.jar
  5. BIN
      libs/jdbc-aarch/postgresql-42.2.9.jre7.jar
  6. 20 1
      pom.xml
  7. 479 0
      sql/2.6.8升级2.6.9.sql
  8. 13 13
      sql/clean.sql
  9. 284 542
      sql/初始化.sql
  10. 7 7
      src/main/java/com/genersoft/iot/vmp/gb28181/bean/Device.java
  11. 3 3
      src/main/java/com/genersoft/iot/vmp/gb28181/bean/DeviceChannel.java
  12. 1 1
      src/main/java/com/genersoft/iot/vmp/gb28181/bean/GbStream.java
  13. 1 1
      src/main/java/com/genersoft/iot/vmp/gb28181/bean/PlatformGbStream.java
  14. 1 1
      src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/ISIPCommanderForPlatform.java
  15. 5 5
      src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommanderFroPlatform.java
  16. 1 1
      src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/NotifyRequestForCatalogProcessor.java
  17. 1 1
      src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/NotifyRequestProcessor.java
  18. 1 1
      src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/RegisterRequestProcessor.java
  19. 2 2
      src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/notify/cmd/KeepaliveNotifyMessageHandler.java
  20. 1 1
      src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/query/cmd/DeviceStatusQueryMessageHandler.java
  21. 1 6
      src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/response/cmd/DeviceInfoResponseMessageHandler.java
  22. 5 5
      src/main/java/com/genersoft/iot/vmp/gb28181/utils/XmlUtil.java
  23. 2 2
      src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMHttpHookListener.java
  24. 60 0
      src/main/java/com/genersoft/iot/vmp/media/zlm/dto/StreamPushItem.java
  25. 2 2
      src/main/java/com/genersoft/iot/vmp/service/IDeviceChannelService.java
  26. 2 2
      src/main/java/com/genersoft/iot/vmp/service/IDeviceService.java
  27. 0 8
      src/main/java/com/genersoft/iot/vmp/service/IRecordInfoServer.java
  28. 2 2
      src/main/java/com/genersoft/iot/vmp/service/IStreamProxyService.java
  29. 2 2
      src/main/java/com/genersoft/iot/vmp/service/IStreamPushService.java
  30. 7 3
      src/main/java/com/genersoft/iot/vmp/service/impl/DeviceChannelServiceImpl.java
  31. 14 12
      src/main/java/com/genersoft/iot/vmp/service/impl/DeviceServiceImpl.java
  32. 2 2
      src/main/java/com/genersoft/iot/vmp/service/impl/GbStreamServiceImpl.java
  33. 1 1
      src/main/java/com/genersoft/iot/vmp/service/impl/MediaServerServiceImpl.java
  34. 0 25
      src/main/java/com/genersoft/iot/vmp/service/impl/RecordInfoServerImpl.java
  35. 9 5
      src/main/java/com/genersoft/iot/vmp/service/impl/StreamProxyServiceImpl.java
  36. 6 3
      src/main/java/com/genersoft/iot/vmp/service/impl/StreamPushServiceImpl.java
  37. 28 13
      src/main/java/com/genersoft/iot/vmp/service/impl/StreamPushUploadFileHandler.java
  38. 17 6
      src/main/java/com/genersoft/iot/vmp/service/impl/UserServiceImpl.java
  39. 12 12
      src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceAlarmMapper.java
  40. 202 253
      src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceChannelMapper.java
  41. 162 164
      src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceMapper.java
  42. 6 6
      src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceMobilePositionMapper.java
  43. 52 52
      src/main/java/com/genersoft/iot/vmp/storager/dao/GbStreamMapper.java
  44. 6 7
      src/main/java/com/genersoft/iot/vmp/storager/dao/LogMapper.java
  45. 63 63
      src/main/java/com/genersoft/iot/vmp/storager/dao/MediaServerMapper.java
  46. 41 41
      src/main/java/com/genersoft/iot/vmp/storager/dao/ParentPlatformMapper.java
  47. 12 14
      src/main/java/com/genersoft/iot/vmp/storager/dao/PlatformCatalogMapper.java
  48. 35 35
      src/main/java/com/genersoft/iot/vmp/storager/dao/PlatformChannelMapper.java
  49. 32 32
      src/main/java/com/genersoft/iot/vmp/storager/dao/PlatformGbStreamMapper.java
  50. 0 25
      src/main/java/com/genersoft/iot/vmp/storager/dao/RecordInfoDao.java
  51. 6 7
      src/main/java/com/genersoft/iot/vmp/storager/dao/RoleMapper.java
  52. 30 23
      src/main/java/com/genersoft/iot/vmp/storager/dao/StreamProxyMapper.java
  53. 68 52
      src/main/java/com/genersoft/iot/vmp/storager/dao/StreamPushMapper.java
  54. 17 23
      src/main/java/com/genersoft/iot/vmp/storager/dao/UserMapper.java
  55. 1 1
      src/main/java/com/genersoft/iot/vmp/storager/impl/RedisCatchStorageImpl.java
  56. 33 11
      src/main/java/com/genersoft/iot/vmp/storager/impl/VideoManagerStorageImpl.java
  57. 9 1
      src/main/java/com/genersoft/iot/vmp/vmanager/bean/ResourceBaceInfo.java
  58. 12 12
      src/main/java/com/genersoft/iot/vmp/vmanager/bean/ResourceInfo.java
  59. 5 5
      src/main/java/com/genersoft/iot/vmp/vmanager/server/ServerController.java
  60. 3 3
      src/main/java/com/genersoft/iot/vmp/web/gb28181/ApiDeviceController.java
  61. 2 2
      src/main/java/com/genersoft/iot/vmp/web/gb28181/ApiStreamController.java
  62. 6 6
      src/main/java/com/genersoft/iot/vmp/web/gb28181/dto/DeviceChannelExtend.java

BIN
doc/_media/logo.jpg


BIN
libs/jdbc-aarch/kingbase8-8.6.0.jar


BIN
libs/jdbc-aarch/kingbase8-8.6.0.jre7.jar


BIN
libs/jdbc-aarch/postgresql-42.2.9.jar


BIN
libs/jdbc-aarch/postgresql-42.2.9.jre7.jar


+ 20 - 1
pom.xml

@@ -135,11 +135,30 @@
 			<version>8.0.30</version>
 		</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分页插件 -->
 		<dependency>
 			<groupId>com.github.pagehelper</groupId>
 			<artifactId>pagehelper-spring-boot-starter</artifactId>
-			<version>1.4.3</version>
+			<version>1.4.6</version>
 		</dependency>
 
 		<!--在线文档 -->

+ 479 - 0
sql/2.6.8升级2.6.9.sql

@@ -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;
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

+ 13 - 13
sql/clean.sql

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

+ 284 - 542
sql/初始化.sql

@@ -1,580 +1,287 @@
---
+/*建表*/
+create table wvp_device (
+                            id serial primary key ,
+                            device_id character varying(50) not null ,
+                            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)
+);
+
+create table wvp_device_alarm (
+                                  id serial primary key ,
+                                  device_id character varying(50) not null,
+                                  channel_id character varying(50) not null,
+                                  alarm_priority character varying(50),
+                                  alarm_method character varying(50),
+                                  alarm_time character varying(50),
+                                  alarm_description character varying(255),
+                                  longitude double precision,
+                                  latitude double precision,
+                                  alarm_type character varying(50),
+                                  create_time character varying(50) not null
+);
+
+create table wvp_device_channel (
+                                    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)
+);
+
+create table wvp_device_mobile_position (
+                                            id serial primary key,
+                                            device_id character varying(50) not null,
+                                            channel_id character varying(50) not null,
+                                            device_name character varying(255),
+                                            time character varying(50),
+                                            longitude double precision,
+                                            latitude double precision,
+                                            altitude double precision,
+                                            speed double precision,
+                                            direction double precision,
+                                            report_source character varying(50),
+                                            longitude_gcj02 double precision,
+                                            latitude_gcj02 double precision,
+                                            longitude_wgs84 double precision,
+                                            latitude_wgs84 double precision,
+                                            create_time character varying(50)
+);
+
+create table wvp_gb_stream (
+                               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)
+);
+
+create table wvp_log (
+                         id serial primary key ,
+                         name character varying(50),
+                         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 (
+                                  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)
+);
+
+create table wvp_platform (
+                              id serial primary key ,
+                              enable bool default false,
+                              name character varying(255),
+                              server_gb_id character varying(50),
+                              server_gb_domain character varying(50),
+                              server_ip character varying(50),
+                              server_port integer,
+                              device_gb_id character varying(50),
+                              device_ip character varying(50),
+                              device_port character varying(50),
+                              username character varying(255),
+                              password character varying(50),
+                              expires character varying(50),
+                              keep_timeout character varying(50),
+                              transport character varying(50),
+                              character_set character varying(50),
+                              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 (
+                                      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)
+);
+
+create table wvp_platform_gb_channel (
+                                         id serial primary key ,
+                                         platform_id character varying(50),
+                                         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 (
+                                        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)
+);
+
+create table wvp_stream_proxy (
+                                  id serial primary key,
+                                  type character varying(50),
+                                  app character varying(255),
+                                  stream character varying(255),
+                                  url character varying(255),
+                                  src_url character varying(255),
+                                  dst_url character varying(255),
+                                  timeout_ms integer,
+                                  ffmpeg_cmd_key character varying(255),
+                                  rtp_type character varying(50),
+                                  media_server_id character varying(50),
+                                  enable_audio bool default false,
+                                  enable_mp4 bool default false,
+                                  enable bool default false,
+                                  status boolean,
+                                  enable_remove_none_reader bool default false,
+                                  create_time character varying(50),
+                                  name character varying(255),
+                                  update_time character varying(50),
+                                  enable_disable_none_reader bool default false,
+                                  constraint uk_stream_proxy_app_stream unique (app, stream)
+);
+
+create table wvp_stream_push (
+                                 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)
+);
+
+create table wvp_user (
+                          id serial primary key,
+                          username character varying(255),
+                          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 (
+                               id serial primary key,
+                               name character varying(50),
+                               authority character varying(50),
+                               create_time character varying(50),
+                               update_time character varying(50)
+);
+
+/*初始数据*/
+INSERT INTO wvp_user VALUES (1, 'admin','21232f297a57a5a743894a0e4a801fc3',1,'2021-04-13 14:14:57','2021-04-13 14:14:57','3e80d1762a324d5b0ff636e0bd16f1e3');
+INSERT INTO wvp_user_role VALUES (1, 'admin','0','2021-04-13 14:14:57','2021-04-13 14:14:57');
 
-/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
-/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
-/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
-/*!50503 SET NAMES utf8mb4 */;
-/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
-/*!40103 SET TIME_ZONE='+00:00' */;
-/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
-/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
-/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
-/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
 
---
---
 
-DROP TABLE IF EXISTS `device`;
-/*!40101 SET @saved_cs_client     = @@character_set_client */;
-/*!50503 SET character_set_client = utf8mb4 */;
-CREATE TABLE `device` (
-                          `id` int NOT NULL AUTO_INCREMENT,
-                          `deviceId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
-                          `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
-                          `manufacturer` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
-                          `model` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
-                          `firmware` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
-                          `transport` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
-                          `streamMode` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
-                          `online` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
-                          `mediaServerId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
-                          `registerTime` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
-                          `keepaliveTime` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
-                          `ip` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci 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,
-                          `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 */;
-
---
---
-
-LOCK TABLES `device` WRITE;
-/*!40000 ALTER TABLE `device` DISABLE KEYS */;
-/*!40000 ALTER TABLE `device` ENABLE KEYS */;
-UNLOCK TABLES;
-
---
---
-
-DROP TABLE IF EXISTS `device_alarm`;
-/*!40101 SET @saved_cs_client     = @@character_set_client */;
-/*!50503 SET character_set_client = utf8mb4 */;
-CREATE TABLE `device_alarm` (
-                                `id` int NOT NULL AUTO_INCREMENT,
-                                `deviceId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
-                                `channelId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
-                                `alarmPriority` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
-                                `alarmMethod` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
-                                `alarmTime` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
-                                `alarmDescription` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
-                                `longitude` double DEFAULT NULL,
-                                `latitude` double DEFAULT NULL,
-                                `alarmType` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
-                                `createTime` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT 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 */;
-
---
---
-
-LOCK TABLES `device_alarm` WRITE;
-/*!40000 ALTER TABLE `device_alarm` DISABLE KEYS */;
-/*!40000 ALTER TABLE `device_alarm` ENABLE KEYS */;
-UNLOCK TABLES;
-
---
---
-
-DROP TABLE IF EXISTS `device_channel`;
-/*!40101 SET @saved_cs_client     = @@character_set_client */;
-/*!50503 SET character_set_client = utf8mb4 */;
-CREATE TABLE `device_channel` (
-                                  `id` int NOT NULL AUTO_INCREMENT,
-                                  `channelId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
-                                  `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
-                                  `manufacture` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
-                                  `model` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
-                                  `owner` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
-                                  `civilCode` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
-                                  `block` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
-                                  `address` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
-                                  `parentId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
-                                  `safetyWay` int DEFAULT NULL,
-                                  `registerWay` int DEFAULT NULL,
-                                  `certNum` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
-                                  `certifiable` int DEFAULT NULL,
-                                  `errCode` int DEFAULT NULL,
-                                  `endTime` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
-                                  `secrecy` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
-                                  `ipAddress` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
-                                  `port` int DEFAULT NULL,
-                                  `password` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
-                                  `PTZType` int DEFAULT NULL,
-                                  `status` int DEFAULT NULL,
-                                  `longitude` double DEFAULT NULL,
-                                  `latitude` double DEFAULT NULL,
-                                  `streamId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
-                                  `deviceId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
-                                  `parental` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
-                                  `hasAudio` bit(1) DEFAULT NULL,
-                                  `createTime` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
-                                  `updateTime` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
-                                  `subCount` int DEFAULT '0',
-                                  `longitudeGcj02` double DEFAULT NULL,
-                                  `latitudeGcj02` double DEFAULT NULL,
-                                  `longitudeWgs84` double DEFAULT NULL,
-                                  `latitudeWgs84` double DEFAULT NULL,
-                                  `businessGroupId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
-                                  `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 */;
-
---
---
-
-LOCK TABLES `device_channel` WRITE;
-/*!40000 ALTER TABLE `device_channel` DISABLE KEYS */;
-/*!40000 ALTER TABLE `device_channel` ENABLE KEYS */;
-UNLOCK TABLES;
-
---
---
-
-DROP TABLE IF EXISTS `device_mobile_position`;
-/*!40101 SET @saved_cs_client     = @@character_set_client */;
-/*!50503 SET character_set_client = utf8mb4 */;
-CREATE TABLE `device_mobile_position` (
-                                          `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 */;
-
---
---
-
-LOCK TABLES `device_mobile_position` WRITE;
-/*!40000 ALTER TABLE `device_mobile_position` DISABLE KEYS */;
-/*!40000 ALTER TABLE `device_mobile_position` ENABLE KEYS */;
-UNLOCK TABLES;
-
---
---
-
-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 */;
-
---
---
-
-LOCK TABLES `gb_stream` WRITE;
-/*!40000 ALTER TABLE `gb_stream` DISABLE KEYS */;
-/*!40000 ALTER TABLE `gb_stream` ENABLE KEYS */;
-UNLOCK TABLES;
-
---
---
-
-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 */;
-
---
---
-
-LOCK TABLES `log` WRITE;
-/*!40000 ALTER TABLE `log` DISABLE KEYS */;
-/*!40000 ALTER TABLE `log` ENABLE KEYS */;
-UNLOCK TABLES;
-
---
---
-
-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 */;
-
---
---
-
-LOCK TABLES `media_server` WRITE;
-/*!40000 ALTER TABLE `media_server` DISABLE KEYS */;
-/*!40000 ALTER TABLE `media_server` ENABLE KEYS */;
-UNLOCK TABLES;
-
---
---
-
-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 */;
-
---
---
-
-LOCK TABLES `parent_platform` WRITE;
-/*!40000 ALTER TABLE `parent_platform` DISABLE KEYS */;
-/*!40000 ALTER TABLE `parent_platform` ENABLE KEYS */;
-UNLOCK TABLES;
-
---
---
-
-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 */;
-
---
---
-
-LOCK TABLES `platform_catalog` WRITE;
-/*!40000 ALTER TABLE `platform_catalog` DISABLE KEYS */;
-/*!40000 ALTER TABLE `platform_catalog` ENABLE KEYS */;
-UNLOCK TABLES;
-
---
---
-
-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 */;
-
---
---
-
-LOCK TABLES `platform_gb_channel` WRITE;
-/*!40000 ALTER TABLE `platform_gb_channel` DISABLE KEYS */;
-/*!40000 ALTER TABLE `platform_gb_channel` ENABLE KEYS */;
-UNLOCK TABLES;
-
---
---
-
-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 */;
-
---
---
-
-LOCK TABLES `platform_gb_stream` WRITE;
-/*!40000 ALTER TABLE `platform_gb_stream` DISABLE KEYS */;
-/*!40000 ALTER TABLE `platform_gb_stream` ENABLE KEYS */;
-UNLOCK TABLES;
-
---
---
-
-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 */;
-
---
---
-
-LOCK TABLES `stream_proxy` WRITE;
-/*!40000 ALTER TABLE `stream_proxy` DISABLE KEYS */;
-/*!40000 ALTER TABLE `stream_proxy` ENABLE KEYS */;
-UNLOCK TABLES;
-
---
---
-
-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 */;
-
---
---
-
-LOCK TABLES `stream_push` WRITE;
-/*!40000 ALTER TABLE `stream_push` DISABLE KEYS */;
-/*!40000 ALTER TABLE `stream_push` ENABLE KEYS */;
-UNLOCK TABLES;
-
---
---
-
-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 */;
-
---
---
-
-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;
-
---
---
-
-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 */;
-
---
---
-
-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 */;
-

+ 7 - 7
src/main/java/com/genersoft/iot/vmp/gb28181/bean/Device.java

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

+ 3 - 3
src/main/java/com/genersoft/iot/vmp/gb28181/bean/DeviceChannel.java

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

+ 1 - 1
src/main/java/com/genersoft/iot/vmp/gb28181/bean/GbStream.java

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

+ 1 - 1
src/main/java/com/genersoft/iot/vmp/gb28181/bean/PlatformGbStream.java

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

+ 1 - 1
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/ISIPCommanderForPlatform.java

@@ -66,7 +66,7 @@ public interface ISIPCommanderForPlatform {
      * @param fromTag
      * @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;
 
     /**
      * 向上级回复移动位置订阅消息

+ 5 - 5
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommanderFroPlatform.java

@@ -221,7 +221,7 @@ public class SIPCommanderFroPlatform implements ISIPCommanderForPlatform {
                 if (!channel.getChannelId().equals(parentPlatform.getDeviceGBId())) {
                     catalogXml.append("<Parental>" + channel.getParental() + "</Parental>\r\n");
                     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) {
@@ -250,7 +250,7 @@ public class SIPCommanderFroPlatform implements ISIPCommanderForPlatform {
                         catalogXml.append("<Port>" + channel.getPort() + "</Port>\r\n");
                         catalogXml.append("<Password>" + channel.getPort() + "</Password>\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>" +
                                 (channel.getLongitudeWgs84() != 0? channel.getLongitudeWgs84():channel.getLongitude())
                                 + "</Longitude>\r\n");
@@ -377,11 +377,11 @@ public class SIPCommanderFroPlatform implements ISIPCommanderForPlatform {
      * @return
      */
     @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) {
             return ;
         }
-        String statusStr = (status==1)?"ONLINE":"OFFLINE";
+        String statusStr = (status)?"ONLINE":"OFFLINE";
         String characterSet = parentPlatform.getCharacterSet();
         StringBuffer deviceStatusXml = new StringBuffer(600);
         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")
                             .append("<Secrecy>" + channel.getSecrecy() + "</Secrecy>\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) {  // 业务分组/虚拟组织/行政区划 不设置以下属性
                         catalogXml.append("<Model>" + channel.getModel() + "</Model>\r\n")

+ 1 - 1
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/NotifyRequestForCatalogProcessor.java

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

+ 1 - 1
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/NotifyRequestProcessor.java

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

+ 1 - 1
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/RegisterRequestProcessor.java

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

+ 2 - 2
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/notify/cmd/KeepaliveNotifyMessageHandler.java

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

+ 1 - 1
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/query/cmd/DeviceStatusQueryMessageHandler.java

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

+ 1 - 6
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/response/cmd/DeviceInfoResponseMessageHandler.java

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

+ 5 - 5
src/main/java/com/genersoft/iot/vmp/gb28181/utils/XmlUtil.java

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

+ 2 - 2
src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMHttpHookListener.java

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

+ 60 - 0
src/main/java/com/genersoft/iot/vmp/media/zlm/dto/StreamPushItem.java

@@ -325,5 +325,65 @@ public class StreamPushItem extends GbStream implements Comparable<StreamPushIte
     public void setSelf(boolean 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);
+//    }
+
 }
 

+ 2 - 2
src/main/java/com/genersoft/iot/vmp/service/IDeviceChannelService.java

@@ -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.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 java.util.List;
@@ -38,7 +38,7 @@ public interface IDeviceChannelService {
      * 获取统计信息
      * @return
      */
-    ResourceBaceInfo getOverview();
+    ResourceBaseInfo getOverview();
 
     /**
      * 查询所有未分配的通道

+ 2 - 2
src/main/java/com/genersoft/iot/vmp/service/IDeviceService.java

@@ -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.SyncStatus;
 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;
 
@@ -162,7 +162,7 @@ public interface IDeviceService {
      * 获取统计信息
      * @return
      */
-    ResourceBaceInfo getOverview();
+    ResourceBaseInfo getOverview();
 
     /**
      * 获取所有设备

+ 0 - 8
src/main/java/com/genersoft/iot/vmp/service/IRecordInfoServer.java

@@ -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);
-}

+ 2 - 2
src/main/java/com/genersoft/iot/vmp/service/IStreamProxyService.java

@@ -4,7 +4,7 @@ import com.alibaba.fastjson2.JSONObject;
 import com.genersoft.iot.vmp.common.StreamInfo;
 import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem;
 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;
 
 public interface IStreamProxyService {
@@ -108,6 +108,6 @@ public interface IStreamProxyService {
      * 获取统计信息
      * @return
      */
-    ResourceBaceInfo getOverview();
+    ResourceBaseInfo getOverview();
 
 }

+ 2 - 2
src/main/java/com/genersoft/iot/vmp/service/IStreamPushService.java

@@ -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.StreamPushItem;
 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 java.util.List;
@@ -113,5 +113,5 @@ public interface IStreamPushService {
      * 获取统计信息
      * @return
      */
-    ResourceBaceInfo getOverview();
+    ResourceBaseInfo getOverview();
 }

+ 7 - 3
src/main/java/com/genersoft/iot/vmp/service/impl/DeviceChannelServiceImpl.java

@@ -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.DeviceMapper;
 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 org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -175,8 +175,12 @@ public class DeviceChannelServiceImpl implements IDeviceChannelService {
     }
 
     @Override
-    public ResourceBaceInfo getOverview() {
-        return channelMapper.getOverview();
+    public ResourceBaseInfo getOverview() {
+
+        int online = channelMapper.getOnlineCount();
+        int total = channelMapper.getAllChannelCount();
+
+        return new ResourceBaseInfo(total, online);
     }
 
 

+ 14 - 12
src/main/java/com/genersoft/iot/vmp/service/impl/DeviceServiceImpl.java

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

+ 2 - 2
src/main/java/com/genersoft/iot/vmp/service/impl/GbStreamServiceImpl.java

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

+ 1 - 1
src/main/java/com/genersoft/iot/vmp/service/impl/MediaServerServiceImpl.java

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

+ 0 - 25
src/main/java/com/genersoft/iot/vmp/service/impl/RecordInfoServerImpl.java

@@ -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);
-    }
-}

+ 9 - 5
src/main/java/com/genersoft/iot/vmp/service/impl/StreamProxyServiceImpl.java

@@ -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.utils.DateUtil;
 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 org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -332,7 +332,7 @@ public class StreamProxyServiceImpl implements IStreamProxyService {
     @Override
     public void zlmServerOnline(String mediaServerId) {
         // 移除开启了无人观看自动移除的流
-        List<StreamProxyItem> streamProxyItemList = streamProxyMapper.selecAutoRemoveItemByMediaServerId(mediaServerId);
+        List<StreamProxyItem> streamProxyItemList = streamProxyMapper.selectAutoRemoveItemByMediaServerId(mediaServerId);
         if (streamProxyItemList.size() > 0) {
             gbStreamMapper.batchDel(streamProxyItemList);
         }
@@ -360,7 +360,7 @@ public class StreamProxyServiceImpl implements IStreamProxyService {
     @Override
     public void zlmServerOffline(String mediaServerId) {
         // 移除开启了无人观看自动移除的流
-        List<StreamProxyItem> streamProxyItemList = streamProxyMapper.selecAutoRemoveItemByMediaServerId(mediaServerId);
+        List<StreamProxyItem> streamProxyItemList = streamProxyMapper.selectAutoRemoveItemByMediaServerId(mediaServerId);
         if (streamProxyItemList.size() > 0) {
             gbStreamMapper.batchDel(streamProxyItemList);
         }
@@ -438,7 +438,11 @@ public class StreamProxyServiceImpl implements IStreamProxyService {
     }
 
     @Override
-    public ResourceBaceInfo getOverview() {
-        return streamProxyMapper.getOverview();
+    public ResourceBaseInfo getOverview() {
+
+        int total = streamProxyMapper.getAllCount();
+        int online = streamProxyMapper.getOnline();
+
+        return new ResourceBaseInfo(total, online);
     }
 }

+ 6 - 3
src/main/java/com/genersoft/iot/vmp/service/impl/StreamPushServiceImpl.java

@@ -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.dao.*;
 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.PageInfo;
 import org.slf4j.Logger;
@@ -531,7 +531,10 @@ public class StreamPushServiceImpl implements IStreamPushService {
     }
 
     @Override
-    public ResourceBaceInfo getOverview() {
-        return streamPushMapper.getOverview(userSetting.isUsePushingAsStatus());
+    public ResourceBaseInfo getOverview() {
+        int total = streamPushMapper.getAllCount();
+        int online = streamPushMapper.getAllOnline(userSetting.isUsePushingAsStatus());
+
+        return new ResourceBaseInfo(total, online);
     }
 }

+ 28 - 13
src/main/java/com/genersoft/iot/vmp/service/impl/StreamPushUploadFileHandler.java

@@ -9,7 +9,6 @@ import com.genersoft.iot.vmp.vmanager.bean.StreamPushExcelDto;
 import com.google.common.collect.BiMap;
 import com.google.common.collect.HashBiMap;
 import org.springframework.util.ObjectUtils;
-import org.springframework.util.StringUtils;
 
 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表
      */
-    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对应的平台与目录信息,然后存入关联表
      */
-    private Map<String, List<String[]>> streamPushItemsForPlatform = new HashMap<>();
+    private final Map<String, List<String[]>> streamPushItemsForPlatform = new HashMap<>();
 
     /**
      * 用于判断文件是否存在重复的app+Stream+平台ID
      */
-    private Set<String> streamPushStreamSet = new HashSet<>();
+    private final Set<String> streamPushStreamSet = new HashSet<>();
 
     /**
      * 用于存储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
      */
-    private List<String> errorStreamList = new ArrayList<>();
+    private final List<String> errorStreamList = new ArrayList<>();
 
 
     /**
      * 记录错误的国标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.defaultMediaServerId = defaultMediaServerId;
         this.errorDataHandler = errorDataHandler;
+        // 获取数据库已有的数据,已经存在的则忽略
+        List<String> allAppAndStreams = pushService.getAllAppAndStream();
+        if (allAppAndStreams.size() > 0) {
+            for (String allAppAndStream : allAppAndStreams) {
+                pushMapInDb.put(allAppAndStream, allAppAndStream);
+            }
+        }
     }
 
     public interface ErrorDataHandler{
@@ -88,26 +99,30 @@ public class StreamPushUploadFileHandler extends AnalysisEventListener<StreamPus
                 || ObjectUtils.isEmpty(streamPushExcelDto.getGbId())) {
             return;
         }
+        Integer rowIndex = analysisContext.readRowHolder().getRowIndex();
 
         if (gBMap.get(streamPushExcelDto.getApp() + streamPushExcelDto.getStream()) == null) {
             try {
                 gBMap.put(streamPushExcelDto.getApp() + streamPushExcelDto.getStream(), streamPushExcelDto.getGbId());
             }catch (IllegalArgumentException e) {
-                errorGBList.add(streamPushExcelDto.getGbId() + "(不同的app+stream使用了相同的国标ID)");
+                errorInfoList.add("行:" + rowIndex + ", " + streamPushExcelDto.getGbId() + " 国标ID重复使用");
                 return;
             }
         }else {
             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;
             }
         }
 
         if (streamPushStreamSet.contains(streamPushExcelDto.getApp() + streamPushExcelDto.getStream() + streamPushExcelDto.getPlatformId())) {
-            errorStreamList.add(streamPushExcelDto.getApp() + "/" + streamPushExcelDto.getStream()+ "/" +
-                    streamPushExcelDto.getPlatformId() + "(同一组app+stream添加在了同一个平台下)");
+            errorStreamList.add("行:" + rowIndex + ", " +  streamPushExcelDto.getApp() + "/" + streamPushExcelDto.getStream()+  " 平台信息重复");
             return;
         }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());
         }
 
@@ -165,7 +180,7 @@ public class StreamPushUploadFileHandler extends AnalysisEventListener<StreamPus
         gBMap.clear();
         streamPushStreamSet.clear();
         streamPushItemsForPlatform.clear();
-        errorDataHandler.handle(errorStreamList, errorGBList);
+        errorDataHandler.handle(errorStreamList, errorInfoList);
     }
 
     private void saveData(){

+ 17 - 6
src/main/java/com/genersoft/iot/vmp/service/impl/UserServiceImpl.java

@@ -7,8 +7,7 @@ import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
-import org.springframework.util.ObjectUtils;
-import org.springframework.util.StringUtils;
+import org.springframework.util.DigestUtils;
 
 import java.util.List;
 
@@ -61,11 +60,23 @@ public class UserServiceImpl implements IUserService {
 
     @Override
     public boolean checkPushAuthority(String callId, String sign) {
-        if (ObjectUtils.isEmpty(callId)) {
-            return userMapper.checkPushAuthorityByCallId(sign).size() > 0;
-        }else {
-            return userMapper.checkPushAuthorityByCallIdAndSign(callId, sign).size() > 0;
+
+        List<User> users = userMapper.getUsers();
+        if (users.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

+ 12 - 12
src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceAlarmMapper.java

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

+ 202 - 253
src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceChannelMapper.java

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

+ 162 - 164
src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceMapper.java

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

+ 6 - 6
src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceMobilePositionMapper.java

@@ -11,25 +11,25 @@ import java.util.List;
 @Mapper
 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})")
     int insertNewPosition(MobilePosition mobilePosition);
 
     @Select(value = {" <script>" +
-    "SELECT * FROM device_mobile_position" +
-    " WHERE deviceId = #{deviceId}" +
-    "<if test=\"channelId != null\"> and channelId = #{channelId}</if>" +
+    "SELECT * FROM wvp_device_mobile_position" +
+    " WHERE device_id = #{deviceId}" +
+    "<if test=\"channelId != null\"> and channel_id = #{channelId}</if>" +
     "<if test=\"startTime != null\"> AND time&gt;=#{startTime}</if>" +
     "<if test=\"endTime != null\"> AND time&lt;=#{endTime}</if>" +
     " ORDER BY time ASC" +
     " </script>"})
     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")
     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);
 
 }

+ 52 - 52
src/main/java/com/genersoft/iot/vmp/storager/dao/GbStreamMapper.java

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

+ 6 - 7
src/main/java/com/genersoft/iot/vmp/storager/dao/LogMapper.java

@@ -1,6 +1,5 @@
 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 org.apache.ibatis.annotations.Delete;
 import org.apache.ibatis.annotations.Insert;
@@ -17,21 +16,21 @@ import java.util.List;
 @Repository
 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})")
     int add(LogDto logDto);
 
     @Select(value = {"<script>" +
-            " SELECT * FROM log " +
+            " SELECT * FROM wvp_log " +
             " WHERE 1=1 " +
             " <if test=\"query != null\"> AND (name LIKE concat('%',#{query},'%'))</if> " +
             " <if test=\"type != null\" >  AND type = #{type}</if>" +
-            " <if test=\"startTime != null\" >  AND createTime &gt;= #{startTime} </if>" +
-            " <if test=\"endTime != null\" >  AND createTime &lt;= #{endTime} </if>" +
-            " ORDER BY createTime DESC " +
+            " <if test=\"startTime != null\" >  AND create_time &gt;= #{startTime} </if>" +
+            " <if test=\"endTime != null\" >  AND create_time &lt;= #{endTime} </if>" +
+            " ORDER BY create_time DESC " +
             " </script>"})
     List<LogDto> query(String query, String type, String startTime, String endTime);
 
-    @Delete("DELETE FROM log")
+    @Delete("DELETE FROM wvp_log")
     int clear();
 }

+ 63 - 63
src/main/java/com/genersoft/iot/vmp/storager/dao/MediaServerMapper.java

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

+ 41 - 41
src/main/java/com/genersoft/iot/vmp/storager/dao/ParentPlatformMapper.java

@@ -14,88 +14,88 @@ import java.util.List;
 @Repository
 public interface ParentPlatformMapper {
 
-    @Insert("INSERT INTO parent_platform (enable, name, serverGBId, serverGBDomain, serverIP, serverPort, deviceGBId, deviceIp,  " +
-            "            devicePort, username, password, expires, keepTimeout, transport, characterSet, ptz, rtcp, asMessageChannel, " +
-            "            status, startOfflinePush, catalogId, administrativeDivision, catalogGroup, createTime, updateTime, treeType) " +
+    @Insert("INSERT INTO wvp_platform (enable, name, server_gb_id, server_gb_domain, server_ip, server_port,device_gb_id,device_ip,"+
+            "device_port,username,password,expires,keep_timeout,transport,character_set,ptz,rtcp,as_message_channel,"+
+            "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}, " +
             "            #{devicePort}, #{username}, #{password}, #{expires}, #{keepTimeout}, #{transport}, #{characterSet}, #{ptz}, #{rtcp}, #{asMessageChannel}, " +
             "            #{status},  #{startOfflinePush}, #{catalogId}, #{administrativeDivision}, #{catalogGroup}, #{createTime}, #{updateTime}, #{treeType})")
     int addParentPlatform(ParentPlatform parentPlatform);
 
-    @Update("UPDATE parent_platform " +
+    @Update("UPDATE wvp_platform " +
             "SET enable=#{enable}, " +
             "name=#{name}," +
-            "deviceGBId=#{deviceGBId}," +
-            "serverGBId=#{serverGBId}, " +
-            "serverGBDomain=#{serverGBDomain}, " +
-            "serverIP=#{serverIP}," +
-            "serverPort=#{serverPort}, " +
-            "deviceIp=#{deviceIp}, " +
-            "devicePort=#{devicePort}, " +
+            "device_gb_id=#{deviceGBId}," +
+            "server_gb_id=#{serverGBId}, " +
+            "server_gb_domain=#{serverGBDomain}, " +
+            "server_ip=#{serverIP}," +
+            "server_port=#{serverPort}, " +
+            "device_ip=#{deviceIp}, " +
+            "device_port=#{devicePort}, " +
             "username=#{username}, " +
             "password=#{password}, " +
             "expires=#{expires}, " +
-            "keepTimeout=#{keepTimeout}, " +
+            "keep_timeout=#{keepTimeout}, " +
             "transport=#{transport}, " +
-            "characterSet=#{characterSet}, " +
+            "character_set=#{characterSet}, " +
             "ptz=#{ptz}, " +
             "rtcp=#{rtcp}, " +
-            "asMessageChannel=#{asMessageChannel}, " +
+            "as_message_channel=#{asMessageChannel}, " +
             "status=#{status}, " +
-            "startOfflinePush=#{startOfflinePush}, " +
-            "catalogGroup=#{catalogGroup}, " +
-            "administrativeDivision=#{administrativeDivision}, " +
-            "createTime=#{createTime}, " +
-            "updateTime=#{updateTime}, " +
-            "treeType=#{treeType}, " +
-            "catalogId=#{catalogId} " +
+            "start_offline_push=#{startOfflinePush}, " +
+            "catalog_group=#{catalogGroup}, " +
+            "administrative_division=#{administrativeDivision}, " +
+            "create_time=#{createTime}, " +
+            "update_time=#{updateTime}, " +
+            "tree_type=#{treeType}, " +
+            "catalog_id=#{catalogId} " +
             "WHERE id=#{id}")
     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);
 
     @Select("SELECT *, ((SELECT count(0)\n" +
-            "              FROM platform_gb_channel pc\n" +
-            "              WHERE pc.platformId = pp.serverGBId)\n" +
+            "              FROM wvp_platform_gb_channel pc\n" +
+            "              WHERE pc.platform_id = pp.server_gb_id)\n" +
             "              +\n" +
             "              (SELECT count(0)\n" +
-            "              FROM platform_gb_stream pgs\n" +
-            "              WHERE pgs.platformId = pp.serverGBId)\n" +
+            "              FROM wvp_platform_gb_stream pgs\n" +
+            "              WHERE pgs.platform_id = pp.server_gb_id)\n" +
             "              +\n" +
             "              (SELECT count(0)\n" +
-            "              FROM platform_catalog pgc\n" +
-            "              WHERE pgc.platformId = pp.serverGBId)) as channelCount\n" +
-            "FROM parent_platform pp ")
+            "              FROM wvp_platform_catalog pgc\n" +
+            "              WHERE pgc.platform_id = pp.server_gb_id)) as channel_count\n" +
+            "FROM wvp_platform pp ")
     List<ParentPlatform> getParentPlatformList();
 
-    @Select("SELECT * FROM parent_platform WHERE enable=#{enable} ")
+    @Select("SELECT * FROM wvp_platform WHERE enable=#{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();
 
-    @Select("SELECT * FROM parent_platform WHERE serverGBId=#{platformGbId}")
+    @Select("SELECT * FROM wvp_platform WHERE server_gb_id=#{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);
 
-    @Update("UPDATE parent_platform SET status=false" )
+    @Update("UPDATE wvp_platform SET status=false" )
     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);
 
     @Update(value = {" <script>" +
-            "UPDATE parent_platform " +
-            "SET catalogId=#{catalogId}, updateTime=#{updateTime}" +
-            "WHERE serverGBId=#{platformId}"+
+            "UPDATE wvp_platform " +
+            "SET catalog_id=#{catalogId}, update_time=#{updateTime}" +
+            "WHERE server_gb_id=#{platformId}"+
             "</script>"})
     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 " +
-            "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}")
-    List<ChannelSourceInfo> getChannelSource(String platformId, String 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 platform_id, String gbId);
 }

+ 12 - 14
src/main/java/com/genersoft/iot/vmp/storager/dao/PlatformCatalogMapper.java

@@ -1,10 +1,7 @@
 package com.genersoft.iot.vmp.storager.dao;
 
 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.PlatformGbStream;
-import com.genersoft.iot.vmp.media.zlm.dto.StreamProxyItem;
 import org.apache.ibatis.annotations.*;
 import org.springframework.stereotype.Repository;
 
@@ -15,22 +12,23 @@ import java.util.List;
 @Repository
 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})")
     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);
 
-    @Delete("DELETE FROM platform_catalog WHERE platformId=#{platformId}")
+    @Delete("DELETE from wvp_platform_catalog WHERE platform_id=#{platformId}")
     int delByPlatformId(String platformId);
 
-    @Select("SELECT pc.*, count(pc2.id) as childrenCount FROM platform_catalog pc " +
-            "left join platform_catalog pc2 on pc.id = pc2.parentId " +
-            "WHERE pc.parentId=#{parentId} AND pc.platformId=#{platformId} group by pc.id")
+    @Select("SELECT pc.*, count(pc2.id) as children_count from wvp_platform_catalog pc " +
+            "left join wvp_platform_catalog pc2 on pc.id = pc2.parent_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);
 
-    @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);
 
     @Update(value = {" <script>" +
@@ -40,17 +38,17 @@ public interface PlatformCatalogMapper {
             "</script>"})
     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);
 
-    @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);
 
 
     @Select("SELECT pc.* FROM  platform_catalog pc WHERE pc.id = #{id}")
     PlatformCatalog selectParentCatalog(String id);
 
-    @Select("SELECT pc.id as channelId, pc.name, pc.civilCode, pc.businessGroupId,'1' as parental, pc.parentId  " +
-            " FROM platform_catalog pc WHERE pc.platformId=#{platformId}")
+    @Select("SELECT pc.id as channel_id, pc.name, pc.civil_code, pc.business_group_id,'1' as parental, pc.parent_id  " +
+            " from wvp_platform_catalog pc WHERE pc.platform_id=#{platformId}")
     List<DeviceChannel> queryCatalogInPlatform(String platformId);
 }

+ 35 - 35
src/main/java/com/genersoft/iot/vmp/storager/dao/PlatformChannelMapper.java

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

+ 32 - 32
src/main/java/com/genersoft/iot/vmp/storager/dao/PlatformGbStreamMapper.java

@@ -16,82 +16,82 @@ import java.util.List;
 @Repository
 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})")
     int add(PlatformGbStream platformGbStream);
 
 
     @Insert("<script> " +
-            "INSERT into platform_gb_stream " +
-            "(gbStreamId, platformId, catalogId) " +
+            "INSERT into wvp_platform_gb_stream " +
+            "(gb_stream_id, platform_id, catalog_id) " +
             "values " +
             "<foreach collection='streamPushItems' index='index' item='item' separator=','> " +
-            "(#{item.gbStreamId}, #{item.platformId}, #{item.catalogId})" +
+            "(#{item.gbStreamId}, #{item.platform_id}, #{item.catalogId})" +
             "</foreach> " +
             "</script>")
     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);
 
-    @Delete("DELETE FROM platform_gb_stream WHERE platformId=#{platformId}")
+    @Delete("DELETE from wvp_platform_gb_stream WHERE platform_id=#{platformId}")
     int delByPlatformId(String platformId);
 
     @Select("SELECT " +
             "pp.* " +
             "FROM " +
-            "platform_gb_stream pgs " +
-            "LEFT JOIN parent_platform pp ON pp.serverGBId = pgs.platformId " +
-            "LEFT JOIN gb_stream gs ON gs.gbStreamId = pgs.gbStreamId " +
+            "wvp_platform_gb_stream pgs " +
+            "LEFT JOIN wvp_platform pp ON pp.server_gb_id = pgs.platform_id " +
+            "LEFT join wvp_gb_stream gs ON gs.gb_stream_id = pgs.gb_stream_id " +
             "WHERE " +
             "gs.app =#{app} " +
             "AND gs.stream =#{stream} ")
     List<ParentPlatform> selectByAppAndStream(String app, String stream);
 
-    @Select("SELECT pgs.*, gs.gbId  FROM platform_gb_stream pgs " +
-            "LEFT JOIN gb_stream gs ON pgs.gbStreamId = gs.gbStreamId  " +
-            "WHERE gs.app=#{app} AND gs.stream=#{stream} AND pgs.platformId=#{serverGBId}")
+    @Select("SELECT pgs.*, gs.gb_id  from wvp_platform_gb_stream pgs " +
+            "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.platform_id=#{serverGBId}")
     StreamProxyItem selectOne(String app, String stream, String serverGBId);
 
     @Select("select gs.* \n" +
-            "from gb_stream gs\n" +
-            "    left join platform_gb_stream pgs\n" +
-            "        on gs.gbStreamId = pgs.gbStreamId\n" +
-            "where pgs.platformId=#{platformId} and pgs.catalogId=#{catalogId}")
+            "from wvp_gb_stream gs\n" +
+            "    left join wvp_platform_gb_stream pgs\n" +
+            "        on gs.gb_stream_id = pgs.gb_stream_id\n" +
+            "where pgs.platform_id=#{platformId} and pgs.catalog_id=#{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" +
-            "from gb_stream gs\n" +
-            "    left join platform_gb_stream pgs\n" +
-            "        on gs.gbStreamId = pgs.gbStreamId\n" +
-            "where pgs.platformId=#{platformId} and pgs.catalogId=#{catalogId}")
+    @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 wvp_gb_stream gs\n" +
+            "    left join wvp_platform_gb_stream pgs\n" +
+            "        on gs.gb_stream_id = pgs.gb_stream_id\n" +
+            "where pgs.platform_id=#{platformId} and pgs.catalog_id=#{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);
 
     @Select("<script> " +
             "SELECT " +
             "pp.* " +
             "FROM " +
-            "parent_platform pp " +
-            "left join platform_gb_stream pgs on " +
-            "pp.serverGBId = pgs.platformId " +
-            "left join gb_stream gs " +
-            "on gs.gbStreamId = pgs.gbStreamId " +
+            "wvp_platform pp " +
+            "left join wvp_platform_gb_stream pgs on " +
+            "pp.server_gb_id = pgs.platform_id " +
+            "left join wvp_gb_stream gs " +
+            "on gs.gb_stream_id = pgs.gb_stream_id " +
             "WHERE " +
             "gs.app = #{app} " +
             "AND gs.stream = #{stream}" +
-            "AND pp.serverGBId IN" +
+            "AND pp.server_gb_id IN" +
             "<foreach collection='platforms'  item='item'  open='(' separator=',' close=')' > #{item}</foreach>" +
             "</script> ")
     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);
 
     @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=')' >" +
             "#{item.gbStreamId}" +
             "</foreach>" +
@@ -99,13 +99,13 @@ public interface PlatformGbStreamMapper {
     void delByGbStreams(List<GbStream> gbStreams);
 
     @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=')'>" +
             "#{item.gbStreamId} " +
             "</foreach>" +
             "</script>")
     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);
 }

+ 0 - 25
src/main/java/com/genersoft/iot/vmp/storager/dao/RecordInfoDao.java

@@ -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();
-}

+ 6 - 7
src/main/java/com/genersoft/iot/vmp/storager/dao/RoleMapper.java

@@ -1,7 +1,6 @@
 package com.genersoft.iot.vmp.storager.dao;
 
 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.springframework.stereotype.Repository;
 
@@ -11,25 +10,25 @@ import java.util.List;
 @Repository
 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})")
     int add(Role role);
 
     @Update(value = {" <script>" +
-            "UPDATE user_role " +
-            "SET updateTime=#{updateTime} " +
+            "UPDATE wvp_user_role " +
+            "SET update_time=#{updateTime} " +
             "<if test=\"name != null\">, name=#{name}</if>" +
             "<if test=\"authority != null\">, authority=#{authority}</if>" +
             "WHERE id != 1 and id=#{id}" +
             " </script>"})
     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);
 
-    @Select("select * FROM user_role WHERE id=#{id}")
+    @Select("select * from wvp_user_role WHERE id=#{id}")
     Role selectById(int id);
 
-    @Select("select * FROM user_role")
+    @Select("select * from wvp_user_role")
     List<Role> selectAll();
 }

+ 30 - 23
src/main/java/com/genersoft/iot/vmp/storager/dao/StreamProxyMapper.java

@@ -1,7 +1,7 @@
 package com.genersoft.iot.vmp.storager.dao;
 
 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.springframework.stereotype.Repository;
 
@@ -11,20 +11,20 @@ import java.util.List;
 @Repository
 public interface StreamProxyMapper {
 
-    @Insert("INSERT INTO stream_proxy (type, name, app, stream,mediaServerId, 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" +
+    @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, create_time) VALUES" +
             "(#{type}, #{name}, #{app}, #{stream}, #{mediaServerId}, #{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} )")
     int add(StreamProxyItem streamProxyDto);
 
-    @Update("UPDATE stream_proxy " +
+    @Update("UPDATE wvp_stream_proxy " +
             "SET type=#{type}, " +
             "name=#{name}," +
             "app=#{app}," +
             "stream=#{stream}," +
             "url=#{url}, " +
-            "mediaServerId=#{mediaServerId}, " +
+            "media_server_id=#{mediaServerId}, " +
             "src_url=#{src_url}," +
             "dst_url=#{dst_url}, " +
             "timeout_ms=#{timeout_ms}, " +
@@ -39,44 +39,51 @@ public interface StreamProxyMapper {
             "WHERE app=#{app} AND stream=#{stream}")
     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);
 
-    @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();
 
-    @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);
 
-    @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);
 
-    @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} and st.mediaServerId = #{id} 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} and st.media_server_id= #{id} order by st.create_time desc")
     List<StreamProxyItem> selectForEnableInMediaServer(String id, 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.mediaServerId = #{id} 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.media_server_id= #{id} order by st.create_time desc")
     List<StreamProxyItem> selectInMediaServer(String id);
 
-    @Update("UPDATE stream_proxy " +
+    @Update("UPDATE wvp_stream_proxy " +
             "SET status=#{status} " +
-            "WHERE mediaServerId=#{mediaServerId}")
+            "WHERE media_server_id=#{mediaServerId}")
     void updateStatusByMediaServerId(String mediaServerId, boolean status);
 
-    @Update("UPDATE stream_proxy " +
+    @Update("UPDATE wvp_stream_proxy " +
             "SET status=#{status} " +
             "WHERE app=#{app} AND stream=#{stream}")
     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);
 
-    @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")
-    List<StreamProxyItem> selecAutoRemoveItemByMediaServerId(String mediaServerId);
+    @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> selectAutoRemoveItemByMediaServerId(String mediaServerId);
 
-    @Select("select count(1) as total, sum(status) as online from stream_proxy")
-    ResourceBaceInfo getOverview();
+    @Select("select count(1) as total, sum(status) as online from wvp_stream_proxy")
+    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();
 }

+ 68 - 52
src/main/java/com/genersoft/iot/vmp/storager/dao/StreamPushMapper.java

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

+ 17 - 23
src/main/java/com/genersoft/iot/vmp/storager/dao/UserMapper.java

@@ -10,56 +10,50 @@ import java.util.List;
 @Repository
 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})")
     int add(User user);
 
     @Update(value = {" <script>" +
-            "UPDATE user " +
-            "SET updateTime=#{updateTime} " +
-            "<if test=\"pushKey != null\">, pushKey=#{pushKey}</if>" +
-            "<if test=\"role != null\">, roleId=#{role.id}</if>" +
+            "UPDATE wvp_user " +
+            "SET update_time=#{updateTime} " +
+            "<if test=\"pushKey != null\">, push_key=#{pushKey}</if>" +
+            "<if test=\"role != null\">, role_id=#{role.id}</if>" +
             "<if test=\"password != null\">, password=#{password}</if>" +
             "<if test=\"username != null\">, username=#{username}</if>" +
             "WHERE id=#{id}" +
             " </script>"})
     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);
 
-    @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 = {
-            @Result(column = "roleID", property = "role.id"),
-            @Result(column = "roleName", property = "role.name"),
-            @Result(column = "roleAuthority", property = "role.authority"),
-            @Result(column = "roleCreateTime", property = "role.createTime"),
-            @Result(column = "roleUpdateTime", property = "role.updateTime")
+            @Result(column = "role_id", property = "role.id"),
+            @Result(column = "role_name", property = "role.name"),
+            @Result(column = "role_authority", property = "role.authority"),
+            @Result(column = "role_create_time", property = "role.createTime"),
+            @Result(column = "role_update_time", property = "role.updateTime")
     })
     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")
     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")
     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")
     List<User> selectAll();
 
-    @Select("select * from (select user.*, concat(concat(#{callId}, '_'), pushKey) as str1 from user) as u where md5(u.str1) = #{sign}")
-    List<User> checkPushAuthorityByCallIdAndSign(String callId, String sign);
-
-    @Select("select * from user where md5(pushKey) = #{sign}")
-    List<User> checkPushAuthorityByCallId(String sign);
-
-    @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")
+    @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")
     @ResultMap(value="roleMap")
     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);
 }

+ 1 - 1
src/main/java/com/genersoft/iot/vmp/storager/impl/RedisCatchStorageImpl.java

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

+ 33 - 11
src/main/java/com/genersoft/iot/vmp/storager/impl/VideoManagerStorageImpl.java

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

+ 9 - 1
src/main/java/com/genersoft/iot/vmp/vmanager/bean/ResourceBaceInfo.java

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

+ 12 - 12
src/main/java/com/genersoft/iot/vmp/vmanager/bean/ResourceInfo.java

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

+ 5 - 5
src/main/java/com/genersoft/iot/vmp/vmanager/server/ServerController.java

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

+ 3 - 3
src/main/java/com/genersoft/iot/vmp/web/gb28181/ApiDeviceController.java

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

+ 2 - 2
src/main/java/com/genersoft/iot/vmp/web/gb28181/ApiStreamController.java

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

+ 6 - 6
src/main/java/com/genersoft/iot/vmp/web/gb28181/dto/DeviceChannelExtend.java

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