Commit 2014fa72 authored by tianyiming's avatar tianyiming

将管辖机构树中children为[]的修改为null

parent e2e2542c
......@@ -223,12 +223,35 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
FeignClientResult tree = privilegeFeginService.tree();
List<LinkedHashMap> result = (List<LinkedHashMap>) tree.getResult();
List<LinkedHashMap> treeData = deleteRegulatorTreeData(result);
List<LinkedHashMap> resultTree = treeData.stream().filter(e -> code.equals(e.get("orgCode"))).collect(Collectors.toList());
List<LinkedHashMap> supervisionTree = treeData.stream().filter(e -> code.equals(e.get("orgCode"))).collect(Collectors.toList());
List<LinkedHashMap> resultTree = updateNullChildren(supervisionTree);
redisUtils.set(REGULATOR_UNIT_TREE, resultTree);
return resultTree;
}
/**
* 将管辖机构树中children为[]的修改为null
* @param result
* @return
*/
private List<LinkedHashMap> updateNullChildren(List<LinkedHashMap> result) {
Iterator it = result.iterator();
while (it.hasNext()) {
LinkedHashMap e = (LinkedHashMap) it.next();
//将管辖机构树中children为[]的修改为null
if(e.get("children") != null){
if(((List<LinkedHashMap>) e.get("children")).size() == 0){
e.put("children",null);
}
}
if (!ObjectUtils.isEmpty(e.get("children"))) {
updateNullChildren((List<LinkedHashMap>) e.get("children"));
}
}
return result;
}
/**
* 删除管辖机构树中level为使用单位的数据
*
* @param result 管辖机构树
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment