diff --git a/src/main/java/com/bocloud/cmp/service/impl/CloudServerServiceImpl.java b/src/main/java/com/bocloud/cmp/service/impl/CloudServerServiceImpl.java index 5de2eb9..ae0ff1f 100644 --- a/src/main/java/com/bocloud/cmp/service/impl/CloudServerServiceImpl.java +++ b/src/main/java/com/bocloud/cmp/service/impl/CloudServerServiceImpl.java @@ -70,6 +70,7 @@ import org.springframework.amqp.core.AmqpTemplate; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.util.Assert; +import org.springframework.util.CollectionUtils; import java.util.*; import java.util.stream.Collectors; @@ -315,9 +316,11 @@ public class CloudServerServiceImpl implements CloudServerService { paramMap.remove("dcId"); // 查询相应云平台 List cloudVendors = cloudVendorRepository.getByDcId(dcId); - String ids = cloudVendors.stream().map(CloudVendor::getId).map(item -> String.valueOf(item)).collect(Collectors.joining(",")); - paramMap.put("vendorId", ids); - param.setSign(Sign.IN); + if (!CollectionUtils.isEmpty(cloudVendors)) { + String ids = cloudVendors.stream().map(CloudVendor::getId).map(item -> String.valueOf(item)).collect(Collectors.joining(",")); + paramMap.put("vendorId", ids); + param.setSign(Sign.IN); + } } } int total = 0;