Merge remote-tracking branch 'origin/dev/master-通道结构重构' into dev/master-通道结构重构

This commit is contained in:
648540858
2024-08-12 09:55:10 +08:00
83 changed files with 747 additions and 787 deletions

View File

@@ -1,7 +1,7 @@
package com.genersoft.iot.vmp.conf;
import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform;
import com.genersoft.iot.vmp.gb28181.bean.ParentPlatformCatch;
import com.genersoft.iot.vmp.gb28181.bean.Platform;
import com.genersoft.iot.vmp.gb28181.bean.PlatformCatch;
import com.genersoft.iot.vmp.gb28181.transmit.cmd.ISIPCommanderForPlatform;
import com.genersoft.iot.vmp.gb28181.service.IPlatformService;
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
@@ -38,14 +38,14 @@ public class SipPlatformRunner implements CommandLineRunner {
@Override
public void run(String... args) throws Exception {
// 获取所有启用的平台
List<ParentPlatform> parentPlatforms = storager.queryEnableParentPlatformList(true);
List<Platform> parentPlatforms = storager.queryEnableParentPlatformList(true);
for (ParentPlatform parentPlatform : parentPlatforms) {
for (Platform parentPlatform : parentPlatforms) {
ParentPlatformCatch parentPlatformCatchOld = redisCatchStorage.queryPlatformCatchInfo(parentPlatform.getServerGBId());
PlatformCatch parentPlatformCatchOld = redisCatchStorage.queryPlatformCatchInfo(parentPlatform.getServerGBId());
// 更新缓存
ParentPlatformCatch parentPlatformCatch = new ParentPlatformCatch();
PlatformCatch parentPlatformCatch = new PlatformCatch();
parentPlatformCatch.setParentPlatform(parentPlatform);
parentPlatformCatch.setId(parentPlatform.getServerGBId());
redisCatchStorage.updatePlatformCatchInfo(parentPlatformCatch);

View File

@@ -342,4 +342,18 @@ public class CommonGBChannel {
return channel;
}
public static CommonGBChannel build(Platform platform) {
CommonGBChannel commonGBChannel = new CommonGBChannel();
commonGBChannel.setGbDeviceId(platform.getDeviceGBId());
commonGBChannel.setGbName(platform.getName());
commonGBChannel.setGbManufacturer(platform.getManufacturer());
commonGBChannel.setGbModel(platform.getModel());
commonGBChannel.setGbCivilCode(platform.getCivilCode());
commonGBChannel.setGbAddress(platform.getAddress());
commonGBChannel.setGbRegisterWay(platform.getRegisterWay());
commonGBChannel.setGbSecrecy(platform.getSecrecy());
commonGBChannel.setGbStatus(platform.getStatus());
return commonGBChannel;
}
}

View File

@@ -1,68 +0,0 @@
package com.genersoft.iot.vmp.gb28181.bean;
public class ParentPlatformCatch {
private String id;
/**
* 心跳未回复次数
*/
private int keepAliveReply;
// 注册未回复次数
private int registerAliveReply;
private String callId;
private ParentPlatform parentPlatform;
private SipTransactionInfo sipTransactionInfo;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public int getKeepAliveReply() {
return keepAliveReply;
}
public void setKeepAliveReply(int keepAliveReply) {
this.keepAliveReply = keepAliveReply;
}
public int getRegisterAliveReply() {
return registerAliveReply;
}
public void setRegisterAliveReply(int registerAliveReply) {
this.registerAliveReply = registerAliveReply;
}
public ParentPlatform getParentPlatform() {
return parentPlatform;
}
public void setParentPlatform(ParentPlatform parentPlatform) {
this.parentPlatform = parentPlatform;
}
public String getCallId() {
return callId;
}
public void setCallId(String callId) {
this.callId = callId;
}
public SipTransactionInfo getSipTransactionInfo() {
return sipTransactionInfo;
}
public void setSipTransactionInfo(SipTransactionInfo sipTransactionInfo) {
this.sipTransactionInfo = sipTransactionInfo;
}
}

View File

@@ -8,7 +8,7 @@ import lombok.Data;
*/
@Data
@Schema(description = "平台信息")
public class ParentPlatform {
public class Platform {
@Schema(description = "ID(数据库中)")
private Integer id;
@@ -70,9 +70,6 @@ public class ParentPlatform {
@Schema(description = "在线状态")
private int channelCount;
@Schema(description = "默认目录Id,自动添加的通道多放在这个目录下")
private String catalogId;
@Schema(description = "已被订阅目录信息")
private boolean catalogSubscribe;
@@ -82,9 +79,6 @@ public class ParentPlatform {
@Schema(description = "已被订阅移动位置信息")
private boolean mobilePositionSubscribe;
@Schema(description = "点播未推流的设备时是否使用redis通知拉起")
private boolean startOfflinePush;
@Schema(description = "目录分组-每次向上级发送通道信息时单个包携带的通道数量取值1,2,4,8")
private int catalogGroup;
@@ -97,12 +91,46 @@ public class ParentPlatform {
@Schema(description = "是否作为消息通道")
private boolean asMessageChannel;
@Schema(description = "点播回复200OK使用IP")
@Schema(description = "点播回复200OK使用IP")
private String sendStreamIp;
@Schema(description = "是否使用自定义业务分组")
private Boolean customCatalog;
private Boolean customGroup;
@Schema(description = "是否自动推送通道变化")
private Boolean autoPushChannel;
@Schema(description = "目录信息包含平台信息")
private Boolean catalogWithPlatform;
@Schema(description = "目录信息包含分组信息")
private Boolean catalogWithGroup;
@Schema(description = "目录信息包含行政区划")
private Boolean catalogWithRegion;
@Schema(description = "行政区划")
private String civilCode;
@Schema(description = "平台厂商")
private String manufacturer;
@Schema(description = "平台型号")
private String model;
@Schema(description = "平台安装地址")
private String address;
@Schema(description = "注册方式必选缺省为1 " +
"1-符合IETF RFC 3261标准的认证注册模式" +
"2-基于口令的双向认证注册模式;" +
"3-基于数字证书的双向认证注册模式(高安全级别要求)" +
"4-基于数字证书的单向认证注册模式(高安全级别要求)")
private int registerWay = 1;
@Schema(description = "保密属性必选缺省为00-不涉密1-涉密")
private int secrecy = 0;
@Schema(description = "在线状态")
private String Status = "ON";
}

View File

@@ -0,0 +1,24 @@
package com.genersoft.iot.vmp.gb28181.bean;
import lombok.Data;
@Data
public class PlatformCatch {
private String id;
/**
* 心跳未回复次数
*/
private int keepAliveReply;
// 注册未回复次数
private int registerAliveReply;
private String callId;
private Platform parentPlatform;
private SipTransactionInfo sipTransactionInfo;
}

View File

@@ -7,7 +7,7 @@ import javax.sip.RequestEvent;
public class SipMsgInfo {
private RequestEvent evt;
private Device device;
private ParentPlatform platform;
private Platform platform;
private Element rootElement;
public SipMsgInfo(RequestEvent evt, Device device, Element rootElement) {
@@ -16,7 +16,7 @@ public class SipMsgInfo {
this.rootElement = rootElement;
}
public SipMsgInfo(RequestEvent evt, ParentPlatform platform, Element rootElement) {
public SipMsgInfo(RequestEvent evt, Platform platform, Element rootElement) {
this.evt = evt;
this.platform = platform;
this.rootElement = rootElement;
@@ -38,11 +38,11 @@ public class SipMsgInfo {
this.device = device;
}
public ParentPlatform getPlatform() {
public Platform getPlatform() {
return platform;
}
public void setPlatform(ParentPlatform platform) {
public void setPlatform(Platform platform) {
this.platform = platform;
}

View File

@@ -4,7 +4,7 @@ import com.genersoft.iot.vmp.conf.exception.ControllerException;
import com.genersoft.iot.vmp.conf.security.JwtUtils;
import com.genersoft.iot.vmp.gb28181.bean.Device;
import com.genersoft.iot.vmp.gb28181.bean.DeviceAlarm;
import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform;
import com.genersoft.iot.vmp.gb28181.bean.Platform;
import com.genersoft.iot.vmp.gb28181.transmit.cmd.ISIPCommander;
import com.genersoft.iot.vmp.gb28181.transmit.cmd.ISIPCommanderForPlatform;
import com.genersoft.iot.vmp.gb28181.service.IDeviceAlarmService;
@@ -99,8 +99,8 @@ public class AlarmController {
@Operation(summary = "测试向上级/设备发送模拟报警通知", security = @SecurityRequirement(name = JwtUtils.HEADER))
@Parameter(name = "deviceId", description = "设备国标编号")
public void delete(@RequestParam String deviceId) {
Device device = deviceService.getDevice(deviceId);
ParentPlatform platform = storage.queryParentPlatByServerGBId(deviceId);
Device device = deviceService.getDeviceByDeviceId(deviceId);
Platform platform = storage.queryParentPlatByServerGBId(deviceId);
DeviceAlarm deviceAlarm = new DeviceAlarm();
deviceAlarm.setChannelId(deviceId);
deviceAlarm.setAlarmDescription("test");

View File

@@ -77,7 +77,7 @@ public class DeviceConfig {
if (log.isDebugEnabled()) {
log.debug("报警复位API调用");
}
Device device = deviceService.getDevice(deviceId);
Device device = deviceService.getDeviceByDeviceId(deviceId);
String uuid = UUID.randomUUID().toString();
String key = DeferredResultHolder.CALLBACK_CMD_DEVICECONFIG + deviceId + channelId;
try {
@@ -130,7 +130,7 @@ public class DeviceConfig {
}
String key = DeferredResultHolder.CALLBACK_CMD_CONFIGDOWNLOAD + (ObjectUtils.isEmpty(channelId) ? deviceId : channelId);
String uuid = UUID.randomUUID().toString();
Device device = deviceService.getDevice(deviceId);
Device device = deviceService.getDeviceByDeviceId(deviceId);
try {
cmder.deviceConfigQuery(device, channelId, configType, event -> {
RequestMessage msg = new RequestMessage();

View File

@@ -59,7 +59,7 @@ public class DeviceControl {
if (log.isDebugEnabled()) {
log.debug("设备远程启动API调用");
}
Device device = deviceService.getDevice(deviceId);
Device device = deviceService.getDeviceByDeviceId(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 = deviceService.getDevice(deviceId);
Device device = deviceService.getDeviceByDeviceId(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 = deviceService.getDevice(deviceId);
Device device = deviceService.getDeviceByDeviceId(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 = deviceService.getDevice(deviceId);
Device device = deviceService.getDeviceByDeviceId(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 = deviceService.getDevice(deviceId);
Device device = deviceService.getDeviceByDeviceId(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 = deviceService.getDevice(deviceId);
Device device = deviceService.getDeviceByDeviceId(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 = deviceService.getDevice(deviceId);
Device device = deviceService.getDeviceByDeviceId(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 = deviceService.getDevice(deviceId);
Device device = deviceService.getDeviceByDeviceId(deviceId);
StringBuffer cmdXml = new StringBuffer(200);
cmdXml.append("<DragZoomOut>\r\n");
cmdXml.append("<Length>" + length+ "</Length>\r\n");

View File

@@ -91,7 +91,7 @@ public class DeviceQuery {
@GetMapping("/devices/{deviceId}")
public Device devices(@PathVariable String deviceId){
return deviceService.getDevice(deviceId);
return deviceService.getDeviceByDeviceId(deviceId);
}
/**
@@ -148,7 +148,7 @@ public class DeviceQuery {
if (log.isDebugEnabled()) {
log.debug("设备通道信息同步API调用deviceId" + deviceId);
}
Device device = deviceService.getDevice(deviceId);
Device device = deviceService.getDeviceByDeviceId(deviceId);
boolean status = deviceService.isSyncRunning(deviceId);
// 已存在则返回进度
if (status) {
@@ -273,7 +273,7 @@ public class DeviceQuery {
"UDPudp传输TCP-ACTIVEtcp主动模式,暂不支持TCP-PASSIVEtcp被动模式", required = true)
@PostMapping("/transport/{deviceId}/{streamMode}")
public void updateTransport(@PathVariable String deviceId, @PathVariable String streamMode){
Device device = deviceService.getDevice(deviceId);
Device device = deviceService.getDeviceByDeviceId(deviceId);
device.setStreamMode(streamMode);
deviceService.updateCustomDevice(device);
}
@@ -330,7 +330,7 @@ public class DeviceQuery {
if (log.isDebugEnabled()) {
log.debug("设备状态查询API调用");
}
Device device = deviceService.getDevice(deviceId);
Device device = deviceService.getDeviceByDeviceId(deviceId);
String uuid = UUID.randomUUID().toString();
String key = DeferredResultHolder.CALLBACK_CMD_DEVICESTATUS + deviceId;
DeferredResult<ResponseEntity<String>> result = new DeferredResult<ResponseEntity<String>>(2*1000L);
@@ -393,7 +393,7 @@ public class DeviceQuery {
if (log.isDebugEnabled()) {
log.debug("设备报警查询API调用");
}
Device device = deviceService.getDevice(deviceId);
Device device = deviceService.getDeviceByDeviceId(deviceId);
String key = DeferredResultHolder.CALLBACK_CMD_ALARM + deviceId;
String uuid = UUID.randomUUID().toString();
try {

View File

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

View File

@@ -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 = deviceService.getDevice(deviceId);
Device device = deviceService.getDeviceByDeviceId(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 = deviceService.getDevice(deviceId);
Device device = deviceService.getDeviceByDeviceId(deviceId);
device.setSubscribeCycleForMobilePosition(Integer.parseInt(expires));
device.setMobilePositionSubmissionInterval(Integer.parseInt(interval));
deviceService.updateCustomDevice(device);

View File

@@ -8,8 +8,8 @@ import com.genersoft.iot.vmp.conf.SipConfig;
import com.genersoft.iot.vmp.conf.UserSetting;
import com.genersoft.iot.vmp.conf.exception.ControllerException;
import com.genersoft.iot.vmp.conf.security.JwtUtils;
import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform;
import com.genersoft.iot.vmp.gb28181.bean.ParentPlatformCatch;
import com.genersoft.iot.vmp.gb28181.bean.Platform;
import com.genersoft.iot.vmp.gb28181.bean.PlatformCatch;
import com.genersoft.iot.vmp.gb28181.bean.PlatformCatalog;
import com.genersoft.iot.vmp.gb28181.bean.SubscribeHolder;
import com.genersoft.iot.vmp.gb28181.controller.bean.ChannelReduce;
@@ -100,8 +100,8 @@ public class PlatformController {
@Operation(summary = "获取级联服务器信息", security = @SecurityRequirement(name = JwtUtils.HEADER))
@Parameter(name = "id", description = "平台国标编号", required = true)
@GetMapping("/info/{id}")
public ParentPlatform getPlatform(@PathVariable String id) {
ParentPlatform parentPlatform = platformService.queryPlatformByServerGBId(id);
public Platform getPlatform(@PathVariable String id) {
Platform parentPlatform = platformService.queryPlatformByServerGBId(id);
if (parentPlatform != null) {
return parentPlatform;
} else {
@@ -120,11 +120,11 @@ public class PlatformController {
@Operation(summary = "分页查询级联平台", security = @SecurityRequirement(name = JwtUtils.HEADER))
@Parameter(name = "page", description = "当前页", required = true)
@Parameter(name = "count", description = "每页条数", required = true)
public PageInfo<ParentPlatform> platforms(@PathVariable int page, @PathVariable int count) {
public PageInfo<Platform> platforms(@PathVariable int page, @PathVariable int count) {
PageInfo<ParentPlatform> parentPlatformPageInfo = platformService.queryParentPlatformList(page, count);
PageInfo<Platform> parentPlatformPageInfo = platformService.queryParentPlatformList(page, count);
if (parentPlatformPageInfo.getList().size() > 0) {
for (ParentPlatform platform : parentPlatformPageInfo.getList()) {
for (Platform platform : parentPlatformPageInfo.getList()) {
platform.setMobilePositionSubscribe(subscribeHolder.getMobilePositionSubscribe(platform.getServerGBId()) != null);
platform.setCatalogSubscribe(subscribeHolder.getCatalogSubscribe(platform.getServerGBId()) != null);
}
@@ -141,7 +141,7 @@ public class PlatformController {
@Operation(summary = "添加上级平台信息", security = @SecurityRequirement(name = JwtUtils.HEADER))
@PostMapping("/add")
@ResponseBody
public void addPlatform(@RequestBody ParentPlatform parentPlatform) {
public void addPlatform(@RequestBody Platform parentPlatform) {
if (log.isDebugEnabled()) {
log.debug("保存上级平台信息API调用");
@@ -164,7 +164,7 @@ public class PlatformController {
}
ParentPlatform parentPlatformOld = storager.queryParentPlatByServerGBId(parentPlatform.getServerGBId());
Platform parentPlatformOld = storager.queryParentPlatByServerGBId(parentPlatform.getServerGBId());
if (parentPlatformOld != null) {
throw new ControllerException(ErrorCode.ERROR100.getCode(), "平台 " + parentPlatform.getServerGBId() + " 已存在");
}
@@ -186,7 +186,7 @@ public class PlatformController {
@Operation(summary = "保存上级平台信息", security = @SecurityRequirement(name = JwtUtils.HEADER))
@PostMapping("/save")
@ResponseBody
public void savePlatform(@RequestBody ParentPlatform parentPlatform) {
public void savePlatform(@RequestBody Platform parentPlatform) {
if (log.isDebugEnabled()) {
log.debug("保存上级平台信息API调用");
@@ -227,8 +227,8 @@ public class PlatformController {
) {
throw new ControllerException(ErrorCode.ERROR400);
}
ParentPlatform parentPlatform = storager.queryParentPlatByServerGBId(serverGBId);
ParentPlatformCatch parentPlatformCatch = redisCatchStorage.queryPlatformCatchInfo(serverGBId);
Platform parentPlatform = storager.queryParentPlatByServerGBId(serverGBId);
PlatformCatch parentPlatformCatch = redisCatchStorage.queryPlatformCatchInfo(serverGBId);
if (parentPlatform == null) {
throw new ControllerException(ErrorCode.ERROR100.getCode(), "平台不存在");
}
@@ -279,7 +279,7 @@ public class PlatformController {
@ResponseBody
public Boolean exitPlatform(@PathVariable String serverGBId) {
ParentPlatform parentPlatform = storager.queryParentPlatByServerGBId(serverGBId);
Platform parentPlatform = storager.queryParentPlatByServerGBId(serverGBId);
return parentPlatform != null;
}

View File

@@ -94,7 +94,7 @@ public class PlayController {
Assert.notNull(deviceId, "设备国标编号不可为NULL");
Assert.notNull(channelId, "通道国标编号不可为NULL");
// 获取可用的zlm
Device device = deviceService.getDevice(deviceId);
Device device = deviceService.getDeviceByDeviceId(deviceId);
MediaServer newMediaServerItem = playService.getNewMediaServerItem(device);
RequestMessage requestMessage = new RequestMessage();
@@ -169,7 +169,7 @@ public class PlayController {
throw new ControllerException(ErrorCode.ERROR400);
}
Device device = deviceService.getDevice(deviceId);
Device device = deviceService.getDeviceByDeviceId(deviceId);
if (device == null) {
throw new ControllerException(ErrorCode.ERROR100.getCode(), "设备[" + deviceId + "]不存在");
}
@@ -212,7 +212,7 @@ public class PlayController {
if (log.isDebugEnabled()) {
log.debug("语音广播API调用");
}
Device device = deviceService.getDevice(deviceId);
Device device = deviceService.getDeviceByDeviceId(deviceId);
if (device == null) {
throw new ControllerException(ErrorCode.ERROR400.getCode(), "未找到设备: " + deviceId);
}

View File

@@ -140,7 +140,7 @@ public class PlaybackController {
if (ObjectUtils.isEmpty(deviceId) || ObjectUtils.isEmpty(channelId) || ObjectUtils.isEmpty(stream)) {
throw new ControllerException(ErrorCode.ERROR400);
}
Device device = deviceService.getDevice(deviceId);
Device device = deviceService.getDeviceByDeviceId(deviceId);
if (device == null) {
throw new ControllerException(ErrorCode.ERROR400.getCode(), "设备:" + deviceId + " 未找到");
}
@@ -195,7 +195,7 @@ public class PlaybackController {
log.warn("streamId不存在!");
throw new ControllerException(ErrorCode.ERROR400.getCode(), "streamId不存在");
}
Device device = deviceService.getDevice(inviteInfo.getDeviceId());
Device device = deviceService.getDeviceByDeviceId(inviteInfo.getDeviceId());
try {
cmder.playSeekCmd(device, inviteInfo.getStreamInfo(), seekTime);
} catch (InvalidArgumentException | ParseException | SipException e) {
@@ -219,7 +219,7 @@ public class PlaybackController {
log.warn("不支持的speed " + speed);
throw new ControllerException(ErrorCode.ERROR100.getCode(), "不支持的speed0.25 0.5 1、2、4");
}
Device device = deviceService.getDevice(inviteInfo.getDeviceId());
Device device = deviceService.getDeviceByDeviceId(inviteInfo.getDeviceId());
try {
cmder.playSpeedCmd(device, inviteInfo.getStreamInfo(), speed);
} catch (InvalidArgumentException | ParseException | SipException e) {

View File

@@ -66,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 = deviceService.getDevice(deviceId);
Device device = deviceService.getDeviceByDeviceId(deviceId);
int cmdCode = 0;
switch (command){
case "left":
@@ -129,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 = deviceService.getDevice(deviceId);
Device device = deviceService.getDeviceByDeviceId(deviceId);
try {
cmder.frontEndCmd(device, channelId, cmdCode, parameter1, parameter2, combindCode2);
@@ -148,7 +148,7 @@ public class PtzController {
if (log.isDebugEnabled()) {
log.debug("设备预置位查询API调用");
}
Device device = deviceService.getDevice(deviceId);
Device device = deviceService.getDeviceByDeviceId(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);

View File

@@ -456,4 +456,100 @@ public interface CommonGBChannelMapper {
"</foreach>" +
"</script>"})
int batchUpdate(List<CommonGBChannel> commonGBChannels);
@Select("select\n" +
" wdc.id as gb_id,\n" +
" wdc.device_db_id as gb_device_db_id,\n" +
" wdc.stream_push_id,\n" +
" wdc.stream_proxy_id,\n" +
" wdc.create_time,\n" +
" wdc.update_time,\n" +
" coalesce(wpgc.device_id, wdc.gb_device_id, wdc.device_id) as gb_device_id,\n" +
" coalesce(wpgc.name, wdc.gb_name, wdc.name) as gb_name,\n" +
" coalesce(wdc.gb_manufacturer, wdc.manufacturer) as gb_manufacturer,\n" +
" coalesce(wdc.gb_model, wdc.model) as gb_model,\n" +
" coalesce(wdc.gb_owner, wdc.owner) as gb_owner,\n" +
" coalesce(wpgc.civil_code, wdc.gb_civil_code, wdc.civil_code),\n" +
" coalesce(wdc.gb_block, wdc.block) as gb_block,\n" +
" coalesce(wdc.gb_address, wdc.address) as gb_address,\n" +
" coalesce(wdc.gb_parental, wdc.parental) as gb_parental,\n" +
" coalesce(wpgc.parent_id, wdc.gb_parent_id, wdc.parent_id) as gb_parent_id,\n" +
" coalesce(wdc.gb_safety_way, wdc.safety_way) as gb_safety_way,\n" +
" coalesce(wdc.gb_register_way, wdc.register_way) as gb_register_way,\n" +
" coalesce(wdc.gb_cert_num, wdc.cert_num) as gb_cert_num,\n" +
" coalesce(wdc.gb_certifiable, wdc.certifiable) as gb_certifiable,\n" +
" coalesce(wdc.gb_err_code, wdc.err_code) as gb_err_code,\n" +
" coalesce(wdc.gb_end_time, wdc.end_time) as gb_end_time,\n" +
" coalesce(wdc.gb_secrecy, wdc.secrecy) as gb_secrecy,\n" +
" coalesce(wdc.gb_ip_address, wdc.ip_address) as gb_ip_address,\n" +
" coalesce(wdc.gb_port, wdc.port) as gb_port,\n" +
" coalesce(wdc.gb_password, wdc.password) as gb_password,\n" +
" coalesce(wdc.gb_status, wdc.status) as gb_status,\n" +
" coalesce(wdc.gb_longitude, wdc.longitude) as gb_longitude,\n" +
" coalesce(wdc.gb_latitude, wdc.latitude) as gb_latitude,\n" +
" coalesce(wdc.gb_ptz_type, wdc.ptz_type) as gb_ptz_type,\n" +
" coalesce(wdc.gb_position_type, wdc.position_type) as gb_position_type,\n" +
" coalesce(wdc.gb_room_type, wdc.room_type) as gb_room_type,\n" +
" coalesce(wdc.gb_use_type, wdc.use_type) as gb_use_type,\n" +
" coalesce(wdc.gb_supply_light_type, wdc.supply_light_type) as gb_supply_light_type,\n" +
" coalesce(wdc.gb_direction_type, wdc.direction_type) as gb_direction_type,\n" +
" coalesce(wdc.gb_resolution, wdc.resolution) as gb_resolution,\n" +
" coalesce(wpgc.business_group_id, wdc.gb_business_group_id, wdc.business_group_id) as gb_business_group_id,\n" +
" coalesce(wdc.gb_download_speed, wdc.download_speed) as gb_download_speed,\n" +
" coalesce(wdc.gb_svc_space_support_mod, wdc.svc_space_support_mod) as gb_svc_space_support_mod,\n" +
" coalesce(wdc.gb_svc_time_support_mode, wdc.svc_time_support_mode) as gb_svc_time_support_mode\n" +
" from wvp_device_channel wdc" +
" left jon wvp_platform_gb_channel wpgc on wdc.id = wpgc.device_channel_id" +
" where wpgc.platform_id = #{platformId}"
)
List<CommonGBChannel> queryWithPlatform(@Param("platformId") Integer platformId);
@Select("select\n" +
" wdc.id as gb_id,\n" +
" wdc.device_db_id as gb_device_db_id,\n" +
" wdc.stream_push_id,\n" +
" wdc.stream_proxy_id,\n" +
" wdc.create_time,\n" +
" wdc.update_time,\n" +
" coalesce(wpgc.device_id, wdc.gb_device_id, wdc.device_id) as gb_device_id,\n" +
" coalesce(wpgc.name, wdc.gb_name, wdc.name) as gb_name,\n" +
" coalesce(wdc.gb_manufacturer, wdc.manufacturer) as gb_manufacturer,\n" +
" coalesce(wdc.gb_model, wdc.model) as gb_model,\n" +
" coalesce(wdc.gb_owner, wdc.owner) as gb_owner,\n" +
" coalesce(wpgc.civil_code, wdc.gb_civil_code, wdc.civil_code),\n" +
" coalesce(wdc.gb_block, wdc.block) as gb_block,\n" +
" coalesce(wdc.gb_address, wdc.address) as gb_address,\n" +
" coalesce(wdc.gb_parental, wdc.parental) as gb_parental,\n" +
" coalesce(wpgc.parent_id, wdc.gb_parent_id, wdc.parent_id) as gb_parent_id,\n" +
" coalesce(wdc.gb_safety_way, wdc.safety_way) as gb_safety_way,\n" +
" coalesce(wdc.gb_register_way, wdc.register_way) as gb_register_way,\n" +
" coalesce(wdc.gb_cert_num, wdc.cert_num) as gb_cert_num,\n" +
" coalesce(wdc.gb_certifiable, wdc.certifiable) as gb_certifiable,\n" +
" coalesce(wdc.gb_err_code, wdc.err_code) as gb_err_code,\n" +
" coalesce(wdc.gb_end_time, wdc.end_time) as gb_end_time,\n" +
" coalesce(wdc.gb_secrecy, wdc.secrecy) as gb_secrecy,\n" +
" coalesce(wdc.gb_ip_address, wdc.ip_address) as gb_ip_address,\n" +
" coalesce(wdc.gb_port, wdc.port) as gb_port,\n" +
" coalesce(wdc.gb_password, wdc.password) as gb_password,\n" +
" coalesce(wdc.gb_status, wdc.status) as gb_status,\n" +
" coalesce(wdc.gb_longitude, wdc.longitude) as gb_longitude,\n" +
" coalesce(wdc.gb_latitude, wdc.latitude) as gb_latitude,\n" +
" coalesce(wdc.gb_ptz_type, wdc.ptz_type) as gb_ptz_type,\n" +
" coalesce(wdc.gb_position_type, wdc.position_type) as gb_position_type,\n" +
" coalesce(wdc.gb_room_type, wdc.room_type) as gb_room_type,\n" +
" coalesce(wdc.gb_use_type, wdc.use_type) as gb_use_type,\n" +
" coalesce(wdc.gb_supply_light_type, wdc.supply_light_type) as gb_supply_light_type,\n" +
" coalesce(wdc.gb_direction_type, wdc.direction_type) as gb_direction_type,\n" +
" coalesce(wdc.gb_resolution, wdc.resolution) as gb_resolution,\n" +
" coalesce(wpgc.business_group_id, wdc.gb_business_group_id, wdc.business_group_id) as gb_business_group_id,\n" +
" coalesce(wdc.gb_download_speed, wdc.download_speed) as gb_download_speed,\n" +
" coalesce(wdc.gb_svc_space_support_mod, wdc.svc_space_support_mod) as gb_svc_space_support_mod,\n" +
" coalesce(wdc.gb_svc_time_support_mode, wdc.svc_time_support_mode) as gb_svc_time_support_mode\n" +
" from wvp_device_channel wdc" +
" left jon wvp_platform_gb_channel wpgc on wdc.id = wpgc.device_channel_id" +
" where wpgc.platform_id = #{platformId} and coalesce(wpgc.device_id, wdc.gb_device_id, wdc.device_id) = #{channelDeviceId}"
)
CommonGBChannel queryOneWithPlatform(@Param("platformId") Integer platformId, @Param("channelDeviceId") String channelDeviceId);
}

View File

@@ -347,4 +347,7 @@ public interface DeviceMapper {
@Select("select * from wvp_device_channel where id = #{id}")
DeviceChannel getRawChannel(@Param("id") int id);
@Select("select * from wvp_device where id = #{id}")
Device query(@Param("id") Integer id);
}

View File

@@ -1,5 +1,6 @@
package com.genersoft.iot.vmp.gb28181.dao;
import com.genersoft.iot.vmp.gb28181.bean.CommonGBChannel;
import com.genersoft.iot.vmp.gb28181.bean.Group;
import com.genersoft.iot.vmp.gb28181.bean.GroupTree;
import com.genersoft.iot.vmp.gb28181.bean.Region;
@@ -160,4 +161,14 @@ public interface GroupMapper {
" <foreach collection='groupList' item='item' open='(' separator=',' close=')' > #{item.deviceId}</foreach>" +
" </script>")
List<Region> queryInGroupList(List<Group> groupList);
@Select(" <script>" +
" SELECT " +
" device_id as gb_device_id" +
" name as gb_name" +
" from wvp_common_group " +
" where (device_id, business_group) in " +
" <foreach collection='channelList' item='item' open='(' separator=',' close=')' > (#{item.gbParentId}, #{item.gbBusinessGroupId})</foreach>" +
" </script>")
List<CommonGBChannel> queryInChannelList(List<CommonGBChannel> channelList);
}

View File

@@ -1,66 +0,0 @@
package com.genersoft.iot.vmp.gb28181.dao;
import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel;
import com.genersoft.iot.vmp.gb28181.bean.PlatformCatalog;
import org.apache.ibatis.annotations.*;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import java.util.List;
@Mapper
@Repository
public interface PlatformCatalogMapper {
@Insert("INSERT INTO wvp_platform_catalog (id, name, platform_id, parent_id, civil_code, business_group_id) VALUES" +
"(#{id}, #{name}, #{platformId}, #{parentId}, #{civilCode}, #{businessGroupId})")
int add(PlatformCatalog platformCatalog);
@Delete("DELETE from wvp_platform_catalog WHERE platform_id=#{platformId} and id=#{id}")
int del(@Param("platformId") String platformId, @Param("id") String id);
@Delete("DELETE from wvp_platform_catalog WHERE platform_id=#{platformId}")
int delByPlatformId(@Param("platformId") String platformId);
@Select("SELECT pc.*, count(pc2.id) as children_count from wvp_platform_catalog pc " +
"left join wvp_platform_catalog pc2 on pc.id = pc2.parent_id " +
"WHERE pc.parent_id=#{parentId} AND pc.platform_id=#{platformId} " +
"group by pc.id, pc.name, pc.platform_id, pc.business_group_id, pc.civil_code, pc.parent_id")
List<PlatformCatalog> selectByParentId(@Param("platformId") String platformId, @Param("parentId") String parentId);
@Update(value = {" <script>" +
"UPDATE wvp_platform_catalog " +
"SET name=#{platformCatalog.name}" +
"WHERE id=#{platformCatalog.id} and platform_id=#{platformCatalog.platformId}"+
"</script>"})
int update(@Param("platformCatalog") PlatformCatalog platformCatalog);
@Select("SELECT *, (SELECT COUNT(1) from wvp_platform_catalog where parent_id = pc.id) as children_count from wvp_platform_catalog pc WHERE pc.platform_id=#{platformId}")
List<PlatformCatalog> selectByPlatForm(@Param("platformId") String platformId);
@Select("SELECT pc.* FROM wvp_platform_catalog pc WHERE pc.id = (SELECT pp.catalog_id from wvp_platform pp WHERE pp.server_gb_id=#{platformId})")
PlatformCatalog selectDefaultByPlatFormId(@Param("platformId") String platformId);
@Select("SELECT pc.id as channel_id, pc.name, pc.civil_code, pc.business_group_id,'1' as parental, pc.parent_id " +
" from wvp_platform_catalog pc WHERE pc.platform_id=#{platformId}")
List<DeviceChannel> queryCatalogInPlatform(@Param("platformId") String platformId);
@Select("SELECT *, " +
"(SELECT COUNT(1) from wvp_platform_catalog where parent_id = pc.id) as children_count " +
" from wvp_platform_catalog pc " +
" WHERE pc.id=#{id} and pc.platform_id=#{platformId}")
PlatformCatalog selectByPlatFormAndCatalogId(@Param("platformId") String platformId, @Param("id") String id);
@Delete("<script> "+
"DELETE from wvp_platform_catalog where platform_id=#{platformId} and id in " +
"<foreach collection='ids' item='item' open='(' separator=',' close=')'>" +
"#{item} " +
"</foreach>" +
"</script>")
int deleteAll(String platformId, List<String> ids);
@Select("SELECT id from wvp_platform_catalog WHERE platform_id=#{platformId} and parent_id = #{id}")
List<String> queryCatalogFromParent(@Param("id") String id, @Param("platformId") String platformId);
}

View File

@@ -97,7 +97,7 @@ public interface PlatformChannelMapper {
"AND pp.server_gb_id IN" +
"<foreach collection='platforms' item='item' open='(' separator=',' close=')' > #{item}</foreach>" +
"</script> ")
List<ParentPlatform> queryPlatFormListForGBWithGBId(@Param("channelId") String channelId, @Param("platforms") List<String> platforms);
List<Platform> queryPlatFormListForGBWithGBId(@Param("channelId") String channelId, @Param("platforms") List<String> platforms);
@Delete("<script> " +
"DELETE from wvp_platform_gb_channel WHERE platform_id=#{serverGBId}" +

View File

@@ -1,114 +0,0 @@
package com.genersoft.iot.vmp.gb28181.dao;
import com.genersoft.iot.vmp.gb28181.bean.GbStream;
import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform;
import com.genersoft.iot.vmp.gb28181.bean.PlatformCatalog;
import com.genersoft.iot.vmp.gb28181.bean.PlatformGbStream;
import com.genersoft.iot.vmp.streamProxy.bean.StreamProxy;
import com.genersoft.iot.vmp.streamPush.bean.StreamPush;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;
import java.util.List;
@Mapper
@Repository
public interface PlatformGbStreamMapper {
@Insert("INSERT INTO wvp_platform_gb_stream (gb_stream_id, platform_id, catalog_id) VALUES" +
"( #{gbStreamId}, #{platformId}, #{catalogId})")
int add(PlatformGbStream platformGbStream);
@Insert("<script> " +
"INSERT into wvp_platform_gb_stream " +
"(gb_stream_id, platform_id, catalog_id) " +
"values " +
"<foreach collection='streamPushItems' index='index' item='item' separator=','> " +
"(#{item.gbStreamId}, #{item.platform_id}, #{item.catalogId})" +
"</foreach> " +
"</script>")
int batchAdd(List<StreamPush> streamPushItems);
@Delete("DELETE from wvp_platform_gb_stream WHERE gb_stream_id = (select gb_stream_id from wvp_gb_stream where app=#{app} AND stream=#{stream})")
int delByAppAndStream(@Param("app") String app, @Param("stream") String stream);
@Delete("DELETE from wvp_platform_gb_stream WHERE platform_id=#{platformId}")
int delByPlatformId(String platformId);
@Select("SELECT " +
"pp.* " +
"FROM " +
"wvp_platform_gb_stream pgs " +
"LEFT JOIN wvp_platform pp ON pp.server_gb_id = pgs.platform_id " +
"LEFT join wvp_gb_stream gs ON gs.gb_stream_id = pgs.gb_stream_id " +
"WHERE " +
"gs.app =#{app} " +
"AND gs.stream =#{stream} ")
List<ParentPlatform> selectByAppAndStream(@Param("app") String app, @Param("stream") String stream);
@Select("SELECT pgs.*, gs.gb_id from wvp_platform_gb_stream pgs " +
"LEFT join wvp_gb_stream gs ON pgs.gb_stream_id = gs.gb_stream_id " +
"WHERE gs.app=#{app} AND gs.stream=#{stream} AND pgs.platform_id=#{platformId}")
StreamProxy selectOne(@Param("app") String app, @Param("stream") String stream, @Param("platformId") String platformId);
@Select("<script> " +
"select gs.* " +
" from wvp_gb_stream gs\n" +
" left join wvp_platform_gb_stream pgs\n" +
" on gs.gb_stream_id = pgs.gb_stream_id\n" +
" where pgs.platform_id=#{platformId} " +
" <if test='catalogId != null' > and pgs.catalog_id=#{catalogId}</if>" +
"</script>")
List<GbStream> queryChannelInParentPlatformAndCatalog(@Param("platformId") String platformId, @Param("catalogId") String catalogId);
@Select("select gs.gb_id as id, gs.name as name, pgs.platform_id as platform_id, pgs.catalog_id as catalog_id , 0 as children_count, 2 as type\n" +
"from wvp_gb_stream gs\n" +
" left join wvp_platform_gb_stream pgs\n" +
" on gs.gb_stream_id = pgs.gb_stream_id\n" +
"where pgs.platform_id=#{platformId} and pgs.catalog_id=#{catalogId}")
List<PlatformCatalog> queryChannelInParentPlatformAndCatalogForCatalog(@Param("platformId") String platformId, @Param("catalogId") String catalogId);
@Select("<script> " +
"SELECT " +
"pp.* " +
"FROM " +
"wvp_platform pp " +
"left join wvp_platform_gb_stream pgs on " +
"pp.server_gb_id = pgs.platform_id " +
"left join wvp_gb_stream gs " +
"on gs.gb_stream_id = pgs.gb_stream_id " +
"WHERE " +
"gs.app = #{app} " +
"AND gs.stream = #{stream}" +
"AND pp.server_gb_id IN" +
"<foreach collection='platforms' item='item' open='(' separator=',' close=')' > #{item}</foreach>" +
"</script> ")
List<ParentPlatform> queryPlatFormListForGBWithGBId(@Param("app") String app, @Param("stream") String stream, @Param("platforms") List<String> platforms);
@Delete("DELETE from wvp_platform_gb_stream WHERE gb_stream_id = (select id from wvp_gb_stream where app=#{app} AND stream=#{stream}) AND platform_id=#{platformId}")
int delByAppAndStreamAndPlatform(String app, String stream, String platformId);
@Delete("<script> "+
"DELETE from wvp_platform_gb_stream where gb_stream_id in " +
"<foreach collection='gbStreams' item='item' open='(' separator=',' close=')' >" +
"#{item.gbStreamId}" +
"</foreach>" +
"</script>")
void delByGbStreams(List<GbStream> gbStreams);
@Delete("<script> "+
"DELETE from wvp_platform_gb_stream where platform_id=#{platformId} and gb_stream_id in " +
"<foreach collection='gbStreams' item='item' open='(' separator=',' close=')'>" +
"#{item.gbStreamId} " +
"</foreach>" +
"</script>")
void delByAppAndStreamsByPlatformId(@Param("gbStreams") List<GbStream> gbStreams, @Param("platformId") String platformId);
@Delete("<script> "+
"DELETE from wvp_platform_gb_stream WHERE platform_id=#{platformId}" +
" <if test='catalogId != null' > and catalog_id=#{catalogId}</if>" +
"</script>")
int delByPlatformAndCatalogId(@Param("platformId") String platformId, @Param("catalogId") String catalogId);
}

View File

@@ -1,6 +1,6 @@
package com.genersoft.iot.vmp.gb28181.dao;
import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform;
import com.genersoft.iot.vmp.gb28181.bean.Platform;
import com.genersoft.iot.vmp.storager.dao.dto.ChannelSourceInfo;
import org.apache.ibatis.annotations.*;
import org.apache.ibatis.annotations.Param;
@@ -13,15 +13,15 @@ import java.util.List;
*/
@Mapper
@Repository
public interface ParentPlatformMapper {
public interface PlatformMapper {
@Insert("INSERT INTO wvp_platform (enable, name, server_gb_id, server_gb_domain, server_ip, server_port,device_gb_id,device_ip,"+
"device_port,username,password,expires,keep_timeout,transport,character_set,ptz,rtcp,as_message_channel,auto_push_channel,"+
"status,start_offline_push,catalog_id,administrative_division,catalog_group,create_time,update_time,send_stream_ip) " +
"status,catalog_id,administrative_division,catalog_group,create_time,update_time,send_stream_ip) " +
" VALUES (#{enable}, #{name}, #{serverGBId}, #{serverGBDomain}, #{serverIP}, #{serverPort}, #{deviceGBId}, #{deviceIp}, " +
" #{devicePort}, #{username}, #{password}, #{expires}, #{keepTimeout}, #{transport}, #{characterSet}, #{ptz}, #{rtcp}, #{asMessageChannel}, #{autoPushChannel}, " +
" #{status}, #{startOfflinePush}, #{catalogId}, #{administrativeDivision}, #{catalogGroup}, #{createTime}, #{updateTime}, #{sendStreamIp})")
int addParentPlatform(ParentPlatform parentPlatform);
" #{status}, #{catalogId}, #{administrativeDivision}, #{catalogGroup}, #{createTime}, #{updateTime}, #{sendStreamIp})")
int addParentPlatform(Platform parentPlatform);
@Update("UPDATE wvp_platform " +
"SET enable=#{enable}, " +
@@ -44,7 +44,6 @@ public interface ParentPlatformMapper {
"as_message_channel=#{asMessageChannel}, " +
"auto_push_channel=#{autoPushChannel}, " +
"status=#{status}, " +
"start_offline_push=#{startOfflinePush}, " +
"catalog_group=#{catalogGroup}, " +
"administrative_division=#{administrativeDivision}, " +
"create_time=#{createTime}, " +
@@ -52,10 +51,10 @@ public interface ParentPlatformMapper {
"send_stream_ip=#{sendStreamIp}, " +
"catalog_id=#{catalogId} " +
"WHERE id=#{id}")
int updateParentPlatform(ParentPlatform parentPlatform);
int updateParentPlatform(Platform parentPlatform);
@Delete("DELETE FROM wvp_platform WHERE server_gb_id=#{serverGBId}")
int delParentPlatform(ParentPlatform parentPlatform);
int delParentPlatform(Platform parentPlatform);
@Select("SELECT *, ((SELECT count(0)\n" +
" FROM wvp_platform_gb_channel pc\n" +
@@ -69,19 +68,19 @@ public interface ParentPlatformMapper {
" FROM wvp_platform_catalog pgc\n" +
" WHERE pgc.platform_id = pp.server_gb_id)) as channel_count\n" +
"FROM wvp_platform pp ")
List<ParentPlatform> getParentPlatformList();
List<Platform> getParentPlatformList();
@Select("SELECT * FROM wvp_platform WHERE enable=#{enable} ")
List<ParentPlatform> getEnableParentPlatformList(boolean enable);
List<Platform> getEnableParentPlatformList(boolean enable);
@Select("SELECT * FROM wvp_platform WHERE enable=true and as_message_channel=true")
List<ParentPlatform> queryEnablePlatformListWithAsMessageChannel();
List<Platform> queryEnablePlatformListWithAsMessageChannel();
@Select("SELECT * FROM wvp_platform WHERE server_gb_id=#{platformGbId}")
ParentPlatform getParentPlatByServerGBId(String platformGbId);
Platform getParentPlatByServerGBId(String platformGbId);
@Select("SELECT * FROM wvp_platform WHERE id=#{id}")
ParentPlatform getParentPlatById(int id);
Platform getParentPlatById(int id);
@Update("UPDATE wvp_platform SET status=false" )
int outlineForAllParentPlatform();

View File

@@ -1,5 +1,6 @@
package com.genersoft.iot.vmp.gb28181.dao;
import com.genersoft.iot.vmp.gb28181.bean.CommonGBChannel;
import com.genersoft.iot.vmp.gb28181.bean.Region;
import com.genersoft.iot.vmp.gb28181.bean.RegionTree;
import org.apache.ibatis.annotations.*;
@@ -96,4 +97,14 @@ public interface RegionMapper {
" <foreach collection='regionList' item='item' open='(' separator=',' close=')' > #{item.deviceId}</foreach>" +
" </script>")
List<Region> queryInRegionList(List<Region> regionList);
@Select(" <script>" +
" SELECT " +
" device_id as gb_device_id" +
" name as gb_name" +
" from wvp_common_region " +
" where device_id in " +
" <foreach collection='channelList' item='item' open='(' separator=',' close=')' > #{item.gbCivilCode}</foreach>" +
" </script>")
List<CommonGBChannel> queryInChannelList(List<CommonGBChannel> channelList);
}

View File

@@ -1,7 +1,7 @@
package com.genersoft.iot.vmp.gb28181.event.subscribe.catalog;
import com.genersoft.iot.vmp.gb28181.bean.CommonGBChannel;
import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform;
import com.genersoft.iot.vmp.gb28181.bean.Platform;
import com.genersoft.iot.vmp.gb28181.bean.SubscribeHolder;
import com.genersoft.iot.vmp.gb28181.bean.SubscribeInfo;
import com.genersoft.iot.vmp.gb28181.service.IPlatformService;
@@ -42,9 +42,9 @@ public class CatalogEventLister implements ApplicationListener<CatalogEvent> {
@Override
public void onApplicationEvent(CatalogEvent event) {
SubscribeInfo subscribe = null;
ParentPlatform parentPlatform = null;
Platform parentPlatform = null;
Map<String, List<ParentPlatform>> parentPlatformMap = new HashMap<>();
Map<String, List<Platform>> parentPlatformMap = new HashMap<>();
Map<String, CommonGBChannel> channelMap = new HashMap<>();
if (event.getPlatformId() != null) {
parentPlatform = platformService.queryOne(event.getPlatformId());
@@ -62,7 +62,7 @@ public class CatalogEventLister implements ApplicationListener<CatalogEvent> {
if (event.getChannels() != null) {
if (!platforms.isEmpty()) {
for (CommonGBChannel deviceChannel : event.getChannels()) {
List<ParentPlatform> parentPlatformsForGB = storager.queryPlatFormListForGBWithGBId(deviceChannel.getGbDeviceId(), platforms);
List<Platform> parentPlatformsForGB = storager.queryPlatFormListForGBWithGBId(deviceChannel.getGbDeviceId(), platforms);
parentPlatformMap.put(deviceChannel.getGbDeviceId(), parentPlatformsForGB);
channelMap.put(deviceChannel.getGbDeviceId(), deviceChannel);
}
@@ -90,9 +90,9 @@ public class CatalogEventLister implements ApplicationListener<CatalogEvent> {
}
}else if (!parentPlatformMap.keySet().isEmpty()) {
for (String gbId : parentPlatformMap.keySet()) {
List<ParentPlatform> parentPlatforms = parentPlatformMap.get(gbId);
List<Platform> parentPlatforms = parentPlatformMap.get(gbId);
if (parentPlatforms != null && !parentPlatforms.isEmpty()) {
for (ParentPlatform platform : parentPlatforms) {
for (Platform platform : parentPlatforms) {
SubscribeInfo subscribeInfo = subscribeHolder.getCatalogSubscribe(platform.getServerGBId());
if (subscribeInfo == null) {
continue;
@@ -135,9 +135,9 @@ public class CatalogEventLister implements ApplicationListener<CatalogEvent> {
}
}else if (!parentPlatformMap.keySet().isEmpty()) {
for (String gbId : parentPlatformMap.keySet()) {
List<ParentPlatform> parentPlatforms = parentPlatformMap.get(gbId);
List<Platform> parentPlatforms = parentPlatformMap.get(gbId);
if (parentPlatforms != null && !parentPlatforms.isEmpty()) {
for (ParentPlatform platform : parentPlatforms) {
for (Platform platform : parentPlatforms) {
SubscribeInfo subscribeInfo = subscribeHolder.getCatalogSubscribe(platform.getServerGBId());
if (subscribeInfo == null) {
continue;

View File

@@ -1,6 +1,6 @@
package com.genersoft.iot.vmp.gb28181.event.subscribe.mobilePosition;
import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform;
import com.genersoft.iot.vmp.gb28181.bean.Platform;
import com.genersoft.iot.vmp.gb28181.bean.SubscribeHolder;
import com.genersoft.iot.vmp.gb28181.bean.SubscribeInfo;
import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommanderFroPlatform;
@@ -39,9 +39,9 @@ public class MobilePositionEventLister implements ApplicationListener<MobilePosi
if (platforms.isEmpty()) {
return;
}
List<ParentPlatform> parentPlatformsForGB = storager.queryPlatFormListForGBWithGBId(event.getMobilePosition().getChannelId(), platforms);
List<Platform> parentPlatformsForGB = storager.queryPlatFormListForGBWithGBId(event.getMobilePosition().getChannelId(), platforms);
for (ParentPlatform platform : parentPlatformsForGB) {
for (Platform platform : parentPlatformsForGB) {
log.info("[向上级发送MobilePosition] 通道:{},平台:{} 位置: {}:{}", event.getMobilePosition().getChannelId(),
platform.getServerGBId(), event.getMobilePosition().getLongitude(), event.getMobilePosition().getLatitude());
SubscribeInfo subscribe = subscribeHolder.getMobilePositionSubscribe(platform.getServerGBId());

View File

@@ -81,7 +81,7 @@ public interface IDeviceService {
* @param deviceId 设备编号
* @return 设备信息
*/
Device getDevice(String deviceId);
Device getDeviceByDeviceId(String deviceId);
/**
* 获取所有在线设备
@@ -164,4 +164,7 @@ public interface IDeviceService {
List<Device> getAll();
PageInfo<Device> getAll(int page, int count, String query, Boolean status);
Device getDevice(Integer gbDeviceDbId);
}

View File

@@ -30,7 +30,7 @@ public interface IGbChannelService {
void updateStatus(List<CommonGBChannel> channelList);
List<CommonGBChannel> queryByPlatformId(Integer platformId);
List<CommonGBChannel> queryByPlatform(Platform platform);
CommonGBChannel getOne(int id);
@@ -75,4 +75,6 @@ public interface IGbChannelService {
void deleteChannelToGroupByGbDevice(List<Integer> deviceIds);
void batchUpdate(List<CommonGBChannel> commonGBChannels);
CommonGBChannel queryOneWithPlatform(Integer platformId, String channelDeviceId);
}

View File

@@ -1,7 +1,8 @@
package com.genersoft.iot.vmp.gb28181.service;
import com.genersoft.iot.vmp.gb28181.bean.CommonGBChannel;
import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel;
import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform;
import com.genersoft.iot.vmp.gb28181.bean.Platform;
import com.genersoft.iot.vmp.gb28181.event.SipSubscribe;
import com.genersoft.iot.vmp.media.event.hook.HookSubscribe;
import com.genersoft.iot.vmp.media.bean.MediaServer;
@@ -19,7 +20,7 @@ import java.text.ParseException;
*/
public interface IPlatformService {
ParentPlatform queryPlatformByServerGBId(String platformGbId);
Platform queryPlatformByServerGBId(String platformGbId);
/**
* 分页获取上级平台
@@ -27,37 +28,37 @@ public interface IPlatformService {
* @param count
* @return
*/
PageInfo<ParentPlatform> queryParentPlatformList(int page, int count);
PageInfo<Platform> queryParentPlatformList(int page, int count);
/**
* 添加级联平台
* @param parentPlatform 级联平台
*/
boolean add(ParentPlatform parentPlatform);
boolean add(Platform parentPlatform);
/**
* 添加级联平台
* @param parentPlatform 级联平台
*/
boolean update(ParentPlatform parentPlatform);
boolean update(Platform parentPlatform);
/**
* 平台上线
* @param parentPlatform 平台信息
*/
void online(ParentPlatform parentPlatform, SipTransactionInfo sipTransactionInfo);
void online(Platform parentPlatform, SipTransactionInfo sipTransactionInfo);
/**
* 平台离线
* @param parentPlatform 平台信息
*/
void offline(ParentPlatform parentPlatform, boolean stopRegisterTask);
void offline(Platform parentPlatform, boolean stopRegisterTask);
/**
* 向上级平台发起注册
* @param parentPlatform
*/
void login(ParentPlatform parentPlatform);
void login(Platform parentPlatform);
/**
* 向上级平台发送位置订阅
@@ -73,15 +74,15 @@ public interface IPlatformService {
* @param errorEvent 信令错误事件
* @param timeoutCallback 超时事件
*/
void broadcastInvite(ParentPlatform platform, String channelId, MediaServer mediaServerItem, HookSubscribe.Event hookEvent,
void broadcastInvite(Platform platform, String channelId, MediaServer mediaServerItem, HookSubscribe.Event hookEvent,
SipSubscribe.Event errorEvent, InviteTimeOutCallback timeoutCallback) throws InvalidArgumentException, ParseException, SipException;
/**
* 语音喊话回复BYE
*/
void stopBroadcast(ParentPlatform platform, DeviceChannel channel, String stream,boolean sendBye, MediaServer mediaServerItem);
void stopBroadcast(Platform platform, CommonGBChannel channel, String stream, boolean sendBye, MediaServer mediaServerItem);
void addSimulatedSubscribeInfo(ParentPlatform parentPlatform);
void addSimulatedSubscribeInfo(Platform parentPlatform);
ParentPlatform queryOne(Integer platformId);
Platform queryOne(Integer platformId);
}

View File

@@ -3,7 +3,7 @@ package com.genersoft.iot.vmp.gb28181.service;
import com.genersoft.iot.vmp.common.StreamInfo;
import com.genersoft.iot.vmp.conf.exception.ServiceException;
import com.genersoft.iot.vmp.gb28181.bean.Device;
import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform;
import com.genersoft.iot.vmp.gb28181.bean.Platform;
import com.genersoft.iot.vmp.gb28181.bean.SendRtpItem;
import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel;
import com.genersoft.iot.vmp.media.bean.MediaInfo;
@@ -55,9 +55,9 @@ public interface IPlayService {
void resumeRtp(String streamId) throws ServiceException, InvalidArgumentException, ParseException, SipException;
void startPushStream(SendRtpItem sendRtpItem, SIPResponse sipResponse, ParentPlatform platform, CallIdHeader callIdHeader);
void startPushStream(SendRtpItem sendRtpItem, SIPResponse sipResponse, Platform platform, CallIdHeader callIdHeader);
void startSendRtpStreamFailHand(SendRtpItem sendRtpItem,ParentPlatform platform, CallIdHeader callIdHeader);
void startSendRtpStreamFailHand(SendRtpItem sendRtpItem, Platform platform, CallIdHeader callIdHeader);
void talkCmd(Device device, String channelId, MediaServer mediaServerItem, String stream, AudioBroadcastEvent event);

View File

@@ -351,7 +351,7 @@ public class DeviceServiceImpl implements IDeviceService {
}
@Override
public Device getDevice(String deviceId) {
public Device getDeviceByDeviceId(String deviceId) {
Device device = redisCatchStorage.getDevice(deviceId);
if (device == null) {
device = deviceMapper.getDeviceByDeviceId(deviceId);
@@ -568,4 +568,9 @@ public class DeviceServiceImpl implements IDeviceService {
List<Device> all = deviceMapper.getDeviceList(query, status);
return new PageInfo<>(all);
}
@Override
public Device getDevice(Integer id) {
return deviceMapper.query(id);
}
}

View File

@@ -3,6 +3,8 @@ package com.genersoft.iot.vmp.gb28181.service.impl;
import com.genersoft.iot.vmp.conf.exception.ControllerException;
import com.genersoft.iot.vmp.gb28181.bean.*;
import com.genersoft.iot.vmp.gb28181.dao.CommonGBChannelMapper;
import com.genersoft.iot.vmp.gb28181.dao.GroupMapper;
import com.genersoft.iot.vmp.gb28181.dao.RegionMapper;
import com.genersoft.iot.vmp.gb28181.event.EventPublisher;
import com.genersoft.iot.vmp.gb28181.event.subscribe.catalog.CatalogEvent;
import com.genersoft.iot.vmp.gb28181.service.IGbChannelService;
@@ -32,6 +34,12 @@ public class GbChannelServiceImpl implements IGbChannelService {
@Autowired
private CommonGBChannelMapper commonGBChannelMapper;
@Autowired
private RegionMapper regionMapper;
@Autowired
private GroupMapper groupMapper;
@Override
public CommonGBChannel queryByDeviceId(String gbDeviceId) {
return commonGBChannelMapper.queryByDeviceId(gbDeviceId);
@@ -299,10 +307,40 @@ public class GbChannelServiceImpl implements IGbChannelService {
}
@Override
public List<CommonGBChannel> queryByPlatformId(Integer platformId) {
return commonGBChannelMapper.queryByPlatformId(platformId);
public List<CommonGBChannel> queryByPlatform(Platform platform) {
if (platform == null) {
return null;
}
List<CommonGBChannel> commonGBChannelList = commonGBChannelMapper.queryWithPlatform(platform.getId());
if (commonGBChannelList.isEmpty()) {
return new ArrayList<>();
}
List<CommonGBChannel> channelList = new ArrayList<>();
// 是否包含平台信息
if (platform.getCatalogWithPlatform()) {
CommonGBChannel channel = CommonGBChannel.build(platform);
channelList.add(channel);
}
// 是否包含行政区划信息
if (platform.getCatalogWithRegion()) {
List<CommonGBChannel> regionChannelList = regionMapper.queryInChannelList(commonGBChannelList);
if (!regionChannelList.isEmpty()) {
channelList.addAll(regionChannelList);
}
}
// 是否包含分组信息
if (platform.getCatalogWithGroup()) {
List<CommonGBChannel> groupChannelList = groupMapper.queryInChannelList(commonGBChannelList);
if (!groupChannelList.isEmpty()) {
channelList.addAll(groupChannelList);
}
}
channelList.addAll(commonGBChannelList);
return channelList;
}
@Override
public CommonGBChannel getOne(int id) {
return commonGBChannelMapper.queryById(id);
@@ -594,4 +632,9 @@ public class GbChannelServiceImpl implements IGbChannelService {
}
commonGBChannelMapper.removeParentIdByChannels(channelList);
}
@Override
public CommonGBChannel queryOneWithPlatform(Integer platformId, String channelDeviceId) {
return commonGBChannelMapper.queryOneWithPlatform(platformId, channelDeviceId);
}
}

View File

@@ -6,7 +6,7 @@ import com.genersoft.iot.vmp.gb28181.event.EventPublisher;
import com.genersoft.iot.vmp.gb28181.event.subscribe.catalog.CatalogEvent;
import com.genersoft.iot.vmp.gb28181.service.IPlatformChannelService;
import com.genersoft.iot.vmp.gb28181.dao.DeviceChannelMapper;
import com.genersoft.iot.vmp.gb28181.dao.ParentPlatformMapper;
import com.genersoft.iot.vmp.gb28181.dao.PlatformMapper;
import com.genersoft.iot.vmp.gb28181.dao.PlatformCatalogMapper;
import com.genersoft.iot.vmp.gb28181.dao.PlatformChannelMapper;
import com.genersoft.iot.vmp.gb28181.controller.bean.ChannelReduce;
@@ -51,14 +51,14 @@ public class PlatformChannelServiceImpl implements IPlatformChannelService {
private PlatformCatalogMapper catalogManager;
@Autowired
private ParentPlatformMapper platformMapper;
private PlatformMapper platformMapper;
@Autowired
EventPublisher eventPublisher;
@Override
public int updateChannelForGB(String platformId, List<ChannelReduce> channelReduces, String catalogId) {
ParentPlatform platform = platformMapper.getParentPlatByServerGBId(platformId);
Platform platform = platformMapper.getParentPlatByServerGBId(platformId);
if (platform == null) {
log.warn("更新级联通道信息时未找到平台{}的信息", platformId);
return 0;
@@ -122,7 +122,7 @@ public class PlatformChannelServiceImpl implements IPlatformChannelService {
return allCount;
}
private List<CommonGBChannel> getDeviceChannelListByChannelReduceList(List<ChannelReduce> channelReduces, String catalogId, ParentPlatform platform) {
private List<CommonGBChannel> getDeviceChannelListByChannelReduceList(List<ChannelReduce> channelReduces, String catalogId, Platform platform) {
List<CommonGBChannel> deviceChannelList = new ArrayList<>();
if (!channelReduces.isEmpty()){
PlatformCatalog catalog = catalogManager.selectByPlatFormAndCatalogId(platform.getServerGBId(),catalogId);
@@ -157,7 +157,7 @@ public class PlatformChannelServiceImpl implements IPlatformChannelService {
if (platformId == null) {
return 0;
}
ParentPlatform platform = platformMapper.getParentPlatByServerGBId(platformId);
Platform platform = platformMapper.getParentPlatByServerGBId(platformId);
if (platform == null) {
return 0;
}

View File

@@ -25,7 +25,7 @@ import com.genersoft.iot.vmp.gb28181.service.IPlayService;
import com.genersoft.iot.vmp.service.bean.*;
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
import com.genersoft.iot.vmp.storager.dao.GbStreamMapper;
import com.genersoft.iot.vmp.gb28181.dao.ParentPlatformMapper;
import com.genersoft.iot.vmp.gb28181.dao.PlatformMapper;
import com.genersoft.iot.vmp.utils.DateUtil;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
@@ -59,7 +59,7 @@ public class PlatformServiceImpl implements IPlatformService {
private final static String KEEPALIVE_KEY_PREFIX = "platform_keepalive_";
@Autowired
private ParentPlatformMapper platformMapper;
private PlatformMapper platformMapper;
@Autowired
private IRedisCatchStorage redisCatchStorage;
@@ -106,7 +106,7 @@ public class PlatformServiceImpl implements IPlatformService {
for (SendRtpItem sendRtpItem : sendRtpItems) {
if (sendRtpItem != null && sendRtpItem.getApp().equals(event.getApp())) {
String platformId = sendRtpItem.getPlatformId();
ParentPlatform platform = platformMapper.getParentPlatByServerGBId(platformId);
Platform platform = platformMapper.getParentPlatByServerGBId(platformId);
try {
if (platform != null) {
@@ -132,7 +132,7 @@ public class PlatformServiceImpl implements IPlatformService {
List<SendRtpItem> sendRtpItems = redisCatchStorage.querySendRTPServerByStream(event.getStream());
if (sendRtpItems != null && !sendRtpItems.isEmpty()) {
for (SendRtpItem sendRtpItem : sendRtpItems) {
ParentPlatform parentPlatform = platformMapper.getParentPlatByServerGBId(sendRtpItem.getPlatformId());
Platform parentPlatform = platformMapper.getParentPlatByServerGBId(sendRtpItem.getPlatformId());
ssrcFactory.releaseSsrc(sendRtpItem.getMediaServerId(), sendRtpItem.getSsrc());
try {
commanderForPlatform.streamByeCmd(parentPlatform, sendRtpItem.getCallId());
@@ -147,28 +147,27 @@ public class PlatformServiceImpl implements IPlatformService {
@Override
public ParentPlatform queryPlatformByServerGBId(String platformGbId) {
public Platform queryPlatformByServerGBId(String platformGbId) {
return platformMapper.getParentPlatByServerGBId(platformGbId);
}
@Override
public PageInfo<ParentPlatform> queryParentPlatformList(int page, int count) {
public PageInfo<Platform> queryParentPlatformList(int page, int count) {
PageHelper.startPage(page, count);
List<ParentPlatform> all = platformMapper.getParentPlatformList();
List<Platform> all = platformMapper.getParentPlatformList();
return new PageInfo<>(all);
}
@Override
public boolean add(ParentPlatform parentPlatform) {
public boolean add(Platform parentPlatform) {
if (parentPlatform.getCatalogGroup() == 0) {
// 每次发送目录的数量默认为1
parentPlatform.setCatalogGroup(1);
}
parentPlatform.setCatalogId(parentPlatform.getDeviceGBId());
int result = platformMapper.addParentPlatform(parentPlatform);
// 添加缓存
ParentPlatformCatch parentPlatformCatch = new ParentPlatformCatch();
PlatformCatch parentPlatformCatch = new PlatformCatch();
parentPlatformCatch.setParentPlatform(parentPlatform);
parentPlatformCatch.setId(parentPlatform.getServerGBId());
parentPlatformCatch.setParentPlatform(parentPlatform);
@@ -188,11 +187,11 @@ public class PlatformServiceImpl implements IPlatformService {
}
@Override
public boolean update(ParentPlatform parentPlatform) {
public boolean update(Platform parentPlatform) {
log.info("[国标级联]更新平台 {}", parentPlatform.getDeviceGBId());
parentPlatform.setCharacterSet(parentPlatform.getCharacterSet().toUpperCase());
ParentPlatform parentPlatformOld = platformMapper.getParentPlatById(parentPlatform.getId());
ParentPlatformCatch parentPlatformCatchOld = redisCatchStorage.queryPlatformCatchInfo(parentPlatformOld.getServerGBId());
Platform parentPlatformOld = platformMapper.getParentPlatById(parentPlatform.getId());
PlatformCatch parentPlatformCatchOld = redisCatchStorage.queryPlatformCatchInfo(parentPlatformOld.getServerGBId());
parentPlatform.setUpdateTime(DateUtil.getNow());
// 停止心跳定时
@@ -221,7 +220,7 @@ public class PlatformServiceImpl implements IPlatformService {
platformMapper.updateParentPlatform(parentPlatform);
// 更新redis
redisCatchStorage.delPlatformCatchInfo(parentPlatformOld.getServerGBId());
ParentPlatformCatch parentPlatformCatch = new ParentPlatformCatch();
PlatformCatch parentPlatformCatch = new PlatformCatch();
parentPlatformCatch.setParentPlatform(parentPlatform);
parentPlatformCatch.setId(parentPlatform.getServerGBId());
redisCatchStorage.updatePlatformCatchInfo(parentPlatformCatch);
@@ -245,15 +244,15 @@ public class PlatformServiceImpl implements IPlatformService {
@Override
public void online(ParentPlatform parentPlatform, SipTransactionInfo sipTransactionInfo) {
public void online(Platform parentPlatform, SipTransactionInfo sipTransactionInfo) {
log.info("[国标级联]{}, 平台上线", parentPlatform.getServerGBId());
final String registerFailAgainTaskKey = REGISTER_FAIL_AGAIN_KEY_PREFIX + parentPlatform.getServerGBId();
dynamicTask.stop(registerFailAgainTaskKey);
platformMapper.updateParentPlatformStatus(parentPlatform.getServerGBId(), true);
ParentPlatformCatch parentPlatformCatch = redisCatchStorage.queryPlatformCatchInfo(parentPlatform.getServerGBId());
PlatformCatch parentPlatformCatch = redisCatchStorage.queryPlatformCatchInfo(parentPlatform.getServerGBId());
if (parentPlatformCatch == null) {
parentPlatformCatch = new ParentPlatformCatch();
parentPlatformCatch = new PlatformCatch();
parentPlatformCatch.setParentPlatform(parentPlatform);
parentPlatformCatch.setId(parentPlatform.getServerGBId());
parentPlatform.setStatus(true);
@@ -288,7 +287,7 @@ public class PlatformServiceImpl implements IPlatformService {
log.warn("[国标级联]发送心跳收到错误code {}, msg: {}", eventResult.statusCode, eventResult.msg);
}
// 心跳失败
ParentPlatformCatch platformCatch = redisCatchStorage.queryPlatformCatchInfo(parentPlatform.getServerGBId());
PlatformCatch platformCatch = redisCatchStorage.queryPlatformCatchInfo(parentPlatform.getServerGBId());
// 此时是第三次心跳超时, 平台离线
if (platformCatch.getKeepAliveReply() == 2) {
// 设置平台离线,并重新注册
@@ -302,7 +301,7 @@ public class PlatformServiceImpl implements IPlatformService {
}, eventResult -> {
// 心跳成功
// 清空之前的心跳超时计数
ParentPlatformCatch platformCatch = redisCatchStorage.queryPlatformCatchInfo(parentPlatform.getServerGBId());
PlatformCatch platformCatch = redisCatchStorage.queryPlatformCatchInfo(parentPlatform.getServerGBId());
if (platformCatch != null && platformCatch.getKeepAliveReply() > 0) {
platformCatch.setKeepAliveReply(0);
redisCatchStorage.updatePlatformCatchInfo(platformCatch);
@@ -329,7 +328,7 @@ public class PlatformServiceImpl implements IPlatformService {
}
@Override
public void addSimulatedSubscribeInfo(ParentPlatform parentPlatform) {
public void addSimulatedSubscribeInfo(Platform parentPlatform) {
// 自动添加一条模拟的订阅信息
SubscribeInfo subscribeInfo = new SubscribeInfo();
subscribeInfo.setId(parentPlatform.getServerGBId());
@@ -343,7 +342,7 @@ public class PlatformServiceImpl implements IPlatformService {
subscribeHolder.putCatalogSubscribe(parentPlatform.getServerGBId(), subscribeInfo);
}
private void registerTask(ParentPlatform parentPlatform, SipTransactionInfo sipTransactionInfo){
private void registerTask(Platform parentPlatform, SipTransactionInfo sipTransactionInfo){
try {
// 不在同一个会话中续订则每次全新注册
if (!userSetting.isRegisterKeepIntDialog()) {
@@ -367,12 +366,12 @@ public class PlatformServiceImpl implements IPlatformService {
}
@Override
public void offline(ParentPlatform parentPlatform, boolean stopRegister) {
public void offline(Platform parentPlatform, boolean stopRegister) {
log.info("[平台离线]{}", parentPlatform.getServerGBId());
ParentPlatformCatch parentPlatformCatch = redisCatchStorage.queryPlatformCatchInfo(parentPlatform.getServerGBId());
PlatformCatch parentPlatformCatch = redisCatchStorage.queryPlatformCatchInfo(parentPlatform.getServerGBId());
parentPlatformCatch.setKeepAliveReply(0);
parentPlatformCatch.setRegisterAliveReply(0);
ParentPlatform parentPlatformInCatch = parentPlatformCatch.getParentPlatform();
Platform parentPlatformInCatch = parentPlatformCatch.getParentPlatform();
parentPlatformInCatch.setStatus(false);
parentPlatformCatch.setParentPlatform(parentPlatformInCatch);
redisCatchStorage.updatePlatformCatchInfo(parentPlatformCatch);
@@ -409,7 +408,7 @@ public class PlatformServiceImpl implements IPlatformService {
if (!stopRegister) {
// 设置为60秒自动尝试重新注册
final String registerFailAgainTaskKey = REGISTER_FAIL_AGAIN_KEY_PREFIX + parentPlatform.getServerGBId();
ParentPlatform platform = platformMapper.getParentPlatById(parentPlatform.getId());
Platform platform = platformMapper.getParentPlatById(parentPlatform.getId());
if (platform.isEnable()) {
dynamicTask.startCron(registerFailAgainTaskKey,
()-> registerTask(platform, null),
@@ -431,7 +430,7 @@ public class PlatformServiceImpl implements IPlatformService {
}
@Override
public void login(ParentPlatform parentPlatform) {
public void login(Platform parentPlatform) {
final String registerTaskKey = REGISTER_KEY_PREFIX + parentPlatform.getServerGBId();
try {
commanderForPlatform.register(parentPlatform, eventResult1 -> {
@@ -449,7 +448,7 @@ public class PlatformServiceImpl implements IPlatformService {
@Override
public void sendNotifyMobilePosition(String platformId) {
ParentPlatform platform = platformMapper.getParentPlatByServerGBId(platformId);
Platform platform = platformMapper.getParentPlatByServerGBId(platformId);
if (platform == null) {
return;
}
@@ -483,7 +482,7 @@ public class PlatformServiceImpl implements IPlatformService {
}
@Override
public void broadcastInvite(ParentPlatform platform, String channelId, MediaServer mediaServerItem, HookSubscribe.Event hookEvent,
public void broadcastInvite(Platform platform, String channelId, MediaServer mediaServerItem, HookSubscribe.Event hookEvent,
SipSubscribe.Event errorEvent, InviteTimeOutCallback timeoutCallback) throws InvalidArgumentException, ParseException, SipException {
if (mediaServerItem == null) {
@@ -625,7 +624,7 @@ public class PlatformServiceImpl implements IPlatformService {
}
private void inviteOKHandler(SipSubscribe.EventResult eventResult, SSRCInfo ssrcInfo, int tcpMode, boolean ssrcCheck, MediaServer mediaServerItem,
ParentPlatform platform, String channelId, String timeOutTaskKey, ErrorCallback<Object> callback,
Platform platform, String channelId, String timeOutTaskKey, ErrorCallback<Object> callback,
InviteInfo inviteInfo, InviteSessionType inviteSessionType){
inviteInfo.setStatus(InviteSessionStatus.ok);
ResponseEvent responseEvent = (ResponseEvent) eventResult.event;
@@ -727,7 +726,7 @@ public class PlatformServiceImpl implements IPlatformService {
}
private void tcpActiveHandler(ParentPlatform platform, String channelId, String contentString,
private void tcpActiveHandler(Platform platform, String channelId, String contentString,
MediaServer mediaServerItem, int tcpMode, boolean ssrcCheck,
String timeOutTaskKey, SSRCInfo ssrcInfo, ErrorCallback<Object> callback){
if (tcpMode != 2) {
@@ -776,28 +775,28 @@ public class PlatformServiceImpl implements IPlatformService {
}
@Override
public void stopBroadcast(ParentPlatform platform, DeviceChannel channel, String stream, boolean sendBye, MediaServer mediaServerItem) {
public void stopBroadcast(Platform platform, CommonGBChannel channel, String stream, boolean sendBye, MediaServer mediaServerItem) {
try {
if (sendBye) {
commanderForPlatform.streamByeCmd(platform, channel.getDeviceId(), stream, null, null);
commanderForPlatform.streamByeCmd(platform, channel.getGbDeviceId(), stream, null, null);
}
} catch (InvalidArgumentException | SipException | ParseException | SsrcTransactionNotFoundException e) {
log.warn("[消息发送失败] 停止语音对讲, 平台:{},通道:{}", platform.getId(), channel.getDeviceId() );
log.warn("[消息发送失败] 停止语音对讲, 平台:{},通道:{}", platform.getId(), channel.getGbDeviceId() );
} finally {
mediaServerService.closeRTPServer(mediaServerItem, stream);
InviteInfo inviteInfo = inviteStreamService.getInviteInfo(null, platform.getServerGBId(), channel.getDeviceId(), stream);
InviteInfo inviteInfo = inviteStreamService.getInviteInfo(null, platform.getServerGBId(), channel.getGbDeviceId(), stream);
if (inviteInfo != null) {
// 释放ssrc
mediaServerService.releaseSsrc(mediaServerItem.getId(), inviteInfo.getSsrcInfo().getSsrc());
inviteStreamService.removeInviteInfo(inviteInfo);
}
streamSession.remove(platform.getServerGBId(), channel.getDeviceId(), stream);
streamSession.remove(platform.getServerGBId(), channel.getGbDeviceId(), stream);
}
}
@Override
public ParentPlatform queryOne(Integer platformId) {
public Platform queryOne(Integer platformId) {
return platformMapper.getParentPlatById(platformId);
}
}

View File

@@ -130,7 +130,7 @@ public class PlayServiceImpl implements IPlayService {
if (streamArray.length == 2) {
String deviceId = streamArray[0];
String channelId = streamArray[1];
Device device = deviceService.getDevice(deviceId);
Device device = deviceService.getDeviceByDeviceId(deviceId);
if (device == null) {
log.info("[语音对讲/喊话] 未找到设备:{}", deviceId);
return;
@@ -172,7 +172,7 @@ public class PlayServiceImpl implements IPlayService {
for (SendRtpItem sendRtpItem : sendRtpItems) {
if (sendRtpItem != null && sendRtpItem.getApp().equals(event.getApp())) {
String platformId = sendRtpItem.getPlatformId();
Device device = deviceService.getDevice(platformId);
Device device = deviceService.getDeviceByDeviceId(platformId);
try {
if (device != null) {
cmder.streamByeCmd(device, sendRtpItem.getChannelId(), event.getStream(), sendRtpItem.getCallId());
@@ -200,7 +200,7 @@ public class PlayServiceImpl implements IPlayService {
if (streamArray.length == 2) {
String deviceId = streamArray[0];
String channelId = streamArray[1];
Device device = deviceService.getDevice(deviceId);
Device device = deviceService.getDeviceByDeviceId(deviceId);
if (device == null) {
log.info("[语音对讲/喊话] 未找到设备:{}", deviceId);
return;
@@ -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 = deviceService.getDevice(deviceId);
Device device = deviceService.getDeviceByDeviceId(deviceId);
if (device == null) {
log.warn("[录像回放] 未找到设备 deviceId: {},channelId:{}", deviceId, channelId);
throw new ControllerException(ErrorCode.ERROR100.getCode(), "未找到设备:" + deviceId);
@@ -793,7 +793,7 @@ public class PlayServiceImpl implements IPlayService {
return;
}
Device device = deviceService.getDevice(deviceId);
Device device = deviceService.getDeviceByDeviceId(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 = deviceService.getDevice(deviceId);
Device device = deviceService.getDeviceByDeviceId(deviceId);
if (device == null) {
return;
}
@@ -989,7 +989,7 @@ public class PlayServiceImpl implements IPlayService {
null);
return;
}
Device device = deviceService.getDevice(deviceId);
Device device = deviceService.getDeviceByDeviceId(deviceId);
if (device == null) {
callback.run(InviteErrorCode.ERROR_FOR_PARAMETER_ERROR.getCode(),
"设备:" + deviceId + "不存在",
@@ -1155,7 +1155,7 @@ public class PlayServiceImpl implements IPlayService {
if (sendRtpItems.size() > 0) {
for (SendRtpItem sendRtpItem : sendRtpItems) {
if (sendRtpItem.getMediaServerId().equals(mediaServerId)) {
ParentPlatform platform = storager.queryParentPlatByServerGBId(sendRtpItem.getPlatformId());
Platform platform = storager.queryParentPlatByServerGBId(sendRtpItem.getPlatformId());
try {
sipCommanderFroPlatform.streamByeCmd(platform, sendRtpItem.getCallId());
} catch (SipException | InvalidArgumentException | ParseException e) {
@@ -1169,7 +1169,7 @@ public class PlayServiceImpl implements IPlayService {
if (allSsrc.size() > 0) {
for (SsrcTransaction ssrcTransaction : allSsrc) {
if (ssrcTransaction.getMediaServerId().equals(mediaServerId)) {
Device device = deviceService.getDevice(ssrcTransaction.getDeviceId());
Device device = deviceService.getDeviceByDeviceId(ssrcTransaction.getDeviceId());
if (device == null) {
continue;
}
@@ -1291,7 +1291,7 @@ public class PlayServiceImpl implements IPlayService {
}
if (audioBroadcastCatchList.size() > 0) {
for (AudioBroadcastCatch audioBroadcastCatch : audioBroadcastCatchList) {
Device device = deviceService.getDevice(deviceId);
Device device = deviceService.getDeviceByDeviceId(deviceId);
if (device == null || audioBroadcastCatch == null) {
return;
}
@@ -1390,7 +1390,7 @@ public class PlayServiceImpl implements IPlayService {
if (!result) {
throw new ServiceException("暂停RTP接收失败");
}
Device device = deviceService.getDevice(inviteInfo.getDeviceId());
Device device = deviceService.getDeviceByDeviceId(inviteInfo.getDeviceId());
cmder.playPauseCmd(device, inviteInfo.getStreamInfo());
}
@@ -1418,12 +1418,12 @@ public class PlayServiceImpl implements IPlayService {
if (!result) {
throw new ServiceException("继续RTP接收失败");
}
Device device = deviceService.getDevice(inviteInfo.getDeviceId());
Device device = deviceService.getDeviceByDeviceId(inviteInfo.getDeviceId());
cmder.playResumeCmd(device, inviteInfo.getStreamInfo());
}
@Override
public void startPushStream(SendRtpItem sendRtpItem, SIPResponse sipResponse, ParentPlatform platform, CallIdHeader callIdHeader) {
public void startPushStream(SendRtpItem sendRtpItem, SIPResponse sipResponse, Platform platform, CallIdHeader callIdHeader) {
// 开始发流
MediaServer mediaInfo = mediaServerService.getOne(sendRtpItem.getMediaServerId());
@@ -1448,9 +1448,9 @@ public class PlayServiceImpl implements IPlayService {
}
@Override
public void startSendRtpStreamFailHand(SendRtpItem sendRtpItem, ParentPlatform platform, CallIdHeader callIdHeader) {
public void startSendRtpStreamFailHand(SendRtpItem sendRtpItem, Platform platform, CallIdHeader callIdHeader) {
if (sendRtpItem.isOnlyAudio()) {
Device device = deviceService.getDevice(sendRtpItem.getDeviceId());
Device device = deviceService.getDeviceByDeviceId(sendRtpItem.getDeviceId());
AudioBroadcastCatch audioBroadcastCatch = audioBroadcastManager.get(sendRtpItem.getDeviceId(), sendRtpItem.getChannelId());
if (audioBroadcastCatch != null) {
try {
@@ -1571,7 +1571,7 @@ public class PlayServiceImpl implements IPlayService {
@Override
public void getSnap(String deviceId, String channelId, String fileName, ErrorCallback errorCallback) {
Device device = deviceService.getDevice(deviceId);
Device device = deviceService.getDeviceByDeviceId(deviceId);
if (device == null) {
errorCallback.run(InviteErrorCode.ERROR_FOR_PARAMETER_ERROR.getCode(), InviteErrorCode.ERROR_FOR_PARAMETER_ERROR.getMsg(), null);
return;

View File

@@ -1,7 +1,7 @@
package com.genersoft.iot.vmp.gb28181.task;
import com.genersoft.iot.vmp.gb28181.bean.Device;
import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform;
import com.genersoft.iot.vmp.gb28181.bean.Platform;
import com.genersoft.iot.vmp.gb28181.bean.SendRtpItem;
import com.genersoft.iot.vmp.gb28181.session.SSRCFactory;
import com.genersoft.iot.vmp.gb28181.transmit.cmd.ISIPCommanderForPlatform;
@@ -95,7 +95,7 @@ public class SipRunner implements CommandLineRunner {
ssrcFactory.releaseSsrc(sendRtpItem.getMediaServerId(), sendRtpItem.getSsrc());
boolean stopResult = mediaServerService.initStopSendRtp(mediaServerItem, sendRtpItem.getApp(), sendRtpItem.getStream(), sendRtpItem.getSsrc());
if (stopResult) {
ParentPlatform platform = platformService.queryPlatformByServerGBId(sendRtpItem.getPlatformId());
Platform platform = platformService.queryPlatformByServerGBId(sendRtpItem.getPlatformId());
if (platform != null) {
try {
commanderForPlatform.streamByeCmd(platform, sendRtpItem.getCallId());

View File

@@ -22,12 +22,12 @@ public interface ISIPCommanderForPlatform {
* @param parentPlatform
* @return
*/
void register(ParentPlatform parentPlatform, SipSubscribe.Event errorEvent , SipSubscribe.Event okEvent) throws InvalidArgumentException, ParseException, SipException;
void register(Platform parentPlatform, SipSubscribe.Event errorEvent , SipSubscribe.Event okEvent) throws InvalidArgumentException, ParseException, SipException;
void register(ParentPlatform parentPlatform, SipTransactionInfo sipTransactionInfo, SipSubscribe.Event errorEvent , SipSubscribe.Event okEvent) throws InvalidArgumentException, ParseException, SipException;
void register(Platform parentPlatform, SipTransactionInfo sipTransactionInfo, SipSubscribe.Event errorEvent , SipSubscribe.Event okEvent) throws InvalidArgumentException, ParseException, SipException;
void register(ParentPlatform parentPlatform, SipTransactionInfo sipTransactionInfo, WWWAuthenticateHeader www, SipSubscribe.Event errorEvent , SipSubscribe.Event okEvent, boolean isRegister) throws SipException, InvalidArgumentException, ParseException;
void register(Platform parentPlatform, SipTransactionInfo sipTransactionInfo, WWWAuthenticateHeader www, SipSubscribe.Event errorEvent , SipSubscribe.Event okEvent, boolean isRegister) throws SipException, InvalidArgumentException, ParseException;
/**
* 向上级平台注销
@@ -35,7 +35,7 @@ public interface ISIPCommanderForPlatform {
* @param parentPlatform
* @return
*/
void unregister(ParentPlatform parentPlatform, SipTransactionInfo sipTransactionInfo, SipSubscribe.Event errorEvent , SipSubscribe.Event okEvent) throws InvalidArgumentException, ParseException, SipException;
void unregister(Platform parentPlatform, SipTransactionInfo sipTransactionInfo, SipSubscribe.Event errorEvent , SipSubscribe.Event okEvent) throws InvalidArgumentException, ParseException, SipException;
/**
@@ -44,7 +44,7 @@ public interface ISIPCommanderForPlatform {
* @param parentPlatform
* @return callId(作为接受回复的判定)
*/
String keepalive(ParentPlatform parentPlatform, SipSubscribe.Event errorEvent, SipSubscribe.Event okEvent)
String keepalive(Platform parentPlatform, SipSubscribe.Event errorEvent, SipSubscribe.Event okEvent)
throws SipException, InvalidArgumentException, ParseException;
@@ -58,10 +58,10 @@ public interface ISIPCommanderForPlatform {
* @param size
* @return
*/
void catalogQuery(CommonGBChannel channel, ParentPlatform parentPlatform, String sn, String fromTag, int size)
void catalogQuery(CommonGBChannel channel, Platform parentPlatform, String sn, String fromTag, int size)
throws SipException, InvalidArgumentException, ParseException;
void catalogQuery(List<CommonGBChannel> channels, ParentPlatform parentPlatform, String sn, String fromTag)
void catalogQuery(List<CommonGBChannel> channels, Platform parentPlatform, String sn, String fromTag)
throws InvalidArgumentException, ParseException, SipException;
/**
@@ -72,7 +72,7 @@ public interface ISIPCommanderForPlatform {
* @param fromTag FROM头的tag信息
* @return
*/
void deviceInfoResponse(ParentPlatform parentPlatform,Device device, String sn, String fromTag) throws SipException, InvalidArgumentException, ParseException;
void deviceInfoResponse(Platform parentPlatform, Device device, String sn, String fromTag) throws SipException, InvalidArgumentException, ParseException;
/**
* 向上级回复DeviceStatus查询信息
@@ -82,7 +82,7 @@ public interface ISIPCommanderForPlatform {
* @param fromTag
* @return
*/
void deviceStatusResponse(ParentPlatform parentPlatform,String channelId, String sn, String fromTag,boolean status) throws SipException, InvalidArgumentException, ParseException;
void deviceStatusResponse(Platform parentPlatform, String channelId, String sn, String fromTag, boolean status) throws SipException, InvalidArgumentException, ParseException;
/**
* 向上级回复移动位置订阅消息
@@ -92,7 +92,7 @@ public interface ISIPCommanderForPlatform {
* @param subscribeInfo 订阅相关的信息
* @return
*/
void sendNotifyMobilePosition(ParentPlatform parentPlatform, GPSMsgInfo gpsMsgInfo, SubscribeInfo subscribeInfo)
void sendNotifyMobilePosition(Platform parentPlatform, GPSMsgInfo gpsMsgInfo, SubscribeInfo subscribeInfo)
throws InvalidArgumentException, ParseException, NoSuchFieldException, SipException, IllegalAccessException;
/**
@@ -102,7 +102,7 @@ public interface ISIPCommanderForPlatform {
* @param deviceAlarm 报警信息信息
* @return
*/
void sendAlarmMessage(ParentPlatform parentPlatform, DeviceAlarm deviceAlarm) throws SipException, InvalidArgumentException, ParseException;
void sendAlarmMessage(Platform parentPlatform, DeviceAlarm deviceAlarm) throws SipException, InvalidArgumentException, ParseException;
/**
* 回复catalog事件-增加/更新
@@ -110,7 +110,7 @@ public interface ISIPCommanderForPlatform {
* @param parentPlatform
* @param deviceChannels
*/
void sendNotifyForCatalogAddOrUpdate(String type, ParentPlatform parentPlatform, List<CommonGBChannel> deviceChannels, SubscribeInfo subscribeInfo, Integer index) throws InvalidArgumentException, ParseException, NoSuchFieldException, SipException, IllegalAccessException;
void sendNotifyForCatalogAddOrUpdate(String type, Platform parentPlatform, List<CommonGBChannel> deviceChannels, SubscribeInfo subscribeInfo, Integer index) throws InvalidArgumentException, ParseException, NoSuchFieldException, SipException, IllegalAccessException;
/**
* 回复catalog事件-删除
@@ -118,7 +118,7 @@ public interface ISIPCommanderForPlatform {
* @param parentPlatform
* @param deviceChannels
*/
void sendNotifyForCatalogOther(String type, ParentPlatform parentPlatform, List<CommonGBChannel> deviceChannels,
void sendNotifyForCatalogOther(String type, Platform parentPlatform, List<CommonGBChannel> deviceChannels,
SubscribeInfo subscribeInfo, Integer index) throws InvalidArgumentException,
ParseException, NoSuchFieldException, SipException, IllegalAccessException;
@@ -130,7 +130,7 @@ public interface ISIPCommanderForPlatform {
* @param fromTag fromTag
* @param recordInfo 录像信息
*/
void recordInfo(CommonGBChannel deviceChannel, ParentPlatform parentPlatform, String fromTag, RecordInfo recordInfo)
void recordInfo(CommonGBChannel deviceChannel, Platform parentPlatform, String fromTag, RecordInfo recordInfo)
throws SipException, InvalidArgumentException, ParseException;
/**
@@ -140,7 +140,7 @@ public interface ISIPCommanderForPlatform {
* @param sendRtpItem
* @return
*/
void sendMediaStatusNotify(ParentPlatform platform, SendRtpItem sendRtpItem) throws SipException, InvalidArgumentException, ParseException;
void sendMediaStatusNotify(Platform platform, SendRtpItem sendRtpItem) throws SipException, InvalidArgumentException, ParseException;
/**
* 向发起点播的上级回复bye
@@ -148,15 +148,15 @@ public interface ISIPCommanderForPlatform {
* @param platform 平台信息
* @param callId callId
*/
void streamByeCmd(ParentPlatform platform, String callId) throws SipException, InvalidArgumentException, ParseException;
void streamByeCmd(Platform platform, String callId) throws SipException, InvalidArgumentException, ParseException;
void streamByeCmd(ParentPlatform platform, SendRtpItem sendRtpItem) throws SipException, InvalidArgumentException, ParseException;
void streamByeCmd(Platform platform, SendRtpItem sendRtpItem) throws SipException, InvalidArgumentException, ParseException;
void streamByeCmd(ParentPlatform platform, String channelId, String stream, String callId, SipSubscribe.Event okEvent) throws InvalidArgumentException, SipException, ParseException, SsrcTransactionNotFoundException;
void streamByeCmd(Platform platform, String channelId, String stream, String callId, SipSubscribe.Event okEvent) throws InvalidArgumentException, SipException, ParseException, SsrcTransactionNotFoundException;
void broadcastInviteCmd(ParentPlatform platform, String channelId, MediaServer mediaServerItem,
void broadcastInviteCmd(Platform platform, String channelId, MediaServer mediaServerItem,
SSRCInfo ssrcInfo, HookSubscribe.Event event, SipSubscribe.Event okEvent,
SipSubscribe.Event errorEvent) throws ParseException, SipException, InvalidArgumentException;
void broadcastResultCmd(ParentPlatform platform, CommonGBChannel deviceChannel, String sn, boolean result, SipSubscribe.Event errorEvent, SipSubscribe.Event okEvent) throws InvalidArgumentException, SipException, ParseException;
void broadcastResultCmd(Platform platform, CommonGBChannel deviceChannel, String sn, boolean result, SipSubscribe.Event errorEvent, SipSubscribe.Event okEvent) throws InvalidArgumentException, SipException, ParseException;
}

View File

@@ -2,7 +2,7 @@ package com.genersoft.iot.vmp.gb28181.transmit.cmd;
import com.genersoft.iot.vmp.conf.SipConfig;
import com.genersoft.iot.vmp.gb28181.SipLayer;
import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform;
import com.genersoft.iot.vmp.gb28181.bean.Platform;
import com.genersoft.iot.vmp.gb28181.bean.SendRtpItem;
import com.genersoft.iot.vmp.gb28181.bean.SipTransactionInfo;
import com.genersoft.iot.vmp.gb28181.bean.SubscribeInfo;
@@ -47,7 +47,7 @@ public class SIPRequestHeaderPlarformProvider {
@Autowired
private IRedisCatchStorage redisCatchStorage;
public Request createRegisterRequest(@NotNull ParentPlatform parentPlatform, long CSeq, String fromTag, String toTag, CallIdHeader callIdHeader, int expires) throws ParseException, InvalidArgumentException, PeerUnavailableException {
public Request createRegisterRequest(@NotNull Platform parentPlatform, long CSeq, String fromTag, String toTag, CallIdHeader callIdHeader, int expires) throws ParseException, InvalidArgumentException, PeerUnavailableException {
Request request = null;
String sipAddress = parentPlatform.getDeviceIp() + ":" + parentPlatform.getDevicePort();
//请求行
@@ -88,8 +88,8 @@ public class SIPRequestHeaderPlarformProvider {
return request;
}
public Request createRegisterRequest(@NotNull ParentPlatform parentPlatform, String fromTag, String toTag,
WWWAuthenticateHeader www , CallIdHeader callIdHeader, int expires) throws ParseException, PeerUnavailableException, InvalidArgumentException {
public Request createRegisterRequest(@NotNull Platform parentPlatform, String fromTag, String toTag,
WWWAuthenticateHeader www , CallIdHeader callIdHeader, int expires) throws ParseException, PeerUnavailableException, InvalidArgumentException {
Request registerRequest = createRegisterRequest(parentPlatform, redisCatchStorage.getCSEQ(), fromTag, toTag, callIdHeader, expires);
@@ -165,18 +165,18 @@ public class SIPRequestHeaderPlarformProvider {
return registerRequest;
}
public Request createMessageRequest(ParentPlatform parentPlatform, String content, SendRtpItem sendRtpItem) throws PeerUnavailableException, ParseException, InvalidArgumentException {
public Request createMessageRequest(Platform parentPlatform, String content, SendRtpItem sendRtpItem) throws PeerUnavailableException, ParseException, InvalidArgumentException {
CallIdHeader callIdHeader = SipFactory.getInstance().createHeaderFactory().createCallIdHeader(sendRtpItem.getCallId());
callIdHeader.setCallId(sendRtpItem.getCallId());
return createMessageRequest(parentPlatform, content, sendRtpItem.getToTag(), SipUtils.getNewViaTag(), sendRtpItem.getFromTag(), callIdHeader);
}
public Request createMessageRequest(ParentPlatform parentPlatform, String content, String fromTag, String viaTag, CallIdHeader callIdHeader) throws PeerUnavailableException, ParseException, InvalidArgumentException {
public Request createMessageRequest(Platform parentPlatform, String content, String fromTag, String viaTag, CallIdHeader callIdHeader) throws PeerUnavailableException, ParseException, InvalidArgumentException {
return createMessageRequest(parentPlatform, content, fromTag, viaTag, null, callIdHeader);
}
public Request createMessageRequest(ParentPlatform parentPlatform, String content, String fromTag, String viaTag, String toTag, CallIdHeader callIdHeader) throws PeerUnavailableException, ParseException, InvalidArgumentException {
public Request createMessageRequest(Platform parentPlatform, String content, String fromTag, String viaTag, String toTag, CallIdHeader callIdHeader) throws PeerUnavailableException, ParseException, InvalidArgumentException {
Request request = null;
String serverAddress = parentPlatform.getServerIP()+ ":" + parentPlatform.getServerPort();
// sipuri
@@ -214,7 +214,7 @@ public class SIPRequestHeaderPlarformProvider {
return request;
}
public SIPRequest createNotifyRequest(ParentPlatform parentPlatform, String content, SubscribeInfo subscribeInfo) throws PeerUnavailableException, ParseException, InvalidArgumentException {
public SIPRequest createNotifyRequest(Platform parentPlatform, String content, SubscribeInfo subscribeInfo) throws PeerUnavailableException, ParseException, InvalidArgumentException {
SIPRequest request = null;
// sipuri
SipURI requestURI = SipFactory.getInstance().createAddressFactory().createSipURI(parentPlatform.getServerGBId(), parentPlatform.getServerIP()+ ":" + parentPlatform.getServerPort());
@@ -269,7 +269,7 @@ public class SIPRequestHeaderPlarformProvider {
return request;
}
public SIPRequest createByeRequest(ParentPlatform platform, SendRtpItem sendRtpItem) throws PeerUnavailableException, ParseException, InvalidArgumentException {
public SIPRequest createByeRequest(Platform platform, SendRtpItem sendRtpItem) throws PeerUnavailableException, ParseException, InvalidArgumentException {
if (sendRtpItem == null ) {
return null;
@@ -315,7 +315,7 @@ public class SIPRequestHeaderPlarformProvider {
return request;
}
public Request createInviteRequest(ParentPlatform platform, String channelId, String content, String viaTag, String fromTag, String ssrc, CallIdHeader callIdHeader) throws PeerUnavailableException, ParseException, InvalidArgumentException {
public Request createInviteRequest(Platform platform, String channelId, String content, String viaTag, String fromTag, String ssrc, CallIdHeader callIdHeader) throws PeerUnavailableException, ParseException, InvalidArgumentException {
Request request = null;
//请求行
String platformHostAddress = platform.getServerIP() + ":" + platform.getServerPort();
@@ -355,7 +355,7 @@ public class SIPRequestHeaderPlarformProvider {
return request;
}
public Request createByteRequest(ParentPlatform platform, String channelId, SipTransactionInfo transactionInfo) throws PeerUnavailableException, ParseException, InvalidArgumentException {
public Request createByteRequest(Platform platform, String channelId, SipTransactionInfo transactionInfo) throws PeerUnavailableException, ParseException, InvalidArgumentException {
String deviceHostAddress = platform.getDeviceIp() + ":" + platform.getDevicePort();
Request request = null;
SipURI requestLine = SipFactory.getInstance().createAddressFactory().createSipURI(channelId, deviceHostAddress);

View File

@@ -85,24 +85,24 @@ public class SIPCommanderFroPlatform implements ISIPCommanderForPlatform {
private GitUtil gitUtil;
@Override
public void register(ParentPlatform parentPlatform, SipSubscribe.Event errorEvent , SipSubscribe.Event okEvent) throws InvalidArgumentException, ParseException, SipException {
public void register(Platform parentPlatform, SipSubscribe.Event errorEvent , SipSubscribe.Event okEvent) throws InvalidArgumentException, ParseException, SipException {
register(parentPlatform, null, null, errorEvent, okEvent, true);
}
@Override
public void register(ParentPlatform parentPlatform, SipTransactionInfo sipTransactionInfo, SipSubscribe.Event errorEvent , SipSubscribe.Event okEvent) throws InvalidArgumentException, ParseException, SipException {
public void register(Platform parentPlatform, SipTransactionInfo sipTransactionInfo, SipSubscribe.Event errorEvent , SipSubscribe.Event okEvent) throws InvalidArgumentException, ParseException, SipException {
register(parentPlatform, sipTransactionInfo, null, errorEvent, okEvent, true);
}
@Override
public void unregister(ParentPlatform parentPlatform, SipTransactionInfo sipTransactionInfo, SipSubscribe.Event errorEvent , SipSubscribe.Event okEvent) throws InvalidArgumentException, ParseException, SipException {
public void unregister(Platform parentPlatform, SipTransactionInfo sipTransactionInfo, SipSubscribe.Event errorEvent , SipSubscribe.Event okEvent) throws InvalidArgumentException, ParseException, SipException {
register(parentPlatform, sipTransactionInfo, null, errorEvent, okEvent, false);
}
@Override
public void register(ParentPlatform parentPlatform, @Nullable SipTransactionInfo sipTransactionInfo, @Nullable WWWAuthenticateHeader www,
SipSubscribe.Event errorEvent , SipSubscribe.Event okEvent, boolean isRegister) throws SipException, InvalidArgumentException, ParseException {
public void register(Platform parentPlatform, @Nullable SipTransactionInfo sipTransactionInfo, @Nullable WWWAuthenticateHeader www,
SipSubscribe.Event errorEvent , SipSubscribe.Event okEvent, boolean isRegister) throws SipException, InvalidArgumentException, ParseException {
Request request;
CallIdHeader callIdHeader = sipSender.getNewCallIdHeader(parentPlatform.getDeviceIp(),parentPlatform.getTransport());
@@ -148,7 +148,7 @@ public class SIPCommanderFroPlatform implements ISIPCommanderForPlatform {
}
@Override
public String keepalive(ParentPlatform parentPlatform,SipSubscribe.Event errorEvent , SipSubscribe.Event okEvent) throws SipException, InvalidArgumentException, ParseException {
public String keepalive(Platform parentPlatform, SipSubscribe.Event errorEvent , SipSubscribe.Event okEvent) throws SipException, InvalidArgumentException, ParseException {
String characterSet = parentPlatform.getCharacterSet();
StringBuffer keepaliveXml = new StringBuffer(200);
keepaliveXml.append("<?xml version=\"1.0\" encoding=\"")
@@ -178,7 +178,7 @@ public class SIPCommanderFroPlatform implements ISIPCommanderForPlatform {
* @param parentPlatform 平台信息
*/
@Override
public void catalogQuery(CommonGBChannel channel, ParentPlatform parentPlatform, String sn, String fromTag, int size) throws SipException, InvalidArgumentException, ParseException {
public void catalogQuery(CommonGBChannel channel, Platform parentPlatform, String sn, String fromTag, int size) throws SipException, InvalidArgumentException, ParseException {
if ( parentPlatform ==null) {
return ;
@@ -198,13 +198,13 @@ public class SIPCommanderFroPlatform implements ISIPCommanderForPlatform {
}
@Override
public void catalogQuery(List<CommonGBChannel> channels, ParentPlatform parentPlatform, String sn, String fromTag) throws InvalidArgumentException, ParseException, SipException {
public void catalogQuery(List<CommonGBChannel> channels, Platform parentPlatform, String sn, String fromTag) throws InvalidArgumentException, ParseException, SipException {
if ( parentPlatform ==null) {
return ;
}
sendCatalogResponse(channels, parentPlatform, sn, fromTag, 0, true);
}
private String getCatalogXml(List<CommonGBChannel> channels, String sn, ParentPlatform parentPlatform, int size) {
private String getCatalogXml(List<CommonGBChannel> channels, String sn, Platform parentPlatform, int size) {
String characterSet = parentPlatform.getCharacterSet();
StringBuffer catalogXml = new StringBuffer(600);
catalogXml.append("<?xml version=\"1.0\" encoding=\"" + characterSet +"\"?>\r\n")
@@ -225,7 +225,7 @@ public class SIPCommanderFroPlatform implements ISIPCommanderForPlatform {
return catalogXml.toString();
}
private void sendCatalogResponse(List<CommonGBChannel> channels, ParentPlatform parentPlatform, String sn, String fromTag, int index, boolean sendAfterResponse) throws SipException, InvalidArgumentException, ParseException {
private void sendCatalogResponse(List<CommonGBChannel> channels, Platform parentPlatform, String sn, String fromTag, int index, boolean sendAfterResponse) throws SipException, InvalidArgumentException, ParseException {
if (index >= channels.size()) {
return;
}
@@ -295,7 +295,7 @@ public class SIPCommanderFroPlatform implements ISIPCommanderForPlatform {
* @return
*/
@Override
public void deviceInfoResponse(ParentPlatform parentPlatform,Device device, String sn, String fromTag) throws SipException, InvalidArgumentException, ParseException {
public void deviceInfoResponse(Platform parentPlatform, Device device, String sn, String fromTag) throws SipException, InvalidArgumentException, ParseException {
if (parentPlatform == null) {
return;
}
@@ -333,7 +333,7 @@ public class SIPCommanderFroPlatform implements ISIPCommanderForPlatform {
* @return
*/
@Override
public void deviceStatusResponse(ParentPlatform parentPlatform,String channelId, String sn, String fromTag,boolean status) throws SipException, InvalidArgumentException, ParseException {
public void deviceStatusResponse(Platform parentPlatform, String channelId, String sn, String fromTag, boolean status) throws SipException, InvalidArgumentException, ParseException {
if (parentPlatform == null) {
return ;
}
@@ -357,7 +357,7 @@ public class SIPCommanderFroPlatform implements ISIPCommanderForPlatform {
}
@Override
public void sendNotifyMobilePosition(ParentPlatform parentPlatform, GPSMsgInfo gpsMsgInfo, SubscribeInfo subscribeInfo) throws InvalidArgumentException, ParseException, NoSuchFieldException, SipException, IllegalAccessException {
public void sendNotifyMobilePosition(Platform parentPlatform, GPSMsgInfo gpsMsgInfo, SubscribeInfo subscribeInfo) throws InvalidArgumentException, ParseException, NoSuchFieldException, SipException, IllegalAccessException {
if (parentPlatform == null) {
return;
}
@@ -385,7 +385,7 @@ public class SIPCommanderFroPlatform implements ISIPCommanderForPlatform {
}
@Override
public void sendAlarmMessage(ParentPlatform parentPlatform, DeviceAlarm deviceAlarm) throws SipException, InvalidArgumentException, ParseException {
public void sendAlarmMessage(Platform parentPlatform, DeviceAlarm deviceAlarm) throws SipException, InvalidArgumentException, ParseException {
if (parentPlatform == null) {
return;
}
@@ -417,7 +417,7 @@ public class SIPCommanderFroPlatform implements ISIPCommanderForPlatform {
}
@Override
public void sendNotifyForCatalogAddOrUpdate(String type, ParentPlatform parentPlatform, List<CommonGBChannel> deviceChannels, SubscribeInfo subscribeInfo, Integer index) throws InvalidArgumentException, ParseException, NoSuchFieldException, SipException, IllegalAccessException {
public void sendNotifyForCatalogAddOrUpdate(String type, Platform parentPlatform, List<CommonGBChannel> deviceChannels, SubscribeInfo subscribeInfo, Integer index) throws InvalidArgumentException, ParseException, NoSuchFieldException, SipException, IllegalAccessException {
if (parentPlatform == null || deviceChannels == null || deviceChannels.isEmpty() || subscribeInfo == null) {
return;
}
@@ -451,8 +451,8 @@ public class SIPCommanderFroPlatform implements ISIPCommanderForPlatform {
}));
}
private void sendNotify(ParentPlatform parentPlatform, String catalogXmlContent,
SubscribeInfo subscribeInfo, SipSubscribe.Event errorEvent, SipSubscribe.Event okEvent )
private void sendNotify(Platform parentPlatform, String catalogXmlContent,
SubscribeInfo subscribeInfo, SipSubscribe.Event errorEvent, SipSubscribe.Event okEvent )
throws SipException, ParseException, InvalidArgumentException {
MessageFactoryImpl messageFactory = (MessageFactoryImpl) SipFactory.getInstance().createMessageFactory();
String characterSet = parentPlatform.getCharacterSet();
@@ -464,7 +464,7 @@ public class SIPCommanderFroPlatform implements ISIPCommanderForPlatform {
sipSender.transmitRequest(parentPlatform.getDeviceIp(), notifyRequest, errorEvent, okEvent);
}
private String getCatalogXmlContentForCatalogAddOrUpdate(ParentPlatform parentPlatform, List<CommonGBChannel> channels, int sumNum, String type, SubscribeInfo subscribeInfo) {
private String getCatalogXmlContentForCatalogAddOrUpdate(Platform parentPlatform, List<CommonGBChannel> channels, int sumNum, String type, SubscribeInfo subscribeInfo) {
StringBuffer catalogXml = new StringBuffer(600);
String characterSet = parentPlatform.getCharacterSet();
catalogXml.append("<?xml version=\"1.0\" encoding=\"" + characterSet + "\"?>\r\n")
@@ -485,8 +485,8 @@ public class SIPCommanderFroPlatform implements ISIPCommanderForPlatform {
}
@Override
public void sendNotifyForCatalogOther(String type, ParentPlatform parentPlatform, List<CommonGBChannel> deviceChannels,
SubscribeInfo subscribeInfo, Integer index) throws InvalidArgumentException, ParseException, NoSuchFieldException, SipException, IllegalAccessException {
public void sendNotifyForCatalogOther(String type, Platform parentPlatform, List<CommonGBChannel> deviceChannels,
SubscribeInfo subscribeInfo, Integer index) throws InvalidArgumentException, ParseException, NoSuchFieldException, SipException, IllegalAccessException {
if (parentPlatform == null
|| deviceChannels == null
|| deviceChannels.size() == 0
@@ -523,7 +523,7 @@ public class SIPCommanderFroPlatform implements ISIPCommanderForPlatform {
});
}
private String getCatalogXmlContentForCatalogOther(ParentPlatform parentPlatform, List<CommonGBChannel> channels, String type) {
private String getCatalogXmlContentForCatalogOther(Platform parentPlatform, List<CommonGBChannel> channels, String type) {
String characterSet = parentPlatform.getCharacterSet();
StringBuffer catalogXml = new StringBuffer(600);
@@ -544,7 +544,7 @@ public class SIPCommanderFroPlatform implements ISIPCommanderForPlatform {
return catalogXml.toString();
}
@Override
public void recordInfo(CommonGBChannel deviceChannel, ParentPlatform parentPlatform, String fromTag, RecordInfo recordInfo) throws SipException, InvalidArgumentException, ParseException {
public void recordInfo(CommonGBChannel deviceChannel, Platform parentPlatform, String fromTag, RecordInfo recordInfo) throws SipException, InvalidArgumentException, ParseException {
if ( parentPlatform ==null) {
return ;
}
@@ -597,7 +597,7 @@ public class SIPCommanderFroPlatform implements ISIPCommanderForPlatform {
}
@Override
public void sendMediaStatusNotify(ParentPlatform parentPlatform, SendRtpItem sendRtpItem) throws SipException, InvalidArgumentException, ParseException {
public void sendMediaStatusNotify(Platform parentPlatform, SendRtpItem sendRtpItem) throws SipException, InvalidArgumentException, ParseException {
if (sendRtpItem == null || parentPlatform == null) {
return;
}
@@ -621,7 +621,7 @@ public class SIPCommanderFroPlatform implements ISIPCommanderForPlatform {
}
@Override
public void streamByeCmd(ParentPlatform platform, String callId) throws SipException, InvalidArgumentException, ParseException {
public void streamByeCmd(Platform platform, String callId) throws SipException, InvalidArgumentException, ParseException {
if (platform == null) {
return;
}
@@ -632,7 +632,7 @@ public class SIPCommanderFroPlatform implements ISIPCommanderForPlatform {
}
@Override
public synchronized void streamByeCmd(ParentPlatform platform, SendRtpItem sendRtpItem) throws SipException, InvalidArgumentException, ParseException {
public synchronized void streamByeCmd(Platform platform, SendRtpItem sendRtpItem) throws SipException, InvalidArgumentException, ParseException {
if (sendRtpItem == null ) {
log.info("[向上级发送BYE] sendRtpItem 为NULL");
return;
@@ -656,7 +656,7 @@ public class SIPCommanderFroPlatform implements ISIPCommanderForPlatform {
}
@Override
public void streamByeCmd(ParentPlatform platform, String channelId, String stream, String callId, SipSubscribe.Event okEvent) throws InvalidArgumentException, SipException, ParseException, SsrcTransactionNotFoundException {
public void streamByeCmd(Platform platform, String channelId, String stream, String callId, SipSubscribe.Event okEvent) throws InvalidArgumentException, SipException, ParseException, SsrcTransactionNotFoundException {
SsrcTransaction ssrcTransaction = streamSession.getSsrcTransaction(platform.getServerGBId(), channelId, callId, stream);
if (ssrcTransaction == null) {
throw new SsrcTransactionNotFoundException(platform.getServerGBId(), channelId, callId, stream);
@@ -671,7 +671,7 @@ public class SIPCommanderFroPlatform implements ISIPCommanderForPlatform {
}
@Override
public void broadcastResultCmd(ParentPlatform platform, CommonGBChannel deviceChannel, String sn, boolean result, SipSubscribe.Event errorEvent, SipSubscribe.Event okEvent) throws InvalidArgumentException, SipException, ParseException {
public void broadcastResultCmd(Platform platform, CommonGBChannel deviceChannel, String sn, boolean result, SipSubscribe.Event errorEvent, SipSubscribe.Event okEvent) throws InvalidArgumentException, SipException, ParseException {
if (platform == null || deviceChannel == null) {
return;
}
@@ -694,7 +694,7 @@ public class SIPCommanderFroPlatform implements ISIPCommanderForPlatform {
}
@Override
public void broadcastInviteCmd(ParentPlatform platform, String channelId, MediaServer mediaServerItem,
public void broadcastInviteCmd(Platform platform, String channelId, MediaServer mediaServerItem,
SSRCInfo ssrcInfo, HookSubscribe.Event event, SipSubscribe.Event okEvent,
SipSubscribe.Event errorEvent) throws ParseException, SipException, InvalidArgumentException {
String stream = ssrcInfo.getStream();

View File

@@ -1,6 +1,6 @@
package com.genersoft.iot.vmp.gb28181.transmit.event.request;
import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform;
import com.genersoft.iot.vmp.gb28181.bean.Platform;
import com.genersoft.iot.vmp.gb28181.transmit.SIPSender;
import com.genersoft.iot.vmp.gb28181.utils.SipUtils;
import com.google.common.primitives.Bytes;
@@ -127,7 +127,7 @@ public abstract class SIPRequestProcessorParent {
/**
* 回复带sdp的200
*/
public SIPResponse responseSdpAck(SIPRequest request, String sdp, ParentPlatform platform) throws SipException, InvalidArgumentException, ParseException {
public SIPResponse responseSdpAck(SIPRequest request, String sdp, Platform platform) throws SipException, InvalidArgumentException, ParseException {
ContentTypeHeader contentTypeHeader = SipFactory.getInstance().createHeaderFactory().createContentTypeHeader("APPLICATION", "SDP");
@@ -150,7 +150,7 @@ public abstract class SIPRequestProcessorParent {
/**
* 回复带xml的200
*/
public SIPResponse responseXmlAck(SIPRequest request, String xml, ParentPlatform platform, Integer expires) throws SipException, InvalidArgumentException, ParseException {
public SIPResponse responseXmlAck(SIPRequest request, String xml, Platform platform, Integer expires) throws SipException, InvalidArgumentException, ParseException {
ContentTypeHeader contentTypeHeader = SipFactory.getInstance().createHeaderFactory().createContentTypeHeader("Application", "MANSCDP+xml");
SipURI sipURI = (SipURI)request.getRequestURI();

View File

@@ -4,7 +4,7 @@ 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.Device;
import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform;
import com.genersoft.iot.vmp.gb28181.bean.Platform;
import com.genersoft.iot.vmp.gb28181.bean.SendRtpItem;
import com.genersoft.iot.vmp.gb28181.transmit.SIPProcessorObserver;
import com.genersoft.iot.vmp.gb28181.transmit.event.request.ISIPRequestProcessor;
@@ -100,7 +100,7 @@ public class AckRequestProcessor extends SIPRequestProcessorParent implements In
sendRtpItem.getSsrc(),
sendRtpItem.isTcp()?(sendRtpItem.isTcpActive()?"TCP主动":"TCP被动"):"UDP"
);
ParentPlatform parentPlatform = storager.queryParentPlatByServerGBId(fromUserId);
Platform parentPlatform = storager.queryParentPlatByServerGBId(fromUserId);
if (parentPlatform != null) {
if (!userSetting.getServerId().equals(sendRtpItem.getServerId())) {
@@ -122,7 +122,7 @@ public class AckRequestProcessor extends SIPRequestProcessorParent implements In
}
}
}else {
Device device = deviceService.getDevice(fromUserId);
Device device = deviceService.getDeviceByDeviceId(fromUserId);
if (device == null) {
log.warn("[收到ACK]:来自{},目标为({})的推流信息为找到流体服务[{}]信息",fromUserId, toUserId, sendRtpItem.getMediaServerId());
return;

View File

@@ -67,10 +67,10 @@ public class ByeRequestProcessor extends SIPRequestProcessorParent implements In
private AudioBroadcastManager audioBroadcastManager;
@Autowired
private IDeviceChannelService channelService;
private IVideoManagerStorage storager;
@Autowired
private IVideoManagerStorage storager;
private IGbChannelService channelService;
@Autowired
private IMediaServerService mediaServerService;
@@ -123,7 +123,7 @@ public class ByeRequestProcessor extends SIPRequestProcessorParent implements In
if (sendRtpItem.getPlayType().equals(InviteStreamType.PUSH)) {
// 不是本平台的就发送redis消息让其他wvp停止发流
ParentPlatform platform = platformService.queryPlatformByServerGBId(sendRtpItem.getPlatformId());
Platform platform = platformService.queryPlatformByServerGBId(sendRtpItem.getPlatformId());
if (platform != null) {
redisCatchStorage.sendPlatformStopPlayMsg(sendRtpItem, platform);
if (!userSetting.getServerId().equals(sendRtpItem.getServerId())) {
@@ -163,7 +163,7 @@ public class ByeRequestProcessor extends SIPRequestProcessorParent implements In
if (mediaInfo.getReaderCount() <= 0) {
log.info("[收到bye] {} 无其它观看者,通知设备停止推流", streamId);
if (sendRtpItem.getPlayType().equals(InviteStreamType.PLAY)) {
Device device = deviceService.getDevice(sendRtpItem.getDeviceId());
Device device = deviceService.getDeviceByDeviceId(sendRtpItem.getDeviceId());
if (device == null) {
log.info("[收到bye] {} 通知设备停止推流时未找到设备信息", streamId);
}
@@ -185,11 +185,11 @@ public class ByeRequestProcessor extends SIPRequestProcessorParent implements In
}
log.info("[收到bye] 来自设备:{}, 通道: {}, 类型: {}", ssrcTransaction.getDeviceId(), ssrcTransaction.getChannelId(), ssrcTransaction.getType());
ParentPlatform platform = platformService.queryPlatformByServerGBId(ssrcTransaction.getDeviceId());
Platform platform = platformService.queryPlatformByServerGBId(ssrcTransaction.getDeviceId());
if (platform != null ) {
if (ssrcTransaction.getType().equals(InviteSessionType.BROADCAST)) {
log.info("[收到bye] 上级停止语音对讲,来自:{}, 通道已停止推流: {}", ssrcTransaction.getDeviceId(), ssrcTransaction.getChannelId());
DeviceChannel channel = storager.queryChannelInParentPlatform(ssrcTransaction.getDeviceId(), ssrcTransaction.getChannelId());
CommonGBChannel channel = channelService.queryOneWithPlatform(platform.getId(), ssrcTransaction.getChannelId());
if (channel == null) {
log.info("[收到bye] 未找到通道,设备:{} 通道:{}", ssrcTransaction.getDeviceId(), ssrcTransaction.getChannelId());
return;
@@ -198,16 +198,16 @@ public class ByeRequestProcessor extends SIPRequestProcessorParent implements In
platformService.stopBroadcast(platform, channel, ssrcTransaction.getStream(), false,
mediaServerService.getOne(mediaServerId));
playService.stopAudioBroadcast(ssrcTransaction.getDeviceId(), channel.getDeviceId());
playService.stopAudioBroadcast(ssrcTransaction.getDeviceId(), channel.getGbDeviceId());
}
}else {
Device device = deviceService.getDevice(ssrcTransaction.getDeviceId());
Device device = deviceService.getDeviceByDeviceId(ssrcTransaction.getDeviceId());
if (device == null) {
log.info("[收到bye] 未找到设备:{} ", ssrcTransaction.getDeviceId());
return;
}
DeviceChannel channel = channelService.getOne(ssrcTransaction.getDeviceId(), ssrcTransaction.getChannelId());
DeviceChannel channel = deviceChannelService.getOne(ssrcTransaction.getDeviceId(), ssrcTransaction.getChannelId());
if (channel == null) {
log.info("[收到bye] 未找到通道,设备:{} 通道:{}", ssrcTransaction.getDeviceId(), ssrcTransaction.getChannelId());
return;

View File

@@ -10,6 +10,7 @@ import com.genersoft.iot.vmp.conf.SipConfig;
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.service.IGbChannelService;
import com.genersoft.iot.vmp.gb28181.service.IPlayService;
import com.genersoft.iot.vmp.gb28181.session.AudioBroadcastManager;
import com.genersoft.iot.vmp.gb28181.session.SSRCFactory;
@@ -82,6 +83,9 @@ public class InviteRequestProcessor extends SIPRequestProcessorParent implements
@Autowired
private IVideoManagerStorage storager;
@Autowired
private IGbChannelService channelService;
@Autowired
private IStreamPushService streamPushService;
@@ -184,21 +188,18 @@ public class InviteRequestProcessor extends SIPRequestProcessorParent implements
requesterId, callIdHeader.getCallId(), request.getRemoteAddress(), request.getRemotePort());
// 查询请求是否来自上级平台\设备
ParentPlatform platform = storager.queryParentPlatByServerGBId(requesterId);
Platform platform = storager.queryParentPlatByServerGBId(requesterId);
if (platform == null) {
inviteFromDeviceHandle(request, requesterId, channelId);
} else {
// 查询平台下是否有该通道
DeviceChannel channel = storager.queryChannelInParentPlatform(requesterId, channelId);
GbStream gbStream = storager.queryStreamInParentPlatform(requesterId, channelId);
// PlatformCatalog catalog = storager.getCatalog(requesterId, channelId);
CommonGBChannel channel= channelService.queryOneWithPlatform(platform.getId(), channelId);
MediaServer mediaServerItem = null;
StreamPush streamPushItem = null;
StreamProxy proxyByAppAndStream = null;
// 不是通道可能是直播流
if (channel != null && gbStream == null) {
if (channel != null ) {
// 通道存在发100TRYING
try {
responseAck(request, Response.TRYING);
@@ -644,7 +645,7 @@ public class InviteRequestProcessor extends SIPRequestProcessorParent implements
}
}
private void startSendRtpStreamHand(RequestEvent evt, SendRtpItem sendRtpItem, ParentPlatform parentPlatform,
private void startSendRtpStreamHand(RequestEvent evt, SendRtpItem sendRtpItem, Platform parentPlatform,
JSONObject jsonObject, Map<String, Object> param, CallIdHeader callIdHeader) {
if (jsonObject == null) {
log.error("下级TCP被动启动监听失败: 请检查ZLM服务");
@@ -659,7 +660,7 @@ public class InviteRequestProcessor extends SIPRequestProcessorParent implements
/**
* 安排推流
*/
private void sendProxyStream(SendRtpItem sendRtpItem, MediaServer mediaServerItem, ParentPlatform platform, SIPRequest request) {
private void sendProxyStream(SendRtpItem sendRtpItem, MediaServer mediaServerItem, Platform platform, SIPRequest request) {
MediaInfo mediaInfo = mediaServerService.getMediaInfo(mediaServerItem, sendRtpItem.getApp(), sendRtpItem.getStream());
if (mediaInfo != null) {
@@ -688,7 +689,7 @@ public class InviteRequestProcessor extends SIPRequestProcessorParent implements
}
}
private void sendPushStream(SendRtpItem sendRtpItem, MediaServer mediaServerItem, ParentPlatform platform, SIPRequest request) {
private void sendPushStream(SendRtpItem sendRtpItem, MediaServer mediaServerItem, Platform platform, SIPRequest request) {
// 推流
if (sendRtpItem.getServerId().equals(userSetting.getServerId())) {
MediaInfo mediaInfo = mediaServerService.getMediaInfo(mediaServerItem, sendRtpItem.getApp(), sendRtpItem.getStream());
@@ -729,7 +730,7 @@ public class InviteRequestProcessor extends SIPRequestProcessorParent implements
/**
* 通知流上线
*/
private void notifyProxyStreamOnline(SendRtpItem sendRtpItem, MediaServer mediaServerItem, ParentPlatform platform, SIPRequest request) {
private void notifyProxyStreamOnline(SendRtpItem sendRtpItem, MediaServer mediaServerItem, Platform platform, SIPRequest request) {
// TODO 控制启用以使设备上线
log.info("[ app={}, stream={} ]通道未推流,启用流后开始推流", sendRtpItem.getApp(), sendRtpItem.getStream());
// 监听流上线
@@ -758,7 +759,7 @@ public class InviteRequestProcessor extends SIPRequestProcessorParent implements
/**
* 通知流上线
*/
private void notifyPushStreamOnline(SendRtpItem sendRtpItem, MediaServer mediaServerItem, ParentPlatform platform, SIPRequest request) {
private void notifyPushStreamOnline(SendRtpItem sendRtpItem, MediaServer mediaServerItem, Platform platform, SIPRequest request) {
// 发送redis消息以使设备上线流上线后被
log.info("[ app={}, stream={} ]通道未推流发送redis信息控制设备开始推流", sendRtpItem.getApp(), sendRtpItem.getStream());
MessageForPushChannel messageForPushChannel = MessageForPushChannel.getInstance(1,
@@ -847,7 +848,7 @@ public class InviteRequestProcessor extends SIPRequestProcessorParent implements
/**
* 来自其他wvp的推流
*/
private void otherWvpPushStream(SendRtpItem sendRtpItem, SIPRequest request, ParentPlatform platform) {
private void otherWvpPushStream(SendRtpItem sendRtpItem, SIPRequest request, Platform platform) {
log.info("[级联点播] 来自其他wvp的推流 {}/{}", sendRtpItem.getApp(), sendRtpItem.getStream());
sendRtpItem = redisRpcService.getSendRtpItem(sendRtpItem.getRedisKey());
if (sendRtpItem == null) {
@@ -862,7 +863,7 @@ public class InviteRequestProcessor extends SIPRequestProcessorParent implements
redisCatchStorage.updateSendRTPSever(sendRtpItem);
}
public SIPResponse sendStreamAck(SIPRequest request, SendRtpItem sendRtpItem, ParentPlatform platform) {
public SIPResponse sendStreamAck(SIPRequest request, SendRtpItem sendRtpItem, Platform platform) {
String sdpIp = sendRtpItem.getLocalIp();
if (!ObjectUtils.isEmpty(platform.getSendStreamIp())) {
@@ -1117,7 +1118,7 @@ public class InviteRequestProcessor extends SIPRequestProcessorParent implements
content.append("y=" + ssrc + "\r\n");
content.append("f=v/////a/1/8/1\r\n");
ParentPlatform parentPlatform = new ParentPlatform();
Platform parentPlatform = new Platform();
parentPlatform.setServerIP(device.getIp());
parentPlatform.setServerPort(device.getPort());
parentPlatform.setServerGBId(device.getDeviceId());

View File

@@ -93,7 +93,7 @@ public class RegisterRequestProcessor extends SIPRequestProcessorParent implemen
SipUri uri = (SipUri) address.getURI();
String deviceId = uri.getUser();
Device device = deviceService.getDevice(deviceId);
Device device = deviceService.getDeviceByDeviceId(deviceId);
RemoteAddressInfo remoteAddressInfo = SipUtils.getRemoteAddressFromRequest(request,
userSetting.getSipUseSourceIpAsRemoteAddress());

View File

@@ -1,7 +1,7 @@
package com.genersoft.iot.vmp.gb28181.transmit.event.request.impl;
import com.genersoft.iot.vmp.gb28181.bean.CmdType;
import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform;
import com.genersoft.iot.vmp.gb28181.bean.Platform;
import com.genersoft.iot.vmp.gb28181.bean.SubscribeHolder;
import com.genersoft.iot.vmp.gb28181.bean.SubscribeInfo;
import com.genersoft.iot.vmp.gb28181.transmit.SIPProcessorObserver;
@@ -108,7 +108,7 @@ public class SubscribeRequestProcessor extends SIPRequestProcessorParent impleme
}
String platformId = SipUtils.getUserIdFromFromHeader(request);
String deviceId = XmlUtil.getText(rootElement, "DeviceID");
ParentPlatform platform = storager.queryParentPlatByServerGBId(platformId);
Platform platform = storager.queryParentPlatByServerGBId(platformId);
SubscribeInfo subscribeInfo = new SubscribeInfo(request, platformId);
if (platform == null) {
return;
@@ -137,7 +137,7 @@ public class SubscribeRequestProcessor extends SIPRequestProcessorParent impleme
}
try {
ParentPlatform parentPlatform = storager.queryParentPlatByServerGBId(platformId);
Platform parentPlatform = storager.queryParentPlatByServerGBId(platformId);
SIPResponse response = responseXmlAck(request, resultXml.toString(), parentPlatform, subscribeInfo.getExpires());
if (subscribeInfo.getExpires() == 0) {
subscribeHolder.removeMobilePositionSubscribe(platformId);
@@ -163,7 +163,7 @@ public class SubscribeRequestProcessor extends SIPRequestProcessorParent impleme
}
String platformId = SipUtils.getUserIdFromFromHeader(request);
String deviceId = XmlUtil.getText(rootElement, "DeviceID");
ParentPlatform platform = storager.queryParentPlatByServerGBId(platformId);
Platform platform = storager.queryParentPlatByServerGBId(platformId);
if (platform == null){
return;
}
@@ -186,7 +186,7 @@ public class SubscribeRequestProcessor extends SIPRequestProcessorParent impleme
subscribeHolder.removeCatalogSubscribe(platformId);
}
try {
ParentPlatform parentPlatform = storager.queryParentPlatByServerGBId(platformId);
Platform parentPlatform = storager.queryParentPlatByServerGBId(platformId);
SIPResponse response = responseXmlAck(request, resultXml.toString(), parentPlatform, subscribeInfo.getExpires());
if (subscribeInfo.getExpires() == 0) {
subscribeHolder.removeCatalogSubscribe(platformId);

View File

@@ -9,7 +9,6 @@ import com.genersoft.iot.vmp.gb28181.transmit.SIPProcessorObserver;
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.gb28181.service.IDeviceService;
import com.genersoft.iot.vmp.gb28181.service.IInviteStreamService;
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
@@ -28,6 +27,9 @@ import javax.sip.header.ContentTypeHeader;
import javax.sip.message.Response;
import java.text.ParseException;
/**
* INFO 一般用于国标级联时的回放控制
*/
@Slf4j
@Component
public class InfoRequestProcessor extends SIPRequestProcessorParent implements InitializingBean, ISIPRequestProcessor {
@@ -68,22 +70,17 @@ public class InfoRequestProcessor extends SIPRequestProcessorParent implements I
public void process(RequestEvent evt) {
log.debug("接收到消息:" + evt.getRequest());
SIPRequest request = (SIPRequest) evt.getRequest();
String deviceId = SipUtils.getUserIdFromFromHeader(request);
CallIdHeader callIdHeader = request.getCallIdHeader();
// 先从会话内查找
SsrcTransaction ssrcTransaction = sessionManager.getSsrcTransaction(null, null, callIdHeader.getCallId(), null);
// 兼容海康 媒体通知 消息from字段不是设备ID的问题
if (ssrcTransaction != null) {
deviceId = ssrcTransaction.getDeviceId();
}
// 查询设备是否存在
Device device = redisCatchStorage.getDevice(deviceId);
Device device = redisCatchStorage.getDevice(ssrcTransaction.getDeviceId());
// 查询上级平台是否存在
ParentPlatform parentPlatform = storage.queryParentPlatByServerGBId(deviceId);
Platform parentPlatform = storage.queryParentPlatByServerGBId(ssrcTransaction.getDeviceId());
try {
if (device != null && parentPlatform != null) {
log.warn("[重复]平台与设备编号重复:{}", deviceId);
log.warn("[重复]平台与设备编号重复:{}", ssrcTransaction.getDeviceId());
String hostAddress = request.getRemoteAddress().getHostAddress();
int remotePort = request.getRemotePort();
if (device.getHostAddress().equals(hostAddress + ":" + remotePort)) {
@@ -94,8 +91,8 @@ public class InfoRequestProcessor extends SIPRequestProcessorParent implements I
}
if (device == null && parentPlatform == null) {
// 不存在则回复404
responseAck(request, Response.NOT_FOUND, "device "+ deviceId +" not found");
log.warn("[设备未找到 ] {}", deviceId);
responseAck(request, Response.NOT_FOUND, "device "+ ssrcTransaction.getDeviceId() +" not found");
log.warn("[设备未找到 ] {}", ssrcTransaction.getDeviceId());
if (sipSubscribe.getErrorSubscribe(callIdHeader.getCallId()) != null){
DeviceNotFoundEvent deviceNotFoundEvent = new DeviceNotFoundEvent(evt.getDialog());
deviceNotFoundEvent.setCallId(callIdHeader.getCallId());
@@ -114,8 +111,9 @@ public class InfoRequestProcessor extends SIPRequestProcessorParent implements I
responseAck(request, Response.NOT_FOUND, "stream " + streamId + " not found");
return;
}
Device device1 = deviceService.getDevice(inviteInfo.getDeviceId());
Device device1 = deviceService.getDeviceByDeviceId(inviteInfo.getDeviceId());
if (inviteInfo.getStreamInfo() != null) {
// 不解析协议, 直接转发给对应的设备
cmder.playbackControlCmd(device1,inviteInfo.getStreamInfo(),new String(evt.getRequest().getRawContent()),eventResult -> {
// 失败的回复
try {
@@ -143,6 +141,4 @@ public class InfoRequestProcessor extends SIPRequestProcessorParent implements I
log.warn("SIP回复时解析异常", e);
}
}
}

View File

@@ -1,7 +1,7 @@
package com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message;
import com.genersoft.iot.vmp.gb28181.bean.Device;
import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform;
import com.genersoft.iot.vmp.gb28181.bean.Platform;
import org.dom4j.Element;
import javax.sip.RequestEvent;
@@ -19,5 +19,5 @@ public interface IMessageHandler {
* @param evt
* @param parentPlatform
*/
void handForPlatform(RequestEvent evt, ParentPlatform parentPlatform, Element element);
void handForPlatform(RequestEvent evt, Platform parentPlatform, Element element);
}

View File

@@ -1,7 +1,7 @@
package com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message;
import com.genersoft.iot.vmp.gb28181.bean.Device;
import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform;
import com.genersoft.iot.vmp.gb28181.bean.Platform;
import com.genersoft.iot.vmp.gb28181.transmit.event.request.SIPRequestProcessorParent;
import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.query.cmd.CatalogQueryMessageHandler;
import com.genersoft.iot.vmp.storager.IVideoManagerStorage;
@@ -49,7 +49,7 @@ public abstract class MessageHandlerAbstract extends SIPRequestProcessorParent i
//两个国标平台互相级联时由于上一步判断导致本该在平台处理的消息 放到了设备的处理逻辑
//所以对目录查询单独做了校验
if(messageHandler instanceof CatalogQueryMessageHandler){
ParentPlatform parentPlatform = storage.queryParentPlatByServerGBId(device.getDeviceId());
Platform parentPlatform = storage.queryParentPlatByServerGBId(device.getDeviceId());
messageHandler.handForPlatform(evt, parentPlatform, element);
return;
}
@@ -58,7 +58,7 @@ public abstract class MessageHandlerAbstract extends SIPRequestProcessorParent i
}
@Override
public void handForPlatform(RequestEvent evt, ParentPlatform parentPlatform, Element element) {
public void handForPlatform(RequestEvent evt, Platform parentPlatform, Element element) {
String cmd = getText(element, "CmdType");
IMessageHandler messageHandler = messageHandlerMap.get(cmd);
if (messageHandler != null) {

View File

@@ -2,7 +2,7 @@ package com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message;
import com.genersoft.iot.vmp.gb28181.bean.Device;
import com.genersoft.iot.vmp.gb28181.bean.DeviceNotFoundEvent;
import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform;
import com.genersoft.iot.vmp.gb28181.bean.Platform;
import com.genersoft.iot.vmp.gb28181.bean.SsrcTransaction;
import com.genersoft.iot.vmp.gb28181.event.SipSubscribe;
import com.genersoft.iot.vmp.gb28181.session.VideoStreamSessionManager;
@@ -78,7 +78,7 @@ public class MessageRequestProcessor extends SIPRequestProcessorParent implement
// 查询设备是否存在
Device device = redisCatchStorage.getDevice(deviceId);
// 查询上级平台是否存在
ParentPlatform parentPlatform = storage.queryParentPlatByServerGBId(deviceId);
Platform parentPlatform = storage.queryParentPlatByServerGBId(deviceId);
try {
if (device != null && parentPlatform != null) {
String hostAddress = request.getRemoteAddress().getHostAddress();

View File

@@ -4,7 +4,7 @@ import com.genersoft.iot.vmp.common.enums.DeviceControlType;
import com.genersoft.iot.vmp.gb28181.bean.Device;
import com.genersoft.iot.vmp.gb28181.bean.DragZoomRequest;
import com.genersoft.iot.vmp.gb28181.bean.HomePositionRequest;
import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform;
import com.genersoft.iot.vmp.gb28181.bean.Platform;
import com.genersoft.iot.vmp.gb28181.event.SipSubscribe;
import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommander;
import com.genersoft.iot.vmp.gb28181.transmit.event.request.SIPRequestProcessorParent;
@@ -56,7 +56,7 @@ public class DeviceControlQueryMessageHandler extends SIPRequestProcessorParent
}
@Override
public void handForPlatform(RequestEvent evt, ParentPlatform parentPlatform, Element rootElement) {
public void handForPlatform(RequestEvent evt, Platform parentPlatform, Element rootElement) {
SIPRequest request = (SIPRequest) evt.getRequest();
@@ -65,38 +65,14 @@ public class DeviceControlQueryMessageHandler extends SIPRequestProcessorParent
String channelId = getText(rootElement, "DeviceID");
// 远程启动功能
if (!ObjectUtils.isEmpty(getText(rootElement, "TeleBoot"))) {
// TODO 拒绝远程启动命令
log.warn("[国标级联]收到平台的远程启动命令, 不处理");
// if (parentPlatform.getServerGBId().equals(targetGBId)) {
// // 远程启动本平台需要在重新启动程序后先对SipStack解绑
// logger.info("执行远程启动本平台命令");
// try {
// cmderFroPlatform.unregister(parentPlatform, null, null);
// } catch (InvalidArgumentException | ParseException | SipException e) {
// logger.error("[命令发送失败] 国标级联 注销: {}", e.getMessage());
// }
// taskExecutor.execute(() -> {
// // 远程启动
//// try {
//// Thread.sleep(3000);
//// SipProvider up = (SipProvider) SpringBeanFactory.getBean("udpSipProvider");
//// SipStackImpl stack = (SipStackImpl)up.getSipStack();
//// stack.stop();
//// Iterator listener = stack.getListeningPoints();
//// while (listener.hasNext()) {
//// stack.deleteListeningPoint((ListeningPoint) listener.next());
//// }
//// Iterator providers = stack.getSipProviders();
//// while (providers.hasNext()) {
//// stack.deleteSipProvider((SipProvider) providers.next());
//// }
//// VManageBootstrap.restart();
//// } catch (InterruptedException | ObjectInUseException e) {
//// logger.error("[任务执行失败] 服务重启: {}", e.getMessage());
//// }
// });
// }
// 拒绝远程启动命令
log.warn("[国标级联]收到平台的远程启动命令, 禁用,不允许上级平台随意重启下级平台");
try {
responseAck(request, Response.FORBIDDEN);
} catch (SipException | InvalidArgumentException | ParseException e) {
log.error("[命令发送失败] 错误信息: {}", e.getMessage());
}
return;
}
DeviceControlType deviceControlType = DeviceControlType.typeOf(rootElement);
log.info("[接受deviceControl命令] 命令: {}", deviceControlType);

View File

@@ -198,7 +198,7 @@ public class AlarmNotifyMessageHandler extends SIPRequestProcessorParent impleme
}
@Override
public void handForPlatform(RequestEvent evt, ParentPlatform parentPlatform, Element rootElement) {
public void handForPlatform(RequestEvent evt, Platform parentPlatform, Element rootElement) {
log.info("收到来自平台[{}]的报警通知", parentPlatform.getServerGBId());
// 回复200 OK
try {

View File

@@ -2,6 +2,7 @@ package com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.notify
import com.genersoft.iot.vmp.conf.exception.ControllerException;
import com.genersoft.iot.vmp.gb28181.bean.*;
import com.genersoft.iot.vmp.gb28181.service.IGbChannelService;
import com.genersoft.iot.vmp.gb28181.session.AudioBroadcastManager;
import com.genersoft.iot.vmp.gb28181.transmit.cmd.ISIPCommanderForPlatform;
import com.genersoft.iot.vmp.gb28181.transmit.event.request.SIPRequestProcessorParent;
@@ -42,6 +43,9 @@ public class BroadcastNotifyMessageHandler extends SIPRequestProcessorParent imp
@Autowired
private IVideoManagerStorage storage;
@Autowired
private IGbChannelService channelService;
@Autowired
private ISIPCommanderForPlatform commanderForPlatform;
@@ -74,7 +78,7 @@ public class BroadcastNotifyMessageHandler extends SIPRequestProcessorParent imp
}
@Override
public void handForPlatform(RequestEvent evt, ParentPlatform platform, Element rootElement) {
public void handForPlatform(RequestEvent evt, Platform platform, Element rootElement) {
// 来自上级平台的语音喊话请求
SIPRequest request = (SIPRequest) evt.getRequest();
try {
@@ -94,14 +98,14 @@ public class BroadcastNotifyMessageHandler extends SIPRequestProcessorParent imp
log.info("[国标级联 语音喊话] platform: {}, channel: {}", platform.getServerGBId(), targetId);
DeviceChannel deviceChannel = storage.queryChannelInParentPlatform(platform.getServerGBId(), targetId);
if (deviceChannel == null) {
CommonGBChannel channel = channelService.queryOneWithPlatform(platform.getId(), targetId);
if (channel == null) {
log.warn("[国标级联 语音喊话] 未找到通道 platform: {}, channel: {}", platform.getServerGBId(), targetId);
responseAck(request, Response.NOT_FOUND, "TargetID not found");
return;
}
// 向下级发送语音的喊话请求
Device device = deviceService.getDevice(deviceChannel.getDeviceId());
Device device = deviceService.getDevice(channel.getGbDeviceDbId());
if (device == null) {
responseAck(request, Response.NOT_FOUND, "device not found");
return;
@@ -110,26 +114,26 @@ public class BroadcastNotifyMessageHandler extends SIPRequestProcessorParent imp
// 查看语音通道是否已经建立并且已经在使用
if (playService.audioBroadcastInUse(device, targetId)) {
commanderForPlatform.broadcastResultCmd(platform, deviceChannel, sn, false,null, null);
commanderForPlatform.broadcastResultCmd(platform, channel, sn, false,null, null);
return;
}
MediaServer mediaServerForMinimumLoad = mediaServerService.getMediaServerForMinimumLoad(null);
commanderForPlatform.broadcastResultCmd(platform, deviceChannel, sn, true, eventResult->{
commanderForPlatform.broadcastResultCmd(platform, channel, sn, true, eventResult->{
log.info("[国标级联] 语音喊话 回复失败 platform {} 错误:{}/{}", platform.getServerGBId(), eventResult.statusCode, eventResult.msg);
}, eventResult->{
// 消息发送成功, 向上级发送invite获取推流
try {
platformService.broadcastInvite(platform, deviceChannel.getDeviceId(), mediaServerForMinimumLoad, (hookData)->{
platformService.broadcastInvite(platform, channel.getGbDeviceId(), mediaServerForMinimumLoad, (hookData)->{
// 上级平台推流成功
AudioBroadcastCatch broadcastCatch = audioBroadcastManager.get(device.getDeviceId(), targetId);
if (broadcastCatch != null ) {
if (playService.audioBroadcastInUse(device, targetId)) {
log.info("[国标级联] 语音喊话 设备正在使用中 platform {} channel: {}",
platform.getServerGBId(), deviceChannel.getDeviceId());
platform.getServerGBId(), channel.getGbDeviceId());
// 查看语音通道已经建立且已经占用 回复BYE
platformService.stopBroadcast(platform, deviceChannel, hookData.getStream(), true, hookData.getMediaServer());
platformService.stopBroadcast(platform, channel, hookData.getStream(), true, hookData.getMediaServer());
}else {
// 查看语音通道已经建立但是未占用
broadcastCatch.setApp(hookData.getApp());

View File

@@ -4,7 +4,7 @@ import com.genersoft.iot.vmp.common.VideoManagerConstants;
import com.genersoft.iot.vmp.conf.DynamicTask;
import com.genersoft.iot.vmp.conf.UserSetting;
import com.genersoft.iot.vmp.gb28181.bean.Device;
import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform;
import com.genersoft.iot.vmp.gb28181.bean.Platform;
import com.genersoft.iot.vmp.gb28181.bean.RemoteAddressInfo;
import com.genersoft.iot.vmp.gb28181.transmit.event.request.SIPRequestProcessorParent;
import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.IMessageHandler;
@@ -119,7 +119,7 @@ public class KeepaliveNotifyMessageHandler extends SIPRequestProcessorParent imp
}
@Override
public void handForPlatform(RequestEvent evt, ParentPlatform parentPlatform, Element element) {
public void handForPlatform(RequestEvent evt, Platform parentPlatform, Element element) {
// 个别平台保活不回复200OK会判定离线
try {
responseAck((SIPRequest) evt.getRequest(), Response.OK);

View File

@@ -4,7 +4,7 @@ import com.genersoft.iot.vmp.common.InviteInfo;
import com.genersoft.iot.vmp.common.InviteSessionType;
import com.genersoft.iot.vmp.conf.exception.SsrcTransactionNotFoundException;
import com.genersoft.iot.vmp.gb28181.bean.Device;
import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform;
import com.genersoft.iot.vmp.gb28181.bean.Platform;
import com.genersoft.iot.vmp.gb28181.bean.SendRtpItem;
import com.genersoft.iot.vmp.gb28181.bean.SsrcTransaction;
import com.genersoft.iot.vmp.gb28181.session.VideoStreamSessionManager;
@@ -110,7 +110,7 @@ public class MediaStatusNotifyMessageHandler extends SIPRequestProcessorParent i
// 如果级联播放,需要给上级发送此通知 TODO 多个上级同时观看一个下级 可能存在停错的问题需要将点播CallId进行上下级绑定
SendRtpItem sendRtpItem = redisCatchStorage.querySendRTPServer(null, ssrcTransaction.getChannelId(), null, null);
if (sendRtpItem != null) {
ParentPlatform parentPlatform = storage.queryParentPlatByServerGBId(sendRtpItem.getPlatformId());
Platform parentPlatform = storage.queryParentPlatByServerGBId(sendRtpItem.getPlatformId());
if (parentPlatform == null) {
log.warn("[级联消息发送]发送MediaStatus发现上级平台{}不存在", sendRtpItem.getPlatformId());
return;
@@ -128,7 +128,7 @@ public class MediaStatusNotifyMessageHandler extends SIPRequestProcessorParent i
}
@Override
public void handForPlatform(RequestEvent evt, ParentPlatform parentPlatform, Element element) {
public void handForPlatform(RequestEvent evt, Platform parentPlatform, Element element) {
}
}

View File

@@ -146,7 +146,7 @@ public class MobilePositionNotifyMessageHandler extends SIPRequestProcessorParen
}
@Override
public void handForPlatform(RequestEvent evt, ParentPlatform parentPlatform, Element element) {
public void handForPlatform(RequestEvent evt, Platform parentPlatform, Element element) {
}
}

View File

@@ -1,7 +1,7 @@
package com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.query.cmd;
import com.genersoft.iot.vmp.gb28181.bean.Device;
import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform;
import com.genersoft.iot.vmp.gb28181.bean.Platform;
import com.genersoft.iot.vmp.gb28181.transmit.event.request.SIPRequestProcessorParent;
import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.IMessageHandler;
import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.query.QueryMessageHandler;
@@ -38,7 +38,7 @@ public class AlarmQueryMessageHandler extends SIPRequestProcessorParent implemen
}
@Override
public void handForPlatform(RequestEvent evt, ParentPlatform parentPlatform, Element rootElement) {
public void handForPlatform(RequestEvent evt, Platform parentPlatform, Element rootElement) {
log.info("不支持alarm查询");
try {

View File

@@ -3,7 +3,7 @@ package com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.query.
import com.genersoft.iot.vmp.conf.SipConfig;
import com.genersoft.iot.vmp.gb28181.bean.CommonGBChannel;
import com.genersoft.iot.vmp.gb28181.bean.Device;
import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform;
import com.genersoft.iot.vmp.gb28181.bean.Platform;
import com.genersoft.iot.vmp.gb28181.event.EventPublisher;
import com.genersoft.iot.vmp.gb28181.service.IGbChannelService;
import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommanderFroPlatform;
@@ -41,14 +41,6 @@ public class CatalogQueryMessageHandler extends SIPRequestProcessorParent implem
@Autowired
private SIPCommanderFroPlatform cmderFroPlatform;
@Autowired
private SipConfig config;
@Autowired
private EventPublisher publisher;
@Autowired
private IVideoManagerStorage storage;
@Override
public void afterPropertiesSet() throws Exception {
@@ -57,11 +49,14 @@ public class CatalogQueryMessageHandler extends SIPRequestProcessorParent implem
@Override
public void handForDevice(RequestEvent evt, Device device, Element element) {
try {
// 回复200 OK
responseAck((SIPRequest) evt.getRequest(), Response.FORBIDDEN);
} catch (SipException | InvalidArgumentException | ParseException ignored) {}
}
@Override
public void handForPlatform(RequestEvent evt, ParentPlatform parentPlatform, Element rootElement) {
public void handForPlatform(RequestEvent evt, Platform platform, Element rootElement) {
FromHeader fromHeader = (FromHeader) evt.getRequest().getHeader(FromHeader.NAME);
try {
@@ -72,20 +67,17 @@ public class CatalogQueryMessageHandler extends SIPRequestProcessorParent implem
}
Element snElement = rootElement.element("SN");
String sn = snElement.getText();
List<CommonGBChannel> channelList = channelService.queryByPlatformId(parentPlatform.getId());
// TODO 是否包含平台信息,做成一个策略
List<CommonGBChannel> channelList = channelService.queryByPlatform(platform);
try {
if (!channelList.isEmpty()) {
cmderFroPlatform.catalogQuery(channelList, parentPlatform, sn, fromHeader.getTag());
cmderFroPlatform.catalogQuery(channelList, platform, sn, fromHeader.getTag());
}else {
// 回复无通道
cmderFroPlatform.catalogQuery(null, parentPlatform, sn, fromHeader.getTag(), 0);
cmderFroPlatform.catalogQuery(null, platform, sn, fromHeader.getTag(), 0);
}
} catch (SipException | InvalidArgumentException | ParseException e) {
log.error("[命令发送失败] 国标级联 目录查询回复: {}", e.getMessage());
}
}
}

View File

@@ -1,7 +1,7 @@
package com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.query.cmd;
import com.genersoft.iot.vmp.gb28181.bean.Device;
import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform;
import com.genersoft.iot.vmp.gb28181.bean.Platform;
import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommanderFroPlatform;
import com.genersoft.iot.vmp.gb28181.transmit.event.request.SIPRequestProcessorParent;
import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.IMessageHandler;
@@ -48,7 +48,7 @@ public class DeviceInfoQueryMessageHandler extends SIPRequestProcessorParent imp
}
@Override
public void handForPlatform(RequestEvent evt, ParentPlatform parentPlatform, Element rootElement) {
public void handForPlatform(RequestEvent evt, Platform platform, Element rootElement) {
log.info("[DeviceInfo查询]消息");
FromHeader fromHeader = (FromHeader) evt.getRequest().getHeader(FromHeader.NAME);
try {
@@ -68,15 +68,15 @@ public class DeviceInfoQueryMessageHandler extends SIPRequestProcessorParent imp
// 查询这是通道id还是设备id
Device device = null;
// 如果id指向平台的国标编号那么就是查询平台的信息
if (!parentPlatform.getDeviceGBId().equals(channelId)) {
device = storager.queryDeviceInfoByPlatformIdAndChannelId(parentPlatform.getServerGBId(), channelId);
if (!platform.getDeviceGBId().equals(channelId)) {
device = storager.queryDeviceInfoByPlatformIdAndChannelId(platform.getServerGBId(), channelId);
if (device ==null){
log.error("[平台没有该通道的使用权限]:platformId"+parentPlatform.getServerGBId()+" deviceID:"+channelId);
log.error("[平台没有该通道的使用权限]:platformId"+platform.getServerGBId()+" deviceID:"+channelId);
return;
}
}
try {
cmderFroPlatform.deviceInfoResponse(parentPlatform, device, sn, fromHeader.getTag());
cmderFroPlatform.deviceInfoResponse(platform, device, sn, fromHeader.getTag());
} catch (SipException | InvalidArgumentException | ParseException e) {
log.error("[命令发送失败] 国标级联 DeviceInfo查询回复: {}", e.getMessage());
}

View File

@@ -1,8 +1,10 @@
package com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.query.cmd;
import com.genersoft.iot.vmp.gb28181.bean.CommonGBChannel;
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.gb28181.bean.Platform;
import com.genersoft.iot.vmp.gb28181.service.IGbChannelService;
import com.genersoft.iot.vmp.gb28181.transmit.cmd.ISIPCommanderForPlatform;
import com.genersoft.iot.vmp.gb28181.transmit.event.request.SIPRequestProcessorParent;
import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.IMessageHandler;
@@ -34,7 +36,7 @@ public class DeviceStatusQueryMessageHandler extends SIPRequestProcessorParent i
private QueryMessageHandler queryMessageHandler;
@Autowired
private IVideoManagerStorage storager;
private IGbChannelService channelService;
@Autowired
private ISIPCommanderForPlatform cmderFroPlatform;
@@ -50,7 +52,7 @@ public class DeviceStatusQueryMessageHandler extends SIPRequestProcessorParent i
}
@Override
public void handForPlatform(RequestEvent evt, ParentPlatform parentPlatform, Element rootElement) {
public void handForPlatform(RequestEvent evt, Platform parentPlatform, Element rootElement) {
log.info("接收到DeviceStatus查询消息");
FromHeader fromHeader = (FromHeader) evt.getRequest().getHeader(FromHeader.NAME);
@@ -62,13 +64,13 @@ public class DeviceStatusQueryMessageHandler extends SIPRequestProcessorParent i
}
String sn = rootElement.element("SN").getText();
String channelId = getText(rootElement, "DeviceID");
DeviceChannel deviceChannel = storager.queryChannelInParentPlatform(parentPlatform.getServerGBId(), channelId);
if (deviceChannel ==null){
CommonGBChannel channel= channelService.queryOneWithPlatform(parentPlatform.getId(), channelId);
if (channel ==null){
log.error("[平台没有该通道的使用权限]:platformId"+parentPlatform.getServerGBId()+" deviceID:"+channelId);
return;
}
try {
cmderFroPlatform.deviceStatusResponse(parentPlatform,channelId, sn, fromHeader.getTag(), "ON".equalsIgnoreCase(deviceChannel.getStatus()));
cmderFroPlatform.deviceStatusResponse(parentPlatform, channelId, sn, fromHeader.getTag(), "ON".equalsIgnoreCase(channel.getGbStatus()));
} catch (SipException | InvalidArgumentException | ParseException e) {
log.error("[命令发送失败] 国标级联 DeviceStatus查询回复: {}", e.getMessage());
}

View File

@@ -1,9 +1,12 @@
package com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.query.cmd;
import com.genersoft.iot.vmp.gb28181.bean.CommonGBChannel;
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.gb28181.bean.Platform;
import com.genersoft.iot.vmp.gb28181.event.record.RecordEndEventListener;
import com.genersoft.iot.vmp.gb28181.service.IDeviceService;
import com.genersoft.iot.vmp.gb28181.service.IGbChannelService;
import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommander;
import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommanderFroPlatform;
import com.genersoft.iot.vmp.gb28181.transmit.event.request.SIPRequestProcessorParent;
@@ -38,6 +41,12 @@ public class RecordInfoQueryMessageHandler extends SIPRequestProcessorParent imp
@Autowired
private IVideoManagerStorage storager;
@Autowired
private IGbChannelService channelService;
@Autowired
private IDeviceService deviceService;
@Autowired
private SIPCommanderFroPlatform cmderFroPlatform;
@@ -58,7 +67,7 @@ public class RecordInfoQueryMessageHandler extends SIPRequestProcessorParent imp
}
@Override
public void handForPlatform(RequestEvent evt, ParentPlatform parentPlatform, Element rootElement) {
public void handForPlatform(RequestEvent evt, Platform parentPlatform, Element rootElement) {
SIPRequest request = (SIPRequest) evt.getRequest();
Element snElement = rootElement.element("SN");
@@ -85,56 +94,65 @@ public class RecordInfoQueryMessageHandler extends SIPRequestProcessorParent imp
if (typeElement != null) {
type = typeElement.getText();
}
// 确认是直播还是国标, 国标直接请求下级,直播请求录像管理服务
List<ChannelSourceInfo> channelSources = storager.getChannelSource(parentPlatform.getServerGBId(), channelId);
if (channelSources.get(0).getCount() > 0) { // 国标
// 向国标设备请求录像数据
Device device = storager.queryVideoDeviceByPlatformIdAndChannelId(parentPlatform.getServerGBId(), channelId);
DeviceChannel deviceChannel = storager.queryChannelInParentPlatform(parentPlatform.getServerGBId(), channelId);
// 接收录像数据
recordEndEventListener.addEndEventHandler(deviceChannel.getDeviceId(), channelId, (recordInfo)->{
try {
log.info("[国标级联] 录像查询收到数据, 通道: {},准备转发===", channelId);
cmderFroPlatform.recordInfo(deviceChannel, parentPlatform, request.getFromTag(), recordInfo);
} catch (SipException | InvalidArgumentException | ParseException e) {
log.error("[命令发送失败] 国标级联 回复录像数据: {}", e.getMessage());
}
});
try {
commander.recordInfoQuery(device, channelId, DateUtil.ISO8601Toyyyy_MM_dd_HH_mm_ss(startTime),
DateUtil.ISO8601Toyyyy_MM_dd_HH_mm_ss(endTime), sn, secrecy, type, (eventResult -> {
// 回复200 OK
try {
responseAck(request, Response.OK);
} catch (SipException | InvalidArgumentException | ParseException e) {
log.error("[命令发送失败] 录像查询回复: {}", e.getMessage());
}
}),(eventResult -> {
// 查询失败
try {
responseAck(request, eventResult.statusCode, eventResult.msg);
} catch (SipException | InvalidArgumentException | ParseException e) {
log.error("[命令发送失败] 录像查询回复: {}", e.getMessage());
}
}));
} catch (InvalidArgumentException | ParseException | SipException e) {
log.error("[命令发送失败] 录像查询: {}", e.getMessage());
}
}else if (channelSources.get(1).getCount() > 0) { // 直播流
// TODO
try {
responseAck(request, Response.NOT_IMPLEMENTED); // 回复未实现
} catch (SipException | InvalidArgumentException | ParseException e) {
log.error("[命令发送失败] 录像查询: {}", e.getMessage());
}
}else { // 错误的请求
// 国标设备请求录像数据
CommonGBChannel channel = channelService.queryOneWithPlatform(parentPlatform.getId(), channelId);
if (channel == null) {
log.info("[平台查询录像记录] 未找到通道 {}/{}", parentPlatform.getName(), channelId );
try {
responseAck(request, Response.BAD_REQUEST);
} catch (SipException | InvalidArgumentException | ParseException e) {
log.error("[命令发送失败] 录像查询: {}", e.getMessage());
log.error("[命令发送失败] [平台查询录像记录] 未找到通道: {}", e.getMessage());
}
return;
}
if (channel.getStreamProxyId() > 0 || channel.getStreamPushId() > 0) {
log.info("[平台查询录像记录] 不支持查询推流和拉流代理的录像数据 {}/{}", parentPlatform.getName(), channelId );
try {
responseAck(request, Response.NOT_IMPLEMENTED); // 回复未实现
} catch (SipException | InvalidArgumentException | ParseException e) {
log.error("[命令发送失败] 平台查询录像记录: {}", e.getMessage());
}
return;
}
Device device = deviceService.getDevice(channel.getGbDeviceDbId());
if (device == null) {
log.warn("[平台查询录像记录] 未找到通道对应的设备 {}/{}", parentPlatform.getName(), channelId );
try {
responseAck(request, Response.BAD_REQUEST);
} catch (SipException | InvalidArgumentException | ParseException e) {
log.error("[命令发送失败] [平台查询录像记录] 未找到通道对应的设备: {}", e.getMessage());
}
return;
}
// 接收录像数据
recordEndEventListener.addEndEventHandler(channel.getGbDeviceId(), channelId, (recordInfo)->{
try {
log.info("[国标级联] 录像查询收到数据, 通道: {},准备转发===", channelId);
cmderFroPlatform.recordInfo(channel, parentPlatform, request.getFromTag(), recordInfo);
} catch (SipException | InvalidArgumentException | ParseException e) {
log.error("[命令发送失败] 国标级联 回复录像数据: {}", e.getMessage());
}
});
try {
commander.recordInfoQuery(device, channelId, DateUtil.ISO8601Toyyyy_MM_dd_HH_mm_ss(startTime),
DateUtil.ISO8601Toyyyy_MM_dd_HH_mm_ss(endTime), sn, secrecy, type, (eventResult -> {
// 回复200 OK
try {
responseAck(request, Response.OK);
} catch (SipException | InvalidArgumentException | ParseException e) {
log.error("[命令发送失败] 录像查询回复: {}", e.getMessage());
}
}),(eventResult -> {
// 查询失败
try {
responseAck(request, eventResult.statusCode, eventResult.msg);
} catch (SipException | InvalidArgumentException | ParseException e) {
log.error("[命令发送失败] 录像查询回复: {}", e.getMessage());
}
}));
} catch (InvalidArgumentException | ParseException | SipException e) {
log.error("[命令发送失败] 录像查询: {}", e.getMessage());
}
}
}

View File

@@ -2,7 +2,7 @@ package com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.respon
import com.alibaba.fastjson2.JSONObject;
import com.genersoft.iot.vmp.gb28181.bean.Device;
import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform;
import com.genersoft.iot.vmp.gb28181.bean.Platform;
import com.genersoft.iot.vmp.gb28181.transmit.callback.DeferredResultHolder;
import com.genersoft.iot.vmp.gb28181.transmit.callback.RequestMessage;
import com.genersoft.iot.vmp.gb28181.transmit.event.request.SIPRequestProcessorParent;
@@ -51,7 +51,7 @@ public class AlarmResponseMessageHandler extends SIPRequestProcessorParent imple
}
@Override
public void handForPlatform(RequestEvent evt, ParentPlatform parentPlatform, Element element) {
public void handForPlatform(RequestEvent evt, Platform parentPlatform, Element element) {
}
}

View File

@@ -4,7 +4,7 @@ import com.genersoft.iot.vmp.conf.DynamicTask;
import com.genersoft.iot.vmp.gb28181.bean.AudioBroadcastCatch;
import com.genersoft.iot.vmp.gb28181.bean.AudioBroadcastCatchStatus;
import com.genersoft.iot.vmp.gb28181.bean.Device;
import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform;
import com.genersoft.iot.vmp.gb28181.bean.Platform;
import com.genersoft.iot.vmp.gb28181.session.AudioBroadcastManager;
import com.genersoft.iot.vmp.gb28181.transmit.event.request.SIPRequestProcessorParent;
import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.IMessageHandler;
@@ -82,7 +82,7 @@ public class BroadcastResponseMessageHandler extends SIPRequestProcessorParent i
}
@Override
public void handForPlatform(RequestEvent evt, ParentPlatform parentPlatform, Element element) {
public void handForPlatform(RequestEvent evt, Platform parentPlatform, Element element) {
}
}

View File

@@ -196,7 +196,7 @@ public class CatalogResponseMessageHandler extends SIPRequestProcessorParent imp
}
@Override
public void handForPlatform(RequestEvent evt, ParentPlatform parentPlatform, Element rootElement) {
public void handForPlatform(RequestEvent evt, Platform parentPlatform, Element rootElement) {
}

View File

@@ -2,7 +2,7 @@ package com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.respon
import com.alibaba.fastjson2.JSONObject;
import com.genersoft.iot.vmp.gb28181.bean.Device;
import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform;
import com.genersoft.iot.vmp.gb28181.bean.Platform;
import com.genersoft.iot.vmp.gb28181.transmit.callback.DeferredResultHolder;
import com.genersoft.iot.vmp.gb28181.transmit.callback.RequestMessage;
import com.genersoft.iot.vmp.gb28181.transmit.event.request.SIPRequestProcessorParent;
@@ -67,7 +67,7 @@ public class ConfigDownloadResponseMessageHandler extends SIPRequestProcessorPar
}
@Override
public void handForPlatform(RequestEvent evt, ParentPlatform parentPlatform, Element element) {
public void handForPlatform(RequestEvent evt, Platform parentPlatform, Element element) {
// 不会收到上级平台的心跳信息
}

View File

@@ -2,7 +2,7 @@ package com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.respon
import com.alibaba.fastjson2.JSONObject;
import com.genersoft.iot.vmp.gb28181.bean.Device;
import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform;
import com.genersoft.iot.vmp.gb28181.bean.Platform;
import com.genersoft.iot.vmp.gb28181.transmit.callback.DeferredResultHolder;
import com.genersoft.iot.vmp.gb28181.transmit.callback.RequestMessage;
import com.genersoft.iot.vmp.gb28181.transmit.event.request.SIPRequestProcessorParent;
@@ -52,6 +52,6 @@ public class DeviceConfigResponseMessageHandler extends SIPRequestProcessorParen
}
@Override
public void handForPlatform(RequestEvent evt, ParentPlatform parentPlatform, Element rootElement) {
public void handForPlatform(RequestEvent evt, Platform parentPlatform, Element rootElement) {
}
}

View File

@@ -2,7 +2,7 @@ package com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.respon
import com.alibaba.fastjson2.JSONObject;
import com.genersoft.iot.vmp.gb28181.bean.Device;
import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform;
import com.genersoft.iot.vmp.gb28181.bean.Platform;
import com.genersoft.iot.vmp.gb28181.transmit.callback.DeferredResultHolder;
import com.genersoft.iot.vmp.gb28181.transmit.callback.RequestMessage;
import com.genersoft.iot.vmp.gb28181.transmit.event.request.SIPRequestProcessorParent;
@@ -64,6 +64,6 @@ public class DeviceControlResponseMessageHandler extends SIPRequestProcessorPare
}
@Override
public void handForPlatform(RequestEvent evt, ParentPlatform parentPlatform, Element rootElement) {
public void handForPlatform(RequestEvent evt, Platform parentPlatform, Element rootElement) {
}
}

View File

@@ -1,7 +1,7 @@
package com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.response.cmd;
import com.genersoft.iot.vmp.gb28181.bean.Device;
import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform;
import com.genersoft.iot.vmp.gb28181.bean.Platform;
import com.genersoft.iot.vmp.gb28181.transmit.callback.DeferredResultHolder;
import com.genersoft.iot.vmp.gb28181.transmit.callback.RequestMessage;
import com.genersoft.iot.vmp.gb28181.transmit.event.request.SIPRequestProcessorParent;
@@ -100,7 +100,7 @@ public class DeviceInfoResponseMessageHandler extends SIPRequestProcessorParent
}
@Override
public void handForPlatform(RequestEvent evt, ParentPlatform parentPlatform, Element rootElement) {
public void handForPlatform(RequestEvent evt, Platform parentPlatform, Element rootElement) {
}
}

View File

@@ -2,7 +2,7 @@ package com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.respon
import com.alibaba.fastjson2.JSONObject;
import com.genersoft.iot.vmp.gb28181.bean.Device;
import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform;
import com.genersoft.iot.vmp.gb28181.bean.Platform;
import com.genersoft.iot.vmp.gb28181.transmit.callback.DeferredResultHolder;
import com.genersoft.iot.vmp.gb28181.transmit.callback.RequestMessage;
import com.genersoft.iot.vmp.gb28181.transmit.event.request.SIPRequestProcessorParent;
@@ -81,7 +81,7 @@ public class DeviceStatusResponseMessageHandler extends SIPRequestProcessorParen
}
@Override
public void handForPlatform(RequestEvent evt, ParentPlatform parentPlatform, Element rootElement) {
public void handForPlatform(RequestEvent evt, Platform parentPlatform, Element rootElement) {
}

View File

@@ -3,7 +3,7 @@ package com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.respon
import com.genersoft.iot.vmp.gb28181.bean.Device;
import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel;
import com.genersoft.iot.vmp.gb28181.bean.MobilePosition;
import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform;
import com.genersoft.iot.vmp.gb28181.bean.Platform;
import com.genersoft.iot.vmp.gb28181.transmit.callback.DeferredResultHolder;
import com.genersoft.iot.vmp.gb28181.transmit.callback.RequestMessage;
import com.genersoft.iot.vmp.gb28181.transmit.event.request.SIPRequestProcessorParent;
@@ -131,7 +131,7 @@ public class MobilePositionResponseMessageHandler extends SIPRequestProcessorPar
}
@Override
public void handForPlatform(RequestEvent evt, ParentPlatform parentPlatform, Element element) {
public void handForPlatform(RequestEvent evt, Platform parentPlatform, Element element) {
}
}

View File

@@ -1,7 +1,7 @@
package com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.response.cmd;
import com.genersoft.iot.vmp.gb28181.bean.Device;
import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform;
import com.genersoft.iot.vmp.gb28181.bean.Platform;
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;
@@ -113,7 +113,7 @@ public class PresetQueryResponseMessageHandler extends SIPRequestProcessorParent
}
@Override
public void handForPlatform(RequestEvent evt, ParentPlatform parentPlatform, Element rootElement) {
public void handForPlatform(RequestEvent evt, Platform parentPlatform, Element rootElement) {
}

View File

@@ -2,7 +2,7 @@ package com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.respon
import com.genersoft.iot.vmp.common.VideoManagerConstants;
import com.genersoft.iot.vmp.gb28181.bean.Device;
import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform;
import com.genersoft.iot.vmp.gb28181.bean.Platform;
import com.genersoft.iot.vmp.gb28181.bean.RecordInfo;
import com.genersoft.iot.vmp.gb28181.bean.RecordItem;
import com.genersoft.iot.vmp.gb28181.event.EventPublisher;
@@ -160,7 +160,7 @@ public class RecordInfoResponseMessageHandler extends SIPRequestProcessorParent
}
@Override
public void handForPlatform(RequestEvent evt, ParentPlatform parentPlatform, Element element) {
public void handForPlatform(RequestEvent evt, Platform parentPlatform, Element element) {
}

View File

@@ -1,7 +1,7 @@
package com.genersoft.iot.vmp.gb28181.transmit.event.response.impl;
import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform;
import com.genersoft.iot.vmp.gb28181.bean.ParentPlatformCatch;
import com.genersoft.iot.vmp.gb28181.bean.Platform;
import com.genersoft.iot.vmp.gb28181.bean.PlatformCatch;
import com.genersoft.iot.vmp.gb28181.bean.SipTransactionInfo;
import com.genersoft.iot.vmp.gb28181.transmit.SIPProcessorObserver;
import com.genersoft.iot.vmp.gb28181.transmit.cmd.ISIPCommanderForPlatform;
@@ -65,7 +65,7 @@ public class RegisterResponseProcessor extends SIPResponseProcessorAbstract {
return;
}
ParentPlatformCatch parentPlatformCatch = redisCatchStorage.queryPlatformCatchInfo(platformRegisterInfo.getPlatformId());
PlatformCatch parentPlatformCatch = redisCatchStorage.queryPlatformCatchInfo(platformRegisterInfo.getPlatformId());
if (parentPlatformCatch == null) {
log.warn(String.format("[国标级联]收到注册/注销%S请求平台%s但是平台缓存信息未查询到!!!", response.getStatusCode(),platformRegisterInfo.getPlatformId()));
return;
@@ -73,7 +73,7 @@ public class RegisterResponseProcessor extends SIPResponseProcessorAbstract {
String action = platformRegisterInfo.isRegister() ? "注册" : "注销";
log.info(String.format("[国标级联]%s %S响应,%s ", action, response.getStatusCode(), platformRegisterInfo.getPlatformId() ));
ParentPlatform parentPlatform = parentPlatformCatch.getParentPlatform();
Platform parentPlatform = parentPlatformCatch.getParentPlatform();
if (parentPlatform == null) {
log.warn(String.format("[国标级联]收到 %s %s的%S请求, 但是平台信息未查询到!!!", platformRegisterInfo.getPlatformId(), action, response.getStatusCode()));
return;

View File

@@ -234,7 +234,7 @@ public class MediaServiceImpl implements IMediaService {
inviteInfo.getChannelId());
if (!sendRtpItems.isEmpty()) {
for (SendRtpItem sendRtpItem : sendRtpItems) {
ParentPlatform parentPlatform = storager.queryParentPlatByServerGBId(sendRtpItem.getPlatformId());
Platform parentPlatform = storager.queryParentPlatByServerGBId(sendRtpItem.getPlatformId());
try {
commanderForPlatform.streamByeCmd(parentPlatform, sendRtpItem.getCallId());
} catch (SipException | InvalidArgumentException | ParseException e) {
@@ -248,7 +248,7 @@ public class MediaServiceImpl implements IMediaService {
}
}
}
Device device = deviceService.getDevice(inviteInfo.getDeviceId());
Device device = deviceService.getDeviceByDeviceId(inviteInfo.getDeviceId());
if (device != null) {
try {
// 多查询一次防止已经被处理了

View File

@@ -5,7 +5,7 @@ import com.genersoft.iot.vmp.conf.UserSetting;
import com.genersoft.iot.vmp.gb28181.bean.AlarmChannelMessage;
import com.genersoft.iot.vmp.gb28181.bean.Device;
import com.genersoft.iot.vmp.gb28181.bean.DeviceAlarm;
import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform;
import com.genersoft.iot.vmp.gb28181.bean.Platform;
import com.genersoft.iot.vmp.gb28181.transmit.cmd.ISIPCommander;
import com.genersoft.iot.vmp.gb28181.transmit.cmd.ISIPCommanderForPlatform;
import com.genersoft.iot.vmp.gb28181.service.IDeviceChannelService;
@@ -89,9 +89,9 @@ public class RedisAlarmMsgListener implements MessageListener {
if (ObjectUtils.isEmpty(gbId)) {
if (userSetting.getSendToPlatformsWhenIdLost()) {
// 发送给所有的上级
List<ParentPlatform> parentPlatforms = storage.queryEnableParentPlatformList(true);
List<Platform> parentPlatforms = storage.queryEnableParentPlatformList(true);
if (parentPlatforms.size() > 0) {
for (ParentPlatform parentPlatform : parentPlatforms) {
for (Platform parentPlatform : parentPlatforms) {
try {
deviceAlarm.setChannelId(parentPlatform.getDeviceGBId());
commanderForPlatform.sendAlarmMessage(parentPlatform, deviceAlarm);
@@ -102,9 +102,9 @@ public class RedisAlarmMsgListener implements MessageListener {
}
}else {
// 获取开启了消息推送的设备和平台
List<ParentPlatform> parentPlatforms = storage.queryEnablePlatformListWithAsMessageChannel();
List<Platform> parentPlatforms = storage.queryEnablePlatformListWithAsMessageChannel();
if (parentPlatforms.size() > 0) {
for (ParentPlatform parentPlatform : parentPlatforms) {
for (Platform parentPlatform : parentPlatforms) {
try {
deviceAlarm.setChannelId(parentPlatform.getDeviceGBId());
commanderForPlatform.sendAlarmMessage(parentPlatform, deviceAlarm);
@@ -129,8 +129,8 @@ public class RedisAlarmMsgListener implements MessageListener {
}
}else {
Device device = deviceService.getDevice(gbId);
ParentPlatform platform = storage.queryParentPlatByServerGBId(gbId);
Device device = deviceService.getDeviceByDeviceId(gbId);
Platform platform = storage.queryParentPlatByServerGBId(gbId);
if (device != null && platform == null) {
try {
commander.sendAlarmMessage(device, deviceAlarm);

View File

@@ -8,7 +8,7 @@ import com.genersoft.iot.vmp.conf.redis.RedisRpcConfig;
import com.genersoft.iot.vmp.conf.redis.bean.RedisRpcMessage;
import com.genersoft.iot.vmp.conf.redis.bean.RedisRpcRequest;
import com.genersoft.iot.vmp.conf.redis.bean.RedisRpcResponse;
import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform;
import com.genersoft.iot.vmp.gb28181.bean.Platform;
import com.genersoft.iot.vmp.gb28181.bean.SendRtpItem;
import com.genersoft.iot.vmp.gb28181.session.SSRCFactory;
import com.genersoft.iot.vmp.gb28181.transmit.cmd.ISIPCommanderForPlatform;
@@ -317,7 +317,7 @@ public class RedisRpcController {
}
log.info("[redis-rpc] 推流已经停止: {}/{}, 目标地址: {}{}", sendRtpItem.getApp(), sendRtpItem.getStream(), sendRtpItem.getIp(), sendRtpItem.getPort() );
String platformId = sendRtpItem.getPlatformId();
ParentPlatform platform = storager.queryParentPlatByServerGBId(platformId);
Platform platform = storager.queryParentPlatByServerGBId(platformId);
if (platform == null) {
return response;
}

View File

@@ -22,9 +22,9 @@ public interface IRedisCatchStorage {
*/
Long getCSEQ();
void updatePlatformCatchInfo(ParentPlatformCatch parentPlatformCatch);
void updatePlatformCatchInfo(PlatformCatch parentPlatformCatch);
ParentPlatformCatch queryPlatformCatchInfo(String platformGbId);
PlatformCatch queryPlatformCatchInfo(String platformGbId);
void delPlatformCatchInfo(String platformGbId);
@@ -208,9 +208,9 @@ public interface IRedisCatchStorage {
void sendChannelAddOrDelete(String deviceId, String channelId, boolean add);
void sendPlatformStartPlayMsg(SendRtpItem sendRtpItem, ParentPlatform platform);
void sendPlatformStartPlayMsg(SendRtpItem sendRtpItem, Platform platform);
void sendPlatformStopPlayMsg(SendRtpItem sendRtpItem, ParentPlatform platform);
void sendPlatformStopPlayMsg(SendRtpItem sendRtpItem, Platform platform);
void addPushListItem(String app, String stream, MediaInfo param);

View File

@@ -20,26 +20,26 @@ public interface IVideoManagerStorage {
* 更新上级平台
* @param parentPlatform
*/
boolean updateParentPlatform(ParentPlatform parentPlatform);
boolean updateParentPlatform(Platform parentPlatform);
/**
* 删除上级平台
* @param parentPlatform
*/
boolean deleteParentPlatform(ParentPlatform parentPlatform);
boolean deleteParentPlatform(Platform parentPlatform);
/**
* 获取所有已启用的平台
* @return
*/
List<ParentPlatform> queryEnableParentPlatformList(boolean enable);
List<Platform> queryEnableParentPlatformList(boolean enable);
/**
* 获取上级平台
* @param platformGbId
* @return
*/
ParentPlatform queryParentPlatByServerGBId(String platformGbId);
Platform queryParentPlatByServerGBId(String platformGbId);
/**
* 移除上级平台的通道信息
@@ -95,12 +95,12 @@ public interface IVideoManagerStorage {
int updateStreamGPS(List<GPSMsgInfo> gpsMsgInfo);
List<ParentPlatform> queryPlatFormListForGBWithGBId(String channelId, List<String> platforms);
List<Platform> queryPlatFormListForGBWithGBId(String channelId, List<String> platforms);
void delRelationByPlatformId(String serverGBId);
List<ChannelSourceInfo> getChannelSource(String platformId, String gbId);
List<ParentPlatform> queryEnablePlatformListWithAsMessageChannel();
List<Platform> queryEnablePlatformListWithAsMessageChannel();
}

View File

@@ -89,14 +89,14 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage {
}
@Override
public void updatePlatformCatchInfo(ParentPlatformCatch parentPlatformCatch) {
public void updatePlatformCatchInfo(PlatformCatch parentPlatformCatch) {
String key = VideoManagerConstants.PLATFORM_CATCH_PREFIX + userSetting.getServerId() + "_" + parentPlatformCatch.getId();
redisTemplate.opsForValue().set(key, parentPlatformCatch);
}
@Override
public ParentPlatformCatch queryPlatformCatchInfo(String platformGbId) {
return (ParentPlatformCatch)redisTemplate.opsForValue().get(VideoManagerConstants.PLATFORM_CATCH_PREFIX + userSetting.getServerId() + "_" + platformGbId);
public PlatformCatch queryPlatformCatchInfo(String platformGbId) {
return (PlatformCatch)redisTemplate.opsForValue().get(VideoManagerConstants.PLATFORM_CATCH_PREFIX + userSetting.getServerId() + "_" + platformGbId);
}
@Override
@@ -662,7 +662,7 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage {
}
@Override
public void sendPlatformStartPlayMsg(SendRtpItem sendRtpItem, ParentPlatform platform) {
public void sendPlatformStartPlayMsg(SendRtpItem sendRtpItem, Platform platform) {
if (sendRtpItem.getPlayType() == InviteStreamType.PUSH && platform != null) {
MessageForPushChannel messageForPushChannel = MessageForPushChannel.getInstance(0, sendRtpItem.getApp(), sendRtpItem.getStream(),
sendRtpItem.getChannelId(), platform.getServerGBId(), platform.getName(), userSetting.getServerId(),
@@ -675,7 +675,7 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage {
}
@Override
public void sendPlatformStopPlayMsg(SendRtpItem sendRtpItem, ParentPlatform platform) {
public void sendPlatformStopPlayMsg(SendRtpItem sendRtpItem, Platform platform) {
MessageForPushChannel msg = MessageForPushChannel.getInstance(0,
sendRtpItem.getApp(), sendRtpItem.getStream(), sendRtpItem.getChannelId(),

View File

@@ -56,7 +56,7 @@ public class VideoManagerStorageImpl implements IVideoManagerStorage {
private DeviceMobilePositionMapper deviceMobilePositionMapper;
@Autowired
private ParentPlatformMapper platformMapper;
private PlatformMapper platformMapper;
@Autowired
private IRedisCatchStorage redisCatchStorage;
@@ -91,27 +91,27 @@ public class VideoManagerStorageImpl implements IVideoManagerStorage {
}
@Override
public boolean updateParentPlatform(ParentPlatform parentPlatform) {
public boolean updateParentPlatform(Platform parentPlatform) {
int result = 0;
if (parentPlatform.getCatalogGroup() == 0) {
parentPlatform.setCatalogGroup(1);
}
ParentPlatformCatch parentPlatformCatch = redisCatchStorage.queryPlatformCatchInfo(parentPlatform.getServerGBId()); // .getDeviceGBId());
PlatformCatch parentPlatformCatch = redisCatchStorage.queryPlatformCatchInfo(parentPlatform.getServerGBId()); // .getDeviceGBId());
if (parentPlatform.getId() == null ) {
if (parentPlatform.getCatalogId() == null) {
parentPlatform.setCatalogId(parentPlatform.getServerGBId());
}
result = platformMapper.addParentPlatform(parentPlatform);
if (parentPlatformCatch == null) {
parentPlatformCatch = new ParentPlatformCatch();
parentPlatformCatch = new PlatformCatch();
parentPlatformCatch.setParentPlatform(parentPlatform);
parentPlatformCatch.setId(parentPlatform.getServerGBId());
}
}else {
if (parentPlatformCatch == null) { // serverGBId 已变化
ParentPlatform parentPlatById = platformMapper.getParentPlatById(parentPlatform.getId());
Platform parentPlatById = platformMapper.getParentPlatById(parentPlatform.getId());
// 使用旧的查出缓存ID
parentPlatformCatch = new ParentPlatformCatch();
parentPlatformCatch = new PlatformCatch();
parentPlatformCatch.setId(parentPlatform.getServerGBId());
redisCatchStorage.delPlatformCatchInfo(parentPlatById.getServerGBId());
}
@@ -127,7 +127,7 @@ public class VideoManagerStorageImpl implements IVideoManagerStorage {
@Transactional
@Override
public boolean deleteParentPlatform(ParentPlatform parentPlatform) {
public boolean deleteParentPlatform(Platform parentPlatform) {
int result = platformMapper.delParentPlatform(parentPlatform);
// 删除关联的通道
platformChannelMapper.cleanChannelForGB(parentPlatform.getServerGBId());
@@ -135,17 +135,17 @@ public class VideoManagerStorageImpl implements IVideoManagerStorage {
}
@Override
public ParentPlatform queryParentPlatByServerGBId(String platformGbId) {
public Platform queryParentPlatByServerGBId(String platformGbId) {
return platformMapper.getParentPlatByServerGBId(platformGbId);
}
@Override
public List<ParentPlatform> queryEnableParentPlatformList(boolean enable) {
public List<Platform> queryEnableParentPlatformList(boolean enable) {
return platformMapper.getEnableParentPlatformList(enable);
}
@Override
public List<ParentPlatform> queryEnablePlatformListWithAsMessageChannel() {
public List<Platform> queryEnablePlatformListWithAsMessageChannel() {
return platformMapper.queryEnablePlatformListWithAsMessageChannel();
}
@@ -266,29 +266,8 @@ public class VideoManagerStorageImpl implements IVideoManagerStorage {
return gbStreamMapper.updateStreamGPS(gpsMsgInfos);
}
private DeviceChannel getDeviceChannelByCatalog(PlatformCatalog catalog) {
ParentPlatform platform = platformMapper.getParentPlatByServerGBId(catalog.getPlatformId());
DeviceChannel deviceChannel = new DeviceChannel();
deviceChannel.setDeviceId(catalog.getId());
deviceChannel.setName(catalog.getName());
deviceChannel.setDeviceId(platform.getDeviceGBId());
deviceChannel.setManufacturer("wvp-pro");
deviceChannel.setStatus("ON");
deviceChannel.setParental(1);
deviceChannel.setRegisterWay(1);
deviceChannel.setParentId(catalog.getParentId());
deviceChannel.setBusinessGroupId(catalog.getBusinessGroupId());
deviceChannel.setModel("live");
deviceChannel.setOwner("wvp-pro");
deviceChannel.setSecrecy(0);
return deviceChannel;
}
@Override
public List<ParentPlatform> queryPlatFormListForGBWithGBId(String channelId, List<String> platforms) {
public List<Platform> queryPlatFormListForGBWithGBId(String channelId, List<String> platforms) {
return platformChannelMapper.queryPlatFormListForGBWithGBId(channelId, platforms);
}

View File

@@ -51,7 +51,7 @@ public class ApiControlController {
}
if (channel == null) {channel = 0;}
if (speed == null) {speed = 0;}
Device device = deviceService.getDevice(serial);
Device device = deviceService.getDeviceByDeviceId(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 = deviceService.getDevice(serial);
Device device = deviceService.getDeviceByDeviceId(serial);
if (device == null) {
throw new ControllerException(ErrorCode.ERROR100.getCode(), "device[ " + serial + " ]未找到");
}

View File

@@ -200,7 +200,7 @@ public class ApiDeviceController {
serial, channel, code, fill, timeout);
}
Device device = deviceService.getDevice(serial);
Device device = deviceService.getDeviceByDeviceId(serial);
String uuid = UUID.randomUUID().toString();
String key = DeferredResultHolder.CALLBACK_CMD_PRESETQUERY + (ObjectUtils.isEmpty(code) ? serial : code);
DeferredResult<Object> result = new DeferredResult<> (timeout * 1000L);

View File

@@ -82,7 +82,7 @@ public class ApiStreamController {
){
DeferredResult<JSONObject> result = new DeferredResult<>(userSetting.getPlayTimeout().longValue() + 10);
Device device = deviceService.getDevice(serial);
Device device = deviceService.getDeviceByDeviceId(serial);
if (device == null ) {
JSONObject resultJSON = new JSONObject();
resultJSON.put("error","device[ " + serial + " ]未找到");
@@ -230,7 +230,7 @@ public class ApiStreamController {
result.put("error","未找到流信息");
return result;
}
Device device = deviceService.getDevice(serial);
Device device = deviceService.getDeviceByDeviceId(serial);
if (device == null) {
JSONObject result = new JSONObject();
result.put("error","未找到设备");