Browse Source

项目预审中撤回状态机修改

master
CMM 1 year ago
parent
commit
6004ce5b72
4 changed files with 39 additions and 37 deletions
  1. +0
    -19
      pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/action/ProjectDeclareAction.java
  2. +27
    -8
      pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/action/ProjectDeclareChoiceAction.java
  3. +11
    -10
      pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/builder/ProjectDeclareStateMachineBuilder.java
  4. +1
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/projectlib/enumeration/ProjectStatusEnum.java

+ 0
- 19
pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/action/ProjectDeclareAction.java View File

@@ -256,23 +256,4 @@ public class ProjectDeclareAction {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW.getCode());
}


public class ProjectDeclareChoiceAction implements Action<ProjectStatusEnum, ProjectStatusChangeEvent> {

@Override
public void execute(StateContext<ProjectStatusEnum, ProjectStatusChangeEvent> stateContext) {
log.info(String.valueOf(stateContext.getTarget().getId()));
ProjectStatusEnum projectStatusEnum = stateContext.getTarget().getId();
if (projectStatusEnum.equals(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE)) {
Project project = stateContext.getMessage().getHeaders().get(PROJECT_DECLARE, Project.class);
log.info("预审申报事件之前,项目的状态为:{}" + project.getStatus());
if (StateMachineUtils.isCityProject(project) && StateMachineUtils.judgeDeclareAmount(project)) {
project.setStatus(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS.getCode());
} else {
project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode());
}
}
}
}
}

+ 27
- 8
pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/action/ProjectDeclareChoiceAction.java View File

@@ -24,14 +24,33 @@ public class ProjectDeclareChoiceAction implements Action<ProjectStatusEnum, Pro
public void execute(StateContext<ProjectStatusEnum, ProjectStatusChangeEvent> stateContext) {
log.info(String.valueOf(stateContext.getTarget().getId()));
ProjectStatusEnum projectStatusEnum = stateContext.getTarget().getId();
if (projectStatusEnum.equals(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE)){
Project project = stateContext.getMessage().getHeaders().get(PROJECT_DECLARE, Project.class);
log.info("预审申报事件之前,项目的状态为:{}"+project.getStatus());
if (StateMachineUtils.isCityProject(project) && StateMachineUtils.judgeDeclareAmount(project)){
project.setStatus(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS.getCode());
}else {
project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode());
}
switch (projectStatusEnum){
case PENDING_PREQUALIFICATION_CHOICE:
preDeclareChoice(stateContext);
break;
case PREQUALIFICATION_WITHDRAW_CHOICE:
preWithDrawChoice(stateContext);

}
}

private void preDeclareChoice(StateContext<ProjectStatusEnum, ProjectStatusChangeEvent> stateContext) {
Project project = stateContext.getMessage().getHeaders().get(PROJECT_DECLARE, Project.class);
log.info("预审申报事件之前,项目的状态为:{}"+project.getStatus());
if (StateMachineUtils.isCityProject(project) && StateMachineUtils.judgeDeclareAmount(project)){
project.setStatus(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS.getCode());
}else {
project.setStatus(ProjectStatusEnum.PRE_APPLYING.getCode());
}
}

private void preWithDrawChoice(StateContext<ProjectStatusEnum, ProjectStatusChangeEvent> stateContext) {
Project project = stateContext.getMessage().getHeaders().get(PROJECT_DECLARE, Project.class);
log.info("预审中撤回事件之前,项目的状态为:{}"+project.getStatus());
if (StateMachineUtils.isCityProject(project) && StateMachineUtils.judgeDeclareAmount(project)){
project.setStatus(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS.getCode());
}else {
project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode());
}
}
}

+ 11
- 10
pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/builder/ProjectDeclareStateMachineBuilder.java View File

