feat():增加nacosService业务类

master
86191 2024-08-04 12:00:35 +08:00
parent c3f3de9ea2
commit c472b42c62
2 changed files with 37 additions and 0 deletions

View File

@ -0,0 +1,36 @@
package com.muyu.common.nacos.service;
import com.muyu.common.nacos.remote.NacosServiceRemote;
import com.muyu.common.nacos.remote.req.ServiceListReq;
import com.muyu.common.nacos.remote.resp.ServiceListResp;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
/**
* nacos
*/
public class NacosService {
@Resource
private NacosServiceRemote nacosServiceRemote;
public List<String> nacosServerAllList() {
ArrayList<String> serverList = new ArrayList<>();
ServiceListResp serviceListResp = null;
int pageNo = 0,pageSize = 2;
do {
serviceListResp = nacosServiceRemote.serviceList(
ServiceListReq.builder()
.pageNo(++pageNo)
.pageSize(pageSize)
.build()
);
}while (serviceListResp.getCount() > pageNo * pageSize);
return serverList;
}
}

View File

@ -1 +1,2 @@
com.muyu.common.nacos.remote.interceptor.NacosNamespaceInterceptor com.muyu.common.nacos.remote.interceptor.NacosNamespaceInterceptor
com.muyu.common.nacos.service.NacosService