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

develop
bayuzhen 2024-05-30 16:23:12 +08:00
parent 07329a2e0c
commit 79ca2cfcc2
1 changed files with 12 additions and 8 deletions

View File

@ -87,12 +87,16 @@ public class ResourceScreenServiceImpl implements ResourceScreenService {
List<CloudServer> cloudServers = imsInternalService.listVmsByVendor(null, false, requestContext);
//私有云平台
List<CloudVendor> cloudVendors = imsInternalService.listCloudVendor(null);
Set<String> vendors =
cloudVendors.stream().filter(cloudVendor -> !cloudVendor.getIsPublic())
.map(CloudVendor::getType).collect(Collectors.toSet());
Set<Long> vendorIds =
cloudVendors.stream().filter(cloudVendor -> !cloudVendor.getIsPublic())
.map(CloudVendor::getId).collect(Collectors.toSet());
Set<String> vendors = new HashSet<>();
Set<Long> vendorIds = new HashSet<>();
List<CloudVendor> noPublicVendors = new ArrayList<>();
for (CloudVendor cloudVendor : cloudVendors) {
if (!cloudVendor.getIsPublic()) {
noPublicVendors.add(cloudVendor);
vendors.add(cloudVendor.getType());
vendorIds.add(cloudVendor.getId());
}
}
List<CloudServer> priServers = cloudServers.stream().filter(
cloudServer -> null != cloudServer.getVendorType() && vendors.contains(cloudServer.getVendorType()))
.collect(Collectors.toList());
@ -116,8 +120,8 @@ public class ResourceScreenServiceImpl implements ResourceScreenService {
hosts.removeIf(server -> null == server.getVendorId());
Map<Long, List<com.bocloud.ims.entity.resource.Server>> hostMap = hosts.stream().filter(server -> null != server.getVendorId())
.collect(Collectors.groupingBy(com.bocloud.ims.entity.resource.Server::getVendorId));
List<CloudVendor> vmVendors = imsInternalService.listCloudVendor(VendorType.VMWARE.name());
for (CloudVendor vendor : vmVendors) {
// List<CloudVendor> vmVendors = imsInternalService.listCloudVendor(VendorType.VMWARE.name());
for (CloudVendor vendor : noPublicVendors) {
List<com.bocloud.ims.entity.resource.Server> servers = Optional.ofNullable(hostMap.get(vendor.getId())).orElse(new ArrayList<>());
for (com.bocloud.ims.entity.resource.Server server : servers) {
com.bocloud.ims.entity.resource.ServerConfig config = server.getConfig();