@@ -13,10 +13,25 @@ public enum CommonEnum { | |||
/** | |||
* 公共的一些枚举 | |||
*/ | |||
YES(1,"是"), | |||
NO(0,"否"); | |||
YES(1,"是",1), | |||
NO(0,"否",1), | |||
LS_SBJ(331100,"市本级",2), | |||
LS_LD(331102,"莲都区",2), | |||
LS_QT(331121,"青田县",2), | |||
LS_JY(331122,"缙云县",2), | |||
LS_SC(331123,"遂昌县",2), | |||
LS_SY(331124,"松阳县",2), | |||
LS_YH(331125,"云和县",2), | |||
LS_QY(331126,"庆元县",2), | |||
LS_JN(331127,"景宁畲族自治县",2), | |||
LS_LQ(331181,"龙泉市",2), | |||
LS_KFQ(331199,"开发区",2); | |||
private Integer code; | |||
private String desc; | |||
private Integer groupId; | |||
} |
@@ -2,6 +2,7 @@ package com.ningdatech.pmapi.common.statemachine.action; | |||
import com.ningdatech.pmapi.common.constant.StateMachineConst; | |||
import com.ningdatech.pmapi.common.statemachine.builder.ProjectDeclareStateMachineBuilder; | |||
import com.ningdatech.pmapi.common.statemachine.contants.RegionContant; | |||
import com.ningdatech.pmapi.common.statemachine.util.StateMachineUtils; | |||
import com.ningdatech.pmapi.common.statemachine.event.ProjectStatusChangeEvent; | |||
import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; | |||
@@ -20,7 +21,7 @@ import org.springframework.statemachine.annotation.WithStateMachine; | |||
* @since 2023/02/08 13:48 | |||
*/ | |||
@Slf4j | |||
@WithStateMachine(id = ProjectDeclareStateMachineBuilder.MACHINEID_TO) | |||
@WithStateMachine(id = RegionContant.LS_SBJ_CODE) | |||
public class ProjectDeclareAction { | |||
private static final String PROJECT_DECLARE = StateMachineConst.PROJECT_DECLARE; | |||
@@ -0,0 +1,269 @@ | |||
package com.ningdatech.pmapi.common.statemachine.action; | |||
import com.ningdatech.pmapi.common.constant.StateMachineConst; | |||
import com.ningdatech.pmapi.common.statemachine.builder.ProjectDeclareStateMachineBuilder; | |||
import com.ningdatech.pmapi.common.statemachine.contants.RegionContant; | |||
import com.ningdatech.pmapi.common.statemachine.event.ProjectStatusChangeEvent; | |||
import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; | |||
import com.ningdatech.pmapi.projectlib.model.entity.Project; | |||
import lombok.extern.slf4j.Slf4j; | |||
import org.springframework.messaging.Message; | |||
import org.springframework.statemachine.annotation.OnTransition; | |||
import org.springframework.statemachine.annotation.WithStateMachine; | |||
/** | |||
* 项目申报状态机action集合类 | |||
* 景宁畲族自治县 | |||
* @author CMM | |||
* @since 2023/02/08 13:48 | |||
*/ | |||
@Slf4j | |||
@WithStateMachine(id = RegionContant.LS_JN_CODE) | |||
public class ProjectDeclareJNAction { | |||
private static final String PROJECT_DECLARE = StateMachineConst.PROJECT_DECLARE; | |||
@OnTransition(source = "UNDER_INTERNAL_AUDIT", target = "PENDING_PREQUALIFICATION") | |||
public void UNDER_INTERNAL_PASS(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode()); | |||
} | |||
@OnTransition(source = "UNDER_INTERNAL_AUDIT", target = "UNDER_INTERNAL_AUDIT_NOT_PASS") | |||
public void UNDER_INTERNAL_REJECT(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS.getCode()); | |||
} | |||
@OnTransition(source = "UNDER_INTERNAL_AUDIT", target = "TO_BE_DECLARED") | |||
public void UNDER_INTERNAL_WITHDRAW(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.TO_BE_DECLARED.getCode()); | |||
} | |||
@OnTransition(source = "UNDER_INTERNAL_AUDIT_NOT_PASS", target = "UNDER_INTERNAL_AUDIT") | |||
public void UNDER_INTERNAL_REJECT_RESUBMIT(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT.getCode()); | |||
} | |||
@OnTransition(source = "PENDING_PREQUALIFICATION", target = "PENDING_PREQUALIFICATION_CHOICE") | |||
public void PRELIMINARY_REVIEW_DECLARE(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE.getCode()); | |||
} | |||
@OnTransition(source = "PENDING_PREQUALIFICATION", target = "UNDER_INTERNAL_AUDIT") | |||
public void PENDING_PREQUALIFICATION_WITHDRAW(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT.getCode()); | |||
} | |||
@OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS", target = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS") | |||
public void PROVINCIAL_DEPARTMENT_REVIEW_PASS(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS.getCode()); | |||
} | |||
@OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS", target = "PRE_APPLYING") | |||
public void PROVINCIAL_PASS_TO_PRELIMINARY_REVIEW(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.PRE_APPLYING.getCode()); | |||
} | |||
@OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS", target = "THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED") | |||
public void PROVINCIAL_DEPARTMENT_REVIEW_REJECT(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED.getCode()); | |||
} | |||
@OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS", target = "PENDING_PREQUALIFICATION") | |||
public void JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_WITHDRAW(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode()); | |||
} | |||
@OnTransition(source = "PRE_APPLYING", target = "DEPARTMENT_JOINT_REVIEW") | |||
public void PRELIMINARY_REVIEW_PASS(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW.getCode()); | |||
} | |||
@OnTransition(source = "PRE_APPLYING", target = "PREQUALIFICATION_FAILED") | |||
public void PRELIMINARY_REVIEW_REJECT(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.PREQUALIFICATION_FAILED.getCode()); | |||
} | |||
@OnTransition(source = "PREQUALIFICATION_FAILED", target = "PENDING_PREQUALIFICATION_CHOICE") | |||
public void PRELIMINARY_REVIEW_REJECT_RESUBMIT(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE.getCode()); | |||
} | |||
@OnTransition(source = "PRE_APPLYING", target = "PREQUALIFICATION_WITHDRAW_CHOICE") | |||
public void PRE_APPLYING_WITHDRAW(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE.getCode()); | |||
} | |||
@OnTransition(source = "DEPARTMENT_JOINT_REVIEW", target = "IN_THE_ANNUAL_PLAN") | |||
public void DEPARTMENT_UNITED_REVIEW_PASS(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.IN_THE_ANNUAL_PLAN.getCode()); | |||
} | |||
@OnTransition(source = "DEPARTMENT_JOINT_REVIEW", target = "DEPARTMENT_JOINT_REVIEW_FAILED") | |||
public void DEPARTMENT_UNITED_REVIEW_REJECT(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW_FAILED.getCode()); | |||
} | |||
@OnTransition(source = "DEPARTMENT_JOINT_REVIEW", target = "PRE_APPLYING") | |||
public void DEPARTMENT_JOINT_REVIEW_WITHDRAW(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.PRE_APPLYING.getCode()); | |||
} | |||
@OnTransition(source = "IN_THE_ANNUAL_PLAN", target = "PLAN_TO_BE_DECLARED") | |||
public void ANNUAL_PLAN_PROJECT_OPEN_PLAN_DECLARE(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.PLAN_TO_BE_DECLARED.getCode()); | |||
} | |||
@OnTransition(source = "IN_THE_ANNUAL_PLAN", target = "BE_SUSPENDED") | |||
public void ANNUAL_PLAN_SUSPEND(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.BE_SUSPENDED.getCode()); | |||
} | |||
@OnTransition(source = "IN_THE_ANNUAL_PLAN", target = "DEPARTMENT_JOINT_REVIEW") | |||
public void IN_THE_ANNUAL_PLAN_WITHDRAW(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW.getCode()); | |||
} | |||
@OnTransition(source = "PLAN_TO_BE_DECLARED", target = "SCHEME_UNDER_REVIEW") | |||
public void DECLARE_PLAN(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); | |||
} | |||
@OnTransition(source = "PLAN_TO_BE_DECLARED", target = "IN_THE_ANNUAL_PLAN") | |||
public void PLAN_TO_DECLARE_WITHDRAW(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.IN_THE_ANNUAL_PLAN.getCode()); | |||
} | |||
@OnTransition(source = "SCHEME_REVIEW_FAILED", target = "SCHEME_UNDER_REVIEW") | |||
public void DECLARE_PLAN_RESUBMIT(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); | |||
} | |||
@OnTransition(source = "SCHEME_UNDER_REVIEW", target = "TO_BE_APPROVED") | |||
public void PLAN_REVIEW_PASS(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.TO_BE_APPROVED.getCode()); | |||
} | |||
@OnTransition(source = "SCHEME_UNDER_REVIEW", target = "SCHEME_REVIEW_FAILED") | |||
public void PLAN_REVIEW_REJECT(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.SCHEME_REVIEW_FAILED.getCode()); | |||
} | |||
@OnTransition(source = "SCHEME_REVIEW_FAILED", target = "SCHEME_UNDER_REVIEW") | |||
public void PLAN_REVIEW_REJECT_RESUBMIT(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); | |||
} | |||
@OnTransition(source = "SCHEME_UNDER_REVIEW", target = "PLAN_TO_BE_DECLARED") | |||
public void SCHEME_UNDER_REVIEW_WITHDRAW(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.PLAN_TO_BE_DECLARED.getCode()); | |||
} | |||
@OnTransition(source = "TO_BE_APPROVED", target = "TO_BE_PURCHASED") | |||
public void PROJECT_APPROVAL(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
// 待立项批复批复后,项目一级状态变更为已立项 | |||
project.setStage(ProjectStatusEnum.PROJECT_APPROVED.getCode()); | |||
project.setStatus(ProjectStatusEnum.TO_BE_PURCHASED.getCode()); | |||
} | |||
@OnTransition(source = "TO_BE_APPROVED", target = "SCHEME_UNDER_REVIEW") | |||
public void TO_BE_APPROVED_WITHDRAW(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); | |||
} | |||
@OnTransition(source = "TO_BE_PURCHASED", target = "UNDER_CONSTRUCTION") | |||
public void PURCHASE_PUT_ON_RECORD(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.UNDER_CONSTRUCTION.getCode()); | |||
} | |||
@OnTransition(source = "TO_BE_PURCHASED", target = "TO_BE_APPROVED") | |||
public void TO_BE_PURCHASED_WITHDRAW(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
// 待采购状态撤回后,项目一级状态回退到未立项 | |||
project.setStage(ProjectStatusEnum.NOT_APPROVED.getCode()); | |||
project.setStatus(ProjectStatusEnum.TO_BE_APPROVED.getCode()); | |||
} | |||
@OnTransition(source = "UNDER_CONSTRUCTION", target = "TO_BE_FINALLY_INSPECTED") | |||
public void PRELIMINARY_ACCEPTANCE_PUT_ON_RECORD(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.TO_BE_FINALLY_INSPECTED.getCode()); | |||
} | |||
@OnTransition(source = "UNDER_CONSTRUCTION", target = "TO_BE_PURCHASED") | |||
public void UNDER_CONSTRUCTION_WITHDRAW(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.TO_BE_PURCHASED.getCode()); | |||
} | |||
@OnTransition(source = "TO_BE_FINALLY_INSPECTED", target = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW") | |||
public void FINAL_ACCEPTANCE_APPLICATION(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW.getCode()); | |||
} | |||
@OnTransition(source = "TO_BE_FINALLY_INSPECTED", target = "UNDER_CONSTRUCTION") | |||
public void TO_BE_FINALLY_INSPECTED_WITHDRAW(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.UNDER_CONSTRUCTION.getCode()); | |||
} | |||
@OnTransition(source = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW", target = "ARCHIVED") | |||
public void FINAL_ACCEPTANCE_PASS(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
// 终验审核通过后,项目一级状态变更为已归档 | |||
project.setStage(ProjectStatusEnum.ARCHIVED.getCode()); | |||
project.setStatus(ProjectStatusEnum.ACCEPTED.getCode()); | |||
} | |||
@OnTransition(source = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW", target = "FINAL_ACCEPTANCE_REVIEW_FAILED") | |||
public void FINAL_ACCEPTANCE_REJECT(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.FINAL_ACCEPTANCE_REVIEW_FAILED.getCode()); | |||
} | |||
@OnTransition(source = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW", target = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW") | |||
public void FINAL_ACCEPTANCE_IS_UNDER_REVIEW_WITHDRAW(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW.getCode()); | |||
} | |||
} |
@@ -0,0 +1,268 @@ | |||
package com.ningdatech.pmapi.common.statemachine.action; | |||
import com.ningdatech.pmapi.common.constant.StateMachineConst; | |||
import com.ningdatech.pmapi.common.statemachine.contants.RegionContant; | |||
import com.ningdatech.pmapi.common.statemachine.event.ProjectStatusChangeEvent; | |||
import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; | |||
import com.ningdatech.pmapi.projectlib.model.entity.Project; | |||
import lombok.extern.slf4j.Slf4j; | |||
import org.springframework.messaging.Message; | |||
import org.springframework.statemachine.annotation.OnTransition; | |||
import org.springframework.statemachine.annotation.WithStateMachine; | |||
/** | |||
* 项目申报状态机action集合类 | |||
* 缙云县 | |||
* @author CMM | |||
* @since 2023/02/08 13:48 | |||
*/ | |||
@Slf4j | |||
@WithStateMachine(id = RegionContant.LS_JY_CODE) | |||
public class ProjectDeclareJYAction { | |||
private static final String PROJECT_DECLARE = StateMachineConst.PROJECT_DECLARE; | |||
@OnTransition(source = "UNDER_INTERNAL_AUDIT", target = "PENDING_PREQUALIFICATION") | |||
public void UNDER_INTERNAL_PASS(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode()); | |||
} | |||
@OnTransition(source = "UNDER_INTERNAL_AUDIT", target = "UNDER_INTERNAL_AUDIT_NOT_PASS") | |||
public void UNDER_INTERNAL_REJECT(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS.getCode()); | |||
} | |||
@OnTransition(source = "UNDER_INTERNAL_AUDIT", target = "TO_BE_DECLARED") | |||
public void UNDER_INTERNAL_WITHDRAW(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.TO_BE_DECLARED.getCode()); | |||
} | |||
@OnTransition(source = "UNDER_INTERNAL_AUDIT_NOT_PASS", target = "UNDER_INTERNAL_AUDIT") | |||
public void UNDER_INTERNAL_REJECT_RESUBMIT(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT.getCode()); | |||
} | |||
@OnTransition(source = "PENDING_PREQUALIFICATION", target = "PENDING_PREQUALIFICATION_CHOICE") | |||
public void PRELIMINARY_REVIEW_DECLARE(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE.getCode()); | |||
} | |||
@OnTransition(source = "PENDING_PREQUALIFICATION", target = "UNDER_INTERNAL_AUDIT") | |||
public void PENDING_PREQUALIFICATION_WITHDRAW(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT.getCode()); | |||
} | |||
@OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS", target = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS") | |||
public void PROVINCIAL_DEPARTMENT_REVIEW_PASS(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS.getCode()); | |||
} | |||
@OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS", target = "PRE_APPLYING") | |||
public void PROVINCIAL_PASS_TO_PRELIMINARY_REVIEW(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.PRE_APPLYING.getCode()); | |||
} | |||
@OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS", target = "THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED") | |||
public void PROVINCIAL_DEPARTMENT_REVIEW_REJECT(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED.getCode()); | |||
} | |||
@OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS", target = "PENDING_PREQUALIFICATION") | |||
public void JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_WITHDRAW(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode()); | |||
} | |||
@OnTransition(source = "PRE_APPLYING", target = "DEPARTMENT_JOINT_REVIEW") | |||
public void PRELIMINARY_REVIEW_PASS(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW.getCode()); | |||
} | |||
@OnTransition(source = "PRE_APPLYING", target = "PREQUALIFICATION_FAILED") | |||
public void PRELIMINARY_REVIEW_REJECT(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.PREQUALIFICATION_FAILED.getCode()); | |||
} | |||
@OnTransition(source = "PREQUALIFICATION_FAILED", target = "PENDING_PREQUALIFICATION_CHOICE") | |||
public void PRELIMINARY_REVIEW_REJECT_RESUBMIT(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE.getCode()); | |||
} | |||
@OnTransition(source = "PRE_APPLYING", target = "PREQUALIFICATION_WITHDRAW_CHOICE") | |||
public void PRE_APPLYING_WITHDRAW(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE.getCode()); | |||
} | |||
@OnTransition(source = "DEPARTMENT_JOINT_REVIEW", target = "IN_THE_ANNUAL_PLAN") | |||
public void DEPARTMENT_UNITED_REVIEW_PASS(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.IN_THE_ANNUAL_PLAN.getCode()); | |||
} | |||
@OnTransition(source = "DEPARTMENT_JOINT_REVIEW", target = "DEPARTMENT_JOINT_REVIEW_FAILED") | |||
public void DEPARTMENT_UNITED_REVIEW_REJECT(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW_FAILED.getCode()); | |||
} | |||
@OnTransition(source = "DEPARTMENT_JOINT_REVIEW", target = "PRE_APPLYING") | |||
public void DEPARTMENT_JOINT_REVIEW_WITHDRAW(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.PRE_APPLYING.getCode()); | |||
} | |||
@OnTransition(source = "IN_THE_ANNUAL_PLAN", target = "PLAN_TO_BE_DECLARED") | |||
public void ANNUAL_PLAN_PROJECT_OPEN_PLAN_DECLARE(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.PLAN_TO_BE_DECLARED.getCode()); | |||
} | |||
@OnTransition(source = "IN_THE_ANNUAL_PLAN", target = "BE_SUSPENDED") | |||
public void ANNUAL_PLAN_SUSPEND(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.BE_SUSPENDED.getCode()); | |||
} | |||
@OnTransition(source = "IN_THE_ANNUAL_PLAN", target = "DEPARTMENT_JOINT_REVIEW") | |||
public void IN_THE_ANNUAL_PLAN_WITHDRAW(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW.getCode()); | |||
} | |||
@OnTransition(source = "PLAN_TO_BE_DECLARED", target = "SCHEME_UNDER_REVIEW") | |||
public void DECLARE_PLAN(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); | |||
} | |||
@OnTransition(source = "PLAN_TO_BE_DECLARED", target = "IN_THE_ANNUAL_PLAN") | |||
public void PLAN_TO_DECLARE_WITHDRAW(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.IN_THE_ANNUAL_PLAN.getCode()); | |||
} | |||
@OnTransition(source = "SCHEME_REVIEW_FAILED", target = "SCHEME_UNDER_REVIEW") | |||
public void DECLARE_PLAN_RESUBMIT(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); | |||
} | |||
@OnTransition(source = "SCHEME_UNDER_REVIEW", target = "TO_BE_APPROVED") | |||
public void PLAN_REVIEW_PASS(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.TO_BE_APPROVED.getCode()); | |||
} | |||
@OnTransition(source = "SCHEME_UNDER_REVIEW", target = "SCHEME_REVIEW_FAILED") | |||
public void PLAN_REVIEW_REJECT(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.SCHEME_REVIEW_FAILED.getCode()); | |||
} | |||
@OnTransition(source = "SCHEME_REVIEW_FAILED", target = "SCHEME_UNDER_REVIEW") | |||
public void PLAN_REVIEW_REJECT_RESUBMIT(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); | |||
} | |||
@OnTransition(source = "SCHEME_UNDER_REVIEW", target = "PLAN_TO_BE_DECLARED") | |||
public void SCHEME_UNDER_REVIEW_WITHDRAW(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.PLAN_TO_BE_DECLARED.getCode()); | |||
} | |||
@OnTransition(source = "TO_BE_APPROVED", target = "TO_BE_PURCHASED") | |||
public void PROJECT_APPROVAL(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
// 待立项批复批复后,项目一级状态变更为已立项 | |||
project.setStage(ProjectStatusEnum.PROJECT_APPROVED.getCode()); | |||
project.setStatus(ProjectStatusEnum.TO_BE_PURCHASED.getCode()); | |||
} | |||
@OnTransition(source = "TO_BE_APPROVED", target = "SCHEME_UNDER_REVIEW") | |||
public void TO_BE_APPROVED_WITHDRAW(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); | |||
} | |||
@OnTransition(source = "TO_BE_PURCHASED", target = "UNDER_CONSTRUCTION") | |||
public void PURCHASE_PUT_ON_RECORD(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.UNDER_CONSTRUCTION.getCode()); | |||
} | |||
@OnTransition(source = "TO_BE_PURCHASED", target = "TO_BE_APPROVED") | |||
public void TO_BE_PURCHASED_WITHDRAW(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
// 待采购状态撤回后,项目一级状态回退到未立项 | |||
project.setStage(ProjectStatusEnum.NOT_APPROVED.getCode()); | |||
project.setStatus(ProjectStatusEnum.TO_BE_APPROVED.getCode()); | |||
} | |||
@OnTransition(source = "UNDER_CONSTRUCTION", target = "TO_BE_FINALLY_INSPECTED") | |||
public void PRELIMINARY_ACCEPTANCE_PUT_ON_RECORD(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.TO_BE_FINALLY_INSPECTED.getCode()); | |||
} | |||
@OnTransition(source = "UNDER_CONSTRUCTION", target = "TO_BE_PURCHASED") | |||
public void UNDER_CONSTRUCTION_WITHDRAW(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.TO_BE_PURCHASED.getCode()); | |||
} | |||
@OnTransition(source = "TO_BE_FINALLY_INSPECTED", target = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW") | |||
public void FINAL_ACCEPTANCE_APPLICATION(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW.getCode()); | |||
} | |||
@OnTransition(source = "TO_BE_FINALLY_INSPECTED", target = "UNDER_CONSTRUCTION") | |||
public void TO_BE_FINALLY_INSPECTED_WITHDRAW(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.UNDER_CONSTRUCTION.getCode()); | |||
} | |||
@OnTransition(source = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW", target = "ARCHIVED") | |||
public void FINAL_ACCEPTANCE_PASS(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
// 终验审核通过后,项目一级状态变更为已归档 | |||
project.setStage(ProjectStatusEnum.ARCHIVED.getCode()); | |||
project.setStatus(ProjectStatusEnum.ACCEPTED.getCode()); | |||
} | |||
@OnTransition(source = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW", target = "FINAL_ACCEPTANCE_REVIEW_FAILED") | |||
public void FINAL_ACCEPTANCE_REJECT(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.FINAL_ACCEPTANCE_REVIEW_FAILED.getCode()); | |||
} | |||
@OnTransition(source = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW", target = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW") | |||
public void FINAL_ACCEPTANCE_IS_UNDER_REVIEW_WITHDRAW(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW.getCode()); | |||
} | |||
} |
@@ -0,0 +1,268 @@ | |||
package com.ningdatech.pmapi.common.statemachine.action; | |||
import com.ningdatech.pmapi.common.constant.StateMachineConst; | |||
import com.ningdatech.pmapi.common.statemachine.contants.RegionContant; | |||
import com.ningdatech.pmapi.common.statemachine.event.ProjectStatusChangeEvent; | |||
import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; | |||
import com.ningdatech.pmapi.projectlib.model.entity.Project; | |||
import lombok.extern.slf4j.Slf4j; | |||
import org.springframework.messaging.Message; | |||
import org.springframework.statemachine.annotation.OnTransition; | |||
import org.springframework.statemachine.annotation.WithStateMachine; | |||
/** | |||
* 项目申报状态机action集合类 | |||
* 开发区 | |||
* @author CMM | |||
* @since 2023/02/08 13:48 | |||
*/ | |||
@Slf4j | |||
@WithStateMachine(id = RegionContant.LS_KFQ_CODE) | |||
public class ProjectDeclareKFBAction { | |||
private static final String PROJECT_DECLARE = StateMachineConst.PROJECT_DECLARE; | |||
@OnTransition(source = "UNDER_INTERNAL_AUDIT", target = "PENDING_PREQUALIFICATION") | |||
public void UNDER_INTERNAL_PASS(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode()); | |||
} | |||
@OnTransition(source = "UNDER_INTERNAL_AUDIT", target = "UNDER_INTERNAL_AUDIT_NOT_PASS") | |||
public void UNDER_INTERNAL_REJECT(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS.getCode()); | |||
} | |||
@OnTransition(source = "UNDER_INTERNAL_AUDIT", target = "TO_BE_DECLARED") | |||
public void UNDER_INTERNAL_WITHDRAW(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.TO_BE_DECLARED.getCode()); | |||
} | |||
@OnTransition(source = "UNDER_INTERNAL_AUDIT_NOT_PASS", target = "UNDER_INTERNAL_AUDIT") | |||
public void UNDER_INTERNAL_REJECT_RESUBMIT(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT.getCode()); | |||
} | |||
@OnTransition(source = "PENDING_PREQUALIFICATION", target = "PENDING_PREQUALIFICATION_CHOICE") | |||
public void PRELIMINARY_REVIEW_DECLARE(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE.getCode()); | |||
} | |||
@OnTransition(source = "PENDING_PREQUALIFICATION", target = "UNDER_INTERNAL_AUDIT") | |||
public void PENDING_PREQUALIFICATION_WITHDRAW(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT.getCode()); | |||
} | |||
@OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS", target = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS") | |||
public void PROVINCIAL_DEPARTMENT_REVIEW_PASS(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS.getCode()); | |||
} | |||
@OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS", target = "PRE_APPLYING") | |||
public void PROVINCIAL_PASS_TO_PRELIMINARY_REVIEW(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.PRE_APPLYING.getCode()); | |||
} | |||
@OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS", target = "THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED") | |||
public void PROVINCIAL_DEPARTMENT_REVIEW_REJECT(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED.getCode()); | |||
} | |||
@OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS", target = "PENDING_PREQUALIFICATION") | |||
public void JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_WITHDRAW(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode()); | |||
} | |||
@OnTransition(source = "PRE_APPLYING", target = "DEPARTMENT_JOINT_REVIEW") | |||
public void PRELIMINARY_REVIEW_PASS(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW.getCode()); | |||
} | |||
@OnTransition(source = "PRE_APPLYING", target = "PREQUALIFICATION_FAILED") | |||
public void PRELIMINARY_REVIEW_REJECT(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.PREQUALIFICATION_FAILED.getCode()); | |||
} | |||
@OnTransition(source = "PREQUALIFICATION_FAILED", target = "PENDING_PREQUALIFICATION_CHOICE") | |||
public void PRELIMINARY_REVIEW_REJECT_RESUBMIT(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE.getCode()); | |||
} | |||
@OnTransition(source = "PRE_APPLYING", target = "PREQUALIFICATION_WITHDRAW_CHOICE") | |||
public void PRE_APPLYING_WITHDRAW(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE.getCode()); | |||
} | |||
@OnTransition(source = "DEPARTMENT_JOINT_REVIEW", target = "IN_THE_ANNUAL_PLAN") | |||
public void DEPARTMENT_UNITED_REVIEW_PASS(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.IN_THE_ANNUAL_PLAN.getCode()); | |||
} | |||
@OnTransition(source = "DEPARTMENT_JOINT_REVIEW", target = "DEPARTMENT_JOINT_REVIEW_FAILED") | |||
public void DEPARTMENT_UNITED_REVIEW_REJECT(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW_FAILED.getCode()); | |||
} | |||
@OnTransition(source = "DEPARTMENT_JOINT_REVIEW", target = "PRE_APPLYING") | |||
public void DEPARTMENT_JOINT_REVIEW_WITHDRAW(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.PRE_APPLYING.getCode()); | |||
} | |||
@OnTransition(source = "IN_THE_ANNUAL_PLAN", target = "PLAN_TO_BE_DECLARED") | |||
public void ANNUAL_PLAN_PROJECT_OPEN_PLAN_DECLARE(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.PLAN_TO_BE_DECLARED.getCode()); | |||
} | |||
@OnTransition(source = "IN_THE_ANNUAL_PLAN", target = "BE_SUSPENDED") | |||
public void ANNUAL_PLAN_SUSPEND(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.BE_SUSPENDED.getCode()); | |||
} | |||
@OnTransition(source = "IN_THE_ANNUAL_PLAN", target = "DEPARTMENT_JOINT_REVIEW") | |||
public void IN_THE_ANNUAL_PLAN_WITHDRAW(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW.getCode()); | |||
} | |||
@OnTransition(source = "PLAN_TO_BE_DECLARED", target = "SCHEME_UNDER_REVIEW") | |||
public void DECLARE_PLAN(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); | |||
} | |||
@OnTransition(source = "PLAN_TO_BE_DECLARED", target = "IN_THE_ANNUAL_PLAN") | |||
public void PLAN_TO_DECLARE_WITHDRAW(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.IN_THE_ANNUAL_PLAN.getCode()); | |||
} | |||
@OnTransition(source = "SCHEME_REVIEW_FAILED", target = "SCHEME_UNDER_REVIEW") | |||
public void DECLARE_PLAN_RESUBMIT(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); | |||
} | |||
@OnTransition(source = "SCHEME_UNDER_REVIEW", target = "TO_BE_APPROVED") | |||
public void PLAN_REVIEW_PASS(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.TO_BE_APPROVED.getCode()); | |||
} | |||
@OnTransition(source = "SCHEME_UNDER_REVIEW", target = "SCHEME_REVIEW_FAILED") | |||
public void PLAN_REVIEW_REJECT(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.SCHEME_REVIEW_FAILED.getCode()); | |||
} | |||
@OnTransition(source = "SCHEME_REVIEW_FAILED", target = "SCHEME_UNDER_REVIEW") | |||
public void PLAN_REVIEW_REJECT_RESUBMIT(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); | |||
} | |||
@OnTransition(source = "SCHEME_UNDER_REVIEW", target = "PLAN_TO_BE_DECLARED") | |||
public void SCHEME_UNDER_REVIEW_WITHDRAW(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.PLAN_TO_BE_DECLARED.getCode()); | |||
} | |||
@OnTransition(source = "TO_BE_APPROVED", target = "TO_BE_PURCHASED") | |||
public void PROJECT_APPROVAL(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
// 待立项批复批复后,项目一级状态变更为已立项 | |||
project.setStage(ProjectStatusEnum.PROJECT_APPROVED.getCode()); | |||
project.setStatus(ProjectStatusEnum.TO_BE_PURCHASED.getCode()); | |||
} | |||
@OnTransition(source = "TO_BE_APPROVED", target = "SCHEME_UNDER_REVIEW") | |||
public void TO_BE_APPROVED_WITHDRAW(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); | |||
} | |||
@OnTransition(source = "TO_BE_PURCHASED", target = "UNDER_CONSTRUCTION") | |||
public void PURCHASE_PUT_ON_RECORD(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.UNDER_CONSTRUCTION.getCode()); | |||
} | |||
@OnTransition(source = "TO_BE_PURCHASED", target = "TO_BE_APPROVED") | |||
public void TO_BE_PURCHASED_WITHDRAW(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
// 待采购状态撤回后,项目一级状态回退到未立项 | |||
project.setStage(ProjectStatusEnum.NOT_APPROVED.getCode()); | |||
project.setStatus(ProjectStatusEnum.TO_BE_APPROVED.getCode()); | |||
} | |||
@OnTransition(source = "UNDER_CONSTRUCTION", target = "TO_BE_FINALLY_INSPECTED") | |||
public void PRELIMINARY_ACCEPTANCE_PUT_ON_RECORD(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.TO_BE_FINALLY_INSPECTED.getCode()); | |||
} | |||
@OnTransition(source = "UNDER_CONSTRUCTION", target = "TO_BE_PURCHASED") | |||
public void UNDER_CONSTRUCTION_WITHDRAW(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.TO_BE_PURCHASED.getCode()); | |||
} | |||
@OnTransition(source = "TO_BE_FINALLY_INSPECTED", target = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW") | |||
public void FINAL_ACCEPTANCE_APPLICATION(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW.getCode()); | |||
} | |||
@OnTransition(source = "TO_BE_FINALLY_INSPECTED", target = "UNDER_CONSTRUCTION") | |||
public void TO_BE_FINALLY_INSPECTED_WITHDRAW(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.UNDER_CONSTRUCTION.getCode()); | |||
} | |||
@OnTransition(source = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW", target = "ARCHIVED") | |||
public void FINAL_ACCEPTANCE_PASS(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
// 终验审核通过后,项目一级状态变更为已归档 | |||
project.setStage(ProjectStatusEnum.ARCHIVED.getCode()); | |||
project.setStatus(ProjectStatusEnum.ACCEPTED.getCode()); | |||
} | |||
@OnTransition(source = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW", target = "FINAL_ACCEPTANCE_REVIEW_FAILED") | |||
public void FINAL_ACCEPTANCE_REJECT(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.FINAL_ACCEPTANCE_REVIEW_FAILED.getCode()); | |||
} | |||
@OnTransition(source = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW", target = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW") | |||
public void FINAL_ACCEPTANCE_IS_UNDER_REVIEW_WITHDRAW(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW.getCode()); | |||
} | |||
} |
@@ -0,0 +1,268 @@ | |||
package com.ningdatech.pmapi.common.statemachine.action; | |||
import com.ningdatech.pmapi.common.constant.StateMachineConst; | |||
import com.ningdatech.pmapi.common.statemachine.contants.RegionContant; | |||
import com.ningdatech.pmapi.common.statemachine.event.ProjectStatusChangeEvent; | |||
import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; | |||
import com.ningdatech.pmapi.projectlib.model.entity.Project; | |||
import lombok.extern.slf4j.Slf4j; | |||
import org.springframework.messaging.Message; | |||
import org.springframework.statemachine.annotation.OnTransition; | |||
import org.springframework.statemachine.annotation.WithStateMachine; | |||
/** | |||
* 项目申报状态机action集合类 | |||
* 莲都区 | |||
* @author CMM | |||
* @since 2023/02/08 13:48 | |||
*/ | |||
@Slf4j | |||
@WithStateMachine(id = RegionContant.LS_LD_CODE) | |||
public class ProjectDeclareLDAction { | |||
private static final String PROJECT_DECLARE = StateMachineConst.PROJECT_DECLARE; | |||
@OnTransition(source = "UNDER_INTERNAL_AUDIT", target = "PENDING_PREQUALIFICATION") | |||
public void UNDER_INTERNAL_PASS(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode()); | |||
} | |||
@OnTransition(source = "UNDER_INTERNAL_AUDIT", target = "UNDER_INTERNAL_AUDIT_NOT_PASS") | |||
public void UNDER_INTERNAL_REJECT(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS.getCode()); | |||
} | |||
@OnTransition(source = "UNDER_INTERNAL_AUDIT", target = "TO_BE_DECLARED") | |||
public void UNDER_INTERNAL_WITHDRAW(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.TO_BE_DECLARED.getCode()); | |||
} | |||
@OnTransition(source = "UNDER_INTERNAL_AUDIT_NOT_PASS", target = "UNDER_INTERNAL_AUDIT") | |||
public void UNDER_INTERNAL_REJECT_RESUBMIT(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT.getCode()); | |||
} | |||
@OnTransition(source = "PENDING_PREQUALIFICATION", target = "PENDING_PREQUALIFICATION_CHOICE") | |||
public void PRELIMINARY_REVIEW_DECLARE(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE.getCode()); | |||
} | |||
@OnTransition(source = "PENDING_PREQUALIFICATION", target = "UNDER_INTERNAL_AUDIT") | |||
public void PENDING_PREQUALIFICATION_WITHDRAW(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT.getCode()); | |||
} | |||
@OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS", target = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS") | |||
public void PROVINCIAL_DEPARTMENT_REVIEW_PASS(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS.getCode()); | |||
} | |||
@OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS", target = "PRE_APPLYING") | |||
public void PROVINCIAL_PASS_TO_PRELIMINARY_REVIEW(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.PRE_APPLYING.getCode()); | |||
} | |||
@OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS", target = "THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED") | |||
public void PROVINCIAL_DEPARTMENT_REVIEW_REJECT(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED.getCode()); | |||
} | |||
@OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS", target = "PENDING_PREQUALIFICATION") | |||
public void JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_WITHDRAW(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode()); | |||
} | |||
@OnTransition(source = "PRE_APPLYING", target = "DEPARTMENT_JOINT_REVIEW") | |||
public void PRELIMINARY_REVIEW_PASS(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW.getCode()); | |||
} | |||
@OnTransition(source = "PRE_APPLYING", target = "PREQUALIFICATION_FAILED") | |||
public void PRELIMINARY_REVIEW_REJECT(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.PREQUALIFICATION_FAILED.getCode()); | |||
} | |||
@OnTransition(source = "PREQUALIFICATION_FAILED", target = "PENDING_PREQUALIFICATION_CHOICE") | |||
public void PRELIMINARY_REVIEW_REJECT_RESUBMIT(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE.getCode()); | |||
} | |||
@OnTransition(source = "PRE_APPLYING", target = "PREQUALIFICATION_WITHDRAW_CHOICE") | |||
public void PRE_APPLYING_WITHDRAW(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE.getCode()); | |||
} | |||
@OnTransition(source = "DEPARTMENT_JOINT_REVIEW", target = "IN_THE_ANNUAL_PLAN") | |||
public void DEPARTMENT_UNITED_REVIEW_PASS(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.IN_THE_ANNUAL_PLAN.getCode()); | |||
} | |||
@OnTransition(source = "DEPARTMENT_JOINT_REVIEW", target = "DEPARTMENT_JOINT_REVIEW_FAILED") | |||
public void DEPARTMENT_UNITED_REVIEW_REJECT(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW_FAILED.getCode()); | |||
} | |||
@OnTransition(source = "DEPARTMENT_JOINT_REVIEW", target = "PRE_APPLYING") | |||
public void DEPARTMENT_JOINT_REVIEW_WITHDRAW(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.PRE_APPLYING.getCode()); | |||
} | |||
@OnTransition(source = "IN_THE_ANNUAL_PLAN", target = "PLAN_TO_BE_DECLARED") | |||
public void ANNUAL_PLAN_PROJECT_OPEN_PLAN_DECLARE(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.PLAN_TO_BE_DECLARED.getCode()); | |||
} | |||
@OnTransition(source = "IN_THE_ANNUAL_PLAN", target = "BE_SUSPENDED") | |||
public void ANNUAL_PLAN_SUSPEND(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.BE_SUSPENDED.getCode()); | |||
} | |||
@OnTransition(source = "IN_THE_ANNUAL_PLAN", target = "DEPARTMENT_JOINT_REVIEW") | |||
public void IN_THE_ANNUAL_PLAN_WITHDRAW(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW.getCode()); | |||
} | |||
@OnTransition(source = "PLAN_TO_BE_DECLARED", target = "SCHEME_UNDER_REVIEW") | |||
public void DECLARE_PLAN(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); | |||
} | |||
@OnTransition(source = "PLAN_TO_BE_DECLARED", target = "IN_THE_ANNUAL_PLAN") | |||
public void PLAN_TO_DECLARE_WITHDRAW(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.IN_THE_ANNUAL_PLAN.getCode()); | |||
} | |||
@OnTransition(source = "SCHEME_REVIEW_FAILED", target = "SCHEME_UNDER_REVIEW") | |||
public void DECLARE_PLAN_RESUBMIT(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); | |||
} | |||
@OnTransition(source = "SCHEME_UNDER_REVIEW", target = "TO_BE_APPROVED") | |||
public void PLAN_REVIEW_PASS(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.TO_BE_APPROVED.getCode()); | |||
} | |||
@OnTransition(source = "SCHEME_UNDER_REVIEW", target = "SCHEME_REVIEW_FAILED") | |||
public void PLAN_REVIEW_REJECT(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.SCHEME_REVIEW_FAILED.getCode()); | |||
} | |||
@OnTransition(source = "SCHEME_REVIEW_FAILED", target = "SCHEME_UNDER_REVIEW") | |||
public void PLAN_REVIEW_REJECT_RESUBMIT(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); | |||
} | |||
@OnTransition(source = "SCHEME_UNDER_REVIEW", target = "PLAN_TO_BE_DECLARED") | |||
public void SCHEME_UNDER_REVIEW_WITHDRAW(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.PLAN_TO_BE_DECLARED.getCode()); | |||
} | |||
@OnTransition(source = "TO_BE_APPROVED", target = "TO_BE_PURCHASED") | |||
public void PROJECT_APPROVAL(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
// 待立项批复批复后,项目一级状态变更为已立项 | |||
project.setStage(ProjectStatusEnum.PROJECT_APPROVED.getCode()); | |||
project.setStatus(ProjectStatusEnum.TO_BE_PURCHASED.getCode()); | |||
} | |||
@OnTransition(source = "TO_BE_APPROVED", target = "SCHEME_UNDER_REVIEW") | |||
public void TO_BE_APPROVED_WITHDRAW(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); | |||
} | |||
@OnTransition(source = "TO_BE_PURCHASED", target = "UNDER_CONSTRUCTION") | |||
public void PURCHASE_PUT_ON_RECORD(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.UNDER_CONSTRUCTION.getCode()); | |||
} | |||
@OnTransition(source = "TO_BE_PURCHASED", target = "TO_BE_APPROVED") | |||
public void TO_BE_PURCHASED_WITHDRAW(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
// 待采购状态撤回后,项目一级状态回退到未立项 | |||
project.setStage(ProjectStatusEnum.NOT_APPROVED.getCode()); | |||
project.setStatus(ProjectStatusEnum.TO_BE_APPROVED.getCode()); | |||
} | |||
@OnTransition(source = "UNDER_CONSTRUCTION", target = "TO_BE_FINALLY_INSPECTED") | |||
public void PRELIMINARY_ACCEPTANCE_PUT_ON_RECORD(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.TO_BE_FINALLY_INSPECTED.getCode()); | |||
} | |||
@OnTransition(source = "UNDER_CONSTRUCTION", target = "TO_BE_PURCHASED") | |||
public void UNDER_CONSTRUCTION_WITHDRAW(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.TO_BE_PURCHASED.getCode()); | |||
} | |||
@OnTransition(source = "TO_BE_FINALLY_INSPECTED", target = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW") | |||
public void FINAL_ACCEPTANCE_APPLICATION(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW.getCode()); | |||
} | |||
@OnTransition(source = "TO_BE_FINALLY_INSPECTED", target = "UNDER_CONSTRUCTION") | |||
public void TO_BE_FINALLY_INSPECTED_WITHDRAW(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.UNDER_CONSTRUCTION.getCode()); | |||
} | |||
@OnTransition(source = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW", target = "ARCHIVED") | |||
public void FINAL_ACCEPTANCE_PASS(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
// 终验审核通过后,项目一级状态变更为已归档 | |||
project.setStage(ProjectStatusEnum.ARCHIVED.getCode()); | |||
project.setStatus(ProjectStatusEnum.ACCEPTED.getCode()); | |||
} | |||
@OnTransition(source = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW", target = "FINAL_ACCEPTANCE_REVIEW_FAILED") | |||
public void FINAL_ACCEPTANCE_REJECT(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.FINAL_ACCEPTANCE_REVIEW_FAILED.getCode()); | |||
} | |||
@OnTransition(source = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW", target = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW") | |||
public void FINAL_ACCEPTANCE_IS_UNDER_REVIEW_WITHDRAW(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW.getCode()); | |||
} | |||
} |
@@ -0,0 +1,268 @@ | |||
package com.ningdatech.pmapi.common.statemachine.action; | |||
import com.ningdatech.pmapi.common.constant.StateMachineConst; | |||
import com.ningdatech.pmapi.common.statemachine.contants.RegionContant; | |||
import com.ningdatech.pmapi.common.statemachine.event.ProjectStatusChangeEvent; | |||
import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; | |||
import com.ningdatech.pmapi.projectlib.model.entity.Project; | |||
import lombok.extern.slf4j.Slf4j; | |||
import org.springframework.messaging.Message; | |||
import org.springframework.statemachine.annotation.OnTransition; | |||
import org.springframework.statemachine.annotation.WithStateMachine; | |||
/** | |||
* 项目申报状态机action集合类 | |||
* ;龙泉市 | |||
* @author CMM | |||
* @since 2023/02/08 13:48 | |||
*/ | |||
@Slf4j | |||
@WithStateMachine(id = RegionContant.LS_LQ_CODE) | |||
public class ProjectDeclareLQAction { | |||
private static final String PROJECT_DECLARE = StateMachineConst.PROJECT_DECLARE; | |||
@OnTransition(source = "UNDER_INTERNAL_AUDIT", target = "PENDING_PREQUALIFICATION") | |||
public void UNDER_INTERNAL_PASS(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode()); | |||
} | |||
@OnTransition(source = "UNDER_INTERNAL_AUDIT", target = "UNDER_INTERNAL_AUDIT_NOT_PASS") | |||
public void UNDER_INTERNAL_REJECT(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS.getCode()); | |||
} | |||
@OnTransition(source = "UNDER_INTERNAL_AUDIT", target = "TO_BE_DECLARED") | |||
public void UNDER_INTERNAL_WITHDRAW(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.TO_BE_DECLARED.getCode()); | |||
} | |||
@OnTransition(source = "UNDER_INTERNAL_AUDIT_NOT_PASS", target = "UNDER_INTERNAL_AUDIT") | |||
public void UNDER_INTERNAL_REJECT_RESUBMIT(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT.getCode()); | |||
} | |||
@OnTransition(source = "PENDING_PREQUALIFICATION", target = "PENDING_PREQUALIFICATION_CHOICE") | |||
public void PRELIMINARY_REVIEW_DECLARE(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE.getCode()); | |||
} | |||
@OnTransition(source = "PENDING_PREQUALIFICATION", target = "UNDER_INTERNAL_AUDIT") | |||
public void PENDING_PREQUALIFICATION_WITHDRAW(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT.getCode()); | |||
} | |||
@OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS", target = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS") | |||
public void PROVINCIAL_DEPARTMENT_REVIEW_PASS(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS.getCode()); | |||
} | |||
@OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS", target = "PRE_APPLYING") | |||
public void PROVINCIAL_PASS_TO_PRELIMINARY_REVIEW(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.PRE_APPLYING.getCode()); | |||
} | |||
@OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS", target = "THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED") | |||
public void PROVINCIAL_DEPARTMENT_REVIEW_REJECT(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED.getCode()); | |||
} | |||
@OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS", target = "PENDING_PREQUALIFICATION") | |||
public void JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_WITHDRAW(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode()); | |||
} | |||
@OnTransition(source = "PRE_APPLYING", target = "DEPARTMENT_JOINT_REVIEW") | |||
public void PRELIMINARY_REVIEW_PASS(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW.getCode()); | |||
} | |||
@OnTransition(source = "PRE_APPLYING", target = "PREQUALIFICATION_FAILED") | |||
public void PRELIMINARY_REVIEW_REJECT(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.PREQUALIFICATION_FAILED.getCode()); | |||
} | |||
@OnTransition(source = "PREQUALIFICATION_FAILED", target = "PENDING_PREQUALIFICATION_CHOICE") | |||
public void PRELIMINARY_REVIEW_REJECT_RESUBMIT(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE.getCode()); | |||
} | |||
@OnTransition(source = "PRE_APPLYING", target = "PREQUALIFICATION_WITHDRAW_CHOICE") | |||
public void PRE_APPLYING_WITHDRAW(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE.getCode()); | |||
} | |||
@OnTransition(source = "DEPARTMENT_JOINT_REVIEW", target = "IN_THE_ANNUAL_PLAN") | |||
public void DEPARTMENT_UNITED_REVIEW_PASS(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.IN_THE_ANNUAL_PLAN.getCode()); | |||
} | |||
@OnTransition(source = "DEPARTMENT_JOINT_REVIEW", target = "DEPARTMENT_JOINT_REVIEW_FAILED") | |||
public void DEPARTMENT_UNITED_REVIEW_REJECT(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW_FAILED.getCode()); | |||
} | |||
@OnTransition(source = "DEPARTMENT_JOINT_REVIEW", target = "PRE_APPLYING") | |||
public void DEPARTMENT_JOINT_REVIEW_WITHDRAW(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.PRE_APPLYING.getCode()); | |||
} | |||
@OnTransition(source = "IN_THE_ANNUAL_PLAN", target = "PLAN_TO_BE_DECLARED") | |||
public void ANNUAL_PLAN_PROJECT_OPEN_PLAN_DECLARE(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.PLAN_TO_BE_DECLARED.getCode()); | |||
} | |||
@OnTransition(source = "IN_THE_ANNUAL_PLAN", target = "BE_SUSPENDED") | |||
public void ANNUAL_PLAN_SUSPEND(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.BE_SUSPENDED.getCode()); | |||
} | |||
@OnTransition(source = "IN_THE_ANNUAL_PLAN", target = "DEPARTMENT_JOINT_REVIEW") | |||
public void IN_THE_ANNUAL_PLAN_WITHDRAW(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW.getCode()); | |||
} | |||
@OnTransition(source = "PLAN_TO_BE_DECLARED", target = "SCHEME_UNDER_REVIEW") | |||
public void DECLARE_PLAN(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); | |||
} | |||
@OnTransition(source = "PLAN_TO_BE_DECLARED", target = "IN_THE_ANNUAL_PLAN") | |||
public void PLAN_TO_DECLARE_WITHDRAW(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.IN_THE_ANNUAL_PLAN.getCode()); | |||
} | |||
@OnTransition(source = "SCHEME_REVIEW_FAILED", target = "SCHEME_UNDER_REVIEW") | |||
public void DECLARE_PLAN_RESUBMIT(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); | |||
} | |||
@OnTransition(source = "SCHEME_UNDER_REVIEW", target = "TO_BE_APPROVED") | |||
public void PLAN_REVIEW_PASS(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.TO_BE_APPROVED.getCode()); | |||
} | |||
@OnTransition(source = "SCHEME_UNDER_REVIEW", target = "SCHEME_REVIEW_FAILED") | |||
public void PLAN_REVIEW_REJECT(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.SCHEME_REVIEW_FAILED.getCode()); | |||
} | |||
@OnTransition(source = "SCHEME_REVIEW_FAILED", target = "SCHEME_UNDER_REVIEW") | |||
public void PLAN_REVIEW_REJECT_RESUBMIT(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); | |||
} | |||
@OnTransition(source = "SCHEME_UNDER_REVIEW", target = "PLAN_TO_BE_DECLARED") | |||
public void SCHEME_UNDER_REVIEW_WITHDRAW(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.PLAN_TO_BE_DECLARED.getCode()); | |||
} | |||
@OnTransition(source = "TO_BE_APPROVED", target = "TO_BE_PURCHASED") | |||
public void PROJECT_APPROVAL(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
// 待立项批复批复后,项目一级状态变更为已立项 | |||
project.setStage(ProjectStatusEnum.PROJECT_APPROVED.getCode()); | |||
project.setStatus(ProjectStatusEnum.TO_BE_PURCHASED.getCode()); | |||
} | |||
@OnTransition(source = "TO_BE_APPROVED", target = "SCHEME_UNDER_REVIEW") | |||
public void TO_BE_APPROVED_WITHDRAW(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); | |||
} | |||
@OnTransition(source = "TO_BE_PURCHASED", target = "UNDER_CONSTRUCTION") | |||
public void PURCHASE_PUT_ON_RECORD(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.UNDER_CONSTRUCTION.getCode()); | |||
} | |||
@OnTransition(source = "TO_BE_PURCHASED", target = "TO_BE_APPROVED") | |||
public void TO_BE_PURCHASED_WITHDRAW(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
// 待采购状态撤回后,项目一级状态回退到未立项 | |||
project.setStage(ProjectStatusEnum.NOT_APPROVED.getCode()); | |||
project.setStatus(ProjectStatusEnum.TO_BE_APPROVED.getCode()); | |||
} | |||
@OnTransition(source = "UNDER_CONSTRUCTION", target = "TO_BE_FINALLY_INSPECTED") | |||
public void PRELIMINARY_ACCEPTANCE_PUT_ON_RECORD(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.TO_BE_FINALLY_INSPECTED.getCode()); | |||
} | |||
@OnTransition(source = "UNDER_CONSTRUCTION", target = "TO_BE_PURCHASED") | |||
public void UNDER_CONSTRUCTION_WITHDRAW(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.TO_BE_PURCHASED.getCode()); | |||
} | |||
@OnTransition(source = "TO_BE_FINALLY_INSPECTED", target = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW") | |||
public void FINAL_ACCEPTANCE_APPLICATION(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW.getCode()); | |||
} | |||
@OnTransition(source = "TO_BE_FINALLY_INSPECTED", target = "UNDER_CONSTRUCTION") | |||
public void TO_BE_FINALLY_INSPECTED_WITHDRAW(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.UNDER_CONSTRUCTION.getCode()); | |||
} | |||
@OnTransition(source = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW", target = "ARCHIVED") | |||
public void FINAL_ACCEPTANCE_PASS(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
// 终验审核通过后,项目一级状态变更为已归档 | |||
project.setStage(ProjectStatusEnum.ARCHIVED.getCode()); | |||
project.setStatus(ProjectStatusEnum.ACCEPTED.getCode()); | |||
} | |||
@OnTransition(source = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW", target = "FINAL_ACCEPTANCE_REVIEW_FAILED") | |||
public void FINAL_ACCEPTANCE_REJECT(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.FINAL_ACCEPTANCE_REVIEW_FAILED.getCode()); | |||
} | |||
@OnTransition(source = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW", target = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW") | |||
public void FINAL_ACCEPTANCE_IS_UNDER_REVIEW_WITHDRAW(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW.getCode()); | |||
} | |||
} |
@@ -0,0 +1,268 @@ | |||
package com.ningdatech.pmapi.common.statemachine.action; | |||
import com.ningdatech.pmapi.common.constant.StateMachineConst; | |||
import com.ningdatech.pmapi.common.statemachine.contants.RegionContant; | |||
import com.ningdatech.pmapi.common.statemachine.event.ProjectStatusChangeEvent; | |||
import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; | |||
import com.ningdatech.pmapi.projectlib.model.entity.Project; | |||
import lombok.extern.slf4j.Slf4j; | |||
import org.springframework.messaging.Message; | |||
import org.springframework.statemachine.annotation.OnTransition; | |||
import org.springframework.statemachine.annotation.WithStateMachine; | |||
/** | |||
* 项目申报状态机action集合类 | |||
* 青田县 | |||
* @author CMM | |||
* @since 2023/02/08 13:48 | |||
*/ | |||
@Slf4j | |||
@WithStateMachine(id = RegionContant.LS_QT_CODE) | |||
public class ProjectDeclareQTAction { | |||
private static final String PROJECT_DECLARE = StateMachineConst.PROJECT_DECLARE; | |||
@OnTransition(source = "UNDER_INTERNAL_AUDIT", target = "PENDING_PREQUALIFICATION") | |||
public void UNDER_INTERNAL_PASS(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode()); | |||
} | |||
@OnTransition(source = "UNDER_INTERNAL_AUDIT", target = "UNDER_INTERNAL_AUDIT_NOT_PASS") | |||
public void UNDER_INTERNAL_REJECT(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS.getCode()); | |||
} | |||
@OnTransition(source = "UNDER_INTERNAL_AUDIT", target = "TO_BE_DECLARED") | |||
public void UNDER_INTERNAL_WITHDRAW(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.TO_BE_DECLARED.getCode()); | |||
} | |||
@OnTransition(source = "UNDER_INTERNAL_AUDIT_NOT_PASS", target = "UNDER_INTERNAL_AUDIT") | |||
public void UNDER_INTERNAL_REJECT_RESUBMIT(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT.getCode()); | |||
} | |||
@OnTransition(source = "PENDING_PREQUALIFICATION", target = "PENDING_PREQUALIFICATION_CHOICE") | |||
public void PRELIMINARY_REVIEW_DECLARE(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE.getCode()); | |||
} | |||
@OnTransition(source = "PENDING_PREQUALIFICATION", target = "UNDER_INTERNAL_AUDIT") | |||
public void PENDING_PREQUALIFICATION_WITHDRAW(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT.getCode()); | |||
} | |||
@OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS", target = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS") | |||
public void PROVINCIAL_DEPARTMENT_REVIEW_PASS(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS.getCode()); | |||
} | |||
@OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS", target = "PRE_APPLYING") | |||
public void PROVINCIAL_PASS_TO_PRELIMINARY_REVIEW(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.PRE_APPLYING.getCode()); | |||
} | |||
@OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS", target = "THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED") | |||
public void PROVINCIAL_DEPARTMENT_REVIEW_REJECT(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED.getCode()); | |||
} | |||
@OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS", target = "PENDING_PREQUALIFICATION") | |||
public void JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_WITHDRAW(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode()); | |||
} | |||
@OnTransition(source = "PRE_APPLYING", target = "DEPARTMENT_JOINT_REVIEW") | |||
public void PRELIMINARY_REVIEW_PASS(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW.getCode()); | |||
} | |||
@OnTransition(source = "PRE_APPLYING", target = "PREQUALIFICATION_FAILED") | |||
public void PRELIMINARY_REVIEW_REJECT(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.PREQUALIFICATION_FAILED.getCode()); | |||
} | |||
@OnTransition(source = "PREQUALIFICATION_FAILED", target = "PENDING_PREQUALIFICATION_CHOICE") | |||
public void PRELIMINARY_REVIEW_REJECT_RESUBMIT(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE.getCode()); | |||
} | |||
@OnTransition(source = "PRE_APPLYING", target = "PREQUALIFICATION_WITHDRAW_CHOICE") | |||
public void PRE_APPLYING_WITHDRAW(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE.getCode()); | |||
} | |||
@OnTransition(source = "DEPARTMENT_JOINT_REVIEW", target = "IN_THE_ANNUAL_PLAN") | |||
public void DEPARTMENT_UNITED_REVIEW_PASS(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.IN_THE_ANNUAL_PLAN.getCode()); | |||
} | |||
@OnTransition(source = "DEPARTMENT_JOINT_REVIEW", target = "DEPARTMENT_JOINT_REVIEW_FAILED") | |||
public void DEPARTMENT_UNITED_REVIEW_REJECT(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW_FAILED.getCode()); | |||
} | |||
@OnTransition(source = "DEPARTMENT_JOINT_REVIEW", target = "PRE_APPLYING") | |||
public void DEPARTMENT_JOINT_REVIEW_WITHDRAW(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.PRE_APPLYING.getCode()); | |||
} | |||
@OnTransition(source = "IN_THE_ANNUAL_PLAN", target = "PLAN_TO_BE_DECLARED") | |||
public void ANNUAL_PLAN_PROJECT_OPEN_PLAN_DECLARE(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.PLAN_TO_BE_DECLARED.getCode()); | |||
} | |||
@OnTransition(source = "IN_THE_ANNUAL_PLAN", target = "BE_SUSPENDED") | |||
public void ANNUAL_PLAN_SUSPEND(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.BE_SUSPENDED.getCode()); | |||
} | |||
@OnTransition(source = "IN_THE_ANNUAL_PLAN", target = "DEPARTMENT_JOINT_REVIEW") | |||
public void IN_THE_ANNUAL_PLAN_WITHDRAW(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW.getCode()); | |||
} | |||
@OnTransition(source = "PLAN_TO_BE_DECLARED", target = "SCHEME_UNDER_REVIEW") | |||
public void DECLARE_PLAN(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); | |||
} | |||
@OnTransition(source = "PLAN_TO_BE_DECLARED", target = "IN_THE_ANNUAL_PLAN") | |||
public void PLAN_TO_DECLARE_WITHDRAW(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.IN_THE_ANNUAL_PLAN.getCode()); | |||
} | |||
@OnTransition(source = "SCHEME_REVIEW_FAILED", target = "SCHEME_UNDER_REVIEW") | |||
public void DECLARE_PLAN_RESUBMIT(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); | |||
} | |||
@OnTransition(source = "SCHEME_UNDER_REVIEW", target = "TO_BE_APPROVED") | |||
public void PLAN_REVIEW_PASS(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.TO_BE_APPROVED.getCode()); | |||
} | |||
@OnTransition(source = "SCHEME_UNDER_REVIEW", target = "SCHEME_REVIEW_FAILED") | |||
public void PLAN_REVIEW_REJECT(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.SCHEME_REVIEW_FAILED.getCode()); | |||
} | |||
@OnTransition(source = "SCHEME_REVIEW_FAILED", target = "SCHEME_UNDER_REVIEW") | |||
public void PLAN_REVIEW_REJECT_RESUBMIT(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); | |||
} | |||
@OnTransition(source = "SCHEME_UNDER_REVIEW", target = "PLAN_TO_BE_DECLARED") | |||
public void SCHEME_UNDER_REVIEW_WITHDRAW(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.PLAN_TO_BE_DECLARED.getCode()); | |||
} | |||
@OnTransition(source = "TO_BE_APPROVED", target = "TO_BE_PURCHASED") | |||
public void PROJECT_APPROVAL(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
// 待立项批复批复后,项目一级状态变更为已立项 | |||
project.setStage(ProjectStatusEnum.PROJECT_APPROVED.getCode()); | |||
project.setStatus(ProjectStatusEnum.TO_BE_PURCHASED.getCode()); | |||
} | |||
@OnTransition(source = "TO_BE_APPROVED", target = "SCHEME_UNDER_REVIEW") | |||
public void TO_BE_APPROVED_WITHDRAW(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); | |||
} | |||
@OnTransition(source = "TO_BE_PURCHASED", target = "UNDER_CONSTRUCTION") | |||
public void PURCHASE_PUT_ON_RECORD(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.UNDER_CONSTRUCTION.getCode()); | |||
} | |||
@OnTransition(source = "TO_BE_PURCHASED", target = "TO_BE_APPROVED") | |||
public void TO_BE_PURCHASED_WITHDRAW(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
// 待采购状态撤回后,项目一级状态回退到未立项 | |||
project.setStage(ProjectStatusEnum.NOT_APPROVED.getCode()); | |||
project.setStatus(ProjectStatusEnum.TO_BE_APPROVED.getCode()); | |||
} | |||
@OnTransition(source = "UNDER_CONSTRUCTION", target = "TO_BE_FINALLY_INSPECTED") | |||
public void PRELIMINARY_ACCEPTANCE_PUT_ON_RECORD(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.TO_BE_FINALLY_INSPECTED.getCode()); | |||
} | |||
@OnTransition(source = "UNDER_CONSTRUCTION", target = "TO_BE_PURCHASED") | |||
public void UNDER_CONSTRUCTION_WITHDRAW(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.TO_BE_PURCHASED.getCode()); | |||
} | |||
@OnTransition(source = "TO_BE_FINALLY_INSPECTED", target = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW") | |||
public void FINAL_ACCEPTANCE_APPLICATION(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW.getCode()); | |||
} | |||
@OnTransition(source = "TO_BE_FINALLY_INSPECTED", target = "UNDER_CONSTRUCTION") | |||
public void TO_BE_FINALLY_INSPECTED_WITHDRAW(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.UNDER_CONSTRUCTION.getCode()); | |||
} | |||
@OnTransition(source = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW", target = "ARCHIVED") | |||
public void FINAL_ACCEPTANCE_PASS(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
// 终验审核通过后,项目一级状态变更为已归档 | |||
project.setStage(ProjectStatusEnum.ARCHIVED.getCode()); | |||
project.setStatus(ProjectStatusEnum.ACCEPTED.getCode()); | |||
} | |||
@OnTransition(source = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW", target = "FINAL_ACCEPTANCE_REVIEW_FAILED") | |||
public void FINAL_ACCEPTANCE_REJECT(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.FINAL_ACCEPTANCE_REVIEW_FAILED.getCode()); | |||
} | |||
@OnTransition(source = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW", target = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW") | |||
public void FINAL_ACCEPTANCE_IS_UNDER_REVIEW_WITHDRAW(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW.getCode()); | |||
} | |||
} |
@@ -0,0 +1,268 @@ | |||
package com.ningdatech.pmapi.common.statemachine.action; | |||
import com.ningdatech.pmapi.common.constant.StateMachineConst; | |||
import com.ningdatech.pmapi.common.statemachine.contants.RegionContant; | |||
import com.ningdatech.pmapi.common.statemachine.event.ProjectStatusChangeEvent; | |||
import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; | |||
import com.ningdatech.pmapi.projectlib.model.entity.Project; | |||
import lombok.extern.slf4j.Slf4j; | |||
import org.springframework.messaging.Message; | |||
import org.springframework.statemachine.annotation.OnTransition; | |||
import org.springframework.statemachine.annotation.WithStateMachine; | |||
/** | |||
* 项目申报状态机action集合类 | |||
* 庆元县 | |||
* @author CMM | |||
* @since 2023/02/08 13:48 | |||
*/ | |||
@Slf4j | |||
@WithStateMachine(id = RegionContant.LS_QY_CODE) | |||
public class ProjectDeclareQYAction { | |||
private static final String PROJECT_DECLARE = StateMachineConst.PROJECT_DECLARE; | |||
@OnTransition(source = "UNDER_INTERNAL_AUDIT", target = "PENDING_PREQUALIFICATION") | |||
public void UNDER_INTERNAL_PASS(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode()); | |||
} | |||
@OnTransition(source = "UNDER_INTERNAL_AUDIT", target = "UNDER_INTERNAL_AUDIT_NOT_PASS") | |||
public void UNDER_INTERNAL_REJECT(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS.getCode()); | |||
} | |||
@OnTransition(source = "UNDER_INTERNAL_AUDIT", target = "TO_BE_DECLARED") | |||
public void UNDER_INTERNAL_WITHDRAW(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.TO_BE_DECLARED.getCode()); | |||
} | |||
@OnTransition(source = "UNDER_INTERNAL_AUDIT_NOT_PASS", target = "UNDER_INTERNAL_AUDIT") | |||
public void UNDER_INTERNAL_REJECT_RESUBMIT(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT.getCode()); | |||
} | |||
@OnTransition(source = "PENDING_PREQUALIFICATION", target = "PENDING_PREQUALIFICATION_CHOICE") | |||
public void PRELIMINARY_REVIEW_DECLARE(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE.getCode()); | |||
} | |||
@OnTransition(source = "PENDING_PREQUALIFICATION", target = "UNDER_INTERNAL_AUDIT") | |||
public void PENDING_PREQUALIFICATION_WITHDRAW(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT.getCode()); | |||
} | |||
@OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS", target = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS") | |||
public void PROVINCIAL_DEPARTMENT_REVIEW_PASS(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS.getCode()); | |||
} | |||
@OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS", target = "PRE_APPLYING") | |||
public void PROVINCIAL_PASS_TO_PRELIMINARY_REVIEW(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.PRE_APPLYING.getCode()); | |||
} | |||
@OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS", target = "THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED") | |||
public void PROVINCIAL_DEPARTMENT_REVIEW_REJECT(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED.getCode()); | |||
} | |||
@OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS", target = "PENDING_PREQUALIFICATION") | |||
public void JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_WITHDRAW(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode()); | |||
} | |||
@OnTransition(source = "PRE_APPLYING", target = "DEPARTMENT_JOINT_REVIEW") | |||
public void PRELIMINARY_REVIEW_PASS(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW.getCode()); | |||
} | |||
@OnTransition(source = "PRE_APPLYING", target = "PREQUALIFICATION_FAILED") | |||
public void PRELIMINARY_REVIEW_REJECT(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.PREQUALIFICATION_FAILED.getCode()); | |||
} | |||
@OnTransition(source = "PREQUALIFICATION_FAILED", target = "PENDING_PREQUALIFICATION_CHOICE") | |||
public void PRELIMINARY_REVIEW_REJECT_RESUBMIT(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE.getCode()); | |||
} | |||
@OnTransition(source = "PRE_APPLYING", target = "PREQUALIFICATION_WITHDRAW_CHOICE") | |||
public void PRE_APPLYING_WITHDRAW(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE.getCode()); | |||
} | |||
@OnTransition(source = "DEPARTMENT_JOINT_REVIEW", target = "IN_THE_ANNUAL_PLAN") | |||
public void DEPARTMENT_UNITED_REVIEW_PASS(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.IN_THE_ANNUAL_PLAN.getCode()); | |||
} | |||
@OnTransition(source = "DEPARTMENT_JOINT_REVIEW", target = "DEPARTMENT_JOINT_REVIEW_FAILED") | |||
public void DEPARTMENT_UNITED_REVIEW_REJECT(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW_FAILED.getCode()); | |||
} | |||
@OnTransition(source = "DEPARTMENT_JOINT_REVIEW", target = "PRE_APPLYING") | |||
public void DEPARTMENT_JOINT_REVIEW_WITHDRAW(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.PRE_APPLYING.getCode()); | |||
} | |||
@OnTransition(source = "IN_THE_ANNUAL_PLAN", target = "PLAN_TO_BE_DECLARED") | |||
public void ANNUAL_PLAN_PROJECT_OPEN_PLAN_DECLARE(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.PLAN_TO_BE_DECLARED.getCode()); | |||
} | |||
@OnTransition(source = "IN_THE_ANNUAL_PLAN", target = "BE_SUSPENDED") | |||
public void ANNUAL_PLAN_SUSPEND(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.BE_SUSPENDED.getCode()); | |||
} | |||
@OnTransition(source = "IN_THE_ANNUAL_PLAN", target = "DEPARTMENT_JOINT_REVIEW") | |||
public void IN_THE_ANNUAL_PLAN_WITHDRAW(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW.getCode()); | |||
} | |||
@OnTransition(source = "PLAN_TO_BE_DECLARED", target = "SCHEME_UNDER_REVIEW") | |||
public void DECLARE_PLAN(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); | |||
} | |||
@OnTransition(source = "PLAN_TO_BE_DECLARED", target = "IN_THE_ANNUAL_PLAN") | |||
public void PLAN_TO_DECLARE_WITHDRAW(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.IN_THE_ANNUAL_PLAN.getCode()); | |||
} | |||
@OnTransition(source = "SCHEME_REVIEW_FAILED", target = "SCHEME_UNDER_REVIEW") | |||
public void DECLARE_PLAN_RESUBMIT(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); | |||
} | |||
@OnTransition(source = "SCHEME_UNDER_REVIEW", target = "TO_BE_APPROVED") | |||
public void PLAN_REVIEW_PASS(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.TO_BE_APPROVED.getCode()); | |||
} | |||
@OnTransition(source = "SCHEME_UNDER_REVIEW", target = "SCHEME_REVIEW_FAILED") | |||
public void PLAN_REVIEW_REJECT(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.SCHEME_REVIEW_FAILED.getCode()); | |||
} | |||
@OnTransition(source = "SCHEME_REVIEW_FAILED", target = "SCHEME_UNDER_REVIEW") | |||
public void PLAN_REVIEW_REJECT_RESUBMIT(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); | |||
} | |||
@OnTransition(source = "SCHEME_UNDER_REVIEW", target = "PLAN_TO_BE_DECLARED") | |||
public void SCHEME_UNDER_REVIEW_WITHDRAW(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.PLAN_TO_BE_DECLARED.getCode()); | |||
} | |||
@OnTransition(source = "TO_BE_APPROVED", target = "TO_BE_PURCHASED") | |||
public void PROJECT_APPROVAL(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
// 待立项批复批复后,项目一级状态变更为已立项 | |||
project.setStage(ProjectStatusEnum.PROJECT_APPROVED.getCode()); | |||
project.setStatus(ProjectStatusEnum.TO_BE_PURCHASED.getCode()); | |||
} | |||
@OnTransition(source = "TO_BE_APPROVED", target = "SCHEME_UNDER_REVIEW") | |||
public void TO_BE_APPROVED_WITHDRAW(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); | |||
} | |||
@OnTransition(source = "TO_BE_PURCHASED", target = "UNDER_CONSTRUCTION") | |||
public void PURCHASE_PUT_ON_RECORD(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.UNDER_CONSTRUCTION.getCode()); | |||
} | |||
@OnTransition(source = "TO_BE_PURCHASED", target = "TO_BE_APPROVED") | |||
public void TO_BE_PURCHASED_WITHDRAW(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
// 待采购状态撤回后,项目一级状态回退到未立项 | |||
project.setStage(ProjectStatusEnum.NOT_APPROVED.getCode()); | |||
project.setStatus(ProjectStatusEnum.TO_BE_APPROVED.getCode()); | |||
} | |||
@OnTransition(source = "UNDER_CONSTRUCTION", target = "TO_BE_FINALLY_INSPECTED") | |||
public void PRELIMINARY_ACCEPTANCE_PUT_ON_RECORD(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.TO_BE_FINALLY_INSPECTED.getCode()); | |||
} | |||
@OnTransition(source = "UNDER_CONSTRUCTION", target = "TO_BE_PURCHASED") | |||
public void UNDER_CONSTRUCTION_WITHDRAW(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.TO_BE_PURCHASED.getCode()); | |||
} | |||
@OnTransition(source = "TO_BE_FINALLY_INSPECTED", target = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW") | |||
public void FINAL_ACCEPTANCE_APPLICATION(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW.getCode()); | |||
} | |||
@OnTransition(source = "TO_BE_FINALLY_INSPECTED", target = "UNDER_CONSTRUCTION") | |||
public void TO_BE_FINALLY_INSPECTED_WITHDRAW(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.UNDER_CONSTRUCTION.getCode()); | |||
} | |||
@OnTransition(source = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW", target = "ARCHIVED") | |||
public void FINAL_ACCEPTANCE_PASS(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
// 终验审核通过后,项目一级状态变更为已归档 | |||
project.setStage(ProjectStatusEnum.ARCHIVED.getCode()); | |||
project.setStatus(ProjectStatusEnum.ACCEPTED.getCode()); | |||
} | |||
@OnTransition(source = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW", target = "FINAL_ACCEPTANCE_REVIEW_FAILED") | |||
public void FINAL_ACCEPTANCE_REJECT(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.FINAL_ACCEPTANCE_REVIEW_FAILED.getCode()); | |||
} | |||
@OnTransition(source = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW", target = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW") | |||
public void FINAL_ACCEPTANCE_IS_UNDER_REVIEW_WITHDRAW(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW.getCode()); | |||
} | |||
} |
@@ -0,0 +1,268 @@ | |||
package com.ningdatech.pmapi.common.statemachine.action; | |||
import com.ningdatech.pmapi.common.constant.StateMachineConst; | |||
import com.ningdatech.pmapi.common.statemachine.contants.RegionContant; | |||
import com.ningdatech.pmapi.common.statemachine.event.ProjectStatusChangeEvent; | |||
import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; | |||
import com.ningdatech.pmapi.projectlib.model.entity.Project; | |||
import lombok.extern.slf4j.Slf4j; | |||
import org.springframework.messaging.Message; | |||
import org.springframework.statemachine.annotation.OnTransition; | |||
import org.springframework.statemachine.annotation.WithStateMachine; | |||
/** | |||
* 项目申报状态机action集合类 | |||
* 市本级 | |||
* @author CMM | |||
* @since 2023/02/08 13:48 | |||
*/ | |||
@Slf4j | |||
@WithStateMachine(id = RegionContant.LS_SBJ_CODE) | |||
public class ProjectDeclareSBJAction { | |||
private static final String PROJECT_DECLARE = StateMachineConst.PROJECT_DECLARE; | |||
@OnTransition(source = "UNDER_INTERNAL_AUDIT", target = "PENDING_PREQUALIFICATION") | |||
public void UNDER_INTERNAL_PASS(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode()); | |||
} | |||
@OnTransition(source = "UNDER_INTERNAL_AUDIT", target = "UNDER_INTERNAL_AUDIT_NOT_PASS") | |||
public void UNDER_INTERNAL_REJECT(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS.getCode()); | |||
} | |||
@OnTransition(source = "UNDER_INTERNAL_AUDIT", target = "TO_BE_DECLARED") | |||
public void UNDER_INTERNAL_WITHDRAW(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.TO_BE_DECLARED.getCode()); | |||
} | |||
@OnTransition(source = "UNDER_INTERNAL_AUDIT_NOT_PASS", target = "UNDER_INTERNAL_AUDIT") | |||
public void UNDER_INTERNAL_REJECT_RESUBMIT(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT.getCode()); | |||
} | |||
@OnTransition(source = "PENDING_PREQUALIFICATION", target = "PENDING_PREQUALIFICATION_CHOICE") | |||
public void PRELIMINARY_REVIEW_DECLARE(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE.getCode()); | |||
} | |||
@OnTransition(source = "PENDING_PREQUALIFICATION", target = "UNDER_INTERNAL_AUDIT") | |||
public void PENDING_PREQUALIFICATION_WITHDRAW(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT.getCode()); | |||
} | |||
@OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS", target = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS") | |||
public void PROVINCIAL_DEPARTMENT_REVIEW_PASS(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS.getCode()); | |||
} | |||
@OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS", target = "PRE_APPLYING") | |||
public void PROVINCIAL_PASS_TO_PRELIMINARY_REVIEW(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.PRE_APPLYING.getCode()); | |||
} | |||
@OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS", target = "THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED") | |||
public void PROVINCIAL_DEPARTMENT_REVIEW_REJECT(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED.getCode()); | |||
} | |||
@OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS", target = "PENDING_PREQUALIFICATION") | |||
public void JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_WITHDRAW(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode()); | |||
} | |||
@OnTransition(source = "PRE_APPLYING", target = "DEPARTMENT_JOINT_REVIEW") | |||
public void PRELIMINARY_REVIEW_PASS(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW.getCode()); | |||
} | |||
@OnTransition(source = "PRE_APPLYING", target = "PREQUALIFICATION_FAILED") | |||
public void PRELIMINARY_REVIEW_REJECT(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.PREQUALIFICATION_FAILED.getCode()); | |||
} | |||
@OnTransition(source = "PREQUALIFICATION_FAILED", target = "PENDING_PREQUALIFICATION_CHOICE") | |||
public void PRELIMINARY_REVIEW_REJECT_RESUBMIT(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE.getCode()); | |||
} | |||
@OnTransition(source = "PRE_APPLYING", target = "PREQUALIFICATION_WITHDRAW_CHOICE") | |||
public void PRE_APPLYING_WITHDRAW(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE.getCode()); | |||
} | |||
@OnTransition(source = "DEPARTMENT_JOINT_REVIEW", target = "IN_THE_ANNUAL_PLAN") | |||
public void DEPARTMENT_UNITED_REVIEW_PASS(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.IN_THE_ANNUAL_PLAN.getCode()); | |||
} | |||
@OnTransition(source = "DEPARTMENT_JOINT_REVIEW", target = "DEPARTMENT_JOINT_REVIEW_FAILED") | |||
public void DEPARTMENT_UNITED_REVIEW_REJECT(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW_FAILED.getCode()); | |||
} | |||
@OnTransition(source = "DEPARTMENT_JOINT_REVIEW", target = "PRE_APPLYING") | |||
public void DEPARTMENT_JOINT_REVIEW_WITHDRAW(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.PRE_APPLYING.getCode()); | |||
} | |||
@OnTransition(source = "IN_THE_ANNUAL_PLAN", target = "PLAN_TO_BE_DECLARED") | |||
public void ANNUAL_PLAN_PROJECT_OPEN_PLAN_DECLARE(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.PLAN_TO_BE_DECLARED.getCode()); | |||
} | |||
@OnTransition(source = "IN_THE_ANNUAL_PLAN", target = "BE_SUSPENDED") | |||
public void ANNUAL_PLAN_SUSPEND(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.BE_SUSPENDED.getCode()); | |||
} | |||
@OnTransition(source = "IN_THE_ANNUAL_PLAN", target = "DEPARTMENT_JOINT_REVIEW") | |||
public void IN_THE_ANNUAL_PLAN_WITHDRAW(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW.getCode()); | |||
} | |||
@OnTransition(source = "PLAN_TO_BE_DECLARED", target = "SCHEME_UNDER_REVIEW") | |||
public void DECLARE_PLAN(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); | |||
} | |||
@OnTransition(source = "PLAN_TO_BE_DECLARED", target = "IN_THE_ANNUAL_PLAN") | |||
public void PLAN_TO_DECLARE_WITHDRAW(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.IN_THE_ANNUAL_PLAN.getCode()); | |||
} | |||
@OnTransition(source = "SCHEME_REVIEW_FAILED", target = "SCHEME_UNDER_REVIEW") | |||
public void DECLARE_PLAN_RESUBMIT(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); | |||
} | |||
@OnTransition(source = "SCHEME_UNDER_REVIEW", target = "TO_BE_APPROVED") | |||
public void PLAN_REVIEW_PASS(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.TO_BE_APPROVED.getCode()); | |||
} | |||
@OnTransition(source = "SCHEME_UNDER_REVIEW", target = "SCHEME_REVIEW_FAILED") | |||
public void PLAN_REVIEW_REJECT(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.SCHEME_REVIEW_FAILED.getCode()); | |||
} | |||
@OnTransition(source = "SCHEME_REVIEW_FAILED", target = "SCHEME_UNDER_REVIEW") | |||
public void PLAN_REVIEW_REJECT_RESUBMIT(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); | |||
} | |||
@OnTransition(source = "SCHEME_UNDER_REVIEW", target = "PLAN_TO_BE_DECLARED") | |||
public void SCHEME_UNDER_REVIEW_WITHDRAW(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.PLAN_TO_BE_DECLARED.getCode()); | |||
} | |||
@OnTransition(source = "TO_BE_APPROVED", target = "TO_BE_PURCHASED") | |||
public void PROJECT_APPROVAL(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
// 待立项批复批复后,项目一级状态变更为已立项 | |||
project.setStage(ProjectStatusEnum.PROJECT_APPROVED.getCode()); | |||
project.setStatus(ProjectStatusEnum.TO_BE_PURCHASED.getCode()); | |||
} | |||
@OnTransition(source = "TO_BE_APPROVED", target = "SCHEME_UNDER_REVIEW") | |||
public void TO_BE_APPROVED_WITHDRAW(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); | |||
} | |||
@OnTransition(source = "TO_BE_PURCHASED", target = "UNDER_CONSTRUCTION") | |||
public void PURCHASE_PUT_ON_RECORD(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.UNDER_CONSTRUCTION.getCode()); | |||
} | |||
@OnTransition(source = "TO_BE_PURCHASED", target = "TO_BE_APPROVED") | |||
public void TO_BE_PURCHASED_WITHDRAW(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
// 待采购状态撤回后,项目一级状态回退到未立项 | |||
project.setStage(ProjectStatusEnum.NOT_APPROVED.getCode()); | |||
project.setStatus(ProjectStatusEnum.TO_BE_APPROVED.getCode()); | |||
} | |||
@OnTransition(source = "UNDER_CONSTRUCTION", target = "TO_BE_FINALLY_INSPECTED") | |||
public void PRELIMINARY_ACCEPTANCE_PUT_ON_RECORD(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.TO_BE_FINALLY_INSPECTED.getCode()); | |||
} | |||
@OnTransition(source = "UNDER_CONSTRUCTION", target = "TO_BE_PURCHASED") | |||
public void UNDER_CONSTRUCTION_WITHDRAW(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.TO_BE_PURCHASED.getCode()); | |||
} | |||
@OnTransition(source = "TO_BE_FINALLY_INSPECTED", target = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW") | |||
public void FINAL_ACCEPTANCE_APPLICATION(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW.getCode()); | |||
} | |||
@OnTransition(source = "TO_BE_FINALLY_INSPECTED", target = "UNDER_CONSTRUCTION") | |||
public void TO_BE_FINALLY_INSPECTED_WITHDRAW(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.UNDER_CONSTRUCTION.getCode()); | |||
} | |||
@OnTransition(source = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW", target = "ARCHIVED") | |||
public void FINAL_ACCEPTANCE_PASS(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
// 终验审核通过后,项目一级状态变更为已归档 | |||
project.setStage(ProjectStatusEnum.ARCHIVED.getCode()); | |||
project.setStatus(ProjectStatusEnum.ACCEPTED.getCode()); | |||
} | |||
@OnTransition(source = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW", target = "FINAL_ACCEPTANCE_REVIEW_FAILED") | |||
public void FINAL_ACCEPTANCE_REJECT(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.FINAL_ACCEPTANCE_REVIEW_FAILED.getCode()); | |||
} | |||
@OnTransition(source = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW", target = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW") | |||
public void FINAL_ACCEPTANCE_IS_UNDER_REVIEW_WITHDRAW(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW.getCode()); | |||
} | |||
} |
@@ -0,0 +1,268 @@ | |||
package com.ningdatech.pmapi.common.statemachine.action; | |||
import com.ningdatech.pmapi.common.constant.StateMachineConst; | |||
import com.ningdatech.pmapi.common.statemachine.contants.RegionContant; | |||
import com.ningdatech.pmapi.common.statemachine.event.ProjectStatusChangeEvent; | |||
import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; | |||
import com.ningdatech.pmapi.projectlib.model.entity.Project; | |||
import lombok.extern.slf4j.Slf4j; | |||
import org.springframework.messaging.Message; | |||
import org.springframework.statemachine.annotation.OnTransition; | |||
import org.springframework.statemachine.annotation.WithStateMachine; | |||
/** | |||
* 项目申报状态机action集合类 | |||
* 遂昌县 | |||
* @author CMM | |||
* @since 2023/02/08 13:48 | |||
*/ | |||
@Slf4j | |||
@WithStateMachine(id = RegionContant.LS_SC_CODE) | |||
public class ProjectDeclareSCAction { | |||
private static final String PROJECT_DECLARE = StateMachineConst.PROJECT_DECLARE; | |||
@OnTransition(source = "UNDER_INTERNAL_AUDIT", target = "PENDING_PREQUALIFICATION") | |||
public void UNDER_INTERNAL_PASS(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode()); | |||
} | |||
@OnTransition(source = "UNDER_INTERNAL_AUDIT", target = "UNDER_INTERNAL_AUDIT_NOT_PASS") | |||
public void UNDER_INTERNAL_REJECT(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS.getCode()); | |||
} | |||
@OnTransition(source = "UNDER_INTERNAL_AUDIT", target = "TO_BE_DECLARED") | |||
public void UNDER_INTERNAL_WITHDRAW(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.TO_BE_DECLARED.getCode()); | |||
} | |||
@OnTransition(source = "UNDER_INTERNAL_AUDIT_NOT_PASS", target = "UNDER_INTERNAL_AUDIT") | |||
public void UNDER_INTERNAL_REJECT_RESUBMIT(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT.getCode()); | |||
} | |||
@OnTransition(source = "PENDING_PREQUALIFICATION", target = "PENDING_PREQUALIFICATION_CHOICE") | |||
public void PRELIMINARY_REVIEW_DECLARE(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE.getCode()); | |||
} | |||
@OnTransition(source = "PENDING_PREQUALIFICATION", target = "UNDER_INTERNAL_AUDIT") | |||
public void PENDING_PREQUALIFICATION_WITHDRAW(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT.getCode()); | |||
} | |||
@OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS", target = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS") | |||
public void PROVINCIAL_DEPARTMENT_REVIEW_PASS(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS.getCode()); | |||
} | |||
@OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS", target = "PRE_APPLYING") | |||
public void PROVINCIAL_PASS_TO_PRELIMINARY_REVIEW(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.PRE_APPLYING.getCode()); | |||
} | |||
@OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS", target = "THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED") | |||
public void PROVINCIAL_DEPARTMENT_REVIEW_REJECT(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED.getCode()); | |||
} | |||
@OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS", target = "PENDING_PREQUALIFICATION") | |||
public void JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_WITHDRAW(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode()); | |||
} | |||
@OnTransition(source = "PRE_APPLYING", target = "DEPARTMENT_JOINT_REVIEW") | |||
public void PRELIMINARY_REVIEW_PASS(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW.getCode()); | |||
} | |||
@OnTransition(source = "PRE_APPLYING", target = "PREQUALIFICATION_FAILED") | |||
public void PRELIMINARY_REVIEW_REJECT(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.PREQUALIFICATION_FAILED.getCode()); | |||
} | |||
@OnTransition(source = "PREQUALIFICATION_FAILED", target = "PENDING_PREQUALIFICATION_CHOICE") | |||
public void PRELIMINARY_REVIEW_REJECT_RESUBMIT(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE.getCode()); | |||
} | |||
@OnTransition(source = "PRE_APPLYING", target = "PREQUALIFICATION_WITHDRAW_CHOICE") | |||
public void PRE_APPLYING_WITHDRAW(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE.getCode()); | |||
} | |||
@OnTransition(source = "DEPARTMENT_JOINT_REVIEW", target = "IN_THE_ANNUAL_PLAN") | |||
public void DEPARTMENT_UNITED_REVIEW_PASS(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.IN_THE_ANNUAL_PLAN.getCode()); | |||
} | |||
@OnTransition(source = "DEPARTMENT_JOINT_REVIEW", target = "DEPARTMENT_JOINT_REVIEW_FAILED") | |||
public void DEPARTMENT_UNITED_REVIEW_REJECT(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW_FAILED.getCode()); | |||
} | |||
@OnTransition(source = "DEPARTMENT_JOINT_REVIEW", target = "PRE_APPLYING") | |||
public void DEPARTMENT_JOINT_REVIEW_WITHDRAW(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.PRE_APPLYING.getCode()); | |||
} | |||
@OnTransition(source = "IN_THE_ANNUAL_PLAN", target = "PLAN_TO_BE_DECLARED") | |||
public void ANNUAL_PLAN_PROJECT_OPEN_PLAN_DECLARE(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.PLAN_TO_BE_DECLARED.getCode()); | |||
} | |||
@OnTransition(source = "IN_THE_ANNUAL_PLAN", target = "BE_SUSPENDED") | |||
public void ANNUAL_PLAN_SUSPEND(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.BE_SUSPENDED.getCode()); | |||
} | |||
@OnTransition(source = "IN_THE_ANNUAL_PLAN", target = "DEPARTMENT_JOINT_REVIEW") | |||
public void IN_THE_ANNUAL_PLAN_WITHDRAW(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW.getCode()); | |||
} | |||
@OnTransition(source = "PLAN_TO_BE_DECLARED", target = "SCHEME_UNDER_REVIEW") | |||
public void DECLARE_PLAN(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); | |||
} | |||
@OnTransition(source = "PLAN_TO_BE_DECLARED", target = "IN_THE_ANNUAL_PLAN") | |||
public void PLAN_TO_DECLARE_WITHDRAW(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.IN_THE_ANNUAL_PLAN.getCode()); | |||
} | |||
@OnTransition(source = "SCHEME_REVIEW_FAILED", target = "SCHEME_UNDER_REVIEW") | |||
public void DECLARE_PLAN_RESUBMIT(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); | |||
} | |||
@OnTransition(source = "SCHEME_UNDER_REVIEW", target = "TO_BE_APPROVED") | |||
public void PLAN_REVIEW_PASS(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.TO_BE_APPROVED.getCode()); | |||
} | |||
@OnTransition(source = "SCHEME_UNDER_REVIEW", target = "SCHEME_REVIEW_FAILED") | |||
public void PLAN_REVIEW_REJECT(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.SCHEME_REVIEW_FAILED.getCode()); | |||
} | |||
@OnTransition(source = "SCHEME_REVIEW_FAILED", target = "SCHEME_UNDER_REVIEW") | |||
public void PLAN_REVIEW_REJECT_RESUBMIT(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); | |||
} | |||
@OnTransition(source = "SCHEME_UNDER_REVIEW", target = "PLAN_TO_BE_DECLARED") | |||
public void SCHEME_UNDER_REVIEW_WITHDRAW(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.PLAN_TO_BE_DECLARED.getCode()); | |||
} | |||
@OnTransition(source = "TO_BE_APPROVED", target = "TO_BE_PURCHASED") | |||
public void PROJECT_APPROVAL(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
// 待立项批复批复后,项目一级状态变更为已立项 | |||
project.setStage(ProjectStatusEnum.PROJECT_APPROVED.getCode()); | |||
project.setStatus(ProjectStatusEnum.TO_BE_PURCHASED.getCode()); | |||
} | |||
@OnTransition(source = "TO_BE_APPROVED", target = "SCHEME_UNDER_REVIEW") | |||
public void TO_BE_APPROVED_WITHDRAW(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); | |||
} | |||
@OnTransition(source = "TO_BE_PURCHASED", target = "UNDER_CONSTRUCTION") | |||
public void PURCHASE_PUT_ON_RECORD(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.UNDER_CONSTRUCTION.getCode()); | |||
} | |||
@OnTransition(source = "TO_BE_PURCHASED", target = "TO_BE_APPROVED") | |||
public void TO_BE_PURCHASED_WITHDRAW(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
// 待采购状态撤回后,项目一级状态回退到未立项 | |||
project.setStage(ProjectStatusEnum.NOT_APPROVED.getCode()); | |||
project.setStatus(ProjectStatusEnum.TO_BE_APPROVED.getCode()); | |||
} | |||
@OnTransition(source = "UNDER_CONSTRUCTION", target = "TO_BE_FINALLY_INSPECTED") | |||
public void PRELIMINARY_ACCEPTANCE_PUT_ON_RECORD(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.TO_BE_FINALLY_INSPECTED.getCode()); | |||
} | |||
@OnTransition(source = "UNDER_CONSTRUCTION", target = "TO_BE_PURCHASED") | |||
public void UNDER_CONSTRUCTION_WITHDRAW(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.TO_BE_PURCHASED.getCode()); | |||
} | |||
@OnTransition(source = "TO_BE_FINALLY_INSPECTED", target = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW") | |||
public void FINAL_ACCEPTANCE_APPLICATION(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW.getCode()); | |||
} | |||
@OnTransition(source = "TO_BE_FINALLY_INSPECTED", target = "UNDER_CONSTRUCTION") | |||
public void TO_BE_FINALLY_INSPECTED_WITHDRAW(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.UNDER_CONSTRUCTION.getCode()); | |||
} | |||
@OnTransition(source = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW", target = "ARCHIVED") | |||
public void FINAL_ACCEPTANCE_PASS(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
// 终验审核通过后,项目一级状态变更为已归档 | |||
project.setStage(ProjectStatusEnum.ARCHIVED.getCode()); | |||
project.setStatus(ProjectStatusEnum.ACCEPTED.getCode()); | |||
} | |||
@OnTransition(source = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW", target = "FINAL_ACCEPTANCE_REVIEW_FAILED") | |||
public void FINAL_ACCEPTANCE_REJECT(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.FINAL_ACCEPTANCE_REVIEW_FAILED.getCode()); | |||
} | |||
@OnTransition(source = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW", target = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW") | |||
public void FINAL_ACCEPTANCE_IS_UNDER_REVIEW_WITHDRAW(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW.getCode()); | |||
} | |||
} |
@@ -0,0 +1,268 @@ | |||
package com.ningdatech.pmapi.common.statemachine.action; | |||
import com.ningdatech.pmapi.common.constant.StateMachineConst; | |||
import com.ningdatech.pmapi.common.statemachine.contants.RegionContant; | |||
import com.ningdatech.pmapi.common.statemachine.event.ProjectStatusChangeEvent; | |||
import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; | |||
import com.ningdatech.pmapi.projectlib.model.entity.Project; | |||
import lombok.extern.slf4j.Slf4j; | |||
import org.springframework.messaging.Message; | |||
import org.springframework.statemachine.annotation.OnTransition; | |||
import org.springframework.statemachine.annotation.WithStateMachine; | |||
/** | |||
* 项目申报状态机action集合类 | |||
* 松阳县 | |||
* @author CMM | |||
* @since 2023/02/08 13:48 | |||
*/ | |||
@Slf4j | |||
@WithStateMachine(id = RegionContant.LS_SY_CODE) | |||
public class ProjectDeclareSYAction { | |||
private static final String PROJECT_DECLARE = StateMachineConst.PROJECT_DECLARE; | |||
@OnTransition(source = "UNDER_INTERNAL_AUDIT", target = "PENDING_PREQUALIFICATION") | |||
public void UNDER_INTERNAL_PASS(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode()); | |||
} | |||
@OnTransition(source = "UNDER_INTERNAL_AUDIT", target = "UNDER_INTERNAL_AUDIT_NOT_PASS") | |||
public void UNDER_INTERNAL_REJECT(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS.getCode()); | |||
} | |||
@OnTransition(source = "UNDER_INTERNAL_AUDIT", target = "TO_BE_DECLARED") | |||
public void UNDER_INTERNAL_WITHDRAW(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.TO_BE_DECLARED.getCode()); | |||
} | |||
@OnTransition(source = "UNDER_INTERNAL_AUDIT_NOT_PASS", target = "UNDER_INTERNAL_AUDIT") | |||
public void UNDER_INTERNAL_REJECT_RESUBMIT(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT.getCode()); | |||
} | |||
@OnTransition(source = "PENDING_PREQUALIFICATION", target = "PENDING_PREQUALIFICATION_CHOICE") | |||
public void PRELIMINARY_REVIEW_DECLARE(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE.getCode()); | |||
} | |||
@OnTransition(source = "PENDING_PREQUALIFICATION", target = "UNDER_INTERNAL_AUDIT") | |||
public void PENDING_PREQUALIFICATION_WITHDRAW(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT.getCode()); | |||
} | |||
@OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS", target = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS") | |||
public void PROVINCIAL_DEPARTMENT_REVIEW_PASS(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS.getCode()); | |||
} | |||
@OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS", target = "PRE_APPLYING") | |||
public void PROVINCIAL_PASS_TO_PRELIMINARY_REVIEW(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.PRE_APPLYING.getCode()); | |||
} | |||
@OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS", target = "THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED") | |||
public void PROVINCIAL_DEPARTMENT_REVIEW_REJECT(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED.getCode()); | |||
} | |||
@OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS", target = "PENDING_PREQUALIFICATION") | |||
public void JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_WITHDRAW(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode()); | |||
} | |||
@OnTransition(source = "PRE_APPLYING", target = "DEPARTMENT_JOINT_REVIEW") | |||
public void PRELIMINARY_REVIEW_PASS(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW.getCode()); | |||
} | |||
@OnTransition(source = "PRE_APPLYING", target = "PREQUALIFICATION_FAILED") | |||
public void PRELIMINARY_REVIEW_REJECT(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.PREQUALIFICATION_FAILED.getCode()); | |||
} | |||
@OnTransition(source = "PREQUALIFICATION_FAILED", target = "PENDING_PREQUALIFICATION_CHOICE") | |||
public void PRELIMINARY_REVIEW_REJECT_RESUBMIT(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE.getCode()); | |||
} | |||
@OnTransition(source = "PRE_APPLYING", target = "PREQUALIFICATION_WITHDRAW_CHOICE") | |||
public void PRE_APPLYING_WITHDRAW(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE.getCode()); | |||
} | |||
@OnTransition(source = "DEPARTMENT_JOINT_REVIEW", target = "IN_THE_ANNUAL_PLAN") | |||
public void DEPARTMENT_UNITED_REVIEW_PASS(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.IN_THE_ANNUAL_PLAN.getCode()); | |||
} | |||
@OnTransition(source = "DEPARTMENT_JOINT_REVIEW", target = "DEPARTMENT_JOINT_REVIEW_FAILED") | |||
public void DEPARTMENT_UNITED_REVIEW_REJECT(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW_FAILED.getCode()); | |||
} | |||
@OnTransition(source = "DEPARTMENT_JOINT_REVIEW", target = "PRE_APPLYING") | |||
public void DEPARTMENT_JOINT_REVIEW_WITHDRAW(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.PRE_APPLYING.getCode()); | |||
} | |||
@OnTransition(source = "IN_THE_ANNUAL_PLAN", target = "PLAN_TO_BE_DECLARED") | |||
public void ANNUAL_PLAN_PROJECT_OPEN_PLAN_DECLARE(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.PLAN_TO_BE_DECLARED.getCode()); | |||
} | |||
@OnTransition(source = "IN_THE_ANNUAL_PLAN", target = "BE_SUSPENDED") | |||
public void ANNUAL_PLAN_SUSPEND(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.BE_SUSPENDED.getCode()); | |||
} | |||
@OnTransition(source = "IN_THE_ANNUAL_PLAN", target = "DEPARTMENT_JOINT_REVIEW") | |||
public void IN_THE_ANNUAL_PLAN_WITHDRAW(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW.getCode()); | |||
} | |||
@OnTransition(source = "PLAN_TO_BE_DECLARED", target = "SCHEME_UNDER_REVIEW") | |||
public void DECLARE_PLAN(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); | |||
} | |||
@OnTransition(source = "PLAN_TO_BE_DECLARED", target = "IN_THE_ANNUAL_PLAN") | |||
public void PLAN_TO_DECLARE_WITHDRAW(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.IN_THE_ANNUAL_PLAN.getCode()); | |||
} | |||
@OnTransition(source = "SCHEME_REVIEW_FAILED", target = "SCHEME_UNDER_REVIEW") | |||
public void DECLARE_PLAN_RESUBMIT(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); | |||
} | |||
@OnTransition(source = "SCHEME_UNDER_REVIEW", target = "TO_BE_APPROVED") | |||
public void PLAN_REVIEW_PASS(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.TO_BE_APPROVED.getCode()); | |||
} | |||
@OnTransition(source = "SCHEME_UNDER_REVIEW", target = "SCHEME_REVIEW_FAILED") | |||
public void PLAN_REVIEW_REJECT(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.SCHEME_REVIEW_FAILED.getCode()); | |||
} | |||
@OnTransition(source = "SCHEME_REVIEW_FAILED", target = "SCHEME_UNDER_REVIEW") | |||
public void PLAN_REVIEW_REJECT_RESUBMIT(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); | |||
} | |||
@OnTransition(source = "SCHEME_UNDER_REVIEW", target = "PLAN_TO_BE_DECLARED") | |||
public void SCHEME_UNDER_REVIEW_WITHDRAW(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.PLAN_TO_BE_DECLARED.getCode()); | |||
} | |||
@OnTransition(source = "TO_BE_APPROVED", target = "TO_BE_PURCHASED") | |||
public void PROJECT_APPROVAL(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
// 待立项批复批复后,项目一级状态变更为已立项 | |||
project.setStage(ProjectStatusEnum.PROJECT_APPROVED.getCode()); | |||
project.setStatus(ProjectStatusEnum.TO_BE_PURCHASED.getCode()); | |||
} | |||
@OnTransition(source = "TO_BE_APPROVED", target = "SCHEME_UNDER_REVIEW") | |||
public void TO_BE_APPROVED_WITHDRAW(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); | |||
} | |||
@OnTransition(source = "TO_BE_PURCHASED", target = "UNDER_CONSTRUCTION") | |||
public void PURCHASE_PUT_ON_RECORD(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.UNDER_CONSTRUCTION.getCode()); | |||
} | |||
@OnTransition(source = "TO_BE_PURCHASED", target = "TO_BE_APPROVED") | |||
public void TO_BE_PURCHASED_WITHDRAW(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
// 待采购状态撤回后,项目一级状态回退到未立项 | |||
project.setStage(ProjectStatusEnum.NOT_APPROVED.getCode()); | |||
project.setStatus(ProjectStatusEnum.TO_BE_APPROVED.getCode()); | |||
} | |||
@OnTransition(source = "UNDER_CONSTRUCTION", target = "TO_BE_FINALLY_INSPECTED") | |||
public void PRELIMINARY_ACCEPTANCE_PUT_ON_RECORD(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.TO_BE_FINALLY_INSPECTED.getCode()); | |||
} | |||
@OnTransition(source = "UNDER_CONSTRUCTION", target = "TO_BE_PURCHASED") | |||
public void UNDER_CONSTRUCTION_WITHDRAW(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.TO_BE_PURCHASED.getCode()); | |||
} | |||
@OnTransition(source = "TO_BE_FINALLY_INSPECTED", target = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW") | |||
public void FINAL_ACCEPTANCE_APPLICATION(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW.getCode()); | |||
} | |||
@OnTransition(source = "TO_BE_FINALLY_INSPECTED", target = "UNDER_CONSTRUCTION") | |||
public void TO_BE_FINALLY_INSPECTED_WITHDRAW(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.UNDER_CONSTRUCTION.getCode()); | |||
} | |||
@OnTransition(source = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW", target = "ARCHIVED") | |||
public void FINAL_ACCEPTANCE_PASS(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
// 终验审核通过后,项目一级状态变更为已归档 | |||
project.setStage(ProjectStatusEnum.ARCHIVED.getCode()); | |||
project.setStatus(ProjectStatusEnum.ACCEPTED.getCode()); | |||
} | |||
@OnTransition(source = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW", target = "FINAL_ACCEPTANCE_REVIEW_FAILED") | |||
public void FINAL_ACCEPTANCE_REJECT(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.FINAL_ACCEPTANCE_REVIEW_FAILED.getCode()); | |||
} | |||
@OnTransition(source = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW", target = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW") | |||
public void FINAL_ACCEPTANCE_IS_UNDER_REVIEW_WITHDRAW(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW.getCode()); | |||
} | |||
} |
@@ -0,0 +1,268 @@ | |||
package com.ningdatech.pmapi.common.statemachine.action; | |||
import com.ningdatech.pmapi.common.constant.StateMachineConst; | |||
import com.ningdatech.pmapi.common.statemachine.contants.RegionContant; | |||
import com.ningdatech.pmapi.common.statemachine.event.ProjectStatusChangeEvent; | |||
import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; | |||
import com.ningdatech.pmapi.projectlib.model.entity.Project; | |||
import lombok.extern.slf4j.Slf4j; | |||
import org.springframework.messaging.Message; | |||
import org.springframework.statemachine.annotation.OnTransition; | |||
import org.springframework.statemachine.annotation.WithStateMachine; | |||
/** | |||
* 项目申报状态机action集合类 | |||
* 云和县 | |||
* @author CMM | |||
* @since 2023/02/08 13:48 | |||
*/ | |||
@Slf4j | |||
@WithStateMachine(id = RegionContant.LS_YH_CODE) | |||
public class ProjectDeclareYHAction { | |||
private static final String PROJECT_DECLARE = StateMachineConst.PROJECT_DECLARE; | |||
@OnTransition(source = "UNDER_INTERNAL_AUDIT", target = "PENDING_PREQUALIFICATION") | |||
public void UNDER_INTERNAL_PASS(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode()); | |||
} | |||
@OnTransition(source = "UNDER_INTERNAL_AUDIT", target = "UNDER_INTERNAL_AUDIT_NOT_PASS") | |||
public void UNDER_INTERNAL_REJECT(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS.getCode()); | |||
} | |||
@OnTransition(source = "UNDER_INTERNAL_AUDIT", target = "TO_BE_DECLARED") | |||
public void UNDER_INTERNAL_WITHDRAW(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.TO_BE_DECLARED.getCode()); | |||
} | |||
@OnTransition(source = "UNDER_INTERNAL_AUDIT_NOT_PASS", target = "UNDER_INTERNAL_AUDIT") | |||
public void UNDER_INTERNAL_REJECT_RESUBMIT(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT.getCode()); | |||
} | |||
@OnTransition(source = "PENDING_PREQUALIFICATION", target = "PENDING_PREQUALIFICATION_CHOICE") | |||
public void PRELIMINARY_REVIEW_DECLARE(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE.getCode()); | |||
} | |||
@OnTransition(source = "PENDING_PREQUALIFICATION", target = "UNDER_INTERNAL_AUDIT") | |||
public void PENDING_PREQUALIFICATION_WITHDRAW(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT.getCode()); | |||
} | |||
@OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS", target = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS") | |||
public void PROVINCIAL_DEPARTMENT_REVIEW_PASS(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS.getCode()); | |||
} | |||
@OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS", target = "PRE_APPLYING") | |||
public void PROVINCIAL_PASS_TO_PRELIMINARY_REVIEW(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.PRE_APPLYING.getCode()); | |||
} | |||
@OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS", target = "THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED") | |||
public void PROVINCIAL_DEPARTMENT_REVIEW_REJECT(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED.getCode()); | |||
} | |||
@OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS", target = "PENDING_PREQUALIFICATION") | |||
public void JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_WITHDRAW(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode()); | |||
} | |||
@OnTransition(source = "PRE_APPLYING", target = "DEPARTMENT_JOINT_REVIEW") | |||
public void PRELIMINARY_REVIEW_PASS(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW.getCode()); | |||
} | |||
@OnTransition(source = "PRE_APPLYING", target = "PREQUALIFICATION_FAILED") | |||
public void PRELIMINARY_REVIEW_REJECT(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.PREQUALIFICATION_FAILED.getCode()); | |||
} | |||
@OnTransition(source = "PREQUALIFICATION_FAILED", target = "PENDING_PREQUALIFICATION_CHOICE") | |||
public void PRELIMINARY_REVIEW_REJECT_RESUBMIT(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE.getCode()); | |||
} | |||
@OnTransition(source = "PRE_APPLYING", target = "PREQUALIFICATION_WITHDRAW_CHOICE") | |||
public void PRE_APPLYING_WITHDRAW(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE.getCode()); | |||
} | |||
@OnTransition(source = "DEPARTMENT_JOINT_REVIEW", target = "IN_THE_ANNUAL_PLAN") | |||
public void DEPARTMENT_UNITED_REVIEW_PASS(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.IN_THE_ANNUAL_PLAN.getCode()); | |||
} | |||
@OnTransition(source = "DEPARTMENT_JOINT_REVIEW", target = "DEPARTMENT_JOINT_REVIEW_FAILED") | |||
public void DEPARTMENT_UNITED_REVIEW_REJECT(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW_FAILED.getCode()); | |||
} | |||
@OnTransition(source = "DEPARTMENT_JOINT_REVIEW", target = "PRE_APPLYING") | |||
public void DEPARTMENT_JOINT_REVIEW_WITHDRAW(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.PRE_APPLYING.getCode()); | |||
} | |||
@OnTransition(source = "IN_THE_ANNUAL_PLAN", target = "PLAN_TO_BE_DECLARED") | |||
public void ANNUAL_PLAN_PROJECT_OPEN_PLAN_DECLARE(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.PLAN_TO_BE_DECLARED.getCode()); | |||
} | |||
@OnTransition(source = "IN_THE_ANNUAL_PLAN", target = "BE_SUSPENDED") | |||
public void ANNUAL_PLAN_SUSPEND(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.BE_SUSPENDED.getCode()); | |||
} | |||
@OnTransition(source = "IN_THE_ANNUAL_PLAN", target = "DEPARTMENT_JOINT_REVIEW") | |||
public void IN_THE_ANNUAL_PLAN_WITHDRAW(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW.getCode()); | |||
} | |||
@OnTransition(source = "PLAN_TO_BE_DECLARED", target = "SCHEME_UNDER_REVIEW") | |||
public void DECLARE_PLAN(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); | |||
} | |||
@OnTransition(source = "PLAN_TO_BE_DECLARED", target = "IN_THE_ANNUAL_PLAN") | |||
public void PLAN_TO_DECLARE_WITHDRAW(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.IN_THE_ANNUAL_PLAN.getCode()); | |||
} | |||
@OnTransition(source = "SCHEME_REVIEW_FAILED", target = "SCHEME_UNDER_REVIEW") | |||
public void DECLARE_PLAN_RESUBMIT(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); | |||
} | |||
@OnTransition(source = "SCHEME_UNDER_REVIEW", target = "TO_BE_APPROVED") | |||
public void PLAN_REVIEW_PASS(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.TO_BE_APPROVED.getCode()); | |||
} | |||
@OnTransition(source = "SCHEME_UNDER_REVIEW", target = "SCHEME_REVIEW_FAILED") | |||
public void PLAN_REVIEW_REJECT(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.SCHEME_REVIEW_FAILED.getCode()); | |||
} | |||
@OnTransition(source = "SCHEME_REVIEW_FAILED", target = "SCHEME_UNDER_REVIEW") | |||
public void PLAN_REVIEW_REJECT_RESUBMIT(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); | |||
} | |||
@OnTransition(source = "SCHEME_UNDER_REVIEW", target = "PLAN_TO_BE_DECLARED") | |||
public void SCHEME_UNDER_REVIEW_WITHDRAW(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.PLAN_TO_BE_DECLARED.getCode()); | |||
} | |||
@OnTransition(source = "TO_BE_APPROVED", target = "TO_BE_PURCHASED") | |||
public void PROJECT_APPROVAL(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
// 待立项批复批复后,项目一级状态变更为已立项 | |||
project.setStage(ProjectStatusEnum.PROJECT_APPROVED.getCode()); | |||
project.setStatus(ProjectStatusEnum.TO_BE_PURCHASED.getCode()); | |||
} | |||
@OnTransition(source = "TO_BE_APPROVED", target = "SCHEME_UNDER_REVIEW") | |||
public void TO_BE_APPROVED_WITHDRAW(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); | |||
} | |||
@OnTransition(source = "TO_BE_PURCHASED", target = "UNDER_CONSTRUCTION") | |||
public void PURCHASE_PUT_ON_RECORD(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.UNDER_CONSTRUCTION.getCode()); | |||
} | |||
@OnTransition(source = "TO_BE_PURCHASED", target = "TO_BE_APPROVED") | |||
public void TO_BE_PURCHASED_WITHDRAW(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
// 待采购状态撤回后,项目一级状态回退到未立项 | |||
project.setStage(ProjectStatusEnum.NOT_APPROVED.getCode()); | |||
project.setStatus(ProjectStatusEnum.TO_BE_APPROVED.getCode()); | |||
} | |||
@OnTransition(source = "UNDER_CONSTRUCTION", target = "TO_BE_FINALLY_INSPECTED") | |||
public void PRELIMINARY_ACCEPTANCE_PUT_ON_RECORD(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.TO_BE_FINALLY_INSPECTED.getCode()); | |||
} | |||
@OnTransition(source = "UNDER_CONSTRUCTION", target = "TO_BE_PURCHASED") | |||
public void UNDER_CONSTRUCTION_WITHDRAW(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.TO_BE_PURCHASED.getCode()); | |||
} | |||
@OnTransition(source = "TO_BE_FINALLY_INSPECTED", target = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW") | |||
public void FINAL_ACCEPTANCE_APPLICATION(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW.getCode()); | |||
} | |||
@OnTransition(source = "TO_BE_FINALLY_INSPECTED", target = "UNDER_CONSTRUCTION") | |||
public void TO_BE_FINALLY_INSPECTED_WITHDRAW(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.UNDER_CONSTRUCTION.getCode()); | |||
} | |||
@OnTransition(source = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW", target = "ARCHIVED") | |||
public void FINAL_ACCEPTANCE_PASS(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
// 终验审核通过后,项目一级状态变更为已归档 | |||
project.setStage(ProjectStatusEnum.ARCHIVED.getCode()); | |||
project.setStatus(ProjectStatusEnum.ACCEPTED.getCode()); | |||
} | |||
@OnTransition(source = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW", target = "FINAL_ACCEPTANCE_REVIEW_FAILED") | |||
public void FINAL_ACCEPTANCE_REJECT(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.FINAL_ACCEPTANCE_REVIEW_FAILED.getCode()); | |||
} | |||
@OnTransition(source = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW", target = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW") | |||
public void FINAL_ACCEPTANCE_IS_UNDER_REVIEW_WITHDRAW(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW.getCode()); | |||
} | |||
} |
@@ -1,27 +1,11 @@ | |||
package com.ningdatech.pmapi.common.statemachine.builder; | |||
import com.ningdatech.pmapi.common.statemachine.action.ProjectDeclareChoiceAction; | |||
import com.ningdatech.pmapi.common.statemachine.action.ProjectDeclareAction; | |||
import com.ningdatech.pmapi.common.statemachine.factory.ProjectDeclareGuardFactory; | |||
import com.ningdatech.pmapi.common.statemachine.event.ProjectStatusChangeEvent; | |||
import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; | |||
import com.ningdatech.pmapi.projectlib.model.entity.Project; | |||
import lombok.RequiredArgsConstructor; | |||
import org.slf4j.Logger; | |||
import org.slf4j.LoggerFactory; | |||
import org.springframework.beans.factory.BeanFactory; | |||
import org.springframework.context.annotation.Bean; | |||
import org.springframework.statemachine.StateMachine; | |||
import org.springframework.statemachine.StateMachineContext; | |||
import org.springframework.statemachine.StateMachinePersist; | |||
import org.springframework.statemachine.config.EnableStateMachine; | |||
import org.springframework.statemachine.config.StateMachineBuilder; | |||
import org.springframework.statemachine.persist.DefaultStateMachinePersister; | |||
import org.springframework.statemachine.persist.StateMachinePersister; | |||
import org.springframework.statemachine.support.DefaultStateMachineContext; | |||
import org.springframework.stereotype.Component; | |||
import java.util.EnumSet; | |||
/** | |||
* 项目申报状态机 | |||
@@ -29,234 +13,20 @@ import java.util.EnumSet; | |||
* @author CMM | |||
* @since 2023/02/07 15:56 | |||
*/ | |||
@Component | |||
@EnableStateMachine(name= ProjectDeclareStateMachineBuilder.MACHINEID_TO) | |||
@RequiredArgsConstructor | |||
public class ProjectDeclareStateMachineBuilder { | |||
private static final ProjectDeclareGuardFactory projectDeclareGuardFactory = new ProjectDeclareGuardFactory(); | |||
private final BeanFactory beanFactory; | |||
private Logger logger = LoggerFactory.getLogger(getClass()); | |||
/** | |||
* TO状态机 | |||
*/ | |||
public final static String MACHINEID_TO = "MACHINEID_TO"; | |||
public StateMachine<ProjectStatusEnum, ProjectStatusChangeEvent> build() throws Exception { | |||
StateMachine<ProjectStatusEnum, ProjectStatusChangeEvent> stateMachine = build(beanFactory); | |||
logger.info("状态机ID:" + stateMachine.getId()); | |||
stateMachine.start(); | |||
return stateMachine; | |||
} | |||
public interface ProjectDeclareStateMachineBuilder { | |||
StateMachine<ProjectStatusEnum, ProjectStatusChangeEvent> build() throws Exception; | |||
/** | |||
* 构建状态机 | |||
* @param beanFactory | |||
* @author CMM | |||
* @since 2023/02/07 16:15 | |||
*/ | |||
public StateMachine<ProjectStatusEnum, ProjectStatusChangeEvent> build(BeanFactory beanFactory) throws Exception { | |||
StateMachineBuilder.Builder<ProjectStatusEnum, ProjectStatusChangeEvent> builder = StateMachineBuilder.builder(); | |||
builder.configureConfiguration() | |||
.withConfiguration() | |||
.machineId(MACHINEID_TO) | |||
.beanFactory(beanFactory); | |||
builder.configureStates() | |||
.withStates() | |||
.initial(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) | |||
.choice(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) | |||
.choice(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE) | |||
.states(EnumSet.allOf(ProjectStatusEnum.class)); | |||
builder.configureTransitions() | |||
// 单位内部审核通过,从单位内部审核中到待预审 | |||
.withExternal() | |||
.source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) | |||
.target(ProjectStatusEnum.PENDING_PREQUALIFICATION) | |||
.event(ProjectStatusChangeEvent.UNDER_INTERNAL_PASS).and() | |||
// 单位内部审核驳回,从单位内部审核中到单位内部审核不通过 | |||
.withExternal() | |||
.source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) | |||
.target(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS) | |||
.event(ProjectStatusChangeEvent.UNDER_INTERNAL_REJECT).and() | |||
// 单位内部审核中撤回,从单位内部审核中到待申报 | |||
.withExternal() | |||
.source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) | |||
.target(ProjectStatusEnum.TO_BE_DECLARED) | |||
.event(ProjectStatusChangeEvent.UNDER_INTERNAL_WITHDRAW).and() | |||
// 单位内部审核不通过重新提交,从单位内部审核不通过到单位内部审核中 | |||
.withExternal() | |||
.source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS) | |||
.target(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) | |||
.event(ProjectStatusChangeEvent.UNDER_INTERNAL_REJECT_RESUBMIT).and() | |||
// 待预审预审申报,从待预审到待预审选择 | |||
.withExternal() | |||
.source(ProjectStatusEnum.PENDING_PREQUALIFICATION) | |||
.target(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) | |||
.event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_DECLARE).and() | |||
// 待预审申报,从待预审选择->省级部门联审中,预审中,完成其中一种状态 | |||
.withChoice() | |||
.source(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) | |||
.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) | |||
.target(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS) | |||
.event(ProjectStatusChangeEvent.PROVINCIAL_DEPARTMENT_REVIEW_PASS).and() | |||
// 省级部门联审通过,从省级部门联审成功到预审中 | |||
.withExternal() | |||
.source(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS) | |||
.target(ProjectStatusEnum.PRE_APPLYING) | |||
.event(ProjectStatusChangeEvent.PROVINCIAL_PASS_TO_PRELIMINARY_REVIEW).and() | |||
// 省级部门联审不通过,从省级部门联审中到省级部门联审不通过 | |||
.withExternal() | |||
.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) | |||
.event(ProjectStatusChangeEvent.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_WITHDRAW).and() | |||
// 预审通过,从预审中到部门联审中 | |||
.withExternal() | |||
.source(ProjectStatusEnum.PRE_APPLYING) | |||
.target(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW) | |||
.event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_PASS).and() | |||
// 预审驳回,从预审中到预审不通过 | |||
.withExternal() | |||
.source(ProjectStatusEnum.PRE_APPLYING) | |||
.target(ProjectStatusEnum.PREQUALIFICATION_FAILED) | |||
.event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_REJECT).and() | |||
// 预审中撤回,从预审中到预审中撤回选择态 | |||
.withExternal() | |||
.source(ProjectStatusEnum.PRE_APPLYING) | |||
.target(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE) | |||
.event(ProjectStatusChangeEvent.PRE_APPLYING_WITHDRAW).and() | |||
// 预审中撤回,从预审中撤回选择态->省级部门联审成功,待预审,完成其中一种状态 | |||
.withChoice() | |||
.source(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE) | |||
.first(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS,projectDeclareGuardFactory.new PendingPreQualificationChoiceGuard() | |||
,new ProjectDeclareChoiceAction()) | |||
.last(ProjectStatusEnum.PENDING_PREQUALIFICATION,new ProjectDeclareChoiceAction()).and() | |||
// 预审不通过重新提交,从预审不通过到待预审选择 | |||
.withExternal() | |||
.source(ProjectStatusEnum.PREQUALIFICATION_FAILED) | |||
.target(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) | |||
.event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_REJECT_RESUBMIT).and() | |||
// 预审不通过重新提交,从待预审选择->省级部门联审中,预审中,完成其中一种状态 | |||
.withChoice() | |||
.source(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) | |||
.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) | |||
.target(ProjectStatusEnum.IN_THE_ANNUAL_PLAN) | |||
.event(ProjectStatusChangeEvent.DEPARTMENT_UNITED_REVIEW_PASS).and() | |||
// 部门联审驳回,从部门联审中到部门联审不通过 | |||
.withExternal() | |||
.source(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW) | |||
.target(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW_FAILED) | |||
.event(ProjectStatusChangeEvent.DEPARTMENT_UNITED_REVIEW_REJECT).and() | |||
// 部门联审中撤回,从部门联审中到预审中 | |||
.withExternal() | |||
.source(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW) | |||
.target(ProjectStatusEnum.PRE_APPLYING) | |||
.event(ProjectStatusChangeEvent.DEPARTMENT_JOINT_REVIEW_WITHDRAW).and() | |||
// 年度计划中开启方案申报,从年度计划中到方案待申报 | |||
.withExternal() | |||
.source(ProjectStatusEnum.IN_THE_ANNUAL_PLAN) | |||
.target(ProjectStatusEnum.PLAN_TO_BE_DECLARED) | |||
.event(ProjectStatusChangeEvent.ANNUAL_PLAN_PROJECT_OPEN_PLAN_DECLARE).and() | |||
// 年度计划中暂缓,从年度计划中到被暂缓 | |||
.withExternal() | |||
.source(ProjectStatusEnum.IN_THE_ANNUAL_PLAN) | |||
.target(ProjectStatusEnum.BE_SUSPENDED) | |||
.event(ProjectStatusChangeEvent.ANNUAL_PLAN_SUSPEND).and() | |||
// 方案待申报申报方案,从方案待申报到方案评审中 | |||
.withExternal() | |||
.source(ProjectStatusEnum.PLAN_TO_BE_DECLARED) | |||
.target(ProjectStatusEnum.SCHEME_UNDER_REVIEW) | |||
.event(ProjectStatusChangeEvent.DECLARE_PLAN).and() | |||
// 方案评审通过,从方案评审中到待立项批复 | |||
.withExternal() | |||
.source(ProjectStatusEnum.SCHEME_UNDER_REVIEW) | |||
.target(ProjectStatusEnum.TO_BE_APPROVED) | |||
.event(ProjectStatusChangeEvent.PLAN_REVIEW_PASS).and() | |||
// 方案评审驳回,从方案评审中到方案评审不通过 | |||
.withExternal() | |||
.source(ProjectStatusEnum.SCHEME_UNDER_REVIEW) | |||
.target(ProjectStatusEnum.SCHEME_REVIEW_FAILED) | |||
.event(ProjectStatusChangeEvent.PLAN_REVIEW_REJECT).and() | |||
// 方案评审中撤回,从方案评审中到方案待申报 | |||
.withExternal() | |||
.source(ProjectStatusEnum.SCHEME_UNDER_REVIEW) | |||
.target(ProjectStatusEnum.PLAN_TO_BE_DECLARED) | |||
.event(ProjectStatusChangeEvent.SCHEME_UNDER_REVIEW_WITHDRAW).and() | |||
// 方案评审不通过重新提交,从方案评审不通过到方案评审中 | |||
.withExternal() | |||
.source(ProjectStatusEnum.SCHEME_REVIEW_FAILED) | |||
.target(ProjectStatusEnum.SCHEME_UNDER_REVIEW) | |||
.event(ProjectStatusChangeEvent.PLAN_REVIEW_REJECT_RESUBMIT).and() | |||
// 待立项批复批复,从待立项批复到待采购 | |||
.withExternal() | |||
.source(ProjectStatusEnum.TO_BE_APPROVED) | |||
.target(ProjectStatusEnum.TO_BE_PURCHASED) | |||
.event(ProjectStatusChangeEvent.PROJECT_APPROVAL).and() | |||
// 待采购采购备案,从待采购到建设中 | |||
.withExternal() | |||
.source(ProjectStatusEnum.TO_BE_PURCHASED) | |||
.target(ProjectStatusEnum.UNDER_CONSTRUCTION) | |||
.event(ProjectStatusChangeEvent.PURCHASE_PUT_ON_RECORD).and() | |||
// 建设中初验备案,从建设中到待终验 | |||
.withExternal() | |||
.source(ProjectStatusEnum.UNDER_CONSTRUCTION) | |||
.target(ProjectStatusEnum.TO_BE_FINALLY_INSPECTED) | |||
.event(ProjectStatusChangeEvent.PRELIMINARY_ACCEPTANCE_PUT_ON_RECORD).and() | |||
// 待终验终验申请,从待终验到终验审核中 | |||
.withExternal() | |||
.source(ProjectStatusEnum.TO_BE_FINALLY_INSPECTED) | |||
.target(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) | |||
.event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_APPLICATION).and() | |||
// 终审审核通过,从终审审核中到已归档 | |||
.withExternal() | |||
.source(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) | |||
.target(ProjectStatusEnum.ARCHIVED) | |||
.event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_PASS).and() | |||
// 终审审核不通过,从终审审核中到终审审核不通过 | |||
.withExternal() | |||
.source(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) | |||
.target(ProjectStatusEnum.FINAL_ACCEPTANCE_REVIEW_FAILED) | |||
.event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_REJECT).and() | |||
// 终审审核中撤回,从终审审核中到待终验 | |||
.withExternal() | |||
.source(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) | |||
.target(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) | |||
.event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_IS_UNDER_REVIEW_WITHDRAW).and(); | |||
return builder.build(); | |||
} | |||
StateMachine<ProjectStatusEnum, ProjectStatusChangeEvent> build(BeanFactory beanFactory) throws Exception; | |||
/** | |||
* 持久化配置 | |||
* @author CMM | |||
* @since 2023/02/07 16:22 | |||
*/ | |||
@Bean(name = "projectDeclareStateMachinePersister") | |||
public StateMachinePersister<ProjectStatusEnum, ProjectStatusChangeEvent, Project> getProjectPersister() { | |||
return new DefaultStateMachinePersister<>(new StateMachinePersist<ProjectStatusEnum, ProjectStatusChangeEvent, Project>() { | |||
@Override | |||
public void write(StateMachineContext<ProjectStatusEnum, ProjectStatusChangeEvent> context, Project contextObj) { | |||
} | |||
@Override | |||
public StateMachineContext<ProjectStatusEnum, ProjectStatusChangeEvent> read(Project contextObj) { | |||
StateMachineContext<ProjectStatusEnum, ProjectStatusChangeEvent> result = new DefaultStateMachineContext(ProjectStatusEnum.getValue(contextObj.getStatus()), | |||
null, null, null, null, MACHINEID_TO); | |||
return result; | |||
} | |||
}); | |||
} | |||
StateMachinePersister<ProjectStatusEnum, ProjectStatusChangeEvent, Project> getProjectPersister(); | |||
} |
@@ -0,0 +1,274 @@ | |||
package com.ningdatech.pmapi.common.statemachine.builder; | |||
import com.ningdatech.pmapi.common.statemachine.action.ProjectDeclareChoiceAction; | |||
import com.ningdatech.pmapi.common.statemachine.contants.RegionContant; | |||
import com.ningdatech.pmapi.common.statemachine.event.ProjectStatusChangeEvent; | |||
import com.ningdatech.pmapi.common.statemachine.factory.ProjectDeclareGuardFactory; | |||
import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; | |||
import com.ningdatech.pmapi.projectlib.model.entity.Project; | |||
import lombok.RequiredArgsConstructor; | |||
import org.slf4j.Logger; | |||
import org.slf4j.LoggerFactory; | |||
import org.springframework.beans.factory.BeanFactory; | |||
import org.springframework.context.annotation.Bean; | |||
import org.springframework.statemachine.StateMachine; | |||
import org.springframework.statemachine.StateMachineContext; | |||
import org.springframework.statemachine.StateMachinePersist; | |||
import org.springframework.statemachine.config.EnableStateMachine; | |||
import org.springframework.statemachine.config.StateMachineBuilder; | |||
import org.springframework.statemachine.persist.DefaultStateMachinePersister; | |||
import org.springframework.statemachine.persist.StateMachinePersister; | |||
import org.springframework.statemachine.support.DefaultStateMachineContext; | |||
import org.springframework.stereotype.Component; | |||
import java.util.EnumSet; | |||
/** | |||
* 项目申报状态机 | |||
* 景宁畲族自治县 | |||
* @author CMM | |||
* @since 2023/02/07 15:56 | |||
*/ | |||
@Component | |||
@EnableStateMachine(name= ProjectDeclareStateMachineJNBuilder.MACHINEID_TO) | |||
@RequiredArgsConstructor | |||
public class ProjectDeclareStateMachineJNBuilder implements ProjectDeclareStateMachineBuilder{ | |||
private static final ProjectDeclareGuardFactory projectDeclareGuardFactory = new ProjectDeclareGuardFactory(); | |||
private final BeanFactory beanFactory; | |||
private Logger logger = LoggerFactory.getLogger(getClass()); | |||
private StateMachinePersister stateMachinePersister; | |||
/** | |||
* TO状态机 | |||
*/ | |||
public final static String MACHINEID_TO = RegionContant.LS_JN_CODE; | |||
@Override | |||
public StateMachine<ProjectStatusEnum, ProjectStatusChangeEvent> build() throws Exception { | |||
StateMachine<ProjectStatusEnum, ProjectStatusChangeEvent> stateMachine = build(beanFactory); | |||
logger.info("状态机ID:" + stateMachine.getId()); | |||
stateMachine.start(); | |||
return stateMachine; | |||
} | |||
/** | |||
* 构建状态机 | |||
* @param beanFactory | |||
* @author CMM | |||
* @since 2023/02/07 16:15 | |||
*/ | |||
@Override | |||
public StateMachine<ProjectStatusEnum, ProjectStatusChangeEvent> build(BeanFactory beanFactory) throws Exception { | |||
StateMachineBuilder.Builder<ProjectStatusEnum, ProjectStatusChangeEvent> builder = StateMachineBuilder.builder(); | |||
builder.configureConfiguration() | |||
.withConfiguration() | |||
.machineId(MACHINEID_TO) | |||
.beanFactory(beanFactory); | |||
builder.configureStates() | |||
.withStates() | |||
.initial(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) | |||
.choice(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) | |||
.choice(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE) | |||
.states(EnumSet.allOf(ProjectStatusEnum.class)); | |||
builder.configureTransitions() | |||
// 单位内部审核通过,从单位内部审核中到待预审 | |||
.withExternal() | |||
.source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) | |||
.target(ProjectStatusEnum.PENDING_PREQUALIFICATION) | |||
.event(ProjectStatusChangeEvent.UNDER_INTERNAL_PASS).and() | |||
// 单位内部审核驳回,从单位内部审核中到单位内部审核不通过 | |||
.withExternal() | |||
.source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) | |||
.target(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS) | |||
.event(ProjectStatusChangeEvent.UNDER_INTERNAL_REJECT).and() | |||
// 单位内部审核中撤回,从单位内部审核中到待申报 | |||
.withExternal() | |||
.source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) | |||
.target(ProjectStatusEnum.TO_BE_DECLARED) | |||
.event(ProjectStatusChangeEvent.UNDER_INTERNAL_WITHDRAW).and() | |||
// 单位内部审核不通过重新提交,从单位内部审核不通过到单位内部审核中 | |||
.withExternal() | |||
.source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS) | |||
.target(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) | |||
.event(ProjectStatusChangeEvent.UNDER_INTERNAL_REJECT_RESUBMIT).and() | |||
// 待预审预审申报,从待预审到待预审选择 | |||
.withExternal() | |||
.source(ProjectStatusEnum.PENDING_PREQUALIFICATION) | |||
.target(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) | |||
.event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_DECLARE).and() | |||
// 待预审申报,从待预审选择->省级部门联审中,预审中,完成其中一种状态 | |||
.withChoice() | |||
.source(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) | |||
.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) | |||
.target(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS) | |||
.event(ProjectStatusChangeEvent.PROVINCIAL_DEPARTMENT_REVIEW_PASS).and() | |||
// 省级部门联审通过,从省级部门联审成功到预审中 | |||
.withExternal() | |||
.source(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS) | |||
.target(ProjectStatusEnum.PRE_APPLYING) | |||
.event(ProjectStatusChangeEvent.PROVINCIAL_PASS_TO_PRELIMINARY_REVIEW).and() | |||
// 省级部门联审不通过,从省级部门联审中到省级部门联审不通过 | |||
.withExternal() | |||
.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) | |||
.event(ProjectStatusChangeEvent.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_WITHDRAW).and() | |||
// 预审通过,从预审中到部门联审中 | |||
.withExternal() | |||
.source(ProjectStatusEnum.PRE_APPLYING) | |||
.target(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW) | |||
.event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_PASS).and() | |||
// 预审驳回,从预审中到预审不通过 | |||
.withExternal() | |||
.source(ProjectStatusEnum.PRE_APPLYING) | |||
.target(ProjectStatusEnum.PREQUALIFICATION_FAILED) | |||
.event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_REJECT).and() | |||
// 预审中撤回,从预审中到预审中撤回选择态 | |||
.withExternal() | |||
.source(ProjectStatusEnum.PRE_APPLYING) | |||
.target(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE) | |||
.event(ProjectStatusChangeEvent.PRE_APPLYING_WITHDRAW).and() | |||
// 预审中撤回,从预审中撤回选择态->省级部门联审成功,待预审,完成其中一种状态 | |||
.withChoice() | |||
.source(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE) | |||
.first(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS,projectDeclareGuardFactory.new PendingPreQualificationChoiceGuard() | |||
,new ProjectDeclareChoiceAction()) | |||
.last(ProjectStatusEnum.PENDING_PREQUALIFICATION,new ProjectDeclareChoiceAction()).and() | |||
// 预审不通过重新提交,从预审不通过到待预审选择 | |||
.withExternal() | |||
.source(ProjectStatusEnum.PREQUALIFICATION_FAILED) | |||
.target(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) | |||
.event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_REJECT_RESUBMIT).and() | |||
// 预审不通过重新提交,从待预审选择->省级部门联审中,预审中,完成其中一种状态 | |||
.withChoice() | |||
.source(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) | |||
.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) | |||
.target(ProjectStatusEnum.IN_THE_ANNUAL_PLAN) | |||
.event(ProjectStatusChangeEvent.DEPARTMENT_UNITED_REVIEW_PASS).and() | |||
// 部门联审驳回,从部门联审中到部门联审不通过 | |||
.withExternal() | |||
.source(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW) | |||
.target(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW_FAILED) | |||
.event(ProjectStatusChangeEvent.DEPARTMENT_UNITED_REVIEW_REJECT).and() | |||
// 部门联审中撤回,从部门联审中到预审中 | |||
.withExternal() | |||
.source(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW) | |||
.target(ProjectStatusEnum.PRE_APPLYING) | |||
.event(ProjectStatusChangeEvent.DEPARTMENT_JOINT_REVIEW_WITHDRAW).and() | |||
// 年度计划中开启方案申报,从年度计划中到方案待申报 | |||
.withExternal() | |||
.source(ProjectStatusEnum.IN_THE_ANNUAL_PLAN) | |||
.target(ProjectStatusEnum.PLAN_TO_BE_DECLARED) | |||
.event(ProjectStatusChangeEvent.ANNUAL_PLAN_PROJECT_OPEN_PLAN_DECLARE).and() | |||
// 年度计划中暂缓,从年度计划中到被暂缓 | |||
.withExternal() | |||
.source(ProjectStatusEnum.IN_THE_ANNUAL_PLAN) | |||
.target(ProjectStatusEnum.BE_SUSPENDED) | |||
.event(ProjectStatusChangeEvent.ANNUAL_PLAN_SUSPEND).and() | |||
// 方案待申报申报方案,从方案待申报到方案评审中 | |||
.withExternal() | |||
.source(ProjectStatusEnum.PLAN_TO_BE_DECLARED) | |||
.target(ProjectStatusEnum.SCHEME_UNDER_REVIEW) | |||
.event(ProjectStatusChangeEvent.DECLARE_PLAN).and() | |||
// 方案评审通过,从方案评审中到待立项批复 | |||
.withExternal() | |||
.source(ProjectStatusEnum.SCHEME_UNDER_REVIEW) | |||
.target(ProjectStatusEnum.TO_BE_APPROVED) | |||
.event(ProjectStatusChangeEvent.PLAN_REVIEW_PASS).and() | |||
// 方案评审驳回,从方案评审中到方案评审不通过 | |||
.withExternal() | |||
.source(ProjectStatusEnum.SCHEME_UNDER_REVIEW) | |||
.target(ProjectStatusEnum.SCHEME_REVIEW_FAILED) | |||
.event(ProjectStatusChangeEvent.PLAN_REVIEW_REJECT).and() | |||
// 方案评审中撤回,从方案评审中到方案待申报 | |||
.withExternal() | |||
.source(ProjectStatusEnum.SCHEME_UNDER_REVIEW) | |||
.target(ProjectStatusEnum.PLAN_TO_BE_DECLARED) | |||
.event(ProjectStatusChangeEvent.SCHEME_UNDER_REVIEW_WITHDRAW).and() | |||
// 方案评审不通过重新提交,从方案评审不通过到方案评审中 | |||
.withExternal() | |||
.source(ProjectStatusEnum.SCHEME_REVIEW_FAILED) | |||
.target(ProjectStatusEnum.SCHEME_UNDER_REVIEW) | |||
.event(ProjectStatusChangeEvent.PLAN_REVIEW_REJECT_RESUBMIT).and() | |||
// 待立项批复批复,从待立项批复到待采购 | |||
.withExternal() | |||
.source(ProjectStatusEnum.TO_BE_APPROVED) | |||
.target(ProjectStatusEnum.TO_BE_PURCHASED) | |||
.event(ProjectStatusChangeEvent.PROJECT_APPROVAL).and() | |||
// 待采购采购备案,从待采购到建设中 | |||
.withExternal() | |||
.source(ProjectStatusEnum.TO_BE_PURCHASED) | |||
.target(ProjectStatusEnum.UNDER_CONSTRUCTION) | |||
.event(ProjectStatusChangeEvent.PURCHASE_PUT_ON_RECORD).and() | |||
// 建设中初验备案,从建设中到待终验 | |||
.withExternal() | |||
.source(ProjectStatusEnum.UNDER_CONSTRUCTION) | |||
.target(ProjectStatusEnum.TO_BE_FINALLY_INSPECTED) | |||
.event(ProjectStatusChangeEvent.PRELIMINARY_ACCEPTANCE_PUT_ON_RECORD).and() | |||
// 待终验终验申请,从待终验到终验审核中 | |||
.withExternal() | |||
.source(ProjectStatusEnum.TO_BE_FINALLY_INSPECTED) | |||
.target(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) | |||
.event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_APPLICATION).and() | |||
// 终审审核通过,从终审审核中到已归档 | |||
.withExternal() | |||
.source(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) | |||
.target(ProjectStatusEnum.ARCHIVED) | |||
.event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_PASS).and() | |||
// 终审审核不通过,从终审审核中到终审审核不通过 | |||
.withExternal() | |||
.source(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) | |||
.target(ProjectStatusEnum.FINAL_ACCEPTANCE_REVIEW_FAILED) | |||
.event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_REJECT).and() | |||
// 终审审核中撤回,从终审审核中到待终验 | |||
.withExternal() | |||
.source(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) | |||
.target(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) | |||
.event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_IS_UNDER_REVIEW_WITHDRAW).and(); | |||
return builder.build(); | |||
} | |||
/** | |||
* 持久化配置 | |||
* @author CMM | |||
* @since 2023/02/07 16:22 | |||
*/ | |||
@Bean(name = "projectDeclareStateMachineJNPersister") | |||
@Override | |||
public StateMachinePersister<ProjectStatusEnum, ProjectStatusChangeEvent, Project> getProjectPersister() { | |||
StateMachinePersister sp = new DefaultStateMachinePersister<>(new StateMachinePersist<ProjectStatusEnum, ProjectStatusChangeEvent, Project>() { | |||
@Override | |||
public void write(StateMachineContext<ProjectStatusEnum, ProjectStatusChangeEvent> context, Project contextObj) { | |||
} | |||
@Override | |||
public StateMachineContext<ProjectStatusEnum, ProjectStatusChangeEvent> read(Project contextObj) { | |||
StateMachineContext<ProjectStatusEnum, ProjectStatusChangeEvent> result = new DefaultStateMachineContext(ProjectStatusEnum.getValue(contextObj.getStatus()), | |||
null, null, null, null, RegionContant.LS_YH_CODE); | |||
return result; | |||
} | |||
}); | |||
stateMachinePersister = sp; | |||
return sp; | |||
} | |||
public StateMachinePersister getStateMachinePersister(){ | |||
return stateMachinePersister; | |||
} | |||
} |
@@ -0,0 +1,274 @@ | |||
package com.ningdatech.pmapi.common.statemachine.builder; | |||
import com.ningdatech.pmapi.common.statemachine.action.ProjectDeclareChoiceAction; | |||
import com.ningdatech.pmapi.common.statemachine.contants.RegionContant; | |||
import com.ningdatech.pmapi.common.statemachine.event.ProjectStatusChangeEvent; | |||
import com.ningdatech.pmapi.common.statemachine.factory.ProjectDeclareGuardFactory; | |||
import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; | |||
import com.ningdatech.pmapi.projectlib.model.entity.Project; | |||
import lombok.RequiredArgsConstructor; | |||
import org.slf4j.Logger; | |||
import org.slf4j.LoggerFactory; | |||
import org.springframework.beans.factory.BeanFactory; | |||
import org.springframework.context.annotation.Bean; | |||
import org.springframework.statemachine.StateMachine; | |||
import org.springframework.statemachine.StateMachineContext; | |||
import org.springframework.statemachine.StateMachinePersist; | |||
import org.springframework.statemachine.config.EnableStateMachine; | |||
import org.springframework.statemachine.config.StateMachineBuilder; | |||
import org.springframework.statemachine.persist.DefaultStateMachinePersister; | |||
import org.springframework.statemachine.persist.StateMachinePersister; | |||
import org.springframework.statemachine.support.DefaultStateMachineContext; | |||
import org.springframework.stereotype.Component; | |||
import java.util.EnumSet; | |||
/** | |||
* 项目申报状态机 | |||
* 缙云县 | |||
* @author CMM | |||
* @since 2023/02/07 15:56 | |||
*/ | |||
@Component | |||
@EnableStateMachine(name= ProjectDeclareStateMachineJYBuilder.MACHINEID_TO) | |||
@RequiredArgsConstructor | |||
public class ProjectDeclareStateMachineJYBuilder implements ProjectDeclareStateMachineBuilder { | |||
private static final ProjectDeclareGuardFactory projectDeclareGuardFactory = new ProjectDeclareGuardFactory(); | |||
private final BeanFactory beanFactory; | |||
private Logger logger = LoggerFactory.getLogger(getClass()); | |||
private StateMachinePersister stateMachinePersister; | |||
/** | |||
* TO状态机 | |||
*/ | |||
public final static String MACHINEID_TO = RegionContant.LS_JY_CODE; | |||
@Override | |||
public StateMachine<ProjectStatusEnum, ProjectStatusChangeEvent> build() throws Exception { | |||
StateMachine<ProjectStatusEnum, ProjectStatusChangeEvent> stateMachine = build(beanFactory); | |||
logger.info("状态机ID:" + stateMachine.getId()); | |||
stateMachine.start(); | |||
return stateMachine; | |||
} | |||
/** | |||
* 构建状态机 | |||
* @param beanFactory | |||
* @author CMM | |||
* @since 2023/02/07 16:15 | |||
*/ | |||
@Override | |||
public StateMachine<ProjectStatusEnum, ProjectStatusChangeEvent> build(BeanFactory beanFactory) throws Exception { | |||
StateMachineBuilder.Builder<ProjectStatusEnum, ProjectStatusChangeEvent> builder = StateMachineBuilder.builder(); | |||
builder.configureConfiguration() | |||
.withConfiguration() | |||
.machineId(MACHINEID_TO) | |||
.beanFactory(beanFactory); | |||
builder.configureStates() | |||
.withStates() | |||
.initial(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) | |||
.choice(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) | |||
.choice(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE) | |||
.states(EnumSet.allOf(ProjectStatusEnum.class)); | |||
builder.configureTransitions() | |||
// 单位内部审核通过,从单位内部审核中到待预审 | |||
.withExternal() | |||
.source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) | |||
.target(ProjectStatusEnum.PENDING_PREQUALIFICATION) | |||
.event(ProjectStatusChangeEvent.UNDER_INTERNAL_PASS).and() | |||
// 单位内部审核驳回,从单位内部审核中到单位内部审核不通过 | |||
.withExternal() | |||
.source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) | |||
.target(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS) | |||
.event(ProjectStatusChangeEvent.UNDER_INTERNAL_REJECT).and() | |||
// 单位内部审核中撤回,从单位内部审核中到待申报 | |||
.withExternal() | |||
.source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) | |||
.target(ProjectStatusEnum.TO_BE_DECLARED) | |||
.event(ProjectStatusChangeEvent.UNDER_INTERNAL_WITHDRAW).and() | |||
// 单位内部审核不通过重新提交,从单位内部审核不通过到单位内部审核中 | |||
.withExternal() | |||
.source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS) | |||
.target(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) | |||
.event(ProjectStatusChangeEvent.UNDER_INTERNAL_REJECT_RESUBMIT).and() | |||
// 待预审预审申报,从待预审到待预审选择 | |||
.withExternal() | |||
.source(ProjectStatusEnum.PENDING_PREQUALIFICATION) | |||
.target(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) | |||
.event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_DECLARE).and() | |||
// 待预审申报,从待预审选择->省级部门联审中,预审中,完成其中一种状态 | |||
.withChoice() | |||
.source(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) | |||
.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) | |||
.target(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS) | |||
.event(ProjectStatusChangeEvent.PROVINCIAL_DEPARTMENT_REVIEW_PASS).and() | |||
// 省级部门联审通过,从省级部门联审成功到预审中 | |||
.withExternal() | |||
.source(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS) | |||
.target(ProjectStatusEnum.PRE_APPLYING) | |||
.event(ProjectStatusChangeEvent.PROVINCIAL_PASS_TO_PRELIMINARY_REVIEW).and() | |||
// 省级部门联审不通过,从省级部门联审中到省级部门联审不通过 | |||
.withExternal() | |||
.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) | |||
.event(ProjectStatusChangeEvent.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_WITHDRAW).and() | |||
// 预审通过,从预审中到部门联审中 | |||
.withExternal() | |||
.source(ProjectStatusEnum.PRE_APPLYING) | |||
.target(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW) | |||
.event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_PASS).and() | |||
// 预审驳回,从预审中到预审不通过 | |||
.withExternal() | |||
.source(ProjectStatusEnum.PRE_APPLYING) | |||
.target(ProjectStatusEnum.PREQUALIFICATION_FAILED) | |||
.event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_REJECT).and() | |||
// 预审中撤回,从预审中到预审中撤回选择态 | |||
.withExternal() | |||
.source(ProjectStatusEnum.PRE_APPLYING) | |||
.target(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE) | |||
.event(ProjectStatusChangeEvent.PRE_APPLYING_WITHDRAW).and() | |||
// 预审中撤回,从预审中撤回选择态->省级部门联审成功,待预审,完成其中一种状态 | |||
.withChoice() | |||
.source(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE) | |||
.first(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS,projectDeclareGuardFactory.new PendingPreQualificationChoiceGuard() | |||
,new ProjectDeclareChoiceAction()) | |||
.last(ProjectStatusEnum.PENDING_PREQUALIFICATION,new ProjectDeclareChoiceAction()).and() | |||
// 预审不通过重新提交,从预审不通过到待预审选择 | |||
.withExternal() | |||
.source(ProjectStatusEnum.PREQUALIFICATION_FAILED) | |||
.target(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) | |||
.event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_REJECT_RESUBMIT).and() | |||
// 预审不通过重新提交,从待预审选择->省级部门联审中,预审中,完成其中一种状态 | |||
.withChoice() | |||
.source(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) | |||
.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) | |||
.target(ProjectStatusEnum.IN_THE_ANNUAL_PLAN) | |||
.event(ProjectStatusChangeEvent.DEPARTMENT_UNITED_REVIEW_PASS).and() | |||
// 部门联审驳回,从部门联审中到部门联审不通过 | |||
.withExternal() | |||
.source(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW) | |||
.target(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW_FAILED) | |||
.event(ProjectStatusChangeEvent.DEPARTMENT_UNITED_REVIEW_REJECT).and() | |||
// 部门联审中撤回,从部门联审中到预审中 | |||
.withExternal() | |||
.source(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW) | |||
.target(ProjectStatusEnum.PRE_APPLYING) | |||
.event(ProjectStatusChangeEvent.DEPARTMENT_JOINT_REVIEW_WITHDRAW).and() | |||
// 年度计划中开启方案申报,从年度计划中到方案待申报 | |||
.withExternal() | |||
.source(ProjectStatusEnum.IN_THE_ANNUAL_PLAN) | |||
.target(ProjectStatusEnum.PLAN_TO_BE_DECLARED) | |||
.event(ProjectStatusChangeEvent.ANNUAL_PLAN_PROJECT_OPEN_PLAN_DECLARE).and() | |||
// 年度计划中暂缓,从年度计划中到被暂缓 | |||
.withExternal() | |||
.source(ProjectStatusEnum.IN_THE_ANNUAL_PLAN) | |||
.target(ProjectStatusEnum.BE_SUSPENDED) | |||
.event(ProjectStatusChangeEvent.ANNUAL_PLAN_SUSPEND).and() | |||
// 方案待申报申报方案,从方案待申报到方案评审中 | |||
.withExternal() | |||
.source(ProjectStatusEnum.PLAN_TO_BE_DECLARED) | |||
.target(ProjectStatusEnum.SCHEME_UNDER_REVIEW) | |||
.event(ProjectStatusChangeEvent.DECLARE_PLAN).and() | |||
// 方案评审通过,从方案评审中到待立项批复 | |||
.withExternal() | |||
.source(ProjectStatusEnum.SCHEME_UNDER_REVIEW) | |||
.target(ProjectStatusEnum.TO_BE_APPROVED) | |||
.event(ProjectStatusChangeEvent.PLAN_REVIEW_PASS).and() | |||
// 方案评审驳回,从方案评审中到方案评审不通过 | |||
.withExternal() | |||
.source(ProjectStatusEnum.SCHEME_UNDER_REVIEW) | |||
.target(ProjectStatusEnum.SCHEME_REVIEW_FAILED) | |||
.event(ProjectStatusChangeEvent.PLAN_REVIEW_REJECT).and() | |||
// 方案评审中撤回,从方案评审中到方案待申报 | |||
.withExternal() | |||
.source(ProjectStatusEnum.SCHEME_UNDER_REVIEW) | |||
.target(ProjectStatusEnum.PLAN_TO_BE_DECLARED) | |||
.event(ProjectStatusChangeEvent.SCHEME_UNDER_REVIEW_WITHDRAW).and() | |||
// 方案评审不通过重新提交,从方案评审不通过到方案评审中 | |||
.withExternal() | |||
.source(ProjectStatusEnum.SCHEME_REVIEW_FAILED) | |||
.target(ProjectStatusEnum.SCHEME_UNDER_REVIEW) | |||
.event(ProjectStatusChangeEvent.PLAN_REVIEW_REJECT_RESUBMIT).and() | |||
// 待立项批复批复,从待立项批复到待采购 | |||
.withExternal() | |||
.source(ProjectStatusEnum.TO_BE_APPROVED) | |||
.target(ProjectStatusEnum.TO_BE_PURCHASED) | |||
.event(ProjectStatusChangeEvent.PROJECT_APPROVAL).and() | |||
// 待采购采购备案,从待采购到建设中 | |||
.withExternal() | |||
.source(ProjectStatusEnum.TO_BE_PURCHASED) | |||
.target(ProjectStatusEnum.UNDER_CONSTRUCTION) | |||
.event(ProjectStatusChangeEvent.PURCHASE_PUT_ON_RECORD).and() | |||
// 建设中初验备案,从建设中到待终验 | |||
.withExternal() | |||
.source(ProjectStatusEnum.UNDER_CONSTRUCTION) | |||
.target(ProjectStatusEnum.TO_BE_FINALLY_INSPECTED) | |||
.event(ProjectStatusChangeEvent.PRELIMINARY_ACCEPTANCE_PUT_ON_RECORD).and() | |||
// 待终验终验申请,从待终验到终验审核中 | |||
.withExternal() | |||
.source(ProjectStatusEnum.TO_BE_FINALLY_INSPECTED) | |||
.target(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) | |||
.event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_APPLICATION).and() | |||
// 终审审核通过,从终审审核中到已归档 | |||
.withExternal() | |||
.source(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) | |||
.target(ProjectStatusEnum.ARCHIVED) | |||
.event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_PASS).and() | |||
// 终审审核不通过,从终审审核中到终审审核不通过 | |||
.withExternal() | |||
.source(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) | |||
.target(ProjectStatusEnum.FINAL_ACCEPTANCE_REVIEW_FAILED) | |||
.event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_REJECT).and() | |||
// 终审审核中撤回,从终审审核中到待终验 | |||
.withExternal() | |||
.source(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) | |||
.target(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) | |||
.event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_IS_UNDER_REVIEW_WITHDRAW).and(); | |||
return builder.build(); | |||
} | |||
/** | |||
* 持久化配置 | |||
* @author CMM | |||
* @since 2023/02/07 16:22 | |||
*/ | |||
@Bean(name = "projectDeclareStateMachineJYPersister") | |||
@Override | |||
public StateMachinePersister<ProjectStatusEnum, ProjectStatusChangeEvent, Project> getProjectPersister() { | |||
StateMachinePersister sp = new DefaultStateMachinePersister<>(new StateMachinePersist<ProjectStatusEnum, ProjectStatusChangeEvent, Project>() { | |||
@Override | |||
public void write(StateMachineContext<ProjectStatusEnum, ProjectStatusChangeEvent> context, Project contextObj) { | |||
} | |||
@Override | |||
public StateMachineContext<ProjectStatusEnum, ProjectStatusChangeEvent> read(Project contextObj) { | |||
StateMachineContext<ProjectStatusEnum, ProjectStatusChangeEvent> result = new DefaultStateMachineContext(ProjectStatusEnum.getValue(contextObj.getStatus()), | |||
null, null, null, null, RegionContant.LS_YH_CODE); | |||
return result; | |||
} | |||
}); | |||
stateMachinePersister = sp; | |||
return sp; | |||
} | |||
public StateMachinePersister getStateMachinePersister(){ | |||
return stateMachinePersister; | |||
} | |||
} |
@@ -0,0 +1,274 @@ | |||
package com.ningdatech.pmapi.common.statemachine.builder; | |||
import com.ningdatech.pmapi.common.statemachine.action.ProjectDeclareChoiceAction; | |||
import com.ningdatech.pmapi.common.statemachine.contants.RegionContant; | |||
import com.ningdatech.pmapi.common.statemachine.event.ProjectStatusChangeEvent; | |||
import com.ningdatech.pmapi.common.statemachine.factory.ProjectDeclareGuardFactory; | |||
import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; | |||
import com.ningdatech.pmapi.projectlib.model.entity.Project; | |||
import lombok.RequiredArgsConstructor; | |||
import org.slf4j.Logger; | |||
import org.slf4j.LoggerFactory; | |||
import org.springframework.beans.factory.BeanFactory; | |||
import org.springframework.context.annotation.Bean; | |||
import org.springframework.statemachine.StateMachine; | |||
import org.springframework.statemachine.StateMachineContext; | |||
import org.springframework.statemachine.StateMachinePersist; | |||
import org.springframework.statemachine.config.EnableStateMachine; | |||
import org.springframework.statemachine.config.StateMachineBuilder; | |||
import org.springframework.statemachine.persist.DefaultStateMachinePersister; | |||
import org.springframework.statemachine.persist.StateMachinePersister; | |||
import org.springframework.statemachine.support.DefaultStateMachineContext; | |||
import org.springframework.stereotype.Component; | |||
import java.util.EnumSet; | |||
/** | |||
* 项目申报状态机 | |||
* 开发区 | |||
* @author CMM | |||
* @since 2023/02/07 15:56 | |||
*/ | |||
@Component | |||
@EnableStateMachine(name= ProjectDeclareStateMachineKFQBuilder.MACHINEID_TO) | |||
@RequiredArgsConstructor | |||
public class ProjectDeclareStateMachineKFQBuilder implements ProjectDeclareStateMachineBuilder { | |||
private static final ProjectDeclareGuardFactory projectDeclareGuardFactory = new ProjectDeclareGuardFactory(); | |||
private final BeanFactory beanFactory; | |||
private Logger logger = LoggerFactory.getLogger(getClass()); | |||
private StateMachinePersister stateMachinePersister; | |||
/** | |||
* TO状态机 | |||
*/ | |||
public final static String MACHINEID_TO = RegionContant.LS_KFQ_CODE; | |||
@Override | |||
public StateMachine<ProjectStatusEnum, ProjectStatusChangeEvent> build() throws Exception { | |||
StateMachine<ProjectStatusEnum, ProjectStatusChangeEvent> stateMachine = build(beanFactory); | |||
logger.info("状态机ID:" + stateMachine.getId()); | |||
stateMachine.start(); | |||
return stateMachine; | |||
} | |||
/** | |||
* 构建状态机 | |||
* @param beanFactory | |||
* @author CMM | |||
* @since 2023/02/07 16:15 | |||
*/ | |||
@Override | |||
public StateMachine<ProjectStatusEnum, ProjectStatusChangeEvent> build(BeanFactory beanFactory) throws Exception { | |||
StateMachineBuilder.Builder<ProjectStatusEnum, ProjectStatusChangeEvent> builder = StateMachineBuilder.builder(); | |||
builder.configureConfiguration() | |||
.withConfiguration() | |||
.machineId(MACHINEID_TO) | |||
.beanFactory(beanFactory); | |||
builder.configureStates() | |||
.withStates() | |||
.initial(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) | |||
.choice(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) | |||
.choice(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE) | |||
.states(EnumSet.allOf(ProjectStatusEnum.class)); | |||
builder.configureTransitions() | |||
// 单位内部审核通过,从单位内部审核中到待预审 | |||
.withExternal() | |||
.source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) | |||
.target(ProjectStatusEnum.PENDING_PREQUALIFICATION) | |||
.event(ProjectStatusChangeEvent.UNDER_INTERNAL_PASS).and() | |||
// 单位内部审核驳回,从单位内部审核中到单位内部审核不通过 | |||
.withExternal() | |||
.source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) | |||
.target(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS) | |||
.event(ProjectStatusChangeEvent.UNDER_INTERNAL_REJECT).and() | |||
// 单位内部审核中撤回,从单位内部审核中到待申报 | |||
.withExternal() | |||
.source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) | |||
.target(ProjectStatusEnum.TO_BE_DECLARED) | |||
.event(ProjectStatusChangeEvent.UNDER_INTERNAL_WITHDRAW).and() | |||
// 单位内部审核不通过重新提交,从单位内部审核不通过到单位内部审核中 | |||
.withExternal() | |||
.source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS) | |||
.target(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) | |||
.event(ProjectStatusChangeEvent.UNDER_INTERNAL_REJECT_RESUBMIT).and() | |||
// 待预审预审申报,从待预审到待预审选择 | |||
.withExternal() | |||
.source(ProjectStatusEnum.PENDING_PREQUALIFICATION) | |||
.target(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) | |||
.event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_DECLARE).and() | |||
// 待预审申报,从待预审选择->省级部门联审中,预审中,完成其中一种状态 | |||
.withChoice() | |||
.source(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) | |||
.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) | |||
.target(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS) | |||
.event(ProjectStatusChangeEvent.PROVINCIAL_DEPARTMENT_REVIEW_PASS).and() | |||
// 省级部门联审通过,从省级部门联审成功到预审中 | |||
.withExternal() | |||
.source(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS) | |||
.target(ProjectStatusEnum.PRE_APPLYING) | |||
.event(ProjectStatusChangeEvent.PROVINCIAL_PASS_TO_PRELIMINARY_REVIEW).and() | |||
// 省级部门联审不通过,从省级部门联审中到省级部门联审不通过 | |||
.withExternal() | |||
.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) | |||
.event(ProjectStatusChangeEvent.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_WITHDRAW).and() | |||
// 预审通过,从预审中到部门联审中 | |||
.withExternal() | |||
.source(ProjectStatusEnum.PRE_APPLYING) | |||
.target(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW) | |||
.event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_PASS).and() | |||
// 预审驳回,从预审中到预审不通过 | |||
.withExternal() | |||
.source(ProjectStatusEnum.PRE_APPLYING) | |||
.target(ProjectStatusEnum.PREQUALIFICATION_FAILED) | |||
.event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_REJECT).and() | |||
// 预审中撤回,从预审中到预审中撤回选择态 | |||
.withExternal() | |||
.source(ProjectStatusEnum.PRE_APPLYING) | |||
.target(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE) | |||
.event(ProjectStatusChangeEvent.PRE_APPLYING_WITHDRAW).and() | |||
// 预审中撤回,从预审中撤回选择态->省级部门联审成功,待预审,完成其中一种状态 | |||
.withChoice() | |||
.source(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE) | |||
.first(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS,projectDeclareGuardFactory.new PendingPreQualificationChoiceGuard() | |||
,new ProjectDeclareChoiceAction()) | |||
.last(ProjectStatusEnum.PENDING_PREQUALIFICATION,new ProjectDeclareChoiceAction()).and() | |||
// 预审不通过重新提交,从预审不通过到待预审选择 | |||
.withExternal() | |||
.source(ProjectStatusEnum.PREQUALIFICATION_FAILED) | |||
.target(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) | |||
.event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_REJECT_RESUBMIT).and() | |||
// 预审不通过重新提交,从待预审选择->省级部门联审中,预审中,完成其中一种状态 | |||
.withChoice() | |||
.source(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) | |||
.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) | |||
.target(ProjectStatusEnum.IN_THE_ANNUAL_PLAN) | |||
.event(ProjectStatusChangeEvent.DEPARTMENT_UNITED_REVIEW_PASS).and() | |||
// 部门联审驳回,从部门联审中到部门联审不通过 | |||
.withExternal() | |||
.source(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW) | |||
.target(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW_FAILED) | |||
.event(ProjectStatusChangeEvent.DEPARTMENT_UNITED_REVIEW_REJECT).and() | |||
// 部门联审中撤回,从部门联审中到预审中 | |||
.withExternal() | |||
.source(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW) | |||
.target(ProjectStatusEnum.PRE_APPLYING) | |||
.event(ProjectStatusChangeEvent.DEPARTMENT_JOINT_REVIEW_WITHDRAW).and() | |||
// 年度计划中开启方案申报,从年度计划中到方案待申报 | |||
.withExternal() | |||
.source(ProjectStatusEnum.IN_THE_ANNUAL_PLAN) | |||
.target(ProjectStatusEnum.PLAN_TO_BE_DECLARED) | |||
.event(ProjectStatusChangeEvent.ANNUAL_PLAN_PROJECT_OPEN_PLAN_DECLARE).and() | |||
// 年度计划中暂缓,从年度计划中到被暂缓 | |||
.withExternal() | |||
.source(ProjectStatusEnum.IN_THE_ANNUAL_PLAN) | |||
.target(ProjectStatusEnum.BE_SUSPENDED) | |||
.event(ProjectStatusChangeEvent.ANNUAL_PLAN_SUSPEND).and() | |||
// 方案待申报申报方案,从方案待申报到方案评审中 | |||
.withExternal() | |||
.source(ProjectStatusEnum.PLAN_TO_BE_DECLARED) | |||
.target(ProjectStatusEnum.SCHEME_UNDER_REVIEW) | |||
.event(ProjectStatusChangeEvent.DECLARE_PLAN).and() | |||
// 方案评审通过,从方案评审中到待立项批复 | |||
.withExternal() | |||
.source(ProjectStatusEnum.SCHEME_UNDER_REVIEW) | |||
.target(ProjectStatusEnum.TO_BE_APPROVED) | |||
.event(ProjectStatusChangeEvent.PLAN_REVIEW_PASS).and() | |||
// 方案评审驳回,从方案评审中到方案评审不通过 | |||
.withExternal() | |||
.source(ProjectStatusEnum.SCHEME_UNDER_REVIEW) | |||
.target(ProjectStatusEnum.SCHEME_REVIEW_FAILED) | |||
.event(ProjectStatusChangeEvent.PLAN_REVIEW_REJECT).and() | |||
// 方案评审中撤回,从方案评审中到方案待申报 | |||
.withExternal() | |||
.source(ProjectStatusEnum.SCHEME_UNDER_REVIEW) | |||
.target(ProjectStatusEnum.PLAN_TO_BE_DECLARED) | |||
.event(ProjectStatusChangeEvent.SCHEME_UNDER_REVIEW_WITHDRAW).and() | |||
// 方案评审不通过重新提交,从方案评审不通过到方案评审中 | |||
.withExternal() | |||
.source(ProjectStatusEnum.SCHEME_REVIEW_FAILED) | |||
.target(ProjectStatusEnum.SCHEME_UNDER_REVIEW) | |||
.event(ProjectStatusChangeEvent.PLAN_REVIEW_REJECT_RESUBMIT).and() | |||
// 待立项批复批复,从待立项批复到待采购 | |||
.withExternal() | |||
.source(ProjectStatusEnum.TO_BE_APPROVED) | |||
.target(ProjectStatusEnum.TO_BE_PURCHASED) | |||
.event(ProjectStatusChangeEvent.PROJECT_APPROVAL).and() | |||
// 待采购采购备案,从待采购到建设中 | |||
.withExternal() | |||
.source(ProjectStatusEnum.TO_BE_PURCHASED) | |||
.target(ProjectStatusEnum.UNDER_CONSTRUCTION) | |||
.event(ProjectStatusChangeEvent.PURCHASE_PUT_ON_RECORD).and() | |||
// 建设中初验备案,从建设中到待终验 | |||
.withExternal() | |||
.source(ProjectStatusEnum.UNDER_CONSTRUCTION) | |||
.target(ProjectStatusEnum.TO_BE_FINALLY_INSPECTED) | |||
.event(ProjectStatusChangeEvent.PRELIMINARY_ACCEPTANCE_PUT_ON_RECORD).and() | |||
// 待终验终验申请,从待终验到终验审核中 | |||
.withExternal() | |||
.source(ProjectStatusEnum.TO_BE_FINALLY_INSPECTED) | |||
.target(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) | |||
.event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_APPLICATION).and() | |||
// 终审审核通过,从终审审核中到已归档 | |||
.withExternal() | |||
.source(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) | |||
.target(ProjectStatusEnum.ARCHIVED) | |||
.event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_PASS).and() | |||
// 终审审核不通过,从终审审核中到终审审核不通过 | |||
.withExternal() | |||
.source(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) | |||
.target(ProjectStatusEnum.FINAL_ACCEPTANCE_REVIEW_FAILED) | |||
.event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_REJECT).and() | |||
// 终审审核中撤回,从终审审核中到待终验 | |||
.withExternal() | |||
.source(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) | |||
.target(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) | |||
.event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_IS_UNDER_REVIEW_WITHDRAW).and(); | |||
return builder.build(); | |||
} | |||
/** | |||
* 持久化配置 | |||
* @author CMM | |||
* @since 2023/02/07 16:22 | |||
*/ | |||
@Bean(name = "projectDeclareStateMachineKFQPersister") | |||
@Override | |||
public StateMachinePersister<ProjectStatusEnum, ProjectStatusChangeEvent, Project> getProjectPersister() { | |||
StateMachinePersister sp = new DefaultStateMachinePersister<>(new StateMachinePersist<ProjectStatusEnum, ProjectStatusChangeEvent, Project>() { | |||
@Override | |||
public void write(StateMachineContext<ProjectStatusEnum, ProjectStatusChangeEvent> context, Project contextObj) { | |||
} | |||
@Override | |||
public StateMachineContext<ProjectStatusEnum, ProjectStatusChangeEvent> read(Project contextObj) { | |||
StateMachineContext<ProjectStatusEnum, ProjectStatusChangeEvent> result = new DefaultStateMachineContext(ProjectStatusEnum.getValue(contextObj.getStatus()), | |||
null, null, null, null, RegionContant.LS_YH_CODE); | |||
return result; | |||
} | |||
}); | |||
stateMachinePersister = sp; | |||
return sp; | |||
} | |||
public StateMachinePersister getStateMachinePersister(){ | |||
return stateMachinePersister; | |||
} | |||
} |
@@ -0,0 +1,274 @@ | |||
package com.ningdatech.pmapi.common.statemachine.builder; | |||
import com.ningdatech.pmapi.common.statemachine.action.ProjectDeclareChoiceAction; | |||
import com.ningdatech.pmapi.common.statemachine.contants.RegionContant; | |||
import com.ningdatech.pmapi.common.statemachine.event.ProjectStatusChangeEvent; | |||
import com.ningdatech.pmapi.common.statemachine.factory.ProjectDeclareGuardFactory; | |||
import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; | |||
import com.ningdatech.pmapi.projectlib.model.entity.Project; | |||
import lombok.RequiredArgsConstructor; | |||
import org.slf4j.Logger; | |||
import org.slf4j.LoggerFactory; | |||
import org.springframework.beans.factory.BeanFactory; | |||
import org.springframework.context.annotation.Bean; | |||
import org.springframework.statemachine.StateMachine; | |||
import org.springframework.statemachine.StateMachineContext; | |||
import org.springframework.statemachine.StateMachinePersist; | |||
import org.springframework.statemachine.config.EnableStateMachine; | |||
import org.springframework.statemachine.config.StateMachineBuilder; | |||
import org.springframework.statemachine.persist.DefaultStateMachinePersister; | |||
import org.springframework.statemachine.persist.StateMachinePersister; | |||
import org.springframework.statemachine.support.DefaultStateMachineContext; | |||
import org.springframework.stereotype.Component; | |||
import java.util.EnumSet; | |||
/** | |||
* 项目申报状态机 | |||
* 莲都区 | |||
* @author CMM | |||
* @since 2023/02/07 15:56 | |||
*/ | |||
@Component | |||
@EnableStateMachine(name= ProjectDeclareStateMachineLDBuilder.MACHINEID_TO) | |||
@RequiredArgsConstructor | |||
public class ProjectDeclareStateMachineLDBuilder implements ProjectDeclareStateMachineBuilder { | |||
private static final ProjectDeclareGuardFactory projectDeclareGuardFactory = new ProjectDeclareGuardFactory(); | |||
private final BeanFactory beanFactory; | |||
private StateMachinePersister stateMachinePersister; | |||
private Logger logger = LoggerFactory.getLogger(getClass()); | |||
/** | |||
* TO状态机 | |||
*/ | |||
public final static String MACHINEID_TO = RegionContant.LS_LD_CODE; | |||
@Override | |||
public StateMachine<ProjectStatusEnum, ProjectStatusChangeEvent> build() throws Exception { | |||
StateMachine<ProjectStatusEnum, ProjectStatusChangeEvent> stateMachine = build(beanFactory); | |||
logger.info("状态机ID:" + stateMachine.getId()); | |||
stateMachine.start(); | |||
return stateMachine; | |||
} | |||
/** | |||
* 构建状态机 | |||
* @param beanFactory | |||
* @author CMM | |||
* @since 2023/02/07 16:15 | |||
*/ | |||
@Override | |||
public StateMachine<ProjectStatusEnum, ProjectStatusChangeEvent> build(BeanFactory beanFactory) throws Exception { | |||
StateMachineBuilder.Builder<ProjectStatusEnum, ProjectStatusChangeEvent> builder = StateMachineBuilder.builder(); | |||
builder.configureConfiguration() | |||
.withConfiguration() | |||
.machineId(MACHINEID_TO) | |||
.beanFactory(beanFactory); | |||
builder.configureStates() | |||
.withStates() | |||
.initial(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) | |||
.choice(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) | |||
.choice(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE) | |||
.states(EnumSet.allOf(ProjectStatusEnum.class)); | |||
builder.configureTransitions() | |||
// 单位内部审核通过,从单位内部审核中到待预审 | |||
.withExternal() | |||
.source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) | |||
.target(ProjectStatusEnum.PENDING_PREQUALIFICATION) | |||
.event(ProjectStatusChangeEvent.UNDER_INTERNAL_PASS).and() | |||
// 单位内部审核驳回,从单位内部审核中到单位内部审核不通过 | |||
.withExternal() | |||
.source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) | |||
.target(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS) | |||
.event(ProjectStatusChangeEvent.UNDER_INTERNAL_REJECT).and() | |||
// 单位内部审核中撤回,从单位内部审核中到待申报 | |||
.withExternal() | |||
.source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) | |||
.target(ProjectStatusEnum.TO_BE_DECLARED) | |||
.event(ProjectStatusChangeEvent.UNDER_INTERNAL_WITHDRAW).and() | |||
// 单位内部审核不通过重新提交,从单位内部审核不通过到单位内部审核中 | |||
.withExternal() | |||
.source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS) | |||
.target(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) | |||
.event(ProjectStatusChangeEvent.UNDER_INTERNAL_REJECT_RESUBMIT).and() | |||
// 待预审预审申报,从待预审到待预审选择 | |||
.withExternal() | |||
.source(ProjectStatusEnum.PENDING_PREQUALIFICATION) | |||
.target(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) | |||
.event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_DECLARE).and() | |||
// 待预审申报,从待预审选择->省级部门联审中,预审中,完成其中一种状态 | |||
.withChoice() | |||
.source(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) | |||
.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) | |||
.target(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS) | |||
.event(ProjectStatusChangeEvent.PROVINCIAL_DEPARTMENT_REVIEW_PASS).and() | |||
// 省级部门联审通过,从省级部门联审成功到预审中 | |||
.withExternal() | |||
.source(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS) | |||
.target(ProjectStatusEnum.PRE_APPLYING) | |||
.event(ProjectStatusChangeEvent.PROVINCIAL_PASS_TO_PRELIMINARY_REVIEW).and() | |||
// 省级部门联审不通过,从省级部门联审中到省级部门联审不通过 | |||
.withExternal() | |||
.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) | |||
.event(ProjectStatusChangeEvent.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_WITHDRAW).and() | |||
// 预审通过,从预审中到部门联审中 | |||
.withExternal() | |||
.source(ProjectStatusEnum.PRE_APPLYING) | |||
.target(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW) | |||
.event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_PASS).and() | |||
// 预审驳回,从预审中到预审不通过 | |||
.withExternal() | |||
.source(ProjectStatusEnum.PRE_APPLYING) | |||
.target(ProjectStatusEnum.PREQUALIFICATION_FAILED) | |||
.event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_REJECT).and() | |||
// 预审中撤回,从预审中到预审中撤回选择态 | |||
.withExternal() | |||
.source(ProjectStatusEnum.PRE_APPLYING) | |||
.target(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE) | |||
.event(ProjectStatusChangeEvent.PRE_APPLYING_WITHDRAW).and() | |||
// 预审中撤回,从预审中撤回选择态->省级部门联审成功,待预审,完成其中一种状态 | |||
.withChoice() | |||
.source(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE) | |||
.first(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS,projectDeclareGuardFactory.new PendingPreQualificationChoiceGuard() | |||
,new ProjectDeclareChoiceAction()) | |||
.last(ProjectStatusEnum.PENDING_PREQUALIFICATION,new ProjectDeclareChoiceAction()).and() | |||
// 预审不通过重新提交,从预审不通过到待预审选择 | |||
.withExternal() | |||
.source(ProjectStatusEnum.PREQUALIFICATION_FAILED) | |||
.target(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) | |||
.event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_REJECT_RESUBMIT).and() | |||
// 预审不通过重新提交,从待预审选择->省级部门联审中,预审中,完成其中一种状态 | |||
.withChoice() | |||
.source(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) | |||
.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) | |||
.target(ProjectStatusEnum.IN_THE_ANNUAL_PLAN) | |||
.event(ProjectStatusChangeEvent.DEPARTMENT_UNITED_REVIEW_PASS).and() | |||
// 部门联审驳回,从部门联审中到部门联审不通过 | |||
.withExternal() | |||
.source(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW) | |||
.target(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW_FAILED) | |||
.event(ProjectStatusChangeEvent.DEPARTMENT_UNITED_REVIEW_REJECT).and() | |||
// 部门联审中撤回,从部门联审中到预审中 | |||
.withExternal() | |||
.source(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW) | |||
.target(ProjectStatusEnum.PRE_APPLYING) | |||
.event(ProjectStatusChangeEvent.DEPARTMENT_JOINT_REVIEW_WITHDRAW).and() | |||
// 年度计划中开启方案申报,从年度计划中到方案待申报 | |||
.withExternal() | |||
.source(ProjectStatusEnum.IN_THE_ANNUAL_PLAN) | |||
.target(ProjectStatusEnum.PLAN_TO_BE_DECLARED) | |||
.event(ProjectStatusChangeEvent.ANNUAL_PLAN_PROJECT_OPEN_PLAN_DECLARE).and() | |||
// 年度计划中暂缓,从年度计划中到被暂缓 | |||
.withExternal() | |||
.source(ProjectStatusEnum.IN_THE_ANNUAL_PLAN) | |||
.target(ProjectStatusEnum.BE_SUSPENDED) | |||
.event(ProjectStatusChangeEvent.ANNUAL_PLAN_SUSPEND).and() | |||
// 方案待申报申报方案,从方案待申报到方案评审中 | |||
.withExternal() | |||
.source(ProjectStatusEnum.PLAN_TO_BE_DECLARED) | |||
.target(ProjectStatusEnum.SCHEME_UNDER_REVIEW) | |||
.event(ProjectStatusChangeEvent.DECLARE_PLAN).and() | |||
// 方案评审通过,从方案评审中到待立项批复 | |||
.withExternal() | |||
.source(ProjectStatusEnum.SCHEME_UNDER_REVIEW) | |||
.target(ProjectStatusEnum.TO_BE_APPROVED) | |||
.event(ProjectStatusChangeEvent.PLAN_REVIEW_PASS).and() | |||
// 方案评审驳回,从方案评审中到方案评审不通过 | |||
.withExternal() | |||
.source(ProjectStatusEnum.SCHEME_UNDER_REVIEW) | |||
.target(ProjectStatusEnum.SCHEME_REVIEW_FAILED) | |||
.event(ProjectStatusChangeEvent.PLAN_REVIEW_REJECT).and() | |||
// 方案评审中撤回,从方案评审中到方案待申报 | |||
.withExternal() | |||
.source(ProjectStatusEnum.SCHEME_UNDER_REVIEW) | |||
.target(ProjectStatusEnum.PLAN_TO_BE_DECLARED) | |||
.event(ProjectStatusChangeEvent.SCHEME_UNDER_REVIEW_WITHDRAW).and() | |||
// 方案评审不通过重新提交,从方案评审不通过到方案评审中 | |||
.withExternal() | |||
.source(ProjectStatusEnum.SCHEME_REVIEW_FAILED) | |||
.target(ProjectStatusEnum.SCHEME_UNDER_REVIEW) | |||
.event(ProjectStatusChangeEvent.PLAN_REVIEW_REJECT_RESUBMIT).and() | |||
// 待立项批复批复,从待立项批复到待采购 | |||
.withExternal() | |||
.source(ProjectStatusEnum.TO_BE_APPROVED) | |||
.target(ProjectStatusEnum.TO_BE_PURCHASED) | |||
.event(ProjectStatusChangeEvent.PROJECT_APPROVAL).and() | |||
// 待采购采购备案,从待采购到建设中 | |||
.withExternal() | |||
.source(ProjectStatusEnum.TO_BE_PURCHASED) | |||
.target(ProjectStatusEnum.UNDER_CONSTRUCTION) | |||
.event(ProjectStatusChangeEvent.PURCHASE_PUT_ON_RECORD).and() | |||
// 建设中初验备案,从建设中到待终验 | |||
.withExternal() | |||
.source(ProjectStatusEnum.UNDER_CONSTRUCTION) | |||
.target(ProjectStatusEnum.TO_BE_FINALLY_INSPECTED) | |||
.event(ProjectStatusChangeEvent.PRELIMINARY_ACCEPTANCE_PUT_ON_RECORD).and() | |||
// 待终验终验申请,从待终验到终验审核中 | |||
.withExternal() | |||
.source(ProjectStatusEnum.TO_BE_FINALLY_INSPECTED) | |||
.target(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) | |||
.event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_APPLICATION).and() | |||
// 终审审核通过,从终审审核中到已归档 | |||
.withExternal() | |||
.source(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) | |||
.target(ProjectStatusEnum.ARCHIVED) | |||
.event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_PASS).and() | |||
// 终审审核不通过,从终审审核中到终审审核不通过 | |||
.withExternal() | |||
.source(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) | |||
.target(ProjectStatusEnum.FINAL_ACCEPTANCE_REVIEW_FAILED) | |||
.event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_REJECT).and() | |||
// 终审审核中撤回,从终审审核中到待终验 | |||
.withExternal() | |||
.source(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) | |||
.target(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) | |||
.event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_IS_UNDER_REVIEW_WITHDRAW).and(); | |||
return builder.build(); | |||
} | |||
/** | |||
* 持久化配置 | |||
* @author CMM | |||
* @since 2023/02/07 16:22 | |||
*/ | |||
@Bean(name = "projectDeclareStateMachineLDPersister") | |||
@Override | |||
public StateMachinePersister<ProjectStatusEnum, ProjectStatusChangeEvent, Project> getProjectPersister() { | |||
StateMachinePersister sp = new DefaultStateMachinePersister<>(new StateMachinePersist<ProjectStatusEnum, ProjectStatusChangeEvent, Project>() { | |||
@Override | |||
public void write(StateMachineContext<ProjectStatusEnum, ProjectStatusChangeEvent> context, Project contextObj) { | |||
} | |||
@Override | |||
public StateMachineContext<ProjectStatusEnum, ProjectStatusChangeEvent> read(Project contextObj) { | |||
StateMachineContext<ProjectStatusEnum, ProjectStatusChangeEvent> result = new DefaultStateMachineContext(ProjectStatusEnum.getValue(contextObj.getStatus()), | |||
null, null, null, null, RegionContant.LS_YH_CODE); | |||
return result; | |||
} | |||
}); | |||
stateMachinePersister = sp; | |||
return sp; | |||
} | |||
public StateMachinePersister getStateMachinePersister(){ | |||
return stateMachinePersister; | |||
} | |||
} |
@@ -0,0 +1,274 @@ | |||
package com.ningdatech.pmapi.common.statemachine.builder; | |||
import com.ningdatech.pmapi.common.statemachine.action.ProjectDeclareChoiceAction; | |||
import com.ningdatech.pmapi.common.statemachine.contants.RegionContant; | |||
import com.ningdatech.pmapi.common.statemachine.event.ProjectStatusChangeEvent; | |||
import com.ningdatech.pmapi.common.statemachine.factory.ProjectDeclareGuardFactory; | |||
import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; | |||
import com.ningdatech.pmapi.projectlib.model.entity.Project; | |||
import lombok.RequiredArgsConstructor; | |||
import org.slf4j.Logger; | |||
import org.slf4j.LoggerFactory; | |||
import org.springframework.beans.factory.BeanFactory; | |||
import org.springframework.context.annotation.Bean; | |||
import org.springframework.statemachine.StateMachine; | |||
import org.springframework.statemachine.StateMachineContext; | |||
import org.springframework.statemachine.StateMachinePersist; | |||
import org.springframework.statemachine.config.EnableStateMachine; | |||
import org.springframework.statemachine.config.StateMachineBuilder; | |||
import org.springframework.statemachine.persist.DefaultStateMachinePersister; | |||
import org.springframework.statemachine.persist.StateMachinePersister; | |||
import org.springframework.statemachine.support.DefaultStateMachineContext; | |||
import org.springframework.stereotype.Component; | |||
import java.util.EnumSet; | |||
/** | |||
* 项目申报状态机 | |||
* 龙泉市 | |||
* @author CMM | |||
* @since 2023/02/07 15:56 | |||
*/ | |||
@Component | |||
@EnableStateMachine(name= ProjectDeclareStateMachineLQBuilder.MACHINEID_TO) | |||
@RequiredArgsConstructor | |||
public class ProjectDeclareStateMachineLQBuilder implements ProjectDeclareStateMachineBuilder { | |||
private static final ProjectDeclareGuardFactory projectDeclareGuardFactory = new ProjectDeclareGuardFactory(); | |||
private final BeanFactory beanFactory; | |||
private StateMachinePersister stateMachinePersister; | |||
private Logger logger = LoggerFactory.getLogger(getClass()); | |||
/** | |||
* TO状态机 | |||
*/ | |||
public final static String MACHINEID_TO = RegionContant.LS_LQ_CODE; | |||
@Override | |||
public StateMachine<ProjectStatusEnum, ProjectStatusChangeEvent> build() throws Exception { | |||
StateMachine<ProjectStatusEnum, ProjectStatusChangeEvent> stateMachine = build(beanFactory); | |||
logger.info("状态机ID:" + stateMachine.getId()); | |||
stateMachine.start(); | |||
return stateMachine; | |||
} | |||
/** | |||
* 构建状态机 | |||
* @param beanFactory | |||
* @author CMM | |||
* @since 2023/02/07 16:15 | |||
*/ | |||
@Override | |||
public StateMachine<ProjectStatusEnum, ProjectStatusChangeEvent> build(BeanFactory beanFactory) throws Exception { | |||
StateMachineBuilder.Builder<ProjectStatusEnum, ProjectStatusChangeEvent> builder = StateMachineBuilder.builder(); | |||
builder.configureConfiguration() | |||
.withConfiguration() | |||
.machineId(MACHINEID_TO) | |||
.beanFactory(beanFactory); | |||
builder.configureStates() | |||
.withStates() | |||
.initial(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) | |||
.choice(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) | |||
.choice(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE) | |||
.states(EnumSet.allOf(ProjectStatusEnum.class)); | |||
builder.configureTransitions() | |||
// 单位内部审核通过,从单位内部审核中到待预审 | |||
.withExternal() | |||
.source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) | |||
.target(ProjectStatusEnum.PENDING_PREQUALIFICATION) | |||
.event(ProjectStatusChangeEvent.UNDER_INTERNAL_PASS).and() | |||
// 单位内部审核驳回,从单位内部审核中到单位内部审核不通过 | |||
.withExternal() | |||
.source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) | |||
.target(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS) | |||
.event(ProjectStatusChangeEvent.UNDER_INTERNAL_REJECT).and() | |||
// 单位内部审核中撤回,从单位内部审核中到待申报 | |||
.withExternal() | |||
.source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) | |||
.target(ProjectStatusEnum.TO_BE_DECLARED) | |||
.event(ProjectStatusChangeEvent.UNDER_INTERNAL_WITHDRAW).and() | |||
// 单位内部审核不通过重新提交,从单位内部审核不通过到单位内部审核中 | |||
.withExternal() | |||
.source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS) | |||
.target(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) | |||
.event(ProjectStatusChangeEvent.UNDER_INTERNAL_REJECT_RESUBMIT).and() | |||
// 待预审预审申报,从待预审到待预审选择 | |||
.withExternal() | |||
.source(ProjectStatusEnum.PENDING_PREQUALIFICATION) | |||
.target(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) | |||
.event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_DECLARE).and() | |||
// 待预审申报,从待预审选择->省级部门联审中,预审中,完成其中一种状态 | |||
.withChoice() | |||
.source(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) | |||
.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) | |||
.target(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS) | |||
.event(ProjectStatusChangeEvent.PROVINCIAL_DEPARTMENT_REVIEW_PASS).and() | |||
// 省级部门联审通过,从省级部门联审成功到预审中 | |||
.withExternal() | |||
.source(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS) | |||
.target(ProjectStatusEnum.PRE_APPLYING) | |||
.event(ProjectStatusChangeEvent.PROVINCIAL_PASS_TO_PRELIMINARY_REVIEW).and() | |||
// 省级部门联审不通过,从省级部门联审中到省级部门联审不通过 | |||
.withExternal() | |||
.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) | |||
.event(ProjectStatusChangeEvent.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_WITHDRAW).and() | |||
// 预审通过,从预审中到部门联审中 | |||
.withExternal() | |||
.source(ProjectStatusEnum.PRE_APPLYING) | |||
.target(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW) | |||
.event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_PASS).and() | |||
// 预审驳回,从预审中到预审不通过 | |||
.withExternal() | |||
.source(ProjectStatusEnum.PRE_APPLYING) | |||
.target(ProjectStatusEnum.PREQUALIFICATION_FAILED) | |||
.event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_REJECT).and() | |||
// 预审中撤回,从预审中到预审中撤回选择态 | |||
.withExternal() | |||
.source(ProjectStatusEnum.PRE_APPLYING) | |||
.target(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE) | |||
.event(ProjectStatusChangeEvent.PRE_APPLYING_WITHDRAW).and() | |||
// 预审中撤回,从预审中撤回选择态->省级部门联审成功,待预审,完成其中一种状态 | |||
.withChoice() | |||
.source(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE) | |||
.first(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS,projectDeclareGuardFactory.new PendingPreQualificationChoiceGuard() | |||
,new ProjectDeclareChoiceAction()) | |||
.last(ProjectStatusEnum.PENDING_PREQUALIFICATION,new ProjectDeclareChoiceAction()).and() | |||
// 预审不通过重新提交,从预审不通过到待预审选择 | |||
.withExternal() | |||
.source(ProjectStatusEnum.PREQUALIFICATION_FAILED) | |||
.target(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) | |||
.event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_REJECT_RESUBMIT).and() | |||
// 预审不通过重新提交,从待预审选择->省级部门联审中,预审中,完成其中一种状态 | |||
.withChoice() | |||
.source(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) | |||
.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) | |||
.target(ProjectStatusEnum.IN_THE_ANNUAL_PLAN) | |||
.event(ProjectStatusChangeEvent.DEPARTMENT_UNITED_REVIEW_PASS).and() | |||
// 部门联审驳回,从部门联审中到部门联审不通过 | |||
.withExternal() | |||
.source(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW) | |||
.target(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW_FAILED) | |||
.event(ProjectStatusChangeEvent.DEPARTMENT_UNITED_REVIEW_REJECT).and() | |||
// 部门联审中撤回,从部门联审中到预审中 | |||
.withExternal() | |||
.source(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW) | |||
.target(ProjectStatusEnum.PRE_APPLYING) | |||
.event(ProjectStatusChangeEvent.DEPARTMENT_JOINT_REVIEW_WITHDRAW).and() | |||
// 年度计划中开启方案申报,从年度计划中到方案待申报 | |||
.withExternal() | |||
.source(ProjectStatusEnum.IN_THE_ANNUAL_PLAN) | |||
.target(ProjectStatusEnum.PLAN_TO_BE_DECLARED) | |||
.event(ProjectStatusChangeEvent.ANNUAL_PLAN_PROJECT_OPEN_PLAN_DECLARE).and() | |||
// 年度计划中暂缓,从年度计划中到被暂缓 | |||
.withExternal() | |||
.source(ProjectStatusEnum.IN_THE_ANNUAL_PLAN) | |||
.target(ProjectStatusEnum.BE_SUSPENDED) | |||
.event(ProjectStatusChangeEvent.ANNUAL_PLAN_SUSPEND).and() | |||
// 方案待申报申报方案,从方案待申报到方案评审中 | |||
.withExternal() | |||
.source(ProjectStatusEnum.PLAN_TO_BE_DECLARED) | |||
.target(ProjectStatusEnum.SCHEME_UNDER_REVIEW) | |||
.event(ProjectStatusChangeEvent.DECLARE_PLAN).and() | |||
// 方案评审通过,从方案评审中到待立项批复 | |||
.withExternal() | |||
.source(ProjectStatusEnum.SCHEME_UNDER_REVIEW) | |||
.target(ProjectStatusEnum.TO_BE_APPROVED) | |||
.event(ProjectStatusChangeEvent.PLAN_REVIEW_PASS).and() | |||
// 方案评审驳回,从方案评审中到方案评审不通过 | |||
.withExternal() | |||
.source(ProjectStatusEnum.SCHEME_UNDER_REVIEW) | |||
.target(ProjectStatusEnum.SCHEME_REVIEW_FAILED) | |||
.event(ProjectStatusChangeEvent.PLAN_REVIEW_REJECT).and() | |||
// 方案评审中撤回,从方案评审中到方案待申报 | |||
.withExternal() | |||
.source(ProjectStatusEnum.SCHEME_UNDER_REVIEW) | |||
.target(ProjectStatusEnum.PLAN_TO_BE_DECLARED) | |||
.event(ProjectStatusChangeEvent.SCHEME_UNDER_REVIEW_WITHDRAW).and() | |||
// 方案评审不通过重新提交,从方案评审不通过到方案评审中 | |||
.withExternal() | |||
.source(ProjectStatusEnum.SCHEME_REVIEW_FAILED) | |||
.target(ProjectStatusEnum.SCHEME_UNDER_REVIEW) | |||
.event(ProjectStatusChangeEvent.PLAN_REVIEW_REJECT_RESUBMIT).and() | |||
// 待立项批复批复,从待立项批复到待采购 | |||
.withExternal() | |||
.source(ProjectStatusEnum.TO_BE_APPROVED) | |||
.target(ProjectStatusEnum.TO_BE_PURCHASED) | |||
.event(ProjectStatusChangeEvent.PROJECT_APPROVAL).and() | |||
// 待采购采购备案,从待采购到建设中 | |||
.withExternal() | |||
.source(ProjectStatusEnum.TO_BE_PURCHASED) | |||
.target(ProjectStatusEnum.UNDER_CONSTRUCTION) | |||
.event(ProjectStatusChangeEvent.PURCHASE_PUT_ON_RECORD).and() | |||
// 建设中初验备案,从建设中到待终验 | |||
.withExternal() | |||
.source(ProjectStatusEnum.UNDER_CONSTRUCTION) | |||
.target(ProjectStatusEnum.TO_BE_FINALLY_INSPECTED) | |||
.event(ProjectStatusChangeEvent.PRELIMINARY_ACCEPTANCE_PUT_ON_RECORD).and() | |||
// 待终验终验申请,从待终验到终验审核中 | |||
.withExternal() | |||
.source(ProjectStatusEnum.TO_BE_FINALLY_INSPECTED) | |||
.target(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) | |||
.event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_APPLICATION).and() | |||
// 终审审核通过,从终审审核中到已归档 | |||
.withExternal() | |||
.source(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) | |||
.target(ProjectStatusEnum.ARCHIVED) | |||
.event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_PASS).and() | |||
// 终审审核不通过,从终审审核中到终审审核不通过 | |||
.withExternal() | |||
.source(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) | |||
.target(ProjectStatusEnum.FINAL_ACCEPTANCE_REVIEW_FAILED) | |||
.event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_REJECT).and() | |||
// 终审审核中撤回,从终审审核中到待终验 | |||
.withExternal() | |||
.source(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) | |||
.target(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) | |||
.event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_IS_UNDER_REVIEW_WITHDRAW).and(); | |||
return builder.build(); | |||
} | |||
/** | |||
* 持久化配置 | |||
* @author CMM | |||
* @since 2023/02/07 16:22 | |||
*/ | |||
@Bean(name = "projectDeclareStateMachineLQPersister") | |||
@Override | |||
public StateMachinePersister<ProjectStatusEnum, ProjectStatusChangeEvent, Project> getProjectPersister() { | |||
StateMachinePersister sp = new DefaultStateMachinePersister<>(new StateMachinePersist<ProjectStatusEnum, ProjectStatusChangeEvent, Project>() { | |||
@Override | |||
public void write(StateMachineContext<ProjectStatusEnum, ProjectStatusChangeEvent> context, Project contextObj) { | |||
} | |||
@Override | |||
public StateMachineContext<ProjectStatusEnum, ProjectStatusChangeEvent> read(Project contextObj) { | |||
StateMachineContext<ProjectStatusEnum, ProjectStatusChangeEvent> result = new DefaultStateMachineContext(ProjectStatusEnum.getValue(contextObj.getStatus()), | |||
null, null, null, null, RegionContant.LS_YH_CODE); | |||
return result; | |||
} | |||
}); | |||
stateMachinePersister = sp; | |||
return sp; | |||
} | |||
public StateMachinePersister getStateMachinePersister(){ | |||
return stateMachinePersister; | |||
} | |||
} |
@@ -0,0 +1,274 @@ | |||
package com.ningdatech.pmapi.common.statemachine.builder; | |||
import com.ningdatech.pmapi.common.statemachine.action.ProjectDeclareChoiceAction; | |||
import com.ningdatech.pmapi.common.statemachine.contants.RegionContant; | |||
import com.ningdatech.pmapi.common.statemachine.event.ProjectStatusChangeEvent; | |||
import com.ningdatech.pmapi.common.statemachine.factory.ProjectDeclareGuardFactory; | |||
import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; | |||
import com.ningdatech.pmapi.projectlib.model.entity.Project; | |||
import lombok.RequiredArgsConstructor; | |||
import org.slf4j.Logger; | |||
import org.slf4j.LoggerFactory; | |||
import org.springframework.beans.factory.BeanFactory; | |||
import org.springframework.context.annotation.Bean; | |||
import org.springframework.statemachine.StateMachine; | |||
import org.springframework.statemachine.StateMachineContext; | |||
import org.springframework.statemachine.StateMachinePersist; | |||
import org.springframework.statemachine.config.EnableStateMachine; | |||
import org.springframework.statemachine.config.StateMachineBuilder; | |||
import org.springframework.statemachine.persist.DefaultStateMachinePersister; | |||
import org.springframework.statemachine.persist.StateMachinePersister; | |||
import org.springframework.statemachine.support.DefaultStateMachineContext; | |||
import org.springframework.stereotype.Component; | |||
import java.util.EnumSet; | |||
/** | |||
* 项目申报状态机 | |||
* 青田县 | |||
* @author CMM | |||
* @since 2023/02/07 15:56 | |||
*/ | |||
@Component | |||
@EnableStateMachine(name= ProjectDeclareStateMachineQTBuilder.MACHINEID_TO) | |||
@RequiredArgsConstructor | |||
public class ProjectDeclareStateMachineQTBuilder implements ProjectDeclareStateMachineBuilder { | |||
private static final ProjectDeclareGuardFactory projectDeclareGuardFactory = new ProjectDeclareGuardFactory(); | |||
private final BeanFactory beanFactory; | |||
private StateMachinePersister stateMachinePersister; | |||
private Logger logger = LoggerFactory.getLogger(getClass()); | |||
/** | |||
* TO状态机 | |||
*/ | |||
public final static String MACHINEID_TO = RegionContant.LS_QT_CODE; | |||
@Override | |||
public StateMachine<ProjectStatusEnum, ProjectStatusChangeEvent> build() throws Exception { | |||
StateMachine<ProjectStatusEnum, ProjectStatusChangeEvent> stateMachine = build(beanFactory); | |||
logger.info("状态机ID:" + stateMachine.getId()); | |||
stateMachine.start(); | |||
return stateMachine; | |||
} | |||
/** | |||
* 构建状态机 | |||
* @param beanFactory | |||
* @author CMM | |||
* @since 2023/02/07 16:15 | |||
*/ | |||
@Override | |||
public StateMachine<ProjectStatusEnum, ProjectStatusChangeEvent> build(BeanFactory beanFactory) throws Exception { | |||
StateMachineBuilder.Builder<ProjectStatusEnum, ProjectStatusChangeEvent> builder = StateMachineBuilder.builder(); | |||
builder.configureConfiguration() | |||
.withConfiguration() | |||
.machineId(MACHINEID_TO) | |||
.beanFactory(beanFactory); | |||
builder.configureStates() | |||
.withStates() | |||
.initial(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) | |||
.choice(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) | |||
.choice(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE) | |||
.states(EnumSet.allOf(ProjectStatusEnum.class)); | |||
builder.configureTransitions() | |||
// 单位内部审核通过,从单位内部审核中到待预审 | |||
.withExternal() | |||
.source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) | |||
.target(ProjectStatusEnum.PENDING_PREQUALIFICATION) | |||
.event(ProjectStatusChangeEvent.UNDER_INTERNAL_PASS).and() | |||
// 单位内部审核驳回,从单位内部审核中到单位内部审核不通过 | |||
.withExternal() | |||
.source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) | |||
.target(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS) | |||
.event(ProjectStatusChangeEvent.UNDER_INTERNAL_REJECT).and() | |||
// 单位内部审核中撤回,从单位内部审核中到待申报 | |||
.withExternal() | |||
.source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) | |||
.target(ProjectStatusEnum.TO_BE_DECLARED) | |||
.event(ProjectStatusChangeEvent.UNDER_INTERNAL_WITHDRAW).and() | |||
// 单位内部审核不通过重新提交,从单位内部审核不通过到单位内部审核中 | |||
.withExternal() | |||
.source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS) | |||
.target(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) | |||
.event(ProjectStatusChangeEvent.UNDER_INTERNAL_REJECT_RESUBMIT).and() | |||
// 待预审预审申报,从待预审到待预审选择 | |||
.withExternal() | |||
.source(ProjectStatusEnum.PENDING_PREQUALIFICATION) | |||
.target(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) | |||
.event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_DECLARE).and() | |||
// 待预审申报,从待预审选择->省级部门联审中,预审中,完成其中一种状态 | |||
.withChoice() | |||
.source(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) | |||
.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) | |||
.target(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS) | |||
.event(ProjectStatusChangeEvent.PROVINCIAL_DEPARTMENT_REVIEW_PASS).and() | |||
// 省级部门联审通过,从省级部门联审成功到预审中 | |||
.withExternal() | |||
.source(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS) | |||
.target(ProjectStatusEnum.PRE_APPLYING) | |||
.event(ProjectStatusChangeEvent.PROVINCIAL_PASS_TO_PRELIMINARY_REVIEW).and() | |||
// 省级部门联审不通过,从省级部门联审中到省级部门联审不通过 | |||
.withExternal() | |||
.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) | |||
.event(ProjectStatusChangeEvent.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_WITHDRAW).and() | |||
// 预审通过,从预审中到部门联审中 | |||
.withExternal() | |||
.source(ProjectStatusEnum.PRE_APPLYING) | |||
.target(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW) | |||
.event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_PASS).and() | |||
// 预审驳回,从预审中到预审不通过 | |||
.withExternal() | |||
.source(ProjectStatusEnum.PRE_APPLYING) | |||
.target(ProjectStatusEnum.PREQUALIFICATION_FAILED) | |||
.event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_REJECT).and() | |||
// 预审中撤回,从预审中到预审中撤回选择态 | |||
.withExternal() | |||
.source(ProjectStatusEnum.PRE_APPLYING) | |||
.target(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE) | |||
.event(ProjectStatusChangeEvent.PRE_APPLYING_WITHDRAW).and() | |||
// 预审中撤回,从预审中撤回选择态->省级部门联审成功,待预审,完成其中一种状态 | |||
.withChoice() | |||
.source(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE) | |||
.first(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS,projectDeclareGuardFactory.new PendingPreQualificationChoiceGuard() | |||
,new ProjectDeclareChoiceAction()) | |||
.last(ProjectStatusEnum.PENDING_PREQUALIFICATION,new ProjectDeclareChoiceAction()).and() | |||
// 预审不通过重新提交,从预审不通过到待预审选择 | |||
.withExternal() | |||
.source(ProjectStatusEnum.PREQUALIFICATION_FAILED) | |||
.target(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) | |||
.event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_REJECT_RESUBMIT).and() | |||
// 预审不通过重新提交,从待预审选择->省级部门联审中,预审中,完成其中一种状态 | |||
.withChoice() | |||
.source(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) | |||
.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) | |||
.target(ProjectStatusEnum.IN_THE_ANNUAL_PLAN) | |||
.event(ProjectStatusChangeEvent.DEPARTMENT_UNITED_REVIEW_PASS).and() | |||
// 部门联审驳回,从部门联审中到部门联审不通过 | |||
.withExternal() | |||
.source(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW) | |||
.target(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW_FAILED) | |||
.event(ProjectStatusChangeEvent.DEPARTMENT_UNITED_REVIEW_REJECT).and() | |||
// 部门联审中撤回,从部门联审中到预审中 | |||
.withExternal() | |||
.source(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW) | |||
.target(ProjectStatusEnum.PRE_APPLYING) | |||
.event(ProjectStatusChangeEvent.DEPARTMENT_JOINT_REVIEW_WITHDRAW).and() | |||
// 年度计划中开启方案申报,从年度计划中到方案待申报 | |||
.withExternal() | |||
.source(ProjectStatusEnum.IN_THE_ANNUAL_PLAN) | |||
.target(ProjectStatusEnum.PLAN_TO_BE_DECLARED) | |||
.event(ProjectStatusChangeEvent.ANNUAL_PLAN_PROJECT_OPEN_PLAN_DECLARE).and() | |||
// 年度计划中暂缓,从年度计划中到被暂缓 | |||
.withExternal() | |||
.source(ProjectStatusEnum.IN_THE_ANNUAL_PLAN) | |||
.target(ProjectStatusEnum.BE_SUSPENDED) | |||
.event(ProjectStatusChangeEvent.ANNUAL_PLAN_SUSPEND).and() | |||
// 方案待申报申报方案,从方案待申报到方案评审中 | |||
.withExternal() | |||
.source(ProjectStatusEnum.PLAN_TO_BE_DECLARED) | |||
.target(ProjectStatusEnum.SCHEME_UNDER_REVIEW) | |||
.event(ProjectStatusChangeEvent.DECLARE_PLAN).and() | |||
// 方案评审通过,从方案评审中到待立项批复 | |||
.withExternal() | |||
.source(ProjectStatusEnum.SCHEME_UNDER_REVIEW) | |||
.target(ProjectStatusEnum.TO_BE_APPROVED) | |||
.event(ProjectStatusChangeEvent.PLAN_REVIEW_PASS).and() | |||
// 方案评审驳回,从方案评审中到方案评审不通过 | |||
.withExternal() | |||
.source(ProjectStatusEnum.SCHEME_UNDER_REVIEW) | |||
.target(ProjectStatusEnum.SCHEME_REVIEW_FAILED) | |||
.event(ProjectStatusChangeEvent.PLAN_REVIEW_REJECT).and() | |||
// 方案评审中撤回,从方案评审中到方案待申报 | |||
.withExternal() | |||
.source(ProjectStatusEnum.SCHEME_UNDER_REVIEW) | |||
.target(ProjectStatusEnum.PLAN_TO_BE_DECLARED) | |||
.event(ProjectStatusChangeEvent.SCHEME_UNDER_REVIEW_WITHDRAW).and() | |||
// 方案评审不通过重新提交,从方案评审不通过到方案评审中 | |||
.withExternal() | |||
.source(ProjectStatusEnum.SCHEME_REVIEW_FAILED) | |||
.target(ProjectStatusEnum.SCHEME_UNDER_REVIEW) | |||
.event(ProjectStatusChangeEvent.PLAN_REVIEW_REJECT_RESUBMIT).and() | |||
// 待立项批复批复,从待立项批复到待采购 | |||
.withExternal() | |||
.source(ProjectStatusEnum.TO_BE_APPROVED) | |||
.target(ProjectStatusEnum.TO_BE_PURCHASED) | |||
.event(ProjectStatusChangeEvent.PROJECT_APPROVAL).and() | |||
// 待采购采购备案,从待采购到建设中 | |||
.withExternal() | |||
.source(ProjectStatusEnum.TO_BE_PURCHASED) | |||
.target(ProjectStatusEnum.UNDER_CONSTRUCTION) | |||
.event(ProjectStatusChangeEvent.PURCHASE_PUT_ON_RECORD).and() | |||
// 建设中初验备案,从建设中到待终验 | |||
.withExternal() | |||
.source(ProjectStatusEnum.UNDER_CONSTRUCTION) | |||
.target(ProjectStatusEnum.TO_BE_FINALLY_INSPECTED) | |||
.event(ProjectStatusChangeEvent.PRELIMINARY_ACCEPTANCE_PUT_ON_RECORD).and() | |||
// 待终验终验申请,从待终验到终验审核中 | |||
.withExternal() | |||
.source(ProjectStatusEnum.TO_BE_FINALLY_INSPECTED) | |||
.target(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) | |||
.event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_APPLICATION).and() | |||
// 终审审核通过,从终审审核中到已归档 | |||
.withExternal() | |||
.source(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) | |||
.target(ProjectStatusEnum.ARCHIVED) | |||
.event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_PASS).and() | |||
// 终审审核不通过,从终审审核中到终审审核不通过 | |||
.withExternal() | |||
.source(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) | |||
.target(ProjectStatusEnum.FINAL_ACCEPTANCE_REVIEW_FAILED) | |||
.event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_REJECT).and() | |||
// 终审审核中撤回,从终审审核中到待终验 | |||
.withExternal() | |||
.source(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) | |||
.target(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) | |||
.event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_IS_UNDER_REVIEW_WITHDRAW).and(); | |||
return builder.build(); | |||
} | |||
/** | |||
* 持久化配置 | |||
* @author CMM | |||
* @since 2023/02/07 16:22 | |||
*/ | |||
@Bean(name = "projectDeclareStateMachineQTPersister") | |||
@Override | |||
public StateMachinePersister<ProjectStatusEnum, ProjectStatusChangeEvent, Project> getProjectPersister() { | |||
StateMachinePersister sp = new DefaultStateMachinePersister<>(new StateMachinePersist<ProjectStatusEnum, ProjectStatusChangeEvent, Project>() { | |||
@Override | |||
public void write(StateMachineContext<ProjectStatusEnum, ProjectStatusChangeEvent> context, Project contextObj) { | |||
} | |||
@Override | |||
public StateMachineContext<ProjectStatusEnum, ProjectStatusChangeEvent> read(Project contextObj) { | |||
StateMachineContext<ProjectStatusEnum, ProjectStatusChangeEvent> result = new DefaultStateMachineContext(ProjectStatusEnum.getValue(contextObj.getStatus()), | |||
null, null, null, null, RegionContant.LS_YH_CODE); | |||
return result; | |||
} | |||
}); | |||
stateMachinePersister = sp; | |||
return sp; | |||
} | |||
public StateMachinePersister getStateMachinePersister(){ | |||
return stateMachinePersister; | |||
} | |||
} |
@@ -0,0 +1,274 @@ | |||
package com.ningdatech.pmapi.common.statemachine.builder; | |||
import com.ningdatech.pmapi.common.statemachine.action.ProjectDeclareChoiceAction; | |||
import com.ningdatech.pmapi.common.statemachine.contants.RegionContant; | |||
import com.ningdatech.pmapi.common.statemachine.event.ProjectStatusChangeEvent; | |||
import com.ningdatech.pmapi.common.statemachine.factory.ProjectDeclareGuardFactory; | |||
import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; | |||
import com.ningdatech.pmapi.projectlib.model.entity.Project; | |||
import lombok.RequiredArgsConstructor; | |||
import org.slf4j.Logger; | |||
import org.slf4j.LoggerFactory; | |||
import org.springframework.beans.factory.BeanFactory; | |||
import org.springframework.context.annotation.Bean; | |||
import org.springframework.statemachine.StateMachine; | |||
import org.springframework.statemachine.StateMachineContext; | |||
import org.springframework.statemachine.StateMachinePersist; | |||
import org.springframework.statemachine.config.EnableStateMachine; | |||
import org.springframework.statemachine.config.StateMachineBuilder; | |||
import org.springframework.statemachine.persist.DefaultStateMachinePersister; | |||
import org.springframework.statemachine.persist.StateMachinePersister; | |||
import org.springframework.statemachine.support.DefaultStateMachineContext; | |||
import org.springframework.stereotype.Component; | |||
import java.util.EnumSet; | |||
/** | |||
* 项目申报状态机 | |||
* 庆元县 | |||
* @author CMM | |||
* @since 2023/02/07 15:56 | |||
*/ | |||
@Component | |||
@EnableStateMachine(name= ProjectDeclareStateMachineQYBuilder.MACHINEID_TO) | |||
@RequiredArgsConstructor | |||
public class ProjectDeclareStateMachineQYBuilder implements ProjectDeclareStateMachineBuilder { | |||
private static final ProjectDeclareGuardFactory projectDeclareGuardFactory = new ProjectDeclareGuardFactory(); | |||
private final BeanFactory beanFactory; | |||
private StateMachinePersister stateMachinePersister; | |||
private Logger logger = LoggerFactory.getLogger(getClass()); | |||
/** | |||
* TO状态机 | |||
*/ | |||
public final static String MACHINEID_TO = RegionContant.LS_QY_CODE; | |||
@Override | |||
public StateMachine<ProjectStatusEnum, ProjectStatusChangeEvent> build() throws Exception { | |||
StateMachine<ProjectStatusEnum, ProjectStatusChangeEvent> stateMachine = build(beanFactory); | |||
logger.info("状态机ID:" + stateMachine.getId()); | |||
stateMachine.start(); | |||
return stateMachine; | |||
} | |||
/** | |||
* 构建状态机 | |||
* @param beanFactory | |||
* @author CMM | |||
* @since 2023/02/07 16:15 | |||
*/ | |||
@Override | |||
public StateMachine<ProjectStatusEnum, ProjectStatusChangeEvent> build(BeanFactory beanFactory) throws Exception { | |||
StateMachineBuilder.Builder<ProjectStatusEnum, ProjectStatusChangeEvent> builder = StateMachineBuilder.builder(); | |||
builder.configureConfiguration() | |||
.withConfiguration() | |||
.machineId(MACHINEID_TO) | |||
.beanFactory(beanFactory); | |||
builder.configureStates() | |||
.withStates() | |||
.initial(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) | |||
.choice(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) | |||
.choice(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE) | |||
.states(EnumSet.allOf(ProjectStatusEnum.class)); | |||
builder.configureTransitions() | |||
// 单位内部审核通过,从单位内部审核中到待预审 | |||
.withExternal() | |||
.source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) | |||
.target(ProjectStatusEnum.PENDING_PREQUALIFICATION) | |||
.event(ProjectStatusChangeEvent.UNDER_INTERNAL_PASS).and() | |||
// 单位内部审核驳回,从单位内部审核中到单位内部审核不通过 | |||
.withExternal() | |||
.source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) | |||
.target(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS) | |||
.event(ProjectStatusChangeEvent.UNDER_INTERNAL_REJECT).and() | |||
// 单位内部审核中撤回,从单位内部审核中到待申报 | |||
.withExternal() | |||
.source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) | |||
.target(ProjectStatusEnum.TO_BE_DECLARED) | |||
.event(ProjectStatusChangeEvent.UNDER_INTERNAL_WITHDRAW).and() | |||
// 单位内部审核不通过重新提交,从单位内部审核不通过到单位内部审核中 | |||
.withExternal() | |||
.source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS) | |||
.target(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) | |||
.event(ProjectStatusChangeEvent.UNDER_INTERNAL_REJECT_RESUBMIT).and() | |||
// 待预审预审申报,从待预审到待预审选择 | |||
.withExternal() | |||
.source(ProjectStatusEnum.PENDING_PREQUALIFICATION) | |||
.target(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) | |||
.event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_DECLARE).and() | |||
// 待预审申报,从待预审选择->省级部门联审中,预审中,完成其中一种状态 | |||
.withChoice() | |||
.source(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) | |||
.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) | |||
.target(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS) | |||
.event(ProjectStatusChangeEvent.PROVINCIAL_DEPARTMENT_REVIEW_PASS).and() | |||
// 省级部门联审通过,从省级部门联审成功到预审中 | |||
.withExternal() | |||
.source(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS) | |||
.target(ProjectStatusEnum.PRE_APPLYING) | |||
.event(ProjectStatusChangeEvent.PROVINCIAL_PASS_TO_PRELIMINARY_REVIEW).and() | |||
// 省级部门联审不通过,从省级部门联审中到省级部门联审不通过 | |||
.withExternal() | |||
.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) | |||
.event(ProjectStatusChangeEvent.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_WITHDRAW).and() | |||
// 预审通过,从预审中到部门联审中 | |||
.withExternal() | |||
.source(ProjectStatusEnum.PRE_APPLYING) | |||
.target(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW) | |||
.event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_PASS).and() | |||
// 预审驳回,从预审中到预审不通过 | |||
.withExternal() | |||
.source(ProjectStatusEnum.PRE_APPLYING) | |||
.target(ProjectStatusEnum.PREQUALIFICATION_FAILED) | |||
.event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_REJECT).and() | |||
// 预审中撤回,从预审中到预审中撤回选择态 | |||
.withExternal() | |||
.source(ProjectStatusEnum.PRE_APPLYING) | |||
.target(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE) | |||
.event(ProjectStatusChangeEvent.PRE_APPLYING_WITHDRAW).and() | |||
// 预审中撤回,从预审中撤回选择态->省级部门联审成功,待预审,完成其中一种状态 | |||
.withChoice() | |||
.source(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE) | |||
.first(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS,projectDeclareGuardFactory.new PendingPreQualificationChoiceGuard() | |||
,new ProjectDeclareChoiceAction()) | |||
.last(ProjectStatusEnum.PENDING_PREQUALIFICATION,new ProjectDeclareChoiceAction()).and() | |||
// 预审不通过重新提交,从预审不通过到待预审选择 | |||
.withExternal() | |||
.source(ProjectStatusEnum.PREQUALIFICATION_FAILED) | |||
.target(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) | |||
.event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_REJECT_RESUBMIT).and() | |||
// 预审不通过重新提交,从待预审选择->省级部门联审中,预审中,完成其中一种状态 | |||
.withChoice() | |||
.source(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) | |||
.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) | |||
.target(ProjectStatusEnum.IN_THE_ANNUAL_PLAN) | |||
.event(ProjectStatusChangeEvent.DEPARTMENT_UNITED_REVIEW_PASS).and() | |||
// 部门联审驳回,从部门联审中到部门联审不通过 | |||
.withExternal() | |||
.source(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW) | |||
.target(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW_FAILED) | |||
.event(ProjectStatusChangeEvent.DEPARTMENT_UNITED_REVIEW_REJECT).and() | |||
// 部门联审中撤回,从部门联审中到预审中 | |||
.withExternal() | |||
.source(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW) | |||
.target(ProjectStatusEnum.PRE_APPLYING) | |||
.event(ProjectStatusChangeEvent.DEPARTMENT_JOINT_REVIEW_WITHDRAW).and() | |||
// 年度计划中开启方案申报,从年度计划中到方案待申报 | |||
.withExternal() | |||
.source(ProjectStatusEnum.IN_THE_ANNUAL_PLAN) | |||
.target(ProjectStatusEnum.PLAN_TO_BE_DECLARED) | |||
.event(ProjectStatusChangeEvent.ANNUAL_PLAN_PROJECT_OPEN_PLAN_DECLARE).and() | |||
// 年度计划中暂缓,从年度计划中到被暂缓 | |||
.withExternal() | |||
.source(ProjectStatusEnum.IN_THE_ANNUAL_PLAN) | |||
.target(ProjectStatusEnum.BE_SUSPENDED) | |||
.event(ProjectStatusChangeEvent.ANNUAL_PLAN_SUSPEND).and() | |||
// 方案待申报申报方案,从方案待申报到方案评审中 | |||
.withExternal() | |||
.source(ProjectStatusEnum.PLAN_TO_BE_DECLARED) | |||
.target(ProjectStatusEnum.SCHEME_UNDER_REVIEW) | |||
.event(ProjectStatusChangeEvent.DECLARE_PLAN).and() | |||
// 方案评审通过,从方案评审中到待立项批复 | |||
.withExternal() | |||
.source(ProjectStatusEnum.SCHEME_UNDER_REVIEW) | |||
.target(ProjectStatusEnum.TO_BE_APPROVED) | |||
.event(ProjectStatusChangeEvent.PLAN_REVIEW_PASS).and() | |||
// 方案评审驳回,从方案评审中到方案评审不通过 | |||
.withExternal() | |||
.source(ProjectStatusEnum.SCHEME_UNDER_REVIEW) | |||
.target(ProjectStatusEnum.SCHEME_REVIEW_FAILED) | |||
.event(ProjectStatusChangeEvent.PLAN_REVIEW_REJECT).and() | |||
// 方案评审中撤回,从方案评审中到方案待申报 | |||
.withExternal() | |||
.source(ProjectStatusEnum.SCHEME_UNDER_REVIEW) | |||
.target(ProjectStatusEnum.PLAN_TO_BE_DECLARED) | |||
.event(ProjectStatusChangeEvent.SCHEME_UNDER_REVIEW_WITHDRAW).and() | |||
// 方案评审不通过重新提交,从方案评审不通过到方案评审中 | |||
.withExternal() | |||
.source(ProjectStatusEnum.SCHEME_REVIEW_FAILED) | |||
.target(ProjectStatusEnum.SCHEME_UNDER_REVIEW) | |||
.event(ProjectStatusChangeEvent.PLAN_REVIEW_REJECT_RESUBMIT).and() | |||
// 待立项批复批复,从待立项批复到待采购 | |||
.withExternal() | |||
.source(ProjectStatusEnum.TO_BE_APPROVED) | |||
.target(ProjectStatusEnum.TO_BE_PURCHASED) | |||
.event(ProjectStatusChangeEvent.PROJECT_APPROVAL).and() | |||
// 待采购采购备案,从待采购到建设中 | |||
.withExternal() | |||
.source(ProjectStatusEnum.TO_BE_PURCHASED) | |||
.target(ProjectStatusEnum.UNDER_CONSTRUCTION) | |||
.event(ProjectStatusChangeEvent.PURCHASE_PUT_ON_RECORD).and() | |||
// 建设中初验备案,从建设中到待终验 | |||
.withExternal() | |||
.source(ProjectStatusEnum.UNDER_CONSTRUCTION) | |||
.target(ProjectStatusEnum.TO_BE_FINALLY_INSPECTED) | |||
.event(ProjectStatusChangeEvent.PRELIMINARY_ACCEPTANCE_PUT_ON_RECORD).and() | |||
// 待终验终验申请,从待终验到终验审核中 | |||
.withExternal() | |||
.source(ProjectStatusEnum.TO_BE_FINALLY_INSPECTED) | |||
.target(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) | |||
.event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_APPLICATION).and() | |||
// 终审审核通过,从终审审核中到已归档 | |||
.withExternal() | |||
.source(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) | |||
.target(ProjectStatusEnum.ARCHIVED) | |||
.event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_PASS).and() | |||
// 终审审核不通过,从终审审核中到终审审核不通过 | |||
.withExternal() | |||
.source(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) | |||
.target(ProjectStatusEnum.FINAL_ACCEPTANCE_REVIEW_FAILED) | |||
.event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_REJECT).and() | |||
// 终审审核中撤回,从终审审核中到待终验 | |||
.withExternal() | |||
.source(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) | |||
.target(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) | |||
.event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_IS_UNDER_REVIEW_WITHDRAW).and(); | |||
return builder.build(); | |||
} | |||
/** | |||
* 持久化配置 | |||
* @author CMM | |||
* @since 2023/02/07 16:22 | |||
*/ | |||
@Bean(name = "projectDeclareStateMachineQYPersister") | |||
@Override | |||
public StateMachinePersister<ProjectStatusEnum, ProjectStatusChangeEvent, Project> getProjectPersister() { | |||
StateMachinePersister sp = new DefaultStateMachinePersister<>(new StateMachinePersist<ProjectStatusEnum, ProjectStatusChangeEvent, Project>() { | |||
@Override | |||
public void write(StateMachineContext<ProjectStatusEnum, ProjectStatusChangeEvent> context, Project contextObj) { | |||
} | |||
@Override | |||
public StateMachineContext<ProjectStatusEnum, ProjectStatusChangeEvent> read(Project contextObj) { | |||
StateMachineContext<ProjectStatusEnum, ProjectStatusChangeEvent> result = new DefaultStateMachineContext(ProjectStatusEnum.getValue(contextObj.getStatus()), | |||
null, null, null, null, RegionContant.LS_YH_CODE); | |||
return result; | |||
} | |||
}); | |||
stateMachinePersister = sp; | |||
return sp; | |||
} | |||
public StateMachinePersister getStateMachinePersister(){ | |||
return stateMachinePersister; | |||
} | |||
} |
@@ -0,0 +1,275 @@ | |||
package com.ningdatech.pmapi.common.statemachine.builder; | |||
import com.ningdatech.pmapi.common.enumeration.CommonEnum; | |||
import com.ningdatech.pmapi.common.statemachine.action.ProjectDeclareChoiceAction; | |||
import com.ningdatech.pmapi.common.statemachine.contants.RegionContant; | |||
import com.ningdatech.pmapi.common.statemachine.event.ProjectStatusChangeEvent; | |||
import com.ningdatech.pmapi.common.statemachine.factory.ProjectDeclareGuardFactory; | |||
import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; | |||
import com.ningdatech.pmapi.projectlib.model.entity.Project; | |||
import lombok.RequiredArgsConstructor; | |||
import org.slf4j.Logger; | |||
import org.slf4j.LoggerFactory; | |||
import org.springframework.beans.factory.BeanFactory; | |||
import org.springframework.context.annotation.Bean; | |||
import org.springframework.statemachine.StateMachine; | |||
import org.springframework.statemachine.StateMachineContext; | |||
import org.springframework.statemachine.StateMachinePersist; | |||
import org.springframework.statemachine.config.EnableStateMachine; | |||
import org.springframework.statemachine.config.StateMachineBuilder; | |||
import org.springframework.statemachine.persist.DefaultStateMachinePersister; | |||
import org.springframework.statemachine.persist.StateMachinePersister; | |||
import org.springframework.statemachine.support.DefaultStateMachineContext; | |||
import org.springframework.stereotype.Component; | |||
import java.util.EnumSet; | |||
/** | |||
* 项目申报状态机 | |||
* 市本级 | |||
* @author CMM | |||
* @since 2023/02/07 15:56 | |||
*/ | |||
@Component | |||
@EnableStateMachine(name= ProjectDeclareStateMachineSBJBuilder.MACHINEID_TO) | |||
@RequiredArgsConstructor | |||
public class ProjectDeclareStateMachineSBJBuilder implements ProjectDeclareStateMachineBuilder { | |||
private static final ProjectDeclareGuardFactory projectDeclareGuardFactory = new ProjectDeclareGuardFactory(); | |||
private final BeanFactory beanFactory; | |||
private StateMachinePersister stateMachinePersister; | |||
private Logger logger = LoggerFactory.getLogger(getClass()); | |||
/** | |||
* TO状态机 | |||
*/ | |||
public final static String MACHINEID_TO = RegionContant.LS_SBJ_CODE; | |||
@Override | |||
public StateMachine<ProjectStatusEnum, ProjectStatusChangeEvent> build() throws Exception { | |||
StateMachine<ProjectStatusEnum, ProjectStatusChangeEvent> stateMachine = build(beanFactory); | |||
logger.info("状态机ID:" + stateMachine.getId()); | |||
stateMachine.start(); | |||
return stateMachine; | |||
} | |||
/** | |||
* 构建状态机 | |||
* @param beanFactory | |||
* @author CMM | |||
* @since 2023/02/07 16:15 | |||
*/ | |||
@Override | |||
public StateMachine<ProjectStatusEnum, ProjectStatusChangeEvent> build(BeanFactory beanFactory) throws Exception { | |||
StateMachineBuilder.Builder<ProjectStatusEnum, ProjectStatusChangeEvent> builder = StateMachineBuilder.builder(); | |||
builder.configureConfiguration() | |||
.withConfiguration() | |||
.machineId(MACHINEID_TO) | |||
.beanFactory(beanFactory); | |||
builder.configureStates() | |||
.withStates() | |||
.initial(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) | |||
.choice(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) | |||
.choice(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE) | |||
.states(EnumSet.allOf(ProjectStatusEnum.class)); | |||
builder.configureTransitions() | |||
// 单位内部审核通过,从单位内部审核中到待预审 | |||
.withExternal() | |||
.source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) | |||
.target(ProjectStatusEnum.PENDING_PREQUALIFICATION) | |||
.event(ProjectStatusChangeEvent.UNDER_INTERNAL_PASS).and() | |||
// 单位内部审核驳回,从单位内部审核中到单位内部审核不通过 | |||
.withExternal() | |||
.source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) | |||
.target(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS) | |||
.event(ProjectStatusChangeEvent.UNDER_INTERNAL_REJECT).and() | |||
// 单位内部审核中撤回,从单位内部审核中到待申报 | |||
.withExternal() | |||
.source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) | |||
.target(ProjectStatusEnum.TO_BE_DECLARED) | |||
.event(ProjectStatusChangeEvent.UNDER_INTERNAL_WITHDRAW).and() | |||
// 单位内部审核不通过重新提交,从单位内部审核不通过到单位内部审核中 | |||
.withExternal() | |||
.source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS) | |||
.target(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) | |||
.event(ProjectStatusChangeEvent.UNDER_INTERNAL_REJECT_RESUBMIT).and() | |||
// 待预审预审申报,从待预审到待预审选择 | |||
.withExternal() | |||
.source(ProjectStatusEnum.PENDING_PREQUALIFICATION) | |||
.target(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) | |||
.event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_DECLARE).and() | |||
// 待预审申报,从待预审选择->省级部门联审中,预审中,完成其中一种状态 | |||
.withChoice() | |||
.source(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) | |||
.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) | |||
.target(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS) | |||
.event(ProjectStatusChangeEvent.PROVINCIAL_DEPARTMENT_REVIEW_PASS).and() | |||
// 省级部门联审通过,从省级部门联审成功到预审中 | |||
.withExternal() | |||
.source(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS) | |||
.target(ProjectStatusEnum.PRE_APPLYING) | |||
.event(ProjectStatusChangeEvent.PROVINCIAL_PASS_TO_PRELIMINARY_REVIEW).and() | |||
// 省级部门联审不通过,从省级部门联审中到省级部门联审不通过 | |||
.withExternal() | |||
.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) | |||
.event(ProjectStatusChangeEvent.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_WITHDRAW).and() | |||
// 预审通过,从预审中到部门联审中 | |||
.withExternal() | |||
.source(ProjectStatusEnum.PRE_APPLYING) | |||
.target(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW) | |||
.event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_PASS).and() | |||
// 预审驳回,从预审中到预审不通过 | |||
.withExternal() | |||
.source(ProjectStatusEnum.PRE_APPLYING) | |||
.target(ProjectStatusEnum.PREQUALIFICATION_FAILED) | |||
.event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_REJECT).and() | |||
// 预审中撤回,从预审中到预审中撤回选择态 | |||
.withExternal() | |||
.source(ProjectStatusEnum.PRE_APPLYING) | |||
.target(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE) | |||
.event(ProjectStatusChangeEvent.PRE_APPLYING_WITHDRAW).and() | |||
// 预审中撤回,从预审中撤回选择态->省级部门联审成功,待预审,完成其中一种状态 | |||
.withChoice() | |||
.source(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE) | |||
.first(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS,projectDeclareGuardFactory.new PendingPreQualificationChoiceGuard() | |||
,new ProjectDeclareChoiceAction()) | |||
.last(ProjectStatusEnum.PENDING_PREQUALIFICATION,new ProjectDeclareChoiceAction()).and() | |||
// 预审不通过重新提交,从预审不通过到待预审选择 | |||
.withExternal() | |||
.source(ProjectStatusEnum.PREQUALIFICATION_FAILED) | |||
.target(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) | |||
.event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_REJECT_RESUBMIT).and() | |||
// 预审不通过重新提交,从待预审选择->省级部门联审中,预审中,完成其中一种状态 | |||
.withChoice() | |||
.source(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) | |||
.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) | |||
.target(ProjectStatusEnum.IN_THE_ANNUAL_PLAN) | |||
.event(ProjectStatusChangeEvent.DEPARTMENT_UNITED_REVIEW_PASS).and() | |||
// 部门联审驳回,从部门联审中到部门联审不通过 | |||
.withExternal() | |||
.source(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW) | |||
.target(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW_FAILED) | |||
.event(ProjectStatusChangeEvent.DEPARTMENT_UNITED_REVIEW_REJECT).and() | |||
// 部门联审中撤回,从部门联审中到预审中 | |||
.withExternal() | |||
.source(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW) | |||
.target(ProjectStatusEnum.PRE_APPLYING) | |||
.event(ProjectStatusChangeEvent.DEPARTMENT_JOINT_REVIEW_WITHDRAW).and() | |||
// 年度计划中开启方案申报,从年度计划中到方案待申报 | |||
.withExternal() | |||
.source(ProjectStatusEnum.IN_THE_ANNUAL_PLAN) | |||
.target(ProjectStatusEnum.PLAN_TO_BE_DECLARED) | |||
.event(ProjectStatusChangeEvent.ANNUAL_PLAN_PROJECT_OPEN_PLAN_DECLARE).and() | |||
// 年度计划中暂缓,从年度计划中到被暂缓 | |||
.withExternal() | |||
.source(ProjectStatusEnum.IN_THE_ANNUAL_PLAN) | |||
.target(ProjectStatusEnum.BE_SUSPENDED) | |||
.event(ProjectStatusChangeEvent.ANNUAL_PLAN_SUSPEND).and() | |||
// 方案待申报申报方案,从方案待申报到方案评审中 | |||
.withExternal() | |||
.source(ProjectStatusEnum.PLAN_TO_BE_DECLARED) | |||
.target(ProjectStatusEnum.SCHEME_UNDER_REVIEW) | |||
.event(ProjectStatusChangeEvent.DECLARE_PLAN).and() | |||
// 方案评审通过,从方案评审中到待立项批复 | |||
.withExternal() | |||
.source(ProjectStatusEnum.SCHEME_UNDER_REVIEW) | |||
.target(ProjectStatusEnum.TO_BE_APPROVED) | |||
.event(ProjectStatusChangeEvent.PLAN_REVIEW_PASS).and() | |||
// 方案评审驳回,从方案评审中到方案评审不通过 | |||
.withExternal() | |||
.source(ProjectStatusEnum.SCHEME_UNDER_REVIEW) | |||
.target(ProjectStatusEnum.SCHEME_REVIEW_FAILED) | |||
.event(ProjectStatusChangeEvent.PLAN_REVIEW_REJECT).and() | |||
// 方案评审中撤回,从方案评审中到方案待申报 | |||
.withExternal() | |||
.source(ProjectStatusEnum.SCHEME_UNDER_REVIEW) | |||
.target(ProjectStatusEnum.PLAN_TO_BE_DECLARED) | |||
.event(ProjectStatusChangeEvent.SCHEME_UNDER_REVIEW_WITHDRAW).and() | |||
// 方案评审不通过重新提交,从方案评审不通过到方案评审中 | |||
.withExternal() | |||
.source(ProjectStatusEnum.SCHEME_REVIEW_FAILED) | |||
.target(ProjectStatusEnum.SCHEME_UNDER_REVIEW) | |||
.event(ProjectStatusChangeEvent.PLAN_REVIEW_REJECT_RESUBMIT).and() | |||
// 待立项批复批复,从待立项批复到待采购 | |||
.withExternal() | |||
.source(ProjectStatusEnum.TO_BE_APPROVED) | |||
.target(ProjectStatusEnum.TO_BE_PURCHASED) | |||
.event(ProjectStatusChangeEvent.PROJECT_APPROVAL).and() | |||
// 待采购采购备案,从待采购到建设中 | |||
.withExternal() | |||
.source(ProjectStatusEnum.TO_BE_PURCHASED) | |||
.target(ProjectStatusEnum.UNDER_CONSTRUCTION) | |||
.event(ProjectStatusChangeEvent.PURCHASE_PUT_ON_RECORD).and() | |||
// 建设中初验备案,从建设中到待终验 | |||
.withExternal() | |||
.source(ProjectStatusEnum.UNDER_CONSTRUCTION) | |||
.target(ProjectStatusEnum.TO_BE_FINALLY_INSPECTED) | |||
.event(ProjectStatusChangeEvent.PRELIMINARY_ACCEPTANCE_PUT_ON_RECORD).and() | |||
// 待终验终验申请,从待终验到终验审核中 | |||
.withExternal() | |||
.source(ProjectStatusEnum.TO_BE_FINALLY_INSPECTED) | |||
.target(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) | |||
.event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_APPLICATION).and() | |||
// 终审审核通过,从终审审核中到已归档 | |||
.withExternal() | |||
.source(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) | |||
.target(ProjectStatusEnum.ARCHIVED) | |||
.event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_PASS).and() | |||
// 终审审核不通过,从终审审核中到终审审核不通过 | |||
.withExternal() | |||
.source(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) | |||
.target(ProjectStatusEnum.FINAL_ACCEPTANCE_REVIEW_FAILED) | |||
.event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_REJECT).and() | |||
// 终审审核中撤回,从终审审核中到待终验 | |||
.withExternal() | |||
.source(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) | |||
.target(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) | |||
.event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_IS_UNDER_REVIEW_WITHDRAW).and(); | |||
return builder.build(); | |||
} | |||
/** | |||
* 持久化配置 | |||
* @author CMM | |||
* @since 2023/02/07 16:22 | |||
*/ | |||
@Bean(name = "projectDeclareStateMachineSBJPersister") | |||
@Override | |||
public StateMachinePersister<ProjectStatusEnum, ProjectStatusChangeEvent, Project> getProjectPersister() { | |||
StateMachinePersister sp = new DefaultStateMachinePersister<>(new StateMachinePersist<ProjectStatusEnum, ProjectStatusChangeEvent, Project>() { | |||
@Override | |||
public void write(StateMachineContext<ProjectStatusEnum, ProjectStatusChangeEvent> context, Project contextObj) { | |||
} | |||
@Override | |||
public StateMachineContext<ProjectStatusEnum, ProjectStatusChangeEvent> read(Project contextObj) { | |||
StateMachineContext<ProjectStatusEnum, ProjectStatusChangeEvent> result = new DefaultStateMachineContext(ProjectStatusEnum.getValue(contextObj.getStatus()), | |||
null, null, null, null, RegionContant.LS_YH_CODE); | |||
return result; | |||
} | |||
}); | |||
stateMachinePersister = sp; | |||
return sp; | |||
} | |||
public StateMachinePersister getStateMachinePersister(){ | |||
return stateMachinePersister; | |||
} | |||
} |
@@ -0,0 +1,274 @@ | |||
package com.ningdatech.pmapi.common.statemachine.builder; | |||
import com.ningdatech.pmapi.common.statemachine.action.ProjectDeclareChoiceAction; | |||
import com.ningdatech.pmapi.common.statemachine.contants.RegionContant; | |||
import com.ningdatech.pmapi.common.statemachine.event.ProjectStatusChangeEvent; | |||
import com.ningdatech.pmapi.common.statemachine.factory.ProjectDeclareGuardFactory; | |||
import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; | |||
import com.ningdatech.pmapi.projectlib.model.entity.Project; | |||
import lombok.RequiredArgsConstructor; | |||
import org.slf4j.Logger; | |||
import org.slf4j.LoggerFactory; | |||
import org.springframework.beans.factory.BeanFactory; | |||
import org.springframework.context.annotation.Bean; | |||
import org.springframework.statemachine.StateMachine; | |||
import org.springframework.statemachine.StateMachineContext; | |||
import org.springframework.statemachine.StateMachinePersist; | |||
import org.springframework.statemachine.config.EnableStateMachine; | |||
import org.springframework.statemachine.config.StateMachineBuilder; | |||
import org.springframework.statemachine.persist.DefaultStateMachinePersister; | |||
import org.springframework.statemachine.persist.StateMachinePersister; | |||
import org.springframework.statemachine.support.DefaultStateMachineContext; | |||
import org.springframework.stereotype.Component; | |||
import java.util.EnumSet; | |||
/** | |||
* 项目申报状态机 | |||
* 遂昌县 | |||
* @author CMM | |||
* @since 2023/02/07 15:56 | |||
*/ | |||
@Component | |||
@EnableStateMachine(name= ProjectDeclareStateMachineSCBuilder.MACHINEID_TO) | |||
@RequiredArgsConstructor | |||
public class ProjectDeclareStateMachineSCBuilder implements ProjectDeclareStateMachineBuilder{ | |||
private static final ProjectDeclareGuardFactory projectDeclareGuardFactory = new ProjectDeclareGuardFactory(); | |||
private final BeanFactory beanFactory; | |||
private StateMachinePersister stateMachinePersister; | |||
private Logger logger = LoggerFactory.getLogger(getClass()); | |||
/** | |||
* TO状态机 | |||
*/ | |||
public final static String MACHINEID_TO = RegionContant.LS_SC_CODE; | |||
@Override | |||
public StateMachine<ProjectStatusEnum, ProjectStatusChangeEvent> build() throws Exception { | |||
StateMachine<ProjectStatusEnum, ProjectStatusChangeEvent> stateMachine = build(beanFactory); | |||
logger.info("状态机ID:" + stateMachine.getId()); | |||
stateMachine.start(); | |||
return stateMachine; | |||
} | |||
/** | |||
* 构建状态机 | |||
* @param beanFactory | |||
* @author CMM | |||
* @since 2023/02/07 16:15 | |||
*/ | |||
@Override | |||
public StateMachine<ProjectStatusEnum, ProjectStatusChangeEvent> build(BeanFactory beanFactory) throws Exception { | |||
StateMachineBuilder.Builder<ProjectStatusEnum, ProjectStatusChangeEvent> builder = StateMachineBuilder.builder(); | |||
builder.configureConfiguration() | |||
.withConfiguration() | |||
.machineId(MACHINEID_TO) | |||
.beanFactory(beanFactory); | |||
builder.configureStates() | |||
.withStates() | |||
.initial(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) | |||
.choice(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) | |||
.choice(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE) | |||
.states(EnumSet.allOf(ProjectStatusEnum.class)); | |||
builder.configureTransitions() | |||
// 单位内部审核通过,从单位内部审核中到待预审 | |||
.withExternal() | |||
.source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) | |||
.target(ProjectStatusEnum.PENDING_PREQUALIFICATION) | |||
.event(ProjectStatusChangeEvent.UNDER_INTERNAL_PASS).and() | |||
// 单位内部审核驳回,从单位内部审核中到单位内部审核不通过 | |||
.withExternal() | |||
.source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) | |||
.target(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS) | |||
.event(ProjectStatusChangeEvent.UNDER_INTERNAL_REJECT).and() | |||
// 单位内部审核中撤回,从单位内部审核中到待申报 | |||
.withExternal() | |||
.source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) | |||
.target(ProjectStatusEnum.TO_BE_DECLARED) | |||
.event(ProjectStatusChangeEvent.UNDER_INTERNAL_WITHDRAW).and() | |||
// 单位内部审核不通过重新提交,从单位内部审核不通过到单位内部审核中 | |||
.withExternal() | |||
.source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS) | |||
.target(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) | |||
.event(ProjectStatusChangeEvent.UNDER_INTERNAL_REJECT_RESUBMIT).and() | |||
// 待预审预审申报,从待预审到待预审选择 | |||
.withExternal() | |||
.source(ProjectStatusEnum.PENDING_PREQUALIFICATION) | |||
.target(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) | |||
.event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_DECLARE).and() | |||
// 待预审申报,从待预审选择->省级部门联审中,预审中,完成其中一种状态 | |||
.withChoice() | |||
.source(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) | |||
.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) | |||
.target(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS) | |||
.event(ProjectStatusChangeEvent.PROVINCIAL_DEPARTMENT_REVIEW_PASS).and() | |||
// 省级部门联审通过,从省级部门联审成功到预审中 | |||
.withExternal() | |||
.source(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS) | |||
.target(ProjectStatusEnum.PRE_APPLYING) | |||
.event(ProjectStatusChangeEvent.PROVINCIAL_PASS_TO_PRELIMINARY_REVIEW).and() | |||
// 省级部门联审不通过,从省级部门联审中到省级部门联审不通过 | |||
.withExternal() | |||
.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) | |||
.event(ProjectStatusChangeEvent.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_WITHDRAW).and() | |||
// 预审通过,从预审中到部门联审中 | |||
.withExternal() | |||
.source(ProjectStatusEnum.PRE_APPLYING) | |||
.target(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW) | |||
.event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_PASS).and() | |||
// 预审驳回,从预审中到预审不通过 | |||
.withExternal() | |||
.source(ProjectStatusEnum.PRE_APPLYING) | |||
.target(ProjectStatusEnum.PREQUALIFICATION_FAILED) | |||
.event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_REJECT).and() | |||
// 预审中撤回,从预审中到预审中撤回选择态 | |||
.withExternal() | |||
.source(ProjectStatusEnum.PRE_APPLYING) | |||
.target(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE) | |||
.event(ProjectStatusChangeEvent.PRE_APPLYING_WITHDRAW).and() | |||
// 预审中撤回,从预审中撤回选择态->省级部门联审成功,待预审,完成其中一种状态 | |||
.withChoice() | |||
.source(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE) | |||
.first(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS,projectDeclareGuardFactory.new PendingPreQualificationChoiceGuard() | |||
,new ProjectDeclareChoiceAction()) | |||
.last(ProjectStatusEnum.PENDING_PREQUALIFICATION,new ProjectDeclareChoiceAction()).and() | |||
// 预审不通过重新提交,从预审不通过到待预审选择 | |||
.withExternal() | |||
.source(ProjectStatusEnum.PREQUALIFICATION_FAILED) | |||
.target(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) | |||
.event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_REJECT_RESUBMIT).and() | |||
// 预审不通过重新提交,从待预审选择->省级部门联审中,预审中,完成其中一种状态 | |||
.withChoice() | |||
.source(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) | |||
.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) | |||
.target(ProjectStatusEnum.IN_THE_ANNUAL_PLAN) | |||
.event(ProjectStatusChangeEvent.DEPARTMENT_UNITED_REVIEW_PASS).and() | |||
// 部门联审驳回,从部门联审中到部门联审不通过 | |||
.withExternal() | |||
.source(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW) | |||
.target(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW_FAILED) | |||
.event(ProjectStatusChangeEvent.DEPARTMENT_UNITED_REVIEW_REJECT).and() | |||
// 部门联审中撤回,从部门联审中到预审中 | |||
.withExternal() | |||
.source(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW) | |||
.target(ProjectStatusEnum.PRE_APPLYING) | |||
.event(ProjectStatusChangeEvent.DEPARTMENT_JOINT_REVIEW_WITHDRAW).and() | |||
// 年度计划中开启方案申报,从年度计划中到方案待申报 | |||
.withExternal() | |||
.source(ProjectStatusEnum.IN_THE_ANNUAL_PLAN) | |||
.target(ProjectStatusEnum.PLAN_TO_BE_DECLARED) | |||
.event(ProjectStatusChangeEvent.ANNUAL_PLAN_PROJECT_OPEN_PLAN_DECLARE).and() | |||
// 年度计划中暂缓,从年度计划中到被暂缓 | |||
.withExternal() | |||
.source(ProjectStatusEnum.IN_THE_ANNUAL_PLAN) | |||
.target(ProjectStatusEnum.BE_SUSPENDED) | |||
.event(ProjectStatusChangeEvent.ANNUAL_PLAN_SUSPEND).and() | |||
// 方案待申报申报方案,从方案待申报到方案评审中 | |||
.withExternal() | |||
.source(ProjectStatusEnum.PLAN_TO_BE_DECLARED) | |||
.target(ProjectStatusEnum.SCHEME_UNDER_REVIEW) | |||
.event(ProjectStatusChangeEvent.DECLARE_PLAN).and() | |||
// 方案评审通过,从方案评审中到待立项批复 | |||
.withExternal() | |||
.source(ProjectStatusEnum.SCHEME_UNDER_REVIEW) | |||
.target(ProjectStatusEnum.TO_BE_APPROVED) | |||
.event(ProjectStatusChangeEvent.PLAN_REVIEW_PASS).and() | |||
// 方案评审驳回,从方案评审中到方案评审不通过 | |||
.withExternal() | |||
.source(ProjectStatusEnum.SCHEME_UNDER_REVIEW) | |||
.target(ProjectStatusEnum.SCHEME_REVIEW_FAILED) | |||
.event(ProjectStatusChangeEvent.PLAN_REVIEW_REJECT).and() | |||
// 方案评审中撤回,从方案评审中到方案待申报 | |||
.withExternal() | |||
.source(ProjectStatusEnum.SCHEME_UNDER_REVIEW) | |||
.target(ProjectStatusEnum.PLAN_TO_BE_DECLARED) | |||
.event(ProjectStatusChangeEvent.SCHEME_UNDER_REVIEW_WITHDRAW).and() | |||
// 方案评审不通过重新提交,从方案评审不通过到方案评审中 | |||
.withExternal() | |||
.source(ProjectStatusEnum.SCHEME_REVIEW_FAILED) | |||
.target(ProjectStatusEnum.SCHEME_UNDER_REVIEW) | |||
.event(ProjectStatusChangeEvent.PLAN_REVIEW_REJECT_RESUBMIT).and() | |||
// 待立项批复批复,从待立项批复到待采购 | |||
.withExternal() | |||
.source(ProjectStatusEnum.TO_BE_APPROVED) | |||
.target(ProjectStatusEnum.TO_BE_PURCHASED) | |||
.event(ProjectStatusChangeEvent.PROJECT_APPROVAL).and() | |||
// 待采购采购备案,从待采购到建设中 | |||
.withExternal() | |||
.source(ProjectStatusEnum.TO_BE_PURCHASED) | |||
.target(ProjectStatusEnum.UNDER_CONSTRUCTION) | |||
.event(ProjectStatusChangeEvent.PURCHASE_PUT_ON_RECORD).and() | |||
// 建设中初验备案,从建设中到待终验 | |||
.withExternal() | |||
.source(ProjectStatusEnum.UNDER_CONSTRUCTION) | |||
.target(ProjectStatusEnum.TO_BE_FINALLY_INSPECTED) | |||
.event(ProjectStatusChangeEvent.PRELIMINARY_ACCEPTANCE_PUT_ON_RECORD).and() | |||
// 待终验终验申请,从待终验到终验审核中 | |||
.withExternal() | |||
.source(ProjectStatusEnum.TO_BE_FINALLY_INSPECTED) | |||
.target(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) | |||
.event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_APPLICATION).and() | |||
// 终审审核通过,从终审审核中到已归档 | |||
.withExternal() | |||
.source(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) | |||
.target(ProjectStatusEnum.ARCHIVED) | |||
.event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_PASS).and() | |||
// 终审审核不通过,从终审审核中到终审审核不通过 | |||
.withExternal() | |||
.source(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) | |||
.target(ProjectStatusEnum.FINAL_ACCEPTANCE_REVIEW_FAILED) | |||
.event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_REJECT).and() | |||
// 终审审核中撤回,从终审审核中到待终验 | |||
.withExternal() | |||
.source(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) | |||
.target(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) | |||
.event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_IS_UNDER_REVIEW_WITHDRAW).and(); | |||
return builder.build(); | |||
} | |||
/** | |||
* 持久化配置 | |||
* @author CMM | |||
* @since 2023/02/07 16:22 | |||
*/ | |||
@Bean(name = "projectDeclareStateMachineSCPersister") | |||
@Override | |||
public StateMachinePersister<ProjectStatusEnum, ProjectStatusChangeEvent, Project> getProjectPersister() { | |||
StateMachinePersister sp = new DefaultStateMachinePersister<>(new StateMachinePersist<ProjectStatusEnum, ProjectStatusChangeEvent, Project>() { | |||
@Override | |||
public void write(StateMachineContext<ProjectStatusEnum, ProjectStatusChangeEvent> context, Project contextObj) { | |||
} | |||
@Override | |||
public StateMachineContext<ProjectStatusEnum, ProjectStatusChangeEvent> read(Project contextObj) { | |||
StateMachineContext<ProjectStatusEnum, ProjectStatusChangeEvent> result = new DefaultStateMachineContext(ProjectStatusEnum.getValue(contextObj.getStatus()), | |||
null, null, null, null, RegionContant.LS_YH_CODE); | |||
return result; | |||
} | |||
}); | |||
stateMachinePersister = sp; | |||
return sp; | |||
} | |||
public StateMachinePersister getStateMachinePersister(){ | |||
return stateMachinePersister; | |||
} | |||
} |
@@ -0,0 +1,274 @@ | |||
package com.ningdatech.pmapi.common.statemachine.builder; | |||
import com.ningdatech.pmapi.common.statemachine.action.ProjectDeclareChoiceAction; | |||
import com.ningdatech.pmapi.common.statemachine.contants.RegionContant; | |||
import com.ningdatech.pmapi.common.statemachine.event.ProjectStatusChangeEvent; | |||
import com.ningdatech.pmapi.common.statemachine.factory.ProjectDeclareGuardFactory; | |||
import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; | |||
import com.ningdatech.pmapi.projectlib.model.entity.Project; | |||
import lombok.RequiredArgsConstructor; | |||
import org.slf4j.Logger; | |||
import org.slf4j.LoggerFactory; | |||
import org.springframework.beans.factory.BeanFactory; | |||
import org.springframework.context.annotation.Bean; | |||
import org.springframework.statemachine.StateMachine; | |||
import org.springframework.statemachine.StateMachineContext; | |||
import org.springframework.statemachine.StateMachinePersist; | |||
import org.springframework.statemachine.config.EnableStateMachine; | |||
import org.springframework.statemachine.config.StateMachineBuilder; | |||
import org.springframework.statemachine.persist.DefaultStateMachinePersister; | |||
import org.springframework.statemachine.persist.StateMachinePersister; | |||
import org.springframework.statemachine.support.DefaultStateMachineContext; | |||
import org.springframework.stereotype.Component; | |||
import java.util.EnumSet; | |||
/** | |||
* 项目申报状态机 | |||
* 松阳县 | |||
* @author CMM | |||
* @since 2023/02/07 15:56 | |||
*/ | |||
@Component | |||
@EnableStateMachine(name= ProjectDeclareStateMachineSYBuilder.MACHINEID_TO) | |||
@RequiredArgsConstructor | |||
public class ProjectDeclareStateMachineSYBuilder implements ProjectDeclareStateMachineBuilder { | |||
private static final ProjectDeclareGuardFactory projectDeclareGuardFactory = new ProjectDeclareGuardFactory(); | |||
private final BeanFactory beanFactory; | |||
private StateMachinePersister stateMachinePersister; | |||
private Logger logger = LoggerFactory.getLogger(getClass()); | |||
/** | |||
* TO状态机 | |||
*/ | |||
public final static String MACHINEID_TO = RegionContant.LS_SY_CODE; | |||
@Override | |||
public StateMachine<ProjectStatusEnum, ProjectStatusChangeEvent> build() throws Exception { | |||
StateMachine<ProjectStatusEnum, ProjectStatusChangeEvent> stateMachine = build(beanFactory); | |||
logger.info("状态机ID:" + stateMachine.getId()); | |||
stateMachine.start(); | |||
return stateMachine; | |||
} | |||
/** | |||
* 构建状态机 | |||
* @param beanFactory | |||
* @author CMM | |||
* @since 2023/02/07 16:15 | |||
*/ | |||
@Override | |||
public StateMachine<ProjectStatusEnum, ProjectStatusChangeEvent> build(BeanFactory beanFactory) throws Exception { | |||
StateMachineBuilder.Builder<ProjectStatusEnum, ProjectStatusChangeEvent> builder = StateMachineBuilder.builder(); | |||
builder.configureConfiguration() | |||
.withConfiguration() | |||
.machineId(MACHINEID_TO) | |||
.beanFactory(beanFactory); | |||
builder.configureStates() | |||
.withStates() | |||
.initial(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) | |||
.choice(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) | |||
.choice(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE) | |||
.states(EnumSet.allOf(ProjectStatusEnum.class)); | |||
builder.configureTransitions() | |||
// 单位内部审核通过,从单位内部审核中到待预审 | |||
.withExternal() | |||
.source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) | |||
.target(ProjectStatusEnum.PENDING_PREQUALIFICATION) | |||
.event(ProjectStatusChangeEvent.UNDER_INTERNAL_PASS).and() | |||
// 单位内部审核驳回,从单位内部审核中到单位内部审核不通过 | |||
.withExternal() | |||
.source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) | |||
.target(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS) | |||
.event(ProjectStatusChangeEvent.UNDER_INTERNAL_REJECT).and() | |||
// 单位内部审核中撤回,从单位内部审核中到待申报 | |||
.withExternal() | |||
.source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) | |||
.target(ProjectStatusEnum.TO_BE_DECLARED) | |||
.event(ProjectStatusChangeEvent.UNDER_INTERNAL_WITHDRAW).and() | |||
// 单位内部审核不通过重新提交,从单位内部审核不通过到单位内部审核中 | |||
.withExternal() | |||
.source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS) | |||
.target(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) | |||
.event(ProjectStatusChangeEvent.UNDER_INTERNAL_REJECT_RESUBMIT).and() | |||
// 待预审预审申报,从待预审到待预审选择 | |||
.withExternal() | |||
.source(ProjectStatusEnum.PENDING_PREQUALIFICATION) | |||
.target(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) | |||
.event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_DECLARE).and() | |||
// 待预审申报,从待预审选择->省级部门联审中,预审中,完成其中一种状态 | |||
.withChoice() | |||
.source(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) | |||
.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) | |||
.target(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS) | |||
.event(ProjectStatusChangeEvent.PROVINCIAL_DEPARTMENT_REVIEW_PASS).and() | |||
// 省级部门联审通过,从省级部门联审成功到预审中 | |||
.withExternal() | |||
.source(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS) | |||
.target(ProjectStatusEnum.PRE_APPLYING) | |||
.event(ProjectStatusChangeEvent.PROVINCIAL_PASS_TO_PRELIMINARY_REVIEW).and() | |||
// 省级部门联审不通过,从省级部门联审中到省级部门联审不通过 | |||
.withExternal() | |||
.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) | |||
.event(ProjectStatusChangeEvent.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_WITHDRAW).and() | |||
// 预审通过,从预审中到部门联审中 | |||
.withExternal() | |||
.source(ProjectStatusEnum.PRE_APPLYING) | |||
.target(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW) | |||
.event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_PASS).and() | |||
// 预审驳回,从预审中到预审不通过 | |||
.withExternal() | |||
.source(ProjectStatusEnum.PRE_APPLYING) | |||
.target(ProjectStatusEnum.PREQUALIFICATION_FAILED) | |||
.event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_REJECT).and() | |||
// 预审中撤回,从预审中到预审中撤回选择态 | |||
.withExternal() | |||
.source(ProjectStatusEnum.PRE_APPLYING) | |||
.target(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE) | |||
.event(ProjectStatusChangeEvent.PRE_APPLYING_WITHDRAW).and() | |||
// 预审中撤回,从预审中撤回选择态->省级部门联审成功,待预审,完成其中一种状态 | |||
.withChoice() | |||
.source(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE) | |||
.first(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS,projectDeclareGuardFactory.new PendingPreQualificationChoiceGuard() | |||
,new ProjectDeclareChoiceAction()) | |||
.last(ProjectStatusEnum.PENDING_PREQUALIFICATION,new ProjectDeclareChoiceAction()).and() | |||
// 预审不通过重新提交,从预审不通过到待预审选择 | |||
.withExternal() | |||
.source(ProjectStatusEnum.PREQUALIFICATION_FAILED) | |||
.target(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) | |||
.event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_REJECT_RESUBMIT).and() | |||
// 预审不通过重新提交,从待预审选择->省级部门联审中,预审中,完成其中一种状态 | |||
.withChoice() | |||
.source(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) | |||
.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) | |||
.target(ProjectStatusEnum.IN_THE_ANNUAL_PLAN) | |||
.event(ProjectStatusChangeEvent.DEPARTMENT_UNITED_REVIEW_PASS).and() | |||
// 部门联审驳回,从部门联审中到部门联审不通过 | |||
.withExternal() | |||
.source(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW) | |||
.target(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW_FAILED) | |||
.event(ProjectStatusChangeEvent.DEPARTMENT_UNITED_REVIEW_REJECT).and() | |||
// 部门联审中撤回,从部门联审中到预审中 | |||
.withExternal() | |||
.source(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW) | |||
.target(ProjectStatusEnum.PRE_APPLYING) | |||
.event(ProjectStatusChangeEvent.DEPARTMENT_JOINT_REVIEW_WITHDRAW).and() | |||
// 年度计划中开启方案申报,从年度计划中到方案待申报 | |||
.withExternal() | |||
.source(ProjectStatusEnum.IN_THE_ANNUAL_PLAN) | |||
.target(ProjectStatusEnum.PLAN_TO_BE_DECLARED) | |||
.event(ProjectStatusChangeEvent.ANNUAL_PLAN_PROJECT_OPEN_PLAN_DECLARE).and() | |||
// 年度计划中暂缓,从年度计划中到被暂缓 | |||
.withExternal() | |||
.source(ProjectStatusEnum.IN_THE_ANNUAL_PLAN) | |||
.target(ProjectStatusEnum.BE_SUSPENDED) | |||
.event(ProjectStatusChangeEvent.ANNUAL_PLAN_SUSPEND).and() | |||
// 方案待申报申报方案,从方案待申报到方案评审中 | |||
.withExternal() | |||
.source(ProjectStatusEnum.PLAN_TO_BE_DECLARED) | |||
.target(ProjectStatusEnum.SCHEME_UNDER_REVIEW) | |||
.event(ProjectStatusChangeEvent.DECLARE_PLAN).and() | |||
// 方案评审通过,从方案评审中到待立项批复 | |||
.withExternal() | |||
.source(ProjectStatusEnum.SCHEME_UNDER_REVIEW) | |||
.target(ProjectStatusEnum.TO_BE_APPROVED) | |||
.event(ProjectStatusChangeEvent.PLAN_REVIEW_PASS).and() | |||
// 方案评审驳回,从方案评审中到方案评审不通过 | |||
.withExternal() | |||
.source(ProjectStatusEnum.SCHEME_UNDER_REVIEW) | |||
.target(ProjectStatusEnum.SCHEME_REVIEW_FAILED) | |||
.event(ProjectStatusChangeEvent.PLAN_REVIEW_REJECT).and() | |||
// 方案评审中撤回,从方案评审中到方案待申报 | |||
.withExternal() | |||
.source(ProjectStatusEnum.SCHEME_UNDER_REVIEW) | |||
.target(ProjectStatusEnum.PLAN_TO_BE_DECLARED) | |||
.event(ProjectStatusChangeEvent.SCHEME_UNDER_REVIEW_WITHDRAW).and() | |||
// 方案评审不通过重新提交,从方案评审不通过到方案评审中 | |||
.withExternal() | |||
.source(ProjectStatusEnum.SCHEME_REVIEW_FAILED) | |||
.target(ProjectStatusEnum.SCHEME_UNDER_REVIEW) | |||
.event(ProjectStatusChangeEvent.PLAN_REVIEW_REJECT_RESUBMIT).and() | |||
// 待立项批复批复,从待立项批复到待采购 | |||
.withExternal() | |||
.source(ProjectStatusEnum.TO_BE_APPROVED) | |||
.target(ProjectStatusEnum.TO_BE_PURCHASED) | |||
.event(ProjectStatusChangeEvent.PROJECT_APPROVAL).and() | |||
// 待采购采购备案,从待采购到建设中 | |||
.withExternal() | |||
.source(ProjectStatusEnum.TO_BE_PURCHASED) | |||
.target(ProjectStatusEnum.UNDER_CONSTRUCTION) | |||
.event(ProjectStatusChangeEvent.PURCHASE_PUT_ON_RECORD).and() | |||
// 建设中初验备案,从建设中到待终验 | |||
.withExternal() | |||
.source(ProjectStatusEnum.UNDER_CONSTRUCTION) | |||
.target(ProjectStatusEnum.TO_BE_FINALLY_INSPECTED) | |||
.event(ProjectStatusChangeEvent.PRELIMINARY_ACCEPTANCE_PUT_ON_RECORD).and() | |||
// 待终验终验申请,从待终验到终验审核中 | |||
.withExternal() | |||
.source(ProjectStatusEnum.TO_BE_FINALLY_INSPECTED) | |||
.target(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) | |||
.event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_APPLICATION).and() | |||
// 终审审核通过,从终审审核中到已归档 | |||
.withExternal() | |||
.source(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) | |||
.target(ProjectStatusEnum.ARCHIVED) | |||
.event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_PASS).and() | |||
// 终审审核不通过,从终审审核中到终审审核不通过 | |||
.withExternal() | |||
.source(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) | |||
.target(ProjectStatusEnum.FINAL_ACCEPTANCE_REVIEW_FAILED) | |||
.event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_REJECT).and() | |||
// 终审审核中撤回,从终审审核中到待终验 | |||
.withExternal() | |||
.source(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) | |||
.target(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) | |||
.event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_IS_UNDER_REVIEW_WITHDRAW).and(); | |||
return builder.build(); | |||
} | |||
/** | |||
* 持久化配置 | |||
* @author CMM | |||
* @since 2023/02/07 16:22 | |||
*/ | |||
@Bean(name = "projectDeclareStateMachineSYPersister") | |||
@Override | |||
public StateMachinePersister<ProjectStatusEnum, ProjectStatusChangeEvent, Project> getProjectPersister() { | |||
StateMachinePersister sp = new DefaultStateMachinePersister<>(new StateMachinePersist<ProjectStatusEnum, ProjectStatusChangeEvent, Project>() { | |||
@Override | |||
public void write(StateMachineContext<ProjectStatusEnum, ProjectStatusChangeEvent> context, Project contextObj) { | |||
} | |||
@Override | |||
public StateMachineContext<ProjectStatusEnum, ProjectStatusChangeEvent> read(Project contextObj) { | |||
StateMachineContext<ProjectStatusEnum, ProjectStatusChangeEvent> result = new DefaultStateMachineContext(ProjectStatusEnum.getValue(contextObj.getStatus()), | |||
null, null, null, null, RegionContant.LS_YH_CODE); | |||
return result; | |||
} | |||
}); | |||
stateMachinePersister = sp; | |||
return sp; | |||
} | |||
public StateMachinePersister getStateMachinePersister(){ | |||
return stateMachinePersister; | |||
} | |||
} |
@@ -0,0 +1,274 @@ | |||
package com.ningdatech.pmapi.common.statemachine.builder; | |||
import com.ningdatech.pmapi.common.statemachine.action.ProjectDeclareChoiceAction; | |||
import com.ningdatech.pmapi.common.statemachine.contants.RegionContant; | |||
import com.ningdatech.pmapi.common.statemachine.event.ProjectStatusChangeEvent; | |||
import com.ningdatech.pmapi.common.statemachine.factory.ProjectDeclareGuardFactory; | |||
import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; | |||
import com.ningdatech.pmapi.projectlib.model.entity.Project; | |||
import lombok.RequiredArgsConstructor; | |||
import org.slf4j.Logger; | |||
import org.slf4j.LoggerFactory; | |||
import org.springframework.beans.factory.BeanFactory; | |||
import org.springframework.context.annotation.Bean; | |||
import org.springframework.statemachine.StateMachine; | |||
import org.springframework.statemachine.StateMachineContext; | |||
import org.springframework.statemachine.StateMachinePersist; | |||
import org.springframework.statemachine.config.EnableStateMachine; | |||
import org.springframework.statemachine.config.StateMachineBuilder; | |||
import org.springframework.statemachine.persist.DefaultStateMachinePersister; | |||
import org.springframework.statemachine.persist.StateMachinePersister; | |||
import org.springframework.statemachine.support.DefaultStateMachineContext; | |||
import org.springframework.stereotype.Component; | |||
import java.util.EnumSet; | |||
/** | |||
* 项目申报状态机 | |||
* 云和县 | |||
* @author CMM | |||
* @since 2023/02/07 15:56 | |||
*/ | |||
@Component | |||
@EnableStateMachine(name= ProjectDeclareStateMachineYHBuilder.MACHINEID_TO) | |||
@RequiredArgsConstructor | |||
public class ProjectDeclareStateMachineYHBuilder implements ProjectDeclareStateMachineBuilder { | |||
private static final ProjectDeclareGuardFactory projectDeclareGuardFactory = new ProjectDeclareGuardFactory(); | |||
private final BeanFactory beanFactory; | |||
private StateMachinePersister stateMachinePersister; | |||
private Logger logger = LoggerFactory.getLogger(getClass()); | |||
/** | |||
* TO状态机 | |||
*/ | |||
public final static String MACHINEID_TO = RegionContant.LS_YH_CODE; | |||
@Override | |||
public StateMachine<ProjectStatusEnum, ProjectStatusChangeEvent> build() throws Exception { | |||
StateMachine<ProjectStatusEnum, ProjectStatusChangeEvent> stateMachine = build(beanFactory); | |||
logger.info("状态机ID:" + stateMachine.getId()); | |||
stateMachine.start(); | |||
return stateMachine; | |||
} | |||
/** | |||
* 构建状态机 | |||
* @param beanFactory | |||
* @author CMM | |||
* @since 2023/02/07 16:15 | |||
*/ | |||
@Override | |||
public StateMachine<ProjectStatusEnum, ProjectStatusChangeEvent> build(BeanFactory beanFactory) throws Exception { | |||
StateMachineBuilder.Builder<ProjectStatusEnum, ProjectStatusChangeEvent> builder = StateMachineBuilder.builder(); | |||
builder.configureConfiguration() | |||
.withConfiguration() | |||
.machineId(MACHINEID_TO) | |||
.beanFactory(beanFactory); | |||
builder.configureStates() | |||
.withStates() | |||
.initial(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) | |||
.choice(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) | |||
.choice(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE) | |||
.states(EnumSet.allOf(ProjectStatusEnum.class)); | |||
builder.configureTransitions() | |||
// 单位内部审核通过,从单位内部审核中到待预审 | |||
.withExternal() | |||
.source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) | |||
.target(ProjectStatusEnum.PENDING_PREQUALIFICATION) | |||
.event(ProjectStatusChangeEvent.UNDER_INTERNAL_PASS).and() | |||
// 单位内部审核驳回,从单位内部审核中到单位内部审核不通过 | |||
.withExternal() | |||
.source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) | |||
.target(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS) | |||
.event(ProjectStatusChangeEvent.UNDER_INTERNAL_REJECT).and() | |||
// 单位内部审核中撤回,从单位内部审核中到待申报 | |||
.withExternal() | |||
.source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) | |||
.target(ProjectStatusEnum.TO_BE_DECLARED) | |||
.event(ProjectStatusChangeEvent.UNDER_INTERNAL_WITHDRAW).and() | |||
// 单位内部审核不通过重新提交,从单位内部审核不通过到单位内部审核中 | |||
.withExternal() | |||
.source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS) | |||
.target(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) | |||
.event(ProjectStatusChangeEvent.UNDER_INTERNAL_REJECT_RESUBMIT).and() | |||
// 待预审预审申报,从待预审到待预审选择 | |||
.withExternal() | |||
.source(ProjectStatusEnum.PENDING_PREQUALIFICATION) | |||
.target(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) | |||
.event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_DECLARE).and() | |||
// 待预审申报,从待预审选择->省级部门联审中,预审中,完成其中一种状态 | |||
.withChoice() | |||
.source(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) | |||
.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) | |||
.target(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS) | |||
.event(ProjectStatusChangeEvent.PROVINCIAL_DEPARTMENT_REVIEW_PASS).and() | |||
// 省级部门联审通过,从省级部门联审成功到预审中 | |||
.withExternal() | |||
.source(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS) | |||
.target(ProjectStatusEnum.PRE_APPLYING) | |||
.event(ProjectStatusChangeEvent.PROVINCIAL_PASS_TO_PRELIMINARY_REVIEW).and() | |||
// 省级部门联审不通过,从省级部门联审中到省级部门联审不通过 | |||
.withExternal() | |||
.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) | |||
.event(ProjectStatusChangeEvent.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_WITHDRAW).and() | |||
// 预审通过,从预审中到部门联审中 | |||
.withExternal() | |||
.source(ProjectStatusEnum.PRE_APPLYING) | |||
.target(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW) | |||
.event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_PASS).and() | |||
// 预审驳回,从预审中到预审不通过 | |||
.withExternal() | |||
.source(ProjectStatusEnum.PRE_APPLYING) | |||
.target(ProjectStatusEnum.PREQUALIFICATION_FAILED) | |||
.event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_REJECT).and() | |||
// 预审中撤回,从预审中到预审中撤回选择态 | |||
.withExternal() | |||
.source(ProjectStatusEnum.PRE_APPLYING) | |||
.target(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE) | |||
.event(ProjectStatusChangeEvent.PRE_APPLYING_WITHDRAW).and() | |||
// 预审中撤回,从预审中撤回选择态->省级部门联审成功,待预审,完成其中一种状态 | |||
.withChoice() | |||
.source(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE) | |||
.first(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS,projectDeclareGuardFactory.new PendingPreQualificationChoiceGuard() | |||
,new ProjectDeclareChoiceAction()) | |||
.last(ProjectStatusEnum.PENDING_PREQUALIFICATION,new ProjectDeclareChoiceAction()).and() | |||
// 预审不通过重新提交,从预审不通过到待预审选择 | |||
.withExternal() | |||
.source(ProjectStatusEnum.PREQUALIFICATION_FAILED) | |||
.target(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) | |||
.event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_REJECT_RESUBMIT).and() | |||
// 预审不通过重新提交,从待预审选择->省级部门联审中,预审中,完成其中一种状态 | |||
.withChoice() | |||
.source(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) | |||
.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) | |||
.target(ProjectStatusEnum.IN_THE_ANNUAL_PLAN) | |||
.event(ProjectStatusChangeEvent.DEPARTMENT_UNITED_REVIEW_PASS).and() | |||
// 部门联审驳回,从部门联审中到部门联审不通过 | |||
.withExternal() | |||
.source(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW) | |||
.target(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW_FAILED) | |||
.event(ProjectStatusChangeEvent.DEPARTMENT_UNITED_REVIEW_REJECT).and() | |||
// 部门联审中撤回,从部门联审中到预审中 | |||
.withExternal() | |||
.source(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW) | |||
.target(ProjectStatusEnum.PRE_APPLYING) | |||
.event(ProjectStatusChangeEvent.DEPARTMENT_JOINT_REVIEW_WITHDRAW).and() | |||
// 年度计划中开启方案申报,从年度计划中到方案待申报 | |||
.withExternal() | |||
.source(ProjectStatusEnum.IN_THE_ANNUAL_PLAN) | |||
.target(ProjectStatusEnum.PLAN_TO_BE_DECLARED) | |||
.event(ProjectStatusChangeEvent.ANNUAL_PLAN_PROJECT_OPEN_PLAN_DECLARE).and() | |||
// 年度计划中暂缓,从年度计划中到被暂缓 | |||
.withExternal() | |||
.source(ProjectStatusEnum.IN_THE_ANNUAL_PLAN) | |||
.target(ProjectStatusEnum.BE_SUSPENDED) | |||
.event(ProjectStatusChangeEvent.ANNUAL_PLAN_SUSPEND).and() | |||
// 方案待申报申报方案,从方案待申报到方案评审中 | |||
.withExternal() | |||
.source(ProjectStatusEnum.PLAN_TO_BE_DECLARED) | |||
.target(ProjectStatusEnum.SCHEME_UNDER_REVIEW) | |||
.event(ProjectStatusChangeEvent.DECLARE_PLAN).and() | |||
// 方案评审通过,从方案评审中到待立项批复 | |||
.withExternal() | |||
.source(ProjectStatusEnum.SCHEME_UNDER_REVIEW) | |||
.target(ProjectStatusEnum.TO_BE_APPROVED) | |||
.event(ProjectStatusChangeEvent.PLAN_REVIEW_PASS).and() | |||
// 方案评审驳回,从方案评审中到方案评审不通过 | |||
.withExternal() | |||
.source(ProjectStatusEnum.SCHEME_UNDER_REVIEW) | |||
.target(ProjectStatusEnum.SCHEME_REVIEW_FAILED) | |||
.event(ProjectStatusChangeEvent.PLAN_REVIEW_REJECT).and() | |||
// 方案评审中撤回,从方案评审中到方案待申报 | |||
.withExternal() | |||
.source(ProjectStatusEnum.SCHEME_UNDER_REVIEW) | |||
.target(ProjectStatusEnum.PLAN_TO_BE_DECLARED) | |||
.event(ProjectStatusChangeEvent.SCHEME_UNDER_REVIEW_WITHDRAW).and() | |||
// 方案评审不通过重新提交,从方案评审不通过到方案评审中 | |||
.withExternal() | |||
.source(ProjectStatusEnum.SCHEME_REVIEW_FAILED) | |||
.target(ProjectStatusEnum.SCHEME_UNDER_REVIEW) | |||
.event(ProjectStatusChangeEvent.PLAN_REVIEW_REJECT_RESUBMIT).and() | |||
// 待立项批复批复,从待立项批复到待采购 | |||
.withExternal() | |||
.source(ProjectStatusEnum.TO_BE_APPROVED) | |||
.target(ProjectStatusEnum.TO_BE_PURCHASED) | |||
.event(ProjectStatusChangeEvent.PROJECT_APPROVAL).and() | |||
// 待采购采购备案,从待采购到建设中 | |||
.withExternal() | |||
.source(ProjectStatusEnum.TO_BE_PURCHASED) | |||
.target(ProjectStatusEnum.UNDER_CONSTRUCTION) | |||
.event(ProjectStatusChangeEvent.PURCHASE_PUT_ON_RECORD).and() | |||
// 建设中初验备案,从建设中到待终验 | |||
.withExternal() | |||
.source(ProjectStatusEnum.UNDER_CONSTRUCTION) | |||
.target(ProjectStatusEnum.TO_BE_FINALLY_INSPECTED) | |||
.event(ProjectStatusChangeEvent.PRELIMINARY_ACCEPTANCE_PUT_ON_RECORD).and() | |||
// 待终验终验申请,从待终验到终验审核中 | |||
.withExternal() | |||
.source(ProjectStatusEnum.TO_BE_FINALLY_INSPECTED) | |||
.target(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) | |||
.event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_APPLICATION).and() | |||
// 终审审核通过,从终审审核中到已归档 | |||
.withExternal() | |||
.source(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) | |||
.target(ProjectStatusEnum.ARCHIVED) | |||
.event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_PASS).and() | |||
// 终审审核不通过,从终审审核中到终审审核不通过 | |||
.withExternal() | |||
.source(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) | |||
.target(ProjectStatusEnum.FINAL_ACCEPTANCE_REVIEW_FAILED) | |||
.event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_REJECT).and() | |||
// 终审审核中撤回,从终审审核中到待终验 | |||
.withExternal() | |||
.source(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) | |||
.target(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) | |||
.event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_IS_UNDER_REVIEW_WITHDRAW).and(); | |||
return builder.build(); | |||
} | |||
/** | |||
* 持久化配置 | |||
* @author CMM | |||
* @since 2023/02/07 16:22 | |||
*/ | |||
@Bean(name = "projectDeclareStateMachineYHPersister") | |||
@Override | |||
public StateMachinePersister<ProjectStatusEnum, ProjectStatusChangeEvent, Project> getProjectPersister() { | |||
StateMachinePersister sp = new DefaultStateMachinePersister<>(new StateMachinePersist<ProjectStatusEnum, ProjectStatusChangeEvent, Project>() { | |||
@Override | |||
public void write(StateMachineContext<ProjectStatusEnum, ProjectStatusChangeEvent> context, Project contextObj) { | |||
} | |||
@Override | |||
public StateMachineContext<ProjectStatusEnum, ProjectStatusChangeEvent> read(Project contextObj) { | |||
StateMachineContext<ProjectStatusEnum, ProjectStatusChangeEvent> result = new DefaultStateMachineContext(ProjectStatusEnum.getValue(contextObj.getStatus()), | |||
null, null, null, null, RegionContant.LS_YH_CODE); | |||
return result; | |||
} | |||
}); | |||
stateMachinePersister = sp; | |||
return sp; | |||
} | |||
public StateMachinePersister getStateMachinePersister(){ | |||
return stateMachinePersister; | |||
} | |||
} |
@@ -0,0 +1,32 @@ | |||
package com.ningdatech.pmapi.common.statemachine.contants; | |||
/** | |||
* @Classname RegionContant | |||
* @Description | |||
* @Date 2023/6/13 13:57 | |||
* @Author PoffyZhang | |||
*/ | |||
public class RegionContant { | |||
//市本级 | |||
public static final String LS_SBJ_CODE = "331100"; | |||
//莲都区 | |||
public static final String LS_LD_CODE = "331102"; | |||
//青田县 | |||
public static final String LS_QT_CODE = "331121"; | |||
//缙云县 | |||
public static final String LS_JY_CODE = "331122"; | |||
//遂昌县 | |||
public static final String LS_SC_CODE = "331123"; | |||
//松阳县 | |||
public static final String LS_SY_CODE = "331124"; | |||
//云和县 | |||
public static final String LS_YH_CODE = "331125"; | |||
//庆元县 | |||
public static final String LS_QY_CODE = "331126"; | |||
//景宁畲族自治县 | |||
public static final String LS_JN_CODE = "331127"; | |||
//龙泉市 | |||
public static final String LS_LQ_CODE = "331181"; | |||
//开发区 | |||
public static final String LS_KFQ_CODE = "331199"; | |||
} |
@@ -0,0 +1,70 @@ | |||
package com.ningdatech.pmapi.common.statemachine.util; | |||
import com.google.common.collect.Maps; | |||
import com.ningdatech.pmapi.common.statemachine.builder.*; | |||
import com.ningdatech.pmapi.common.statemachine.contants.RegionContant; | |||
import lombok.extern.slf4j.Slf4j; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.stereotype.Component; | |||
import java.util.Map; | |||
/** | |||
* 项目申报状态机 | |||
* | |||
* @author CMM | |||
* @since 2023/02/07 15:56 | |||
*/ | |||
@Component | |||
@Slf4j | |||
public class MachineBuilderFounder { | |||
public final static Map<String,ProjectDeclareStateMachineBuilder> machineBuilderMap = | |||
Maps.newConcurrentMap(); | |||
@Autowired | |||
private ProjectDeclareStateMachineSBJBuilder projectDeclareStateMachineSBJBuilder; | |||
@Autowired | |||
private ProjectDeclareStateMachineLDBuilder projectDeclareStateMachineLDBuilder; | |||
@Autowired | |||
private ProjectDeclareStateMachineQTBuilder projectDeclareStateMachineQTBuilder; | |||
@Autowired | |||
private ProjectDeclareStateMachineJYBuilder projectDeclareStateMachineJYBuilder; | |||
@Autowired | |||
private ProjectDeclareStateMachineSCBuilder projectDeclareStateMachineSCBuilder; | |||
@Autowired | |||
private ProjectDeclareStateMachineSYBuilder projectDeclareStateMachineSYBuilder; | |||
@Autowired | |||
private ProjectDeclareStateMachineYHBuilder projectDeclareStateMachineYHBuilder; | |||
@Autowired | |||
private ProjectDeclareStateMachineQYBuilder projectDeclareStateMachineQYBuilder; | |||
@Autowired | |||
private ProjectDeclareStateMachineJNBuilder projectDeclareStateMachineJNBuilder; | |||
@Autowired | |||
private ProjectDeclareStateMachineLQBuilder projectDeclareStateMachineLQBuilder; | |||
@Autowired | |||
private ProjectDeclareStateMachineKFQBuilder projectDeclareStateMachineKFQBuilder; | |||
public MachineBuilderFounder(){ | |||
machineBuilderMap.put(RegionContant.LS_SBJ_CODE, projectDeclareStateMachineSBJBuilder); | |||
machineBuilderMap.put(RegionContant.LS_LD_CODE, projectDeclareStateMachineLDBuilder); | |||
machineBuilderMap.put(RegionContant.LS_QT_CODE, projectDeclareStateMachineQTBuilder); | |||
machineBuilderMap.put(RegionContant.LS_JY_CODE, projectDeclareStateMachineJYBuilder); | |||
machineBuilderMap.put(RegionContant.LS_SC_CODE, projectDeclareStateMachineSCBuilder); | |||
machineBuilderMap.put(RegionContant.LS_SY_CODE, projectDeclareStateMachineSYBuilder); | |||
machineBuilderMap.put(RegionContant.LS_YH_CODE, projectDeclareStateMachineYHBuilder); | |||
machineBuilderMap.put(RegionContant.LS_QY_CODE, projectDeclareStateMachineQYBuilder); | |||
machineBuilderMap.put(RegionContant.LS_JN_CODE, projectDeclareStateMachineJNBuilder); | |||
machineBuilderMap.put(RegionContant.LS_LQ_CODE, projectDeclareStateMachineLQBuilder); | |||
machineBuilderMap.put(RegionContant.LS_KFQ_CODE, projectDeclareStateMachineKFQBuilder); | |||
} | |||
} |
@@ -1,10 +1,12 @@ | |||
package com.ningdatech.pmapi.common.statemachine.util; | |||
import com.ningdatech.basic.exception.BizException; | |||
import com.ningdatech.basic.function.VUtils; | |||
import com.ningdatech.pmapi.common.constant.ProjectDeclareConst; | |||
import com.ningdatech.pmapi.common.constant.RegionConst; | |||
import com.ningdatech.pmapi.common.constant.StateMachineConst; | |||
import com.ningdatech.pmapi.common.statemachine.builder.ProjectDeclareStateMachineBuilder; | |||
import com.ningdatech.pmapi.common.statemachine.contants.RegionContant; | |||
import com.ningdatech.pmapi.common.statemachine.event.ProjectStatusChangeEvent; | |||
import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; | |||
import com.ningdatech.pmapi.projectlib.model.entity.ProjectStatusChange; | |||
@@ -37,13 +39,8 @@ public class StateMachineUtils { | |||
private static final String PROJECT_DECLARE = StateMachineConst.PROJECT_DECLARE; | |||
private final ProjectDeclareStateMachineBuilder projectDeclareStateMachineBuilder; | |||
private final INdProjectStatusChangeService projectStatusChangeService; | |||
@Resource(name = "projectDeclareStateMachinePersister") | |||
private StateMachinePersister projectDeclareStateMachinePersister; | |||
//通过审核 | |||
public void pass(Project project) { | |||
try{ | |||
@@ -79,10 +76,15 @@ public class StateMachineUtils { | |||
// 将状态变更记录保存到项目状态变更表中 | |||
ProjectStatusChange projectStatusChange = new ProjectStatusChange(); | |||
projectStatusChange.setBeforeStatus(project.getStatus()); | |||
ProjectDeclareStateMachineBuilder builder = MachineBuilderFounder.machineBuilderMap.get(project.getAreaCode()); | |||
VUtils.isTrue(Objects.isNull(builder)).throwMessage("状态机初始化失败!"); | |||
//获取TO状态机 | |||
StateMachine<ProjectStatusEnum, ProjectStatusChangeEvent> stateMachine = projectDeclareStateMachineBuilder.build(); | |||
StateMachine<ProjectStatusEnum, ProjectStatusChangeEvent> stateMachine = builder.build(); | |||
Message message = MessageBuilder.withPayload(event).setHeader(PROJECT_DECLARE, project).build(); | |||
//初始化状态机 | |||
StateMachinePersister projectDeclareStateMachinePersister = builder.getProjectPersister(); | |||
projectDeclareStateMachinePersister.restore(stateMachine, project); | |||
stateMachine.sendEvent(message); | |||
projectStatusChange.setProjectId(project.getId()); | |||
@@ -39,7 +39,7 @@ public class DingInfoPullController { | |||
organizationBatchGetTask.batchGetOrganizationTask(); | |||
} | |||
@GetMapping("/employee/{regionCode}") | |||
@GetMapping("/employeeByRegionCode/{regionCode}") | |||
public void employeeBatchGetByRegionCode(@PathVariable String regionCode) { | |||
employeeBatchGetTask.batchGetEmployeeTaskByRegionCode(regionCode); | |||
} | |||