From 7847bd661404236158d093bd68982166cbdba948 Mon Sep 17 00:00:00 2001
From: panlinlin <648540858@qq.com>
Date: Thu, 27 Jun 2024 23:38:13 +0800
Subject: [PATCH] =?UTF-8?q?=E4=B8=B4=E6=97=B6=E6=8F=90=E4=BA=A4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
pom.xml | 2 --
.../service/impl/StreamProxyServiceImpl.java | 26 +++++++++----------
2 files changed, 13 insertions(+), 15 deletions(-)
diff --git a/pom.xml b/pom.xml
index e0ef34bb..9a5edc53 100644
--- a/pom.xml
+++ b/pom.xml
@@ -345,8 +345,6 @@
1.18.30
provided
-
-
org.springframework.boot
spring-boot-starter-test
diff --git a/src/main/java/com/genersoft/iot/vmp/streamProxy/service/impl/StreamProxyServiceImpl.java b/src/main/java/com/genersoft/iot/vmp/streamProxy/service/impl/StreamProxyServiceImpl.java
index 57f2749b..02d8f023 100755
--- a/src/main/java/com/genersoft/iot/vmp/streamProxy/service/impl/StreamProxyServiceImpl.java
+++ b/src/main/java/com/genersoft/iot/vmp/streamProxy/service/impl/StreamProxyServiceImpl.java
@@ -31,6 +31,7 @@ import com.genersoft.iot.vmp.vmanager.bean.ResourceBaseInfo;
import com.genersoft.iot.vmp.vmanager.bean.WVPResult;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
+import lombok.extern.slf4j.Slf4j;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -54,12 +55,11 @@ import java.util.stream.Collectors;
/**
* 视频代理业务
*/
+@Slf4j
@Service
@DS("master")
public class StreamProxyServiceImpl implements IStreamProxyService {
- private final static Logger logger = LoggerFactory.getLogger(StreamProxyServiceImpl.class);
-
@Autowired
private StreamProxyMapper streamProxyMapper;
@@ -144,7 +144,7 @@ public class StreamProxyServiceImpl implements IStreamProxyService {
mediaServer = mediaServerService.getOne(param.getMediaServerId());
}
if (mediaServer == null) {
- logger.warn("保存代理未找到在线的ZLM...");
+ log.warn("保存代理未找到在线的ZLM...");
throw new ControllerException(ErrorCode.ERROR100.getCode(), "保存代理未找到在线的ZLM");
}
String dstUrl;
@@ -179,7 +179,7 @@ public class StreamProxyServiceImpl implements IStreamProxyService {
param.getStream());
}
param.setDstUrl(dstUrl);
- logger.info("[拉流代理] 输出地址为:{}", dstUrl);
+ log.info("[拉流代理] 输出地址为:{}", dstUrl);
param.setMediaServerId(mediaServer.getId());
boolean saveResult;
// 更新
@@ -287,7 +287,7 @@ public class StreamProxyServiceImpl implements IStreamProxyService {
result = true;
dataSourceTransactionManager.commit(transactionStatus); //手动提交
}catch (Exception e) {
- logger.error("向数据库添加流代理失败:", e);
+ log.error("向数据库添加流代理失败:", e);
dataSourceTransactionManager.rollback(transactionStatus);
}
@@ -323,7 +323,7 @@ public class StreamProxyServiceImpl implements IStreamProxyService {
dataSourceTransactionManager.commit(transactionStatus); //手动提交
result = true;
}catch (Exception e) {
- logger.error("未处理的异常 ", e);
+ log.error("未处理的异常 ", e);
dataSourceTransactionManager.rollback(transactionStatus);
}
return result;
@@ -334,7 +334,7 @@ public class StreamProxyServiceImpl implements IStreamProxyService {
WVPResult result = null;
MediaServer mediaServer = null;
if (param.getMediaServerId() == null) {
- logger.warn("添加代理时MediaServerId 为null");
+ log.warn("添加代理时MediaServerId 为null");
return null;
}else {
mediaServer = mediaServerService.getOne(param.getMediaServerId());
@@ -360,7 +360,7 @@ public class StreamProxyServiceImpl implements IStreamProxyService {
if (result != null && result.getCode() == 0) {
String key = result.getData();
if (key == null) {
- logger.warn("[获取拉流代理的结果数据Data] 失败: {}", result );
+ log.warn("[获取拉流代理的结果数据Data] 失败: {}", result );
return result;
}
param.setStreamKey(key);
@@ -412,9 +412,9 @@ public class StreamProxyServiceImpl implements IStreamProxyService {
redisCatchStorage.removeStream(streamProxyItem.getMediaServerId(), "PUSH", app, stream);
Boolean result = removeStreamProxyFromZlm(streamProxyItem);
if (result != null && result) {
- logger.info("[移除代理]: 代理: {}/{}, 从zlm移除成功", app, stream);
+ log.info("[移除代理]: 代理: {}/{}, 从zlm移除成功", app, stream);
}else {
- logger.info("[移除代理]: 代理: {}/{}, 从zlm移除失败", app, stream);
+ log.info("[移除代理]: 代理: {}/{}, 从zlm移除失败", app, stream);
}
}
}
@@ -433,7 +433,7 @@ public class StreamProxyServiceImpl implements IStreamProxyService {
streamProxy.setEnable(true);
updateStreamProxy(streamProxy);
}else {
- logger.info("启用代理失败: {}/{}->{}({})", app, stream, wvpResult.getMsg(),
+ log.info("启用代理失败: {}/{}->{}({})", app, stream, wvpResult.getMsg(),
streamProxy.getSrcUrl() == null? streamProxy.getUrl():streamProxy.getSrcUrl());
}
} else if (streamProxy != null && streamProxy.isEnable()) {
@@ -483,11 +483,11 @@ public class StreamProxyServiceImpl implements IStreamProxyService {
List streamProxyListForEnable = storager.getStreamProxyListForEnableInMediaServer(
mediaServerId, true);
for (StreamProxy streamProxyDto : streamProxyListForEnable) {
- logger.info("恢复流代理," + streamProxyDto.getApp() + "/" + streamProxyDto.getStream());
+ log.info("恢复流代理," + streamProxyDto.getApp() + "/" + streamProxyDto.getStream());
WVPResult wvpResult = addStreamProxyToZlm(streamProxyDto);
if (wvpResult == null) {
// 设置为离线
- logger.info("恢复流代理失败" + streamProxyDto.getApp() + "/" + streamProxyDto.getStream());
+ log.info("恢复流代理失败" + streamProxyDto.getApp() + "/" + streamProxyDto.getStream());
updateStatusByAppAndStream(streamProxyDto.getApp(), streamProxyDto.getStream(), false);
}else {
updateStatusByAppAndStream(streamProxyDto.getApp(), streamProxyDto.getStream(), true);