From 28a9188bee073c28a4539059905a0f989232d74c Mon Sep 17 00:00:00 2001 From: htjcAdmin Date: Thu, 18 Sep 2025 14:09:07 +0800 Subject: [PATCH] =?UTF-8?q?/*=E8=A7=86=E9=A2=91=E5=BD=95=E5=83=8F=E5=BC=82?= =?UTF-8?q?=E5=B8=B8=E9=97=AE=E9=A2=98=E4=BF=AE=E6=94=B9*/?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ivs/controller/IvsRecordController.java | 9 +++++---- .../ivs/controller/IvsStreamController.java | 17 ++++++++++++----- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/inspect-ivs/src/main/java/com/inspect/ivs/controller/IvsRecordController.java b/inspect-ivs/src/main/java/com/inspect/ivs/controller/IvsRecordController.java index 7127031..d221c10 100644 --- a/inspect-ivs/src/main/java/com/inspect/ivs/controller/IvsRecordController.java +++ b/inspect-ivs/src/main/java/com/inspect/ivs/controller/IvsRecordController.java @@ -42,20 +42,21 @@ public class IvsRecordController { @GetMapping({"start"}) public Response start(String streamid) { - log.debug("[RECORD] record start streamId:{}", streamid); + log.debug("START_RECORD record start streamId:{}", streamid); String code = redisService.getCacheObject(String.format(IvsConst.IVS_STREAM_ID, streamid)); + log.debug("START_RECORD record start code:{}", code); IvsRecStartVo ivsRecStartVo = new IvsRecStartVo(); ivsRecStartVo.setCode(code); String key = String.format(IvsConst.IVS_RECORD_START_TIME, streamid); redisService.setCacheObject(key, DateUtils.dateTimeNow(), IvsConst.IVS_RECORD_START_TIME_EXPIRE, TimeUnit.MINUTES); ivsCommonService.get(getLabel(), UriUtils.parse(IvsConst.URI_START_RECORD, ivsRecStartVo)); - log.debug("[RECORD] record start end"); + log.debug("START_RECORD record start end"); return Response.ok(); } @GetMapping({"stop"}) public IvsRecStopView stop(String streamid) { - log.debug("[RECORD] record stop streamid:{}", streamid); + log.debug("STOP_RECORD record stop streamid:{}", streamid); String key = String.format(IvsConst.IVS_STREAM_ID, streamid); String code = redisService.getCacheObject(key); IvsVo ivsRecordStartVo = new IvsVo(); @@ -78,7 +79,7 @@ public class IvsRecordController { key = String.format(IvsConst.IVS_DOWNLOAD_STREAM_ID, streamid); redisService.setCacheObject(key, ivsRecStopView.toJSON(), IvsConst.IVS_STREAM_ID_EXPIRE, TimeUnit.HOURS); - log.debug("[RECORD] record stop end"); + log.debug("STOP_RECORD record stop end streamid:{}", streamid); return ivsRecStopView; } diff --git a/inspect-ivs/src/main/java/com/inspect/ivs/controller/IvsStreamController.java b/inspect-ivs/src/main/java/com/inspect/ivs/controller/IvsStreamController.java index 44cd7d2..c98e036 100644 --- a/inspect-ivs/src/main/java/com/inspect/ivs/controller/IvsStreamController.java +++ b/inspect-ivs/src/main/java/com/inspect/ivs/controller/IvsStreamController.java @@ -3,6 +3,7 @@ package com.inspect.ivs.controller; import com.inspect.base.core.domain.Response; import com.inspect.base.core.utils.StringUtils; import com.inspect.base.core.utils.uuid.UUID; +import com.inspect.base.redis.service.RedisService; import com.inspect.ivs.constant.IvsConst; import com.inspect.ivs.enums.RtspType; import com.inspect.ivs.service.IvsCommonService; @@ -19,6 +20,8 @@ import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; +import javax.annotation.Resource; + @RestController @RequestMapping({"/api/v1/stream"}) public class IvsStreamController { @@ -34,6 +37,9 @@ public class IvsStreamController { private final ZlMediaComponent zlMediaComponent; private final XinTongComponent xinTongComponent; + @Resource + private RedisService redisService; + public IvsStreamController(IvsCommonService ivsCommonService, ZlMediaComponent zlMediaComponent, XinTongComponent xinTongComponent) { this.ivsCommonService = ivsCommonService; this.zlMediaComponent = zlMediaComponent; @@ -63,17 +69,18 @@ public class IvsStreamController { } log.debug("[IVS] {}", ivsVideoRtspView); - String handle = UUID.randomUUID().toString(); - log.debug("[IVS] => => rtspType: {}, rtspType.ordinal: {}", rtspType, rtspType.ordinal()); + String streamId = UUID.randomUUID().toString(); + redisService.setCacheObject(String.format(IvsConst.IVS_STREAM_ID, streamId), ivsVideoRtspVo.getCameraCode()); + log.debug("[IVS] => => rtspType: {}, rtspType.ordinal: {}, streamId: {}", rtspType, rtspType.ordinal(), streamId); switch (rtspType.ordinal()) { case 0: - zlMediaComponent.convert(ivsVideoRtspView.getRtspURL(), handle, ivsVideoRtspView); + zlMediaComponent.convert(ivsVideoRtspView.getRtspURL(), streamId, ivsVideoRtspView); break; case 1: - xinTongComponent.convert(ivsVideoRtspView.getRtspURL(), handle, ivsVideoRtspView); + xinTongComponent.convert(ivsVideoRtspView.getRtspURL(), streamId, ivsVideoRtspView); } - IvsStreamStartView ivsStreamStartView = new IvsStreamStartView(handle, ivsVideoRtspView); + IvsStreamStartView ivsStreamStartView = new IvsStreamStartView(streamId, ivsVideoRtspView); log.debug("[IVS] {}", ivsStreamStartView); log.debug("[IVS] end"); return ivsStreamStartView;