@RequestMapping(value="/index/{userId}", produces="application/json")
@ResponseBody
public List<Statistical> index(@PathVariable String userId){
TbUser user = null;
try {
user = this.utilService.getObjectById(TbUser.class,Long.parseLong(userId));
TbSysFun fun = this.systemService.getFunByName("统计分析");
List allList = this.systemService.getFunByUser(user);
return this.getSysFunList(fun, allList,userId);
} catch (Exception e) {
e.printStackTrace();
LOG.info("IndexController:left()异常:"+e.getMessage());
}
return null;
}
private List<Statistical> getSysFunList(TbSysFun fun,List<TbSysFun> allList,String userId) throws Exception{
List<Statistical> resultList = null;
List<TbSysFun> childList = this.systemService.findChildFuns(fun, allList);
if(childList != null && childList.size()>0){
resultList = new ArrayList<Statistical>();
Statistical statistical = null;
for(TbSysFun sysFun : childList){
statistical = new Statistical();
statistical.setName(sysFun.getFunName());
statistical.setUrl(sysFun.getFunUrl());
statistical.setItem(getSysFunList(sysFun, allList,userId));
this.setRealUrl(statistical, userId);
resultList.add(statistical);
}
}
return resultList;
}
@ResponseBody
public List<Statistical> index(@PathVariable String userId){
TbUser user = null;
try {
user = this.utilService.getObjectById(TbUser.class,Long.parseLong(userId));
TbSysFun fun = this.systemService.getFunByName("统计分析");
List allList = this.systemService.getFunByUser(user);
return this.getSysFunList(fun, allList,userId);
} catch (Exception e) {
e.printStackTrace();
LOG.info("IndexController:left()异常:"+e.getMessage());
}
return null;
}
private List<Statistical> getSysFunList(TbSysFun fun,List<TbSysFun> allList,String userId) throws Exception{
List<Statistical> resultList = null;
List<TbSysFun> childList = this.systemService.findChildFuns(fun, allList);
if(childList != null && childList.size()>0){
resultList = new ArrayList<Statistical>();
Statistical statistical = null;
for(TbSysFun sysFun : childList){
statistical = new Statistical();
statistical.setName(sysFun.getFunName());
statistical.setUrl(sysFun.getFunUrl());
statistical.setItem(getSysFunList(sysFun, allList,userId));
this.setRealUrl(statistical, userId);
resultList.add(statistical);
}
}
return resultList;
}