From d69b5d810b21b8c59206ce8db549294b9464bba0 Mon Sep 17 00:00:00 2001 From: 648540858 <648540858@qq.com> Date: Wed, 11 Dec 2024 18:26:18 +0800 Subject: [PATCH] =?UTF-8?q?[redis=E4=B8=8B=E7=9A=84=E5=A4=9Awvp]=20?= =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=9C=8D=E5=8A=A1=E9=97=B4=E6=96=B9=E6=B3=95?= =?UTF-8?q?=E8=B0=83=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/IGbChannelRpcPlayService.java | 8 --- .../gb28181/service/impl/PlayRpcService.java | 54 ------------------- 2 files changed, 62 deletions(-) delete mode 100644 src/main/java/com/genersoft/iot/vmp/gb28181/service/IGbChannelRpcPlayService.java delete mode 100644 src/main/java/com/genersoft/iot/vmp/gb28181/service/impl/PlayRpcService.java diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/service/IGbChannelRpcPlayService.java b/src/main/java/com/genersoft/iot/vmp/gb28181/service/IGbChannelRpcPlayService.java deleted file mode 100644 index 1847e430..00000000 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/service/IGbChannelRpcPlayService.java +++ /dev/null @@ -1,8 +0,0 @@ -package com.genersoft.iot.vmp.gb28181.service; - -import com.genersoft.iot.vmp.common.StreamInfo; -import com.genersoft.iot.vmp.service.bean.ErrorCallback; - -public interface IGbChannelRpcPlayService { - void play(String serverId, Integer channelId, ErrorCallback callback); -} diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/service/impl/PlayRpcService.java b/src/main/java/com/genersoft/iot/vmp/gb28181/service/impl/PlayRpcService.java deleted file mode 100644 index 96eb3ced..00000000 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/service/impl/PlayRpcService.java +++ /dev/null @@ -1,54 +0,0 @@ -package com.genersoft.iot.vmp.gb28181.service.impl; - -import com.alibaba.fastjson2.JSON; -import com.genersoft.iot.vmp.common.StreamInfo; -import com.genersoft.iot.vmp.conf.UserSetting; -import com.genersoft.iot.vmp.conf.redis.RedisRpcConfig; -import com.genersoft.iot.vmp.conf.redis.bean.RedisRpcRequest; -import com.genersoft.iot.vmp.conf.redis.bean.RedisRpcResponse; -import com.genersoft.iot.vmp.gb28181.service.IGbChannelRpcPlayService; -import com.genersoft.iot.vmp.service.bean.ErrorCallback; -import com.genersoft.iot.vmp.vmanager.bean.ErrorCode; -import lombok.extern.slf4j.Slf4j; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import javax.sip.message.Response; - -@Slf4j -@Service("playRpcService") -public class PlayRpcService implements IGbChannelRpcPlayService { - - @Autowired - private RedisRpcConfig redisRpcConfig; - - @Autowired - private UserSetting userSetting; - - - private RedisRpcRequest buildRequest(String uri, Object param) { - RedisRpcRequest request = new RedisRpcRequest(); - request.setFromId(userSetting.getServerId()); - request.setParam(param); - request.setUri(uri); - return request; - } - - @Override - public void play(String serverId, Integer channelId, ErrorCallback callback) { - log.info("[点播其他WVP的设备] 通道Id:{}", channelId); - RedisRpcRequest request = buildRequest("playChannel", channelId); - request.setToId(serverId); - RedisRpcResponse response = redisRpcConfig.request(request, userSetting.getPlayTimeout()); - if (response == null) { - callback.run(ErrorCode.ERROR100.getCode(), ErrorCode.ERROR100.getMsg(), null); - }else { - if (response.getStatusCode() == Response.OK) { - StreamInfo streamInfo = JSON.parseObject(response.getBody().toString(), StreamInfo.class); - callback.run(response.getStatusCode(), "success", streamInfo); - }else { - callback.run(response.getStatusCode(), response.getBody().toString(), null); - } - } - } -}