From 8eead398789ca5df689633abaab6fcc0aecbbdff Mon Sep 17 00:00:00 2001 From: PoffyZhang <99775271@qq.com> Date: Thu, 6 Apr 2023 17:43:17 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E9=A2=84=E5=AE=A1=E5=88=97=E8=A1=A8=20?= =?UTF-8?q?=E7=94=B3=E6=8A=A5=E5=8D=95=E4=BD=8D=20=E4=B9=9F=E8=A6=81?= =?UTF-8?q?=E5=8F=AF=E7=9C=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../PrequalificationDeclaredProjectManage.java | 38 +++++----------------- 1 file changed, 8 insertions(+), 30 deletions(-) diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/PrequalificationDeclaredProjectManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/PrequalificationDeclaredProjectManage.java index c55a5ee..9039afe 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/PrequalificationDeclaredProjectManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/PrequalificationDeclaredProjectManage.java @@ -231,9 +231,6 @@ public class PrequalificationDeclaredProjectManage { public PageVo pageInfo(PrequalificationDeclaredListReq preReq) { UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); VUtils.isTrue(Objects.isNull(user)).throwMessage("获取登录用户失败!"); - if(!user.getIsOrgAdmin()){ - return PageVo.empty(); - } //限定参数 复制bean ProjectListReq req = new ProjectListReq(); BeanUtils.copyProperties(preReq,req); @@ -278,33 +275,14 @@ public class PrequalificationDeclaredProjectManage { * @param query */ public UserFullInfoDTO buildPermission(LambdaQueryWrapper query,UserFullInfoDTO user){ - Optional currentUserDataScope = DataScopeUtil.getCurrentUserDataScope(user); - if(!currentUserDataScope.isPresent()){ - log.warn("没有取到权限信息 当前查询 没有权限条件"); - return user; - } - switch (currentUserDataScope.get().getRole()){ - //其它角色 只看自己单位 - case SUPER_ADMIN: - case REGION_MANAGER: - case VISITOR: - case DASHBOARD: - case NORMAL_MEMBER: - //普通用户 只能看到自己单位去申报的 - query.eq(Project::getBuildOrgCode ,user.getOrganizationCode()); - break; - //单位管理角色看 自己单位申报 + 需要本单位来申报的 - case COMPANY_MANAGER: - //单位管理员 看到自己单位去申报的 + 待预审的主管单位是自己单位的项目 - query.and(q1 -> q1.eq(Project::getBuildOrgCode ,user.getOrganizationCode()).or(q2 -> - q2.eq(Project::getStage,ProjectStatusEnum.NOT_APPROVED.getCode()) - .eq(Project::getStatus,ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode()) - .eq(Project::getSuperOrgCode,user.getOrganizationCode()))); - break; - default: - //没有权限的话 就让它查不到 - query.eq(Project::getId,0L); - break; + if(user.getIsOrgAdmin()){ + //单位管理员 看到自己单位去申报的 + 待预审的主管单位是自己单位的项目 + query.and(q1 -> q1.eq(Project::getBuildOrgCode ,user.getOrganizationCode()).or(q2 -> + q2.eq(Project::getStage,ProjectStatusEnum.NOT_APPROVED.getCode()) + .eq(Project::getStatus,ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode()) + .eq(Project::getSuperOrgCode,user.getOrganizationCode()))); + }else{ + query.eq(Project::getBuildOrgCode ,user.getOrganizationCode()); } return user; } From 410cd280f581ea0f3f55825fb3df16ca6b101876 Mon Sep 17 00:00:00 2001 From: PoffyZhang <99775271@qq.com> Date: Thu, 6 Apr 2023 21:10:43 +0800 Subject: [PATCH 2/4] =?UTF-8?q?debug=20=E6=9D=A1=E4=BB=B6=E5=88=86?= =?UTF-8?q?=E6=94=AF=20=E5=9B=A0=E4=B8=BA=E5=89=8D=E7=AB=AF=E6=B2=A1?= =?UTF-8?q?=E4=BC=A0parentType=E5=BC=95=E5=8F=91=E7=9A=84=E6=9D=A1?= =?UTF-8?q?=E7=BA=BF=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pmapi/scheduler/task/ProjectStatusFlowTask.java | 2 +- .../com/ningdatech/pmapi/statemachine/StateMachineTest.java | 12 +++++++----- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/ProjectStatusFlowTask.java b/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/ProjectStatusFlowTask.java index d182e28..b6f5938 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/ProjectStatusFlowTask.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/ProjectStatusFlowTask.java @@ -43,7 +43,7 @@ public class ProjectStatusFlowTask { @Scheduled(cron = "0 */1 * * * ?") public void statusFlow() throws UnknownHostException { //测试暂时用自己207 - if (TaskContant.Host.HOST_207.equals(InetAddress.getLocalHost().getHostName())) { + if (TaskContant.Host.HOST_ZPF.equals(InetAddress.getLocalHost().getHostName())) { //1. 定时取 项目暂存表的数据 去进行状态继续流转 List stagingList = projectStagingService.list(Wrappers.lambdaQuery(ProjectStaging.class) .eq(ProjectStaging::getDead,Boolean.FALSE) diff --git a/pmapi/src/test/java/com/ningdatech/pmapi/statemachine/StateMachineTest.java b/pmapi/src/test/java/com/ningdatech/pmapi/statemachine/StateMachineTest.java index de67421..abecf42 100644 --- a/pmapi/src/test/java/com/ningdatech/pmapi/statemachine/StateMachineTest.java +++ b/pmapi/src/test/java/com/ningdatech/pmapi/statemachine/StateMachineTest.java @@ -5,6 +5,7 @@ import com.ningdatech.pmapi.AppTests; import com.ningdatech.pmapi.common.statemachine.util.StateMachineUtils; import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; import com.ningdatech.pmapi.projectlib.model.entity.Project; +import com.ningdatech.pmapi.projectlib.service.IProjectService; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; @@ -21,13 +22,14 @@ public class StateMachineTest extends AppTests { @Autowired private StateMachineUtils stateMachineUtils; + @Autowired + private IProjectService projectService; + @Test public void stateMachineTest() { - Project project = new Project(); - project.setStage(ProjectStatusEnum.NOT_APPROVED.getCode()); - project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT.getCode()); - project.setDeclareAmount(BigDecimal.valueOf(2000)); - stateMachineUtils.withDraw(project); + Project project = projectService.getById(292); + stateMachineUtils.pass(project); System.out.println(String.format("project:%s", JSON.toJSONString(project))); + projectService.updateById(project); } } From 9fab2ef33c414241177139fedb2b6a0009b45412 Mon Sep 17 00:00:00 2001 From: PoffyZhang <99775271@qq.com> Date: Thu, 6 Apr 2023 21:14:43 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E6=94=B9=E5=9B=9E=E5=AE=9A=E6=97=B6?= =?UTF-8?q?=E4=BB=BB=E5=8A=A1207=E6=9C=BA=E5=99=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/ningdatech/pmapi/scheduler/task/ProjectStatusFlowTask.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/ProjectStatusFlowTask.java b/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/ProjectStatusFlowTask.java index b6f5938..d182e28 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/ProjectStatusFlowTask.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/ProjectStatusFlowTask.java @@ -43,7 +43,7 @@ public class ProjectStatusFlowTask { @Scheduled(cron = "0 */1 * * * ?") public void statusFlow() throws UnknownHostException { //测试暂时用自己207 - if (TaskContant.Host.HOST_ZPF.equals(InetAddress.getLocalHost().getHostName())) { + if (TaskContant.Host.HOST_207.equals(InetAddress.getLocalHost().getHostName())) { //1. 定时取 项目暂存表的数据 去进行状态继续流转 List stagingList = projectStagingService.list(Wrappers.lambdaQuery(ProjectStaging.class) .eq(ProjectStaging::getDead,Boolean.FALSE) From dd4754c274ca8bff6e9f70487691af2075a3bdee Mon Sep 17 00:00:00 2001 From: PoffyZhang <99775271@qq.com> Date: Thu, 6 Apr 2023 22:34:00 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=9D=83=E9=99=90?= =?UTF-8?q?=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pmapi/projectlib/manage/ProjectLibManage.java | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectLibManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectLibManage.java index d17c755..db00266 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectLibManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectLibManage.java @@ -7,6 +7,8 @@ import com.google.common.collect.Lists; import com.ningdatech.basic.model.PageVo; import com.ningdatech.basic.util.CollUtils; import com.ningdatech.pmapi.common.constant.CommonConst; +import com.ningdatech.pmapi.common.constant.RegionConst; +import com.ningdatech.pmapi.common.helper.RegionCacheHelper; import com.ningdatech.pmapi.common.helper.UserInfoHelper; import com.ningdatech.pmapi.common.model.entity.ExcelExportWriter; import com.ningdatech.pmapi.common.util.ExcelDownUtil; @@ -36,10 +38,7 @@ import org.springframework.beans.BeanUtils; import org.springframework.stereotype.Component; import javax.servlet.http.HttpServletResponse; -import java.util.ArrayList; -import java.util.List; -import java.util.Objects; -import java.util.Optional; +import java.util.*; /** *

@@ -59,6 +58,8 @@ public class ProjectLibManage { private final IProjectRenewalFundDeclarationService renewalFundDeclarationService; private final ProcessExecuteChainHandle processExecuteHandle; + private final RegionCacheHelper regionCacheHelper; + private final UserInfoHelper userInfoHelper; public PageVo projectLibList(ProjectListReq req) { @@ -234,8 +235,14 @@ public class ProjectLibManage { //超级管理员 看到丽水全市的 并且也要判断他 同时是不是单位管理员 break; case REGION_MANAGER: - //区域管理员 看到自己区域的项目 - query.eq(Project::getAreaCode,user.getRegionCode()); + //区域管理员 看到自己区域的项目 如果是市本级 就看全市的 + if(RegionConst.RC_LS.equals(user.getRegionCode())){ + Collection regionCodes = regionCacheHelper.listChildRegionCodeList(user.getRegionCode(), + RegionConst.RL_CITY); + query.in(Project::getAreaCode,regionCodes); + }else{ + query.eq(Project::getAreaCode,user.getRegionCode()); + } break; case VISITOR: //访客可以看全市的