Commit e81c77f7 by guojuxing

应用菜单权限优化:根据菜单code获取对应的菜单

parent 9edf0a74
......@@ -74,14 +74,7 @@ public class MenuController {
LOGGER.info("查询登录用户的应用的菜单参数:{}-{}-{}", currentMenu, appId, menuCode);
Integer userId = UserDetailUtils.getUserDetail().getUserId();
Integer enterpriseId = UserDetailUtils.getUserDetail().getEnterpriseId();
if (StringUtils.isBlank(appId)) {
//根据menuCode去查询对应的appId
ServiceResponse<MenuDTO> menuDTOServiceResponse = menuApiService.getMenuByMenuCode(menuCode);
if (menuDTOServiceResponse.isSuccess()) {
MenuDTO tempDTO = menuDTOServiceResponse.getResult();
appId = tempDTO.getProject();
}
}
appId = getAppId(appId, menuCode);
ServiceResponse<List<MenuDTO>> userMenu = this.menuApiService.getUserMenuOfApp(enterpriseId, userId,
currentMenu, appId);
if (userMenu.isSuccess()) {
......@@ -91,8 +84,10 @@ public class MenuController {
}
@RequestMapping("login-collaborator-menu-of-app")
public RestResponse getCollaboratorMenu(String appId) {
public RestResponse getCollaboratorMenu(String appId, String menuCode) {
LOGGER.info("查询登录用户的协作应用的菜单参数:{}-{}", appId, menuCode);
UserDetail userDetail = UserDetailUtils.getUserDetail();
appId = getAppId(appId, menuCode);
ServiceResponse<List<MenuDTO>> userMenu = this.collaboratorApiService.getCollaboratorMenuPage(
userDetail.getEnterpriseId(), userDetail.getUserInfo().getPhoneNumber(), appId);
if (userMenu.isSuccess()) {
......@@ -102,8 +97,10 @@ public class MenuController {
}
@RequestMapping("login-collaborator-operation-item")
public RestResponse getCollaboratorOperationItem(String appId) {
public RestResponse getCollaboratorOperationItem(String appId, String menuCode) {
LOGGER.info("查询登录用户的协作应用的操作项参数:{}-{}", appId, menuCode);
UserDetail userDetail = UserDetailUtils.getUserDetail();
appId = getAppId(appId, menuCode);
boolean isSuperAdmin = userDetail.getUserInfo().getSuperAdmin().intValue() == 1;
ServiceResponse<List<MenuDTO>> userMenu = this.collaboratorApiService.getCollaboratorOperationItem(
userDetail.getEnterpriseId(), userDetail.getUserInfo().getPhoneNumber(), appId, isSuperAdmin);
......@@ -134,8 +131,10 @@ public class MenuController {
* @return com.gic.commons.webapi.reponse.RestResponse


*/
@RequestMapping("login-user-operation-item-of-app")
public RestResponse loginUserOperationItemOfApp(String appId) {
public RestResponse loginUserOperationItemOfApp(String appId, String menuCode) {
LOGGER.info("登陆用户没有权限的操作项列表数据:{}-{}", appId, menuCode);
Integer userId = UserDetailUtils.getUserDetail().getUserId();
appId = getAppId(appId, menuCode);
ServiceResponse<List<MenuDTO>> menuList = this.menuApiService.getNoAuthOperationItemOfApp(userId, "");
List<UserOperationItemAuthVO> resultList = new ArrayList<>();
if (menuList.isSuccess()) {
......@@ -223,4 +222,16 @@ public class MenuController {
return result;
}
private String getAppId(String appId, String menuCode) {
if (StringUtils.isBlank(appId)) {
//根据menuCode去查询对应的appId
ServiceResponse<MenuDTO> menuDTOServiceResponse = menuApiService.getMenuByMenuCode(menuCode);
if (menuDTOServiceResponse.isSuccess()) {
MenuDTO tempDTO = menuDTOServiceResponse.getResult();
appId = tempDTO.getProject();
}
}
return appId;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment