|
|
|
@ -1,5 +1,6 @@
|
|
|
|
|
package cn.estsh.i3plus.core.apiservice.controller.base;
|
|
|
|
|
|
|
|
|
|
import cn.estsh.i3plus.core.api.iservice.busi.ICoreMemTreeService;
|
|
|
|
|
import cn.estsh.i3plus.core.apiservice.serviceimpl.busi.SysLocaleLanguageService;
|
|
|
|
|
import cn.estsh.i3plus.platform.common.util.PlatformConstWords;
|
|
|
|
|
import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil;
|
|
|
|
@ -13,6 +14,7 @@ import cn.estsh.impp.framework.boot.auth.AuthUtil;
|
|
|
|
|
import cn.estsh.impp.framework.boot.exception.ImppBusiException;
|
|
|
|
|
import cn.estsh.impp.framework.boot.exception.ImppExceptionEnum;
|
|
|
|
|
import cn.estsh.impp.framework.boot.util.ResultBean;
|
|
|
|
|
import cn.estsh.impp.framework.boot.util.ValidatorBean;
|
|
|
|
|
import io.swagger.annotations.Api;
|
|
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
|
|
import org.slf4j.Logger;
|
|
|
|
@ -41,6 +43,9 @@ public class AuthController extends CoreBaseController {
|
|
|
|
|
@Autowired
|
|
|
|
|
private SysLocaleLanguageService localeLanguageService;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private ICoreMemTreeService memTreeService;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 获取登录用户信息
|
|
|
|
|
*
|
|
|
|
@ -149,42 +154,18 @@ public class AuthController extends CoreBaseController {
|
|
|
|
|
@GetMapping(value = "/menu/find-module-list/{parentId}")
|
|
|
|
|
@ApiOperation(value = "获取登录用户功能权限信息", notes = "获取首页权限信息")
|
|
|
|
|
public ResultBean findModuleList(@PathVariable("parentId") String parentId) {
|
|
|
|
|
List<SysMenu> list = new ArrayList<>();
|
|
|
|
|
SysUser user = getSessionUser().getUser();
|
|
|
|
|
|
|
|
|
|
if (user != null) {
|
|
|
|
|
List<SysMenu> menus = user.getMenuList();
|
|
|
|
|
if (menus != null) {
|
|
|
|
|
// 封装模块信息
|
|
|
|
|
for (SysMenu menu : menus) {
|
|
|
|
|
if (menu != null && menu.getMenuType().equals(CommonEnumUtil.METHOD_LEVEL.MODULE.getValue())
|
|
|
|
|
&& parentId.equals(menu.getParentId().toString())) {
|
|
|
|
|
|
|
|
|
|
// 封装 功能信息
|
|
|
|
|
for (SysMenu sysMenu : menus) {
|
|
|
|
|
if (sysMenu != null && sysMenu.getMenuType().equals(CommonEnumUtil.METHOD_LEVEL.METHOD.getValue())
|
|
|
|
|
&& menu.getId().longValue() == sysMenu.getParentId().longValue()) {
|
|
|
|
|
if (!menu.getChildList().contains(sysMenu)) {
|
|
|
|
|
menu.getChildList().add(sysMenu);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
menu.getChildList().sort(Comparator.comparing(SysMenu::getMenuSort).reversed().thenComparing(SysMenu::getMenuCode));
|
|
|
|
|
list.add(menu);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
try {
|
|
|
|
|
ValidatorBean.checkIsNumber(parentId,"父节点不能为空");
|
|
|
|
|
|
|
|
|
|
if (list != null && list.size() > 0) {
|
|
|
|
|
// 内存排序 Sort 降序 code 升序
|
|
|
|
|
list.sort(Comparator.comparing(SysMenu::getMenuSort).reversed().thenComparing(SysMenu::getMenuCode));
|
|
|
|
|
return ResultBean.success("操作成功").setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode()).setResultList(list);
|
|
|
|
|
} else {
|
|
|
|
|
return ResultBean.fail("操作失败").setCode(ResourceEnumUtil.MESSAGE.FAIL.getCode()).setErrorMsg("菜单信息不存在");
|
|
|
|
|
List<SysMenu> result = memTreeService.packTreeSysMenuByUserIdAndParentId(getSessionUser().getUser().getId(), Long.parseLong(parentId));
|
|
|
|
|
return ResultBean.success("操作成功").setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode()).setResultList(result);
|
|
|
|
|
} catch (ImppBusiException busExcep) {
|
|
|
|
|
LOGGER.error(busExcep.getErrorMsg() + ":{}", busExcep.getErrorDetail(), busExcep);
|
|
|
|
|
return ResultBean.fail(busExcep);
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
LOGGER.error(ImppExceptionEnum.SYSTEM_EXCEPTION.getDescription() + ":{}", e.getMessage(), e);
|
|
|
|
|
return ResultBean.fail().setCode(ImppExceptionEnum.SYSTEM_EXCEPTION.getCode());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|