From 614ff4c71e9607251d8b98bad5a22096a287a2d2 Mon Sep 17 00:00:00 2001 From: 648540858 <648540858@qq.com> Date: Fri, 13 Sep 2024 15:43:22 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E7=9F=AD=E7=9A=84=E5=BD=95?= =?UTF-8?q?=E5=83=8F=E6=96=87=E4=BB=B6=E7=9A=84=E4=B8=8B=E8=BD=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../genersoft/iot/vmp/common/StreamInfo.java | 11 +++++- .../gb28181/service/impl/PlayServiceImpl.java | 38 ++++++++++++++++++- .../service/impl/StreamPushServiceImpl.java | 18 --------- .../src/components/dialog/recordDownload.vue | 1 + 4 files changed, 48 insertions(+), 20 deletions(-) diff --git a/src/main/java/com/genersoft/iot/vmp/common/StreamInfo.java b/src/main/java/com/genersoft/iot/vmp/common/StreamInfo.java index 5b365ef3..280c11ba 100644 --- a/src/main/java/com/genersoft/iot/vmp/common/StreamInfo.java +++ b/src/main/java/com/genersoft/iot/vmp/common/StreamInfo.java @@ -4,7 +4,6 @@ import com.genersoft.iot.vmp.media.bean.MediaInfo; import com.genersoft.iot.vmp.media.bean.MediaServer; import com.genersoft.iot.vmp.service.bean.DownloadFileInfo; import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; import java.io.Serializable; import java.util.Objects; @@ -83,6 +82,8 @@ public class StreamInfo implements Serializable, Cloneable{ private double progress; @Schema(description = "文件下载地址(录像下载使用)") private DownloadFileInfo downLoadFilePath; + @Schema(description = "点播请求的callId") + private String callId; @Schema(description = "是否暂停(录像回放使用)") private boolean pause; @@ -660,4 +661,12 @@ public class StreamInfo implements Serializable, Cloneable{ public void setServerId(String serverId) { this.serverId = serverId; } + + public String getCallId() { + return callId; + } + + public void setCallId(String callId) { + this.callId = callId; + } } diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/service/impl/PlayServiceImpl.java b/src/main/java/com/genersoft/iot/vmp/gb28181/service/impl/PlayServiceImpl.java index 4fbc6b4b..319220ea 100755 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/service/impl/PlayServiceImpl.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/service/impl/PlayServiceImpl.java @@ -28,6 +28,7 @@ import com.genersoft.iot.vmp.media.event.media.MediaArrivalEvent; import com.genersoft.iot.vmp.media.event.media.MediaDepartureEvent; import com.genersoft.iot.vmp.media.event.media.MediaNotFoundEvent; import com.genersoft.iot.vmp.media.service.IMediaServerService; +import com.genersoft.iot.vmp.media.zlm.dto.StreamAuthorityInfo; import com.genersoft.iot.vmp.service.IReceiveRtpServerService; import com.genersoft.iot.vmp.service.ISendRtpServerService; import com.genersoft.iot.vmp.service.bean.*; @@ -121,6 +122,9 @@ public class PlayServiceImpl implements IPlayService { @Autowired private IReceiveRtpServerService receiveRtpServerService; + @Autowired + private ICloudRecordService cloudRecordService; + /** * 流到来的处理 */ @@ -1053,8 +1057,40 @@ public class PlayServiceImpl implements IPlayService { @Override public StreamInfo getDownLoadInfo(Device device, DeviceChannel channel, String stream) { InviteInfo inviteInfo = inviteStreamService.getInviteInfo(InviteSessionType.DOWNLOAD, channel.getId(), stream); + if (inviteInfo == null) { + String app = "rtp"; + StreamAuthorityInfo streamAuthorityInfo = redisCatchStorage.getStreamAuthorityInfo(app, stream); + if (streamAuthorityInfo != null) { + List allList = cloudRecordService.getAllList(null, app, stream, null, null, null, streamAuthorityInfo.getCallId(), null); + if (allList.isEmpty()) { + log.warn("[获取下载进度] 未查询到录像下载的信息 {}/{}-{}", device.getDeviceId(), channel.getDeviceId(), stream); + return null; + } + String filePath = allList.get(0).getFilePath(); + if (filePath == null) { + log.warn("[获取下载进度] 未查询到录像下载的文件路径 {}/{}-{}", device.getDeviceId(), channel.getDeviceId(), stream); + return null; + } + String mediaServerId = allList.get(0).getMediaServerId(); + MediaServer mediaServer = mediaServerService.getOne(mediaServerId); + if (mediaServer == null) { + log.warn("[获取下载进度] 未查询到录像下载的节点信息 {}/{}-{}", device.getDeviceId(), channel.getDeviceId(), stream); + return null; + } + log.warn("[获取下载进度] 发现下载已经结束,直接从数据库获取到文件 {}/{}-{}", device.getDeviceId(), channel.getDeviceId(), stream); + DownloadFileInfo downloadFileInfo = CloudRecordUtils.getDownloadFilePath(mediaServer, filePath); + StreamInfo streamInfo = new StreamInfo(); + streamInfo.setDownLoadFilePath(downloadFileInfo); + streamInfo.setApp(app); + streamInfo.setStream(stream); + streamInfo.setServerId(mediaServerId); + streamInfo.setProgress(1.0); + return streamInfo; + } + } + if (inviteInfo == null || inviteInfo.getStreamInfo() == null) { - log.warn("[获取下载进度] 未查询到录像下载的信息"); + log.warn("[获取下载进度] 未查询到录像下载的信息 {}/{}-{}", device.getDeviceId(), channel.getDeviceId(), stream); return null; } diff --git a/src/main/java/com/genersoft/iot/vmp/streamPush/service/impl/StreamPushServiceImpl.java b/src/main/java/com/genersoft/iot/vmp/streamPush/service/impl/StreamPushServiceImpl.java index b05dc382..b5c0727a 100755 --- a/src/main/java/com/genersoft/iot/vmp/streamPush/service/impl/StreamPushServiceImpl.java +++ b/src/main/java/com/genersoft/iot/vmp/streamPush/service/impl/StreamPushServiceImpl.java @@ -355,24 +355,6 @@ public class StreamPushServiceImpl implements IStreamPushService { } } - -// if (!changedStreamPushList.isEmpty()) { -// String type = "PUSH"; -// int runLimit = 300; -// if (changedStreamPushList.size() > runLimit) { -// for (int i = 0; i < changedStreamPushList.size(); i += runLimit) { -// int toIndex = i + runLimit; -// if (i + runLimit > changedStreamPushList.size()) { -// toIndex = changedStreamPushList.size(); -// } -// List streamPushItemsSub = changedStreamPushList.subList(i, toIndex); -// streamPushMapper.delAll(streamPushItemsSub); -// } -// }else { -// streamPushMapper.delAll(changedStreamPushList); -// } -// -// } Collection mediaInfos = streamInfoPushItemMap.values(); if (!mediaInfos.isEmpty()) { String type = "PUSH"; diff --git a/web_src/src/components/dialog/recordDownload.vue b/web_src/src/components/dialog/recordDownload.vue index ef4334fc..1dffa767 100755 --- a/web_src/src/components/dialog/recordDownload.vue +++ b/web_src/src/components/dialog/recordDownload.vue @@ -85,6 +85,7 @@ export default { }else { this.downloadFile = this.streamInfo.downLoadFilePath.httpPath; } + this.percentage = 100 this.getProgressRun = false; this.downloadFileClientEvent() }