Browse Source

单位管理员

tags/24080901
PoffyZhang 1 year ago
parent
commit
082f3fdde0
8 changed files with 17 additions and 15 deletions
  1. +1
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/common/helper/impl/UserInfoHelperImpl.java
  2. +1
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/datascope/provider/impl/OrdinaryUserDataScopeProviderImpl.java
  3. +1
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/datascope/provider/impl/OrgAdminDataScopeProviderImpl.java
  4. +1
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/datascope/provider/impl/RegionAdminDataScopeProviderImpl.java
  5. +3
    -3
      pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/AnnualPlanLibManage.java
  6. +3
    -3
      pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectLibManage.java
  7. +6
    -4
      pmapi/src/main/java/com/ningdatech/pmapi/user/entity/enumeration/RoleEnum.java
  8. +1
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/model/UserInfoDetails.java

+ 1
- 1
pmapi/src/main/java/com/ningdatech/pmapi/common/helper/impl/UserInfoHelperImpl.java View File

@@ -47,7 +47,7 @@ public class UserInfoHelperImpl implements UserInfoHelper {
if(CollUtil.isNotEmpty(userFullInfo.getUserRoleList())){ if(CollUtil.isNotEmpty(userFullInfo.getUserRoleList())){
for(Role role : userFullInfo.getUserRoleList()){ for(Role role : userFullInfo.getUserRoleList()){
if(RoleEnum.SUPER_ADMIN.name().equals(role.getCode()) || if(RoleEnum.SUPER_ADMIN.name().equals(role.getCode()) ||
RoleEnum.REGION_ADMIN.name().equals(role.getCode()) ){
RoleEnum.REGION_MANAGER.name().equals(role.getCode()) ){
return Boolean.TRUE; return Boolean.TRUE;
} }
} }


+ 1
- 1
pmapi/src/main/java/com/ningdatech/pmapi/datascope/provider/impl/OrdinaryUserDataScopeProviderImpl.java View File

@@ -34,7 +34,7 @@ public class OrdinaryUserDataScopeProviderImpl implements DataScopeProvider {
ds.setEmployeeCode(userFullInfo.getOrganizationCode()); ds.setEmployeeCode(userFullInfo.getOrganizationCode());
ds.setRegionCodes(Lists.newArrayList(userFullInfo.getRegionCode())); ds.setRegionCodes(Lists.newArrayList(userFullInfo.getRegionCode()));
ds.setUserId(userFullInfo.getUserId()); ds.setUserId(userFullInfo.getUserId());
ds.setRole(RoleEnum.ORDINARY_USER);
ds.setRole(RoleEnum.NORMAL_MEMBER);
return Optional.ofNullable(ds); return Optional.ofNullable(ds);
} }




+ 1
- 1
pmapi/src/main/java/com/ningdatech/pmapi/datascope/provider/impl/OrgAdminDataScopeProviderImpl.java View File

@@ -33,7 +33,7 @@ public class OrgAdminDataScopeProviderImpl implements DataScopeProvider {
ds.setOrgCode(userFullInfo.getOrganizationCode()); ds.setOrgCode(userFullInfo.getOrganizationCode());
ds.setUserId(userFullInfo.getUserId()); ds.setUserId(userFullInfo.getUserId());
ds.setEmployeeCode(userFullInfo.getEmployeeCode()); ds.setEmployeeCode(userFullInfo.getEmployeeCode());
ds.setRole(RoleEnum.ORG_ADMIN);
ds.setRole(RoleEnum.COMPANY_MANAGER);
return Optional.ofNullable(ds); return Optional.ofNullable(ds);
} }




+ 1
- 1
pmapi/src/main/java/com/ningdatech/pmapi/datascope/provider/impl/RegionAdminDataScopeProviderImpl.java View File

@@ -47,7 +47,7 @@ public class RegionAdminDataScopeProviderImpl implements DataScopeProvider {
ds.setRegionCodes(regionCodes.stream().collect(Collectors.toList())); ds.setRegionCodes(regionCodes.stream().collect(Collectors.toList()));
ds.setUserId(userFullInfo.getUserId()); ds.setUserId(userFullInfo.getUserId());
ds.setEmployeeCode(userFullInfo.getEmployeeCode()); ds.setEmployeeCode(userFullInfo.getEmployeeCode());
ds.setRole(RoleEnum.REGION_ADMIN);
ds.setRole(RoleEnum.REGION_MANAGER);
return Optional.ofNullable(ds); return Optional.ofNullable(ds);
} }




+ 3
- 3
pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/AnnualPlanLibManage.java View File

