@RequestMapping("/zhiwei")
@ResponseBody
public Result orgChart(Model model,String orgId){
try {
//查询最高级别的职务
List<OrganizationStructure> dutys = orgService.getStructureDutysForParentIsNull(orgId);
List<OrganizationStructure> dutyLists=new ArrayList<OrganizationStructure>();
return Result.success( getChild(dutys,dutyLists));
} catch (Exception e) {
e.printStackTrace();
return Result.failed(e.getMessage());
}
}
public List<OrganizationStructure> getChild(List<OrganizationStructure> dutys,List<OrganizationStructure> dutyLists){
if (CollectionUtils.isEmpty(dutys)) {
}else{
for (OrganizationStructure orgStructure : dutys){
String imgPathProfix = ConstantUtil.OSS_FILE_PATH;
String defaultImgPath = "";
String imgPath= attachmentDetaillService.getByResourceId(orgStructure.getUserId()).getAttachURL();
orgStructure.setUserImgUrl(StringUtils.isBlank(imgPath) ? defaultImgPath : imgPathProfix + imgPath);
dutyLists.add(orgStructure);
List<OrganizationStructure> childDutyLists = orgService.getStructureDutysForDutyParentId(orgStructure.getDutyId());
getChild(childDutyLists,dutyLists);
}
}
return dutyLists;
}
网友评论