某类设备存在录像列表重复推送问题
故 向上级平台推送历史录像时 去重
This commit is contained in:
parent
5a30f6cd86
commit
133afc655a
@ -25,7 +25,10 @@ import javax.sip.RequestEvent;
|
||||
import javax.sip.SipException;
|
||||
import javax.sip.message.Response;
|
||||
import java.text.ParseException;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
import java.util.concurrent.CopyOnWriteArraySet;
|
||||
|
||||
@Component
|
||||
public class RecordInfoQueryMessageHandler extends SIPRequestProcessorParent implements InitializingBean, IMessageHandler {
|
||||
@ -99,9 +102,20 @@ public class RecordInfoQueryMessageHandler extends SIPRequestProcessorParent imp
|
||||
// 向国标设备请求录像数据
|
||||
Device device = storager.queryVideoDeviceByPlatformIdAndChannelId(parentPlatform.getServerGBId(), channelId);
|
||||
DeviceChannel deviceChannel = storager.queryChannelInParentPlatform(parentPlatform.getServerGBId(), channelId);
|
||||
CopyOnWriteArraySet<String> set = new CopyOnWriteArraySet<>();
|
||||
// 接收录像数据
|
||||
recordEndEventListener.addEndEventHandler(deviceChannel.getDeviceId(), channelId, (recordInfo)->{
|
||||
try {
|
||||
RecordItem item = recordInfo.getRecordList().stream().findFirst().orElse(null);
|
||||
if(item == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
String key = item.getStartTime() + item.getEndTime();
|
||||
if(set.contains(key)){
|
||||
return;
|
||||
}
|
||||
set.add(key);
|
||||
cmderFroPlatform.recordInfo(deviceChannel, parentPlatform, request.getFromTag(), recordInfo);
|
||||
} catch (SipException | InvalidArgumentException | ParseException e) {
|
||||
logger.error("[命令发送失败] 国标级联 回复录像数据: {}", e.getMessage());
|
||||
|
Loading…
Reference in New Issue
Block a user