瀏覽代碼

临时提交

648540858 1 年之前
父節點
當前提交
b843958ed7
共有 31 個文件被更改,包括 361 次插入302 次删除
  1. 1 1
      src/main/java/com/genersoft/iot/vmp/gb28181/bean/DeviceChannel.java
  2. 104 7
      src/main/java/com/genersoft/iot/vmp/gb28181/dao/DeviceChannelMapper.java
  3. 42 0
      src/main/java/com/genersoft/iot/vmp/gb28181/dao/DeviceMapper.java
  4. 3 2
      src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/InviteRequestProcessor.java
  5. 2 2
      src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/NotifyRequestForCatalogProcessor.java
  6. 3 2
      src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/info/InfoRequestProcessor.java
  7. 11 0
      src/main/java/com/genersoft/iot/vmp/service/IDeviceChannelService.java
  8. 5 0
      src/main/java/com/genersoft/iot/vmp/service/IDeviceService.java
  9. 46 3
      src/main/java/com/genersoft/iot/vmp/service/impl/DeviceChannelServiceImpl.java
  10. 16 5
      src/main/java/com/genersoft/iot/vmp/service/impl/DeviceServiceImpl.java
  11. 2 2
      src/main/java/com/genersoft/iot/vmp/service/impl/MediaServiceImpl.java
  12. 3 3
      src/main/java/com/genersoft/iot/vmp/service/impl/PlatformChannelServiceImpl.java
  13. 16 16
      src/main/java/com/genersoft/iot/vmp/service/impl/PlayServiceImpl.java
  14. 10 2
      src/main/java/com/genersoft/iot/vmp/service/redisMsg/RedisAlarmMsgListener.java
  15. 0 71
      src/main/java/com/genersoft/iot/vmp/storager/IVideoManagerStorage.java
  16. 1 110
      src/main/java/com/genersoft/iot/vmp/storager/impl/VideoManagerStorageImpl.java
  17. 3 0
      src/main/java/com/genersoft/iot/vmp/streamPush/service/impl/StreamPushServiceImpl.java
  18. 2 2
      src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/MobilePosition/MobilePositionController.java
  19. 5 1
      src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/alarm/AlarmController.java
  20. 6 2
      src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/device/DeviceConfig.java
  21. 10 10
      src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/device/DeviceControl.java
  22. 17 17
      src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/device/DeviceQuery.java
  23. 1 1
      src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/platform/PlatformController.java
  24. 9 3
      src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/play/PlayController.java
  25. 7 3
      src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/playback/PlaybackController.java
  26. 7 3
      src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/ptz/PtzController.java
  27. 1 1
      src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/record/GBRecordController.java
  28. 4 4
      src/main/java/com/genersoft/iot/vmp/web/gb28181/ApiControlController.java
  29. 9 5
      src/main/java/com/genersoft/iot/vmp/web/gb28181/ApiDeviceController.java
  30. 2 2
      src/main/java/com/genersoft/iot/vmp/web/gb28181/ApiStreamController.java
  31. 13 22
      web_src/src/components/channelList.vue

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

@@ -184,7 +184,7 @@ public class DeviceChannel extends CommonGBChannel {
 	private String  streamId;
 
 	@Schema(description = "是否含有音频")
-	private Boolean hasAudio;
+	private boolean hasAudio;
 
 	@Schema(description = "GPS的更新时间")
 	private String gpsTime;

+ 104 - 7
src/main/java/com/genersoft/iot/vmp/gb28181/dao/DeviceChannelMapper.java

@@ -162,13 +162,11 @@ public interface DeviceChannelMapper {
             " coalesce(dc.gb_svc_time_support_mode,dc.svc_time_support_mode) as svc_time_support_mode\n" +
             " from " +
             " wvp_device_channel dc " +
-            " left join wvp_device d on d.id=dc.device_db_id" +
             " WHERE " +
-            " d.device_id = #{deviceId} " +
+            " dc.device_db_id = #{deviceDbId} " +
             " <if test='query != null'> AND (" +
-            "dc.device_id LIKE concat('%',#{query},'%') " +
-            "OR dc.name LIKE concat('%',#{query},'%') " +
-            "OR dc.custom_name LIKE concat('%',#{query},'%')" +
+            "coalesce(dc.gb_device_id, dc.device_id) LIKE concat('%',#{query},'%') " +
+            "OR coalesce(dc.gb_name, 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>" +
@@ -180,7 +178,7 @@ public interface DeviceChannelMapper {
             "</foreach> </if>" +
             "ORDER BY dc.device_id " +
             " </script>"})
-    List<DeviceChannel> queryChannels(@Param("deviceId") String deviceId, @Param("parentChannelId") String parentChannelId, @Param("query") String query, @Param("hasSubChannel") Boolean hasSubChannel, @Param("online") Boolean online, @Param("channelIds") List<String> channelIds);
+    List<DeviceChannel> queryChannels(@Param("deviceDbId") int deviceDbId, @Param("parentChannelId") String parentChannelId, @Param("query") String query, @Param("hasSubChannel") Boolean hasSubChannel, @Param("online") Boolean online, @Param("channelIds") List<String> channelIds);
 
 
     @Select("select\n" +
@@ -607,7 +605,7 @@ public interface DeviceChannelMapper {
             " coalesce(gb_business_group_id, business_group_id) as business_group_id,\n" +
             " coalesce(gb_download_speed, download_speed) as download_speed,\n" +
             " coalesce(gb_svc_space_support_mod, svc_space_support_mod) as svc_space_support_mod,\n" +
-            " coalesce(gb_svc_time_support_mode svc_time_support_mode) as svc_time_support_mode\n" +
+            " coalesce(gb_svc_time_support_mode, svc_time_support_mode) as svc_time_support_mode\n" +
             "from wvp_device_channel " +
             "where device_db_id=#{deviceDbId}" +
             " <if test='parentId != null and parentId != deviceId'> and parent_id = #{parentId} </if>" +
@@ -636,4 +634,103 @@ public interface DeviceChannelMapper {
             "</script>"})
     void batchUpdatePosition(List<DeviceChannel> channelList);
 
+    @Select(value = {" <script>" +
+            "SELECT " +
+            " id,\n" +
+            " device_db_id,\n" +
+            " create_time,\n" +
+            " update_time,\n" +
+            " sub_count,\n" +
+            " stream_id,\n" +
+            " has_audio,\n" +
+            " gps_time,\n" +
+            " stream_identification,\n" +
+            " coalesce(gb_device_id, device_id) as device_id,\n" +
+            " coalesce(gb_name, name) as name,\n" +
+            " coalesce(gb_manufacturer, manufacturer) as manufacturer,\n" +
+            " coalesce(gb_model, model) as model,\n" +
+            " coalesce(gb_owner, owner) as owner,\n" +
+            " coalesce(gb_civil_code, civil_code) as civil_code,\n" +
+            " coalesce(gb_block, block) as block,\n" +
+            " coalesce(gb_address, address) as address,\n" +
+            " coalesce(gb_parental, parental) as parental,\n" +
+            " coalesce(gb_parent_id, parent_id) as parent_id,\n" +
+            " coalesce(gb_safety_way, safety_way) as safety_way,\n" +
+            " coalesce(gb_register_way, register_way) as register_way,\n" +
+            " coalesce(gb_cert_num, cert_num) as cert_num,\n" +
+            " coalesce(gb_certifiable, certifiable) as certifiable,\n" +
+            " coalesce(gb_err_code, err_code) as err_code,\n" +
+            " coalesce(gb_end_time, end_time) as end_time,\n" +
+            " coalesce(gb_secrecy, secrecy) as secrecy,\n" +
+            " coalesce(gb_ip_address, ip_address) as ip_address,\n" +
+            " coalesce(gb_port, port) as port,\n" +
+            " coalesce(gb_password, password) as password,\n" +
+            " coalesce(gb_status, status) as status,\n" +
+            " coalesce(gb_longitude, longitude) as longitude,\n" +
+            " coalesce(gb_latitude, latitude) as latitude,\n" +
+            " coalesce(gb_ptz_type, ptz_type) as ptz_type,\n" +
+            " coalesce(gb_position_type, position_type) as position_type,\n" +
+            " coalesce(gb_room_type, room_type) as room_type,\n" +
+            " coalesce(gb_use_type, use_type) as use_type,\n" +
+            " coalesce(gb_supply_light_type, supply_light_type) as supply_light_type,\n" +
+            " coalesce(gb_direction_type, direction_type) as direction_type,\n" +
+            " coalesce(gb_resolution, resolution) as resolution,\n" +
+            " coalesce(gb_business_group_id, business_group_id) as business_group_id,\n" +
+            " coalesce(gb_download_speed, download_speed) as download_speed,\n" +
+            " coalesce(gb_svc_space_support_mod, svc_space_support_mod) as svc_space_support_mod,\n" +
+            " coalesce(gb_svc_time_support_mode, svc_time_support_mode) as svc_time_support_mode\n" +
+            "from wvp_device_channel " +
+            "where id=#{id}" +
+            " </script>"})
+    DeviceChannel getOne(@Param("id") int id);
+
+    @Select(value = {" <script>" +
+            "SELECT " +
+            " id,\n" +
+            " device_db_id,\n" +
+            " create_time,\n" +
+            " update_time,\n" +
+            " sub_count,\n" +
+            " stream_id,\n" +
+            " has_audio,\n" +
+            " gps_time,\n" +
+            " stream_identification,\n" +
+            " coalesce(gb_device_id, device_id) as device_id,\n" +
+            " coalesce(gb_name, name) as name,\n" +
+            " coalesce(gb_manufacturer, manufacturer) as manufacturer,\n" +
+            " coalesce(gb_model, model) as model,\n" +
+            " coalesce(gb_owner, owner) as owner,\n" +
+            " coalesce(gb_civil_code, civil_code) as civil_code,\n" +
+            " coalesce(gb_block, block) as block,\n" +
+            " coalesce(gb_address, address) as address,\n" +
+            " coalesce(gb_parental, parental) as parental,\n" +
+            " coalesce(gb_parent_id, parent_id) as parent_id,\n" +
+            " coalesce(gb_safety_way, safety_way) as safety_way,\n" +
+            " coalesce(gb_register_way, register_way) as register_way,\n" +
+            " coalesce(gb_cert_num, cert_num) as cert_num,\n" +
+            " coalesce(gb_certifiable, certifiable) as certifiable,\n" +
+            " coalesce(gb_err_code, err_code) as err_code,\n" +
+            " coalesce(gb_end_time, end_time) as end_time,\n" +
+            " coalesce(gb_secrecy, secrecy) as secrecy,\n" +
+            " coalesce(gb_ip_address, ip_address) as ip_address,\n" +
+            " coalesce(gb_port, port) as port,\n" +
+            " coalesce(gb_password, password) as password,\n" +
+            " coalesce(gb_status, status) as status,\n" +
+            " coalesce(gb_longitude, longitude) as longitude,\n" +
+            " coalesce(gb_latitude, latitude) as latitude,\n" +
+            " coalesce(gb_ptz_type, ptz_type) as ptz_type,\n" +
+            " coalesce(gb_position_type, position_type) as position_type,\n" +
+            " coalesce(gb_room_type, room_type) as room_type,\n" +
+            " coalesce(gb_use_type, use_type) as use_type,\n" +
+            " coalesce(gb_supply_light_type, supply_light_type) as supply_light_type,\n" +
+            " coalesce(gb_direction_type, direction_type) as direction_type,\n" +
+            " coalesce(gb_resolution, resolution) as resolution,\n" +
+            " coalesce(gb_business_group_id, business_group_id) as business_group_id,\n" +
+            " coalesce(gb_download_speed, download_speed) as download_speed,\n" +
+            " coalesce(gb_svc_space_support_mod, svc_space_support_mod) as svc_space_support_mod,\n" +
+            " coalesce(gb_svc_time_support_mode, svc_time_support_mode) as svc_time_support_mode\n" +
+            "from wvp_device_channel " +
+            "where device_db_id=#{deviceDbId} and coalesce(gb_device_id, device_id) = #{channelId}" +
+            " </script>"})
+    DeviceChannel getOneByDeviceId(@Param("deviceDbId") int deviceDbId, @Param("channelId") String channelId);
 }

+ 42 - 0
src/main/java/com/genersoft/iot/vmp/gb28181/dao/DeviceMapper.java

@@ -1,6 +1,7 @@
 package com.genersoft.iot.vmp.gb28181.dao;
 
 import com.genersoft.iot.vmp.gb28181.bean.Device;
+import com.github.pagehelper.PageInfo;
 import org.apache.ibatis.annotations.*;
 import org.apache.ibatis.annotations.Param;
 import org.springframework.stereotype.Repository;
@@ -300,4 +301,45 @@ public interface DeviceMapper {
 
     @Select("select * FROM wvp_device where  as_message_channel = true")
     List<Device> queryDeviceWithAsMessageChannel();
+
+    @Select(" <script>" +
+            "SELECT " +
+            "id, " +
+            "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,"+
+            "broadcast_push_after_ack,"+
+            "geo_coord_sys,"+
+            "on_line,"+
+            "media_server_id,"+
+            "(SELECT count(0) FROM wvp_device_channel dc WHERE dc.device_db_id= de.id) as channel_count " +
+            " FROM wvp_device de" +
+            " where 1 = 1 "+
+            " <if test='status != null'> AND de.on_line=${status}</if>"+
+            " <if test='query != null'> AND coalesce(custom_name, name) as name LIKE '%${query}%'</if> " +
+            " order by create_time desc "+
+            " </script>")
+    List<Device> getDeviceList(@Param("query") String query, @Param("status") Boolean status);
 }

+ 3 - 2
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/InviteRequestProcessor.java

@@ -491,7 +491,7 @@ public class InviteRequestProcessor extends SIPRequestProcessorParent implements
                         String stream = device.getDeviceId() + "_" + channelId + "_" + startTimeStr + "_" + endTimeStr;
                         int tcpMode = device.getStreamMode().equals("TCP-ACTIVE")? 2: (device.getStreamMode().equals("TCP-PASSIVE")? 1:0);
                         SSRCInfo ssrcInfo = mediaServerService.openRTPServer(mediaServerItem, stream, null,
-                                device.isSsrcCheck(), true, 0,false,!channel.getHasAudio(), false, tcpMode);
+                                device.isSsrcCheck(), true, 0,false,!channel.isHasAudio(), false, tcpMode);
                         sendRtpItem.setStream(stream);
                         // 写入redis, 超时时回复
                         redisCatchStorage.updateSendRTPSever(sendRtpItem);
