Sfoglia il codice sorgente

modify:

1. 用户拥有角色修改;
tags/24081601
WendyYang 5 mesi fa
parent
commit
40b9e98514
12 ha cambiato i file con 18 aggiunte e 23 eliminazioni
  1. +1
    -2
      hz-pm-api/src/main/java/com/hz/pm/api/irs/manage/IrsProjectManage.java
  2. +1
    -1
      hz-pm-api/src/main/java/com/hz/pm/api/portrait/manage/TagManage.java
  3. +1
    -1
      hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/ConstructionManage.java
  4. +1
    -3
      hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/FinalAcceptanceManage.java
  5. +1
    -1
      hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/PurchaseManage.java
  6. +2
    -2
      hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/ProjectChangeManage.java
  7. +1
    -1
      hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/ProjectCollectionManage.java
  8. +1
    -1
      hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/ProjectStoppedManage.java
  9. +2
    -3
      hz-pm-api/src/main/java/com/hz/pm/api/safety/manage/SafetyRiskManage.java
  10. +2
    -3
      hz-pm-api/src/main/java/com/hz/pm/api/sys/manage/NoticeManage.java
  11. +2
    -2
      hz-pm-api/src/main/java/com/hz/pm/api/sys/utils/EarlyWarningUtil.java
  12. +3
    -3
      hz-pm-api/src/main/java/com/hz/pm/api/user/security/model/UserInfoDetails.java

+ 1
- 2
hz-pm-api/src/main/java/com/hz/pm/api/irs/manage/IrsProjectManage.java Vedi File

@@ -7,7 +7,6 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ningdatech.basic.model.PageVo;
import com.hz.pm.api.common.enumeration.CommonEnum;
import com.hz.pm.api.projectlib.model.enumeration.status.ProjectStatus;
import com.hz.pm.api.projectlib.model.entity.Project;
import com.hz.pm.api.projectlib.model.req.ProjectListReq;
import com.hz.pm.api.projectlib.model.vo.ProjectLibListItemVO;
@@ -72,7 +71,7 @@ public class IrsProjectManage {
}

