国标级联--选择通道003-前端页面

This commit is contained in:
panlinlin
2021-01-10 20:14:11 +08:00
parent 7ed4a26be6
commit 658bec3ecc
15 changed files with 397 additions and 90 deletions

View File

@@ -8,7 +8,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class VManageBootstrap extends LogManager {
public static void main(String[] args) {
public static void main(String[] args) {
SpringApplication.run(VManageBootstrap.class, args);
}
}

View File

@@ -77,6 +77,9 @@ public class SIPCommander implements ISIPCommander {
@Value("${media.seniorSdp}")
private boolean seniorSdp;
@Value("${media.autoApplyPlay}")
private boolean autoApplyPlay;
@Autowired
private ZLMHttpHookSubscribe subscribe;
@@ -287,8 +290,12 @@ public class SIPCommander implements ISIPCommander {
@Override
public void playStreamCmd(Device device, String channelId, ZLMHttpHookSubscribe.Event event, SipSubscribe.Event errorEvent) {
try {
String ssrc = streamSession.createPlaySsrc();
String ssrc = "";
if (rtpEnable) {
ssrc = String.format("gb_play_%s_%s", device.getDeviceId(), channelId);
}else {
ssrc = streamSession.createPlaySsrc();
}
String streamId = null;
if (rtpEnable) {
streamId = String.format("gb_play_%s_%s", device.getDeviceId(), channelId);
@@ -408,7 +415,12 @@ public class SIPCommander implements ISIPCommander {
, SipSubscribe.Event errorEvent) {
try {
MediaServerConfig mediaInfo = redisCatchStorage.getMediaInfo();
String ssrc = streamSession.createPlayBackSsrc();
String ssrc = null;
if (rtpEnable) {
ssrc = String.format("gb_playback_%s_%s", device.getDeviceId(), channelId);
}else {
ssrc = streamSession.createPlayBackSsrc();
}
String streamId = String.format("%08x", Integer.parseInt(ssrc)).toUpperCase();
// 添加订阅
JSONObject subscribeKey = new JSONObject();

View File

@@ -82,13 +82,10 @@ public class ZLMHttpHookListener {
@ResponseBody
@PostMapping(value = "/on_flow_report", produces = "application/json;charset=UTF-8")
public ResponseEntity<String> onFlowReport(@RequestBody JSONObject json){
if (logger.isDebugEnabled()) {
logger.debug("ZLM HOOK on_flow_report API调用参数" + json.toString());
}
logger.debug("ZLM HOOK on_flow_report API调用参数" + json.toString());
// TODO Auto-generated method stub
JSONObject ret = new JSONObject();
ret.put("code", 0);
ret.put("msg", "success");
@@ -234,8 +231,13 @@ public class ZLMHttpHookListener {
if (logger.isDebugEnabled()) {
logger.debug("ZLM HOOK on_shell_login API调用参数" + json.toString());
}
// TODO Auto-generated method stub
// TODO 如果是带有rtpstream则开启按需拉流
String app = json.getString("app");
String stream = json.getString("stream");
ZLMHttpHookSubscribe.Event subscribe = this.subscribe.getSubscribe(ZLMHttpHookSubscribe.HookType.on_publish, json);
if (subscribe != null) subscribe.response(json);
JSONObject ret = new JSONObject();
ret.put("code", 0);
ret.put("msg", "success");

View File

@@ -7,7 +7,11 @@ import com.genersoft.iot.vmp.common.StreamInfo;
import com.genersoft.iot.vmp.gb28181.bean.Device;
import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel;
import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform;
import com.genersoft.iot.vmp.vmanager.platform.bean.ChannelReduce;
import com.github.pagehelper.PageInfo;
import gov.nist.javax.sip.stack.NioTcpMessageProcessor;
import javax.swing.event.ChangeEvent;
/**
* @Description:视频设备数据存储接口
@@ -200,4 +204,18 @@ public interface IVideoManagerStorager {
* 所有平台离线
*/
void outlineForAllParentPlatform();
/**
* 查询通道信息, 不区分设备
*/
PageInfo<ChannelReduce> queryChannelListInAll(int page, int count, String query, Boolean online, Boolean channelType, String parentChannelId);
/**
* 更新上级平台的通道信息
* @param platformId
* @param channelReduces
* @return
*/
int updateChannelForGB(String platformId, List<ChannelReduce> channelReduces);
}

View File

@@ -1,6 +1,8 @@
package com.genersoft.iot.vmp.storager.dao;
import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel;
import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform;
import com.genersoft.iot.vmp.vmanager.platform.bean.ChannelReduce;
import org.apache.ibatis.annotations.*;
import java.util.List;
@@ -82,4 +84,22 @@ public interface DeviceChannelMapper {
@Update(value = {"UPDATE device_channel SET streamId=#{streamId} WHERE deviceId=#{deviceId} AND channelId=#{channelId}"})
void startPlay(String deviceId, String channelId, String streamId);
@Select(value = {" <script>" +
"SELECT * FROM ( "+
" SELECT dc.channelId, dc.deviceId, dc.name, de.manufacturer, de.hostAddress, " +
"(SELECT count(0) FROM device_channel WHERE parentId=dc.channelId) as subCount " +
"FROM device_channel dc LEFT JOIN device de ON dc.deviceId = de.deviceId" +
" WHERE 1=1 " +
" <if test=\"query != null\"> AND (dc.channelId LIKE '%${query}%' OR dc.name LIKE '%${query}%' OR dc.name LIKE '%${query}%')</if> " +
" <if test=\"parentChannelId != null\"> AND dc.parentId=#{parentChannelId} </if> " +
" <if test=\"online == true\" > AND dc.status=1</if>" +
" <if test=\"online == false\" > AND dc.status=0</if>) dcr" +
" WHERE 1=1 " +
" <if test=\"hasSubChannel == true\" > AND subCount >0</if>" +
" <if test=\"hasSubChannel == false\" > AND subCount=0</if>" +
" </script>"})
List<ChannelReduce> queryChannelListInAll(String query, Boolean online, Boolean hasSubChannel, String parentChannelId);
}

View File

@@ -0,0 +1,7 @@
package com.genersoft.iot.vmp.storager.dao;
import org.mapstruct.Mapper;
@Mapper
public interface patformChannelMapper {
}

View File

@@ -9,6 +9,7 @@ import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
import com.genersoft.iot.vmp.storager.dao.DeviceChannelMapper;
import com.genersoft.iot.vmp.storager.dao.DeviceMapper;
import com.genersoft.iot.vmp.storager.dao.ParentPlatformMapper;
import com.genersoft.iot.vmp.vmanager.platform.bean.ChannelReduce;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
@@ -16,6 +17,7 @@ import org.springframework.stereotype.Component;
import com.genersoft.iot.vmp.gb28181.bean.Device;
import com.genersoft.iot.vmp.storager.IVideoManagerStorager;
import org.springframework.transaction.annotation.Transactional;
/**
* @Description:视频设备数据存储-jdbc实现
@@ -270,4 +272,20 @@ public class VideoManagerStoragerImpl implements IVideoManagerStorager {
public void outlineForAllParentPlatform() {
platformMapper.outlineForAllParentPlatform();
}
@Override
public PageInfo<ChannelReduce> queryChannelListInAll(int page, int count, String query, Boolean online,
Boolean channelType, String parentChannelId) {
PageHelper.startPage(page, count);
List<ChannelReduce> all = deviceChannelMapper.queryChannelListInAll(query, online, channelType, parentChannelId);
return new PageInfo<>(all);
}
@Transactional
@Override
public int updateChannelForGB(String platformId, List<ChannelReduce> channelReduces) {
return 0;
}
}

View File

@@ -61,13 +61,6 @@ public class DeviceController {
return storager.queryVideoDeviceList(page, count);
}
/**
* 分页查询通道数
* @param deviceId 设备id
* @param page 当前页
* @param count 每页条数
* @return 通道列表
*/
/**
* 分页查询通道数
*

View File

@@ -1,10 +1,13 @@
package com.genersoft.iot.vmp.vmanager.platform;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform;
import com.genersoft.iot.vmp.gb28181.transmit.cmd.ISIPCommanderForPlatform;
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
import com.genersoft.iot.vmp.storager.IVideoManagerStorager;
import com.genersoft.iot.vmp.vmanager.platform.bean.ChannelReduce;
import com.genersoft.iot.vmp.vmanager.platform.bean.UpdateChannelParam;
import com.github.pagehelper.PageInfo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -15,6 +18,9 @@ import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.*;
import com.genersoft.iot.vmp.conf.SipConfig;
import java.util.List;
import java.util.Map;
@CrossOrigin
@RestController
@@ -142,5 +148,34 @@ public class PlatformController {
return new ResponseEntity<>(String.valueOf(parentPlatform != null), HttpStatus.OK);
}
@RequestMapping("/platforms/channelList")
@ResponseBody
public PageInfo<ChannelReduce> channelList(int page, int count,
@RequestParam(required = false) String query,
@RequestParam(required = false) Boolean online,
@RequestParam(required = false) Boolean channelType){
if (logger.isDebugEnabled()) {
logger.debug("查询所有所有通道API调用");
}
PageInfo<ChannelReduce> channelReduces = storager.queryChannelListInAll(page, count, query, online, channelType, null);
return channelReduces;
}
@RequestMapping("/platforms/updateChannelForGB")
@ResponseBody
public ResponseEntity<String> updateChannelForGB(@RequestBody UpdateChannelParam param){
if (logger.isDebugEnabled()) {
logger.debug("给上级平台添加国标通道API调用");
}
int result = storager.updateChannelForGB(param.getPlatformId(), param.getChannelReduces());
return new ResponseEntity<>(String.valueOf(result > 0), HttpStatus.OK);
}
}

View File

@@ -0,0 +1,78 @@
package com.genersoft.iot.vmp.vmanager.platform.bean;
/**
* 精简的channel信息展示主要是选择通道的时候展示列表使用
*/
public class ChannelReduce {
/**
* 通道id
*/
private String channelId;
/**
* 设备id
*/
private String deviceId;
/**
* 通道名
*/
private String name;
/**
* 生产厂商
*/
private String manufacturer;
/**
* wan地址
*/
private String hostAddress;
/**
* 子节点数
*/
private int subCount;
public String getChannelId() {
return channelId;
}
public void setChannelId(String channelId) {
this.channelId = channelId;
}
public String getDeviceId() {
return deviceId;
}
public void setDeviceId(String deviceId) {
this.deviceId = deviceId;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getManufacturer() {
return manufacturer;
}
public void setManufacturer(String manufacturer) {
this.manufacturer = manufacturer;
}
public String getHostAddress() {
return hostAddress;
}
public void setHostAddress(String hostAddress) {
this.hostAddress = hostAddress;
}
}

View File

@@ -0,0 +1,24 @@
package com.genersoft.iot.vmp.vmanager.platform.bean;
import java.util.List;
public class UpdateChannelParam {
private String platformId;
private List<ChannelReduce> channelReduces;
public String getPlatformId() {
return platformId;
}
public void setPlatformId(String platformId) {
this.platformId = platformId;
}
public List<ChannelReduce> getChannelReduces() {
return channelReduces;
}
public void setChannelReduces(List<ChannelReduce> channelReduces) {
this.channelReduces = channelReduces;
}
}