add 根据数据中心查询虚拟机

develop
bayuzhen 2024-11-06 16:18:47 +08:00
parent 28696b3a6d
commit c3599c76d5
1 changed files with 6 additions and 3 deletions

View File

@ -70,6 +70,7 @@ import org.springframework.amqp.core.AmqpTemplate;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.Assert; import org.springframework.util.Assert;
import org.springframework.util.CollectionUtils;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -315,11 +316,13 @@ public class CloudServerServiceImpl implements CloudServerService {
paramMap.remove("dcId"); paramMap.remove("dcId");
// 查询相应云平台 // 查询相应云平台
List<CloudVendor> cloudVendors = cloudVendorRepository.getByDcId(dcId); List<CloudVendor> cloudVendors = cloudVendorRepository.getByDcId(dcId);
if (!CollectionUtils.isEmpty(cloudVendors)) {
String ids = cloudVendors.stream().map(CloudVendor::getId).map(item -> String.valueOf(item)).collect(Collectors.joining(",")); String ids = cloudVendors.stream().map(CloudVendor::getId).map(item -> String.valueOf(item)).collect(Collectors.joining(","));
paramMap.put("vendorId", ids); paramMap.put("vendorId", ids);
param.setSign(Sign.IN); param.setSign(Sign.IN);
} }
} }
}
int total = 0; int total = 0;
List<CloudServer> list = Lists.newArrayList(); List<CloudServer> list = Lists.newArrayList();
if (context.getCatalog().equals(Catalog.Tenant)) { if (context.getCatalog().equals(Catalog.Tenant)) {