From 64ff15a6118ab9238096af1a809c7ae248caf5da Mon Sep 17 00:00:00 2001 From: PoffyZhang <99775271@qq.com> Date: Thu, 27 Apr 2023 11:26:53 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8C=BA=E5=8E=BF=20500=E4=B8=87=E6=8E=A8?= =?UTF-8?q?=E9=80=81=E9=87=8D=E5=A4=A7=E9=A1=B9=E7=9B=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pmapi/common/constant/ProjectDeclareConst.java | 3 +++ .../action/ProjectDeclareChoiceAction.java | 7 +++++-- .../factory/ProjectDeclareGuardFactory.java | 4 +++- .../statemachine/util/StateMachineUtils.java | 5 +++-- .../pmapi/todocenter/manage/HandlerManage.java | 23 ++++++++++++++++++++++ 5 files changed, 37 insertions(+), 5 deletions(-) diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/constant/ProjectDeclareConst.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/constant/ProjectDeclareConst.java index b9f08a2..317247b 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/constant/ProjectDeclareConst.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/common/constant/ProjectDeclareConst.java @@ -158,6 +158,9 @@ public interface ProjectDeclareConst { class Number { public static final BigDecimal DECLARE_AMOUNT_JUDGEMENT = BigDecimal.valueOf(1000); + //区县是500万 + public static final BigDecimal DECLARE_COUNTY_AMOUNT_JUDGEMENT = BigDecimal.valueOf(500); + public static final Integer COUNTRY_BUILD_LEVEL = 1; public static final Integer PROVINCE_BUILD_LEVEL = 2; public static final Integer PROVINCE_SELF_BUILD_LEVEL = 3; diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/action/ProjectDeclareChoiceAction.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/action/ProjectDeclareChoiceAction.java index f603ad4..66243f0 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/action/ProjectDeclareChoiceAction.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/action/ProjectDeclareChoiceAction.java @@ -1,5 +1,6 @@ package com.ningdatech.pmapi.common.statemachine.action; +import com.ningdatech.pmapi.common.constant.ProjectDeclareConst; import com.ningdatech.pmapi.common.constant.StateMachineConst; import com.ningdatech.pmapi.common.statemachine.util.StateMachineUtils; import com.ningdatech.pmapi.common.statemachine.event.ProjectStatusChangeEvent; @@ -39,7 +40,8 @@ public class ProjectDeclareChoiceAction implements Action stateContext) { Project project = stateContext.getMessage().getHeaders().get(PROJECT_DECLARE, Project.class); log.info("预审申报事件之前,项目的状态为:{}"+project.getStatus()); - if (StateMachineUtils.isCityProject(project) && StateMachineUtils.judgeDeclareAmount(project)){ + if (StateMachineUtils.isCityProject(project) && StateMachineUtils.judgeDeclareAmount(project, + ProjectDeclareConst.Number.DECLARE_AMOUNT_JUDGEMENT)){ project.setStatus(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS.getCode()); }else { project.setStatus(ProjectStatusEnum.PRE_APPLYING.getCode()); @@ -49,7 +51,8 @@ public class ProjectDeclareChoiceAction implements Action stateContext) { Project project = stateContext.getMessage().getHeaders().get(PROJECT_DECLARE, Project.class); log.info("预审中撤回事件之前,项目的状态为:{}"+project.getStatus()); - if (StateMachineUtils.isCityProject(project) && StateMachineUtils.judgeDeclareAmount(project)){ + if (StateMachineUtils.isCityProject(project) && StateMachineUtils.judgeDeclareAmount(project, + ProjectDeclareConst.Number.DECLARE_AMOUNT_JUDGEMENT)){ project.setStatus(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS.getCode()); }else { project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode()); diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/factory/ProjectDeclareGuardFactory.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/factory/ProjectDeclareGuardFactory.java index 7936261..c918445 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/factory/ProjectDeclareGuardFactory.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/factory/ProjectDeclareGuardFactory.java @@ -1,5 +1,6 @@ package com.ningdatech.pmapi.common.statemachine.factory; +import com.ningdatech.pmapi.common.constant.ProjectDeclareConst; import com.ningdatech.pmapi.common.constant.StateMachineConst; import com.ningdatech.pmapi.common.statemachine.util.StateMachineUtils; import com.ningdatech.pmapi.common.statemachine.event.ProjectStatusChangeEvent; @@ -23,7 +24,8 @@ public class ProjectDeclareGuardFactory { public boolean evaluate(StateContext context) { Project project = context.getMessage().getHeaders().get(PROJECT_DECLARE, Project.class); // 判断申报项目是否是市级项目,且申报金额是否大于等于1000万元 - if (StateMachineUtils.isCityProject(project) && StateMachineUtils.judgeDeclareAmount(project)){ + if (StateMachineUtils.isCityProject(project) && StateMachineUtils.judgeDeclareAmount(project, + ProjectDeclareConst.Number.DECLARE_AMOUNT_JUDGEMENT)){ return true; } return false; diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/util/StateMachineUtils.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/util/StateMachineUtils.java index 7af2041..ec65e8c 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/util/StateMachineUtils.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/util/StateMachineUtils.java @@ -20,6 +20,7 @@ import org.springframework.statemachine.persist.StateMachinePersister; import org.springframework.stereotype.Component; import javax.annotation.Resource; +import java.math.BigDecimal; import java.time.LocalDateTime; import java.util.Objects; @@ -101,8 +102,8 @@ public class StateMachineUtils { * @author CMM * @since 2023/02/07 17:13 */ - public static boolean judgeDeclareAmount(Project project) { - int flag = project.getDeclareAmount().compareTo(ProjectDeclareConst.Number.DECLARE_AMOUNT_JUDGEMENT); + public static boolean judgeDeclareAmount(Project project, BigDecimal targetAmount) { + int flag = project.getDeclareAmount().compareTo(targetAmount); if (flag > 0 || flag == 0) { return true; } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/HandlerManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/HandlerManage.java index 5e95e1b..f3fca9a 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/HandlerManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/HandlerManage.java @@ -7,6 +7,10 @@ import java.util.*; import java.util.stream.Collectors; import com.google.common.collect.Lists; +import com.ningdatech.file.service.FileService; +import com.ningdatech.pmapi.common.constant.ProjectDeclareConst; +import com.ningdatech.pmapi.projectdeclared.converter.ApplicationConverter; +import com.ningdatech.pmapi.provincial.service.IJoinReviewProvincialBureauService; import org.apache.commons.lang3.StringUtils; import org.checkerframework.checker.nullness.qual.Nullable; import org.flowable.engine.HistoryService; @@ -74,6 +78,10 @@ public class HandlerManage { private final NoticeManage noticeManage; private final DeclaredProjectManage declaredProjectManage; + private final FileService fileService; + + private final IJoinReviewProvincialBureauService joinReviewProvincialBureauService; + /** * 审核通过后 所处理的逻辑 * @param declaredProject @@ -127,6 +135,21 @@ public class HandlerManage { // 当前项目状态是单位内部审核中 case UNDER_INTERNAL_AUDIT: // 当前项目状态是部门联审中 + //如果是 区县 并且 500万及以上要推送省局重大项目 + if(!StateMachineUtils.isCityProject(declaredProject) && + StateMachineUtils.judgeDeclareAmount(declaredProject, + ProjectDeclareConst.Number.DECLARE_COUNTY_AMOUNT_JUDGEMENT) ){ + try{ + List applications = projectApplicationService + .list(Wrappers.lambdaQuery(ProjectApplication.class) + .eq(ProjectApplication::getProjectId,declaredProject.getId())); + joinReviewProvincialBureauService.pushImportProject( + ApplicationConverter.convertProject(declaredProject,applications,fileService)); + }catch (Exception e){ + log.info("区县推送省级联审失败[{}],{}", declaredProject.getProjectName() ,e.getMessage()); + log.error("区县推送省级联审失败:" + e); + } + } case DEPARTMENT_JOINT_REVIEW: // 当前项目状态是方案评审中 case SCHEME_UNDER_REVIEW: