From c3599c76d55b2ffcd98d6c2a78307535a11a15e9 Mon Sep 17 00:00:00 2001 From: bayuzhen Date: Wed, 6 Nov 2024 16:18:47 +0800 Subject: [PATCH] =?UTF-8?q?add=20=E6=A0=B9=E6=8D=AE=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E4=B8=AD=E5=BF=83=E6=9F=A5=E8=AF=A2=E8=99=9A=E6=8B=9F=E6=9C=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../bocloud/cmp/service/impl/CloudServerServiceImpl.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) 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;