处理大屏展示资源使用情况问题
parent
4b6bf6bb54
commit
185d1cd9ad
|
@ -150,6 +150,20 @@ public class ServerServiceImpl implements ServerService {
|
||||||
vendorId = Long.valueOf(paramMap.get("vendorId").toString());
|
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);
|
CloudVendor vendor = cloudVendorRepository.listById(vendorId);
|
||||||
if (simple) {
|
if (simple) {
|
||||||
int total = this.serverRepository.count(params, labelContent, vendorType);
|
int total = this.serverRepository.count(params, labelContent, vendorType);
|
||||||
|
@ -158,7 +172,18 @@ public class ServerServiceImpl implements ServerService {
|
||||||
} else {
|
} else {
|
||||||
int total = this.serverRepository.counts(params, labelContent, vendorType, clusterName, vdcName);
|
int total = this.serverRepository.counts(params, labelContent, vendorType, clusterName, vdcName);
|
||||||
List<Server> list = this.serverRepository.list(page, rows, params, sorter, 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;
|
String azUuid, azName, ratioDesc;
|
||||||
Long cpuUsed, cpuHz;
|
Long cpuUsed, cpuHz;
|
||||||
Double memoryCapacity, memUsed;
|
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
|
@Override
|
||||||
|
|
Loading…
Reference in New Issue