fix():修复forest请求naocsApi接口因为路径参数的问题

master
WeiRan 2024-08-09 14:21:35 +08:00
parent d2e48b9f06
commit 477a191ac8
1 changed files with 6 additions and 1 deletions

View File

@ -1,8 +1,10 @@
package com.muyu.common.nacos.service;
import com.alibaba.fastjson2.JSONObject;
import com.muyu.common.nacos.remote.NacosServiceRemote;
import com.muyu.common.nacos.remote.req.ServiceListReq;
import com.muyu.common.nacos.remote.resp.ServiceListResp;
import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.ArrayList;
@ -15,6 +17,7 @@ import java.util.List;
* @nameNacosServerService
* @Date2024/8/8 22:02
*/
@Log4j2
public class NacosServerService {
@Autowired
NacosServiceRemote nacosServiceRemote;
@ -25,7 +28,7 @@ public class NacosServerService {
public List<String> nacosServerAllList(){
List<String>serverList = new ArrayList<>();
ServiceListResp serviceListResp=null;
int pageNo=1,pageSize=2;
int pageNo=0,pageSize=2;
do {
serviceListResp = nacosServiceRemote.serviceList(
ServiceListReq.builder()
@ -34,7 +37,9 @@ public class NacosServerService {
.build()
);
serverList.addAll(serviceListResp.getDoms());
log.info("添加serverList数据为[ {} ] ", JSONObject.toJSONString(serviceListResp.getDoms()));
}while (serviceListResp.getCount() > pageNo * pageSize);
log.info("获取数据为:{}", JSONObject.toJSONString(serverList));
return serverList;
}
}