@@ -522,7 +522,8 @@ public class InviteRequestProcessor extends SIPRequestProcessorParent implements
 
                         sendRtpItem.setPlayType(InviteStreamType.DOWNLOAD);
                         int tcpMode = device.getStreamMode().equals("TCP-ACTIVE")? 2: (device.getStreamMode().equals("TCP-PASSIVE")? 1:0);
-                        SSRCInfo ssrcInfo = mediaServerService.openRTPServer(mediaServerItem, null, null, device.isSsrcCheck(), true, 0, false,!channel.getHasAudio(), false, tcpMode);
+                        SSRCInfo ssrcInfo = mediaServerService.openRTPServer(mediaServerItem, null, null,
+                                device.isSsrcCheck(), true, 0, false,!channel.isHasAudio(), false, tcpMode);
                         sendRtpItem.setStream(ssrcInfo.getStream());
                         // 写入redis, 超时时回复
                         redisCatchStorage.updateSendRTPSever(sendRtpItem);

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

@@ -182,7 +182,7 @@ public class NotifyRequestForCatalogProcessor extends SIPRequestProcessorParent
 									log.info("[增加通道] 已存在,不发送通知只更新,设备: {}, 通道 {}", device.getDeviceId(), catalogChannelEvent.getChannel().getDeviceId());
 									DeviceChannel channel = catalogChannelEvent.getChannel();
 									channel.setId(deviceChannel.getId());
