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