/**
*
* @param rootList 根结点
* @param listAll 所有结点
* @param parentId 父子组织关系依赖属性
* @return 返回树形字符串
*/
public String getTree(List> rootList, List> listAll, String parentId) {
JSONArray jsonRootList = JSONArray.fromObject(rootList);
JSONArray jsonListAll = JSONArray.fromObject(listAll);
// 初始化根节点的等级
for (int i = 0; i < jsonRootList.size(); i++) {
jsonRootList.getJSONObject(i).put("treeLevel", 1);
}
getTreeChildren(jsonRootList, jsonListAll, parentId);
return jsonRootList.toString();
}
/***********
* 递归获取子节点
*
* @param tree
* @param listAll
*/
//@Override
private void getTreeChildren(JSONArray tree, JSONArray listAll,
String parentId) {
fo