维护目录订阅消息与接口

This commit is contained in:
648540858
2021-11-12 14:40:39 +08:00
parent 5854549302
commit eca1e05aee
6 changed files with 188 additions and 94 deletions

View File

@@ -97,6 +97,13 @@ public interface IVideoManagerStorager {
*/
public DeviceChannel queryChannel(String deviceId, String channelId);
/**
* 删除通道
* @param deviceId 设备ID
* @param channelId 通道ID
*/
public int delChannel(String deviceId, String channelId);
/**
* 获取多个设备
* @param page 当前页数
@@ -387,4 +394,16 @@ public interface IVideoManagerStorager {
* @return
*/
Device queryVideoDeviceByChannelId(String channelId);
/**
* 通道上线
* @param channelId 通道ID
*/
void deviceChannelOnline(String deviceId, String channelId);
/**
* 通道离线
* @param channelId 通道ID
*/
void deviceChannelOffline(String deviceId, String channelId);
}

View File

@@ -74,6 +74,9 @@ public interface DeviceChannelMapper {
@Delete("DELETE FROM device_channel WHERE deviceId=#{deviceId}")
int cleanChannelsByDeviceId(String deviceId);
@Delete("DELETE FROM device_channel WHERE deviceId=#{deviceId} AND channelId=#{channelId}")
int del(String deviceId, String channelId);
@Update(value = {"UPDATE device_channel SET streamId=null WHERE deviceId=#{deviceId} AND channelId=#{channelId}"})
void stopPlay(String deviceId, String channelId);
@@ -104,5 +107,11 @@ public interface DeviceChannelMapper {
List<ChannelReduce> queryChannelListInAll(String query, Boolean online, Boolean hasSubChannel, String platformId, Boolean inPlatform);
@Select("SELECT * FROM device_channel WHERE channelId=#{channelId}")
List<DeviceChannel> queryChannelByChannelId(String channelId);
List<DeviceChannel> queryChannelByChannelId( String channelId);
@Update(value = {"UPDATE device_channel SET status=0 WHERE deviceId=#{deviceId} AND channelId=#{channelId}"})
void offline(String deviceId, String channelId);
@Update(value = {"UPDATE device_channel SET status=1 WHERE deviceId=#{deviceId} AND channelId=#{channelId}"})
void online(String deviceId, String channelId);
}

View File

@@ -1,14 +1,12 @@
package com.genersoft.iot.vmp.storager.impl;
import java.text.SimpleDateFormat;
import java.util.*;
import com.genersoft.iot.vmp.gb28181.bean.*;
import com.genersoft.iot.vmp.gb28181.session.VideoStreamSessionManager;
import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem;
import com.genersoft.iot.vmp.media.zlm.dto.StreamProxyItem;
import com.genersoft.iot.vmp.media.zlm.dto.StreamPushItem;
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
import com.genersoft.iot.vmp.storager.IVideoManagerStorager;
import com.genersoft.iot.vmp.storager.dao.*;
import com.genersoft.iot.vmp.vmanager.gb28181.platform.bean.ChannelReduce;
import com.github.pagehelper.PageHelper;
@@ -18,12 +16,16 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.datasource.DataSourceTransactionManager;
import org.springframework.stereotype.Component;
import com.genersoft.iot.vmp.storager.IVideoManagerStorager;
import org.springframework.transaction.TransactionDefinition;
import org.springframework.transaction.TransactionStatus;
import org.springframework.transaction.annotation.Transactional;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @description:视频设备数据存储-jdbc实现
* @author: swwheihei
@@ -137,6 +139,16 @@ public class VideoManagerStoragerImpl implements IVideoManagerStorager {
}
}
@Override
public void deviceChannelOnline(String deviceId, String channelId) {
deviceChannelMapper.online(deviceId, channelId);
}
@Override
public void deviceChannelOffline(String deviceId, String channelId) {
deviceChannelMapper.offline(deviceId, channelId);
}
@Override
public void startPlay(String deviceId, String channelId, String streamId) {
deviceChannelMapper.startPlay(deviceId, channelId, streamId);
@@ -184,6 +196,11 @@ public class VideoManagerStoragerImpl implements IVideoManagerStorager {
}
@Override
public int delChannel(String deviceId, String channelId) {
return deviceChannelMapper.del(deviceId, channelId);
}
/**
* 获取多个设备
*
@@ -624,8 +641,9 @@ public class VideoManagerStoragerImpl implements IVideoManagerStorager {
return streamProxyMapper.selectForEnableInMediaServer(id, enable);
}
@Override
public Device queryVideoDeviceByChannelId(String channelId) {
public Device queryVideoDeviceByChannelId( String channelId) {
Device result = null;
List<DeviceChannel> channelList = deviceChannelMapper.queryChannelByChannelId(channelId);
if (channelList.size() == 1) {