Browse Source

修改项目状态变更状态机

tags/24080901
WendyYang 6 months ago
parent
commit
63e82b4774
4 changed files with 71 additions and 13 deletions
  1. +14
    -2
      hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/ProjectStateChangeAction.java
  2. +11
    -1
      hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/impl/ProjectStateMachineBuilderImpl.java
  3. +43
    -8
      hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/event/ProjectStateChangeEvent.java
  4. +3
    -2
      hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/enumeration/status/ProjectStatus.java

+ 14
- 2
hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/ProjectStateChangeAction.java View File

@@ -18,6 +18,7 @@ import org.springframework.statemachine.annotation.WithStateMachine;
* @since 2023/02/08 13:48
*/
@Slf4j
@SuppressWarnings("all")
@WithStateMachine(id = ProjectStateMachineBuilderImpl.MACHINE_ID)
public class ProjectStateChangeAction {

@@ -38,7 +39,7 @@ public class ProjectStateChangeAction {
}

@OnTransition(source = "ON_COMPLIANCE_REVIEW", target = "COMPLIANCE_REVIEW_FAILED")
public void UNDER_INTERNAL_WITHDRAW(Message<ProjectStateChangeEvent> message) {
public void COMPLIANCE_REVIEW_FAILED(Message<ProjectStateChangeEvent> message) {
Project project = getProject(message);
project.setStatus(ProjectStatus.COMPLIANCE_REVIEW_FAILED.getCode());
}
@@ -49,12 +50,23 @@ public class ProjectStateChangeAction {
project.setStatus(ProjectStatus.ON_COMPLIANCE_REVIEW.getCode());
}

@OnTransition(source = "ON_COMPLIANCE_REVIEW", target = "ON_PROJECT_REVIEW")
@OnTransition(source = "ON_COMPLIANCE_REVIEW", target = "WITHOUT_PROJECT_REVIEW")
public void COMPLIANCE_REVIEW_PASS(Message<ProjectStateChangeEvent> message) {
Project project = getProject(message);
project.setStatus(ProjectStatus.WITHOUT_PROJECT_REVIEW.getCode());
}

@OnTransition(source = "WITHOUT_PROJECT_REVIEW", target = "ON_PROJECT_REVIEW")
public void PROJECT_REVIEW_SUBMIT(Message<ProjectStateChangeEvent> message) {
Project project = getProject(message);
project.setStatus(ProjectStatus.ON_PROJECT_REVIEW.getCode());
}

@OnTransition(source = "PROJECT_REVIEW_FAILED", target = "ON_PROJECT_REVIEW")
public void PROJECT_REVIEW_RESUBMIT(Message<ProjectStateChangeEvent> message) {
Project project = getProject(message);
project.setStatus(ProjectStatus.ON_PROJECT_REVIEW.getCode());
}

@OnTransition(source = "ON_PROJECT_REVIEW", target = "PROJECT_REVIEW_FAILED")
public void PROJECT_REVIEW_FAILED(Message<ProjectStateChangeEvent> message) {


+ 11
- 1
hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/impl/ProjectStateMachineBuilderImpl.java View File

@@ -91,8 +91,18 @@ public class ProjectStateMachineBuilderImpl implements BaseStateMachineBuilder<P
// 合规性审查通过
.withExternal()
.source(ProjectStatus.ON_COMPLIANCE_REVIEW)
.target(ProjectStatus.ON_PROJECT_REVIEW)
.target(ProjectStatus.WITHOUT_PROJECT_REVIEW)
.event(ProjectStateChangeEvent.COMPLIANCE_REVIEW_PASS).and()
// 提交项目评审
.withExternal()
.source(ProjectStatus.WITHOUT_PROJECT_REVIEW)
.target(ProjectStatus.ON_PROJECT_REVIEW)
.event(ProjectStateChangeEvent.PROJECT_REVIEW_SUBMIT).and()
// 重新提交项目评审
.withExternal()
.source(ProjectStatus.PROJECT_REVIEW_FAILED)
.target(ProjectStatus.ON_PROJECT_REVIEW)
.event(ProjectStateChangeEvent.PROJECT_REVIEW_RESUBMIT).and()
// 项目评审不通过
.withExternal()
.source(ProjectStatus.ON_PROJECT_REVIEW)


+ 43
- 8
hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/event/ProjectStateChangeEvent.java View File

@@ -1,8 +1,10 @@
package com.hz.pm.api.common.statemachine.event;

import com.hz.pm.api.common.statemachine.action.ProjectStateChangeAction;
import com.hz.pm.api.projectlib.model.enumeration.status.ProjectStatus;
import lombok.AllArgsConstructor;
import lombok.Getter;
import org.springframework.messaging.Message;

/**
* <p>
@@ -17,44 +19,73 @@ import lombok.Getter;
public enum ProjectStateChangeEvent implements AbstractStateChangeEvent {

/**
* 项目申报提交(项目状态进入:单位内部审核中)
* @see ProjectStateChangeAction#PROJECT_APPLICATION_SUBMIT(Message)
*/
PROJECT_APPLICATION_SUBMIT(ProjectStatus.TO_BE_DECLARED.getCode(), null, null),

/**
* @see ProjectStateChangeAction#COMPLIANCE_REVIEW_FAILED(Message)
*/
COMPLIANCE_REVIEW_FAILED(null, ProjectStatus.ON_COMPLIANCE_REVIEW.getCode(), null),

/**
* @see ProjectStateChangeAction#COMPLIANCE_REVIEW_RESUBMIT(Message)
*/
COMPLIANCE_REVIEW_RESUBMIT(ProjectStatus.COMPLIANCE_REVIEW_FAILED.getCode(), null, null),

/**
* @see ProjectStateChangeAction#COMPLIANCE_REVIEW_PASS(Message)
*/
COMPLIANCE_REVIEW_PASS(ProjectStatus.ON_COMPLIANCE_REVIEW.getCode(), null, null),

/**
* @see ProjectStateChangeAction#PROJECT_REVIEW_SUBMIT(Message)
*/
PROJECT_REVIEW_SUBMIT(ProjectStatus.WITHOUT_PROJECT_REVIEW.getCode(), null, null),

/**
* @see ProjectStateChangeAction#PROJECT_REVIEW_RESUBMIT(Message)
*/
PROJECT_REVIEW_RESUBMIT(ProjectStatus.PROJECT_REVIEW_FAILED.getCode(), null, null),

/**
* @see ProjectStateChangeAction#PROJECT_REVIEW_FAILED(Message)
*/
PROJECT_REVIEW_FAILED(null, ProjectStatus.ON_PROJECT_REVIEW.getCode(), null),

/**
* @see ProjectStateChangeAction#PROJECT_REVIEW_PASS(Message)
*/
PROJECT_REVIEW_PASS(ProjectStatus.ON_PROJECT_REVIEW.getCode(), null, null),

ANNUAL_PLAN_PASS(ProjectStatus.ON_ANNUAL_PLAN.getCode(), null, null),

/**
* 年度计划项目开启方案申报(项目状态变为:方案待申报)
* @see ProjectStateChangeAction#ANNUAL_PLAN_PASS(Message)
*/
ANNUAL_PLAN_PROJECT_OPEN_PLAN_DECLARE(ProjectStatus.ON_ANNUAL_PLAN.getCode(), null, null),
ANNUAL_PLAN_PASS(ProjectStatus.ON_ANNUAL_PLAN.getCode(), null, null),

/**
* 立项备案提交
*
* @see ProjectStateChangeAction#DECLARED_RECORD_SUBMIT(Message)
*/
DECLARED_RECORD_SUBMIT(ProjectStatus.DECLARED_APPROVED_TO_BE_RECORD.getCode(), null, null),

/**
* 立项备案重新提交
*
* @see ProjectStateChangeAction#DECLARED_RECORD_RESUBMIT(Message)
*/
DECLARED_RECORD_RESUBMIT(ProjectStatus.DECLARED_APPROVED_RECORD_FAILED.getCode(), null, null),

/**
* 立项备案通过
* @see ProjectStateChangeAction#DECLARED_RECORD_PASS(Message)
*/
DECLARED_RECORD_PASS(ProjectStatus.DECLARED_APPROVED_RECORD_AUDITING.getCode(), null, null),

/**
* 立项备案不通过
* @see ProjectStateChangeAction#DECLARED_RECORD_FAILED(Message)
*/
DECLARED_RECORD_FAILED(null, ProjectStatus.DECLARED_APPROVED_RECORD_AUDITING.getCode(), null),

@@ -62,38 +93,42 @@ public enum ProjectStateChangeEvent implements AbstractStateChangeEvent {

/**
* 发布采购公告
* @see ProjectStateChangeAction#SUBMIT_PURCHASE_NOTICE(Message)
*/
SUBMIT_PURCHASE_NOTICE(ProjectStatus.TO_BE_PURCHASED.getCode(), null, null),

/**
* 填写实施计划
* @see ProjectStateChangeAction#SUBMIT_OPERATION_PLAN(Message)
*/
SUBMIT_OPERATION_PLAN(ProjectStatus.ON_PURCHASING.getCode(), null, null),

/**
* 上传初验材料
* @see ProjectStateChangeAction#SUBMIT_FIRST_INSPECTED_FILES(Message)
*/
SUBMIT_FIRST_INSPECTED_FILES(ProjectStatus.TO_BE_FIRST_INSPECTED.getCode(), null, null),
/**
* 终验申请(项目状态变为:终验审核中)
* @see ProjectStateChangeAction#FINAL_ACCEPTANCE_APPLICATION(Message)
*/
FINAL_ACCEPTANCE_APPLICATION(ProjectStatus.ON_PILOT_RUNNING.getCode(), null, null),
/**
* 终验审核不通过(项目状态变为:终验审核不通过)
* @see ProjectStateChangeAction#FINAL_ACCEPTANCE_REJECT(Message)
*/
FINAL_ACCEPTANCE_REJECT(null, ProjectStatus.ON_FINALLY_INSPECTED.getCode(), null),
/**
* 终验审核通过(项目状态变为:已归档)
* @see ProjectStateChangeAction#FINAL_ACCEPTANCE_PASS(Message)
*/
FINAL_ACCEPTANCE_PASS(ProjectStatus.ON_FINALLY_INSPECTED.getCode(), null, null),

/**
* 终验审核中时被撤回(项目状态进入:待终验)
*/
FINAL_ACCEPTANCE_IS_UNDER_REVIEW_WITHDRAW(null, null, ProjectStatus.ON_FINALLY_INSPECTED.getCode()),

/**
* 重新提交 终验
* @see ProjectStateChangeAction#FINAL_RE_ACCEPTANCE_APPLICATION(Message)
*/
FINAL_RE_ACCEPTANCE_APPLICATION(ProjectStatus.FINALLY_INSPECTED_FAILED.getCode(), null, null);



+ 3
- 2
hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/enumeration/status/ProjectStatus.java View File

@@ -36,8 +36,9 @@ public enum ProjectStatus implements IStatus<Integer, String> {
/**
* 项目评审
*/
ON_PROJECT_REVIEW(10040, "项目评审中", null),
PROJECT_REVIEW_FAILED(10041, "项目评审不通过", null),
WITHOUT_PROJECT_REVIEW(10040, "待项目评审", null),
ON_PROJECT_REVIEW(10041, "项目评审中", null),
PROJECT_REVIEW_FAILED(10042, "项目评审不通过", null),

ON_ANNUAL_PLAN(10010, "年度计划中", null),



Loading…
Cancel
Save