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

develop
bayuzhen 2024-05-30 15:00:22 +08:00
parent 4b6bf6bb54
commit 185d1cd9ad
1 changed files with 98 additions and 80 deletions

View File

@ -150,6 +150,20 @@ public class ServerServiceImpl implements ServerService {
vendorId = Long.valueOf(paramMap.get("vendorId").toString());
}
}
if (null == vendorId) {
Integer totals = 0;
List<CloudVendor> vendorList = cloudVendorRepository.queryProxy().col(GenericEntity::getDeleted).eq(0).list();
List<Server> servers = new ArrayList<>();
for (CloudVendor cloudVendor : vendorList) {
vendorType = cloudVendor.getType();
int total = this.serverRepository.counts(params, labelContent, vendorType, clusterName, vdcName);
List<Server> list = this.serverRepository.list(page, rows, params, sorter, labelContent, vendorType, clusterName, vdcName);
getServerList(rows, params, cloudVendor, list);
servers.addAll(list);
totals += total;
}
gridBean = GridHelper.getBean(page, rows, totals, servers);
} else {
CloudVendor vendor = cloudVendorRepository.listById(vendorId);
if (simple) {
int total = this.serverRepository.count(params, labelContent, vendorType);
@ -158,7 +172,18 @@ public class ServerServiceImpl implements ServerService {
} else {
int total = this.serverRepository.counts(params, labelContent, vendorType, clusterName, vdcName);
List<Server> list = this.serverRepository.list(page, rows, params, sorter, labelContent, vendorType, clusterName, vdcName);
getServerList(rows, params, vendor, list);
gridBean = GridHelper.getBean(page, rows, total, list);
}
}
return new BocloudResult(true, gridBean, "查询成功");
} catch (Exception e) {
logger.error("Query server list fail:", e);
return new BocloudResult(false, "查询失败");
}
}
private void getServerList(int rows, List<Param> params, CloudVendor vendor, List<Server> list) throws Exception {
String azUuid, azName, ratioDesc;
Long cpuUsed, cpuHz;
Double memoryCapacity, memUsed;
@ -231,13 +256,6 @@ public class ServerServiceImpl implements ServerService {
}
}
}
gridBean = GridHelper.getBean(page, rows, total, list);
}
return new BocloudResult(true, gridBean, "查询成功");
} catch (Exception e) {
logger.error("Query server list fail:", e);
return new BocloudResult(false, "查询失败");
}
}
@Override