1
|
package com.monitor.cmdb.ctrl;
|
1
|
package com.monitor.cmdb.ctrl;
|
2
|
|
2
|
|
3
|
import com.alibaba.fastjson.JSON;
|
3
|
import com.alibaba.fastjson.JSON;
|
|
|
4
|
+import com.alibaba.fastjson.JSONArray;
|
4
|
import com.fasterxml.jackson.databind.deser.Deserializers;
|
5
|
import com.fasterxml.jackson.databind.deser.Deserializers;
|
5
|
import com.model.HostGroup;
|
6
|
import com.model.HostGroup;
|
6
|
import com.model.HostInfo;
|
7
|
import com.model.HostInfo;
|
|
@@ -18,6 +19,7 @@ import com.monitor.model.request.HostInfoReq; |
|
@@ -18,6 +19,7 @@ import com.monitor.model.request.HostInfoReq; |
18
|
import com.monitor.model.request.MObjectHostInfoReq;
|
19
|
import com.monitor.model.request.MObjectHostInfoReq;
|
19
|
import com.monitor.model.request.MObjectInfoReq;
|
20
|
import com.monitor.model.request.MObjectInfoReq;
|
20
|
import com.monitor.model.response.BaseResponse;
|
21
|
import com.monitor.model.response.BaseResponse;
|
|
|
22
|
+import com.monitor.model.response.DependencyRep;
|
21
|
import com.monitor.mysql.mapper.HostInfoMapper;
|
23
|
import com.monitor.mysql.mapper.HostInfoMapper;
|
22
|
import org.apache.commons.lang.StringUtils;
|
24
|
import org.apache.commons.lang.StringUtils;
|
23
|
import org.slf4j.Logger;
|
25
|
import org.slf4j.Logger;
|
|
@@ -575,9 +577,27 @@ public class MObjectInfoCtrl { |
|
@@ -575,9 +577,27 @@ public class MObjectInfoCtrl { |
575
|
*/
|
577
|
*/
|
576
|
@RequestMapping(value = "/queryDependency")
|
578
|
@RequestMapping(value = "/queryDependency")
|
577
|
public BaseResponse queryDependency(@RequestBody DependencyRequest request) {
|
579
|
public BaseResponse queryDependency(@RequestBody DependencyRequest request) {
|
578
|
- BaseResponse response = new BaseResponse();
|
580
|
+ DependencyRep rep=mobjectService.queryDependency(request.getSelectGroup());
|
|
|
581
|
+ List<Map<String,String>> selectGroupsMapList=new ArrayList<>();
|
|
|
582
|
+ for(String str:rep.getSelectGroups()){
|
|
|
583
|
+ Map<String,String> tmp=new HashMap<>();
|
|
|
584
|
+ tmp.put("id",str);
|
|
|
585
|
+ tmp.put("text",str);
|
|
|
586
|
+ selectGroupsMapList.add(tmp);
|
|
|
587
|
+ }
|
|
|
588
|
+ rep.setSelectGroupsJsonArray(JSONArray.parseArray(JSON.toJSONString(selectGroupsMapList)));
|
|
|
589
|
+
|
|
|
590
|
+ List<Map<String,String>> selectDependenciesMapList=new ArrayList<>();
|
|
|
591
|
+ for(String str:rep.getSelectDependencies()){
|
|
|
592
|
+ Map<String,String> tmp=new HashMap<>();
|
|
|
593
|
+ tmp.put("id",str);
|
|
|
594
|
+ tmp.put("text",str);
|
|
|
595
|
+ selectDependenciesMapList.add(tmp);
|
|
|
596
|
+ }
|
|
|
597
|
+ rep.setSelectDependenciesJsonArray(JSONArray.parseArray(JSON.toJSONString(selectDependenciesMapList)));
|
579
|
|
598
|
|
580
|
- response.setData(mobjectService.queryDependency(request.getSelectGroup()));
|
599
|
+ BaseResponse response = new BaseResponse();
|
|
|
600
|
+ response.setData(rep);
|
581
|
|
601
|
|
582
|
return response;
|
602
|
return response;
|
583
|
}
|
603
|
}
|