Authored by qinchao

主机管理

@@ -277,6 +277,44 @@ public class MObjectInfoCtrl { @@ -277,6 +277,44 @@ public class MObjectInfoCtrl {
277 return modelList; 277 return modelList;
278 } 278 }
279 279
  280 + @RequestMapping(value = "/asyMobjectHost")
  281 + public BaseResponse asyMobjectHost(int moTypeId) {
  282 + TypeInfo typeInfo=typeInfoService.queryTypeInfo(moTypeId);
  283 + if(typeInfo!=null&&StringUtils.isNotBlank(typeInfo.getTags())){
  284 + MObjectInfoReq mObjectInfoReq = new MObjectInfoReq();
  285 + mObjectInfoReq.setTypeIds(""+typeInfo.getTypeId());
  286 + mObjectInfoReq.setMoTags(typeInfo.getDescr());
  287 + //根据typeinfo的主机标签查询出主机
  288 + List<String> hostTagsList=new ArrayList<String>();
  289 + List<Integer> cloudTagsList=new ArrayList<Integer>();
  290 + if(StringUtils.isNotBlank(typeInfo.getCloudTags())){
  291 + for(String cloudTag:typeInfo.getCloudTags().split(",")){
  292 + if("1".equalsIgnoreCase(cloudTag)){
  293 + cloudTagsList.add(1);
  294 + }else if("2".equalsIgnoreCase(cloudTag)){
  295 + cloudTagsList.add(2);
  296 + }else if("3".equalsIgnoreCase(cloudTag)){
  297 + cloudTagsList.add(3);
  298 + }else if("0".equalsIgnoreCase(cloudTag)){
  299 + cloudTagsList=new ArrayList<Integer>(); //全部云
  300 + break;
  301 + }
  302 + }
  303 + }
  304 + for(String hostTag:typeInfo.getTags().split(",")){
  305 + if(StringUtils.isNotBlank(hostTag)){
  306 + hostTagsList.add(hostTag);
  307 + }
  308 + }
  309 + if(hostTagsList.size()>0){
  310 + //List<HostInfo> newhostInfos =hostInfoMapper.selectHostInfosByTagListAndCloudTypeList(hostTagsList,cloudTagsList);
  311 +
  312 + }
  313 + // mObjectInfoReq.setMoHostIp();
  314 + }
  315 + return null;
  316 + }
  317 +
280 318
281 @RequestMapping(value = "/add", method = RequestMethod.POST) 319 @RequestMapping(value = "/add", method = RequestMethod.POST)
282 public BaseResponse addMObject(@RequestBody MObjectInfoReq request) { 320 public BaseResponse addMObject(@RequestBody MObjectInfoReq request) {
@@ -18,6 +18,8 @@ public class TypeInfo implements Serializable{ @@ -18,6 +18,8 @@ public class TypeInfo implements Serializable{
18 18
19 private int typeParentId; 19 private int typeParentId;
20 20
  21 + private String cloudTags;//云标签
  22 +
21 private String tags;//主机标签 23 private String tags;//主机标签
22 24
23 private String descr;//节点的特殊信息 25 private String descr;//节点的特殊信息