diff --git a/bocloud.cos.service/src/main/java/com/bocloud/cos/service/ResourceScreenServiceImpl.java b/bocloud.cos.service/src/main/java/com/bocloud/cos/service/ResourceScreenServiceImpl.java index 7db4155..016270d 100644 --- a/bocloud.cos.service/src/main/java/com/bocloud/cos/service/ResourceScreenServiceImpl.java +++ b/bocloud.cos.service/src/main/java/com/bocloud/cos/service/ResourceScreenServiceImpl.java @@ -138,7 +138,7 @@ public class ResourceScreenServiceImpl implements ResourceScreenService { cpuTotal += config.getCpuCore() * config.getCpuAmount() * excessRatio; memTotal += config.getMemoryCapacity().longValue() * excessRatio; } else { - cpuTotal += (long) config.getCpuCore() * config.getCpuAmount(); + cpuTotal += (long) config.getCpuCore() * Optional.ofNullable(config.getCpuAmount()).orElse(0); memTotal += config.getMemoryCapacity().longValue(); } diskTotal += config.getDiskCapacity().intValue(); @@ -149,7 +149,7 @@ public class ResourceScreenServiceImpl implements ResourceScreenService { .collect(Collectors.toList()); for (com.bocloud.ims.entity.resource.Server opServer : opServers) { com.bocloud.ims.entity.resource.ServerConfig config = opServer.getConfig(); - cpuTotal += (long) config.getCpuCore() * config.getCpuAmount(); + cpuTotal += (long) config.getCpuCore() * Optional.ofNullable(config.getCpuAmount()).orElse(0); diskTotal += config.getDiskCapacity().intValue(); memTotal += config.getMemoryCapacity().longValue(); }