支持 禁用实时点播

This commit is contained in:
zxb 2023-11-02 17:28:52 +08:00
parent 792b636898
commit b52459846e
3 changed files with 11 additions and 10 deletions

View File

@ -36,6 +36,7 @@ public class RecordEndEventListener implements ApplicationListener<RecordEndEven
public void onApplicationEvent(RecordEndEvent event) { public void onApplicationEvent(RecordEndEvent event) {
String deviceId = event.getRecordInfo().getDeviceId(); String deviceId = event.getRecordInfo().getDeviceId();
String channelId = event.getRecordInfo().getChannelId(); String channelId = event.getRecordInfo().getChannelId();
String sn = event.getRecordInfo().getSn();
int count = event.getRecordInfo().getCount(); int count = event.getRecordInfo().getCount();
int sumNum = event.getRecordInfo().getSumNum(); int sumNum = event.getRecordInfo().getSumNum();
logger.info("录像查询完成事件触发deviceId{}, channelId: {}, 录像数量{}/{}条", logger.info("录像查询完成事件触发deviceId{}, channelId: {}, 录像数量{}/{}条",
@ -43,9 +44,9 @@ public class RecordEndEventListener implements ApplicationListener<RecordEndEven
event.getRecordInfo().getChannelId(), count,sumNum); event.getRecordInfo().getChannelId(), count,sumNum);
logger.debug("handlerMap.size => {}", handlerMap.size()); logger.debug("handlerMap.size => {}", handlerMap.size());
if (handlerMap.size() > 0) { if (handlerMap.size() > 0) {
String key = deviceId + channelId; String key = deviceId + channelId + sn;
logger.debug("handlerMap.keys => {}", handlerMap.keySet()); logger.debug("handlerMap.keys => {}", handlerMap.keySet());
RecordEndEventHandler handler = handlerMap.get(deviceId + channelId); RecordEndEventHandler handler = handlerMap.get(deviceId + channelId + sn);
logger.debug("handler => {}", handler); logger.debug("handler => {}", handler);
if (handler != null){ if (handler != null){
handler.handler(event.getRecordInfo()); handler.handler(event.getRecordInfo());
@ -71,18 +72,18 @@ public class RecordEndEventListener implements ApplicationListener<RecordEndEven
* @param channelId * @param channelId
* @param recordEndEventHandler * @param recordEndEventHandler
*/ */
public void addEndEventHandler(String device, String channelId, RecordEndEventHandler recordEndEventHandler) { public void addEndEventHandler(String device, String channelId, String sn, RecordEndEventHandler recordEndEventHandler) {
logger.debug("RecordEndEventListener addEndEventHandler => deviceId: {}, channelId: {}", device,channelId); logger.debug("RecordEndEventListener addEndEventHandler => deviceId: {}, channelId: {}, sn: {}", device,channelId, sn);
handlerMap.put(device + channelId, recordEndEventHandler); handlerMap.put(device + channelId + sn, recordEndEventHandler);
} }
/** /**
* 添加 * 添加
* @param device * @param device
* @param channelId * @param channelId
*/ */
public void delEndEventHandler(String device, String channelId) { public void delEndEventHandler(String device, String channelId, String sn) {
logger.debug("RecordEndEventListener delEndEventHandler => deviceId: {}, channelId: {}", device,channelId); logger.debug("RecordEndEventListener delEndEventHandler => deviceId: {}, channelId: {}, sn: {}", device,channelId,sn);
handlerMap.remove(device + channelId); handlerMap.remove(device + channelId + sn);
} }
} }

View File

@ -71,7 +71,7 @@ public class RecordDataCatch {
msg.setKey(msgKey); msg.setKey(msgKey);
msg.setData(recordInfo); msg.setData(recordInfo);
deferredResultHolder.invokeAllResult(msg); deferredResultHolder.invokeAllResult(msg);
recordEndEventListener.delEndEventHandler(recordInfo.getDeviceId(),recordInfo.getChannelId()); recordEndEventListener.delEndEventHandler(recordInfo.getDeviceId(),recordInfo.getChannelId(),recordInfo.getSn());
data.remove(key); data.remove(key);
} }
} }

View File

@ -104,7 +104,7 @@ public class RecordInfoQueryMessageHandler extends SIPRequestProcessorParent imp
DeviceChannel deviceChannel = storager.queryChannelInParentPlatform(parentPlatform.getServerGBId(), channelId); DeviceChannel deviceChannel = storager.queryChannelInParentPlatform(parentPlatform.getServerGBId(), channelId);
CopyOnWriteArraySet<String> set = new CopyOnWriteArraySet<>(); CopyOnWriteArraySet<String> set = new CopyOnWriteArraySet<>();
// 接收录像数据 // 接收录像数据
recordEndEventListener.addEndEventHandler(deviceChannel.getDeviceId(), channelId, (recordInfo)->{ recordEndEventListener.addEndEventHandler(deviceChannel.getDeviceId(), channelId, String.valueOf(sn),(recordInfo)->{
try { try {
RecordItem item = recordInfo.getRecordList().stream().findFirst().orElse(null); RecordItem item = recordInfo.getRecordList().stream().findFirst().orElse(null);
if(item == null) { if(item == null) {