增加nacosServer业务
parent
ea00b377ba
commit
ad3f87857b
|
@ -1,9 +1,6 @@
|
|||
package com.bwie.nacos.remote.req;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.*;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
/**
|
||||
|
@ -27,7 +24,8 @@ public class ServiceListReq extends BaseReq{
|
|||
/**
|
||||
* 分页大小
|
||||
*/
|
||||
private int pageSize=10;
|
||||
@Builder.Default
|
||||
private int pageSize=2;
|
||||
|
||||
/**
|
||||
* 分组名
|
||||
|
|
|
@ -1,5 +1,13 @@
|
|||
package com.bwie.nacos.remote.service;
|
||||
|
||||
import com.bwie.nacos.remote.NacosServiceRemote;
|
||||
import com.bwie.nacos.remote.req.ServiceListReq;
|
||||
import com.bwie.nacos.remote.resp.ServiceListResp;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author:zhangzhihao
|
||||
* @name:NacosServeService
|
||||
|
@ -7,4 +15,29 @@ package com.bwie.nacos.remote.service;
|
|||
* 不准抄代码,添加注释,清楚每一行代码意思
|
||||
*/
|
||||
public class NacosServeService {
|
||||
|
||||
@Resource
|
||||
private NacosServiceRemote nacosServiceRemote;
|
||||
|
||||
public List<String> nacosServerAllList(){
|
||||
|
||||
List<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.bwie.nacos.remote.interceptor.NacosNamespaceInterceptor
|
||||
com.bwie.nacos.remote.service.NacosServeService
|
||||
|
|
Loading…
Reference in New Issue