diff --git a/bocloud.ims.service/src/main/java/com/bocloud/ims/service/rpc/ImsRpcServiceImpl.java b/bocloud.ims.service/src/main/java/com/bocloud/ims/service/rpc/ImsRpcServiceImpl.java index cf1c585..1044a8e 100644 --- a/bocloud.ims.service/src/main/java/com/bocloud/ims/service/rpc/ImsRpcServiceImpl.java +++ b/bocloud.ims.service/src/main/java/com/bocloud/ims/service/rpc/ImsRpcServiceImpl.java @@ -2,8 +2,10 @@ package com.bocloud.ims.service.rpc; import com.alibaba.fastjson.JSON; import com.bocloud.entity.bean.GenericEntity; +import com.bocloud.ims.entity.resource.CloudVendor; import com.bocloud.ims.entity.resource.Ip; import com.bocloud.ims.entity.resource.Server; +import com.bocloud.ims.repository.resource.CloudVendorRepository; import com.bocloud.ims.repository.resource.IpRepository; import com.bocloud.ims.repository.resource.ServerRepository; import com.bocloud.rpc.interfaces.ims.ImsRpcService; @@ -16,6 +18,7 @@ import org.springframework.util.Assert; import java.util.ArrayList; import java.util.List; +import java.util.Set; import java.util.concurrent.TimeUnit; @Slf4j @@ -28,6 +31,8 @@ public class ImsRpcServiceImpl implements ImsRpcService { IpRepository ipRepository; @Autowired private ServerRepository serverRepository; + @Autowired + private CloudVendorRepository cloudVendorRepositoryl; @Override public void preemptOrFreeIp(List ipsToPreempt, List ipsToFree) { @@ -66,4 +71,16 @@ public class ImsRpcServiceImpl implements ImsRpcService { .col(Server::getVendorId).eq(vendorId) .col(GenericEntity::getDeleted).eq(false).list(); } + + @Override + public List getServerAll(Set vendorIds) throws Exception { + // 获取云平台 + List vendorList = cloudVendorRepositoryl.queryProxy().col(GenericEntity::getDeleted).eq(0).list(); + List servers = new ArrayList<>(); + for (CloudVendor cloudVendor : vendorList) { + List list = this.serverRepository.list(1, 100000, null, null, null, cloudVendor.getType(), null, null); + servers.addAll(list); + } + return servers; + } }