支持 禁用实时点播

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

View File

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

View File

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