Authored by mlge

监控对象 主机信息--支持按照主机ip查找 &&修改原来代码获取table数据的业务逻辑

... ... @@ -170,7 +170,8 @@ public class MObjectInfoCtrl {
String typeIdsStr = request.getTypeIds();
String hostIdsStr = request.getSearchHostIps();
Map<String,Object> paramMap = new HashMap<>();
if(StringUtils.isNotBlank(typeIdsStr) && !StringUtils.equals("0",typeIdsStr)){
if(StringUtils.isNotBlank(typeIdsStr) && !StringUtils.equals("0",typeIdsStr)){//为0表示 首次加载 整颗树
List<String> typeIdList = Arrays.asList(StringUtils.split(typeIdsStr, ","));
paramMap.put("typeIdList", typeIdList);
}
... ... @@ -182,6 +183,7 @@ public class MObjectInfoCtrl {
try{
int totalCount = mobjectService.countByCondition(pageBean);
List<MObjectInfo> moListByType = mobjectService.selectPageByCondition(pageBean);
//在原来方法的基础上修改的----展示监控对象全路径
List<MObjectModel> resultList = buildMObjectModelList(moListByType);
PageResponse pageResponse = new PageResponse();
pageResponse.setCurrentPage(request.getCurrentPage());
... ... @@ -281,7 +283,11 @@ public class MObjectInfoCtrl {
BeanUtils.copyProperties(mObjectInfo, model);
model.setMoTypeName(typeInfoService.queryTypeInfo(mObjectInfo.getMoTypeId()).getTypeName());
//获取当前监控对象 在监控树中的全路径
String fullpath = typeInfoService.getFullPathByTypeId(mObjectInfo.getMoTypeId());
model.setMoTypeName(fullpath);
// model.setMoTypeName(typeInfoService.queryTypeInfo(mObjectInfo.getMoTypeId()).getTypeName());
model.setMoStatus("normal");
... ...
... ... @@ -30,4 +30,5 @@ public interface ITypeInfoService {
//根据路径数据查询配置
TypeInfo getTypeByMobjectPathArray(String[] mobjectPaths_array);
String getFullPathByTypeId(int moTypeId);
}
... ...
... ... @@ -151,6 +151,24 @@ public class TypeInfoServiceImpl implements ITypeInfoService {
return targetTypeInfo;
}
}
@Override
/**
* 根据监控typeId,获取全路径
*/
public String getFullPathByTypeId(int moTypeId) {
TypeInfo typeInfo = queryTypeInfo(moTypeId);
if(typeInfo == null){
return "";
}
if(typeInfo.getTypeParentId() == 0){
return typeInfo.getTypeName();
}else{
Integer parentId = typeInfo.getTypeParentId();
return getFullPathByTypeId(parentId) + "/" + typeInfo.getTypeName() ;
}
}
}
... ...