修复国标级自定编号后点播

pull/1642/head
648540858 2024-09-24 15:17:50 +08:00
parent 92b9c3042f
commit ff2b81b546
7 changed files with 73 additions and 38 deletions

View File

@ -1639,7 +1639,8 @@ public class PlayServiceImpl implements IPlayService {
log.warn("[点播] 未找到可用媒体节点");
throw new PlayException(Response.SERVER_INTERNAL_ERROR, "server internal error");
}
play(mediaServer, device.getDeviceId(), channel.getGbDeviceId(), null, callback);
DeviceChannel deviceChannel = deviceChannelService.getOneById(channel.getGbId());
play(mediaServer, device, deviceChannel, null, callback);
}
@Override

View File

@ -6,15 +6,14 @@ import com.genersoft.iot.vmp.conf.SipConfig;
import com.genersoft.iot.vmp.conf.UserSetting;
import com.genersoft.iot.vmp.gb28181.bean.*;
import com.genersoft.iot.vmp.gb28181.event.EventPublisher;
import com.genersoft.iot.vmp.gb28181.service.IDeviceAlarmService;
import com.genersoft.iot.vmp.gb28181.service.IDeviceChannelService;
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.notify.NotifyMessageHandler;
import com.genersoft.iot.vmp.gb28181.utils.NumericUtil;
import com.genersoft.iot.vmp.gb28181.utils.XmlUtil;
import com.genersoft.iot.vmp.gb28181.service.IDeviceAlarmService;
import com.genersoft.iot.vmp.gb28181.service.IDeviceChannelService;
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
import com.genersoft.iot.vmp.storager.IVideoManagerStorage;
import com.genersoft.iot.vmp.utils.DateUtil;
import gov.nist.javax.sip.message.SIPRequest;
import lombok.extern.slf4j.Slf4j;
@ -56,9 +55,6 @@ public class AlarmNotifyMessageHandler extends SIPRequestProcessorParent impleme
@Autowired
private SipConfig sipConfig;
@Autowired
private IVideoManagerStorage storager;
@Autowired
private IRedisCatchStorage redisCatchStorage;

View File

@ -11,8 +11,6 @@ import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.notify.
import com.genersoft.iot.vmp.media.bean.MediaServer;
import com.genersoft.iot.vmp.media.service.IMediaServerService;
import com.genersoft.iot.vmp.service.ISendRtpServerService;
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
import com.genersoft.iot.vmp.storager.IVideoManagerStorage;
import gov.nist.javax.sip.message.SIPRequest;
import lombok.extern.slf4j.Slf4j;
import org.dom4j.Element;
@ -27,7 +25,7 @@ import javax.sip.message.Response;
import java.text.ParseException;
/**
* ()
*
*/
@Slf4j
@Component
@ -38,9 +36,6 @@ public class BroadcastNotifyMessageHandler extends SIPRequestProcessorParent imp
@Autowired
private NotifyMessageHandler notifyMessageHandler;
@Autowired
private IVideoManagerStorage storage;
@Autowired
private IGbChannelService channelService;
@ -65,9 +60,6 @@ public class BroadcastNotifyMessageHandler extends SIPRequestProcessorParent imp
@Autowired
private AudioBroadcastManager audioBroadcastManager;
@Autowired
private IRedisCatchStorage redisCatchStorage;
@Autowired
private ISendRtpServerService sendRtpServerService;

View File

