Commit 9482ace1 by huangjy

Merge remote-tracking branch 'origin/dev' into dev

parents acbe9508 6794a8c9
...@@ -24,4 +24,6 @@ public class HeaderConst { ...@@ -24,4 +24,6 @@ public class HeaderConst {
public static final String FEIGN_NO_REMOVE="feignNoRemove"; public static final String FEIGN_NO_REMOVE="feignNoRemove";
public static final String DATA_SCOPE = "data-scope"; public static final String DATA_SCOPE = "data-scope";
public static final String ROLE_ID = "role-id";
} }
...@@ -24,7 +24,10 @@ import java.util.Set; ...@@ -24,7 +24,10 @@ import java.util.Set;
public class PlatAuthorizationInterceptor implements HandlerInterceptor { public class PlatAuthorizationInterceptor implements HandlerInterceptor {
@Override @Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
//todo 按钮权限关闭
if(true){
return true;
}
Action annotation; Action annotation;
if (handler instanceof HandlerMethod) { if (handler instanceof HandlerMethod) {
......
...@@ -72,6 +72,11 @@ public class PlatUserLoginVO implements Serializable { ...@@ -72,6 +72,11 @@ public class PlatUserLoginVO implements Serializable {
private boolean initFlag = false; private boolean initFlag = false;
/**
* 当前账号选择的右上角角色
*/
private String currentRoleId;
public void init(){ public void init(){
if(initFlag){ if(initFlag){
......
...@@ -30,6 +30,7 @@ import com.makeit.entity.saas.PlatTenant; ...@@ -30,6 +30,7 @@ import com.makeit.entity.saas.PlatTenant;
import com.makeit.entity.saas.PlatTenantMenu; import com.makeit.entity.saas.PlatTenantMenu;
import com.makeit.enums.CodeMessageEnum; import com.makeit.enums.CodeMessageEnum;
import com.makeit.enums.CommonEnum; import com.makeit.enums.CommonEnum;
import com.makeit.enums.HeaderConst;
import com.makeit.enums.IsTenantAccountEnum; import com.makeit.enums.IsTenantAccountEnum;
import com.makeit.enums.biz.auth.SysEnum; import com.makeit.enums.biz.auth.SysEnum;
import com.makeit.enums.id.TreeConst; import com.makeit.enums.id.TreeConst;
...@@ -61,6 +62,7 @@ import com.makeit.utils.data.convert.StreamUtil; ...@@ -61,6 +62,7 @@ import com.makeit.utils.data.convert.StreamUtil;
import com.makeit.utils.data.excel.ExcelUtil; import com.makeit.utils.data.excel.ExcelUtil;
import com.makeit.utils.data.excel.ExcelValidatorUtil; import com.makeit.utils.data.excel.ExcelValidatorUtil;
import com.makeit.utils.data.id.IdGen; import com.makeit.utils.data.id.IdGen;
import com.makeit.utils.request.RequestUtil;
import com.makeit.utils.sql.groupby.DynamicQuery; import com.makeit.utils.sql.groupby.DynamicQuery;
import com.makeit.utils.sql.groupby.SqlUtil; import com.makeit.utils.sql.groupby.SqlUtil;
import com.makeit.utils.sql.join.JoinUtil; import com.makeit.utils.sql.join.JoinUtil;
...@@ -537,9 +539,15 @@ public class PlatUserServiceImpl extends ServiceImpl<PlatUserMapper, PlatUser> ...@@ -537,9 +539,15 @@ public class PlatUserServiceImpl extends ServiceImpl<PlatUserMapper, PlatUser>
private List<PlatMenu> getMenuListByUserId(PlatUserLoginVO userLoginVO) { private List<PlatMenu> getMenuListByUserId(PlatUserLoginVO userLoginVO) {
String currentRoleId = userLoginVO.getCurrentRoleId();
List<String> roleIdList = new ArrayList<>();
if(StringUtils.isBlank(currentRoleId)) {
List<PlatRole> roleList = getRoleList(userLoginVO.getId());
roleIdList = StreamUtil.map(roleList, PlatRole::getId);
}else {
roleIdList.add(currentRoleId);
}
List<PlatRole> roleList = getRoleList(userLoginVO.getId());
List<String> roleIdList = StreamUtil.map(roleList, PlatRole::getId);
roleIdList.add(-1 + ""); roleIdList.add(-1 + "");
List<PlatRoleMenu> roleMenuList = platRoleMenuService.list(new QueryWrapper<PlatRoleMenu>().lambda() List<PlatRoleMenu> roleMenuList = platRoleMenuService.list(new QueryWrapper<PlatRoleMenu>().lambda()
...@@ -554,7 +562,7 @@ public class PlatUserServiceImpl extends ServiceImpl<PlatUserMapper, PlatUser> ...@@ -554,7 +562,7 @@ public class PlatUserServiceImpl extends ServiceImpl<PlatUserMapper, PlatUser>
.orderByAsc(PlatMenu::getCreateDate) .orderByAsc(PlatMenu::getCreateDate)
); );
userLoginVO.setRoleList(BeanDtoVoUtils.listVo(roleList, PlatRoleDTOVO.class)); //userLoginVO.setRoleList(BeanDtoVoUtils.listVo(roleList, PlatRoleDTOVO.class));
if (StringUtils.isNotBlank(userLoginVO.getTenantId())) { if (StringUtils.isNotBlank(userLoginVO.getTenantId())) {
Set<String> menuIdSet = StreamUtil.mapToSet(getMenuListByTenantId(userLoginVO.getTenantId()), PlatMenu::getId); Set<String> menuIdSet = StreamUtil.mapToSet(getMenuListByTenantId(userLoginVO.getTenantId()), PlatMenu::getId);
...@@ -589,6 +597,7 @@ public class PlatUserServiceImpl extends ServiceImpl<PlatUserMapper, PlatUser> ...@@ -589,6 +597,7 @@ public class PlatUserServiceImpl extends ServiceImpl<PlatUserMapper, PlatUser>
return userLoginVO; return userLoginVO;
} }
userLoginVO.setCurrentRoleId(RequestUtil.getHeader(HeaderConst.ROLE_ID));
List<PlatMenu> menuList = getMenuListByUserId(userLoginVO); List<PlatMenu> menuList = getMenuListByUserId(userLoginVO);
fillMenuList(menuList, userLoginVO); fillMenuList(menuList, userLoginVO);
......
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 sign in to comment