From 40b9e98514639e5f9502d898a0d1d08d39ad5967 Mon Sep 17 00:00:00 2001 From: WendyYang Date: Mon, 12 Aug 2024 09:50:35 +0800 Subject: [PATCH] =?UTF-8?q?modify:=201.=20=E7=94=A8=E6=88=B7=E6=8B=A5?= =?UTF-8?q?=E6=9C=89=E8=A7=92=E8=89=B2=E4=BF=AE=E6=94=B9=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/hz/pm/api/irs/manage/IrsProjectManage.java | 3 +-- .../src/main/java/com/hz/pm/api/portrait/manage/TagManage.java | 2 +- .../com/hz/pm/api/projectdeclared/manage/ConstructionManage.java | 2 +- .../com/hz/pm/api/projectdeclared/manage/FinalAcceptanceManage.java | 4 +--- .../java/com/hz/pm/api/projectdeclared/manage/PurchaseManage.java | 2 +- .../java/com/hz/pm/api/projectlib/manage/ProjectChangeManage.java | 4 ++-- .../com/hz/pm/api/projectlib/manage/ProjectCollectionManage.java | 2 +- .../java/com/hz/pm/api/projectlib/manage/ProjectStoppedManage.java | 2 +- .../src/main/java/com/hz/pm/api/safety/manage/SafetyRiskManage.java | 5 ++--- hz-pm-api/src/main/java/com/hz/pm/api/sys/manage/NoticeManage.java | 5 ++--- .../src/main/java/com/hz/pm/api/sys/utils/EarlyWarningUtil.java | 4 ++-- .../java/com/hz/pm/api/user/security/model/UserInfoDetails.java | 6 +++--- 12 files changed, 18 insertions(+), 23 deletions(-) diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/irs/manage/IrsProjectManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/irs/manage/IrsProjectManage.java index 77e3cf2..c40e70c 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/irs/manage/IrsProjectManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/irs/manage/IrsProjectManage.java @@ -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 wrapper, UserInfoDetails user) { - if (user.getSuperAdmin() || user.getRegionAdmin()) { + if (user.hasSuperAdmin() || user.hasRegionAdmin()) { log.info("超管 都可看 项目档案列表"); } else { wrapper.eq(Project::getBuildOrgCode, user.getMhUnitIdStr()); diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/portrait/manage/TagManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/portrait/manage/TagManage.java index 88398bd..751dced 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/portrait/manage/TagManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/portrait/manage/TagManage.java @@ -87,7 +87,7 @@ public class TagManage { */ private void checkAuth(LambdaQueryWrapper query, UserInfoDetails user) { //如果是超管 - if (user.getSuperAdmin() || user.getRegionAdmin()) { + if (user.hasSuperAdmin() || user.hasRegionAdmin()) { log.info(user.getUsername() + " 是超管,可以看所有标签"); } else { //其它角色全都看不见 diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/ConstructionManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/ConstructionManage.java index 8477802..dc3079f 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/ConstructionManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/ConstructionManage.java @@ -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); diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/FinalAcceptanceManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/FinalAcceptanceManage.java index 405b7a6..e75319b 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/FinalAcceptanceManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/FinalAcceptanceManage.java @@ -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); diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/PurchaseManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/PurchaseManage.java index 6510589..efe0f5c 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/PurchaseManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/PurchaseManage.java @@ -207,7 +207,7 @@ public class PurchaseManage { */ private void permission(LambdaQueryWrapper query, UserInfoDetails user) { //超管看所有 - if (user.getSuperAdmin()) { + if (user.hasSuperAdmin()) { log.info("超管查看所有采购信息 :{}", user.getUsername()); } else { //其他情况 只能看自己单位 diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/ProjectChangeManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/ProjectChangeManage.java index 7e255b0..947e7cf 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/ProjectChangeManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/ProjectChangeManage.java @@ -177,7 +177,7 @@ public class ProjectChangeManage { LambdaQueryWrapper 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 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 projects = projectService.list(query); diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/ProjectCollectionManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/ProjectCollectionManage.java index a1e4e40..ffd4ed7 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/ProjectCollectionManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/ProjectCollectionManage.java @@ -55,7 +55,7 @@ public class ProjectCollectionManage { UserInfoDetails user = LoginUserUtil.loginUserDetail(); String buildOrgCode = req.getBuildOrgCode(); //如果是超管 可以看所有 - if (user.getSuperAdmin()) { + if (user.hasSuperAdmin()) { buildOrgCode = null; } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/ProjectStoppedManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/ProjectStoppedManage.java index 20f6c84..28325cf 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/ProjectStoppedManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/ProjectStoppedManage.java @@ -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 projects = projectService.list(query); diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/safety/manage/SafetyRiskManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/safety/manage/SafetyRiskManage.java index a6c2aa8..9d292b4 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/safety/manage/SafetyRiskManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/safety/manage/SafetyRiskManage.java @@ -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 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()); diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/sys/manage/NoticeManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/sys/manage/NoticeManage.java index 49703c0..56bd94d 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/sys/manage/NoticeManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/sys/manage/NoticeManage.java @@ -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; diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/sys/utils/EarlyWarningUtil.java b/hz-pm-api/src/main/java/com/hz/pm/api/sys/utils/EarlyWarningUtil.java index 911bd5f..741802b 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/sys/utils/EarlyWarningUtil.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/sys/utils/EarlyWarningUtil.java @@ -20,9 +20,9 @@ public class EarlyWarningUtil { public static void buildPermissionWrapper(LambdaQueryWrapper 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 { //否则都只能看自己单位的 diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/security/model/UserInfoDetails.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/security/model/UserInfoDetails.java index 0bc56f9..1e5f722 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/user/security/model/UserInfoDetails.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/user/security/model/UserInfoDetails.java @@ -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); }