@ -86,7 +86,6 @@ public class MediaStatusNotifyMessageHandler extends SIPRequestProcessorParent i
@Override
public void handForDevice(RequestEvent evt, Device device, Element rootElement) {
// 回复200 OK
try {
responseAck((SIPRequest) evt.getRequest(), Response.OK);

View File

@ -98,7 +98,6 @@ public class MobilePositionNotifyMessageHandler extends SIPRequestProcessorParen
continue;
}
MobilePosition mobilePosition = new MobilePosition();
mobilePosition.setCreateTime(DateUtil.getNow());
if (!ObjectUtils.isEmpty(sipMsgInfo.getDevice().getName())) {

View File

@ -1,7 +1,11 @@
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.Platform;
import com.genersoft.iot.vmp.gb28181.service.IDeviceChannelService;
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.SIPCommanderFroPlatform;
import com.genersoft.iot.vmp.gb28181.transmit.event.request.SIPRequestProcessorParent;
import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.IMessageHandler;
@ -34,9 +38,19 @@ public class DeviceInfoQueryMessageHandler extends SIPRequestProcessorParent imp
@Autowired
private SIPCommanderFroPlatform cmderFroPlatform;
@Autowired
private IVideoManagerStorage storager;
@Autowired
private IDeviceService deviceService;
@Autowired
private IGbChannelService channelService;
@Autowired
private IDeviceChannelService deviceChannelService;
@Override
public void afterPropertiesSet() throws Exception {
queryMessageHandler.addHandler(cmdType, this);
@ -50,14 +64,9 @@ public class DeviceInfoQueryMessageHandler extends SIPRequestProcessorParent imp
@Override
public void handForPlatform(RequestEvent evt, Platform platform, Element rootElement) {
log.info("[DeviceInfo查询]消息");
SIPRequest request = (SIPRequest) evt.getRequest();
FromHeader fromHeader = (FromHeader) evt.getRequest().getHeader(FromHeader.NAME);
try {
// 回复200 OK
responseAck((SIPRequest) evt.getRequest(), Response.OK);
} catch (SipException | InvalidArgumentException | ParseException e) {
log.error("[命令发送失败] DeviceInfo查询回复: {}", e.getMessage());
return;
}
String sn = rootElement.element("SN").getText();
/*WVP
@ -66,14 +75,60 @@ public class DeviceInfoQueryMessageHandler extends SIPRequestProcessorParent imp
String channelId = getText(rootElement, "DeviceID");
// 查询这是通道id还是设备id
Device device = null;
// 如果id指向平台的国标编号那么就是查询平台的信息
if (!platform.getDeviceGBId().equals(channelId)) {
device = storager.queryDeviceInfoByPlatformIdAndChannelId(platform.getServerGBId(), channelId);
if (device ==null){
log.error("[平台没有该通道的使用权限]:platformId"+platform.getServerGBId()+" deviceID:"+channelId);
if (platform.getDeviceGBId().equals(channelId)) {
// id指向平台的国标编号那么就是查询平台的信息
try {
cmderFroPlatform.deviceInfoResponse(platform, null, sn, fromHeader.getTag());
} catch (SipException | InvalidArgumentException | ParseException e) {
log.error("[命令发送失败] 国标级联 DeviceInfo查询回复: {}", e.getMessage());
}
return;
}
CommonGBChannel channel = channelService.queryOneWithPlatform(platform.getId(), channelId);
if (channel == null) {
// 不存在则回复404
log.warn("[DeviceInfo] 通道不存在: 通道编号: {}", channelId);
try {
responseAck(request, Response.NOT_FOUND, "channel not found or offline");
} catch (SipException | InvalidArgumentException | ParseException e) {
log.error("[命令发送失败] DeviceInfo查询回复: {}", e.getMessage());
return;
}
return;
}
// 判断通道类型
if (channel.getGbDeviceId() == null) {
// 非国标通道不支持录像回放控制
log.warn("[DeviceInfo] 非国标通道不支持录像回放控制: 通道ID {}", channel.getGbId());
try {
responseAck(request, Response.FORBIDDEN, "");
} catch (SipException | InvalidArgumentException | ParseException e) {
log.error("[命令发送失败] DeviceInfo查询回复: {}", e.getMessage());
return;
}
return;
}
// 根据通道ID获取所属设备
Device device = deviceService.getDeviceByChannelId(channel.getGbId());
if (device == null) {
// 不存在则回复404
log.warn("[DeviceInfo] 通道所属设备不存在, 通道ID {}", channel.getGbId());
try {
responseAck(request, Response.NOT_FOUND, "device not found ");
} catch (SipException | InvalidArgumentException | ParseException e) {
log.error("[命令发送失败] DeviceInfo查询回复: {}", e.getMessage());
return;
}
return;
}
try {
// 回复200 OK
responseAck((SIPRequest) evt.getRequest(), Response.OK);
} catch (SipException | InvalidArgumentException | ParseException e) {
log.error("[命令发送失败] DeviceInfo查询回复: {}", e.getMessage());
return;
}
try {
cmderFroPlatform.deviceInfoResponse(platform, device, sn, fromHeader.getTag());

View File

@ -2,7 +2,6 @@ package com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.query.
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.Platform;
import com.genersoft.iot.vmp.gb28181.event.record.RecordEndEventListener;
import com.genersoft.iot.vmp.gb28181.service.IDeviceService;
@ -12,8 +11,6 @@ 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;
import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.query.QueryMessageHandler;
import com.genersoft.iot.vmp.storager.IVideoManagerStorage;
import com.genersoft.iot.vmp.storager.dao.dto.ChannelSourceInfo;
import com.genersoft.iot.vmp.utils.DateUtil;
import gov.nist.javax.sip.message.SIPRequest;
import lombok.extern.slf4j.Slf4j;
@ -27,7 +24,6 @@ import javax.sip.RequestEvent;
import javax.sip.SipException;
import javax.sip.message.Response;
import java.text.ParseException;
import java.util.List;
@Slf4j
@Component
@ -38,9 +34,6 @@ public class RecordInfoQueryMessageHandler extends SIPRequestProcessorParent imp
@Autowired
private QueryMessageHandler queryMessageHandler;
@Autowired
private IVideoManagerStorage storager;
@Autowired
private IGbChannelService channelService;