@@ -34,7 +34,6 @@ import java.util.EnumSet;
@RequiredArgsConstructor
public class ProjectDeclareStateMachineBuilder {
private static final ProjectDeclareGuardFactory projectDeclareGuardFactory = new ProjectDeclareGuardFactory();
private static final ProjectDeclareAction projectDeclareAction = new ProjectDeclareAction();
private final BeanFactory beanFactory;
private Logger logger = LoggerFactory.getLogger(getClass());
/**
@@ -87,6 +86,7 @@ public class ProjectDeclareStateMachineBuilder {
.source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS)
.target(ProjectStatusEnum.UNDER_INTERNAL_AUDIT)
.event(ProjectStatusChangeEvent.PROJECT_APPLICATION_SUBMIT).and()

// 待预审预审申报,从待预审到待预审选择
.withExternal()
.source(ProjectStatusEnum.PENDING_PREQUALIFICATION)
@@ -95,8 +95,9 @@ public class ProjectDeclareStateMachineBuilder {
// 待预审申报,从待预审选择->省级部门联审中,预审中,完成其中一种状态
.withChoice()
.source(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE)
.first(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS,projectDeclareGuardFactory.new PendingPreQualificationChoiceGuard(),projectDeclareAction.new ProjectDeclareChoiceAction())
.last(ProjectStatusEnum.PRE_APPLYING,projectDeclareAction.new ProjectDeclareChoiceAction()).and()
.first(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS,projectDeclareGuardFactory.new PendingPreQualificationChoiceGuard(),new ProjectDeclareChoiceAction())
.last(ProjectStatusEnum.PRE_APPLYING,new ProjectDeclareChoiceAction()).and()

// 省级部门联审通过,从省级部门联审中到省级部门联审成功
.withExternal()
.source(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS)
@@ -112,7 +113,7 @@ public class ProjectDeclareStateMachineBuilder {
.source(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS)
.target(ProjectStatusEnum.THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED)
.event(ProjectStatusChangeEvent.PROVINCIAL_DEPARTMENT_REVIEW_REJECT).and()
// 省级部门联审中撤回,从省级部门联审中到省级部门联审不通过
// 省级部门联审中撤回,从省级部门联审中到待预审
.withExternal()
.source(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS)
.target(ProjectStatusEnum.PENDING_PREQUALIFICATION)
@@ -128,17 +129,17 @@ public class ProjectDeclareStateMachineBuilder {
.source(ProjectStatusEnum.PRE_APPLYING)
.target(ProjectStatusEnum.PREQUALIFICATION_FAILED)
.event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_REJECT).and()
// 预审中撤回,从预审中到预审选择
// 预审中撤回,从预审中到预审中撤回选择
.withExternal()
.source(ProjectStatusEnum.PRE_APPLYING)
.target(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE)
.target(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE)
.event(ProjectStatusChangeEvent.PRE_APPLYING_WITHDRAW).and()
// 预审中撤回,从预审选择->省级部门联审成功,待预审,完成其中一种状态
// 预审中撤回,从预审中撤回选择->省级部门联审成功,待预审,完成其中一种状态
.withChoice()
.source(ProjectStatusEnum.PRE_APPLYING)
.first(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS,projectDeclareGuardFactory.new PendingPreQualificationChoiceGuard()
,new ProjectDeclareChoiceAction())
.last(ProjectStatusEnum.PENDING_PREQUALIFICATION,projectDeclareAction.new ProjectDeclareChoiceAction()).and()
.last(ProjectStatusEnum.PENDING_PREQUALIFICATION,new ProjectDeclareChoiceAction()).and()
// 预审不通过重新提交,从预审不通过到待预审选择
.withExternal()
.source(ProjectStatusEnum.PREQUALIFICATION_FAILED)
@@ -147,8 +148,8 @@ public class ProjectDeclareStateMachineBuilder {
// 预审不通过重新提交,从待预审选择->省级部门联审中,预审中,完成其中一种状态
.withChoice()
.source(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE)
.first(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS,projectDeclareGuardFactory.new PendingPreQualificationChoiceGuard(),projectDeclareAction.new ProjectDeclareChoiceAction())
.last(ProjectStatusEnum.PRE_APPLYING,projectDeclareAction.new ProjectDeclareChoiceAction()).and()
.first(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS,projectDeclareGuardFactory.new PendingPreQualificationChoiceGuard(),new ProjectDeclareChoiceAction())
.last(ProjectStatusEnum.PRE_APPLYING,new ProjectDeclareChoiceAction()).and()
// 部门联审通过,从部门联审中到年度计划中
.withExternal()
.source(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW)


+ 1
- 0
pmapi/src/main/java/com/ningdatech/pmapi/projectlib/enumeration/ProjectStatusEnum.java View File

@@ -44,6 +44,7 @@ public enum ProjectStatusEnum {
TO_BE_DECLARED(10015, "待申报"),
PLAN_TO_BE_DECLARED(10016, "方案待申报"),
PENDING_PREQUALIFICATION_CHOICE(10017, "待预审选择态"),
PREQUALIFICATION_WITHDRAW_CHOICE(10019, "预审中撤回选择态"),
/**
* 项目阶段:已立项
*/


Loading…
Cancel
Save