浏览代码

是否是区域或者超管

tags/24080901
PoffyZhang 1年前
父节点
当前提交
128940be9c
共有 4 个文件被更改,包括 21 次插入10 次删除
  1. +1
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/common/helper/UserInfoHelper.java
  2. +14
    -8
      pmapi/src/main/java/com/ningdatech/pmapi/common/helper/impl/UserInfoHelperImpl.java
  3. +4
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/user/model/vo/UserRoleVO.java
  4. +2
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/workbench/manage/WorkbenchManage.java

+ 1
- 1
pmapi/src/main/java/com/ningdatech/pmapi/common/helper/UserInfoHelper.java 查看文件

@@ -28,5 +28,5 @@ public interface UserInfoHelper {
* 判断该用户是否是区管或者超管
* @return
*/
boolean isAdmin(Long userId);
boolean isSuperOrRegionAdmin(Long userId);
}

+ 14
- 8
pmapi/src/main/java/com/ningdatech/pmapi/common/helper/impl/UserInfoHelperImpl.java 查看文件

@@ -1,6 +1,9 @@
package com.ningdatech.pmapi.common.helper.impl;

import cn.hutool.core.collection.CollUtil;
import com.ningdatech.pmapi.common.helper.UserInfoHelper;
import com.ningdatech.pmapi.sys.model.entity.Role;
import com.ningdatech.pmapi.user.entity.enumeration.RoleEnum;
import com.ningdatech.pmapi.user.manage.UserAuthLoginManage;
import com.ningdatech.pmapi.user.security.auth.model.UserFullInfoDTO;
import lombok.RequiredArgsConstructor;
@@ -38,14 +41,17 @@ public class UserInfoHelperImpl implements UserInfoHelper {
return realName;
}

/**
* 判断此人是否是超管或者区管
* @param userId
* @return
*/
@Override
public boolean isAdmin(Long userId) {
//测试 先返回true
return Boolean.TRUE;
public boolean isSuperOrRegionAdmin(Long userId) {
UserFullInfoDTO userFullInfo = userAuthLoginManage.getUserFullInfo(userId);
if(CollUtil.isNotEmpty(userFullInfo.getUserRoleList())){
for(Role role : userFullInfo.getUserRoleList()){
if(RoleEnum.SUPER_ADMIN.equals(role.getCode()) ||
RoleEnum.REGION_ADMIN.equals(role.getCode()) ){
return Boolean.TRUE;
}
}
}
return Boolean.FALSE;
}
}

+ 4
- 0
pmapi/src/main/java/com/ningdatech/pmapi/user/model/vo/UserRoleVO.java 查看文件

@@ -1,5 +1,6 @@
package com.ningdatech.pmapi.user.model.vo;

import com.ningdatech.pmapi.user.entity.enumeration.RoleEnum;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@@ -18,4 +19,7 @@ public class UserRoleVO {

@ApiModelProperty(value = "名称")
private String name;

@ApiModelProperty(value = "角色code")
private RoleEnum code;
}

+ 2
- 1
pmapi/src/main/java/com/ningdatech/pmapi/workbench/manage/WorkbenchManage.java 查看文件

@@ -17,6 +17,7 @@ import com.ningdatech.pmapi.todocenter.model.req.ToBeProcessedReq;
import com.ningdatech.pmapi.todocenter.model.vo.ResToBeProcessedVO;
import com.ningdatech.pmapi.todocenter.model.vo.TodoCenterStatisticsVO;
import com.ningdatech.pmapi.todocenter.model.vo.TodoVO;
import com.ningdatech.pmapi.user.security.auth.model.UserFullInfoDTO;
import com.ningdatech.pmapi.user.security.auth.model.UserInfoDetails;
import com.ningdatech.pmapi.user.util.LoginUserUtil;
import com.ningdatech.pmapi.workbench.converter.WorkbenchConverter;
@@ -61,7 +62,7 @@ public class WorkbenchManage {

//2.项目统计数据
res.setOrgDeclared(WorkbenchConverter.convert(defaultDeclaredProjectManage.declaredProjectOrgStatistics(year)));
if(userInfoHelper.isAdmin(userInfo.getUserId())){
if(userInfoHelper.isSuperOrRegionAdmin(userInfo.getUserId())){
res.setRegionDeclared(WorkbenchConverter.convert(defaultDeclaredProjectManage.declaredProjectRegionStatistics(year)));
}
ProjectListReq projectListReq = new ProjectListReq();


正在加载...
取消
保存