From 30ab315a1584bd6b94558e5fafd14c9a046bf4ae Mon Sep 17 00:00:00 2001 From: 648540858 <648540858@qq.com> Date: Fri, 3 Jan 2025 16:29:35 +0800 Subject: [PATCH] =?UTF-8?q?[=E9=9B=86=E7=BE=A4]=20=E4=BF=AE=E5=A4=8DBUG?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../redisMsg/control/RedisRpcPlatformController.java | 9 +++++---- .../service/redisMsg/service/RedisRpcServiceImpl.java | 8 +++++--- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/genersoft/iot/vmp/service/redisMsg/control/RedisRpcPlatformController.java b/src/main/java/com/genersoft/iot/vmp/service/redisMsg/control/RedisRpcPlatformController.java index 82b1b017..fbb7be5e 100644 --- a/src/main/java/com/genersoft/iot/vmp/service/redisMsg/control/RedisRpcPlatformController.java +++ b/src/main/java/com/genersoft/iot/vmp/service/redisMsg/control/RedisRpcPlatformController.java @@ -6,6 +6,7 @@ import com.genersoft.iot.vmp.conf.redis.RedisRpcConfig; import com.genersoft.iot.vmp.conf.redis.bean.RedisRpcMessage; import com.genersoft.iot.vmp.conf.redis.bean.RedisRpcRequest; import com.genersoft.iot.vmp.conf.redis.bean.RedisRpcResponse; +import com.genersoft.iot.vmp.gb28181.bean.CommonGBChannel; import com.genersoft.iot.vmp.gb28181.bean.Platform; import com.genersoft.iot.vmp.gb28181.event.EventPublisher; import com.genersoft.iot.vmp.gb28181.event.subscribe.catalog.CatalogEvent; @@ -67,11 +68,11 @@ public class RedisRpcPlatformController extends RpcController { */ @RedisRpcMapping("catalogEventPublish") public RedisRpcResponse catalogEventPublish(RedisRpcRequest request) { - CatalogEvent event = JSONObject.parseObject(request.getParam().toString(), CatalogEvent.class); + JSONObject jsonObject = JSONObject.parseObject(request.getParam().toString()); CatalogEvent catalogEvent = new CatalogEvent(this); - catalogEvent.setPlatform(event.getPlatform()); - catalogEvent.setChannels(event.getChannels()); - catalogEvent.setType(event.getType()); + catalogEvent.setPlatform(jsonObject.getObject("platform", Platform.class)); + catalogEvent.setChannels(jsonObject.getJSONArray("channels").toJavaList(CommonGBChannel.class)); + catalogEvent.setType(jsonObject.getString("type")); eventPublisher.catalogEventPublish(catalogEvent); RedisRpcResponse response = request.getResponse(); response.setStatusCode(ErrorCode.SUCCESS.getCode()); diff --git a/src/main/java/com/genersoft/iot/vmp/service/redisMsg/service/RedisRpcServiceImpl.java b/src/main/java/com/genersoft/iot/vmp/service/redisMsg/service/RedisRpcServiceImpl.java index 5b22719c..09d3c8c5 100644 --- a/src/main/java/com/genersoft/iot/vmp/service/redisMsg/service/RedisRpcServiceImpl.java +++ b/src/main/java/com/genersoft/iot/vmp/service/redisMsg/service/RedisRpcServiceImpl.java @@ -25,8 +25,6 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.redis.core.RedisTemplate; import org.springframework.stereotype.Service; -import java.util.List; - @Slf4j @Service public class RedisRpcServiceImpl implements IRedisRpcService { @@ -236,7 +234,11 @@ public class RedisRpcServiceImpl implements IRedisRpcService { @Override public void catalogEventPublish(String serverId, CatalogEvent event) { - RedisRpcRequest request = buildRequest("platform/catalogEventPublish", event); + JSONObject jsonObject = new JSONObject(); + jsonObject.put("platform", event.getPlatform()); + jsonObject.put("channels", event.getChannels()); + jsonObject.put("type", event.getType()); + RedisRpcRequest request = buildRequest("platform/catalogEventPublish", jsonObject); if (serverId != null) { request.setToId(serverId); }