@@ -277,18 +277,18 @@ public class AnnualPlanLibManage {
return loginUser; return loginUser;
} }
switch (currentUserDataScope.get().getRole()){ switch (currentUserDataScope.get().getRole()){
case ORDINARY_USER:
case NORMAL_MEMBER:
//普通用户 只能看到自己单位去申报的 //普通用户 只能看到自己单位去申报的
query.eq(Project::getBuildOrgCode ,loginUser.getOrganizationCode()); query.eq(Project::getBuildOrgCode ,loginUser.getOrganizationCode());
break; break;
case ORG_ADMIN:
case COMPANY_MANAGER:
//单位管理员 看到自己单位去申报的 + 待预审的主管单位是自己单位的项目 //单位管理员 看到自己单位去申报的 + 待预审的主管单位是自己单位的项目
query.eq(Project::getBuildOrgCode ,loginUser.getOrganizationCode()); query.eq(Project::getBuildOrgCode ,loginUser.getOrganizationCode());
break; break;
case SUPER_ADMIN: case SUPER_ADMIN:
//超级管理员 看到丽水全市的 并且也要判断他 同时是不是单位管理员 //超级管理员 看到丽水全市的 并且也要判断他 同时是不是单位管理员
break; break;
case REGION_ADMIN:
case REGION_MANAGER:
//区域管理员 看到自己区域的项目 //区域管理员 看到自己区域的项目
query.eq(Project::getAreaCode,loginUser.getRegionCode()); query.eq(Project::getAreaCode,loginUser.getRegionCode());
break; break;


+ 3
- 3
pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectLibManage.java View File

@@ -210,11 +210,11 @@ public class ProjectLibManage {
} }
Boolean isOrgAdmin = Boolean.FALSE; Boolean isOrgAdmin = Boolean.FALSE;
switch (currentUserDataScope.get().getRole()){ switch (currentUserDataScope.get().getRole()){
case ORDINARY_USER:
case NORMAL_MEMBER:
//普通用户 只能看到自己单位去申报的 //普通用户 只能看到自己单位去申报的
query.eq(Project::getBuildOrgCode ,loginUser.getOrganizationCode()); query.eq(Project::getBuildOrgCode ,loginUser.getOrganizationCode());
break; break;
case ORG_ADMIN:
case COMPANY_MANAGER:
//单位管理员 看到自己单位去申报的 + 待预审的主管单位是自己单位的项目 //单位管理员 看到自己单位去申报的 + 待预审的主管单位是自己单位的项目
query.and(q1 -> q1.eq(Project::getBuildOrgCode ,loginUser.getOrganizationCode()).or(q2 -> query.and(q1 -> q1.eq(Project::getBuildOrgCode ,loginUser.getOrganizationCode()).or(q2 ->
q2.eq(Project::getStage,ProjectStatusEnum.NOT_APPROVED.getCode()) q2.eq(Project::getStage,ProjectStatusEnum.NOT_APPROVED.getCode())
@@ -224,7 +224,7 @@ public class ProjectLibManage {
case SUPER_ADMIN: case SUPER_ADMIN:
//超级管理员 看到丽水全市的 并且也要判断他 同时是不是单位管理员 //超级管理员 看到丽水全市的 并且也要判断他 同时是不是单位管理员
break; break;
case REGION_ADMIN:
case REGION_MANAGER:
//区域管理员 看到自己区域的项目 //区域管理员 看到自己区域的项目
query.eq(Project::getAreaCode,loginUser.getRegionCode()); query.eq(Project::getAreaCode,loginUser.getRegionCode());
break; break;


+ 6
- 4
pmapi/src/main/java/com/ningdatech/pmapi/user/entity/enumeration/RoleEnum.java View File

@@ -20,19 +20,21 @@ public enum RoleEnum {
/** /**
* 系统角色枚举 * 系统角色枚举
*/ */
ORDINARY_USER("普通用户",6),
NORMAL_MEMBER("普通用户",6),


EXPERT("专家",5), EXPERT("专家",5),


ORG_ADMIN("单位管理员",4),
COMPANY_MANAGER("单位管理员",4),


EXPERT_ADMIN("专家管理员",2), EXPERT_ADMIN("专家管理员",2),


REGION_ADMIN("区域管理员",3),
REGION_MANAGER("区域管理员",3),


SUPER_ADMIN("超级管理员",1), SUPER_ADMIN("超级管理员",1),


VISITOR("访客",7);
VISITOR("访客",7),

DASHBOARD("工作台",8);


private final String desc; private final String desc;




+ 1
- 1
pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/model/UserInfoDetails.java View File

@@ -118,7 +118,7 @@ public class UserInfoDetails extends AbstractLoginUser implements UserDetails {
if(CollUtil.isNotEmpty(this.userRoleList)){ if(CollUtil.isNotEmpty(this.userRoleList)){
for(Role role : this.userRoleList){ for(Role role : this.userRoleList){
RoleEnum roleEnum = RoleEnum.mathByName(role.getCode()); RoleEnum roleEnum = RoleEnum.mathByName(role.getCode());
if(Objects.nonNull(roleEnum) && roleEnum.eq(RoleEnum.ORG_ADMIN.name())){
if(Objects.nonNull(roleEnum) && roleEnum.eq(RoleEnum.COMPANY_MANAGER.name())){
return Boolean.TRUE; return Boolean.TRUE;
} }
} }


Loading…
Cancel
Save