From ddaaf09f85e7c0aa7f0eb6441ab81ed8b289628c Mon Sep 17 00:00:00 2001
From: lwj <3529558005@qq.com>
Date: Thu, 8 Aug 2024 20:00:02 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dnacos=E8=AF=B7=E6=B1=82?=
=?UTF-8?q?=E5=8F=82=E6=95=B0=E9=97=AE=E9=A2=98?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
pom.xml | 2 ++
src/main/java/com/muyu/common/nacos/NacosRemoteConfig.java | 1 +
.../java/com/muyu/common/nacos/remote/NacosServiceReomte.java | 3 ++-
.../nacos/remote/interceptor/NacosNamespaceInterceptor.java | 2 +-
.../java/com/muyu/common/nacos/service/NacosServerService.java | 1 +
5 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/pom.xml b/pom.xml
index 3399338..76d9468 100644
--- a/pom.xml
+++ b/pom.xml
@@ -27,6 +27,8 @@
cloud-common-core
+
+
diff --git a/src/main/java/com/muyu/common/nacos/NacosRemoteConfig.java b/src/main/java/com/muyu/common/nacos/NacosRemoteConfig.java
index f24d3b3..5350f83 100644
--- a/src/main/java/com/muyu/common/nacos/NacosRemoteConfig.java
+++ b/src/main/java/com/muyu/common/nacos/NacosRemoteConfig.java
@@ -12,5 +12,6 @@ import org.springframework.context.annotation.Import;
NacosNamespaceInterceptor.class,
NacosServerService.class
})
+
public class NacosRemoteConfig {
}
diff --git a/src/main/java/com/muyu/common/nacos/remote/NacosServiceReomte.java b/src/main/java/com/muyu/common/nacos/remote/NacosServiceReomte.java
index eda46c4..6d52c39 100644
--- a/src/main/java/com/muyu/common/nacos/remote/NacosServiceReomte.java
+++ b/src/main/java/com/muyu/common/nacos/remote/NacosServiceReomte.java
@@ -4,6 +4,7 @@ package com.muyu.common.nacos.remote;
import com.dtflys.forest.annotation.BaseRequest;
import com.dtflys.forest.annotation.Body;
import com.dtflys.forest.annotation.GetRequest;
+import com.dtflys.forest.annotation.Query;
import com.muyu.common.core.constant.Constants;
import com.muyu.common.nacos.remote.interceptor.NacosNamespaceInterceptor;
import com.muyu.common.nacos.remote.req.ServiceListReq;
@@ -20,5 +21,5 @@ public interface NacosServiceReomte {
)
- public ServiceListResp serviceList(@Body ServiceListReq serviceListReq);
+ public ServiceListResp serviceList(@Query ServiceListReq serviceListReq);
}
diff --git a/src/main/java/com/muyu/common/nacos/remote/interceptor/NacosNamespaceInterceptor.java b/src/main/java/com/muyu/common/nacos/remote/interceptor/NacosNamespaceInterceptor.java
index a03fae4..963841c 100644
--- a/src/main/java/com/muyu/common/nacos/remote/interceptor/NacosNamespaceInterceptor.java
+++ b/src/main/java/com/muyu/common/nacos/remote/interceptor/NacosNamespaceInterceptor.java
@@ -23,7 +23,7 @@ public class NacosNamespaceInterceptor implements Interceptor {
public boolean beforeExecute(ForestRequest req) {
if(StringUtils.isNotEmpty(namespaceId)){
// 执行在发送请求之前处理的代码
- Object reqNamespaceId = req.getQuery("namespaceId");
+ Object reqNamespaceId =Convert.utf8Str( req.getQuery("namespaceId"));
if(reqNamespaceId==null){
log.warn("本次请求nacos的namespaceId未携带,已添加[{}]",namespaceId);
req.addQuery("namespaceId", namespaceId); // 添加URL的Query参数
diff --git a/src/main/java/com/muyu/common/nacos/service/NacosServerService.java b/src/main/java/com/muyu/common/nacos/service/NacosServerService.java
index ae7635a..7eabaf5 100644
--- a/src/main/java/com/muyu/common/nacos/service/NacosServerService.java
+++ b/src/main/java/com/muyu/common/nacos/service/NacosServerService.java
@@ -25,6 +25,7 @@ public class NacosServerService {
.build()
);
serverList.addAll(serviceListResp.getDoms());
+
}while (serviceListResp.getCount() > pageNo*pageSize);
return serverList;