private void buildPermission(LambdaQueryWrapper<Project> wrapper, UserInfoDetails user) {
if (user.getSuperAdmin() || user.getRegionAdmin()) {
if (user.hasSuperAdmin() || user.hasRegionAdmin()) {
log.info("超管 都可看 项目档案列表");
} else {
wrapper.eq(Project::getBuildOrgCode, user.getMhUnitIdStr());


+ 1
- 1
hz-pm-api/src/main/java/com/hz/pm/api/portrait/manage/TagManage.java Vedi File

@@ -87,7 +87,7 @@ public class TagManage {
*/
private void checkAuth(LambdaQueryWrapper<Tag> query, UserInfoDetails user) {
//如果是超管
if (user.getSuperAdmin() || user.getRegionAdmin()) {
if (user.hasSuperAdmin() || user.hasRegionAdmin()) {
log.info(user.getUsername() + " 是超管,可以看所有标签");
} else {
//其它角色全都看不见


+ 1
- 1
hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/ConstructionManage.java Vedi File

@@ -310,7 +310,7 @@ public class ConstructionManage {
query.eq(Project::getStage, ProjectStatus.PROJECT_APPROVED.getCode());
query.eq(Project::getNewest, Boolean.TRUE);
//只能看自己单位的
if (!user.getSuperAdmin()) {
if (!user.hasSuperAdmin()) {
query.eq(Project::getBuildOrgCode, user.getMhUnitIdStr());
}
query.orderByAsc(Project::getDeliveryTime);


+ 1
- 3
hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/FinalAcceptanceManage.java Vedi File

@@ -36,7 +36,6 @@ import com.hz.pm.api.projectlib.service.IProjectAnnualPaymentPlanService;
import com.hz.pm.api.projectlib.service.IProjectInstService;
import com.hz.pm.api.projectlib.service.IProjectService;
import com.hz.pm.api.sys.manage.ProcessModelManage;
import com.hz.pm.api.todocenter.manage.HandlerManage;
import com.hz.pm.api.user.security.model.UserFullInfoDTO;
import com.hz.pm.api.user.security.model.UserInfoDetails;
import com.hz.pm.api.user.util.LoginUserUtil;
@@ -59,7 +58,6 @@ import javax.servlet.http.HttpServletResponse;
import java.math.BigDecimal;
import java.util.*;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.Collectors;

/**
* @Classname FinalAcceptanceManage
@@ -113,7 +111,7 @@ public class FinalAcceptanceManage {
if (projectIds.isEmpty()) {
return PageVo.empty();
}
if (!user.getSuperAdmin()) {
if (!user.hasSuperAdmin()) {
query.eq(Project::getBuildOrgCode, user.getMhUnitIdStr());
}
query.in(Project::getId, projectIds);


+ 1
- 1
hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/PurchaseManage.java Vedi File

@@ -207,7 +207,7 @@ public class PurchaseManage {
*/
private void permission(LambdaQueryWrapper<Project> query, UserInfoDetails user) {
//超管看所有
if (user.getSuperAdmin()) {
if (user.hasSuperAdmin()) {
log.info("超管查看所有采购信息 :{}", user.getUsername());
} else {
//其他情况 只能看自己单位


+ 2
- 2
hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/ProjectChangeManage.java Vedi File

@@ -177,7 +177,7 @@ public class ProjectChangeManage {
LambdaQueryWrapper<Project> wrapper = ProjectManageUtil.projectQuery(req)
.eq(Project::getNewest, Boolean.TRUE);
UserInfoDetails userDetail = LoginUserUtil.loginUserDetail();
if (!userDetail.getSuperAdmin()) {
if (!userDetail.hasSuperAdmin()) {
wrapper.eq(Project::getBuildOrgCode, userDetail.getMhUnitIdStr());
}
Page<ProjectChangeListDTO> page = projectService.pageChangeList(wrapper, req.page());
@@ -233,7 +233,7 @@ public class ProjectChangeManage {
ProjectStatus.ON_STOPPED_APPLY.getCode(),
ProjectStatus.ON_CHANGE_APPLY.getCode());
UserInfoDetails userDetail = LoginUserUtil.loginUserDetail();
if (!userDetail.getSuperAdmin()) {
if (!userDetail.hasSuperAdmin()) {
query.eq(Project::getBuildOrgCode, userDetail.getMhUnitIdStr());
}
List<Project> projects = projectService.list(query);


+ 1
- 1
hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/ProjectCollectionManage.java Vedi File

@@ -55,7 +55,7 @@ public class ProjectCollectionManage {
UserInfoDetails user = LoginUserUtil.loginUserDetail();
String buildOrgCode = req.getBuildOrgCode();
//如果是超管 可以看所有
if (user.getSuperAdmin()) {
if (user.hasSuperAdmin()) {
buildOrgCode = null;
}



+ 1
- 1
hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/ProjectStoppedManage.java Vedi File

@@ -140,7 +140,7 @@ public class ProjectStoppedManage {
.notIn(Project::getStatus, ProjectStatus.STOPPED_PASSED.getCode(),
ProjectStatus.ON_STOPPED_APPLY.getCode());
UserInfoDetails userDetail = LoginUserUtil.loginUserDetail();
if (!userDetail.getSuperAdmin()) {
if (!userDetail.hasSuperAdmin()) {
query.eq(Project::getBuildOrgCode, userDetail.getMhUnitIdStr());
}
List<Project> projects = projectService.list(query);


+ 2
- 3
hz-pm-api/src/main/java/com/hz/pm/api/safety/manage/SafetyRiskManage.java Vedi File

@@ -8,7 +8,6 @@ import com.baomidou.mybatisplus.core.toolkit.Assert;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hz.pm.api.common.model.constant.BizConst;
import com.hz.pm.api.common.model.constant.RegionConst;
import com.hz.pm.api.projectlib.model.entity.Project;
import com.hz.pm.api.projectlib.model.entity.ProjectApplication;
import com.hz.pm.api.projectlib.model.req.ProjectListReq;
@@ -87,9 +86,9 @@ public class SafetyRiskManage {
*/
private void checkAuth(LambdaQueryWrapper<Project> query, UserInfoDetails user) {
//如果是超管
if (user.getSuperAdmin() || user.getRegionAdmin()) {
if (user.hasSuperAdmin() || user.hasRegionAdmin()) {
log.info(user.getUsername() + " 是超管,可以看所有项目");
} else if (user.getIsOrgAdmin()) {
} else if (user.hasOrgAdmin()) {
//单位管理员
log.info(user.getUsername() + " 是单位管理员,可以看单位 " + user.getMhUnitId() + " 项目");
query.eq(Project::getBuildOrgCode, user.getMhUnitId());


+ 2
- 3
hz-pm-api/src/main/java/com/hz/pm/api/sys/manage/NoticeManage.java Vedi File

@@ -15,7 +15,6 @@ import com.hz.pm.api.organization.service.IDingEmployeeInfoService;
import com.hz.pm.api.organization.service.IDingOrganizationService;
import com.hz.pm.api.projectlib.model.entity.Project;
import com.hz.pm.api.staging.enums.MsgTypeEnum;
import com.hz.pm.api.staging.service.INdWorkNoticeStagingService;
import com.hz.pm.api.sys.enumeration.NoticePermissionsEnum;
import com.hz.pm.api.sys.enumeration.NoticeTypeEnum;
import com.hz.pm.api.sys.model.entity.Notice;
@@ -318,10 +317,10 @@ public class NoticeManage {
notice.setPermissionsValue(user.getMhUnitIdStr());
return;
}
if (user.getSuperAdmin()) {
if (user.hasSuperAdmin()) {
notice.setPermissions(NoticePermissionsEnum.SUPER.getCode());
return;
} else if (user.getIsOrgAdmin()) {
} else if (user.hasOrgAdmin()) {
notice.setPermissions(NoticePermissionsEnum.ORG.getCode());
notice.setPermissionsValue(user.getMhUnitIdStr());
return;


+ 2
- 2
hz-pm-api/src/main/java/com/hz/pm/api/sys/utils/EarlyWarningUtil.java Vedi File

@@ -20,9 +20,9 @@ public class EarlyWarningUtil {
public static void buildPermissionWrapper(LambdaQueryWrapper<WflowEarlyWarningRecords> wrapper,
UserInfoDetails user) {
//如果是超管的话
if (user.getSuperAdmin() || user.getRegionAdmin()) {
if (user.hasSuperAdmin() || user.hasRegionAdmin()) {
// 可以看所有
} else if (user.getIsOrgAdmin()) {
} else if (user.hasOrgAdmin()) {
wrapper.eq(WflowEarlyWarningRecords::getBuildOrgCode, user.getMhUnitIdStr());
} else {
//否则都只能看自己单位的


+ 3
- 3
hz-pm-api/src/main/java/com/hz/pm/api/user/security/model/UserInfoDetails.java Vedi File

@@ -131,15 +131,15 @@ public class UserInfoDetails extends AbstractLoginUser implements UserDetails {
return null;
}

public boolean getIsOrgAdmin() {
public boolean hasOrgAdmin() {
return containsRole(RoleEnum.COMPANY_MANAGER);
}

public boolean getSuperAdmin() {
public boolean hasSuperAdmin() {
return containsRole(RoleEnum.SUPER_ADMIN);
}

public boolean getRegionAdmin() {
public boolean hasRegionAdmin() {
return containsRole(RoleEnum.REGION_MANAGER);
}



Loading…
Annulla
Salva