处理大屏展示资源使用情况问题

develop
bayuzhen 2024-05-30 15:39:22 +08:00
parent 273988a5f8
commit deef8d99f1
1 changed files with 17 additions and 0 deletions

View File

@ -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<String> ipsToPreempt, List<String> ipsToFree) {
@ -66,4 +71,16 @@ public class ImsRpcServiceImpl implements ImsRpcService {
.col(Server::getVendorId).eq(vendorId)
.col(GenericEntity::getDeleted).eq(false).list();
}
@Override
public List<Server> getServerAll(Set<Long> vendorIds) throws Exception {
// 获取云平台
List<CloudVendor> vendorList = cloudVendorRepositoryl.queryProxy().col(GenericEntity::getDeleted).eq(0).list();
List<Server> servers = new ArrayList<>();
for (CloudVendor cloudVendor : vendorList) {
List<Server> list = this.serverRepository.list(1, 100000, null, null, null, cloudVendor.getType(), null, null);
servers.addAll(list);
}
return servers;
}
}