设备历史录像查询(调整/部分重构) 调整

This commit is contained in:
shikong 2023-10-03 17:32:01 +08:00
parent dc3cf8f5b5
commit 5b8db7322d

View File

@ -95,8 +95,8 @@ public class RecordService {
subscribe.getSipRequestSubscribe().addPublisher(key); subscribe.getSipRequestSubscribe().addPublisher(key);
Flow.Subscriber<SIPRequest> subscriber = new Flow.Subscriber<>() { Flow.Subscriber<SIPRequest> subscriber = new Flow.Subscriber<>() {
final List<RecordInfoItemDTO> list = new ArrayList<>(); final List<RecordInfoItemDTO> list = new ArrayList<>();
AtomicLong atomicSum = new AtomicLong(0); final AtomicLong atomicSum = new AtomicLong(0);
AtomicLong atomicNum = new AtomicLong(0); final AtomicLong atomicNum = new AtomicLong(0);
Flow.Subscription subscription; Flow.Subscription subscription;
@Override @Override
@ -109,8 +109,8 @@ public class RecordService {
@Override @Override
public void onNext(SIPRequest item) { public void onNext(SIPRequest item) {
RecordInfoResponseDTO data = MANSCDPUtils.parse(item.getRawContent(), RecordInfoResponseDTO.class); RecordInfoResponseDTO data = MANSCDPUtils.parse(item.getRawContent(), RecordInfoResponseDTO.class);
atomicSum.set(data.getSumNum()); atomicSum.set(Math.max(data.getSumNum(), atomicNum.get()));
atomicNum.getAndAdd(data.getRecordList().getNum()); atomicNum.addAndGet(data.getRecordList().getNum());
list.addAll(data.getRecordList().getRecordList()); list.addAll(data.getRecordList().getRecordList());
long num = atomicNum.get(); long num = atomicNum.get();
long sum = atomicSum.get(); long sum = atomicSum.get();