use of com.topcom.cms.yuqing.domain.OrganizationalStructure in project topcom-cloud by 545314690.
the class OrganizationalStructureController method getFullTree.
@ResponseBody
@RequestMapping(value = { "/getFullTree.json" }, method = { RequestMethod.GET }, produces = { "application/json" })
public List<OrganizationalStructure> getFullTree(HttpServletRequest request, HttpServletResponse response, @RequestParam(value = "id", required = false) Long id) {
List<OrganizationalStructure> result = null;
if (id == null) {
result = this.treeManager.getRoot();
} else {
BaseTreeEntityModel node = (BaseTreeEntityModel) this.treeManager.findById(id);
result = node.getChildren();
}
for (int i = 0; i < result.size(); i++) {
result.set(i, handleOne(result.get(i)));
}
return result;
}
use of com.topcom.cms.yuqing.domain.OrganizationalStructure in project topcom-cloud by 545314690.
the class OrganizationalStructureController method handleOne.
private OrganizationalStructure handleOne(OrganizationalStructure OS) {
List<OrganizationalStructure> organizationList = OS.getChildren();
if (organizationList != null && organizationList.size() > 0) {
for (int i = 0; i < organizationList.size(); i++) {
organizationList.set(i, handleOne(organizationList.get(i)));
}
} else {
if (OS.isLeaf()) {
Long id = OS.getId();
List<Staff> byOrganizationalStructureId = staffManager.findByOrganizationalStructureId(id);
List<OrganizationalStructure> childList = new ArrayList<>();
for (Staff s : byOrganizationalStructureId) {
childList.add(new OrganizationalStructure(s.getPosition() + ":" + s.getName(), s.getId()));
}
OS.setChildren(childList);
}
}
return OS;
}
Aggregations