增加分页,搜索,等
parent
764daa8a36
commit
57fd18cd7c
|
@ -3,5 +3,6 @@
|
||||||
<component name="Encoding">
|
<component name="Encoding">
|
||||||
<file url="file://$PROJECT_DIR$" charset="UTF-8" />
|
<file url="file://$PROJECT_DIR$" charset="UTF-8" />
|
||||||
<file url="file://$PROJECT_DIR$/src/main/java" charset="UTF-8" />
|
<file url="file://$PROJECT_DIR$/src/main/java" charset="UTF-8" />
|
||||||
|
<file url="file://$PROJECT_DIR$/src/main/java/com/genersoft/iot/vmp/storager/redis/VideoManagerRedisStoragerImpl.java" charset="UTF-8" />
|
||||||
</component>
|
</component>
|
||||||
</project>
|
</project>
|
29
README.md
29
README.md
|
@ -6,38 +6,25 @@ WEB VIDEO PLATFORM是一个基于GB28181-2016标准实现的网络视频平台
|
||||||
### fork自 [swwheihei/wvp-GB28181](https://github.com/swwheihei/wvp-GB28181)
|
### fork自 [swwheihei/wvp-GB28181](https://github.com/swwheihei/wvp-GB28181)
|
||||||
|
|
||||||
# 应用场景:
|
# 应用场景:
|
||||||
主要应用在IPC等设备没有固定IP地址,但需要在互联网中观看的场景。
|
原项目比较侧重单个摄像机的接入,当前这个更侧重平台接入,当然,直接接摄像机也是没有问题的。
|
||||||
要求IPC设备可以访问互联网,有云服务器用于部署本服务。
|
|
||||||
预计7月可以达到商用级别的文档性
|
|
||||||
|
|
||||||
# 支持特性:
|
# 支持特性:
|
||||||
1、视频预览
|
1、视频预览
|
||||||
2、云台控制(方向、缩放控制)
|
2、云台控制(方向、缩放控制)
|
||||||
3、视频设备信息同步
|
3、视频设备信息同步
|
||||||
4、离在线监控
|
4、离在线监控
|
||||||
5、录像查询与回放(基于NVR\DVR,暂不支持快进、seek操作)
|
5、无人观看自动断流
|
||||||
6、无人观看自动断流
|
|
||||||
|
|
||||||
# 2020路线图:
|
# 待实现:
|
||||||
5月中旬-录像回放(基于NVR\DVR)、设备认证(基于密码)
|
录像查询与回放(基于NVR\DVR,暂不支持快进、seek操作)
|
||||||
5月下旬-设备报警
|
|
||||||
6月上旬-流媒体认证(ZLM推流、取流)
|
|
||||||
6月下旬-语音对讲、Android Deme\iOS Demo
|
|
||||||
7月下旬-设备认证(基于数字证书)、集群部署
|
|
||||||
8月下旬-云端录像与回放
|
|
||||||
9月下旬-Onvif协议支持
|
|
||||||
10月下旬-GB28181-2011版设备适配
|
|
||||||
12月底-上级级联、时间同步、其他国标能力
|
12月底-上级级联、时间同步、其他国标能力
|
||||||
|
|
||||||
# 项目部署
|
# 项目部署
|
||||||
参考wiki说明
|
|
||||||
|
|
||||||
# 使用帮助
|
# 使用帮助
|
||||||
参考wiki说明
|
|
||||||
|
|
||||||
# 致谢
|
# 致谢
|
||||||
感谢作者[夏楚](https://github.com/xiongziliang) 提供这么棒的开源流媒体服务框架
|
感谢作者[夏楚](https://github.com/xiongziliang) 提供这么棒的开源流媒体服务框架
|
||||||
感谢作者[kkkkk5G](https://gitee.com/kkkkk5G) 提供这么棒的前端UI
|
感谢作者[kkkkk5G](https://gitee.com/kkkkk5G) 提供这么棒的前端UI
|
||||||
|
|
||||||
|
|
||||||
[]: https://github.com/swwheihei/wvp-GB28181
|
|
|
@ -21,5 +21,7 @@ public class VManagerConfig {
|
||||||
public void setDatabase(String database) {
|
public void setDatabase(String database) {
|
||||||
this.database = database;
|
this.database = database;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -128,6 +128,11 @@ public class DeviceChannel {
|
||||||
*/
|
*/
|
||||||
private double latitude;
|
private double latitude;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 子设备数
|
||||||
|
*/
|
||||||
|
private int subCount;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 流唯一编号,存在表示正在直播
|
* 流唯一编号,存在表示正在直播
|
||||||
*/
|
*/
|
||||||
|
@ -332,4 +337,12 @@ public class DeviceChannel {
|
||||||
public void setSsrc(String ssrc) {
|
public void setSsrc(String ssrc) {
|
||||||
this.ssrc = ssrc;
|
this.ssrc = ssrc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getSubCount() {
|
||||||
|
return subCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSubCount(int subCount) {
|
||||||
|
this.subCount = subCount;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,6 +7,7 @@ import javax.sip.header.CSeqHeader;
|
||||||
import javax.sip.message.Request;
|
import javax.sip.message.Request;
|
||||||
import javax.sip.message.Response;
|
import javax.sip.message.Response;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
@ -126,6 +127,7 @@ public class SIPProcessorFactory {
|
||||||
processor.setRequestEvent(evt);
|
processor.setRequestEvent(evt);
|
||||||
return processor;
|
return processor;
|
||||||
} else if (Request.MESSAGE.equals(method)) {
|
} else if (Request.MESSAGE.equals(method)) {
|
||||||
|
|
||||||
MessageRequestProcessor processor = new MessageRequestProcessor();
|
MessageRequestProcessor processor = new MessageRequestProcessor();
|
||||||
processor.setRequestEvent(evt);
|
processor.setRequestEvent(evt);
|
||||||
processor.setTcpSipProvider(getTcpSipProvider());
|
processor.setTcpSipProvider(getTcpSipProvider());
|
||||||
|
|
|
@ -144,6 +144,7 @@ public class MessageRequestProcessor extends SIPRequestAbstractProcessor {
|
||||||
private void processMessageCatalogList(RequestEvent evt) {
|
private void processMessageCatalogList(RequestEvent evt) {
|
||||||
try {
|
try {
|
||||||
Element rootElement = getRootElement(evt);
|
Element rootElement = getRootElement(evt);
|
||||||
|
String s = rootElement.toString();
|
||||||
Element deviceIdElement = rootElement.element("DeviceID");
|
Element deviceIdElement = rootElement.element("DeviceID");
|
||||||
String deviceId = deviceIdElement.getText().toString();
|
String deviceId = deviceIdElement.getText().toString();
|
||||||
Element deviceListElement = rootElement.element("DeviceList");
|
Element deviceListElement = rootElement.element("DeviceList");
|
||||||
|
@ -171,10 +172,10 @@ public class MessageRequestProcessor extends SIPRequestAbstractProcessor {
|
||||||
DeviceChannel deviceChannel = new DeviceChannel();
|
DeviceChannel deviceChannel = new DeviceChannel();
|
||||||
deviceChannel.setName(channelName);
|
deviceChannel.setName(channelName);
|
||||||
deviceChannel.setChannelId(channelDeviceId);
|
deviceChannel.setChannelId(channelDeviceId);
|
||||||
if(status.equals("ON")) {
|
if(status.equals("ON") || status.equals("On")) {
|
||||||
deviceChannel.setStatus(1);
|
deviceChannel.setStatus(1);
|
||||||
}
|
}
|
||||||
if(status.equals("OFF")) {
|
if(status.equals("OFF") || status.equals("Off")) {
|
||||||
deviceChannel.setStatus(0);
|
deviceChannel.setStatus(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -185,7 +186,7 @@ public class MessageRequestProcessor extends SIPRequestAbstractProcessor {
|
||||||
deviceChannel.setBlock(XmlUtil.getText(itemDevice,"Block"));
|
deviceChannel.setBlock(XmlUtil.getText(itemDevice,"Block"));
|
||||||
deviceChannel.setAddress(XmlUtil.getText(itemDevice,"Address"));
|
deviceChannel.setAddress(XmlUtil.getText(itemDevice,"Address"));
|
||||||
deviceChannel.setParental(itemDevice.element("Parental") == null? 0:Integer.parseInt(XmlUtil.getText(itemDevice,"Parental")));
|
deviceChannel.setParental(itemDevice.element("Parental") == null? 0:Integer.parseInt(XmlUtil.getText(itemDevice,"Parental")));
|
||||||
deviceChannel.setParentId(XmlUtil.getText(itemDevice,"ParentId"));
|
deviceChannel.setParentId(XmlUtil.getText(itemDevice,"ParentID"));
|
||||||
deviceChannel.setSafetyWay(itemDevice.element("SafetyWay") == null? 0:Integer.parseInt(XmlUtil.getText(itemDevice,"SafetyWay")));
|
deviceChannel.setSafetyWay(itemDevice.element("SafetyWay") == null? 0:Integer.parseInt(XmlUtil.getText(itemDevice,"SafetyWay")));
|
||||||
deviceChannel.setRegisterWay(itemDevice.element("RegisterWay") == null? 1:Integer.parseInt(XmlUtil.getText(itemDevice,"RegisterWay")));
|
deviceChannel.setRegisterWay(itemDevice.element("RegisterWay") == null? 1:Integer.parseInt(XmlUtil.getText(itemDevice,"RegisterWay")));
|
||||||
deviceChannel.setCertNum(XmlUtil.getText(itemDevice,"CertNum"));
|
deviceChannel.setCertNum(XmlUtil.getText(itemDevice,"CertNum"));
|
||||||
|
|
|
@ -77,7 +77,7 @@ public interface IVideoManagerStorager {
|
||||||
* @param count 每页数量
|
* @param count 每页数量
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public PageResult queryChannelsByDeviceId(String deviceId, int page, int count);
|
public PageResult queryChannelsByDeviceId(String deviceId, String query, Boolean hasSubChannel, String online, int page, int count);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取某个设备的通道列表
|
* 获取某个设备的通道列表
|
||||||
|
@ -161,6 +161,19 @@ public interface IVideoManagerStorager {
|
||||||
*/
|
*/
|
||||||
public StreamInfo queryPlay(String deviceId, String channelId);
|
public StreamInfo queryPlay(String deviceId, String channelId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询子设备
|
||||||
|
*
|
||||||
|
* @param deviceId
|
||||||
|
* @param channelId
|
||||||
|
* @param page
|
||||||
|
* @param count
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
PageResult querySubChannels(String deviceId, String channelId, String query, Boolean hasSubChannel, String online, int page, int count);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新缓存
|
||||||
|
*/
|
||||||
|
public void updateCatch();
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,17 @@
|
||||||
|
package com.genersoft.iot.vmp.storager;
|
||||||
|
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.boot.CommandLineRunner;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
public class VodeoMannagerTask implements CommandLineRunner {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IVideoManagerStorager storager;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void run(String... strings) throws Exception {
|
||||||
|
storager.updateCatch();
|
||||||
|
}
|
||||||
|
}
|
|
@ -79,10 +79,11 @@ public class VideoManagerJdbcStoragerImpl implements IVideoManagerStorager {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PageResult queryChannelsByDeviceId(String deviceId, int page, int count) {
|
public PageResult queryChannelsByDeviceId(String deviceId, String query, Boolean hasSubChannel, String online, int page, int count) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<DeviceChannel> queryChannelsByDeviceId(String deviceId) {
|
public List<DeviceChannel> queryChannelsByDeviceId(String deviceId) {
|
||||||
return null;
|
return null;
|
||||||
|
@ -161,4 +162,13 @@ public class VideoManagerJdbcStoragerImpl implements IVideoManagerStorager {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PageResult querySubChannels(String deviceId, String channelId, String query, Boolean hasSubChannel, String online, int page, int count) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateCatch() {
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,278 +1,417 @@
|
||||||
package com.genersoft.iot.vmp.storager.redis;
|
package com.genersoft.iot.vmp.storager.redis;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.List;
|
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.genersoft.iot.vmp.common.PageResult;
|
||||||
import com.genersoft.iot.vmp.common.PageResult;
|
import com.genersoft.iot.vmp.common.StreamInfo;
|
||||||
import com.genersoft.iot.vmp.common.StreamInfo;
|
import com.genersoft.iot.vmp.conf.MediaServerConfig;
|
||||||
import com.genersoft.iot.vmp.conf.MediaServerConfig;
|
import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel;
|
||||||
import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.stereotype.Component;
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
|
import com.genersoft.iot.vmp.common.VideoManagerConstants;
|
||||||
import com.genersoft.iot.vmp.common.VideoManagerConstants;
|
import com.genersoft.iot.vmp.gb28181.bean.Device;
|
||||||
import com.genersoft.iot.vmp.gb28181.bean.Device;
|
import com.genersoft.iot.vmp.storager.IVideoManagerStorager;
|
||||||
import com.genersoft.iot.vmp.storager.IVideoManagerStorager;
|
import com.genersoft.iot.vmp.utils.redis.RedisUtil;
|
||||||
import com.genersoft.iot.vmp.utils.redis.RedisUtil;
|
import org.springframework.util.StringUtils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Description:视频设备数据存储-redis实现
|
* @Description:视频设备数据存储-redis实现
|
||||||
* @author: swwheihei
|
* @author: swwheihei
|
||||||
* @date: 2020年5月6日 下午2:31:42
|
* @date: 2020年5月6日 下午2:31:42
|
||||||
*/
|
*/
|
||||||
@Component("redisStorager")
|
@Component("redisStorager")
|
||||||
public class VideoManagerRedisStoragerImpl implements IVideoManagerStorager {
|
public class VideoManagerRedisStoragerImpl implements IVideoManagerStorager {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private RedisUtil redis;
|
private RedisUtil redis;
|
||||||
|
|
||||||
|
private HashMap<String, HashMap<String, HashSet<String>>> deviceMap = new HashMap<>();
|
||||||
/**
|
|
||||||
* 根据设备ID判断设备是否存在
|
|
||||||
*
|
/**
|
||||||
* @param deviceId 设备ID
|
* 根据设备ID判断设备是否存在
|
||||||
* @return true:存在 false:不存在
|
*
|
||||||
*/
|
* @param deviceId 设备ID
|
||||||
@Override
|
* @return true:存在 false:不存在
|
||||||
public boolean exists(String deviceId) {
|
*/
|
||||||
return redis.hasKey(VideoManagerConstants.DEVICE_PREFIX+deviceId);
|
@Override
|
||||||
}
|
public boolean exists(String deviceId) {
|
||||||
|
return redis.hasKey(VideoManagerConstants.DEVICE_PREFIX+deviceId);
|
||||||
/**
|
}
|
||||||
* 视频设备创建
|
|
||||||
*
|
/**
|
||||||
* @param device 设备对象
|
* 视频设备创建
|
||||||
* @return true:创建成功 false:创建失败
|
*
|
||||||
*/
|
* @param device 设备对象
|
||||||
@Override
|
* @return true:创建成功 false:创建失败
|
||||||
public boolean create(Device device) {
|
*/
|
||||||
return redis.set(VideoManagerConstants.DEVICE_PREFIX+device.getDeviceId(), device);
|
@Override
|
||||||
}
|
public boolean create(Device device) {
|
||||||
|
return redis.set(VideoManagerConstants.DEVICE_PREFIX+device.getDeviceId(), device);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 视频设备更新
|
|
||||||
*
|
/**
|
||||||
* @param device 设备对象
|
* 视频设备更新
|
||||||
* @return true:更新成功 false:更新失败
|
*
|
||||||
*/
|
* @param device 设备对象
|
||||||
@Override
|
* @return true:更新成功 false:更新失败
|
||||||
public boolean updateDevice(Device device) {
|
*/
|
||||||
List<Object> deviceChannelList = redis.keys(VideoManagerConstants.CACHEKEY_PREFIX + device.getDeviceId() + "_" + "*");
|
@Override
|
||||||
// 更新device中的通道数量
|
public boolean updateDevice(Device device) {
|
||||||
device.setChannelCount(deviceChannelList.size());
|
if (deviceMap.get(device.getDeviceId()) == null) {
|
||||||
// 存储device
|
deviceMap.put(device.getDeviceId(), new HashMap<String, HashSet<String>>());
|
||||||
return redis.set(VideoManagerConstants.DEVICE_PREFIX+device.getDeviceId(), device);
|
}
|
||||||
|
// List<Object> deviceChannelList = redis.keys(VideoManagerConstants.CACHEKEY_PREFIX + device.getDeviceId() + "_" + "*");
|
||||||
|
// 更新device中的通道数量
|
||||||
}
|
device.setChannelCount(deviceMap.get(device.getDeviceId()).size());
|
||||||
|
// 存储device
|
||||||
@Override
|
return redis.set(VideoManagerConstants.DEVICE_PREFIX+device.getDeviceId(), device);
|
||||||
public void updateChannel(String deviceId, DeviceChannel channel) {
|
|
||||||
// 存储通道
|
|
||||||
redis.set(VideoManagerConstants.CACHEKEY_PREFIX+deviceId + "_" + channel.getChannelId(),
|
}
|
||||||
channel);
|
|
||||||
List<Object> deviceChannelList = redis.keys(VideoManagerConstants.CACHEKEY_PREFIX + deviceId + "_" + "*");
|
@Override
|
||||||
// 更新device中的通道数量
|
public void updateChannel(String deviceId, DeviceChannel channel) {
|
||||||
Device device = (Device)redis.get(VideoManagerConstants.DEVICE_PREFIX+deviceId);
|
String channelId = channel.getChannelId();
|
||||||
device.setChannelCount(deviceChannelList.size());
|
HashMap<String, HashSet<String>> channelMap = deviceMap.get(deviceId);
|
||||||
redis.set(VideoManagerConstants.DEVICE_PREFIX+device.getDeviceId(), device);
|
if (channelMap == null) return;
|
||||||
}
|
|
||||||
|
// 作为父设备, 确定自己的子节点数
|
||||||
/**
|
if (channelMap.get(channelId) == null) {
|
||||||
* 获取设备
|
channelMap.put(channelId, new HashSet<String>());
|
||||||
*
|
}else if (channelMap.get(channelId).size()> 0) {
|
||||||
* @param deviceId 设备ID
|
channel.setSubCount(channelMap.get(channelId).size());
|
||||||
* @return Device 设备对象
|
}
|
||||||
*/
|
|
||||||
@Override
|
// 存储通道
|
||||||
public Device queryVideoDevice(String deviceId) {
|
redis.set(VideoManagerConstants.CACHEKEY_PREFIX + deviceId +
|
||||||
return (Device)redis.get(VideoManagerConstants.DEVICE_PREFIX+deviceId);
|
"_" + channel.getChannelId() +
|
||||||
}
|
":" + channel.getName() +
|
||||||
|
"_" + (channel.getStatus() == 1 ? "on":"off") +
|
||||||
@Override
|
"_" + (channelMap.get(channelId).size() > 0)+
|
||||||
public PageResult queryChannelsByDeviceId(String deviceId, int page, int count) {
|
"_" + channel.getParentId(),
|
||||||
List<DeviceChannel> result = new ArrayList<>();
|
channel);
|
||||||
PageResult pageResult = new PageResult<DeviceChannel>();
|
// 更新device中的通道数量
|
||||||
List<Object> deviceChannelList = redis.keys(VideoManagerConstants.CACHEKEY_PREFIX + deviceId + "_" + "*");
|
Device device = (Device)redis.get(VideoManagerConstants.DEVICE_PREFIX+deviceId);
|
||||||
pageResult.setPage(page);
|
device.setChannelCount(deviceMap.get(deviceId).size());
|
||||||
pageResult.setCount(count);
|
redis.set(VideoManagerConstants.DEVICE_PREFIX+device.getDeviceId(), device);
|
||||||
pageResult.setTotal(deviceChannelList.size());
|
|
||||||
int maxCount = (page + 1 ) * count;
|
|
||||||
if (deviceChannelList != null && deviceChannelList.size() > 0 ) {
|
// 如果有父设备,更新父设备内子节点数
|
||||||
for (int i = page * count; i < (pageResult.getTotal() > maxCount ? maxCount : pageResult.getTotal() ); i++) {
|
String parentId = channel.getParentId();
|
||||||
result.add((DeviceChannel)redis.get((String)deviceChannelList.get(i)));
|
if (!StringUtils.isEmpty(parentId)) {
|
||||||
}
|
|
||||||
pageResult.setData(result);
|
if (channelMap.get(parentId) == null) {
|
||||||
}
|
channelMap.put(parentId, new HashSet<>());
|
||||||
|
}
|
||||||
return pageResult;
|
channelMap.get(parentId).add(channelId);
|
||||||
}
|
|
||||||
|
DeviceChannel deviceChannel = queryChannel(deviceId, parentId);
|
||||||
@Override
|
if (deviceChannel != null) {
|
||||||
public List<DeviceChannel> queryChannelsByDeviceId(String deviceId) {
|
deviceChannel.setSubCount(channelMap.get(parentId).size());
|
||||||
List<DeviceChannel> result = new ArrayList<>();
|
redis.set(VideoManagerConstants.CACHEKEY_PREFIX+deviceId + "_" + deviceChannel.getChannelId(),
|
||||||
List<Object> deviceChannelList = redis.keys(VideoManagerConstants.CACHEKEY_PREFIX + deviceId + "_" + "*");
|
deviceChannel);
|
||||||
if (deviceChannelList != null && deviceChannelList.size() > 0 ) {
|
|
||||||
for (int i = 0; i < deviceChannelList.size(); i++) {
|
}
|
||||||
result.add((DeviceChannel)redis.get((String)deviceChannelList.get(i)));
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return result;
|
|
||||||
}
|
/**
|
||||||
|
* 获取设备
|
||||||
@Override
|
*
|
||||||
public DeviceChannel queryChannel(String deviceId, String channelId) {
|
* @param deviceId 设备ID
|
||||||
return (DeviceChannel)redis.get(VideoManagerConstants.CACHEKEY_PREFIX + deviceId + "_" + channelId);
|
* @return Device 设备对象
|
||||||
}
|
*/
|
||||||
|
@Override
|
||||||
|
public Device queryVideoDevice(String deviceId) {
|
||||||
/**
|
return (Device)redis.get(VideoManagerConstants.DEVICE_PREFIX+deviceId);
|
||||||
* 获取多个设备
|
}
|
||||||
*
|
|
||||||
* @param deviceIds 设备ID数组
|
@Override
|
||||||
* @return List<Device> 设备对象数组
|
public PageResult queryChannelsByDeviceId(String deviceId, String query, Boolean hasSubChannel, String online, int page, int count) {
|
||||||
*/
|
List<DeviceChannel> result = new ArrayList<>();
|
||||||
@Override
|
PageResult pageResult = new PageResult<DeviceChannel>();
|
||||||
public PageResult<Device> queryVideoDeviceList(String[] deviceIds, int page, int count) {
|
String queryContent = "*";
|
||||||
List<Device> devices = new ArrayList<>();
|
if (!StringUtils.isEmpty(query)) queryContent = String.format("*%S*",query);
|
||||||
PageResult pageResult = new PageResult<Device>();
|
String queryHasSubChannel = "*";
|
||||||
pageResult.setPage(page);
|
if (hasSubChannel != null) queryHasSubChannel = hasSubChannel?"true":"false";
|
||||||
pageResult.setCount(count);
|
String queryOnline = "*";
|
||||||
|
if (!StringUtils.isEmpty(online)) queryOnline = online;
|
||||||
if (deviceIds == null || deviceIds.length == 0) {
|
String queryStr = VideoManagerConstants.CACHEKEY_PREFIX + deviceId +
|
||||||
|
"_" + queryContent + // 搜索编号和名称
|
||||||
List<Object> deviceIdList = redis.keys(VideoManagerConstants.DEVICE_PREFIX+"*");
|
"_" + queryOnline + // 搜索是否在线
|
||||||
pageResult.setTotal(deviceIdList.size());
|
"_" + queryHasSubChannel + // 搜索是否含有子节点
|
||||||
int maxCount = (page + 1)* count;
|
"_" + "*";
|
||||||
for (int i = page * count; i < (pageResult.getTotal() > maxCount ? maxCount : pageResult.getTotal() ); i++) {
|
List<Object> deviceChannelList = redis.keys(queryStr);
|
||||||
devices.add((Device)redis.get((String)deviceIdList.get(i)));
|
pageResult.setPage(page);
|
||||||
}
|
pageResult.setCount(count);
|
||||||
} else {
|
pageResult.setTotal(deviceChannelList.size());
|
||||||
for (int i = 0; i < deviceIds.length; i++) {
|
int maxCount = (page + 1 ) * count;
|
||||||
devices.add((Device)redis.get(VideoManagerConstants.DEVICE_PREFIX+deviceIds[i]));
|
if (deviceChannelList != null && deviceChannelList.size() > 0 ) {
|
||||||
}
|
for (int i = page * count; i < (pageResult.getTotal() > maxCount ? maxCount : pageResult.getTotal() ); i++) {
|
||||||
}
|
result.add((DeviceChannel)redis.get((String)deviceChannelList.get(i)));
|
||||||
pageResult.setData(devices);
|
}
|
||||||
return pageResult;
|
pageResult.setData(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
return pageResult;
|
||||||
* 获取多个设备
|
}
|
||||||
*
|
|
||||||
* @param deviceIds 设备ID数组
|
@Override
|
||||||
* @return List<Device> 设备对象数组
|
public List<DeviceChannel> queryChannelsByDeviceId(String deviceId) {
|
||||||
*/
|
List<DeviceChannel> result = new ArrayList<>();
|
||||||
@Override
|
List<Object> deviceChannelList = redis.keys(VideoManagerConstants.CACHEKEY_PREFIX + deviceId + "_" + "*");
|
||||||
public List<Device> queryVideoDeviceList(String[] deviceIds) {
|
if (deviceChannelList != null && deviceChannelList.size() > 0 ) {
|
||||||
List<Device> devices = new ArrayList<>();
|
for (int i = 0; i < deviceChannelList.size(); i++) {
|
||||||
|
result.add((DeviceChannel)redis.get((String)deviceChannelList.get(i)));
|
||||||
if (deviceIds == null || deviceIds.length == 0) {
|
}
|
||||||
List<Object> deviceIdList = redis.keys(VideoManagerConstants.DEVICE_PREFIX+"*");
|
}
|
||||||
for (int i = 0; i < deviceIdList.size(); i++) {
|
return result;
|
||||||
devices.add((Device)redis.get((String)deviceIdList.get(i)));
|
}
|
||||||
}
|
|
||||||
} else {
|
@Override
|
||||||
for (int i = 0; i < deviceIds.length; i++) {
|
public PageResult querySubChannels(String deviceId, String parentChannelId, String query, Boolean hasSubChannel, String online, int page, int count) {
|
||||||
devices.add((Device)redis.get(VideoManagerConstants.DEVICE_PREFIX+deviceIds[i]));
|
List<DeviceChannel> allDeviceChannels = new ArrayList<>();
|
||||||
}
|
String queryContent = "*";
|
||||||
}
|
if (!StringUtils.isEmpty(query)) queryContent = String.format("*%S*",query);
|
||||||
return devices;
|
String queryHasSubChannel = "*";
|
||||||
}
|
if (hasSubChannel != null) queryHasSubChannel = hasSubChannel?"true":"false";
|
||||||
|
String queryOnline = "*";
|
||||||
/**
|
if (!StringUtils.isEmpty(online)) queryOnline = online;
|
||||||
* 删除设备
|
String queryStr = VideoManagerConstants.CACHEKEY_PREFIX + deviceId +
|
||||||
*
|
"_" + queryContent + // 搜索编号和名称
|
||||||
* @param deviceId 设备ID
|
"_" + queryOnline + // 搜索是否在线
|
||||||
* @return true:删除成功 false:删除失败
|
"_" + queryHasSubChannel + // 搜索是否含有子节点
|
||||||
*/
|
"_" + parentChannelId;
|
||||||
@Override
|
|
||||||
public boolean delete(String deviceId) {
|
List<Object> deviceChannelList = redis.keys(queryStr);
|
||||||
return redis.del(VideoManagerConstants.DEVICE_PREFIX+deviceId);
|
|
||||||
}
|
if (deviceChannelList != null && deviceChannelList.size() > 0 ) {
|
||||||
|
for (int i = 0; i < deviceChannelList.size(); i++) {
|
||||||
/**
|
DeviceChannel deviceChannel = (DeviceChannel)redis.get((String)deviceChannelList.get(i));
|
||||||
* 更新设备在线
|
if (deviceChannel.getParentId() != null && deviceChannel.getParentId().equals(parentChannelId)) {
|
||||||
*
|
allDeviceChannels.add(deviceChannel);
|
||||||
* @param deviceId 设备ID
|
}
|
||||||
* @return true:更新成功 false:更新失败
|
}
|
||||||
*/
|
}
|
||||||
@Override
|
int maxCount = (page + 1 ) * count;
|
||||||
public boolean online(String deviceId) {
|
PageResult pageResult = new PageResult<DeviceChannel>();
|
||||||
Device device = (Device)redis.get(VideoManagerConstants.DEVICE_PREFIX+deviceId);
|
pageResult.setPage(page);
|
||||||
device.setOnline(1);
|
pageResult.setCount(count);
|
||||||
return redis.set(VideoManagerConstants.DEVICE_PREFIX+device.getDeviceId(), device);
|
pageResult.setTotal(allDeviceChannels.size());
|
||||||
}
|
|
||||||
|
if (allDeviceChannels.size() > 0) {
|
||||||
/**
|
pageResult.setData(allDeviceChannels.subList(
|
||||||
* 更新设备离线
|
page * count, pageResult.getTotal() > maxCount ? maxCount : pageResult.getTotal()
|
||||||
*
|
));
|
||||||
* @param deviceId 设备ID
|
}
|
||||||
* @return true:更新成功 false:更新失败
|
return pageResult;
|
||||||
*/
|
}
|
||||||
@Override
|
|
||||||
public boolean outline(String deviceId) {
|
public List<DeviceChannel> querySubChannels(String deviceId, String parentChannelId) {
|
||||||
Device device = (Device)redis.get(VideoManagerConstants.DEVICE_PREFIX+deviceId);
|
List<DeviceChannel> allDeviceChannels = new ArrayList<>();
|
||||||
if (device == null) return false;
|
List<Object> deviceChannelList = redis.keys(VideoManagerConstants.CACHEKEY_PREFIX + deviceId + "_" + "*");
|
||||||
device.setOnline(0);
|
|
||||||
return redis.set(VideoManagerConstants.DEVICE_PREFIX+device.getDeviceId(), device);
|
if (deviceChannelList != null && deviceChannelList.size() > 0 ) {
|
||||||
}
|
for (int i = 0; i < deviceChannelList.size(); i++) {
|
||||||
|
DeviceChannel deviceChannel = (DeviceChannel)redis.get((String)deviceChannelList.get(i));
|
||||||
/**
|
if (deviceChannel.getParentId() != null && deviceChannel.getParentId().equals(parentChannelId)) {
|
||||||
* 开始播放时将流存入redis
|
allDeviceChannels.add(deviceChannel);
|
||||||
*
|
}
|
||||||
* @param deviceId 设备ID
|
}
|
||||||
* @param channelId 通道ID
|
}
|
||||||
* @return
|
|
||||||
*/
|
return allDeviceChannels;
|
||||||
@Override
|
}
|
||||||
public boolean startPlay(String deviceId, String channelId, StreamInfo stream) {
|
|
||||||
return redis.set(String.format("%S_%s_%s", VideoManagerConstants.PLAYER_PREFIX, deviceId, channelId),
|
@Override
|
||||||
stream);
|
public DeviceChannel queryChannel(String deviceId, String channelId) {
|
||||||
}
|
return (DeviceChannel)redis.get(VideoManagerConstants.CACHEKEY_PREFIX + deviceId + "_" + channelId + "_");
|
||||||
|
}
|
||||||
/**
|
|
||||||
* 停止播放时从redis删除
|
|
||||||
*
|
/**
|
||||||
* @param deviceId 设备ID
|
* 获取多个设备
|
||||||
* @param channelId 通道ID
|
*
|
||||||
* @return
|
* @param deviceIds 设备ID数组
|
||||||
*/
|
* @return List<Device> 设备对象数组
|
||||||
@Override
|
*/
|
||||||
public boolean stopPlay(String deviceId, String channelId) {
|
@Override
|
||||||
return redis.del(String.format("%S_%s_%s", VideoManagerConstants.PLAYER_PREFIX, deviceId, channelId));
|
public PageResult<Device> queryVideoDeviceList(String[] deviceIds, int page, int count) {
|
||||||
}
|
List<Device> devices = new ArrayList<>();
|
||||||
|
PageResult pageResult = new PageResult<Device>();
|
||||||
/**
|
pageResult.setPage(page);
|
||||||
* 查询播放列表
|
pageResult.setCount(count);
|
||||||
* @param deviceId 设备ID
|
|
||||||
* @param channelId 通道ID
|
if (deviceIds == null || deviceIds.length == 0) {
|
||||||
* @return
|
|
||||||
*/
|
List<Object> deviceIdList = redis.keys(VideoManagerConstants.DEVICE_PREFIX+"*");
|
||||||
@Override
|
pageResult.setTotal(deviceIdList.size());
|
||||||
public StreamInfo queryPlay(String deviceId, String channelId) {
|
int maxCount = (page + 1)* count;
|
||||||
return (StreamInfo)redis.get(String.format("%S_%s_%s", VideoManagerConstants.PLAYER_PREFIX, deviceId, channelId));
|
for (int i = page * count; i < (pageResult.getTotal() > maxCount ? maxCount : pageResult.getTotal() ); i++) {
|
||||||
}
|
devices.add((Device)redis.get((String)deviceIdList.get(i)));
|
||||||
|
}
|
||||||
/**
|
} else {
|
||||||
* 更新流媒体信息
|
for (int i = 0; i < deviceIds.length; i++) {
|
||||||
* @param mediaServerConfig
|
devices.add((Device)redis.get(VideoManagerConstants.DEVICE_PREFIX+deviceIds[i]));
|
||||||
* @return
|
}
|
||||||
*/
|
}
|
||||||
@Override
|
pageResult.setData(devices);
|
||||||
public boolean updateMediaInfo(MediaServerConfig mediaServerConfig) {
|
return pageResult;
|
||||||
return redis.set(VideoManagerConstants.MEDIA_SERVER_PREFIX,mediaServerConfig);
|
}
|
||||||
}
|
|
||||||
|
/**
|
||||||
/**
|
* 获取多个设备
|
||||||
* 获取流媒体信息
|
*
|
||||||
* @return
|
* @param deviceIds 设备ID数组
|
||||||
*/
|
* @return List<Device> 设备对象数组
|
||||||
@Override
|
*/
|
||||||
public MediaServerConfig getMediaInfo() {
|
@Override
|
||||||
return (MediaServerConfig)redis.get(VideoManagerConstants.MEDIA_SERVER_PREFIX);
|
public List<Device> queryVideoDeviceList(String[] deviceIds) {
|
||||||
}
|
List<Device> devices = new ArrayList<>();
|
||||||
}
|
|
||||||
|
if (deviceIds == null || deviceIds.length == 0) {
|
||||||
|
List<Object> deviceIdList = redis.keys(VideoManagerConstants.DEVICE_PREFIX+"*");
|
||||||
|
for (int i = 0; i < deviceIdList.size(); i++) {
|
||||||
|
devices.add((Device)redis.get((String)deviceIdList.get(i)));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
for (int i = 0; i < deviceIds.length; i++) {
|
||||||
|
devices.add((Device)redis.get(VideoManagerConstants.DEVICE_PREFIX+deviceIds[i]));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return devices;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除设备
|
||||||
|
*
|
||||||
|
* @param deviceId 设备ID
|
||||||
|
* @return true:删除成功 false:删除失败
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public boolean delete(String deviceId) {
|
||||||
|
return redis.del(VideoManagerConstants.DEVICE_PREFIX+deviceId);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新设备在线
|
||||||
|
*
|
||||||
|
* @param deviceId 设备ID
|
||||||
|
* @return true:更新成功 false:更新失败
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public boolean online(String deviceId) {
|
||||||
|
Device device = (Device)redis.get(VideoManagerConstants.DEVICE_PREFIX+deviceId);
|
||||||
|
device.setOnline(1);
|
||||||
|
return redis.set(VideoManagerConstants.DEVICE_PREFIX+device.getDeviceId(), device);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新设备离线
|
||||||
|
*
|
||||||
|
* @param deviceId 设备ID
|
||||||
|
* @return true:更新成功 false:更新失败
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public boolean outline(String deviceId) {
|
||||||
|
Device device = (Device)redis.get(VideoManagerConstants.DEVICE_PREFIX+deviceId);
|
||||||
|
if (device == null) return false;
|
||||||
|
device.setOnline(0);
|
||||||
|
return redis.set(VideoManagerConstants.DEVICE_PREFIX+device.getDeviceId(), device);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 开始播放时将流存入redis
|
||||||
|
*
|
||||||
|
* @param deviceId 设备ID
|
||||||
|
* @param channelId 通道ID
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public boolean startPlay(String deviceId, String channelId, StreamInfo stream) {
|
||||||
|
return redis.set(String.format("%S_%s_%s", VideoManagerConstants.PLAYER_PREFIX, deviceId, channelId),
|
||||||
|
stream);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 停止播放时从redis删除
|
||||||
|
*
|
||||||
|
* @param deviceId 设备ID
|
||||||
|
* @param channelId 通道ID
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public boolean stopPlay(String deviceId, String channelId) {
|
||||||
|
return redis.del(String.format("%S_%s_%s", VideoManagerConstants.PLAYER_PREFIX, deviceId, channelId));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询播放列表
|
||||||
|
* @param deviceId 设备ID
|
||||||
|
* @param channelId 通道ID
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public StreamInfo queryPlay(String deviceId, String channelId) {
|
||||||
|
return (StreamInfo)redis.get(String.format("%S_%s_%s", VideoManagerConstants.PLAYER_PREFIX, deviceId, channelId));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新流媒体信息
|
||||||
|
* @param mediaServerConfig
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public boolean updateMediaInfo(MediaServerConfig mediaServerConfig) {
|
||||||
|
return redis.set(VideoManagerConstants.MEDIA_SERVER_PREFIX,mediaServerConfig);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取流媒体信息
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public MediaServerConfig getMediaInfo() {
|
||||||
|
return (MediaServerConfig)redis.get(VideoManagerConstants.MEDIA_SERVER_PREFIX);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateCatch() {
|
||||||
|
deviceMap = new HashMap<>();
|
||||||
|
// 更新设备
|
||||||
|
List<Device> devices = queryVideoDeviceList(null);
|
||||||
|
if (devices == null && devices.size() == 0) return;
|
||||||
|
for (Device device : devices) {
|
||||||
|
// 更新设备下的通道
|
||||||
|
HashMap<String, HashSet<String>> channelMap = new HashMap<String, HashSet<String>>();
|
||||||
|
List<Object> deviceChannelList = redis.keys(VideoManagerConstants.CACHEKEY_PREFIX +
|
||||||
|
device.getDeviceId() + "_" + "*");
|
||||||
|
if (deviceChannelList != null && deviceChannelList.size() > 0 ) {
|
||||||
|
for (int i = 0; i < deviceChannelList.size(); i++) {
|
||||||
|
String key = (String)deviceChannelList.get(i);
|
||||||
|
String[] s = key.split("_");
|
||||||
|
String channelId = s[3];
|
||||||
|
HashSet<String> subChannel = channelMap.get(channelId);
|
||||||
|
if (subChannel == null) {
|
||||||
|
subChannel = new HashSet<>();
|
||||||
|
}
|
||||||
|
if (s.length > 4) {
|
||||||
|
subChannel.add(s[4]);
|
||||||
|
}
|
||||||
|
channelMap.put(channelId, subChannel);
|
||||||
|
System.out.println();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
deviceMap.put(device.getDeviceId(),channelMap);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -9,12 +9,7 @@ import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.web.bind.annotation.CrossOrigin;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
import org.springframework.web.context.request.async.DeferredResult;
|
import org.springframework.web.context.request.async.DeferredResult;
|
||||||
|
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
@ -72,12 +67,17 @@ public class DeviceController {
|
||||||
* @return 通道列表
|
* @return 通道列表
|
||||||
*/
|
*/
|
||||||
@GetMapping("devices/{deviceId}/channels")
|
@GetMapping("devices/{deviceId}/channels")
|
||||||
public ResponseEntity<PageResult> channels(@PathVariable String deviceId, int page, int count){
|
public ResponseEntity<PageResult> channels(@PathVariable String deviceId,
|
||||||
|
int page, int count,
|
||||||
|
@RequestParam(required = false) String query,
|
||||||
|
@RequestParam(required = false) String online,
|
||||||
|
@RequestParam(required = false) Boolean channelType
|
||||||
|
){
|
||||||
|
|
||||||
if (logger.isDebugEnabled()) {
|
if (logger.isDebugEnabled()) {
|
||||||
logger.debug("查询所有视频设备API调用");
|
logger.debug("查询所有视频设备API调用");
|
||||||
}
|
}
|
||||||
PageResult pageResult = storager.queryChannelsByDeviceId(deviceId, page, count);
|
PageResult pageResult = storager.queryChannelsByDeviceId(deviceId, query, channelType, online, page, count);
|
||||||
return new ResponseEntity<>(pageResult,HttpStatus.OK);
|
return new ResponseEntity<>(pageResult,HttpStatus.OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -115,4 +115,33 @@ public class DeviceController {
|
||||||
return new ResponseEntity<String>("设备预览API调用失败!", HttpStatus.INTERNAL_SERVER_ERROR);
|
return new ResponseEntity<String>("设备预览API调用失败!", HttpStatus.INTERNAL_SERVER_ERROR);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询通道数
|
||||||
|
* @param channelId 通道id
|
||||||
|
* @param page 当前页
|
||||||
|
* @param count 每页条数
|
||||||
|
* @return 子通道列表
|
||||||
|
*/
|
||||||
|
@GetMapping("subChannels/{deviceId}/{channelId}/channels")
|
||||||
|
public ResponseEntity<PageResult> subChannels(@PathVariable String deviceId,
|
||||||
|
@PathVariable String channelId,
|
||||||
|
int page,
|
||||||
|
int count,
|
||||||
|
@RequestParam(required = false) String query,
|
||||||
|
@RequestParam(required = false) String online,
|
||||||
|
@RequestParam(required = false) Boolean channelType){
|
||||||
|
|
||||||
|
if (logger.isDebugEnabled()) {
|
||||||
|
logger.debug("查询所有视频设备API调用");
|
||||||
|
}
|
||||||
|
DeviceChannel deviceChannel = storager.queryChannel(deviceId,channelId);
|
||||||
|
if (deviceChannel == null) {
|
||||||
|
PageResult<DeviceChannel> deviceChannelPageResult = new PageResult<>();
|
||||||
|
new ResponseEntity<>(deviceChannelPageResult,HttpStatus.OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
PageResult pageResult = storager.querySubChannels(deviceId, channelId, query, channelType, online, page, count);
|
||||||
|
return new ResponseEntity<>(pageResult,HttpStatus.OK);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -68,7 +68,7 @@ public class ApiDeviceController {
|
||||||
devices = storager.queryVideoDeviceList(null);
|
devices = storager.queryVideoDeviceList(null);
|
||||||
result.put("DeviceCount", devices.size());
|
result.put("DeviceCount", devices.size());
|
||||||
}else {
|
}else {
|
||||||
PageResult<Device> deviceList = storager.queryVideoDeviceList(null, start, limit);
|
PageResult<Device> deviceList = storager.queryVideoDeviceList(null, start/limit, limit);
|
||||||
result.put("DeviceCount", deviceList.getTotal());
|
result.put("DeviceCount", deviceList.getTotal());
|
||||||
devices = deviceList.getData();
|
devices = deviceList.getData();
|
||||||
}
|
}
|
||||||
|
@ -123,7 +123,7 @@ public class ApiDeviceController {
|
||||||
deviceChannels = storager.queryChannelsByDeviceId(serial);
|
deviceChannels = storager.queryChannelsByDeviceId(serial);
|
||||||
result.put("ChannelCount", deviceChannels.size());
|
result.put("ChannelCount", deviceChannels.size());
|
||||||
}else {
|
}else {
|
||||||
PageResult<DeviceChannel> pageResult = storager.queryChannelsByDeviceId(serial, start, limit);
|
PageResult<DeviceChannel> pageResult = storager.queryChannelsByDeviceId(serial, null, null, null,start/limit, limit);
|
||||||
result.put("ChannelCount", pageResult.getTotal());
|
result.put("ChannelCount", pageResult.getTotal());
|
||||||
deviceChannels = pageResult.getData();
|
deviceChannels = pageResult.getData();
|
||||||
}
|
}
|
||||||
|
@ -139,7 +139,7 @@ public class ApiDeviceController {
|
||||||
deviceJOSNChannel.put("Name", deviceChannel.getName());
|
deviceJOSNChannel.put("Name", deviceChannel.getName());
|
||||||
deviceJOSNChannel.put("Custom", false);
|
deviceJOSNChannel.put("Custom", false);
|
||||||
deviceJOSNChannel.put("CustomName", "");
|
deviceJOSNChannel.put("CustomName", "");
|
||||||
deviceJOSNChannel.put("SubCount", 0); // TODO ? 子节点数, SubCount > 0 表示该通道为子目录
|
deviceJOSNChannel.put("SubCount", deviceChannel.getSubCount()); // TODO ? 子节点数, SubCount > 0 表示该通道为子目录
|
||||||
deviceJOSNChannel.put("SnapURL", "");
|
deviceJOSNChannel.put("SnapURL", "");
|
||||||
deviceJOSNChannel.put("Manufacturer ", deviceChannel.getManufacture());
|
deviceJOSNChannel.put("Manufacturer ", deviceChannel.getManufacture());
|
||||||
deviceJOSNChannel.put("Model", deviceChannel.getModel());
|
deviceJOSNChannel.put("Model", deviceChannel.getModel());
|
||||||
|
|
|
@ -12,7 +12,7 @@ spring:
|
||||||
port: 6379
|
port: 6379
|
||||||
database: 6
|
database: 6
|
||||||
#访问密码,若你的redis服务器没有设置密码,就不需要用密码去连接
|
#访问密码,若你的redis服务器没有设置密码,就不需要用密码去连接
|
||||||
password:
|
password: 4767cb971b40a1300fa09b7f87b09d1c
|
||||||
#超时时间
|
#超时时间
|
||||||
timeout: 10000
|
timeout: 10000
|
||||||
datasource:
|
datasource:
|
||||||
|
@ -31,8 +31,8 @@ sip:
|
||||||
# 根据国标6.1.2中规定,domain宜采用ID统一编码的前十位编码。国标附录D中定义前8位为中心编码(由省级、市级、区级、基层编号组成,参照GB/T 2260-2007)
|
# 根据国标6.1.2中规定,domain宜采用ID统一编码的前十位编码。国标附录D中定义前8位为中心编码(由省级、市级、区级、基层编号组成,参照GB/T 2260-2007)
|
||||||
# 后两位为行业编码,定义参照附录D.3
|
# 后两位为行业编码,定义参照附录D.3
|
||||||
# 3701020049标识山东济南历下区 信息行业接入
|
# 3701020049标识山东济南历下区 信息行业接入
|
||||||
domain: 3701020049
|
domain: 3402000000
|
||||||
id: 37010200492000000001
|
id: 34020000002000000001
|
||||||
# 默认设备认证密码,后续扩展使用设备单独密码
|
# 默认设备认证密码,后续扩展使用设备单独密码
|
||||||
password: 12345678
|
password: 12345678
|
||||||
media:
|
media:
|
||||||
|
|
Loading…
Reference in New Issue