feat():增加nacosService业务类
parent
c3f3de9ea2
commit
c472b42c62
|
@ -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;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -1 +1,2 @@
|
||||||
com.muyu.common.nacos.remote.interceptor.NacosNamespaceInterceptor
|
com.muyu.common.nacos.remote.interceptor.NacosNamespaceInterceptor
|
||||||
|
com.muyu.common.nacos.service.NacosService
|
||||||
|
|
Loading…
Reference in New Issue