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 2a497cd..de3b554 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 @@ -2,7 +2,6 @@ package com.hz.pm.api.projectdeclared.manage; import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.collection.CollUtil; -import cn.hutool.core.util.NumberUtil; import com.alibaba.excel.EasyExcel; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.toolkit.StringUtils; @@ -44,8 +43,8 @@ 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.user.helper.MhUnitQueryHelper; -import com.hz.pm.api.user.helper.MhUnitQueryHelper.UnitQueryState; +import com.hz.pm.api.user.helper.MhUnitQueryAuthHelper; +import com.hz.pm.api.user.helper.MhUnitQueryAuthHelper.UnitQueryState; 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; @@ -107,7 +106,7 @@ public class ConstructionManage { private final TaskService taskService; private final IXinchuangInstService xinchuangInstService; - private final MhUnitQueryHelper mhUnitQueryHelper; + private final MhUnitQueryAuthHelper mhUnitQueryAuthHelper; /** * 待采购的-项目列表 @@ -299,9 +298,8 @@ public class ConstructionManage { public FirstAcceptProgressStatisticsVO firstAcceptProgressStatistics(ProjectListReq req) { UserInfoDetails user = LoginUserUtil.loginUserDetail(); - String buildOrgCode = req.clearBuildOrgCode(); - Long buildOrgCodeNum = NumberUtil.parseLong(buildOrgCode, null); - UnitQueryState queryState = mhUnitQueryHelper.listCanViewUnitIds(buildOrgCodeNum, user); + Long buildOrgCode = req.clearBuildOrgCode(); + UnitQueryState queryState = mhUnitQueryAuthHelper.listCanViewUnitIds(buildOrgCode, user); if (!queryState.isState()) { return null; } @@ -356,9 +354,8 @@ public class ConstructionManage { */ public PageVo preProjectList(ProjectListReq req) { UserInfoDetails user = LoginUserUtil.loginUserDetail(); - String buildOrgCode = req.clearBuildOrgCode(); - Long buildOrgCodeNum = NumberUtil.parseLong(buildOrgCode, null); - UnitQueryState queryState = mhUnitQueryHelper.listCanViewUnitIds(buildOrgCodeNum, user); + Long buildOrgCode = req.clearBuildOrgCode(); + UnitQueryState queryState = mhUnitQueryAuthHelper.listCanViewUnitIds(buildOrgCode, user); if (!queryState.isState()) { return PageVo.empty(); } 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 1751ede..678200c 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 @@ -38,7 +38,7 @@ import com.hz.pm.api.projectlib.model.vo.TenderListInfoVO; 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.user.helper.MhUnitQueryHelper; +import com.hz.pm.api.user.helper.MhUnitQueryAuthHelper; 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; @@ -62,7 +62,7 @@ import java.util.concurrent.atomic.AtomicInteger; import java.util.function.BiFunction; import java.util.stream.Collectors; -import static com.hz.pm.api.user.helper.MhUnitQueryHelper.UnitQueryState; +import static com.hz.pm.api.user.helper.MhUnitQueryAuthHelper.UnitQueryState; /** * @Classname FinalAcceptanceManage @@ -86,7 +86,7 @@ public class FinalAcceptanceManage { private final ProjectStateMachineUtil projectStateMachineUtil; private final TenderStateMachineUtil tenderStateMachineUtil; private final IProjectInstService projectInstService; - private final MhUnitQueryHelper mhUnitQueryHelper; + private final MhUnitQueryAuthHelper mhUnitQueryAuthHelper; //================================================================================================================== @@ -108,9 +108,8 @@ public class FinalAcceptanceManage { */ public FinalAcceptProgressStatisticsVO finalAcceptProgressStatistics(ProjectListReq req) { UserInfoDetails user = LoginUserUtil.loginUserDetail(); - String buildOrgCode = req.clearBuildOrgCode(); - Long buildOrgCodeNum = NumberUtil.parseLong(buildOrgCode, null); - UnitQueryState queryState = mhUnitQueryHelper.listCanViewUnitIds(buildOrgCodeNum, user); + Long buildOrgCode = req.clearBuildOrgCode(); + UnitQueryState queryState = mhUnitQueryAuthHelper.listCanViewUnitIds(buildOrgCode, user); if (!queryState.isState()) { return null; } @@ -155,9 +154,8 @@ public class FinalAcceptanceManage { */ public PageVo projectLibList(ProjectListReq req) { UserInfoDetails user = LoginUserUtil.loginUserDetail(); - String buildOrgCode = req.clearBuildOrgCode(); - Long buildOrgCodeNum = NumberUtil.parseLong(buildOrgCode, null); - UnitQueryState queryState = mhUnitQueryHelper.listCanViewUnitIds(buildOrgCodeNum, user); + Long buildOrgCode = req.clearBuildOrgCode(); + UnitQueryState queryState = mhUnitQueryAuthHelper.listCanViewUnitIds(buildOrgCode, user); if (!queryState.isState()) { return null; } 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 a88a2b7..d870bb2 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 @@ -54,6 +54,8 @@ import com.hz.pm.api.projectlib.service.IProjectService; import com.hz.pm.api.projectlib.service.IPurchaseStatusChangeService; import com.hz.pm.api.sys.manage.ProcessModelManage; import com.hz.pm.api.user.helper.MhUnitCache; +import com.hz.pm.api.user.helper.MhUnitQueryAuthHelper; +import com.hz.pm.api.user.helper.MhUnitQueryAuthHelper.UnitQueryState; 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; @@ -124,12 +126,16 @@ public class PurchaseManage { private final IXinchuangService xinchuangService; private final MhXchxFileHelper mhXchxFileHelper; private final IPurchaseStatusChangeService purchaseStatusChangeService; + private final MhUnitQueryAuthHelper mhUnitQueryAuthHelper; public PurchaseProgressStatVO purchaseProgressStatistics(ProjectListReq req) { UserInfoDetails user = LoginUserUtil.loginUserDetail(); + Long buildOrgCode = req.clearBuildOrgCode(); LambdaQueryWrapper query = ProjectManageUtil.projectQuery(req); //数据权限 - permission(query, user); + if (!permission(query, user, buildOrgCode)) { + return null; + } //待采购状态 query.notIn(Project::getStage, ProjectStatus.STOPPED.getCode(), ProjectStatus.CHANGE.getCode()) .eq(Project::getStage, ProjectStatus.PROJECT_APPROVED.getCode()) @@ -166,9 +172,12 @@ public class PurchaseManage { public PageVo projectLibList(ProjectListReq req) { UserInfoDetails user = LoginUserUtil.loginUserDetail(); Assert.notNull(user, "获取登录用户失败!"); + Long buildOrgCode = req.clearBuildOrgCode(); LambdaQueryWrapper query = ProjectManageUtil.projectQuery(req); //数据权限 - permission(query, user); + if (!permission(query, user, buildOrgCode)) { + return PageVo.empty(); + } //待采购状态 query.notIn(Project::getStage, ProjectStatus.STOPPED.getCode(), ProjectStatus.CHANGE.getCode()); query.eq(Project::getStage, ProjectStatus.PROJECT_APPROVED.getCode()); @@ -265,14 +274,15 @@ public class PurchaseManage { * @param query * @param user */ - private void permission(LambdaQueryWrapper query, UserInfoDetails user) { - //超管看所有 - if (user.hasSuperAdmin()) { - log.info("超管查看所有采购信息 :{}", user.getUsername()); - } else { - //其他情况 只能看自己单位 - query.eq(Project::getBuildOrgCode, user.getMhUnitIdStr()); + private boolean permission(LambdaQueryWrapper query, UserInfoDetails user, Long buildOrgCode) { + UnitQueryState state = mhUnitQueryAuthHelper.listCanViewUnitIds(buildOrgCode, user); + if (!state.isState()) { + return false; + } + if (CollUtil.isNotEmpty(state.getUnitIds())) { + query.in(Project::getBuildOrgCode, CollUtils.convert(state.getUnitIds(), String::valueOf)); } + return true; } public void exportList(HttpServletResponse response, ProjectListReq param) { diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/AmountApprovalManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/AmountApprovalManage.java index 73ba846..8384376 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/AmountApprovalManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/AmountApprovalManage.java @@ -10,6 +10,7 @@ import com.hz.pm.api.common.helper.UserInfoHelper; import com.hz.pm.api.common.util.DecimalUtil; import com.hz.pm.api.datascope.model.DataScopeDTO; import com.hz.pm.api.datascope.utils.DataScopeUtil; +import com.hz.pm.api.external.model.enumeration.MhUnitStripEnum; import com.hz.pm.api.projectlib.helper.ProjectManageUtil; import com.hz.pm.api.projectlib.model.entity.Project; import com.hz.pm.api.projectlib.model.enumeration.status.ProjectStatus; @@ -109,6 +110,8 @@ public class AmountApprovalManage { item.setProjectName(w.getProjectName()); item.setStage(w.getStage()); item.setStatus(w.getStatus()); + item.setUnitStrip(w.getUnitStrip()); + item.setUnitStripName(MhUnitStripEnum.getVal(w.getUnitStrip())); item.setProjectYear(w.getProjectYear()); item.setProjectType(w.getProjectType()); item.setDeclaredAmount(w.getDeclareAmount()); diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/MhSystemReplaceManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/MhSystemReplaceManage.java index 1ab3267..f916d8c 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/MhSystemReplaceManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/MhSystemReplaceManage.java @@ -18,8 +18,8 @@ import com.hz.pm.api.projectlib.model.entity.Project; import com.hz.pm.api.projectlib.model.enumeration.MhSystemReplaceType; import com.hz.pm.api.projectlib.model.req.MhSystemReplaceReq; import com.hz.pm.api.projectlib.service.*; -import com.hz.pm.api.user.helper.MhUnitQueryHelper; -import com.hz.pm.api.user.helper.MhUnitQueryHelper.UnitQueryState; +import com.hz.pm.api.user.helper.MhUnitQueryAuthHelper; +import com.hz.pm.api.user.helper.MhUnitQueryAuthHelper.UnitQueryState; import com.ningdatech.basic.model.PageVo; import com.ningdatech.basic.util.CollUtils; import lombok.RequiredArgsConstructor; @@ -51,7 +51,7 @@ public class MhSystemReplaceManage { private final IProjectGovSystemReplaceInfosService projectGovSystemReplaceInfosService; private final IProjectService projectService; private final IQxProjectSystemReplaceInfosRelationService qxProjectSystemReplaceInfosRelationService; - private final MhUnitQueryHelper mhUnitQueryHelper; + private final MhUnitQueryAuthHelper mhUnitQueryAuthHelper; private final IMhSystemReplaceInfoStoppedRecordService mhSystemReplaceInfoStoppedRecordService; @Transactional(rollbackFor = Exception.class) @@ -92,7 +92,7 @@ public class MhSystemReplaceManage { public PageVo page(MhSystemReplaceReq req) { LambdaQueryWrapper query = buildMhSystemReplaceInfoQuery(req); - UnitQueryState state = mhUnitQueryHelper.listCanViewUnitIds(req.getBuildOrgCode()); + UnitQueryState state = mhUnitQueryAuthHelper.listCanViewUnitIds(req.getBuildOrgCode()); if (!state.isState()) { return PageVo.empty(); } @@ -174,7 +174,7 @@ public class MhSystemReplaceManage { } else if (MhSystemReplaceType.NE.eq(req.getReplaceType())) { return Collections.emptyList(); } - UnitQueryState state = mhUnitQueryHelper.listCanViewUnitIds(req.getBuildOrgCode()); + UnitQueryState state = mhUnitQueryAuthHelper.listCanViewUnitIds(req.getBuildOrgCode()); if (!state.isState()) { return Collections.emptyList(); } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/QxProjectManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/QxProjectManage.java index 867c0e1..d5df59a 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/QxProjectManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/QxProjectManage.java @@ -20,8 +20,8 @@ import com.hz.pm.api.projectlib.model.vo.QxProjectSystemReplaceInfosVO; import com.hz.pm.api.projectlib.model.vo.QxProjectVO; import com.hz.pm.api.projectlib.model.vo.QxPurchaseVO; import com.hz.pm.api.projectlib.service.*; -import com.hz.pm.api.user.helper.MhUnitQueryHelper; -import com.hz.pm.api.user.helper.MhUnitQueryHelper.UnitQueryState; +import com.hz.pm.api.user.helper.MhUnitQueryAuthHelper; +import com.hz.pm.api.user.helper.MhUnitQueryAuthHelper.UnitQueryState; import com.hz.pm.api.user.util.LoginUserUtil; import com.ningdatech.basic.model.PageVo; import com.ningdatech.basic.util.CollUtils; @@ -47,7 +47,7 @@ import java.util.Map; @RequiredArgsConstructor public class QxProjectManage { - private final MhUnitQueryHelper unitQueryHelper; + private final MhUnitQueryAuthHelper unitQueryHelper; private final IQxProjectService qxProjectService; private final IMhSystemReplaceInfoService mhSystemReplaceInfoService; private final IQxProjectSystemReplaceInfosService qxProjectSystemReplaceInfosService; diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/req/ProjectListReq.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/req/ProjectListReq.java index 807967a..c74c686 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/req/ProjectListReq.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/req/ProjectListReq.java @@ -1,5 +1,6 @@ package com.hz.pm.api.projectlib.model.req; +import cn.hutool.core.util.NumberUtil; import cn.hutool.core.util.StrUtil; import com.hz.pm.api.common.enumeration.ExportOptionEnum; import com.ningdatech.basic.model.PagePo; @@ -134,12 +135,12 @@ public class ProjectListReq extends PagePo { @ApiModelProperty("tab状态") private Integer tabStatus; - public String clearBuildOrgCode() { + public Long clearBuildOrgCode() { String tmpBuildOrgCode = this.getBuildOrgCode(); if (StrUtil.isNotBlank(tmpBuildOrgCode)) { this.setBuildOrgCode(null); } - return tmpBuildOrgCode; + return NumberUtil.parseLong(tmpBuildOrgCode, null); } } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/helper/MhUnitQueryHelper.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/helper/MhUnitQueryAuthHelper.java similarity index 98% rename from hz-pm-api/src/main/java/com/hz/pm/api/user/helper/MhUnitQueryHelper.java rename to hz-pm-api/src/main/java/com/hz/pm/api/user/helper/MhUnitQueryAuthHelper.java index 342be4e..2032845 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/user/helper/MhUnitQueryHelper.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/user/helper/MhUnitQueryAuthHelper.java @@ -19,7 +19,7 @@ import java.util.List; */ @Component @RequiredArgsConstructor -public class MhUnitQueryHelper { +public class MhUnitQueryAuthHelper { private final MhUnitCache unitCache;