-									channel.setHasAudio(deviceChannel.getHasAudio());
+									channel.setHasAudio(deviceChannel.isHasAudio());
 									channel.setUpdateTime(DateUtil.getNow());
 									updateChannelMap.put(catalogChannelEvent.getChannel().getDeviceId(), channel);
 								} else {
@@ -211,7 +211,7 @@ public class NotifyRequestForCatalogProcessor extends SIPRequestProcessorParent
 								if (deviceChannelForUpdate != null) {
 									DeviceChannel channel = catalogChannelEvent.getChannel();
 									channel.setId(deviceChannelForUpdate.getId());
-									channel.setHasAudio(deviceChannelForUpdate.getHasAudio());
+									channel.setHasAudio(deviceChannelForUpdate.isHasAudio());
 									channel.setUpdateTime(DateUtil.getNow());
 									updateChannelMap.put(catalogChannelEvent.getChannel().getDeviceId(), channel);
 								} else {

+ 3 - 2
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/info/InfoRequestProcessor.java

@@ -10,6 +10,7 @@ import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommander;
 import com.genersoft.iot.vmp.gb28181.transmit.event.request.ISIPRequestProcessor;
 import com.genersoft.iot.vmp.gb28181.transmit.event.request.SIPRequestProcessorParent;
 import com.genersoft.iot.vmp.gb28181.utils.SipUtils;
+import com.genersoft.iot.vmp.service.IDeviceService;
 import com.genersoft.iot.vmp.service.IInviteStreamService;
 import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
 import com.genersoft.iot.vmp.storager.IVideoManagerStorage;
@@ -49,7 +50,7 @@ public class InfoRequestProcessor extends SIPRequestProcessorParent implements I
     private IInviteStreamService inviteStreamService;
 
     @Autowired
-    private IVideoManagerStorage storager;
+    private IDeviceService deviceService;
 
     @Autowired
     private SIPCommander cmder;
@@ -113,7 +114,7 @@ public class InfoRequestProcessor extends SIPRequestProcessorParent implements I
                         responseAck(request, Response.NOT_FOUND, "stream " + streamId + " not found");
                         return;
                     }
-                    Device device1 = storager.queryVideoDevice(inviteInfo.getDeviceId());
+                    Device device1 = deviceService.getDevice(inviteInfo.getDeviceId());
                     if (inviteInfo.getStreamInfo() != null) {
                         cmder.playbackControlCmd(device1,inviteInfo.getStreamInfo(),new String(evt.getRequest().getRawContent()),eventResult -> {
                             // 失败的回复

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

@@ -5,6 +5,8 @@ import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel;
 import com.genersoft.iot.vmp.gb28181.bean.MobilePosition;
 import com.genersoft.iot.vmp.vmanager.bean.ResourceBaseInfo;
 import com.genersoft.iot.vmp.vmanager.gb28181.platform.bean.ChannelReduce;
+import com.genersoft.iot.vmp.web.gb28181.dto.DeviceChannelExtend;
+import com.github.pagehelper.PageInfo;
 
 import java.util.List;
 
@@ -40,6 +42,8 @@ public interface IDeviceChannelService {
      */
     List<ChannelReduce> queryAllChannelList(String platformId);
 
+    PageInfo<ChannelReduce> queryAllChannelList(int page, int count, String query, Boolean online, Boolean channelType, String platformId, String catalogId);
+
     /**
      * 查询通道所属的设备
      */
@@ -103,5 +107,12 @@ public interface IDeviceChannelService {
 
     boolean resetChannels(String deviceId, List<DeviceChannel> deviceChannels);
 
+    PageInfo<DeviceChannel> getSubChannels(int deviceDbId, String channelId, String query, Boolean channelType, Boolean online, int page, int count);
+
+    List<DeviceChannelExtend> queryChannelExtendsByDeviceId(String deviceId, List<String> channelIds, Boolean online);
+
+    PageInfo<DeviceChannel> queryChannelsByDeviceId(String deviceId, String query, Boolean channelType, Boolean online, int page, int count);
+
 
+    List<Device> queryDeviceWithAsMessageChannel();
 }

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

@@ -6,6 +6,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.ResourceBaseInfo;
+import com.github.pagehelper.PageInfo;
 
 import java.util.List;
 
@@ -88,6 +89,8 @@ public interface IDeviceService {
      */
     List<Device> getAllOnlineDevice();
 
+    List<Device> getAllByStatus(boolean status);
+
     /**
      * 判断是否注册已经失效
      * @param device 设备信息
@@ -159,4 +162,6 @@ public interface IDeviceService {
      * 获取所有设备
      */
     List<Device> getAll();
+
+    PageInfo<Device> getAll(int page, int count, String query, Boolean status);
 }

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

@@ -22,6 +22,9 @@ import com.genersoft.iot.vmp.utils.DateUtil;
 import com.genersoft.iot.vmp.vmanager.bean.ErrorCode;
 import com.genersoft.iot.vmp.vmanager.bean.ResourceBaseInfo;
 import com.genersoft.iot.vmp.vmanager.gb28181.platform.bean.ChannelReduce;
+import com.genersoft.iot.vmp.web.gb28181.dto.DeviceChannelExtend;
+import com.github.pagehelper.PageHelper;
+import com.github.pagehelper.PageInfo;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -74,7 +77,7 @@ public class DeviceChannelServiceImpl implements IDeviceChannelService {
         }
         String now = DateUtil.getNow();
         channel.setUpdateTime(now);
-        DeviceChannel deviceChannel = channelMapper.queryChannel(deviceId, channelId);
+        DeviceChannel deviceChannel = getOne(deviceId, channelId);
         if (deviceChannel == null) {
             channel.setCreateTime(now);
             channelMapper.add(channel);
@@ -170,6 +173,13 @@ public class DeviceChannelServiceImpl implements IDeviceChannelService {
         return channelMapper.queryChannelListInAll(null, null, null, platformId, null);
     }
 
+    @Override
+    public PageInfo<ChannelReduce> queryAllChannelList(int page, int count, String query, Boolean online, Boolean channelType, String platformId, String catalogId) {
+        PageHelper.startPage(page, count);
+        List<ChannelReduce> all = channelMapper.queryChannelListInAll(query, online, channelType, platformId, catalogId);
+        return new PageInfo<>(all);
+    }
+
     @Override
     public List<Device> getDeviceByChannelId(String channelId) {
 
@@ -209,7 +219,11 @@ public class DeviceChannelServiceImpl implements IDeviceChannelService {
 
     @Override
     public DeviceChannel getOne(String deviceId, String channelId){
-        return channelMapper.queryChannel(deviceId, channelId);
+        Device device = deviceMapper.getDeviceByDeviceId(deviceId);
+        if (device == null) {
+            throw new ControllerException(ErrorCode.ERROR100.getCode(), "未找到设备:" + deviceId);
+        }
+        return channelMapper.getOneByDeviceId(device.getId(), channelId);
     }
 
     @Override
@@ -424,7 +438,7 @@ public class DeviceChannelServiceImpl implements IDeviceChannelService {
             DeviceChannel channelInDb = allChannelMap.get(deviceChannel.getDeviceDbId() + deviceChannel.getDeviceId());
             if (channelInDb != null) {
                 deviceChannel.setStreamId(channelInDb.getStreamId());
-                deviceChannel.setHasAudio(channelInDb.getHasAudio());
+                deviceChannel.setHasAudio(channelInDb.isHasAudio());
                 deviceChannel.setId(channelInDb.getId());
                 if (channelInDb.getStatus().equalsIgnoreCase(deviceChannel.getStatus())){
                     List<String> strings = platformChannelMapper.queryParentPlatformByChannelId(deviceChannel.getDeviceId());
@@ -518,4 +532,33 @@ public class DeviceChannelServiceImpl implements IDeviceChannelService {
         return true;
 
     }
+
+    @Override
+    public PageInfo<DeviceChannel> getSubChannels(int deviceDbId, String channelId, String query, Boolean channelType, Boolean online, int page, int count) {
+        PageHelper.startPage(page, count);
+        List<DeviceChannel> all = channelMapper.queryChannels(deviceDbId, channelId, query, channelType, online,null);
+        return new PageInfo<>(all);
+    }
+
+    @Override
+    public List<DeviceChannelExtend> queryChannelExtendsByDeviceId(String deviceId, List<String> channelIds, Boolean online) {
+        return channelMapper.queryChannelsWithDeviceInfo(deviceId, null,null, null, online,channelIds);
+    }
+
+    @Override
+    public PageInfo queryChannelsByDeviceId(String deviceId, String query, Boolean hasSubChannel, Boolean online, int page, int count) {
+        Device device = deviceMapper.getDeviceByDeviceId(deviceId);
+        if (device == null) {
+            throw new ControllerException(ErrorCode.ERROR100.getCode(), "未找到设备:" + deviceId);
+        }
+        // 获取到所有正在播放的流
+        PageHelper.startPage(page, count);
+        List<DeviceChannel> all = channelMapper.queryChannels(device.getId(), null, query, hasSubChannel, online,null);
+        return new PageInfo<>(all);
+    }
+
+    @Override
+    public List<Device> queryDeviceWithAsMessageChannel() {
+        return deviceMapper.queryDeviceWithAsMessageChannel();
+    }
 }

+ 16 - 5
src/main/java/com/genersoft/iot/vmp/service/impl/DeviceServiceImpl.java

@@ -7,6 +7,9 @@ import com.genersoft.iot.vmp.conf.DynamicTask;
 import com.genersoft.iot.vmp.conf.UserSetting;
 import com.genersoft.iot.vmp.conf.exception.ControllerException;
 import com.genersoft.iot.vmp.gb28181.bean.*;
+import com.genersoft.iot.vmp.gb28181.dao.DeviceChannelMapper;
+import com.genersoft.iot.vmp.gb28181.dao.DeviceMapper;
+import com.genersoft.iot.vmp.gb28181.dao.PlatformChannelMapper;
 import com.genersoft.iot.vmp.gb28181.session.AudioBroadcastManager;
 import com.genersoft.iot.vmp.gb28181.session.VideoStreamSessionManager;
 import com.genersoft.iot.vmp.gb28181.task.ISubscribeTask;
@@ -21,12 +24,11 @@ import com.genersoft.iot.vmp.service.IDeviceChannelService;
 import com.genersoft.iot.vmp.service.IDeviceService;
 import com.genersoft.iot.vmp.service.IInviteStreamService;
 import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
-import com.genersoft.iot.vmp.gb28181.dao.DeviceChannelMapper;
-import com.genersoft.iot.vmp.gb28181.dao.DeviceMapper;
-import com.genersoft.iot.vmp.gb28181.dao.PlatformChannelMapper;
 import com.genersoft.iot.vmp.utils.DateUtil;
 import com.genersoft.iot.vmp.vmanager.bean.ErrorCode;
 import com.genersoft.iot.vmp.vmanager.bean.ResourceBaseInfo;
+import com.github.pagehelper.PageHelper;
+import com.github.pagehelper.PageInfo;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.jdbc.datasource.DataSourceTransactionManager;
@@ -39,7 +41,6 @@ import javax.sip.InvalidArgumentException;
 import javax.sip.SipException;
 import java.text.ParseException;
 import java.time.Instant;
-import java.util.ArrayList;
 import java.util.List;
 import java.util.concurrent.TimeUnit;
 
@@ -366,6 +367,11 @@ public class DeviceServiceImpl implements IDeviceService {
         return deviceMapper.getOnlineDevices();
     }
 
+    @Override
+    public List<Device> getAllByStatus(boolean status) {
+        return deviceMapper.getDevices(status);
+    }
+
     @Override
     public boolean expire(Device device) {
         Instant registerTimeDate = Instant.from(DateUtil.formatter.parse(device.getRegisterTime()));
@@ -568,5 +574,10 @@ public class DeviceServiceImpl implements IDeviceService {
         return deviceMapper.getAll();
     }
 
-
+    @Override
+    public PageInfo<Device> getAll(int page, int count, String query, Boolean status) {
+        PageHelper.startPage(page, count);
+        List<Device> all = deviceMapper.getDeviceList(query, status);
+        return new PageInfo<>(all);
+    }
 }

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

@@ -170,9 +170,9 @@ public class MediaServiceImpl implements IMediaService {
 
                 String deviceId = ssrcTransactionForAll.get(0).getDeviceId();
                 String channelId = ssrcTransactionForAll.get(0).getChannelId();
-                DeviceChannel deviceChannel = storager.queryChannel(deviceId, channelId);
+                DeviceChannel deviceChannel = deviceChannelService.getOne(deviceId, channelId);
                 if (deviceChannel != null) {
-                    result.setEnable_audio(deviceChannel.getHasAudio());
+                    result.setEnable_audio(deviceChannel.isHasAudio());
                 }
                 // 如果是录像下载就设置视频间隔十秒
                 if (ssrcTransactionForAll.get(0).getType() == InviteSessionType.DOWNLOAD) {

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

@@ -124,11 +124,11 @@ public class PlatformChannelServiceImpl implements IPlatformChannelService {
 
     private List<CommonGBChannel> getDeviceChannelListByChannelReduceList(List<ChannelReduce> channelReduces, String catalogId, ParentPlatform platform) {
         List<CommonGBChannel> deviceChannelList = new ArrayList<>();
-        if (channelReduces.size() > 0){
+        if (!channelReduces.isEmpty()){
             PlatformCatalog catalog = catalogManager.selectByPlatFormAndCatalogId(platform.getServerGBId(),catalogId);
             if (catalog == null && catalogId.equals(platform.getDeviceGBId())) {
                 for (ChannelReduce channelReduce : channelReduces) {
-                    DeviceChannel deviceChannel = deviceChannelMapper.queryChannel(channelReduce.getDeviceId(), channelReduce.getChannelId());
+                    DeviceChannel deviceChannel = deviceChannelMapper.getOne(channelReduce.getId());
                     deviceChannel.setParental(0);
                     deviceChannel.setCivilCode(platform.getServerGBDomain());
                     deviceChannelList.add(deviceChannel);
@@ -139,7 +139,7 @@ public class PlatformChannelServiceImpl implements IPlatformChannelService {
                 return null;
             }
             for (ChannelReduce channelReduce : channelReduces) {
-                DeviceChannel deviceChannel = deviceChannelMapper.queryChannel(channelReduce.getDeviceId(), channelReduce.getChannelId());
+                DeviceChannel deviceChannel = deviceChannelMapper.getOne(channelReduce.getId());
                 deviceChannel.setParental(0);
                 deviceChannel.setCivilCode(catalog.getCivilCode());
                 deviceChannel.setParentId(catalog.getParentId());

+ 16 - 16
src/main/java/com/genersoft/iot/vmp/service/impl/PlayServiceImpl.java

@@ -234,7 +234,7 @@ public class PlayServiceImpl implements IPlayService {
         if (device == null || !device.isOnLine()) {
             return;
         }
-        DeviceChannel deviceChannel = storager.queryChannel(deviceId, channelId);
+        DeviceChannel deviceChannel = channelService.getOne(deviceId, channelId);
         if (deviceChannel == null) {
             return;
         }
@@ -258,7 +258,7 @@ public class PlayServiceImpl implements IPlayService {
 
             int tcpMode = device.getStreamMode().equals("TCP-ACTIVE")? 2: (device.getStreamMode().equals("TCP-PASSIVE")? 1:0);
             SSRCInfo ssrcInfo = mediaServerService.openRTPServer(event.getMediaServer(), event.getStream(), null,
-                    device.isSsrcCheck(), true, 0, false, !deviceChannel.getHasAudio(), false, tcpMode);
+                    device.isSsrcCheck(), true, 0, false, !deviceChannel.isHasAudio(), false, tcpMode);
             playBack(event.getMediaServer(), ssrcInfo, deviceId, channelId, startTime, endTime, null);
         }
     }
@@ -321,7 +321,7 @@ public class PlayServiceImpl implements IPlayService {
         }
         String streamId = String.format("%s_%s", device.getDeviceId(), channelId);
         int tcpMode = device.getStreamMode().equals("TCP-ACTIVE")? 2: (device.getStreamMode().equals("TCP-PASSIVE")? 1:0);
-        SSRCInfo ssrcInfo = mediaServerService.openRTPServer(mediaServerItem, streamId, ssrc, device.isSsrcCheck(),  false, 0, false, !channel.getHasAudio(), false, tcpMode);
+        SSRCInfo ssrcInfo = mediaServerService.openRTPServer(mediaServerItem, streamId, ssrc, device.isSsrcCheck(),  false, 0, false, !channel.isHasAudio(), false, tcpMode);
         if (ssrcInfo == null) {
             callback.run(InviteErrorCode.ERROR_FOR_RESOURCE_EXHAUSTION.getCode(), InviteErrorCode.ERROR_FOR_RESOURCE_EXHAUSTION.getMsg(), null);
             inviteStreamService.call(InviteSessionType.PLAY, device.getDeviceId(), channelId, null,
@@ -695,7 +695,7 @@ public class PlayServiceImpl implements IPlayService {
         Device device = redisCatchStorage.getDevice(deviceId);
         streamInfo = onPublishHandler(mediaServerItem, mediaInfo, deviceId, channelId);
         if (streamInfo != null) {
-            DeviceChannel deviceChannel = storager.queryChannel(deviceId, channelId);
+            DeviceChannel deviceChannel = channelService.getOne(deviceId, channelId);
             if (deviceChannel != null) {
                 deviceChannel.setStreamId(streamInfo.getStream());
                 channelService.startPlay(deviceId, channelId, streamInfo.getStream());
@@ -716,7 +716,7 @@ public class PlayServiceImpl implements IPlayService {
         if (streamInfo != null) {
             streamInfo.setStartTime(startTime);
             streamInfo.setEndTime(endTime);
-            DeviceChannel deviceChannel = storager.queryChannel(deviceId, channelId);
+            DeviceChannel deviceChannel = channelService.getOne(deviceId, channelId);
             if (deviceChannel != null) {
                 deviceChannel.setStreamId(streamInfo.getStream());
                 channelService.startPlay(deviceId, channelId, streamInfo.getStream());
@@ -753,7 +753,7 @@ public class PlayServiceImpl implements IPlayService {
     @Override
     public void playBack(String deviceId, String channelId, String startTime,
                          String endTime, ErrorCallback<Object> callback) {
-        Device device = storager.queryVideoDevice(deviceId);
+        Device device = deviceService.getDevice(deviceId);
         if (device == null) {
             log.warn("[录像回放] 未找到设备 deviceId: {},channelId:{}", deviceId, channelId);
             throw new ControllerException(ErrorCode.ERROR100.getCode(), "未找到设备:" + deviceId);
@@ -778,7 +778,7 @@ public class PlayServiceImpl implements IPlayService {
                 .replace(" ", "");
         String stream = deviceId + "_" + channelId + "_" + startTimeStr + "_" + endTimeTimeStr;
         int tcpMode = device.getStreamMode().equals("TCP-ACTIVE")? 2: (device.getStreamMode().equals("TCP-PASSIVE")? 1:0);
-        SSRCInfo ssrcInfo = mediaServerService.openRTPServer(newMediaServerItem, stream, null, device.isSsrcCheck(),  true, 0, false,  !channel.getHasAudio(),  false, tcpMode);
+        SSRCInfo ssrcInfo = mediaServerService.openRTPServer(newMediaServerItem, stream, null, device.isSsrcCheck(),  true, 0, false,  !channel.isHasAudio(),  false, tcpMode);
         playBack(newMediaServerItem, ssrcInfo, deviceId, channelId, startTime, endTime, callback);
     }
 
@@ -793,7 +793,7 @@ public class PlayServiceImpl implements IPlayService {
             return;
         }
 
-        Device device = storager.queryVideoDevice(deviceId);
+        Device device = deviceService.getDevice(deviceId);
         if (device == null) {
             throw new ControllerException(ErrorCode.ERROR100.getCode(), "设备: " + deviceId + "不存在");
         }
@@ -959,7 +959,7 @@ public class PlayServiceImpl implements IPlayService {
 
     @Override
     public void download(String deviceId, String channelId, String startTime, String endTime, int downloadSpeed, ErrorCallback<Object> callback) {
-        Device device = storager.queryVideoDevice(deviceId);
+        Device device = deviceService.getDevice(deviceId);
         if (device == null) {
             return;
         }
@@ -976,7 +976,7 @@ public class PlayServiceImpl implements IPlayService {
         }
         int tcpMode = device.getStreamMode().equals("TCP-ACTIVE")? 2: (device.getStreamMode().equals("TCP-PASSIVE")? 1:0);
         // 录像下载不使用固定流地址,固定流地址会导致如果开始时间与结束时间一致时文件错误的叠加在一起
-        SSRCInfo ssrcInfo = mediaServerService.openRTPServer(newMediaServerItem, null, null, device.isSsrcCheck(),  true, 0, false,!channel.getHasAudio(), false, tcpMode);
+        SSRCInfo ssrcInfo = mediaServerService.openRTPServer(newMediaServerItem, null, null, device.isSsrcCheck(),  true, 0, false,!channel.isHasAudio(), false, tcpMode);
         download(newMediaServerItem, ssrcInfo, deviceId, channelId, startTime, endTime, downloadSpeed, callback);
     }
 
@@ -989,7 +989,7 @@ public class PlayServiceImpl implements IPlayService {
                     null);
             return;
         }
-        Device device = storager.queryVideoDevice(deviceId);
+        Device device = deviceService.getDevice(deviceId);
         if (device == null) {
             callback.run(InviteErrorCode.ERROR_FOR_PARAMETER_ERROR.getCode(),
                     "设备:" + deviceId + "不存在",
@@ -1198,7 +1198,7 @@ public class PlayServiceImpl implements IPlayService {
             return null;
         }
         log.info("[语音喊话] device: {}, channel: {}", device.getDeviceId(), channelId);
-        DeviceChannel deviceChannel = storager.queryChannel(device.getDeviceId(), channelId);
+        DeviceChannel deviceChannel = channelService.getOne(device.getDeviceId(), channelId);
         if (deviceChannel == null) {
             log.warn("开启语音广播的时候未找到通道: {}", channelId);
             return null;
@@ -1223,7 +1223,7 @@ public class PlayServiceImpl implements IPlayService {
             return false;
         }
         log.info("[语音喊话] device: {}, channel: {}", device.getDeviceId(), channelId);
-        DeviceChannel deviceChannel = storager.queryChannel(device.getDeviceId(), channelId);
+        DeviceChannel deviceChannel = channelService.getOne(device.getDeviceId(), channelId);
         if (deviceChannel == null) {
             log.warn("开启语音广播的时候未找到通道: {}", channelId);
             event.call("开启语音广播的时候未找到通道");
@@ -1396,7 +1396,7 @@ public class PlayServiceImpl implements IPlayService {
         if (!result) {
             throw new ServiceException("暂停RTP接收失败");
         }
-        Device device = storager.queryVideoDevice(inviteInfo.getDeviceId());
+        Device device = deviceService.getDevice(inviteInfo.getDeviceId());
         cmder.playPauseCmd(device, inviteInfo.getStreamInfo());
     }
 
@@ -1424,7 +1424,7 @@ public class PlayServiceImpl implements IPlayService {
         if (!result) {
             throw new ServiceException("继续RTP接收失败");
         }
-        Device device = storager.queryVideoDevice(inviteInfo.getDeviceId());
+        Device device = deviceService.getDevice(inviteInfo.getDeviceId());
         cmder.playResumeCmd(device, inviteInfo.getStreamInfo());
     }
 
@@ -1486,7 +1486,7 @@ public class PlayServiceImpl implements IPlayService {
         }
         // TODO 必须多端口模式才支持语音喊话鹤语音对讲
         log.info("[语音对讲] device: {}, channel: {}", device.getDeviceId(), channelId);
-        DeviceChannel deviceChannel = storager.queryChannel(device.getDeviceId(), channelId);
+        DeviceChannel deviceChannel = channelService.getOne(device.getDeviceId(), channelId);
         if (deviceChannel == null) {
             log.warn("开启语音对讲的时候未找到通道: {}", channelId);
             event.call("开启语音对讲的时候未找到通道");

+ 10 - 2
src/main/java/com/genersoft/iot/vmp/service/redisMsg/RedisAlarmMsgListener.java

@@ -8,6 +8,8 @@ import com.genersoft.iot.vmp.gb28181.bean.DeviceAlarm;
 import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform;
 import com.genersoft.iot.vmp.gb28181.transmit.cmd.ISIPCommander;
 import com.genersoft.iot.vmp.gb28181.transmit.cmd.ISIPCommanderForPlatform;
+import com.genersoft.iot.vmp.service.IDeviceChannelService;
+import com.genersoft.iot.vmp.service.IDeviceService;
 import com.genersoft.iot.vmp.storager.IVideoManagerStorage;
 import com.genersoft.iot.vmp.utils.DateUtil;
 import lombok.extern.slf4j.Slf4j;
@@ -36,6 +38,12 @@ public class RedisAlarmMsgListener implements MessageListener {
     @Autowired
     private ISIPCommanderForPlatform commanderForPlatform;
 
+    @Autowired
+    private IDeviceService deviceService;
+
+    @Autowired
+    private IDeviceChannelService channelService;
+
     @Autowired
     private IVideoManagerStorage storage;
 
@@ -108,7 +116,7 @@ public class RedisAlarmMsgListener implements MessageListener {
 
                             }
                             // 获取开启了消息推送的设备和平台
-                            List<Device> devices = storage.queryDeviceWithAsMessageChannel();
+                            List<Device> devices = channelService.queryDeviceWithAsMessageChannel();
                             if (devices.size() > 0) {
                                 for (Device device : devices) {
                                     try {
@@ -121,7 +129,7 @@ public class RedisAlarmMsgListener implements MessageListener {
                             }
 
                         }else {
-                            Device device = storage.queryVideoDevice(gbId);
+                            Device device = deviceService.getDevice(gbId);
                             ParentPlatform platform = storage.queryParentPlatByServerGBId(gbId);
                             if (device != null && platform == null) {
                                 try {

+ 0 - 71
src/main/java/com/genersoft/iot/vmp/storager/IVideoManagerStorage.java

@@ -4,8 +4,6 @@ import com.genersoft.iot.vmp.gb28181.bean.*;
 import com.genersoft.iot.vmp.service.bean.GPSMsgInfo;
 import com.genersoft.iot.vmp.storager.dao.dto.ChannelSourceInfo;
 import com.genersoft.iot.vmp.vmanager.gb28181.platform.bean.ChannelReduce;
-import com.genersoft.iot.vmp.web.gb28181.dto.DeviceChannelExtend;
-import com.github.pagehelper.PageInfo;
 
 import java.util.List;
 
@@ -17,66 +15,6 @@ import java.util.List;
 @SuppressWarnings("rawtypes")
 public interface IVideoManagerStorage {
 
-	/**   
-	 * 根据设备ID判断设备是否存在
-	 * 
-	 * @param deviceId 设备ID
-	 * @return true:存在  false:不存在
-	 */
-	public boolean exists(String deviceId);
-	
-	/**   
-	 * 获取设备
-	 * 
-	 * @param deviceId 设备ID
-	 * @return DShadow 设备对象
-	 */
-	public Device queryVideoDevice(String deviceId);
-
-	/**
-	 * 获取某个设备的通道列表
-	 *
-	 * @param deviceId 设备ID
-	 * @param page 分页 当前页
-	 * @param count 每页数量
-	 * @return
-	 */
-	public PageInfo<DeviceChannel> queryChannelsByDeviceId(String deviceId, String query, Boolean hasSubChannel, Boolean online, Boolean catalogUnderDevice, int page, int count);
-
-	/**
-	 * 获取某个设备的通道
-	 * @param deviceId 设备ID
-	 * @param channelId 通道ID
-	 */
-	public DeviceChannel queryChannel(String deviceId, String channelId);
-
-	/**
-	 * 获取多个设备
-	 * @param page 当前页数
-	 * @param count 每页数量
-	 * @return List<Device> 设备对象数组
-	 */
-	public PageInfo<Device> queryVideoDeviceList(int page, int count,Boolean online);
-
-	/**
-	 * 获取多个设备
-	 *
-	 * @return List<Device> 设备对象数组
-	 */
-	public List<Device> queryVideoDeviceList(Boolean online);
-
-
-
-	/**
-	 * 查询子设备
-	 *
-	 * @param deviceId
-	 * @param channelId
-	 * @param page
-	 * @param count
-	 * @return
-	 */
-	PageInfo querySubChannels(String deviceId, String channelId, String query, Boolean hasSubChannel, Boolean online, int page, int count);
 
 	/**
 	 * 更新上级平台
@@ -103,12 +41,6 @@ public interface IVideoManagerStorage {
 	 */
 	ParentPlatform queryParentPlatByServerGBId(String platformGbId);
 
-	/**
-	 * 查询通道信息,不区分设备(已关联平台或全部)
-	 */
-	PageInfo<ChannelReduce> queryAllChannelList(int page, int count, String query, Boolean online, Boolean channelType, String platformId, String catalogId);
-
-
 	/**
 	 *  移除上级平台的通道信息
 	 * @param platformId
@@ -191,9 +123,6 @@ public interface IVideoManagerStorage {
 
 	List<ChannelSourceInfo> getChannelSource(String platformId, String gbId);
 
-	List<DeviceChannelExtend> queryChannelsByDeviceId(String serial, List<String> channelIds, Boolean online);
-
 	List<ParentPlatform> queryEnablePlatformListWithAsMessageChannel();
 
-	List<Device> queryDeviceWithAsMessageChannel();
 }

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

@@ -2,7 +2,6 @@ package com.genersoft.iot.vmp.storager.impl;
 
 import com.baomidou.dynamic.datasource.annotation.DS;
 import com.genersoft.iot.vmp.conf.SipConfig;
-import com.genersoft.iot.vmp.conf.UserSetting;
 import com.genersoft.iot.vmp.gb28181.bean.*;
 import com.genersoft.iot.vmp.gb28181.dao.*;
 import com.genersoft.iot.vmp.gb28181.event.EventPublisher;
@@ -10,15 +9,10 @@ import com.genersoft.iot.vmp.gb28181.event.subscribe.catalog.CatalogEvent;
 import com.genersoft.iot.vmp.service.bean.GPSMsgInfo;
 import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
 import com.genersoft.iot.vmp.storager.IVideoManagerStorage;
-import com.genersoft.iot.vmp.storager.dao.*;
+import com.genersoft.iot.vmp.storager.dao.GbStreamMapper;
 import com.genersoft.iot.vmp.storager.dao.dto.ChannelSourceInfo;
-import com.genersoft.iot.vmp.streamProxy.dao.StreamProxyMapper;
-import com.genersoft.iot.vmp.streamPush.dao.StreamPushMapper;
 import com.genersoft.iot.vmp.utils.DateUtil;
 import com.genersoft.iot.vmp.vmanager.gb28181.platform.bean.ChannelReduce;
-import com.genersoft.iot.vmp.web.gb28181.dto.DeviceChannelExtend;
-import com.github.pagehelper.PageHelper;
-import com.github.pagehelper.PageInfo;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.jdbc.datasource.DataSourceTransactionManager;
@@ -74,106 +68,16 @@ public class VideoManagerStorageImpl implements IVideoManagerStorage {
 	@Autowired
 	private PlatformCatalogMapper platformCatalogMapper;
 
-	@Autowired
-    private StreamProxyMapper streamProxyMapper;
-
-	@Autowired
-    private StreamPushMapper streamPushMapper;
-
 	@Autowired
     private GbStreamMapper gbStreamMapper;
 
-	@Autowired
-    private UserSetting userSetting;
-
 	@Autowired
     private PlatformCatalogMapper catalogMapper;
 
 	@Autowired
     private PlatformGbStreamMapper platformGbStreamMapper;
 
-	/**
-	 * 根据设备ID判断设备是否存在
-	 *
-	 * @param deviceId 设备ID
-	 * @return true:存在  false:不存在
-	 */
-	@Override
-	public boolean exists(String deviceId) {
-		return deviceMapper.getDeviceByDeviceId(deviceId) != null;
-	}
-
-
-	/**
-	 * 获取设备
-	 *
-	 * @param deviceId 设备ID
-	 * @return Device 设备对象
-	 */
-	@Override
-	public Device queryVideoDevice(String deviceId) {
-		return deviceMapper.getDeviceByDeviceId(deviceId);
-	}
 
-	@Override
-	public PageInfo queryChannelsByDeviceId(String deviceId, String query, Boolean hasSubChannel, Boolean online, Boolean catalogUnderDevice, int page, int count) {
-		// 获取到所有正在播放的流
-		PageHelper.startPage(page, count);
-		List<DeviceChannel> all;
-		if (catalogUnderDevice != null && catalogUnderDevice) {
-			all = deviceChannelMapper.queryChannels(deviceId, deviceId, query, hasSubChannel, online,null);
-			// 海康设备的parentId是SIP id
-			List<DeviceChannel> deviceChannels = deviceChannelMapper.queryChannels(deviceId, sipConfig.getId(), query, hasSubChannel, online,null);
-			all.addAll(deviceChannels);
-		}else {
-			all = deviceChannelMapper.queryChannels(deviceId, null, query, hasSubChannel, online,null);
-		}
-		return new PageInfo<>(all);
-	}
-
-	@Override
-	public List<DeviceChannelExtend> queryChannelsByDeviceId(String deviceId, List<String> channelIds, Boolean online) {
-		return deviceChannelMapper.queryChannelsWithDeviceInfo(deviceId, null,null, null, online,channelIds);
-	}
-
-	@Override
-	public PageInfo<DeviceChannel> querySubChannels(String deviceId, String parentChannelId, String query, Boolean hasSubChannel, Boolean online, int page, int count) {
-		PageHelper.startPage(page, count);
-		List<DeviceChannel> all = deviceChannelMapper.queryChannels(deviceId, parentChannelId, query, hasSubChannel, online,null);
-		return new PageInfo<>(all);
-	}
-
-	@Override
-	public DeviceChannel queryChannel(String deviceId, String channelId) {
-		return deviceChannelMapper.queryChannel(deviceId, channelId);
-	}
-
-
-	/**
-	 * 获取多个设备
-	 *
-	 * @param page 当前页数
-	 * @param count 每页数量
-	 * @return PageInfo<Device> 分页设备对象数组
-	 */
-	@Override
-	public PageInfo<Device> queryVideoDeviceList(int page, int count,Boolean online) {
-		PageHelper.startPage(page, count);
-		List<Device> all = deviceMapper.getDevices(online);
-		return new PageInfo<>(all);
-	}
-
-	/**
-	 * 获取多个设备
-	 *
-	 * @return List<Device> 设备对象数组
-	 */
-	@Override
-	public List<Device> queryVideoDeviceList(Boolean online) {
-
-		List<Device> deviceList =  deviceMapper.getDevices(online);
-		return deviceList;
-	}
 
 
 	/**
@@ -246,19 +150,6 @@ public class VideoManagerStorageImpl implements IVideoManagerStorage {
 		return platformMapper.queryEnablePlatformListWithAsMessageChannel();
 	}
 
-	@Override
-	public List<Device> queryDeviceWithAsMessageChannel() {
-		return deviceMapper.queryDeviceWithAsMessageChannel();
-	}
-
-
-	@Override
-	public PageInfo<ChannelReduce> queryAllChannelList(int page, int count, String query, Boolean online,
-													   Boolean channelType, String platformId, String catalogId) {
-		PageHelper.startPage(page, count);
-		List<ChannelReduce> all = deviceChannelMapper.queryChannelListInAll(query, online, channelType, platformId, catalogId);
-		return new PageInfo<>(all);
-	}
 
 
 	@Override

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

@@ -147,6 +147,9 @@ public class StreamPushServiceImpl implements IStreamPushService {
             }
         }
         StreamPush push = getPush(event.getApp(), event.getStream());
+        if (push == null) {
+            return;
+        }
         push.setPushIng(false);
         if (push.getGbDeviceId() != null) {
             if (userSetting.isUsePushingAsStatus()) {

+ 2 - 2
src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/MobilePosition/MobilePositionController.java

@@ -99,7 +99,7 @@ public class MobilePositionController {
     @Parameter(name = "deviceId", description = "设备国标编号", required = true)
     @GetMapping("/realtime/{deviceId}")
     public DeferredResult<MobilePosition> realTimePosition(@PathVariable String deviceId) {
-        Device device = storager.queryVideoDevice(deviceId);
+        Device device = deviceService.getDevice(deviceId);
         String uuid = UUID.randomUUID().toString();
         String key = DeferredResultHolder.CALLBACK_CMD_MOBILE_POSITION + deviceId;
         try {
@@ -147,7 +147,7 @@ public class MobilePositionController {
         if (StringUtil.isEmpty(interval)) {
             interval = "5";
         }
-        Device device = storager.queryVideoDevice(deviceId);
+        Device device = deviceService.getDevice(deviceId);
         device.setSubscribeCycleForMobilePosition(Integer.parseInt(expires));
         device.setMobilePositionSubmissionInterval(Integer.parseInt(interval));
         deviceService.updateCustomDevice(device);

+ 5 - 1
src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/alarm/AlarmController.java

@@ -8,6 +8,7 @@ import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform;
 import com.genersoft.iot.vmp.gb28181.transmit.cmd.ISIPCommander;
 import com.genersoft.iot.vmp.gb28181.transmit.cmd.ISIPCommanderForPlatform;
 import com.genersoft.iot.vmp.service.IDeviceAlarmService;
+import com.genersoft.iot.vmp.service.IDeviceService;
 import com.genersoft.iot.vmp.storager.IVideoManagerStorage;
 import com.genersoft.iot.vmp.utils.DateUtil;
 import com.genersoft.iot.vmp.vmanager.bean.ErrorCode;
@@ -45,6 +46,9 @@ public class AlarmController {
     @Autowired
     private IVideoManagerStorage storage;
 
+    @Autowired
+    private IDeviceService deviceService;
+
 
     /**
      *  删除报警
@@ -95,7 +99,7 @@ public class AlarmController {
     @Operation(summary = "测试向上级/设备发送模拟报警通知", security = @SecurityRequirement(name = JwtUtils.HEADER))
     @Parameter(name = "deviceId", description = "设备国标编号")
     public void delete(@RequestParam String deviceId) {
-        Device device = storage.queryVideoDevice(deviceId);
+        Device device = deviceService.getDevice(deviceId);
         ParentPlatform platform = storage.queryParentPlatByServerGBId(deviceId);
         DeviceAlarm deviceAlarm = new DeviceAlarm();
         deviceAlarm.setChannelId(deviceId);

+ 6 - 2
src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/device/DeviceConfig.java

@@ -14,6 +14,7 @@ import com.genersoft.iot.vmp.gb28181.bean.Device;
 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.cmd.impl.SIPCommander;
+import com.genersoft.iot.vmp.service.IDeviceService;
 import com.genersoft.iot.vmp.storager.IVideoManagerStorage;
 import com.genersoft.iot.vmp.vmanager.bean.ErrorCode;
 import io.swagger.v3.oas.annotations.Operation;
@@ -40,6 +41,9 @@ public class DeviceConfig {
     @Autowired
     private IVideoManagerStorage storager;
 
+    @Autowired
+    private IDeviceService deviceService;
+
     @Autowired
     private SIPCommander cmder;
 
@@ -73,7 +77,7 @@ public class DeviceConfig {
         if (log.isDebugEnabled()) {
 			log.debug("报警复位API调用");
 		}
-		Device device = storager.queryVideoDevice(deviceId);
+		Device device = deviceService.getDevice(deviceId);
 		String uuid = UUID.randomUUID().toString();
 		String key = DeferredResultHolder.CALLBACK_CMD_DEVICECONFIG + deviceId + channelId;
 		try {
@@ -126,7 +130,7 @@ public class DeviceConfig {
 		}
 		String key = DeferredResultHolder.CALLBACK_CMD_CONFIGDOWNLOAD + (ObjectUtils.isEmpty(channelId) ? deviceId : channelId);
 		String uuid = UUID.randomUUID().toString();
-		Device device = storager.queryVideoDevice(deviceId);
+		Device device = deviceService.getDevice(deviceId);
 		try {
 			cmder.deviceConfigQuery(device, channelId, configType, event -> {
 				RequestMessage msg = new RequestMessage();

+ 10 - 10
src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/device/DeviceControl.java

@@ -14,7 +14,7 @@ import com.genersoft.iot.vmp.gb28181.bean.Device;
 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.cmd.ISIPCommander;
-import com.genersoft.iot.vmp.storager.IVideoManagerStorage;
+import com.genersoft.iot.vmp.service.IDeviceService;
 import com.genersoft.iot.vmp.vmanager.bean.ErrorCode;
 import io.swagger.v3.oas.annotations.Operation;
 import io.swagger.v3.oas.annotations.Parameter;
@@ -39,7 +39,7 @@ import java.util.UUID;
 public class DeviceControl {
 
     @Autowired
-    private IVideoManagerStorage storager;
+    private IDeviceService deviceService;
 
     @Autowired
     private ISIPCommander cmder;
@@ -59,7 +59,7 @@ public class DeviceControl {
         if (log.isDebugEnabled()) {
             log.debug("设备远程启动API调用");
         }
-        Device device = storager.queryVideoDevice(deviceId);
+        Device device = deviceService.getDevice(deviceId);
 		try {
 			cmder.teleBootCmd(device);
 		} catch (InvalidArgumentException | SipException | ParseException e) {
@@ -85,7 +85,7 @@ public class DeviceControl {
         if (log.isDebugEnabled()) {
             log.debug("开始/停止录像API调用");
         }
-        Device device = storager.queryVideoDevice(deviceId);
+        Device device = deviceService.getDevice(deviceId);
 		String uuid = UUID.randomUUID().toString();
 		String key = DeferredResultHolder.CALLBACK_CMD_DEVICECONTROL +  deviceId + channelId;
 		DeferredResult<ResponseEntity<String>> result = new DeferredResult<ResponseEntity<String>>(3 * 1000L);
@@ -132,7 +132,7 @@ public class DeviceControl {
 		if (log.isDebugEnabled()) {
 			log.debug("布防/撤防API调用");
 		}
-		Device device = storager.queryVideoDevice(deviceId);
+		Device device = deviceService.getDevice(deviceId);
 		String key = DeferredResultHolder.CALLBACK_CMD_DEVICECONTROL + deviceId + deviceId;
 		String uuid =UUID.randomUUID().toString();
 		try {
@@ -181,7 +181,7 @@ public class DeviceControl {
 		if (log.isDebugEnabled()) {
 			log.debug("报警复位API调用");
 		}
-		Device device = storager.queryVideoDevice(deviceId);
+		Device device = deviceService.getDevice(deviceId);
 		String uuid = UUID.randomUUID().toString();
 		String key = DeferredResultHolder.CALLBACK_CMD_DEVICECONTROL + deviceId + channelId;
 		try {
@@ -225,7 +225,7 @@ public class DeviceControl {
 		if (log.isDebugEnabled()) {
 			log.debug("强制关键帧API调用");
 		}
-		Device device = storager.queryVideoDevice(deviceId);
+		Device device = deviceService.getDevice(deviceId);
 		try {
 			cmder.iFrameCmd(device, channelId);
 		} catch (InvalidArgumentException | SipException | ParseException e) {
@@ -263,7 +263,7 @@ public class DeviceControl {
 		}
 		String key = DeferredResultHolder.CALLBACK_CMD_DEVICECONTROL + (ObjectUtils.isEmpty(channelId) ? deviceId : channelId);
 		String uuid = UUID.randomUUID().toString();
-		Device device = storager.queryVideoDevice(deviceId);
+		Device device = deviceService.getDevice(deviceId);
 		try {
 			cmder.homePositionCmd(device, channelId, enabled, resetTime, presetIndex, event -> {
 				RequestMessage msg = new RequestMessage();
@@ -326,7 +326,7 @@ public class DeviceControl {
 		if (log.isDebugEnabled()) {
 			log.debug(String.format("设备拉框放大 API调用,deviceId:%s ,channelId:%s ,length:%d ,width:%d ,midpointx:%d ,midpointy:%d ,lengthx:%d ,lengthy:%d",deviceId, channelId, length, width, midpointx, midpointy,lengthx, lengthy));
 		}
-		Device device = storager.queryVideoDevice(deviceId);
+		Device device = deviceService.getDevice(deviceId);
 		StringBuffer cmdXml = new StringBuffer(200);
 		cmdXml.append("<DragZoomIn>\r\n");
 		cmdXml.append("<Length>" + length+ "</Length>\r\n");
@@ -378,7 +378,7 @@ public class DeviceControl {
 		if (log.isDebugEnabled()) {
 			log.debug(String.format("设备拉框缩小 API调用,deviceId:%s ,channelId:%s ,length:%d ,width:%d ,midpointx:%d ,midpointy:%d ,lengthx:%d ,lengthy:%d",deviceId, channelId, length, width, midpointx, midpointy,lengthx, lengthy));
 		}
-		Device device = storager.queryVideoDevice(deviceId);
+		Device device = deviceService.getDevice(deviceId);
 		StringBuffer cmdXml = new StringBuffer(200);
 		cmdXml.append("<DragZoomOut>\r\n");
 		cmdXml.append("<Length>" + length+ "</Length>\r\n");

+ 17 - 17
src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/device/DeviceQuery.java

@@ -91,7 +91,7 @@ public class DeviceQuery {
 	@GetMapping("/devices/{deviceId}")
 	public Device devices(@PathVariable String deviceId){
 		
-		return storager.queryVideoDevice(deviceId);
+		return deviceService.getDevice(deviceId);
 	}
 
 	/**
@@ -103,12 +103,14 @@ public class DeviceQuery {
 	@Operation(summary = "分页查询国标设备", security = @SecurityRequirement(name = JwtUtils.HEADER))
 	@Parameter(name = "page", description = "当前页", required = true)
 	@Parameter(name = "count", description = "每页查询数量", required = true)
+	@Parameter(name = "query", description = "搜索", required = false)
+	@Parameter(name = "status", description = "状态", required = false)
 	@GetMapping("/devices")
 	@Options()
-	public PageInfo<Device> devices(int page, int count){
+	public PageInfo<Device> devices(int page, int count, String query, Boolean status){
 //		if (page == null) page = 0;
 //		if (count == null) count = 20;
-		return storager.queryVideoDeviceList(page, count,null);
+		return deviceService.getAll(page, count,query, status);
 	}
 
 	/**
@@ -131,18 +133,16 @@ public class DeviceQuery {
 	@Parameter(name = "query", description = "查询内容")
 	@Parameter(name = "online", description = "是否在线")
 	@Parameter(name = "channelType", description = "设备/子目录-> false/true")
-	@Parameter(name = "catalogUnderDevice", description = "是否直属与设备的目录")
 	public PageInfo<DeviceChannel> channels(@PathVariable String deviceId,
 											   int page, int count,
 											   @RequestParam(required = false) String query,
 											   @RequestParam(required = false) Boolean online,
-											   @RequestParam(required = false) Boolean channelType,
-											   @RequestParam(required = false) Boolean catalogUnderDevice) {
+											   @RequestParam(required = false) Boolean channelType) {
 		if (ObjectUtils.isEmpty(query)) {
 			query = null;
 		}
 
-		return storager.queryChannelsByDeviceId(deviceId, query, channelType, online, catalogUnderDevice, page, count);
+		return deviceChannelService.queryChannelsByDeviceId(deviceId, query, channelType, online, page, count);
 	}
 
 	/**
@@ -154,11 +154,11 @@ public class DeviceQuery {
 	@Parameter(name = "deviceId", description = "设备国标编号", required = true)
 	@GetMapping("/devices/{deviceId}/sync")
 	public WVPResult<SyncStatus> devicesSync(@PathVariable String deviceId){
-		
+
 		if (log.isDebugEnabled()) {
 			log.debug("设备通道信息同步API调用,deviceId:" + deviceId);
 		}
-		Device device = storager.queryVideoDevice(deviceId);
+		Device device = deviceService.getDevice(deviceId);
 		boolean status = deviceService.isSyncRunning(deviceId);
 		// 已存在则返回进度
 		if (status) {
@@ -182,7 +182,7 @@ public class DeviceQuery {
 	@Parameter(name = "deviceId", description = "设备国标编号", required = true)
 	@DeleteMapping("/devices/{deviceId}/delete")
 	public String delete(@PathVariable String deviceId){
-		
+
 		if (log.isDebugEnabled()) {
 			log.debug("设备信息删除API调用,deviceId:" + deviceId);
 		}
@@ -240,13 +240,13 @@ public class DeviceQuery {
 												  @RequestParam(required = false) Boolean online,
 												  @RequestParam(required = false) Boolean channelType){
 
-		DeviceChannel deviceChannel = storager.queryChannel(deviceId,channelId);
+		DeviceChannel deviceChannel = deviceChannelService.getOne(deviceId,channelId);
 		if (deviceChannel == null) {
 			PageInfo<DeviceChannel> deviceChannelPageResult = new PageInfo<>();
 			return deviceChannelPageResult;
 		}
 
-		return storager.querySubChannels(deviceId, channelId, query, channelType, online, page, count);
+		return deviceChannelService.getSubChannels(deviceChannel.getDeviceDbId(), channelId, query, channelType, online, page, count);
 	}
 
 	/**
@@ -330,7 +330,7 @@ public class DeviceQuery {
 
 	/**
 	 * 设备状态查询请求API接口
-	 * 
+	 *
 	 * @param deviceId 设备id
 	 */
 	@Operation(summary = "设备状态查询", security = @SecurityRequirement(name = JwtUtils.HEADER))
@@ -340,7 +340,7 @@ public class DeviceQuery {
 		if (log.isDebugEnabled()) {
 			log.debug("设备状态查询API调用");
 		}
-		Device device = storager.queryVideoDevice(deviceId);
+		Device device = deviceService.getDevice(deviceId);
 		String uuid = UUID.randomUUID().toString();
 		String key = DeferredResultHolder.CALLBACK_CMD_DEVICESTATUS + deviceId;
 		DeferredResult<ResponseEntity<String>> result = new DeferredResult<ResponseEntity<String>>(2*1000L);
@@ -394,8 +394,8 @@ public class DeviceQuery {
 	@Parameter(name = "endTime", description = "报警发生终止时间")
 	@GetMapping("/alarm/{deviceId}")
 	public DeferredResult<ResponseEntity<String>> alarmApi(@PathVariable String deviceId,
-														@RequestParam(required = false) String startPriority, 
-														@RequestParam(required = false) String endPriority, 
+														@RequestParam(required = false) String startPriority,
+														@RequestParam(required = false) String endPriority,
 														@RequestParam(required = false) String alarmMethod,
 														@RequestParam(required = false) String alarmType,
 														@RequestParam(required = false) String startTime,
@@ -403,7 +403,7 @@ public class DeviceQuery {
 		if (log.isDebugEnabled()) {
 			log.debug("设备报警查询API调用");
 		}
-		Device device = storager.queryVideoDevice(deviceId);
+		Device device = deviceService.getDevice(deviceId);
 		String key = DeferredResultHolder.CALLBACK_CMD_ALARM + deviceId;
 		String uuid = UUID.randomUUID().toString();
 		try {

+ 1 - 1
src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/platform/PlatformController.java

@@ -320,7 +320,7 @@ public class PlatformController {
         if (ObjectUtils.isEmpty(platformId) || ObjectUtils.isEmpty(catalogId)) {
             catalogId = null;
         }
-        PageInfo<ChannelReduce> channelReduces = storager.queryAllChannelList(page, count, query, online, channelType, platformId, catalogId);
+        PageInfo<ChannelReduce> channelReduces = deviceChannelService.queryAllChannelList(page, count, query, online, channelType, platformId, catalogId);
 
         return channelReduces;
     }

+ 9 - 3
src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/play/PlayController.java

@@ -16,6 +16,7 @@ import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommander;
 import com.genersoft.iot.vmp.media.bean.MediaServer;
 import com.genersoft.iot.vmp.media.service.IMediaServerService;
 import com.genersoft.iot.vmp.service.IDeviceChannelService;
+import com.genersoft.iot.vmp.service.IDeviceService;
 import com.genersoft.iot.vmp.service.IInviteStreamService;
 import com.genersoft.iot.vmp.service.IPlayService;
 import com.genersoft.iot.vmp.service.bean.InviteErrorCode;
@@ -75,6 +76,8 @@ public class PlayController {
 	@Autowired
 	private UserSetting userSetting;
 
+	@Autowired
+	private IDeviceService deviceService;
 
 	@Autowired
 	private IDeviceChannelService deviceChannelService;
@@ -87,8 +90,11 @@ public class PlayController {
 														 @PathVariable String channelId) {
 
 		log.info("[开始点播] deviceId:{}, channelId:{}, ", deviceId, channelId);
+		if (ObjectUtils.isEmpty(deviceId) || ObjectUtils.isEmpty(channelId)) {
+			throw new ControllerException(ErrorCode.ERROR400);
+		}
 		// 获取可用的zlm
-		Device device = storager.queryVideoDevice(deviceId);
+		Device device = deviceService.getDevice(deviceId);
 		MediaServer newMediaServerItem = playService.getNewMediaServerItem(device);
 
 		RequestMessage requestMessage = new RequestMessage();
@@ -163,7 +169,7 @@ public class PlayController {
 			throw new ControllerException(ErrorCode.ERROR400);
 		}
 
-		Device device = storager.queryVideoDevice(deviceId);
+		Device device = deviceService.getDevice(deviceId);
 		if (device == null) {
 			throw new ControllerException(ErrorCode.ERROR100.getCode(), "设备[" + deviceId + "]不存在");
 		}
@@ -206,7 +212,7 @@ public class PlayController {
 		if (log.isDebugEnabled()) {
 			log.debug("语音广播API调用");
 		}
-		Device device = storager.queryVideoDevice(deviceId);
+		Device device = deviceService.getDevice(deviceId);
 		if (device == null) {
 			throw new ControllerException(ErrorCode.ERROR400.getCode(), "未找到设备: " + deviceId);
 		}

+ 7 - 3
src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/playback/PlaybackController.java

@@ -12,6 +12,7 @@ import com.genersoft.iot.vmp.gb28181.bean.Device;
 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.cmd.impl.SIPCommander;
+import com.genersoft.iot.vmp.service.IDeviceService;
 import com.genersoft.iot.vmp.service.IInviteStreamService;
 import com.genersoft.iot.vmp.service.IPlayService;
 import com.genersoft.iot.vmp.service.bean.InviteErrorCode;
@@ -67,6 +68,9 @@ public class PlaybackController {
 	@Autowired
 	private UserSetting userSetting;
 
+	@Autowired
+	private IDeviceService deviceService;
+
 	@Operation(summary = "开始视频回放", security = @SecurityRequirement(name = JwtUtils.HEADER))
 	@Parameter(name = "deviceId", description = "设备国标编号", required = true)
 	@Parameter(name = "channelId", description = "通道国标编号", required = true)
@@ -136,7 +140,7 @@ public class PlaybackController {
 		if (ObjectUtils.isEmpty(deviceId) || ObjectUtils.isEmpty(channelId) || ObjectUtils.isEmpty(stream)) {
 			throw new ControllerException(ErrorCode.ERROR400);
 		}
-		Device device = storager.queryVideoDevice(deviceId);
+		Device device = deviceService.getDevice(deviceId);
 		if (device == null) {
 			throw new ControllerException(ErrorCode.ERROR400.getCode(), "设备:" + deviceId + " 未找到");
 		}
@@ -191,7 +195,7 @@ public class PlaybackController {
 			log.warn("streamId不存在!");
 			throw new ControllerException(ErrorCode.ERROR400.getCode(), "streamId不存在");
 		}
-		Device device = storager.queryVideoDevice(inviteInfo.getDeviceId());
+		Device device = deviceService.getDevice(inviteInfo.getDeviceId());
 		try {
 			cmder.playSeekCmd(device, inviteInfo.getStreamInfo(), seekTime);
 		} catch (InvalidArgumentException | ParseException | SipException e) {
@@ -215,7 +219,7 @@ public class PlaybackController {
 			log.warn("不支持的speed: " + speed);
 			throw new ControllerException(ErrorCode.ERROR100.getCode(), "不支持的speed(0.25 0.5 1、2、4)");
 		}
-		Device device = storager.queryVideoDevice(inviteInfo.getDeviceId());
+		Device device = deviceService.getDevice(inviteInfo.getDeviceId());
 		try {
 			cmder.playSpeedCmd(device, inviteInfo.getStreamInfo(), speed);
 		} catch (InvalidArgumentException | ParseException | SipException e) {

+ 7 - 3
src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/ptz/PtzController.java

@@ -7,6 +7,7 @@ import com.genersoft.iot.vmp.gb28181.bean.Device;
 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.cmd.impl.SIPCommander;
+import com.genersoft.iot.vmp.service.IDeviceService;
 import com.genersoft.iot.vmp.storager.IVideoManagerStorage;
 import com.genersoft.iot.vmp.vmanager.bean.ErrorCode;
 import io.swagger.v3.oas.annotations.Operation;
@@ -36,6 +37,9 @@ public class PtzController {
 	@Autowired
 	private IVideoManagerStorage storager;
 
+	@Autowired
+	private IDeviceService deviceService;
+
 	@Autowired
 	private DeferredResultHolder resultHolder;
 
@@ -62,7 +66,7 @@ public class PtzController {
 		if (log.isDebugEnabled()) {
 			log.debug(String.format("设备云台控制 API调用,deviceId:%s ,channelId:%s ,command:%s ,horizonSpeed:%d ,verticalSpeed:%d ,zoomSpeed:%d",deviceId, channelId, command, horizonSpeed, verticalSpeed, zoomSpeed));
 		}
-		Device device = storager.queryVideoDevice(deviceId);
+		Device device = deviceService.getDevice(deviceId);
 		int cmdCode = 0;
 		switch (command){
 			case "left":
@@ -125,7 +129,7 @@ public class PtzController {
 		if (log.isDebugEnabled()) {
 			log.debug(String.format("设备云台控制 API调用,deviceId:%s ,channelId:%s ,cmdCode:%d parameter1:%d parameter2:%d",deviceId, channelId, cmdCode, parameter1, parameter2));
 		}
-		Device device = storager.queryVideoDevice(deviceId);
+		Device device = deviceService.getDevice(deviceId);
 
 		try {
 			cmder.frontEndCmd(device, channelId, cmdCode, parameter1, parameter2, combindCode2);
@@ -144,7 +148,7 @@ public class PtzController {
 		if (log.isDebugEnabled()) {
 			log.debug("设备预置位查询API调用");
 		}
-		Device device = storager.queryVideoDevice(deviceId);
+		Device device = deviceService.getDevice(deviceId);
 		String uuid =  UUID.randomUUID().toString();
 		String key =  DeferredResultHolder.CALLBACK_CMD_PRESETQUERY + (ObjectUtils.isEmpty(channelId) ? deviceId : channelId);
 		DeferredResult<String> result = new DeferredResult<String> (3 * 1000L);

+ 1 - 1
src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/record/GBRecordController.java

@@ -83,7 +83,7 @@ public class GBRecordController {
 			throw new ControllerException(ErrorCode.ERROR100.getCode(), "endTime格式为" + DateUtil.PATTERN);
 		}
 
-		Device device = storager.queryVideoDevice(deviceId);
+		Device device = deviceService.getDevice(deviceId);
 		// 指定超时时间 1分钟30秒
 		String uuid = UUID.randomUUID().toString();
 		int sn  =  (int)((Math.random()*9+1)*100000);

+ 4 - 4
src/main/java/com/genersoft/iot/vmp/web/gb28181/ApiControlController.java

@@ -3,7 +3,7 @@ package com.genersoft.iot.vmp.web.gb28181;
 import com.genersoft.iot.vmp.conf.exception.ControllerException;
 import com.genersoft.iot.vmp.gb28181.bean.Device;
 import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommander;
-import com.genersoft.iot.vmp.storager.IVideoManagerStorage;
+import com.genersoft.iot.vmp.service.IDeviceService;
 import com.genersoft.iot.vmp.vmanager.bean.ErrorCode;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -28,7 +28,7 @@ public class ApiControlController {
     private SIPCommander cmder;
 
     @Autowired
-    private IVideoManagerStorage storager;
+    private IDeviceService deviceService;
 
     /**
      * 设备控制 - 云台控制
@@ -51,7 +51,7 @@ public class ApiControlController {
         }
         if (channel == null) {channel = 0;}
         if (speed == null) {speed = 0;}
-        Device device = storager.queryVideoDevice(serial);
+        Device device = deviceService.getDevice(serial);
         if (device == null) {
             throw new ControllerException(ErrorCode.ERROR100.getCode(), "device[ " + serial + " ]未找到");
         }
@@ -125,7 +125,7 @@ public class ApiControlController {
         }
 
         if (channel == null) {channel = 0;}
-        Device device = storager.queryVideoDevice(serial);
+        Device device = deviceService.getDevice(serial);
         if (device == null) {
             throw new ControllerException(ErrorCode.ERROR100.getCode(), "device[ " + serial + " ]未找到");
         }

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

@@ -8,6 +8,7 @@ import com.genersoft.iot.vmp.gb28181.bean.PresetQuerySipReq;
 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.cmd.impl.SIPCommander;
+import com.genersoft.iot.vmp.service.IDeviceChannelService;
 import com.genersoft.iot.vmp.service.IDeviceService;
 import com.genersoft.iot.vmp.storager.IVideoManagerStorage;
 import com.genersoft.iot.vmp.vmanager.bean.DeferredResultEx;
@@ -43,11 +44,14 @@ public class ApiDeviceController {
     @Autowired
     private SIPCommander cmder;
     @Autowired
-    private IDeviceService deviceService;
+    private IDeviceChannelService channelService;
 
     @Autowired
     private DeferredResultHolder resultHolder;
 
+    @Autowired
+    private IDeviceService deviceService;
+
 
     /**
      * 分页获取设备列表 现在直接返回,尚未实现分页
@@ -70,10 +74,10 @@ public class ApiDeviceController {
         JSONObject result = new JSONObject();
         List<Device> devices;
         if (start == null || limit ==null) {
-            devices = storager.queryVideoDeviceList(online);
+            devices = deviceService.getAllByStatus(online);
             result.put("DeviceCount", devices.size());
         }else {
-            PageInfo<Device> deviceList = storager.queryVideoDeviceList(start/limit, limit,online);
+            PageInfo<Device> deviceList = deviceService.getAll(start/limit, limit,null, online);
             result.put("DeviceCount", deviceList.getTotal());
             devices = deviceList.getList();
         }
@@ -120,7 +124,7 @@ public class ApiDeviceController {
             String[] split = code.trim().split(",");
             channelIds = Arrays.asList(split);
         }
-        List<DeviceChannelExtend> allDeviceChannelList = storager.queryChannelsByDeviceId(serial,channelIds,online);
+        List<DeviceChannelExtend> allDeviceChannelList = channelService.queryChannelExtendsByDeviceId(serial,channelIds,online);
         if (start == null || limit ==null) {
             deviceChannels = allDeviceChannelList;
             result.put("ChannelCount", deviceChannels.size());
@@ -196,7 +200,7 @@ public class ApiDeviceController {
                     serial, channel, code, fill, timeout);
         }
 
-        Device device = storager.queryVideoDevice(serial);
+        Device device = deviceService.getDevice(serial);
         String uuid =  UUID.randomUUID().toString();
         String key =  DeferredResultHolder.CALLBACK_CMD_PRESETQUERY + (ObjectUtils.isEmpty(code) ? serial : code);
         DeferredResult<Object> result = new DeferredResult<> (timeout * 1000L);

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

@@ -82,7 +82,7 @@ public class ApiStreamController {
 
     ){
         DeferredResult<JSONObject> result = new DeferredResult<>(userSetting.getPlayTimeout().longValue() + 10);
-        Device device = storager.queryVideoDevice(serial);
+        Device device = deviceService.getDevice(serial);
         if (device == null ) {
             JSONObject resultJSON = new JSONObject();
             resultJSON.put("error","device[ " + serial + " ]未找到");
@@ -104,7 +104,7 @@ public class ApiStreamController {
              // 清理RTP server
         });
 
-        DeviceChannel deviceChannel = storager.queryChannel(serial, code);
+        DeviceChannel deviceChannel = deviceChannelService.getOne(serial, code);
         if (deviceChannel == null) {
             JSONObject resultJSON = new JSONObject();
             resultJSON.put("error","channel[ " + code + " ]未找到");

+ 13 - 22
web_src/src/components/channelList.vue

@@ -52,11 +52,9 @@
       <el-main style="padding: 5px;">
         <el-table ref="channelListTable" :data="deviceChannelList" :height="winHeight" style="width: 100%"
                   header-row-class-name="table-header">
-          <el-table-column prop="channelId" label="通道编号" min-width="180">
+          <el-table-column prop="deviceId" label="编号" min-width="180">
           </el-table-column>
-          <el-table-column prop="deviceId" label="设备编号" min-width="180">
-          </el-table-column>
-          <el-table-column prop="name" label="通道名称" min-width="180">
+          <el-table-column prop="name" label="名称" min-width="180">
             <template v-slot:default="scope">
               <el-input
                 v-show="scope.row.edit"
@@ -85,7 +83,9 @@
           </el-table-column>
           <el-table-column prop="subCount" label="子节点数" min-width="100">
           </el-table-column>
-          <el-table-column prop="manufacture" label="厂家" min-width="100">
+          <el-table-column prop="manufacturer" label="厂家" min-width="100">
+          </el-table-column>
+          <el-table-column prop="model" label="型号" min-width="150">
           </el-table-column>
           <el-table-column label="位置信息" min-width="120">
             <template v-slot:default="scope">
@@ -102,16 +102,7 @@
           </el-table-column>
           <el-table-column prop="ptzType" label="云台类型" min-width="100">
             <template v-slot:default="scope">
-              <el-select v-show="scope.row.edit" v-model="scope.row.ptzType"
-                         placeholder="云台类型" filterable>
-                <el-option
-                  v-for="(value, key) in ptzTypes"
-                  :key="key"
-                  :label="value"
-                  :value="key"
-                />
-              </el-select>
-              <div v-show="!scope.row.edit">{{ scope.row.ptzTypeText }}</div>
+              <div >{{ scope.row.ptzTypeText }}</div>
             </template>
           </el-table-column>
           <el-table-column label="开启音频" min-width="100">
@@ -138,8 +129,8 @@
           <el-table-column label="状态" min-width="100">
             <template slot-scope="scope">
               <div slot="reference" class="name-wrapper">
-                <el-tag size="medium" v-if="scope.row.status === true">在线</el-tag>
-                <el-tag size="medium" type="info" v-if="scope.row.status === false">离线</el-tag>
+                <el-tag size="medium" v-if="scope.row.status === 'ON'">在线</el-tag>
+                <el-tag size="medium" type="info" v-if="scope.row.status !== 'ON'">离线</el-tag>
               </div>
             </template>
           </el-table-column>
@@ -347,7 +338,7 @@ export default {
     sendDevicePush: function (itemData) {
       let deviceId = this.deviceId;
       this.isLoging = true;
-      let channelId = itemData.channelId;
+      let channelId = itemData.deviceId;
       console.log("通知设备推流1:" + deviceId + " : " + channelId);
       let that = this;
       this.$axios({
@@ -394,13 +385,13 @@ export default {
     },
     queryRecords: function (itemData) {
       let deviceId = this.deviceId;
-      let channelId = itemData.channelId;
+      let channelId = itemData.deviceId;
 
       this.$router.push(`/gbRecordDetail/${deviceId}/${channelId}`)
     },
     queryCloudRecords: function (itemData) {
       let deviceId = this.deviceId;
-      let channelId = itemData.channelId;
+      let channelId = itemData.deviceId;
 
       this.$router.push(`/cloudRecordDetail/rtp/${deviceId}_${channelId}`)
     },
@@ -408,7 +399,7 @@ export default {
       var that = this;
       this.$axios({
         method: 'get',
-        url: '/api/play/stop/' + this.deviceId + "/" + itemData.channelId,
+        url: '/api/play/stop/' + this.deviceId + "/" + itemData.deviceId,
         params: {
           isSubStream: this.isSubStream
         }
@@ -454,7 +445,7 @@ export default {
     changeSubchannel(itemData) {
       this.beforeUrl = this.$router.currentRoute.path;
 
-      var url = `/${this.$router.currentRoute.name}/${this.$router.currentRoute.params.deviceId}/${itemData.channelId}`
+      var url = `/${this.$router.currentRoute.name}/${this.$router.currentRoute.params.deviceId}/${itemData.deviceId}`
       this.$router.push(url).then(() => {
         this.searchSrt = "";
         this.channelType = "";