修复国标级自定编号后录像查询
parent
ff2b81b546
commit
c28dacecf2
|
@ -2,8 +2,10 @@ 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.CommonGBChannel;
|
||||||
import com.genersoft.iot.vmp.gb28181.bean.Device;
|
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.bean.Platform;
|
||||||
import com.genersoft.iot.vmp.gb28181.event.record.RecordEndEventListener;
|
import com.genersoft.iot.vmp.gb28181.event.record.RecordEndEventListener;
|
||||||
|
import com.genersoft.iot.vmp.gb28181.service.IDeviceChannelService;
|
||||||
import com.genersoft.iot.vmp.gb28181.service.IDeviceService;
|
import com.genersoft.iot.vmp.gb28181.service.IDeviceService;
|
||||||
import com.genersoft.iot.vmp.gb28181.service.IGbChannelService;
|
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.SIPCommander;
|
||||||
|
@ -40,6 +42,9 @@ public class RecordInfoQueryMessageHandler extends SIPRequestProcessorParent imp
|
||||||
@Autowired
|
@Autowired
|
||||||
private IDeviceService deviceService;
|
private IDeviceService deviceService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IDeviceChannelService deviceChannelService;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private SIPCommanderFroPlatform cmderFroPlatform;
|
private SIPCommanderFroPlatform cmderFroPlatform;
|
||||||
|
|
||||||
|
@ -60,7 +65,7 @@ public class RecordInfoQueryMessageHandler extends SIPRequestProcessorParent imp
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void handForPlatform(RequestEvent evt, Platform parentPlatform, Element rootElement) {
|
public void handForPlatform(RequestEvent evt, Platform platform, Element rootElement) {
|
||||||
|
|
||||||
SIPRequest request = (SIPRequest) evt.getRequest();
|
SIPRequest request = (SIPRequest) evt.getRequest();
|
||||||
Element snElement = rootElement.element("SN");
|
Element snElement = rootElement.element("SN");
|
||||||
|
@ -89,9 +94,9 @@ public class RecordInfoQueryMessageHandler extends SIPRequestProcessorParent imp
|
||||||
}
|
}
|
||||||
|
|
||||||
// 向国标设备请求录像数据
|
// 向国标设备请求录像数据
|
||||||
CommonGBChannel channel = channelService.queryOneWithPlatform(parentPlatform.getId(), channelId);
|
CommonGBChannel channel = channelService.queryOneWithPlatform(platform.getId(), channelId);
|
||||||
if (channel == null) {
|
if (channel == null) {
|
||||||
log.info("[平台查询录像记录] 未找到通道 {}/{}", parentPlatform.getName(), channelId );
|
log.info("[平台查询录像记录] 未找到通道 {}/{}", platform.getName(), channelId );
|
||||||
try {
|
try {
|
||||||
responseAck(request, Response.BAD_REQUEST);
|
responseAck(request, Response.BAD_REQUEST);
|
||||||
} catch (SipException | InvalidArgumentException | ParseException e) {
|
} catch (SipException | InvalidArgumentException | ParseException e) {
|
||||||
|
@ -99,8 +104,8 @@ public class RecordInfoQueryMessageHandler extends SIPRequestProcessorParent imp
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (channel.getStreamProxyId() != null || channel.getStreamPushId() != null ) {
|
if (channel.getGbId() == 0 ) {
|
||||||
log.info("[平台查询录像记录] 不支持查询推流和拉流代理的录像数据 {}/{}", parentPlatform.getName(), channelId );
|
log.info("[平台查询录像记录] 不支持查询推流和拉流代理的录像数据 {}/{}", platform.getName(), channelId );
|
||||||
try {
|
try {
|
||||||
responseAck(request, Response.NOT_IMPLEMENTED); // 回复未实现
|
responseAck(request, Response.NOT_IMPLEMENTED); // 回复未实现
|
||||||
} catch (SipException | InvalidArgumentException | ParseException e) {
|
} catch (SipException | InvalidArgumentException | ParseException e) {
|
||||||
|
@ -110,7 +115,7 @@ public class RecordInfoQueryMessageHandler extends SIPRequestProcessorParent imp
|
||||||
}
|
}
|
||||||
Device device = deviceService.getDevice(channel.getGbDeviceDbId());
|
Device device = deviceService.getDevice(channel.getGbDeviceDbId());
|
||||||
if (device == null) {
|
if (device == null) {
|
||||||
log.warn("[平台查询录像记录] 未找到通道对应的设备 {}/{}", parentPlatform.getName(), channelId );
|
log.warn("[平台查询录像记录] 未找到通道对应的设备 {}/{}", platform.getName(), channelId );
|
||||||
try {
|
try {
|
||||||
responseAck(request, Response.BAD_REQUEST);
|
responseAck(request, Response.BAD_REQUEST);
|
||||||
} catch (SipException | InvalidArgumentException | ParseException e) {
|
} catch (SipException | InvalidArgumentException | ParseException e) {
|
||||||
|
@ -118,17 +123,19 @@ public class RecordInfoQueryMessageHandler extends SIPRequestProcessorParent imp
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
// 获取通道的原始信息
|
||||||
|
DeviceChannel deviceChannel = deviceChannelService.getOneById(channel.getGbId());
|
||||||
// 接收录像数据
|
// 接收录像数据
|
||||||
recordEndEventListener.addEndEventHandler(device.getDeviceId(), channelId, (recordInfo)->{
|
recordEndEventListener.addEndEventHandler(device.getDeviceId(), deviceChannel.getDeviceId(), (recordInfo)->{
|
||||||
try {
|
try {
|
||||||
log.info("[国标级联] 录像查询收到数据, 通道: {},准备转发===", channelId);
|
log.info("[国标级联] 录像查询收到数据, 通道: {},准备转发===", channelId);
|
||||||
cmderFroPlatform.recordInfo(channel, parentPlatform, request.getFromTag(), recordInfo);
|
cmderFroPlatform.recordInfo(channel, platform, request.getFromTag(), recordInfo);
|
||||||
} catch (SipException | InvalidArgumentException | ParseException e) {
|
} catch (SipException | InvalidArgumentException | ParseException e) {
|
||||||
log.error("[命令发送失败] 国标级联 回复录像数据: {}", e.getMessage());
|
log.error("[命令发送失败] 国标级联 回复录像数据: {}", e.getMessage());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
try {
|
try {
|
||||||
commander.recordInfoQuery(device, channelId, DateUtil.ISO8601Toyyyy_MM_dd_HH_mm_ss(startTime),
|
commander.recordInfoQuery(device, deviceChannel.getDeviceId(), DateUtil.ISO8601Toyyyy_MM_dd_HH_mm_ss(startTime),
|
||||||
DateUtil.ISO8601Toyyyy_MM_dd_HH_mm_ss(endTime), sn, secrecy, type, (eventResult -> {
|
DateUtil.ISO8601Toyyyy_MM_dd_HH_mm_ss(endTime), sn, secrecy, type, (eventResult -> {
|
||||||
// 回复200 OK
|
// 回复200 OK
|
||||||
try {
|
try {
|
||||||
|
|
Loading…
Reference in New Issue