Преглед изворни кода

优化状态机

tags/24080901
WendyYang пре 7 месеци
родитељ
комит
59e824a6e2
57 измењених фајлова са 643 додато и 1033 уклоњено
  1. +1
    -2
      hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/AdaptStateChangeAction.java
  2. +8
    -8
      hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/ProjectDeclareActionChoice.java
  3. +53
    -53
      hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/ProjectStateChangeAction.java
  4. +2
    -3
      hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/SelfTestStateChangeAction.java
  5. +15
    -15
      hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/TenderStateChangeAction.java
  6. +1
    -1
      hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/TestValidStateChangeAction.java
  7. +0
    -38
      hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/AdaptStateMachineBuilder.java
  8. +37
    -0
      hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/BaseStateMachineBuilder.java
  9. +0
    -34
      hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/ProjectDeclareStateMachineBuilder.java
  10. +0
    -38
      hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/SelfTestStateMachineBuilder.java
  11. +0
    -36
      hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/TenderStateMachineBuilder.java
  12. +0
    -38
      hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/TestValidStateMachineBuilder.java
  13. +4
    -4
      hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/impl/AdaptStateMachineBuilderImpl.java
  14. +61
    -54
      hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/impl/ProjectStateMachineBuilderImpl.java
  15. +4
    -4
      hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/impl/SelfTestStateMachineBuilderImpl.java
  16. +25
    -25
      hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/impl/TenderStateMachineBuilderImpl.java
  17. +4
    -4
      hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/impl/TestValidStateMachineBuilderImpl.java
  18. +58
    -0
      hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/event/AbstractStateChangeEvent.java
  19. +1
    -39
      hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/event/AdaptStateChangeEvent.java
  20. +10
    -48
      hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/event/ProjectStateChangeEvent.java
  21. +1
    -39
      hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/event/SelfTestStateChangeEvent.java
  22. +1
    -39
      hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/event/TenderStateChangeEvent.java
  23. +1
    -39
      hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/event/TestValidStateChangeEvent.java
  24. +3
    -3
      hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/factory/ProjectDeclareGuardFactory.java
  25. +68
    -0
      hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/util/AbstractStateMachineUtil.java
  26. +8
    -61
      hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/util/AdaptStateMachineUtil.java
  27. +77
    -0
      hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/util/ProjectStateMachineUtil.java
  28. +8
    -60
      hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/util/SelfTestStateMachineUtil.java
  29. +0
    -140
      hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/util/StateMachineUtil.java
  30. +15
    -66
      hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/util/TenderStateMachineUtil.java
  31. +8
    -60
      hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/util/TestValidStateMachineUtil.java
  32. +3
    -3
      hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/ConstructionManage.java
  33. +6
    -8
      hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/ConstructionPlanManage.java
  34. +3
    -7
      hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/FinalAcceptanceManage.java
  35. +3
    -3
      hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/OperationManage.java
  36. +3
    -3
      hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/PrequalificationDeclaredProjectManage.java
  37. +3
    -3
      hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/PurchaseManage.java
  38. +2
    -2
      hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/req/TestValidListReq.java
  39. +42
    -0
      hz-pm-api/src/main/java/com/hz/pm/api/projectlib/entity/PurchaseStatusChange.java
  40. +4
    -4
      hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/AnnualPlanHandle.java
  41. +2
    -2
      hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/ArchivedHandle.java
  42. +0
    -6
      hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/ProcessExecuteChainHandle.java
  43. +7
    -7
      hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/ProjectApprovalHandle.java
  44. +2
    -2
      hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/ProjectPreliminaryInspectionHandle.java
  45. +2
    -2
      hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/TenderPurchaseHandle.java
  46. +2
    -2
      hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/AnnualPlanLibManage.java
  47. +4
    -4
      hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/DeclaredRecordManage.java
  48. +5
    -5
      hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/ProjectLibManage.java
  49. +16
    -0
      hz-pm-api/src/main/java/com/hz/pm/api/projectlib/mapper/PurchaseStatusChangeMapper.java
  50. +5
    -0
      hz-pm-api/src/main/java/com/hz/pm/api/projectlib/mapper/PurchaseStatusChangeMapper.xml
  51. +5
    -5
      hz-pm-api/src/main/java/com/hz/pm/api/projectlib/service/IProjectStatusChangeService.java
  52. +16
    -0
      hz-pm-api/src/main/java/com/hz/pm/api/projectlib/service/IPurchaseStatusChangeService.java
  53. +20
    -0
      hz-pm-api/src/main/java/com/hz/pm/api/projectlib/service/impl/PurchaseStatusChangeServiceImpl.java
  54. +3
    -3
      hz-pm-api/src/main/java/com/hz/pm/api/scheduler/listener/ProcessStartListener.java
  55. +3
    -3
      hz-pm-api/src/main/java/com/hz/pm/api/scheduler/task/CheckProvincialReviewResultTask.java
  56. +5
    -5
      hz-pm-api/src/main/java/com/hz/pm/api/todocenter/manage/HandlerManage.java
  57. +3
    -3
      hz-pm-api/src/test/java/com/hz/pm/api/sys/project/ProjectStateTest.java

hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/AdaptAction.java → hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/AdaptStateChangeAction.java Прегледај датотеку

@@ -2,7 +2,6 @@ package com.hz.pm.api.common.statemachine.action;

import cn.hutool.core.lang.Assert;
import com.hz.pm.api.common.statemachine.builder.impl.AdaptStateMachineBuilderImpl;
import com.hz.pm.api.common.statemachine.builder.impl.TestValidStateMachineBuilderImpl;
import com.hz.pm.api.common.statemachine.event.AdaptStateChangeEvent;
import com.hz.pm.api.common.statemachine.util.TenderStateMachineUtil;
import com.hz.pm.api.projectdeclared.model.entity.Purchase;
@@ -22,7 +21,7 @@ import org.springframework.statemachine.annotation.WithStateMachine;
*/
@Slf4j
@WithStateMachine(id = AdaptStateMachineBuilderImpl.MACHINE_ID)
public class AdaptAction {
public class AdaptStateChangeAction {

private Purchase getPurchaseInfo(Message<AdaptStateChangeEvent> message) {
Purchase purchase = (Purchase) message.getHeaders().get(TenderStateMachineUtil.PURCHASE);

+ 8
- 8
hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/ProjectDeclareActionChoice.java Прегледај датотеку

@@ -5,7 +5,7 @@ import cn.hutool.json.JSONUtil;
import com.baomidou.mybatisplus.core.toolkit.Assert;
import com.hz.pm.api.common.model.constant.StateMachineConst;
import com.hz.pm.api.common.enumeration.CommonEnum;
import com.hz.pm.api.common.statemachine.event.ProjectStatusChangeEvent;
import com.hz.pm.api.common.statemachine.event.ProjectStateChangeEvent;
import com.hz.pm.api.projectlib.model.enumeration.ProjectStatusEnum;
import com.hz.pm.api.projectlib.model.entity.Project;
import com.hz.pm.api.projectlib.model.entity.ProjectApplication;
@@ -24,12 +24,12 @@ import static com.hz.pm.api.common.model.constant.StateMachineConst.APPLICATION_
* @since 2023/02/07 22:31
*/
@Slf4j
public class ProjectDeclareActionChoice implements Action<ProjectStatusEnum, ProjectStatusChangeEvent> {
public class ProjectDeclareActionChoice implements Action<ProjectStatusEnum, ProjectStateChangeEvent> {

private static final String PROJECT_DECLARE = StateMachineConst.PROJECT_DECLARE;

@Override
public void execute(StateContext<ProjectStatusEnum, ProjectStatusChangeEvent> stateContext) {
public void execute(StateContext<ProjectStatusEnum, ProjectStateChangeEvent> stateContext) {
log.info(String.valueOf(stateContext.getTarget().getId()));
ProjectStatusEnum projectStatusEnum = stateContext.getTarget().getId();
switch (projectStatusEnum) {
@@ -47,7 +47,7 @@ public class ProjectDeclareActionChoice implements Action<ProjectStatusEnum, Pro
}
}

private void approvedAfterChoice(StateContext<ProjectStatusEnum, ProjectStatusChangeEvent> stateContext) {
private void approvedAfterChoice(StateContext<ProjectStatusEnum, ProjectStateChangeEvent> stateContext) {
Project project = getProject(stateContext);
List<ProjectApplication> projectApplications = getProjectApplication(stateContext);
log.info("立项批复之后,项目的状态为:{}", project.getStatus());
@@ -72,26 +72,26 @@ public class ProjectDeclareActionChoice implements Action<ProjectStatusEnum, Pro
}
}

private void preDeclareChoice(StateContext<ProjectStatusEnum, ProjectStatusChangeEvent> stateContext) {
private void preDeclareChoice(StateContext<ProjectStatusEnum, ProjectStateChangeEvent> stateContext) {
Project project = getProject(stateContext);
log.info("预审申报事件之前,项目的状态为:{}", project.getStatus());
project.setStatus(ProjectStatusEnum.PRE_APPLYING.getCode());
}

private void preWithDrawChoice(StateContext<ProjectStatusEnum, ProjectStatusChangeEvent> stateContext) {
private void preWithDrawChoice(StateContext<ProjectStatusEnum, ProjectStateChangeEvent> stateContext) {
Project project = getProject(stateContext);
log.info("预审中撤回事件之前,项目的状态为:{}", project.getStatus());
project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode());
}

private Project getProject(StateContext<ProjectStatusEnum, ProjectStatusChangeEvent> stateContext) {
private Project getProject(StateContext<ProjectStatusEnum, ProjectStateChangeEvent> stateContext) {
Project project = stateContext.getMessage().getHeaders().get(PROJECT_DECLARE, Project.class);
Assert.notNull(project, "项目信息获取失败%s", JSONUtil.toJsonStr(stateContext.getMessage()));
return project;
}

@SuppressWarnings("unchecked")
private List<ProjectApplication> getProjectApplication(StateContext<ProjectStatusEnum, ProjectStatusChangeEvent> stateContext) {
private List<ProjectApplication> getProjectApplication(StateContext<ProjectStatusEnum, ProjectStateChangeEvent> stateContext) {
return stateContext.getMessage().getHeaders().get(APPLICATION_DECLARE, List.class);
}



hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/ProjectDeclareAction.java → hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/ProjectStateChangeAction.java Прегледај датотеку

@@ -2,8 +2,8 @@ package com.hz.pm.api.common.statemachine.action;

import cn.hutool.core.lang.Assert;
import com.hz.pm.api.common.model.constant.StateMachineConst;
import com.hz.pm.api.common.statemachine.builder.impl.ProjectDeclareStateMachineBuilderImpl;
import com.hz.pm.api.common.statemachine.event.ProjectStatusChangeEvent;
import com.hz.pm.api.common.statemachine.builder.impl.ProjectStateMachineBuilderImpl;
import com.hz.pm.api.common.statemachine.event.ProjectStateChangeEvent;
import com.hz.pm.api.projectlib.model.entity.Project;
import com.hz.pm.api.projectlib.model.enumeration.ProjectStatusEnum;
import lombok.extern.slf4j.Slf4j;
@@ -18,180 +18,180 @@ import org.springframework.statemachine.annotation.WithStateMachine;
* @since 2023/02/08 13:48
*/
@Slf4j
@WithStateMachine(id = ProjectDeclareStateMachineBuilderImpl.MACHINE_ID)
public class ProjectDeclareAction {
@WithStateMachine(id = ProjectStateMachineBuilderImpl.MACHINE_ID)
public class ProjectStateChangeAction {

private static final String PROJECT_DECLARE = StateMachineConst.PROJECT_DECLARE;

private Project getProject(Message<ProjectStatusChangeEvent> message) {
private Project getProject(Message<ProjectStateChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
Assert.notNull(project, "未获取到需要状态变更的项目信息");
return project;
}

@OnTransition(source = "UNDER_INTERNAL_AUDIT", target = "PENDING_PREQUALIFICATION")
public void UNDER_INTERNAL_PASS(Message<ProjectStatusChangeEvent> message) {
public void UNDER_INTERNAL_PASS(Message<ProjectStateChangeEvent> message) {
Project project = getProject(message);
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) {
public void UNDER_INTERNAL_REJECT(Message<ProjectStateChangeEvent> message) {
Project project = getProject(message);
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) {
public void UNDER_INTERNAL_WITHDRAW(Message<ProjectStateChangeEvent> message) {
Project project = getProject(message);
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) {
public void UNDER_INTERNAL_REJECT_RESUBMIT(Message<ProjectStateChangeEvent> message) {
Project project = getProject(message);
project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT.getCode());
}


@OnTransition(source = "PENDING_PREQUALIFICATION", target = "PENDING_PREQUALIFICATION_CHOICE")
public void PRELIMINARY_REVIEW_DECLARE(Message<ProjectStatusChangeEvent> message) {
public void PRELIMINARY_REVIEW_DECLARE(Message<ProjectStateChangeEvent> message) {
Project project = getProject(message);
project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE.getCode());
}

@OnTransition(source = "PENDING_PREQUALIFICATION", target = "UNDER_INTERNAL_AUDIT")
public void PENDING_PREQUALIFICATION_WITHDRAW(Message<ProjectStatusChangeEvent> message) {
public void PENDING_PREQUALIFICATION_WITHDRAW(Message<ProjectStateChangeEvent> message) {
Project project = getProject(message);
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) {
public void PROVINCIAL_DEPARTMENT_REVIEW_PASS(Message<ProjectStateChangeEvent> message) {
Project project = getProject(message);
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) {
public void PROVINCIAL_PASS_TO_PRELIMINARY_REVIEW(Message<ProjectStateChangeEvent> message) {
Project project = getProject(message);
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) {
public void PROVINCIAL_DEPARTMENT_REVIEW_REJECT(Message<ProjectStateChangeEvent> message) {
Project project = getProject(message);
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) {
public void JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_WITHDRAW(Message<ProjectStateChangeEvent> message) {
Project project = getProject(message);
project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode());
}

@OnTransition(source = "PRE_APPLYING", target = "DEPARTMENT_JOINT_REVIEW")
public void PRELIMINARY_REVIEW_PASS(Message<ProjectStatusChangeEvent> message) {
public void PRELIMINARY_REVIEW_PASS(Message<ProjectStateChangeEvent> message) {
Project project = getProject(message);
project.setStatus(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW.getCode());
}

@OnTransition(source = "PRE_APPLYING", target = "PREQUALIFICATION_FAILED")
public void PRELIMINARY_REVIEW_REJECT(Message<ProjectStatusChangeEvent> message) {
public void PRELIMINARY_REVIEW_REJECT(Message<ProjectStateChangeEvent> message) {
Project project = getProject(message);
project.setStatus(ProjectStatusEnum.PREQUALIFICATION_FAILED.getCode());
}

@OnTransition(source = "PREQUALIFICATION_FAILED", target = "PENDING_PREQUALIFICATION_CHOICE")
public void PRELIMINARY_REVIEW_REJECT_RESUBMIT(Message<ProjectStatusChangeEvent> message) {
public void PRELIMINARY_REVIEW_REJECT_RESUBMIT(Message<ProjectStateChangeEvent> message) {
Project project = getProject(message);
project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE.getCode());
}

@OnTransition(source = "PRE_APPLYING", target = "PREQUALIFICATION_WITHDRAW_CHOICE")
public void PRE_APPLYING_WITHDRAW(Message<ProjectStatusChangeEvent> message) {
public void PRE_APPLYING_WITHDRAW(Message<ProjectStateChangeEvent> message) {
Project project = getProject(message);
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) {
public void DEPARTMENT_UNITED_REVIEW_PASS(Message<ProjectStateChangeEvent> message) {
Project project = getProject(message);
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) {
public void DEPARTMENT_UNITED_REVIEW_REJECT(Message<ProjectStateChangeEvent> message) {
Project project = getProject(message);
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) {
public void DEPARTMENT_JOINT_REVIEW_WITHDRAW(Message<ProjectStateChangeEvent> message) {
Project project = getProject(message);
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) {
public void ANNUAL_PLAN_PROJECT_OPEN_PLAN_DECLARE(Message<ProjectStateChangeEvent> message) {
Project project = getProject(message);
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) {
public void ANNUAL_PLAN_SUSPEND(Message<ProjectStateChangeEvent> message) {
Project project = getProject(message);
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) {
public void IN_THE_ANNUAL_PLAN_WITHDRAW(Message<ProjectStateChangeEvent> message) {
Project project = getProject(message);
project.setStatus(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW.getCode());
}


@OnTransition(source = "PLAN_TO_BE_DECLARED", target = "SCHEME_UNDER_REVIEW")
public void DECLARE_PLAN(Message<ProjectStatusChangeEvent> message) {
public void DECLARE_PLAN(Message<ProjectStateChangeEvent> message) {
Project project = getProject(message);
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) {
public void PLAN_TO_DECLARE_WITHDRAW(Message<ProjectStateChangeEvent> message) {
Project project = getProject(message);
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) {
public void DECLARE_PLAN_RESUBMIT(Message<ProjectStateChangeEvent> message) {
Project project = getProject(message);
project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode());
}

@OnTransition(source = "SCHEME_UNDER_REVIEW", target = "TO_BE_APPROVED")
public void PLAN_REVIEW_PASS(Message<ProjectStatusChangeEvent> message) {
public void PLAN_REVIEW_PASS(Message<ProjectStateChangeEvent> message) {
Project project = getProject(message);
project.setStatus(ProjectStatusEnum.TO_BE_APPROVED.getCode());
}

@OnTransition(source = "SCHEME_UNDER_REVIEW", target = "SCHEME_REVIEW_FAILED")
public void PLAN_REVIEW_REJECT(Message<ProjectStatusChangeEvent> message) {
public void PLAN_REVIEW_REJECT(Message<ProjectStateChangeEvent> message) {
Project project = getProject(message);
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) {
public void PLAN_REVIEW_REJECT_RESUBMIT(Message<ProjectStateChangeEvent> message) {
Project project = getProject(message);
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) {
public void SCHEME_UNDER_REVIEW_WITHDRAW(Message<ProjectStateChangeEvent> message) {
Project project = getProject(message);
project.setStatus(ProjectStatusEnum.PLAN_TO_BE_DECLARED.getCode());
}
@@ -199,20 +199,20 @@ public class ProjectDeclareAction {
//==================================================================================================================

@OnTransition(source = "DECLARED_APPROVED_TO_BE_RECORD", target = "DECLARED_APPROVED_RECORD_AUDITING")
public void DECLARED_RECORD_SUBMIT(Message<ProjectStatusChangeEvent> message) {
public void DECLARED_RECORD_SUBMIT(Message<ProjectStateChangeEvent> message) {
Project project = getProject(message);
// 待立项批复批复后,项目一级状态变更为已立项
project.setStatus(ProjectStatusEnum.DECLARED_APPROVED_RECORD_AUDITING.getCode());
}

@OnTransition(source = "DECLARED_APPROVED_RECORD_FAILED", target = "DECLARED_APPROVED_RECORD_AUDITING")
public void DECLARED_RECORD_RESUBMIT(Message<ProjectStatusChangeEvent> message) {
public void DECLARED_RECORD_RESUBMIT(Message<ProjectStateChangeEvent> message) {
Project project = getProject(message);
project.setStatus(ProjectStatusEnum.DECLARED_APPROVED_RECORD_AUDITING.getCode());
}

@OnTransition(source = "DECLARED_APPROVED_RECORD_AUDITING", target = "TO_BE_PURCHASED")
public void DECLARED_RECORD_PASS(Message<ProjectStatusChangeEvent> message) {
public void DECLARED_RECORD_PASS(Message<ProjectStateChangeEvent> message) {
Project project = getProject(message);
// 待立项批复批复后,项目一级状态变更为已立项
project.setStage(ProjectStatusEnum.PROJECT_APPROVED.getCode());
@@ -220,7 +220,7 @@ public class ProjectDeclareAction {
}

@OnTransition(source = "DECLARED_APPROVED_RECORD_AUDITING", target = "DECLARED_APPROVED_RECORD_FAILED")
public void DECLARED_RECORD_FAILED(Message<ProjectStatusChangeEvent> message) {
public void DECLARED_RECORD_FAILED(Message<ProjectStateChangeEvent> message) {
Project project = getProject(message);
project.setStatus(ProjectStatusEnum.DECLARED_APPROVED_RECORD_FAILED.getCode());
}
@@ -228,7 +228,7 @@ public class ProjectDeclareAction {
//==================================================================================================================

@OnTransition(source = "TO_BE_APPROVED", target = "TO_BE_PURCHASED")
public void PROJECT_APPROVAL(Message<ProjectStatusChangeEvent> message) {
public void PROJECT_APPROVAL(Message<ProjectStateChangeEvent> message) {
Project project = getProject(message);
// 待立项批复批复后,项目一级状态变更为已立项
project.setStage(ProjectStatusEnum.PROJECT_APPROVED.getCode());
@@ -236,25 +236,25 @@ public class ProjectDeclareAction {
}

@OnTransition(source = "TO_BE_APPROVED", target = "SCHEME_UNDER_REVIEW")
public void TO_BE_APPROVED_WITHDRAW(Message<ProjectStatusChangeEvent> message) {
public void TO_BE_APPROVED_WITHDRAW(Message<ProjectStateChangeEvent> message) {
Project project = getProject(message);
project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode());
}

@OnTransition(source = "TO_BE_PURCHASED", target = "OPERATION")
public void PURCHASE_PUT_ON_RECORD(Message<ProjectStatusChangeEvent> message) {
public void PURCHASE_PUT_ON_RECORD(Message<ProjectStateChangeEvent> message) {
Project project = getProject(message);
project.setStatus(ProjectStatusEnum.OPERATION.getCode());
}

@OnTransition(source = "OPERATION", target = "UNDER_CONSTRUCTION")
public void START_TO_WORK(Message<ProjectStatusChangeEvent> message) {
public void START_TO_WORK(Message<ProjectStateChangeEvent> message) {
Project project = getProject(message);
project.setStatus(ProjectStatusEnum.UNDER_CONSTRUCTION.getCode());
}

@OnTransition(source = "TO_BE_PURCHASED", target = "TO_BE_APPROVED")
public void TO_BE_PURCHASED_WITHDRAW(Message<ProjectStatusChangeEvent> message) {
public void TO_BE_PURCHASED_WITHDRAW(Message<ProjectStateChangeEvent> message) {
Project project = getProject(message);
// 待采购状态撤回后,项目一级状态回退到未立项
project.setStage(ProjectStatusEnum.NOT_APPROVED.getCode());
@@ -263,56 +263,56 @@ public class ProjectDeclareAction {


@OnTransition(source = "UNDER_CONSTRUCTION", target = "TO_BE_FINALLY_INSPECTED")
public void PRELIMINARY_ACCEPTANCE_PUT_ON_RECORD(Message<ProjectStatusChangeEvent> message) {
public void PRELIMINARY_ACCEPTANCE_PUT_ON_RECORD(Message<ProjectStateChangeEvent> message) {
Project project = getProject(message);
project.setStatus(ProjectStatusEnum.TO_BE_FINALLY_INSPECTED.getCode());
}

@OnTransition(source = "UNDER_CONSTRUCTION", target = "TO_BE_PURCHASED")
public void UNDER_CONSTRUCTION_WITHDRAW(Message<ProjectStatusChangeEvent> message) {
public void UNDER_CONSTRUCTION_WITHDRAW(Message<ProjectStateChangeEvent> message) {
Project project = getProject(message);
project.setStatus(ProjectStatusEnum.TO_BE_PURCHASED.getCode());
}

@OnTransition(source = "TO_BE_PURCHASED", target = "ON_PURCHASING")
public void SUBMIT_PURCHASE_NOTICE(Message<ProjectStatusChangeEvent> message) {
public void SUBMIT_PURCHASE_NOTICE(Message<ProjectStateChangeEvent> message) {
Project project = getProject(message);
project.setStatus(ProjectStatusEnum.ON_PURCHASING.getCode());
}

@OnTransition(source = "ON_PURCHASING", target = "TO_BE_FIRST_INSPECTED")
public void SUBMIT_OPERATION_PLAN(Message<ProjectStatusChangeEvent> message) {
public void SUBMIT_OPERATION_PLAN(Message<ProjectStateChangeEvent> message) {
Project project = getProject(message);
project.setStatus(ProjectStatusEnum.TO_BE_FIRST_INSPECTED.getCode());
}

@OnTransition(source = "TO_BE_FIRST_INSPECTED", target = "ON_FIRST_INSPECTED")
public void SUBMIT_FIRST_INSPECTED_FILES(Message<ProjectStatusChangeEvent> message) {
public void SUBMIT_FIRST_INSPECTED_FILES(Message<ProjectStateChangeEvent> message) {
Project project = getProject(message);
project.setStatus(ProjectStatusEnum.ON_FIRST_INSPECTED.getCode());
}

@OnTransition(source = "ON_FIRST_INSPECTED", target = "TO_BE_FINALLY_INSPECTED")
public void FIRST_INSPECTED_PASSED(Message<ProjectStatusChangeEvent> message) {
public void FIRST_INSPECTED_PASSED(Message<ProjectStateChangeEvent> message) {
Project project = getProject(message);
project.setStatus(ProjectStatusEnum.TO_BE_FINALLY_INSPECTED.getCode());
}

@OnTransition(source = "TO_BE_FINALLY_INSPECTED", target = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW")
public void FINAL_ACCEPTANCE_APPLICATION(Message<ProjectStatusChangeEvent> message) {
public void FINAL_ACCEPTANCE_APPLICATION(Message<ProjectStateChangeEvent> message) {
Project project = getProject(message);
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) {
public void TO_BE_FINALLY_INSPECTED_WITHDRAW(Message<ProjectStateChangeEvent> message) {
Project project = getProject(message);
project.setStatus(ProjectStatusEnum.UNDER_CONSTRUCTION.getCode());
}


@OnTransition(source = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW", target = "ARCHIVED")
public void FINAL_ACCEPTANCE_PASS(Message<ProjectStatusChangeEvent> message) {
public void FINAL_ACCEPTANCE_PASS(Message<ProjectStateChangeEvent> message) {
Project project = getProject(message);
// 终验审核通过后,项目一级状态变更为已归档
project.setStage(ProjectStatusEnum.ARCHIVED.getCode());
@@ -320,19 +320,19 @@ public class ProjectDeclareAction {
}

@OnTransition(source = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW", target = "FINAL_ACCEPTANCE_REVIEW_FAILED")
public void FINAL_ACCEPTANCE_REJECT(Message<ProjectStatusChangeEvent> message) {
public void FINAL_ACCEPTANCE_REJECT(Message<ProjectStateChangeEvent> message) {
Project project = getProject(message);
project.setStatus(ProjectStatusEnum.FINAL_ACCEPTANCE_REVIEW_FAILED.getCode());
}

@OnTransition(source = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW", target = "TO_BE_FINALLY_INSPECTED")
public void FINAL_ACCEPTANCE_IS_UNDER_REVIEW_WITHDRAW(Message<ProjectStatusChangeEvent> message) {
public void FINAL_ACCEPTANCE_IS_UNDER_REVIEW_WITHDRAW(Message<ProjectStateChangeEvent> message) {
Project project = getProject(message);
project.setStatus(ProjectStatusEnum.TO_BE_FINALLY_INSPECTED.getCode());
}

@OnTransition(source = "FINAL_ACCEPTANCE_REVIEW_FAILED", target = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW")
public void FINAL_RE_ACCEPTANCE_APPLICATION(Message<ProjectStatusChangeEvent> message) {
public void FINAL_RE_ACCEPTANCE_APPLICATION(Message<ProjectStateChangeEvent> message) {
Project project = getProject(message);
project.setStatus(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW.getCode());
}

hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/SelfTestAction.java → hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/SelfTestStateChangeAction.java Прегледај датотеку

@@ -2,7 +2,6 @@ package com.hz.pm.api.common.statemachine.action;

import cn.hutool.core.lang.Assert;
import com.hz.pm.api.common.statemachine.builder.impl.SelfTestStateMachineBuilderImpl;
import com.hz.pm.api.common.statemachine.builder.impl.TestValidStateMachineBuilderImpl;
import com.hz.pm.api.common.statemachine.event.SelfTestStateChangeEvent;
import com.hz.pm.api.common.statemachine.util.TenderStateMachineUtil;
import com.hz.pm.api.projectdeclared.model.entity.Purchase;
@@ -22,7 +21,7 @@ import org.springframework.statemachine.annotation.WithStateMachine;
*/
@Slf4j
@WithStateMachine(id = SelfTestStateMachineBuilderImpl.MACHINE_ID)
public class SelfTestAction {
public class SelfTestStateChangeAction {

private Purchase getPurchaseInfo(Message<SelfTestStateChangeEvent> message) {
Purchase purchase = (Purchase) message.getHeaders().get(TenderStateMachineUtil.PURCHASE);
@@ -48,7 +47,7 @@ public class SelfTestAction {
purchase.setSelfTestStatus(TenderSelfTestStatusEnum.SELF_TEST_INFO_FAILED.getCode());
}

@OnTransition(source = "SELF_TEST_INFO_FAILED", target = "TEST_VALID_INFO_AUDIT")
@OnTransition(source = "SELF_TEST_INFO_FAILED", target = "SELF_TEST_INFO_AUDIT")
public void RESUBMIT_SELF_TEST_INFO(Message<SelfTestStateChangeEvent> message) {
Purchase purchase = getPurchaseInfo(message);
purchase.setSelfTestStatus(TenderSelfTestStatusEnum.SELF_TEST_INFO_AUDIT.getCode());

hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/TenderAction.java → hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/TenderStateChangeAction.java Прегледај датотеку

@@ -2,7 +2,7 @@ package com.hz.pm.api.common.statemachine.action;

import cn.hutool.core.lang.Assert;
import com.hz.pm.api.common.statemachine.builder.impl.TenderStateMachineBuilderImpl;
import com.hz.pm.api.common.statemachine.event.ProjectStatusChangeEvent;
import com.hz.pm.api.common.statemachine.event.ProjectStateChangeEvent;
import com.hz.pm.api.common.statemachine.util.TenderStateMachineUtil;
import com.hz.pm.api.projectdeclared.model.entity.Purchase;
import com.hz.pm.api.projectlib.model.enumeration.TenderStatusEnum;
@@ -21,9 +21,9 @@ import org.springframework.statemachine.annotation.WithStateMachine;
*/
@Slf4j
@WithStateMachine(id = TenderStateMachineBuilderImpl.MACHINE_ID)
public class TenderAction {
public class TenderStateChangeAction {

private Purchase getPurchaseInfo(Message<ProjectStatusChangeEvent> message) {
private Purchase getPurchaseInfo(Message<ProjectStateChangeEvent> message) {
Purchase purchase = (Purchase) message.getHeaders().get(TenderStateMachineUtil.PURCHASE);
Assert.notNull(purchase, "未获取到需要状态变更的标段信息");
return purchase;
@@ -35,7 +35,7 @@ public class TenderAction {
* @param message \
*/
@OnTransition(source = "TO_BE_SUBMIT_PURCHASE_INFO", target = "TO_BE_SUBMIT_CONSTRUCTION_INFO")
public void SUBMIT_PURCHASE_INFO(Message<ProjectStatusChangeEvent> message) {
public void SUBMIT_PURCHASE_INFO(Message<ProjectStateChangeEvent> message) {
Purchase purchase = getPurchaseInfo(message);
purchase.setStatus(TenderStatusEnum.TO_BE_SUBMIT_CONSTRUCTION_INFO.getTenderStatus());
}
@@ -46,7 +46,7 @@ public class TenderAction {
* @param message \
*/
@OnTransition(source = "TO_BE_SUBMIT_CONSTRUCTION_INFO", target = "TO_BE_SUBMIT_OPERATION_PLAN")
public void SUBMIT_CONSTRUCTION_INFO(Message<ProjectStatusChangeEvent> message) {
public void SUBMIT_CONSTRUCTION_INFO(Message<ProjectStateChangeEvent> message) {
Purchase purchase = getPurchaseInfo(message);
purchase.setStatus(TenderStatusEnum.TO_BE_SUBMIT_OPERATION_PLAN.getTenderStatus());
}
@@ -57,7 +57,7 @@ public class TenderAction {
* @param message \
*/
@OnTransition(source = "TO_BE_SUBMIT_OPERATION_PLAN", target = "TO_BE_SUBMIT_FIRST_INSPECTED_INFO")
public void SUBMIT_OPERATION_PLAN(Message<ProjectStatusChangeEvent> message) {
public void SUBMIT_OPERATION_PLAN(Message<ProjectStateChangeEvent> message) {
Purchase purchase = getPurchaseInfo(message);
purchase.setStatus(TenderStatusEnum.TO_BE_SUBMIT_FIRST_INSPECTED_INFO.getTenderStatus());
}
@@ -68,7 +68,7 @@ public class TenderAction {
* @param message \
*/
@OnTransition(source = "TO_BE_SUBMIT_FIRST_INSPECTED_INFO", target = "TO_BE_SUBMIT_XCFHX_APPLY")
public void SUBMIT_FIRST_INSPECTED_FILES(Message<ProjectStatusChangeEvent> message) {
public void SUBMIT_FIRST_INSPECTED_FILES(Message<ProjectStateChangeEvent> message) {
Purchase purchase = getPurchaseInfo(message);
purchase.setStatus(TenderStatusEnum.TO_BE_SUBMIT_XCFHX_APPLY.getTenderStatus());
}
@@ -79,7 +79,7 @@ public class TenderAction {
* @param message \
*/
@OnTransition(source = "TO_BE_SUBMIT_XCFHX_APPLY", target = "ON_XCFHX_APPLY")
public void SUBMIT_XCFHX_APPLY(Message<ProjectStatusChangeEvent> message) {
public void SUBMIT_XCFHX_APPLY(Message<ProjectStateChangeEvent> message) {
Purchase purchase = getPurchaseInfo(message);
purchase.setStatus(TenderStatusEnum.ON_XCFHX_APPLY.getTenderStatus());
}
@@ -90,7 +90,7 @@ public class TenderAction {
* @param message \
*/
@OnTransition(source = "ON_XCFHX_APPLY", target = "TO_BE_SUBMIT_FINALLY_INSPECTED_APPLY")
public void XCFHX_APPLY_PASSED(Message<ProjectStatusChangeEvent> message) {
public void XCFHX_APPLY_PASSED(Message<ProjectStateChangeEvent> message) {
Purchase purchase = getPurchaseInfo(message);
purchase.setStatus(TenderStatusEnum.TO_BE_SUBMIT_FINALLY_INSPECTED_APPLY.getTenderStatus());
}
@@ -101,7 +101,7 @@ public class TenderAction {
* @param message \
*/
@OnTransition(source = "ON_XCFHX_APPLY", target = "XCFHX_APPLY_FAILED")
public void XCFHX_APPLY_FAILED(Message<ProjectStatusChangeEvent> message) {
public void XCFHX_APPLY_FAILED(Message<ProjectStateChangeEvent> message) {
Purchase purchase = getPurchaseInfo(message);
purchase.setStatus(TenderStatusEnum.XCFHX_APPLY_FAILED.getTenderStatus());
}
@@ -112,7 +112,7 @@ public class TenderAction {
* @param message \
*/
@OnTransition(source = "XCFHX_APPLY_FAILED", target = "ON_XCFHX_APPLY")
public void RESUBMIT_XCFHX_APPLY(Message<ProjectStatusChangeEvent> message) {
public void RESUBMIT_XCFHX_APPLY(Message<ProjectStateChangeEvent> message) {
Purchase purchase = getPurchaseInfo(message);
purchase.setStatus(TenderStatusEnum.ON_XCFHX_APPLY.getTenderStatus());
}
@@ -123,7 +123,7 @@ public class TenderAction {
* @param message \
*/
@OnTransition(source = "TO_BE_SUBMIT_FINALLY_INSPECTED_APPLY", target = "ON_FINALLY_INSPECTED_APPLY")
public void SUBMIT_FINALLY_INSPECTED(Message<ProjectStatusChangeEvent> message) {
public void SUBMIT_FINALLY_INSPECTED(Message<ProjectStateChangeEvent> message) {
Purchase purchase = getPurchaseInfo(message);
purchase.setStatus(TenderStatusEnum.ON_FINALLY_INSPECTED_APPLY.getTenderStatus());
}
@@ -134,7 +134,7 @@ public class TenderAction {
* @param message \
*/
@OnTransition(source = "FINALLY_INSPECTED_FAILED", target = "ON_FINALLY_INSPECTED_APPLY")
public void RESUBMIT_FINALLY_INSPECTED(Message<ProjectStatusChangeEvent> message) {
public void RESUBMIT_FINALLY_INSPECTED(Message<ProjectStateChangeEvent> message) {
Purchase purchase = getPurchaseInfo(message);
purchase.setStatus(TenderStatusEnum.ON_FINALLY_INSPECTED_APPLY.getTenderStatus());
}
@@ -145,7 +145,7 @@ public class TenderAction {
* @param message \
*/
@OnTransition(source = "ON_FINALLY_INSPECTED_APPLY", target = "FINALLY_INSPECTED_PASSED")
public void FINALLY_INSPECTED_PASSED(Message<ProjectStatusChangeEvent> message) {
public void FINALLY_INSPECTED_PASSED(Message<ProjectStateChangeEvent> message) {
Purchase purchase = getPurchaseInfo(message);
purchase.setStatus(TenderStatusEnum.FINALLY_INSPECTED_PASSED.getTenderStatus());
}
@@ -156,7 +156,7 @@ public class TenderAction {
* @param message \
*/
@OnTransition(source = "ON_FINALLY_INSPECTED_APPLY", target = "FINALLY_INSPECTED_FAILED")
public void FINALLY_INSPECTED_FAILED(Message<ProjectStatusChangeEvent> message) {
public void FINALLY_INSPECTED_FAILED(Message<ProjectStateChangeEvent> message) {
Purchase purchase = getPurchaseInfo(message);
purchase.setStatus(TenderStatusEnum.FINALLY_INSPECTED_FAILED.getTenderStatus());
}

hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/TestValidAction.java → hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/TestValidStateChangeAction.java Прегледај датотеку

@@ -21,7 +21,7 @@ import org.springframework.statemachine.annotation.WithStateMachine;
*/
@Slf4j
@WithStateMachine(id = TestValidStateMachineBuilderImpl.MACHINE_ID)
public class TestValidAction {
public class TestValidStateChangeAction {

private Purchase getPurchaseInfo(Message<TestValidStateChangeEvent> message) {
Purchase purchase = (Purchase) message.getHeaders().get(TenderStateMachineUtil.PURCHASE);

+ 0
- 38
hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/AdaptStateMachineBuilder.java Прегледај датотеку

@@ -1,38 +0,0 @@
package com.hz.pm.api.common.statemachine.builder;

import com.hz.pm.api.common.statemachine.event.AdaptStateChangeEvent;
import com.hz.pm.api.projectdeclared.model.entity.Purchase;
import com.hz.pm.api.projectlib.model.enumeration.TenderAdaptStatusEnum;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.statemachine.StateMachine;
import org.springframework.statemachine.StateMachineException;
import org.springframework.statemachine.persist.StateMachinePersister;

/**
* 项目申报状态机
*
* @author CMM
* @since 2023/02/07 15:56
*/
public interface AdaptStateMachineBuilder {


StateMachine<TenderAdaptStatusEnum, AdaptStateChangeEvent> build() throws StateMachineException;

/**
* 构建状态机
*
* @param beanFactory \
*/
StateMachine<TenderAdaptStatusEnum, AdaptStateChangeEvent> build(BeanFactory beanFactory) throws StateMachineException;

/**
* 持久化配置
*
* @author CMM
* @since 2023/02/07 16:22
*/
StateMachinePersister<TenderAdaptStatusEnum, AdaptStateChangeEvent, Purchase> stateMachinePersister();


}

+ 37
- 0
hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/BaseStateMachineBuilder.java Прегледај датотеку

@@ -0,0 +1,37 @@
package com.hz.pm.api.common.statemachine.builder;

import org.springframework.beans.factory.BeanFactory;
import org.springframework.statemachine.StateMachine;
import org.springframework.statemachine.StateMachineException;
import org.springframework.statemachine.persist.StateMachinePersister;

/**
* <p>
* 状态机构建基础类
* </p>
*
* @author WendyYang
* @since 20:52 2024/4/2
*/
public interface BaseStateMachineBuilder<T, E, S> {

StateMachine<S, E> build() throws StateMachineException;

/**
* 构建状态机
*
* @param beanFactory \
* @author CMM
* @since 2023/02/07 16:15
*/
StateMachine<S, E> build(BeanFactory beanFactory) throws StateMachineException;

/**
* 持久化配置
*
* @author CMM
* @since 2023/02/07 16:22
*/
StateMachinePersister<S, E, T> stateMachinePersister();

}

+ 0
- 34
hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/ProjectDeclareStateMachineBuilder.java Прегледај датотеку

@@ -1,34 +0,0 @@
package com.hz.pm.api.common.statemachine.builder;

import com.hz.pm.api.common.statemachine.event.ProjectStatusChangeEvent;
import com.hz.pm.api.projectlib.model.enumeration.ProjectStatusEnum;
import com.hz.pm.api.projectlib.model.entity.Project;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.statemachine.StateMachine;
import org.springframework.statemachine.persist.StateMachinePersister;

/**
* 项目申报状态机
*
* @author CMM
* @since 2023/02/07 15:56
*/
public interface ProjectDeclareStateMachineBuilder {

StateMachine<ProjectStatusEnum, ProjectStatusChangeEvent> build() throws Exception;
/**
* 构建状态机
* @param beanFactory \
* @author CMM
* @since 2023/02/07 16:15
*/
StateMachine<ProjectStatusEnum, ProjectStatusChangeEvent> build(BeanFactory beanFactory) throws Exception;

/**
* 持久化配置
* @author CMM
* @since 2023/02/07 16:22
*/
StateMachinePersister<ProjectStatusEnum, ProjectStatusChangeEvent, Project> getProjectPersister();

}

+ 0
- 38
hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/SelfTestStateMachineBuilder.java Прегледај датотеку

@@ -1,38 +0,0 @@
package com.hz.pm.api.common.statemachine.builder;

import com.hz.pm.api.common.statemachine.event.SelfTestStateChangeEvent;
import com.hz.pm.api.projectdeclared.model.entity.Purchase;
import com.hz.pm.api.projectlib.model.enumeration.TenderSelfTestStatusEnum;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.statemachine.StateMachine;
import org.springframework.statemachine.StateMachineException;
import org.springframework.statemachine.persist.StateMachinePersister;

/**
* 项目申报状态机
*
* @author CMM
* @since 2023/02/07 15:56
*/
public interface SelfTestStateMachineBuilder {


StateMachine<TenderSelfTestStatusEnum, SelfTestStateChangeEvent> build() throws StateMachineException;

/**
* 构建状态机
*
* @param beanFactory \
*/
StateMachine<TenderSelfTestStatusEnum, SelfTestStateChangeEvent> build(BeanFactory beanFactory) throws StateMachineException;

/**
* 持久化配置
*
* @author CMM
* @since 2023/02/07 16:22
*/
StateMachinePersister<TenderSelfTestStatusEnum, SelfTestStateChangeEvent, Purchase> stateMachinePersister();


}

+ 0
- 36
hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/TenderStateMachineBuilder.java Прегледај датотеку

@@ -1,36 +0,0 @@
package com.hz.pm.api.common.statemachine.builder;

import com.hz.pm.api.common.statemachine.event.TenderStatusChangeEvent;
import com.hz.pm.api.projectdeclared.model.entity.Purchase;
import com.hz.pm.api.projectlib.model.enumeration.TenderStatusEnum;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.statemachine.StateMachine;
import org.springframework.statemachine.StateMachineException;
import org.springframework.statemachine.persist.StateMachinePersister;

/**
* 项目申报状态机
*
* @author CMM
* @since 2023/02/07 15:56
*/
public interface TenderStateMachineBuilder {

StateMachine<TenderStatusEnum, TenderStatusChangeEvent> build() throws StateMachineException;

/**
* 构建状态机
*
* @param beanFactory \
*/
StateMachine<TenderStatusEnum, TenderStatusChangeEvent> build(BeanFactory beanFactory) throws StateMachineException;

/**
* 持久化配置
*
* @author CMM
* @since 2023/02/07 16:22
*/
StateMachinePersister<TenderStatusEnum, TenderStatusChangeEvent, Purchase> stateMachinePersister();

}

+ 0
- 38
hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/TestValidStateMachineBuilder.java Прегледај датотеку

@@ -1,38 +0,0 @@
package com.hz.pm.api.common.statemachine.builder;

import com.hz.pm.api.common.statemachine.event.TestValidStateChangeEvent;
import com.hz.pm.api.projectdeclared.model.entity.Purchase;
import com.hz.pm.api.projectlib.model.enumeration.TenderTestValidStatusEnum;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.statemachine.StateMachine;
import org.springframework.statemachine.StateMachineException;
import org.springframework.statemachine.persist.StateMachinePersister;

/**
* 项目申报状态机
*
* @author CMM
* @since 2023/02/07 15:56
*/
public interface TestValidStateMachineBuilder {


StateMachine<TenderTestValidStatusEnum, TestValidStateChangeEvent> build() throws StateMachineException;

/**
* 构建状态机
*
* @param beanFactory \
*/
StateMachine<TenderTestValidStatusEnum, TestValidStateChangeEvent> build(BeanFactory beanFactory) throws StateMachineException;

/**
* 持久化配置
*
* @author CMM
* @since 2023/02/07 16:22
*/
StateMachinePersister<TenderTestValidStatusEnum, TestValidStateChangeEvent, Purchase> stateMachinePersister();


}

+ 4
- 4
hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/impl/AdaptStateMachineBuilderImpl.java Прегледај датотеку

@@ -1,6 +1,6 @@
package com.hz.pm.api.common.statemachine.builder.impl;

import com.hz.pm.api.common.statemachine.builder.AdaptStateMachineBuilder;
import com.hz.pm.api.common.statemachine.builder.BaseStateMachineBuilder;
import com.hz.pm.api.common.statemachine.event.AdaptStateChangeEvent;
import com.hz.pm.api.projectdeclared.model.entity.Purchase;
import com.hz.pm.api.projectlib.model.enumeration.TenderAdaptStatusEnum;
@@ -24,7 +24,7 @@ import java.util.EnumSet;

/**
* <p>
* 标段状态机
* 标段适配改造状态机
* </p>
*
* @author WendyYang
@@ -34,7 +34,7 @@ import java.util.EnumSet;
@Component
@EnableStateMachine(name = AdaptStateMachineBuilderImpl.MACHINE_ID)
@RequiredArgsConstructor
public class AdaptStateMachineBuilderImpl implements AdaptStateMachineBuilder {
public class AdaptStateMachineBuilderImpl implements BaseStateMachineBuilder<Purchase, AdaptStateChangeEvent, TenderAdaptStatusEnum> {

public static final String MACHINE_ID = "adaptStateMachine";

@@ -53,7 +53,7 @@ public class AdaptStateMachineBuilderImpl implements AdaptStateMachineBuilder {
try {
return buildStateMachine(beanFactory);
} catch (Exception e) {
throw new StateMachineException("状态机构失败", e);
throw new StateMachineException("状态机构失败", e);
}
}



hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/impl/ProjectDeclareStateMachineBuilderImpl.java → hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/impl/ProjectStateMachineBuilderImpl.java Прегледај датотеку

@@ -1,8 +1,8 @@
package com.hz.pm.api.common.statemachine.builder.impl;

import com.hz.pm.api.common.statemachine.action.ProjectDeclareActionChoice;
import com.hz.pm.api.common.statemachine.builder.ProjectDeclareStateMachineBuilder;
import com.hz.pm.api.common.statemachine.event.ProjectStatusChangeEvent;
import com.hz.pm.api.common.statemachine.builder.BaseStateMachineBuilder;
import com.hz.pm.api.common.statemachine.event.ProjectStateChangeEvent;
import com.hz.pm.api.common.statemachine.factory.ProjectDeclareGuardFactory.PendingPreQualificationChoiceGuard;
import com.hz.pm.api.projectlib.model.entity.Project;
import com.hz.pm.api.projectlib.model.enumeration.ProjectStatusEnum;
@@ -12,6 +12,7 @@ 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.StateMachineException;
import org.springframework.statemachine.StateMachinePersist;
import org.springframework.statemachine.config.EnableStateMachine;
import org.springframework.statemachine.config.StateMachineBuilder;
@@ -31,17 +32,17 @@ import java.util.EnumSet;
*/
@Slf4j
@Component
@EnableStateMachine(name = ProjectDeclareStateMachineBuilderImpl.MACHINE_ID)
@EnableStateMachine(name = ProjectStateMachineBuilderImpl.MACHINE_ID)
@RequiredArgsConstructor
public class ProjectDeclareStateMachineBuilderImpl implements ProjectDeclareStateMachineBuilder {
public class ProjectStateMachineBuilderImpl implements BaseStateMachineBuilder<Project, ProjectStateChangeEvent, ProjectStatusEnum> {

public static final String MACHINE_ID = "projectDeclareStateMachine";

private final BeanFactory beanFactory;

@Override
public StateMachine<ProjectStatusEnum, ProjectStatusChangeEvent> build() throws Exception {
StateMachine<ProjectStatusEnum, ProjectStatusChangeEvent> stateMachine = build(beanFactory);
public StateMachine<ProjectStatusEnum, ProjectStateChangeEvent> build() throws StateMachineException {
StateMachine<ProjectStatusEnum, ProjectStateChangeEvent> stateMachine = build(beanFactory);
log.info("状态机ID:" + stateMachine.getId());
stateMachine.start();
return stateMachine;
@@ -50,13 +51,19 @@ public class ProjectDeclareStateMachineBuilderImpl implements ProjectDeclareStat
/**
* 构建状态机
*
* @param beanFactory
* @author CMM
* @since 2023/02/07 16:15
* @param beanFactory \
*/
@Override
public StateMachine<ProjectStatusEnum, ProjectStatusChangeEvent> build(BeanFactory beanFactory) throws Exception {
StateMachineBuilder.Builder<ProjectStatusEnum, ProjectStatusChangeEvent> builder = StateMachineBuilder.builder();
public StateMachine<ProjectStatusEnum, ProjectStateChangeEvent> build(BeanFactory beanFactory) throws StateMachineException {
try {
return buildStateMachine(beanFactory);
} catch (Exception e) {
throw new StateMachineException("状态机构建失败", e);
}
}

private StateMachine<ProjectStatusEnum, ProjectStateChangeEvent> buildStateMachine(BeanFactory beanFactory) throws Exception {
StateMachineBuilder.Builder<ProjectStatusEnum, ProjectStateChangeEvent> builder = StateMachineBuilder.builder();
builder.configureConfiguration()
.withConfiguration()
.machineId(MACHINE_ID)
@@ -74,27 +81,27 @@ public class ProjectDeclareStateMachineBuilderImpl implements ProjectDeclareStat
.withExternal()
.source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT)
.target(ProjectStatusEnum.PENDING_PREQUALIFICATION)
.event(ProjectStatusChangeEvent.UNDER_INTERNAL_PASS).and()
.event(ProjectStateChangeEvent.UNDER_INTERNAL_PASS).and()
// 单位内部审核驳回,从单位内部审核中到单位内部审核不通过
.withExternal()
.source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT)
.target(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS)
.event(ProjectStatusChangeEvent.UNDER_INTERNAL_REJECT).and()
.event(ProjectStateChangeEvent.UNDER_INTERNAL_REJECT).and()
// 单位内部审核中撤回,从单位内部审核中到待申报
.withExternal()
.source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT)
.target(ProjectStatusEnum.TO_BE_DECLARED)
.event(ProjectStatusChangeEvent.UNDER_INTERNAL_WITHDRAW).and()
.event(ProjectStateChangeEvent.UNDER_INTERNAL_WITHDRAW).and()
// 单位内部审核不通过重新提交,从单位内部审核不通过到单位内部审核中
.withExternal()
.source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS)
.target(ProjectStatusEnum.UNDER_INTERNAL_AUDIT)
.event(ProjectStatusChangeEvent.UNDER_INTERNAL_REJECT_RESUBMIT).and()
.event(ProjectStateChangeEvent.UNDER_INTERNAL_REJECT_RESUBMIT).and()
// 待预审预审申报,从待预审到待预审选择
.withExternal()
.source(ProjectStatusEnum.PENDING_PREQUALIFICATION)
.target(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE)
.event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_DECLARE).and()
.event(ProjectStateChangeEvent.PRELIMINARY_REVIEW_DECLARE).and()
// 待预审申报,从待预审选择->省级部门联审中,预审中,完成其中一种状态
.withChoice()
.source(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE)
@@ -105,38 +112,38 @@ public class ProjectDeclareStateMachineBuilderImpl implements ProjectDeclareStat
.withExternal()
.source(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS)
.target(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS)
.event(ProjectStatusChangeEvent.PROVINCIAL_DEPARTMENT_REVIEW_PASS).and()
.event(ProjectStateChangeEvent.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()
.event(ProjectStateChangeEvent.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()
.event(ProjectStateChangeEvent.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()
.event(ProjectStateChangeEvent.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_WITHDRAW).and()

// 预审通过,从预审中到部门联审中
.withExternal()
.source(ProjectStatusEnum.PRE_APPLYING)
.target(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW)
.event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_PASS).and()
.event(ProjectStateChangeEvent.PRELIMINARY_REVIEW_PASS).and()
// 预审驳回,从预审中到预审不通过
.withExternal()
.source(ProjectStatusEnum.PRE_APPLYING)
.target(ProjectStatusEnum.PREQUALIFICATION_FAILED)
.event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_REJECT).and()
.event(ProjectStateChangeEvent.PRELIMINARY_REVIEW_REJECT).and()
// 预审中撤回,从预审中到预审中撤回选择态
.withExternal()
.source(ProjectStatusEnum.PRE_APPLYING)
.target(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE)
.event(ProjectStatusChangeEvent.PRE_APPLYING_WITHDRAW).and()
.event(ProjectStateChangeEvent.PRE_APPLYING_WITHDRAW).and()
// 预审中撤回,从预审中撤回选择态->省级部门联审成功,待预审,完成其中一种状态
.withChoice()
.source(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE)
@@ -147,7 +154,7 @@ public class ProjectDeclareStateMachineBuilderImpl implements ProjectDeclareStat
.withExternal()
.source(ProjectStatusEnum.PREQUALIFICATION_FAILED)
.target(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE)
.event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_REJECT_RESUBMIT).and()
.event(ProjectStateChangeEvent.PRELIMINARY_REVIEW_REJECT_RESUBMIT).and()
// 预审不通过重新提交,从待预审选择->省级部门联审中,预审中,完成其中一种状态
.withChoice()
.source(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE)
@@ -157,129 +164,129 @@ public class ProjectDeclareStateMachineBuilderImpl implements ProjectDeclareStat
.withExternal()
.source(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW)
.target(ProjectStatusEnum.IN_THE_ANNUAL_PLAN)
.event(ProjectStatusChangeEvent.DEPARTMENT_UNITED_REVIEW_PASS).and()
.event(ProjectStateChangeEvent.DEPARTMENT_UNITED_REVIEW_PASS).and()
// 部门联审驳回,从部门联审中到部门联审不通过
.withExternal()
.source(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW)
.target(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW_FAILED)
.event(ProjectStatusChangeEvent.DEPARTMENT_UNITED_REVIEW_REJECT).and()
.event(ProjectStateChangeEvent.DEPARTMENT_UNITED_REVIEW_REJECT).and()
// 部门联审中撤回,从部门联审中到预审中
.withExternal()
.source(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW)
.target(ProjectStatusEnum.PRE_APPLYING)
.event(ProjectStatusChangeEvent.DEPARTMENT_JOINT_REVIEW_WITHDRAW).and()
.event(ProjectStateChangeEvent.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()
.event(ProjectStateChangeEvent.ANNUAL_PLAN_PROJECT_OPEN_PLAN_DECLARE).and()
// 年度计划中暂缓,从年度计划中到被暂缓
.withExternal()
.source(ProjectStatusEnum.IN_THE_ANNUAL_PLAN)
.target(ProjectStatusEnum.BE_SUSPENDED)
.event(ProjectStatusChangeEvent.ANNUAL_PLAN_SUSPEND).and()
.event(ProjectStateChangeEvent.ANNUAL_PLAN_SUSPEND).and()
// 方案待申报申报方案,从方案待申报到方案评审中
.withExternal()
.source(ProjectStatusEnum.PLAN_TO_BE_DECLARED)
.target(ProjectStatusEnum.SCHEME_UNDER_REVIEW)
.event(ProjectStatusChangeEvent.DECLARE_PLAN).and()
.event(ProjectStateChangeEvent.DECLARE_PLAN).and()
// 方案评审通过,从方案评审中到待立项批复
.withExternal()
.source(ProjectStatusEnum.SCHEME_UNDER_REVIEW)
.target(ProjectStatusEnum.TO_BE_APPROVED)
.event(ProjectStatusChangeEvent.PLAN_REVIEW_PASS).and()
.event(ProjectStateChangeEvent.PLAN_REVIEW_PASS).and()
// 方案评审驳回,从方案评审中到方案评审不通过
.withExternal()
.source(ProjectStatusEnum.SCHEME_UNDER_REVIEW)
.target(ProjectStatusEnum.SCHEME_REVIEW_FAILED)
.event(ProjectStatusChangeEvent.PLAN_REVIEW_REJECT).and()
.event(ProjectStateChangeEvent.PLAN_REVIEW_REJECT).and()
// 方案评审中撤回,从方案评审中到方案待申报
.withExternal()
.source(ProjectStatusEnum.SCHEME_UNDER_REVIEW)
.target(ProjectStatusEnum.PLAN_TO_BE_DECLARED)
.event(ProjectStatusChangeEvent.SCHEME_UNDER_REVIEW_WITHDRAW).and()
.event(ProjectStateChangeEvent.SCHEME_UNDER_REVIEW_WITHDRAW).and()
// 方案评审不通过重新提交,从方案评审不通过到方案评审中
.withExternal()
.source(ProjectStatusEnum.SCHEME_REVIEW_FAILED)
.target(ProjectStatusEnum.SCHEME_UNDER_REVIEW)
.event(ProjectStatusChangeEvent.PLAN_REVIEW_REJECT_RESUBMIT).and()
.event(ProjectStateChangeEvent.PLAN_REVIEW_REJECT_RESUBMIT).and()
// 立项备案
.withExternal()
.source(ProjectStatusEnum.DECLARED_APPROVED_TO_BE_RECORD)
.target(ProjectStatusEnum.DECLARED_APPROVED_RECORD_AUDITING)
.event(ProjectStatusChangeEvent.DECLARED_RECORD_SUBMIT).and()
.event(ProjectStateChangeEvent.DECLARED_RECORD_SUBMIT).and()
.withExternal()
.source(ProjectStatusEnum.DECLARED_APPROVED_RECORD_FAILED)
.target(ProjectStatusEnum.DECLARED_APPROVED_RECORD_AUDITING)
.event(ProjectStatusChangeEvent.DECLARED_RECORD_RESUBMIT).and()
.event(ProjectStateChangeEvent.DECLARED_RECORD_RESUBMIT).and()
.withExternal()
.source(ProjectStatusEnum.DECLARED_APPROVED_RECORD_AUDITING)
.target(ProjectStatusEnum.TO_BE_PURCHASED)
.event(ProjectStatusChangeEvent.DECLARED_RECORD_PASS).and()
.event(ProjectStateChangeEvent.DECLARED_RECORD_PASS).and()
.withExternal()
.source(ProjectStatusEnum.DECLARED_APPROVED_RECORD_AUDITING)
.target(ProjectStatusEnum.DECLARED_APPROVED_RECORD_FAILED)
.event(ProjectStatusChangeEvent.DECLARED_RECORD_FAILED).and()
.event(ProjectStateChangeEvent.DECLARED_RECORD_FAILED).and()
// 待立项批复批复,从待立项批复到待采购
.withExternal()
.source(ProjectStatusEnum.TO_BE_APPROVED)
.target(ProjectStatusEnum.TO_BE_PURCHASED)
.event(ProjectStatusChangeEvent.PROJECT_APPROVAL).and()
.event(ProjectStateChangeEvent.PROJECT_APPROVAL).and()
// 待采购采购备案,从待采购到实施中
.withExternal()
.source(ProjectStatusEnum.TO_BE_PURCHASED)
.target(ProjectStatusEnum.ON_PURCHASING)
.event(ProjectStatusChangeEvent.SUBMIT_PURCHASE_NOTICE).and()
.event(ProjectStateChangeEvent.SUBMIT_PURCHASE_NOTICE).and()
// 填写试试计划 -> 待初验
.withExternal()
.source(ProjectStatusEnum.ON_PURCHASING)
.target(ProjectStatusEnum.TO_BE_FIRST_INSPECTED)
.event(ProjectStatusChangeEvent.SUBMIT_OPERATION_PLAN).and()
.event(ProjectStateChangeEvent.SUBMIT_OPERATION_PLAN).and()
// 上传初验材料
.withExternal()
.source(ProjectStatusEnum.TO_BE_FIRST_INSPECTED)
.target(ProjectStatusEnum.ON_FIRST_INSPECTED)
.event(ProjectStatusChangeEvent.SUBMIT_FIRST_INSPECTED_FILES).and()
.event(ProjectStateChangeEvent.SUBMIT_FIRST_INSPECTED_FILES).and()
// 初验审批通过
.withExternal()
.source(ProjectStatusEnum.ON_FIRST_INSPECTED)
.target(ProjectStatusEnum.TO_BE_FINALLY_INSPECTED)
.event(ProjectStatusChangeEvent.FIRST_INSPECTED_PASSED).and()
.event(ProjectStateChangeEvent.FIRST_INSPECTED_PASSED).and()
// 待开工 实施,从实施到建设中
.withExternal()
.source(ProjectStatusEnum.OPERATION)
.target(ProjectStatusEnum.UNDER_CONSTRUCTION)
.event(ProjectStatusChangeEvent.START_TO_WORK).and()
.event(ProjectStateChangeEvent.START_TO_WORK).and()
// 建设中初验备案,从建设中到待终验
.withExternal()
.source(ProjectStatusEnum.UNDER_CONSTRUCTION)
.target(ProjectStatusEnum.TO_BE_FINALLY_INSPECTED)
.event(ProjectStatusChangeEvent.PRELIMINARY_ACCEPTANCE_PUT_ON_RECORD).and()
.event(ProjectStateChangeEvent.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()
.event(ProjectStateChangeEvent.FINAL_ACCEPTANCE_APPLICATION).and()
// 终审审核通过,从终审审核中到已归档
.withExternal()
.source(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW)
.target(ProjectStatusEnum.ARCHIVED)
.event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_PASS).and()
.event(ProjectStateChangeEvent.FINAL_ACCEPTANCE_PASS).and()
// 终审审核不通过,从终审审核中到终审审核不通过
.withExternal()
.source(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW)
.target(ProjectStatusEnum.FINAL_ACCEPTANCE_REVIEW_FAILED)
.event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_REJECT).and()
.event(ProjectStateChangeEvent.FINAL_ACCEPTANCE_REJECT).and()
// 终审审核中撤回,从终审审核中到待终验
.withExternal()
.source(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW)
.target(ProjectStatusEnum.TO_BE_FINALLY_INSPECTED)
.event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_IS_UNDER_REVIEW_WITHDRAW).and()
.event(ProjectStateChangeEvent.FINAL_ACCEPTANCE_IS_UNDER_REVIEW_WITHDRAW).and()
// 终验中 重新提交
.withExternal()
.source(ProjectStatusEnum.FINAL_ACCEPTANCE_REVIEW_FAILED)
.target(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW)
.event(ProjectStatusChangeEvent.FINAL_RE_ACCEPTANCE_APPLICATION).and();
.event(ProjectStateChangeEvent.FINAL_RE_ACCEPTANCE_APPLICATION).and();
return builder.build();
}

@@ -291,15 +298,15 @@ public class ProjectDeclareStateMachineBuilderImpl implements ProjectDeclareStat
*/
@Bean(name = "projectDeclareStatePersister")
@Override
public StateMachinePersister<ProjectStatusEnum, ProjectStatusChangeEvent, Project> getProjectPersister() {
return new DefaultStateMachinePersister<>(new StateMachinePersist<ProjectStatusEnum, ProjectStatusChangeEvent, Project>() {
public StateMachinePersister<ProjectStatusEnum, ProjectStateChangeEvent, Project> stateMachinePersister() {
return new DefaultStateMachinePersister<>(new StateMachinePersist<ProjectStatusEnum, ProjectStateChangeEvent, Project>() {
@Override
public void write(StateMachineContext<ProjectStatusEnum, ProjectStatusChangeEvent> context, Project contextObj) {
public void write(StateMachineContext<ProjectStatusEnum, ProjectStateChangeEvent> context, Project contextObj) {
log.info("当前项目为:{}", contextObj);
}

@Override
public StateMachineContext<ProjectStatusEnum, ProjectStatusChangeEvent> read(Project contextObj) {
public StateMachineContext<ProjectStatusEnum, ProjectStateChangeEvent> read(Project contextObj) {
return new DefaultStateMachineContext<>(ProjectStatusEnum.match(contextObj.getStatus()),
null, null, null, null, MACHINE_ID);
}

+ 4
- 4
hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/impl/SelfTestStateMachineBuilderImpl.java Прегледај датотеку

@@ -1,6 +1,6 @@
package com.hz.pm.api.common.statemachine.builder.impl;

import com.hz.pm.api.common.statemachine.builder.SelfTestStateMachineBuilder;
import com.hz.pm.api.common.statemachine.builder.BaseStateMachineBuilder;
import com.hz.pm.api.common.statemachine.event.SelfTestStateChangeEvent;
import com.hz.pm.api.projectdeclared.model.entity.Purchase;
import com.hz.pm.api.projectlib.model.enumeration.TenderSelfTestStatusEnum;
@@ -24,7 +24,7 @@ import java.util.EnumSet;

/**
* <p>
* 标段状态机
* 标段系统自测状态机
* </p>
*
* @author WendyYang
@@ -34,7 +34,7 @@ import java.util.EnumSet;
@Component
@EnableStateMachine(name = SelfTestStateMachineBuilderImpl.MACHINE_ID)
@RequiredArgsConstructor
public class SelfTestStateMachineBuilderImpl implements SelfTestStateMachineBuilder {
public class SelfTestStateMachineBuilderImpl implements BaseStateMachineBuilder<Purchase, SelfTestStateChangeEvent, TenderSelfTestStatusEnum> {

public static final String MACHINE_ID = "selfTestStateMachine";

@@ -53,7 +53,7 @@ public class SelfTestStateMachineBuilderImpl implements SelfTestStateMachineBuil
try {
return buildStateMachine(beanFactory);
} catch (Exception e) {
throw new StateMachineException("状态机构失败", e);
throw new StateMachineException("状态机构失败", e);
}
}



+ 25
- 25
hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/impl/TenderStateMachineBuilderImpl.java Прегледај датотеку

@@ -1,7 +1,7 @@
package com.hz.pm.api.common.statemachine.builder.impl;

import com.hz.pm.api.common.statemachine.builder.TenderStateMachineBuilder;
import com.hz.pm.api.common.statemachine.event.TenderStatusChangeEvent;
import com.hz.pm.api.common.statemachine.builder.BaseStateMachineBuilder;
import com.hz.pm.api.common.statemachine.event.TenderStateChangeEvent;
import com.hz.pm.api.projectdeclared.model.entity.Purchase;
import com.hz.pm.api.projectlib.model.enumeration.TenderStatusEnum;
import lombok.RequiredArgsConstructor;
@@ -33,31 +33,31 @@ import java.util.EnumSet;
@Component
@EnableStateMachine(name = TenderStateMachineBuilderImpl.MACHINE_ID)
@RequiredArgsConstructor
public class TenderStateMachineBuilderImpl implements TenderStateMachineBuilder {
public class TenderStateMachineBuilderImpl implements BaseStateMachineBuilder<Purchase, TenderStateChangeEvent, TenderStatusEnum> {

public static final String MACHINE_ID = "tenderStateMachine";

private final BeanFactory beanFactory;

@Override
public StateMachine<TenderStatusEnum, TenderStatusChangeEvent> build() throws StateMachineException {
StateMachine<TenderStatusEnum, TenderStatusChangeEvent> stateMachine = build(beanFactory);
public StateMachine<TenderStatusEnum, TenderStateChangeEvent> build() throws StateMachineException {
StateMachine<TenderStatusEnum, TenderStateChangeEvent> stateMachine = build(beanFactory);
log.info("状态机ID:" + stateMachine.getId());
stateMachine.start();
return stateMachine;
}

@Override
public StateMachine<TenderStatusEnum, TenderStatusChangeEvent> build(BeanFactory beanFactory) throws StateMachineException {
public StateMachine<TenderStatusEnum, TenderStateChangeEvent> build(BeanFactory beanFactory) throws StateMachineException {
try {
return buildStateMachine(beanFactory);
} catch (Exception e) {
throw new StateMachineException("状态机构失败", e);
throw new StateMachineException("状态机构失败", e);
}
}

private StateMachine<TenderStatusEnum, TenderStatusChangeEvent> buildStateMachine(BeanFactory factory) throws Exception {
StateMachineBuilder.Builder<TenderStatusEnum, TenderStatusChangeEvent> builder = StateMachineBuilder.builder();
private StateMachine<TenderStatusEnum, TenderStateChangeEvent> buildStateMachine(BeanFactory factory) throws Exception {
StateMachineBuilder.Builder<TenderStatusEnum, TenderStateChangeEvent> builder = StateMachineBuilder.builder();
builder.configureConfiguration()
.withConfiguration()
.machineId(MACHINE_ID)
@@ -73,87 +73,87 @@ public class TenderStateMachineBuilderImpl implements TenderStateMachineBuilder
.withExternal()
.source(TenderStatusEnum.TO_BE_SUBMIT_PURCHASE_INFO)
.target(TenderStatusEnum.TO_BE_SUBMIT_CONSTRUCTION_INFO)
.event(TenderStatusChangeEvent.SUBMIT_PURCHASE_INFO)
.event(TenderStateChangeEvent.SUBMIT_PURCHASE_INFO)
.and()
// 填写合同信息
.withExternal()
.source(TenderStatusEnum.TO_BE_SUBMIT_CONSTRUCTION_INFO)
.target(TenderStatusEnum.TO_BE_SUBMIT_OPERATION_PLAN)
.event(TenderStatusChangeEvent.SUBMIT_CONSTRUCTION_INFO)
.event(TenderStateChangeEvent.SUBMIT_CONSTRUCTION_INFO)
.and()
// 填写实施计划
.withExternal()
.source(TenderStatusEnum.TO_BE_SUBMIT_OPERATION_PLAN)
.target(TenderStatusEnum.TO_BE_SUBMIT_FIRST_INSPECTED_INFO)
.event(TenderStatusChangeEvent.SUBMIT_OPERATION_PLAN)
.event(TenderStateChangeEvent.SUBMIT_OPERATION_PLAN)
.and()
// 上传初验材料
.withExternal()
.source(TenderStatusEnum.TO_BE_SUBMIT_FIRST_INSPECTED_INFO)
.target(TenderStatusEnum.TO_BE_SUBMIT_XCFHX_APPLY)
.event(TenderStatusChangeEvent.SUBMIT_FIRST_INSPECTED_FILES)
.event(TenderStateChangeEvent.SUBMIT_FIRST_INSPECTED_FILES)
.and()
// 信创符合性申请
.withExternal()
.source(TenderStatusEnum.TO_BE_SUBMIT_XCFHX_APPLY)
.target(TenderStatusEnum.ON_XCFHX_APPLY)
.event(TenderStatusChangeEvent.SUBMIT_XCFHX_APPLY)
.event(TenderStateChangeEvent.SUBMIT_XCFHX_APPLY)
.and()// 信创符合性申请
.withExternal()
.source(TenderStatusEnum.XCFHX_APPLY_FAILED)
.target(TenderStatusEnum.ON_XCFHX_APPLY)
.event(TenderStatusChangeEvent.RESUBMIT_XCFHX_APPLY)
.event(TenderStateChangeEvent.RESUBMIT_XCFHX_APPLY)
.and()
// 信创符合性申请通过
.withExternal()
.source(TenderStatusEnum.ON_XCFHX_APPLY)
.target(TenderStatusEnum.TO_BE_SUBMIT_FINALLY_INSPECTED_APPLY)
.event(TenderStatusChangeEvent.XCFHX_APPLY_PASSED)
.event(TenderStateChangeEvent.XCFHX_APPLY_PASSED)
.and()
// 信创符合性申请失败
.withExternal()
.source(TenderStatusEnum.ON_XCFHX_APPLY)
.target(TenderStatusEnum.XCFHX_APPLY_FAILED)
.event(TenderStatusChangeEvent.XCFHX_APPLY_FAILED)
.event(TenderStateChangeEvent.XCFHX_APPLY_FAILED)
.and()
// 终验申报
.withExternal()
.source(TenderStatusEnum.TO_BE_SUBMIT_FINALLY_INSPECTED_APPLY)
.target(TenderStatusEnum.ON_FINALLY_INSPECTED_APPLY)
.event(TenderStatusChangeEvent.SUBMIT_FINALLY_INSPECTED)
.event(TenderStateChangeEvent.SUBMIT_FINALLY_INSPECTED)
.and()
// 终验申报重新提交
.withExternal()
.source(TenderStatusEnum.FINALLY_INSPECTED_FAILED)
.target(TenderStatusEnum.ON_FINALLY_INSPECTED_APPLY)
.event(TenderStatusChangeEvent.RESUBMIT_FINALLY_INSPECTED)
.event(TenderStateChangeEvent.RESUBMIT_FINALLY_INSPECTED)
.and()
// 终验申报通过
.withExternal()
.source(TenderStatusEnum.ON_FINALLY_INSPECTED_APPLY)
.target(TenderStatusEnum.FINALLY_INSPECTED_PASSED)
.event(TenderStatusChangeEvent.FINALLY_INSPECTED_PASSED)
.event(TenderStateChangeEvent.FINALLY_INSPECTED_PASSED)
.and()
// 终验申报拒绝
.withExternal()
.source(TenderStatusEnum.ON_FINALLY_INSPECTED_APPLY)
.target(TenderStatusEnum.FINALLY_INSPECTED_FAILED)
.event(TenderStatusChangeEvent.FINALLY_INSPECTED_FAILED)
.event(TenderStateChangeEvent.FINALLY_INSPECTED_FAILED)
.and();
return builder.build();
}

@Override
@Bean(name = "tenderStatePersister")
public StateMachinePersister<TenderStatusEnum, TenderStatusChangeEvent, Purchase> stateMachinePersister() {
return new DefaultStateMachinePersister<>(new StateMachinePersist<TenderStatusEnum, TenderStatusChangeEvent, Purchase>() {
public StateMachinePersister<TenderStatusEnum, TenderStateChangeEvent, Purchase> stateMachinePersister() {
return new DefaultStateMachinePersister<>(new StateMachinePersist<TenderStatusEnum, TenderStateChangeEvent, Purchase>() {
@Override
public void write(StateMachineContext<TenderStatusEnum, TenderStatusChangeEvent> context, Purchase contextObj) {
public void write(StateMachineContext<TenderStatusEnum, TenderStateChangeEvent> context, Purchase contextObj) {
log.info("当前项目为:{}", contextObj);
}

@Override
public StateMachineContext<TenderStatusEnum, TenderStatusChangeEvent> read(Purchase contextObj) {
public StateMachineContext<TenderStatusEnum, TenderStateChangeEvent> read(Purchase contextObj) {
return new DefaultStateMachineContext<>(TenderStatusEnum.getByStatus(contextObj.getStatus()),
null, null, null, null, MACHINE_ID);
}


+ 4
- 4
hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/impl/TestValidStateMachineBuilderImpl.java Прегледај датотеку

@@ -1,6 +1,6 @@
package com.hz.pm.api.common.statemachine.builder.impl;

import com.hz.pm.api.common.statemachine.builder.TestValidStateMachineBuilder;
import com.hz.pm.api.common.statemachine.builder.BaseStateMachineBuilder;
import com.hz.pm.api.common.statemachine.event.TestValidStateChangeEvent;
import com.hz.pm.api.projectdeclared.model.entity.Purchase;
import com.hz.pm.api.projectlib.model.enumeration.TenderTestValidStatusEnum;
@@ -24,7 +24,7 @@ import java.util.EnumSet;

/**
* <p>
* 标段状态机
* 标段测试验证状态机
* </p>
*
* @author WendyYang
@@ -34,7 +34,7 @@ import java.util.EnumSet;
@Component
@EnableStateMachine(name = TestValidStateMachineBuilderImpl.MACHINE_ID)
@RequiredArgsConstructor
public class TestValidStateMachineBuilderImpl implements TestValidStateMachineBuilder {
public class TestValidStateMachineBuilderImpl implements BaseStateMachineBuilder<Purchase, TestValidStateChangeEvent, TenderTestValidStatusEnum> {

public static final String MACHINE_ID = "testValidStateMachine";

@@ -53,7 +53,7 @@ public class TestValidStateMachineBuilderImpl implements TestValidStateMachineBu
try {
return buildStateMachine(beanFactory);
} catch (Exception e) {
throw new StateMachineException("状态机构失败", e);
throw new StateMachineException("状态机构失败", e);
}
}



+ 58
- 0
hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/event/AbstractStateChangeEvent.java Прегледај датотеку

@@ -0,0 +1,58 @@
package com.hz.pm.api.common.statemachine.event;

import com.ningdatech.basic.exception.BizException;
import org.apache.commons.lang3.EnumUtils;

import java.util.Objects;

/**
* <p>
* BaseTenderAction
* </p>
*
* @author WendyYang
* @since 18:58 2024/4/2
*/
public interface AbstractStateChangeEvent {


Integer getPassStatusCode();

Integer getRejectStatusCode();

Integer getWithdrawStatusCode();

static <E extends Enum<E> & AbstractStateChangeEvent> E getPassEvent(Class<E> eClass, Integer code) {
if (Objects.nonNull(code)) {
for (E t : EnumUtils.getEnumList(eClass)) {
if (code.equals(t.getPassStatusCode())) {
return t;
}
}
}
throw BizException.wrap("该状态下没有对应的通过操作!");
}

static <E extends Enum<E> & AbstractStateChangeEvent> E getRejectEvent(Class<E> eClass, Integer code) {
if (Objects.nonNull(code)) {
for (E t : EnumUtils.getEnumList(eClass)) {
if (code.equals(t.getRejectStatusCode())) {
return t;
}
}
}
throw BizException.wrap("该状态下没有对应的驳回操作!");
}

static <E extends Enum<E> & AbstractStateChangeEvent> E getWithdrawEvent(Class<E> eClass, Integer code) {
if (Objects.nonNull(code)) {
for (E t : EnumUtils.getEnumList(eClass)) {
if (code.equals(t.getWithdrawStatusCode())) {
return t;
}
}
}
throw BizException.wrap("该状态下没有对应的撤回操作!");
}

}

+ 1
- 39
hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/event/AdaptStateChangeEvent.java Прегледај датотеку

@@ -3,8 +3,6 @@ package com.hz.pm.api.common.statemachine.event;
import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Objects;

/**
* <p>
* TenderStatusChangeEvent
@@ -15,7 +13,7 @@ import java.util.Objects;
*/
@Getter
@AllArgsConstructor
public enum AdaptStateChangeEvent {
public enum AdaptStateChangeEvent implements AbstractStateChangeEvent {

SUBMIT_ADAPT_INFO(2100, null, null),
ADAPT_INFO_PASSED(2101, null, null),
@@ -27,40 +25,4 @@ public enum AdaptStateChangeEvent {
private final Integer rejectStatusCode;
private final Integer withdrawStatusCode;

public static AdaptStateChangeEvent getPassValueByCode(Integer code) {
if (Objects.isNull(code)) {
return null;
}
for (AdaptStateChangeEvent t : AdaptStateChangeEvent.values()) {
if (code.equals(t.getPassStatusCode())) {
return t;
}
}
return null;
}

public static AdaptStateChangeEvent getRejectValueByCode(Integer code) {
if (Objects.isNull(code)) {
return null;
}
for (AdaptStateChangeEvent t : AdaptStateChangeEvent.values()) {
if (code.equals(t.getRejectStatusCode())) {
return t;
}
}
return null;
}

public static AdaptStateChangeEvent getWithdrawValueByCode(Integer code) {
if (Objects.isNull(code)) {
return null;
}
for (AdaptStateChangeEvent t : AdaptStateChangeEvent.values()) {
if (code.equals(t.getWithdrawStatusCode())) {
return t;
}
}
return null;
}

}

hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/event/ProjectStatusChangeEvent.java → hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/event/ProjectStateChangeEvent.java Прегледај датотеку

@@ -3,21 +3,18 @@ package com.hz.pm.api.common.statemachine.event;
import com.hz.pm.api.projectlib.model.enumeration.ProjectStatusEnum;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;

import java.util.Objects;

/**
* 项目状态改变事件
* <p>
* ProjectStatusChangeEvent
* </p>
*
* @author CMM
* @return
* @since 2023/02/07 9:22
* @author WendyYang
* @since 20:20 2024/4/2
*/
@Getter
@AllArgsConstructor
@NoArgsConstructor
public enum ProjectStatusChangeEvent {
public enum ProjectStateChangeEvent implements AbstractStateChangeEvent {

/**
* 项目申报暂存(项目状态进入:待申报)
@@ -205,43 +202,8 @@ public enum ProjectStatusChangeEvent {
FINAL_RE_ACCEPTANCE_APPLICATION(ProjectStatusEnum.FINAL_ACCEPTANCE_REVIEW_FAILED.getCode(), null, null);


private Integer passProjectStatusCode;
private Integer rejectProjectStatusCode;
private Integer withdrawProjectStatusCode;

public static ProjectStatusChangeEvent getPassValueByCode(Integer code) {
if (Objects.isNull(code)) {
return null;
}
for (ProjectStatusChangeEvent t : ProjectStatusChangeEvent.values()) {
if (code.equals(t.getPassProjectStatusCode())) {
return t;
}
}
return null;
}

public static ProjectStatusChangeEvent getRejectValueByCode(Integer code) {
if (Objects.isNull(code)) {
return null;
}
for (ProjectStatusChangeEvent t : ProjectStatusChangeEvent.values()) {
if (code.equals(t.getRejectProjectStatusCode())) {
return t;
}
}
return null;
}

public static ProjectStatusChangeEvent getWithdrawValueByCode(Integer code) {
if (Objects.isNull(code)) {
return null;
}
for (ProjectStatusChangeEvent t : ProjectStatusChangeEvent.values()) {
if (code.equals(t.getWithdrawProjectStatusCode())) {
return t;
}
}
return null;
}
private final Integer passStatusCode;
private final Integer rejectStatusCode;
private final Integer withdrawStatusCode;

}

+ 1
- 39
hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/event/SelfTestStateChangeEvent.java Прегледај датотеку

@@ -3,8 +3,6 @@ package com.hz.pm.api.common.statemachine.event;
import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Objects;

/**
* <p>
* SelfTestStateChangeEvent
@@ -15,7 +13,7 @@ import java.util.Objects;
*/
@Getter
@AllArgsConstructor
public enum SelfTestStateChangeEvent {
public enum SelfTestStateChangeEvent implements AbstractStateChangeEvent {

SUBMIT_SELF_TEST_INFO(1100, null, null),
SELF_TEST_PASSED(1101, null, null),
@@ -27,40 +25,4 @@ public enum SelfTestStateChangeEvent {
private final Integer rejectStatusCode;
private final Integer withdrawStatusCode;

public static SelfTestStateChangeEvent getPassValueByCode(Integer code) {
if (Objects.isNull(code)) {
return null;
}
for (SelfTestStateChangeEvent t : SelfTestStateChangeEvent.values()) {
if (code.equals(t.getPassStatusCode())) {
return t;
}
}
return null;
}

public static SelfTestStateChangeEvent getRejectValueByCode(Integer code) {
if (Objects.isNull(code)) {
return null;
}
for (SelfTestStateChangeEvent t : SelfTestStateChangeEvent.values()) {
if (code.equals(t.getRejectStatusCode())) {
return t;
}
}
return null;
}

public static SelfTestStateChangeEvent getWithdrawValueByCode(Integer code) {
if (Objects.isNull(code)) {
return null;
}
for (SelfTestStateChangeEvent t : SelfTestStateChangeEvent.values()) {
if (code.equals(t.getWithdrawStatusCode())) {
return t;
}
}
return null;
}

}

hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/event/TenderStatusChangeEvent.java → hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/event/TenderStateChangeEvent.java Прегледај датотеку

@@ -3,8 +3,6 @@ package com.hz.pm.api.common.statemachine.event;
import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Objects;

/**
* <p>
* TenderStatusChangeEvent
@@ -15,7 +13,7 @@ import java.util.Objects;
*/
@Getter
@AllArgsConstructor
public enum TenderStatusChangeEvent {
public enum TenderStateChangeEvent implements AbstractStateChangeEvent {

/**
* 填写采购信息
@@ -71,40 +69,4 @@ public enum TenderStatusChangeEvent {
private final Integer rejectStatusCode;
private final Integer withdrawStatusCode;

public static TenderStatusChangeEvent getPassValueByCode(Integer code) {
if (Objects.isNull(code)) {
return null;
}
for (TenderStatusChangeEvent t : TenderStatusChangeEvent.values()) {
if (code.equals(t.getPassStatusCode())) {
return t;
}
}
return null;
}

public static TenderStatusChangeEvent getRejectValueByCode(Integer code) {
if (Objects.isNull(code)) {
return null;
}
for (TenderStatusChangeEvent t : TenderStatusChangeEvent.values()) {
if (code.equals(t.getRejectStatusCode())) {
return t;
}
}
return null;
}

public static TenderStatusChangeEvent getWithdrawValueByCode(Integer code) {
if (Objects.isNull(code)) {
return null;
}
for (TenderStatusChangeEvent t : TenderStatusChangeEvent.values()) {
if (code.equals(t.getWithdrawStatusCode())) {
return t;
}
}
return null;
}

}

+ 1
- 39
hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/event/TestValidStateChangeEvent.java Прегледај датотеку

@@ -3,8 +3,6 @@ package com.hz.pm.api.common.statemachine.event;
import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Objects;

/**
* <p>
* TenderStatusChangeEvent
@@ -15,7 +13,7 @@ import java.util.Objects;
*/
@Getter
@AllArgsConstructor
public enum TestValidStateChangeEvent {
public enum TestValidStateChangeEvent implements AbstractStateChangeEvent {

/**
* 填写测试验证信息
@@ -39,40 +37,4 @@ public enum TestValidStateChangeEvent {
private final Integer rejectStatusCode;
private final Integer withdrawStatusCode;

public static TestValidStateChangeEvent getPassValueByCode(Integer code) {
if (Objects.isNull(code)) {
return null;
}
for (TestValidStateChangeEvent t : TestValidStateChangeEvent.values()) {
if (code.equals(t.getPassStatusCode())) {
return t;
}
}
return null;
}

public static TestValidStateChangeEvent getRejectValueByCode(Integer code) {
if (Objects.isNull(code)) {
return null;
}
for (TestValidStateChangeEvent t : TestValidStateChangeEvent.values()) {
if (code.equals(t.getRejectStatusCode())) {
return t;
}
}
return null;
}

public static TestValidStateChangeEvent getWithdrawValueByCode(Integer code) {
if (Objects.isNull(code)) {
return null;
}
for (TestValidStateChangeEvent t : TestValidStateChangeEvent.values()) {
if (code.equals(t.getWithdrawStatusCode())) {
return t;
}
}
return null;
}

}

+ 3
- 3
hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/factory/ProjectDeclareGuardFactory.java Прегледај датотеку

@@ -1,6 +1,6 @@
package com.hz.pm.api.common.statemachine.factory;

import com.hz.pm.api.common.statemachine.event.ProjectStatusChangeEvent;
import com.hz.pm.api.common.statemachine.event.ProjectStateChangeEvent;
import com.hz.pm.api.projectlib.model.enumeration.ProjectStatusEnum;
import org.springframework.statemachine.StateContext;
import org.springframework.statemachine.guard.Guard;
@@ -16,9 +16,9 @@ public class ProjectDeclareGuardFactory {
private ProjectDeclareGuardFactory() {
}

public static class PendingPreQualificationChoiceGuard implements Guard<ProjectStatusEnum, ProjectStatusChangeEvent> {
public static class PendingPreQualificationChoiceGuard implements Guard<ProjectStatusEnum, ProjectStateChangeEvent> {
@Override
public boolean evaluate(StateContext<ProjectStatusEnum, ProjectStatusChangeEvent> context) {
public boolean evaluate(StateContext<ProjectStatusEnum, ProjectStateChangeEvent> context) {
// 判断申报项目是否是市级项目,且申报金额是否大于等于1000万元
return true;
}


+ 68
- 0
hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/util/AbstractStateMachineUtil.java Прегледај датотеку

@@ -0,0 +1,68 @@
package com.hz.pm.api.common.statemachine.util;

import com.hz.pm.api.common.statemachine.event.AbstractStateChangeEvent;
import com.ningdatech.basic.exception.BizException;
import com.wflow.exception.BusinessException;
import org.slf4j.LoggerFactory;

import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
import java.util.function.Function;

/**
* <p>
* AbstractStateMachineUtil
* </p>
*
* @author WendyYang
* @since 19:39 2024/4/2
*/
public interface AbstractStateMachineUtil<O, E extends Enum<E> & AbstractStateChangeEvent> {

/**
* 获取状态变更事件类型
*
* @return java.lang.Class<E>
**/
default Class<E> eventClass() {
Type type = getClass().getGenericInterfaces()[0];
return (Class<E>) ((ParameterizedType) type).getActualTypeArguments()[1];
}

//通过审核
default void pass(O obj) {
try {
execute(obj, AbstractStateChangeEvent.getPassEvent(eventClass(), statusFunction().apply(obj)));
} catch (Exception e) {
LoggerFactory.getLogger(this.getClass()).info("状态机 通过失败 :{}", e.getMessage());
throw BizException.wrap("状态机通过失败");
}
}


//拒绝
default void reject(O obj) {
try {
execute(obj, AbstractStateChangeEvent.getRejectEvent(eventClass(), statusFunction().apply(obj)));
} catch (Exception e) {
LoggerFactory.getLogger(this.getClass()).info("状态机 拒绝失败 :{}", e.getMessage());
throw new BusinessException("状态机拒绝失败");
}
}

//撤回
default void withDraw(O obj) {
try {
execute(obj, AbstractStateChangeEvent.getWithdrawEvent(eventClass(), statusFunction().apply(obj)));
} catch (Exception e) {
LoggerFactory.getLogger(this.getClass()).info("状态机 撤回失败 :{}", e.getMessage());
throw new BusinessException("状态机撤回失败");
}
}

Function<O, Integer> statusFunction();

void execute(O o, E event) throws Exception;


}

+ 8
- 61
hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/util/AdaptStateMachineUtil.java Прегледај датотеку

@@ -1,15 +1,12 @@
package com.hz.pm.api.common.statemachine.util;

import com.hz.pm.api.common.statemachine.builder.AdaptStateMachineBuilder;
import com.hz.pm.api.common.statemachine.builder.impl.AdaptStateMachineBuilderImpl;
import com.hz.pm.api.common.statemachine.event.AdaptStateChangeEvent;
import com.hz.pm.api.projectdeclared.model.entity.Purchase;
import com.hz.pm.api.projectdeclared.utils.ProjectIdCodeCacheUtil;
import com.hz.pm.api.projectlib.entity.PurchaseStatusChange;
import com.hz.pm.api.projectlib.model.enumeration.InstTypeEnum;
import com.hz.pm.api.projectlib.model.enumeration.TenderAdaptStatusEnum;
import com.hz.pm.api.projectlib.service.IPurchaseStatusChangeService;
import com.ningdatech.basic.exception.BizException;
import com.wflow.exception.BusinessException;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.messaging.Message;
@@ -19,7 +16,7 @@ import org.springframework.statemachine.persist.StateMachinePersister;
import org.springframework.stereotype.Component;

import java.time.LocalDateTime;
import java.util.Objects;
import java.util.function.Function;

/**
* <p>
@@ -32,46 +29,21 @@ import java.util.Objects;
@Slf4j
@Component
@RequiredArgsConstructor
public class AdaptStateMachineUtil {
public class AdaptStateMachineUtil implements AbstractStateMachineUtil<Purchase, AdaptStateChangeEvent> {

public static final String PURCHASE = "purchaseInfo";

//==================================================================================================================

private final AdaptStateMachineBuilder adaptStateMachineBuilder;
private final AdaptStateMachineBuilderImpl adaptStateMachineBuilder;
private final IPurchaseStatusChangeService purchaseStatusChangeService;


//通过审核
public void pass(Purchase purchase) {
try {
execute(purchase, getPassEvent(purchase.getAdaptStatus()));
} catch (Exception e) {
log.info("状态机 通过失败 :{}", e.getMessage());
throw new BusinessException("状态机 通过失败: " + e);
}
}

//拒绝
public void reject(Purchase purchase) {
try {
execute(purchase, getRejectEvent(purchase.getAdaptStatus()));
} catch (Exception e) {
log.info("状态机 拒绝失败 :{}", e.getMessage());
throw new BusinessException("状态机 拒绝失败: " + e);
}
}

//撤回
public void withDraw(Purchase purchase) {
try {
execute(purchase, getWithdrawEvent(purchase.getAdaptStatus()));
} catch (Exception e) {
log.info("状态机 撤回失败 :{}", e.getMessage());
throw new BusinessException("状态机 撤回失败: " + e);
}
@Override
public Function<Purchase, Integer> statusFunction() {
return Purchase::getAdaptStatus;
}

@Override
public void execute(Purchase purchase, AdaptStateChangeEvent event) throws Exception {
log.info("调用状态机前的标段状态为:{}", purchase.getStatus());
// 获取TO状态机
@@ -95,29 +67,4 @@ public class AdaptStateMachineUtil {
log.info("调用状态机后的标段状态为:{}", purchase.getAdaptStatus());
}


public AdaptStateChangeEvent getPassEvent(Integer status) {
AdaptStateChangeEvent event = AdaptStateChangeEvent.getPassValueByCode(status);
if (Objects.isNull(event)) {
throw new BizException("该状态下没有对应的通过操作!");
}
return event;
}

public AdaptStateChangeEvent getRejectEvent(Integer status) {
AdaptStateChangeEvent event = AdaptStateChangeEvent.getRejectValueByCode(status);
if (Objects.isNull(event)) {
throw new BizException("该状态下没有对应的驳回操作!");
}
return event;
}

public AdaptStateChangeEvent getWithdrawEvent(Integer status) {
AdaptStateChangeEvent event = AdaptStateChangeEvent.getWithdrawValueByCode(status);
if (Objects.isNull(event)) {
throw new BizException("该状态下没有对应的撤回操作!");
}
return event;
}

}

+ 77
- 0
hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/util/ProjectStateMachineUtil.java Прегледај датотеку

@@ -0,0 +1,77 @@
package com.hz.pm.api.common.statemachine.util;

import com.hz.pm.api.common.model.constant.StateMachineConst;
import com.hz.pm.api.common.statemachine.builder.impl.ProjectStateMachineBuilderImpl;
import com.hz.pm.api.common.statemachine.event.ProjectStateChangeEvent;
import com.hz.pm.api.projectlib.model.entity.Project;
import com.hz.pm.api.projectlib.model.entity.ProjectStatusChange;
import com.hz.pm.api.projectlib.model.enumeration.ProjectStatusEnum;
import com.hz.pm.api.projectlib.service.IProjectApplicationService;
import com.hz.pm.api.projectlib.service.IProjectStatusChangeService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.messaging.Message;
import org.springframework.messaging.support.MessageBuilder;
import org.springframework.statemachine.StateMachine;
import org.springframework.statemachine.persist.StateMachinePersister;
import org.springframework.stereotype.Component;

import java.time.LocalDateTime;
import java.util.function.Function;

/**
* 状态机工具类
*
* @author CMM
* @since 2023/02/07 22:49
*/
@Slf4j
@Component
@RequiredArgsConstructor
public class ProjectStateMachineUtil implements AbstractStateMachineUtil<Project, ProjectStateChangeEvent> {

private static final String PROJECT_DECLARE = StateMachineConst.PROJECT_DECLARE;

private static final String APPLICATION_DECLARE = StateMachineConst.APPLICATION_DECLARE;

//==================================================================================================================

private final ProjectStateMachineBuilderImpl projectStateMachineBuilder;

private final IProjectStatusChangeService projectStatusChangeService;

private final IProjectApplicationService projectApplicationService;

@Override
public Function<Project, Integer> statusFunction() {
return Project::getStatus;
}

@Override
public void execute(Project project, ProjectStateChangeEvent event) throws Exception {
log.info("调用状态机前的项目状态为:{}", project.getStatus());
// 将状态变更记录保存到项目状态变更表中
ProjectStatusChange projectStatusChange = new ProjectStatusChange();
projectStatusChange.setBeforeStatus(project.getStatus());

// 获取TO状态机
StateMachine<ProjectStatusEnum, ProjectStateChangeEvent> stateMachine = projectStateMachineBuilder.build();
Message<ProjectStateChangeEvent> message = MessageBuilder.withPayload(event)
.setHeader(PROJECT_DECLARE, project)
.setHeader(APPLICATION_DECLARE, projectApplicationService.getApplicationsByProject(project))
.build();
//初始化状态机
StateMachinePersister<ProjectStatusEnum, ProjectStateChangeEvent, Project> projectDeclareStateMachinePersister = projectStateMachineBuilder.stateMachinePersister();
projectDeclareStateMachinePersister.restore(stateMachine, project);
stateMachine.sendEvent(message);
projectStatusChange.setProjectId(project.getId());
projectStatusChange.setAfterStatus(project.getStatus());
projectStatusChange.setEvent(event.name());
projectStatusChange.setCreateOn(LocalDateTime.now());
projectStatusChange.setProjectCode(project.getProjectCode());
// 插入项目状态变更表中
projectStatusChangeService.save(projectStatusChange);
log.info("调用状态机后的项目状态为:{}", project.getStatus());
}

}

+ 8
- 60
hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/util/SelfTestStateMachineUtil.java Прегледај датотеку

@@ -1,15 +1,12 @@
package com.hz.pm.api.common.statemachine.util;

import com.hz.pm.api.common.statemachine.builder.SelfTestStateMachineBuilder;
import com.hz.pm.api.common.statemachine.builder.impl.SelfTestStateMachineBuilderImpl;
import com.hz.pm.api.common.statemachine.event.SelfTestStateChangeEvent;
import com.hz.pm.api.projectdeclared.model.entity.Purchase;
import com.hz.pm.api.projectdeclared.utils.ProjectIdCodeCacheUtil;
import com.hz.pm.api.projectlib.entity.PurchaseStatusChange;
import com.hz.pm.api.projectlib.model.enumeration.InstTypeEnum;
import com.hz.pm.api.projectlib.model.enumeration.TenderSelfTestStatusEnum;
import com.hz.pm.api.projectlib.service.IPurchaseStatusChangeService;
import com.ningdatech.basic.exception.BizException;
import com.wflow.exception.BusinessException;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.messaging.Message;
@@ -19,7 +16,7 @@ import org.springframework.statemachine.persist.StateMachinePersister;
import org.springframework.stereotype.Component;

import java.time.LocalDateTime;
import java.util.Objects;
import java.util.function.Function;

/**
* <p>
@@ -32,45 +29,21 @@ import java.util.Objects;
@Slf4j
@Component
@RequiredArgsConstructor
public class SelfTestStateMachineUtil {
public class SelfTestStateMachineUtil implements AbstractStateMachineUtil<Purchase, SelfTestStateChangeEvent> {

public static final String PURCHASE = "purchaseInfo";

//==================================================================================================================

private final SelfTestStateMachineBuilder selfTestStateMachineBuilder;
private final SelfTestStateMachineBuilderImpl selfTestStateMachineBuilder;
private final IPurchaseStatusChangeService purchaseStatusChangeService;

//通过审核
public void pass(Purchase purchase) {
try {
execute(purchase, getPassEvent(purchase.getSelfTestStatus()));
} catch (Exception e) {
log.info("状态机 通过失败 :{}", e.getMessage());
throw new BusinessException("状态机 通过失败: " + e);
}
}

//拒绝
public void reject(Purchase purchase) {
try {
execute(purchase, getRejectEvent(purchase.getSelfTestStatus()));
} catch (Exception e) {
log.info("状态机 拒绝失败 :{}", e.getMessage());
throw new BusinessException("状态机 拒绝失败: " + e);
}
}

//撤回
public void withDraw(Purchase purchase) {
try {
execute(purchase, getWithdrawEvent(purchase.getSelfTestStatus()));
} catch (Exception e) {
log.info("状态机 撤回失败 :{}", e.getMessage());
throw new BusinessException("状态机 撤回失败: " + e);
}
@Override
public Function<Purchase, Integer> statusFunction() {
return Purchase::getSelfTestStatus;
}

@Override
public void execute(Purchase purchase, SelfTestStateChangeEvent event) throws Exception {
log.info("调用状态机前的标段状态为:{}", purchase.getSelfTestStatus());
// 获取TO状态机
@@ -94,29 +67,4 @@ public class SelfTestStateMachineUtil {
log.info("调用状态机后的标段状态为:{}", purchase.getSelfTestStatus());
}


public SelfTestStateChangeEvent getPassEvent(Integer status) {
SelfTestStateChangeEvent event = SelfTestStateChangeEvent.getPassValueByCode(status);
if (Objects.isNull(event)) {
throw new BizException("该状态下没有对应的通过操作!");
}
return event;
}

public SelfTestStateChangeEvent getRejectEvent(Integer status) {
SelfTestStateChangeEvent event = SelfTestStateChangeEvent.getRejectValueByCode(status);
if (Objects.isNull(event)) {
throw new BizException("该状态下没有对应的驳回操作!");
}
return event;
}

public SelfTestStateChangeEvent getWithdrawEvent(Integer status) {
SelfTestStateChangeEvent event = SelfTestStateChangeEvent.getWithdrawValueByCode(status);
if (Objects.isNull(event)) {
throw new BizException("该状态下没有对应的撤回操作!");
}
return event;
}

}

+ 0
- 140
hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/util/StateMachineUtil.java Прегледај датотеку

@@ -1,140 +0,0 @@
package com.hz.pm.api.common.statemachine.util;

import com.hz.pm.api.common.model.constant.StateMachineConst;
import com.hz.pm.api.common.statemachine.builder.ProjectDeclareStateMachineBuilder;
import com.hz.pm.api.common.statemachine.event.ProjectStatusChangeEvent;
import com.hz.pm.api.projectlib.model.entity.Project;
import com.hz.pm.api.projectlib.model.entity.ProjectStatusChange;
import com.hz.pm.api.projectlib.model.enumeration.ProjectStatusEnum;
import com.hz.pm.api.projectlib.service.IProjectStatusChangeService;
import com.hz.pm.api.projectlib.service.IProjectApplicationService;
import com.ningdatech.basic.exception.BizException;
import com.wflow.exception.BusinessException;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.messaging.Message;
import org.springframework.messaging.support.MessageBuilder;
import org.springframework.statemachine.StateMachine;
import org.springframework.statemachine.persist.StateMachinePersister;
import org.springframework.stereotype.Component;

import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.Objects;

/**
* 状态机工具类
*
* @author CMM
* @since 2023/02/07 22:49
*/
@Slf4j
@Component
@RequiredArgsConstructor
public class StateMachineUtil {

private static final String PROJECT_DECLARE = StateMachineConst.PROJECT_DECLARE;

private static final String APPLICATION_DECLARE = StateMachineConst.APPLICATION_DECLARE;

//==================================================================================================================

private final ProjectDeclareStateMachineBuilder projectDeclareStateMachineBuilder;

private final IProjectStatusChangeService projectStatusChangeService;

private final IProjectApplicationService projectApplicationService;

//通过审核
public void pass(Project project) {
try {
execute(project, getProjectStatusPassEvent(project.getStatus()));
} catch (Exception e) {
log.info("状态机 通过失败 :{}", e.getMessage());
throw new BusinessException("状态机 通过失败: " + e);
}
}

//拒绝
public void reject(Project project) {
try {
execute(project, getProjectStatusRejectEvent(project.getStatus()));
} catch (Exception e) {
log.info("状态机 拒绝失败 :{}", e.getMessage());
throw new BusinessException("状态机 拒绝失败: " + e);
}
}

//撤回
public void withDraw(Project project) {
try {
execute(project, getProjectStatusWithdrawEvent(project.getStatus()));
} catch (Exception e) {
log.info("状态机 撤回失败 :{}", e.getMessage());
throw new BusinessException("状态机 撤回失败: " + e);
}
}

public void execute(Project project, ProjectStatusChangeEvent event) throws Exception {
log.info("调用状态机前的项目状态为:{}", project.getStatus());
// 将状态变更记录保存到项目状态变更表中
ProjectStatusChange projectStatusChange = new ProjectStatusChange();
projectStatusChange.setBeforeStatus(project.getStatus());

// 获取TO状态机
StateMachine<ProjectStatusEnum, ProjectStatusChangeEvent> stateMachine = projectDeclareStateMachineBuilder.build();
Message<ProjectStatusChangeEvent> message = MessageBuilder.withPayload(event)
.setHeader(PROJECT_DECLARE, project)
.setHeader(APPLICATION_DECLARE, projectApplicationService.getApplicationsByProject(project))
.build();
//初始化状态机
StateMachinePersister<ProjectStatusEnum, ProjectStatusChangeEvent, Project> projectDeclareStateMachinePersister = projectDeclareStateMachineBuilder.getProjectPersister();
projectDeclareStateMachinePersister.restore(stateMachine, project);
stateMachine.sendEvent(message);
projectStatusChange.setProjectId(project.getId());
projectStatusChange.setAfterStatus(project.getStatus());
projectStatusChange.setEvent(event.name());
projectStatusChange.setCreateOn(LocalDateTime.now());
projectStatusChange.setProjectCode(project.getProjectCode());
// 插入项目状态变更表中
projectStatusChangeService.save(projectStatusChange);
log.info("调用状态机后的项目状态为:{}", project.getStatus());
}

/**
* 判断项目申报金额是否大于1000万元
*
* @param project \
* @return boolean
* @since 2023/02/07 17:13
*/
public static boolean judgeDeclareAmount(Project project, BigDecimal targetAmount) {
int flag = project.getDeclareAmount().compareTo(targetAmount);
return flag > 0 || flag == 0;
}

public ProjectStatusChangeEvent getProjectStatusPassEvent(Integer status) {
ProjectStatusChangeEvent event = ProjectStatusChangeEvent.getPassValueByCode(status);
if (Objects.isNull(event)) {
throw new BizException("该状态下没有对应的通过操作!");
}
return event;
}

public ProjectStatusChangeEvent getProjectStatusRejectEvent(Integer status) {
ProjectStatusChangeEvent event = ProjectStatusChangeEvent.getRejectValueByCode(status);
if (Objects.isNull(event)) {
throw new BizException("该状态下没有对应的驳回操作!");
}
return event;
}

public ProjectStatusChangeEvent getProjectStatusWithdrawEvent(Integer status) {
ProjectStatusChangeEvent event = ProjectStatusChangeEvent.getWithdrawValueByCode(status);
if (Objects.isNull(event)) {
throw new BizException("该状态下没有对应的撤回操作!");
}
return event;
}

}

+ 15
- 66
hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/util/TenderStateMachineUtil.java Прегледај датотеку

@@ -1,14 +1,12 @@
package com.hz.pm.api.common.statemachine.util;

import com.hz.pm.api.common.statemachine.builder.TenderStateMachineBuilder;
import com.hz.pm.api.common.statemachine.event.TenderStatusChangeEvent;
import com.hz.pm.api.common.statemachine.builder.impl.TenderStateMachineBuilderImpl;
import com.hz.pm.api.common.statemachine.event.TenderStateChangeEvent;
import com.hz.pm.api.projectdeclared.model.entity.Purchase;
import com.hz.pm.api.projectdeclared.utils.ProjectIdCodeCacheUtil;
import com.hz.pm.api.projectlib.entity.PurchaseStatusChange;
import com.hz.pm.api.projectlib.model.enumeration.TenderStatusEnum;
import com.hz.pm.api.projectlib.service.IPurchaseStatusChangeService;
import com.ningdatech.basic.exception.BizException;
import com.wflow.exception.BusinessException;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.messaging.Message;
@@ -18,7 +16,7 @@ import org.springframework.statemachine.persist.StateMachinePersister;
import org.springframework.stereotype.Component;

import java.time.LocalDateTime;
import java.util.Objects;
import java.util.function.Function;

/**
* <p>
@@ -31,91 +29,42 @@ import java.util.Objects;
@Slf4j
@Component
@RequiredArgsConstructor
public class TenderStateMachineUtil {
public class TenderStateMachineUtil implements AbstractStateMachineUtil<Purchase, TenderStateChangeEvent> {

public static final String PURCHASE = "purchaseInfo";

//==================================================================================================================

private final TenderStateMachineBuilder tenderStateMachineBuilder;
private final TenderStateMachineBuilderImpl tenderStateMachineBuilder;
private final IPurchaseStatusChangeService purchaseStatusChangeService;

//通过审核
public void pass(Purchase purchase) {
try {
execute(purchase, getPassEvent(purchase.getStatus()));
} catch (Exception e) {
log.info("状态机 通过失败 :{}", e.getMessage());
throw new BusinessException("状态机 通过失败: " + e);
}
@Override
public Function<Purchase, Integer> statusFunction() {
return Purchase::getStatus;
}

//拒绝
public void reject(Purchase purchase) {
try {
execute(purchase, getRejectEvent(purchase.getStatus()));
} catch (Exception e) {
log.info("状态机 拒绝失败 :{}", e.getMessage());
throw new BusinessException("状态机 拒绝失败: " + e);
}
}

//撤回
public void withDraw(Purchase purchase) {
try {
execute(purchase, getWithdrawEvent(purchase.getStatus()));
} catch (Exception e) {
log.info("状态机 撤回失败 :{}", e.getMessage());
throw new BusinessException("状态机 撤回失败: " + e);
}
}

public void execute(Purchase purchase, TenderStatusChangeEvent event) throws Exception {
@Override
public void execute(Purchase purchase, TenderStateChangeEvent event) throws Exception {
log.info("调用状态机前的标段状态为:{}", purchase.getStatus());
// 获取TO状态机
PurchaseStatusChange change = new PurchaseStatusChange();
change.setBeforeStatus(purchase.getAdaptStatus());
change.setBeforeStatus(purchase.getStatus());
change.setEvent(event.name());
change.setBidId(purchase.getId());
change.setProjectId(purchase.getProjectId());
change.setProjectCode(ProjectIdCodeCacheUtil.get(purchase.getProjectId()));
change.setCreateOn(LocalDateTime.now());
StateMachine<TenderStatusEnum, TenderStatusChangeEvent> stateMachine = tenderStateMachineBuilder.build();
Message<TenderStatusChangeEvent> message = MessageBuilder.withPayload(event)
StateMachine<TenderStatusEnum, TenderStateChangeEvent> stateMachine = tenderStateMachineBuilder.build();
Message<TenderStateChangeEvent> message = MessageBuilder.withPayload(event)
.setHeader(PURCHASE, purchase)
.build();
//初始化状态机
StateMachinePersister<TenderStatusEnum, TenderStatusChangeEvent, Purchase> stateMachinePersister = tenderStateMachineBuilder.stateMachinePersister();
StateMachinePersister<TenderStatusEnum, TenderStateChangeEvent, Purchase> stateMachinePersister = tenderStateMachineBuilder.stateMachinePersister();
stateMachinePersister.restore(stateMachine, purchase);
stateMachine.sendEvent(message);
change.setAfterStatus(purchase.getAdaptStatus());
change.setAfterStatus(purchase.getStatus());
purchaseStatusChangeService.save(change);
log.info("调用状态机后的标段状态为:{}", purchase.getStatus());
}


public TenderStatusChangeEvent getPassEvent(Integer status) {
TenderStatusChangeEvent event = TenderStatusChangeEvent.getPassValueByCode(status);
if (Objects.isNull(event)) {
throw new BizException("该状态下没有对应的通过操作!");
}
return event;
}

public TenderStatusChangeEvent getRejectEvent(Integer status) {
TenderStatusChangeEvent event = TenderStatusChangeEvent.getRejectValueByCode(status);
if (Objects.isNull(event)) {
throw new BizException("该状态下没有对应的驳回操作!");
}
return event;
}

public TenderStatusChangeEvent getWithdrawEvent(Integer status) {
TenderStatusChangeEvent event = TenderStatusChangeEvent.getWithdrawValueByCode(status);
if (Objects.isNull(event)) {
throw new BizException("该状态下没有对应的撤回操作!");
}
return event;
}

}

+ 8
- 60
hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/util/TestValidStateMachineUtil.java Прегледај датотеку

@@ -1,15 +1,12 @@
package com.hz.pm.api.common.statemachine.util;

import com.hz.pm.api.common.statemachine.builder.TestValidStateMachineBuilder;
import com.hz.pm.api.common.statemachine.builder.impl.TestValidStateMachineBuilderImpl;
import com.hz.pm.api.common.statemachine.event.TestValidStateChangeEvent;
import com.hz.pm.api.projectdeclared.model.entity.Purchase;
import com.hz.pm.api.projectdeclared.utils.ProjectIdCodeCacheUtil;
import com.hz.pm.api.projectlib.entity.PurchaseStatusChange;
import com.hz.pm.api.projectlib.model.enumeration.InstTypeEnum;
import com.hz.pm.api.projectlib.model.enumeration.TenderTestValidStatusEnum;
import com.hz.pm.api.projectlib.service.IPurchaseStatusChangeService;
import com.ningdatech.basic.exception.BizException;
import com.wflow.exception.BusinessException;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.messaging.Message;
@@ -19,7 +16,7 @@ import org.springframework.statemachine.persist.StateMachinePersister;
import org.springframework.stereotype.Component;

import java.time.LocalDateTime;
import java.util.Objects;
import java.util.function.Function;

/**
* <p>
@@ -32,45 +29,21 @@ import java.util.Objects;
@Slf4j
@Component
@RequiredArgsConstructor
public class TestValidStateMachineUtil {
public class TestValidStateMachineUtil implements AbstractStateMachineUtil<Purchase, TestValidStateChangeEvent> {

public static final String PURCHASE = "purchaseInfo";

//==================================================================================================================

private final TestValidStateMachineBuilder testValidStateMachineBuilder;
private final TestValidStateMachineBuilderImpl testValidStateMachineBuilder;
private final IPurchaseStatusChangeService purchaseStatusChangeService;

//通过审核
public void pass(Purchase purchase) {
try {
execute(purchase, getPassEvent(purchase.getTestValidStatus()));
} catch (Exception e) {
log.info("状态机 通过失败 :{}", e.getMessage());
throw new BusinessException("状态机 通过失败: " + e);
}
}

//拒绝
public void reject(Purchase purchase) {
try {
execute(purchase, getRejectEvent(purchase.getTestValidStatus()));
} catch (Exception e) {
log.info("状态机 拒绝失败 :{}", e.getMessage());
throw new BusinessException("状态机 拒绝失败: " + e);
}
}

//撤回
public void withDraw(Purchase purchase) {
try {
execute(purchase, getWithdrawEvent(purchase.getTestValidStatus()));
} catch (Exception e) {
log.info("状态机 撤回失败 :{}", e.getMessage());
throw new BusinessException("状态机 撤回失败: " + e);
}
@Override
public Function<Purchase, Integer> statusFunction() {
return Purchase::getTestValidStatus;
}

@Override
public void execute(Purchase purchase, TestValidStateChangeEvent event) throws Exception {
log.info("调用状态机前的标段状态为:{}", purchase.getStatus());
// 获取TO状态机
@@ -94,29 +67,4 @@ public class TestValidStateMachineUtil {
log.info("调用状态机后的标段状态为:{}", purchase.getStatus());
}


public TestValidStateChangeEvent getPassEvent(Integer status) {
TestValidStateChangeEvent event = TestValidStateChangeEvent.getPassValueByCode(status);
if (Objects.isNull(event)) {
throw new BizException("该状态下没有对应的通过操作!");
}
return event;
}

public TestValidStateChangeEvent getRejectEvent(Integer status) {
TestValidStateChangeEvent event = TestValidStateChangeEvent.getRejectValueByCode(status);
if (Objects.isNull(event)) {
throw new BizException("该状态下没有对应的驳回操作!");
}
return event;
}

public TestValidStateChangeEvent getWithdrawEvent(Integer status) {
TestValidStateChangeEvent event = TestValidStateChangeEvent.getWithdrawValueByCode(status);
if (Objects.isNull(event)) {
throw new BizException("该状态下没有对应的撤回操作!");
}
return event;
}

}

+ 3
- 3
hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/ConstructionManage.java Прегледај датотеку

@@ -10,7 +10,7 @@ import com.google.common.collect.Lists;
import com.hz.pm.api.common.enumeration.ProjectProcessStageEnum;
import com.hz.pm.api.common.helper.UserInfoHelper;
import com.hz.pm.api.common.model.constant.BizConst;
import com.hz.pm.api.common.statemachine.util.StateMachineUtil;
import com.hz.pm.api.common.statemachine.util.ProjectStateMachineUtil;
import com.hz.pm.api.common.statemachine.util.TenderStateMachineUtil;
import com.hz.pm.api.common.util.DecimalUtil;
import com.hz.pm.api.common.util.ExcelDownUtil;
@@ -89,7 +89,7 @@ public class ConstructionManage {
private final DefaultDeclaredProjectManage defaultDeclaredProjectManage;
private final IPreInsAcceptancePersonService acceptancePersonService;
private final ProcessInstanceService processInstanceService;
private final StateMachineUtil stateMachineUtil;
private final ProjectStateMachineUtil projectStateMachineUtil;
private final IProjectAnnualPaymentPlanService projectPaymentPlanService;
private final TenderStateMachineUtil tenderStateMachineUtil;

@@ -560,7 +560,7 @@ public class ConstructionManage {
.last(BizConst.LIMIT_1);
if (purchaseService.count(purchaseQuery) == 0) {
Project project = projectService.getById(req.getProjectId());
stateMachineUtil.pass(project);
projectStateMachineUtil.pass(project);
projectService.updateById(project);
}
}


+ 6
- 8
hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/ConstructionPlanManage.java Прегледај датотеку

@@ -7,10 +7,9 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hz.pm.api.common.enumeration.CommonEnum;
import com.hz.pm.api.common.enumeration.ProjectProcessStageEnum;
import com.hz.pm.api.common.helper.UserInfoHelper;
import com.hz.pm.api.common.model.constant.BizConst;
import com.hz.pm.api.common.model.constant.CommonConst;
import com.hz.pm.api.common.statemachine.util.StateMachineUtil;
import com.hz.pm.api.common.statemachine.util.ProjectStateMachineUtil;
import com.hz.pm.api.common.util.ExcelDownUtil;
import com.hz.pm.api.common.util.ExcelExportStyle;
import com.hz.pm.api.projectdeclared.model.dto.ConstructionPlanExportDTO;
@@ -46,7 +45,6 @@ import com.wflow.exception.BusinessException;
import com.wflow.workflow.bean.dto.OrgInfoDTO;
import com.wflow.workflow.bean.vo.ProcessStartParamsVo;
import com.wflow.workflow.service.ProcessInstanceService;
import com.wflow.workflow.service.ProcessModelService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
@@ -77,7 +75,7 @@ public class ConstructionPlanManage {
private final ProcessModelManage processModelManage;
private final IProjectService projectService;
private final ProcessInstanceService processService;
private final StateMachineUtil stateMachineUtil;
private final ProjectStateMachineUtil projectStateMachineUtil;
private final IProjectInstService projectInstService;
private final ProjectLibManage projectLibManage;
private final DefaultDeclaredProjectManage declaredProjectManage;
@@ -136,8 +134,8 @@ public class ConstructionPlanManage {
//如果被禁用了的话 直接跳过 进入到下一个状态
if (Boolean.TRUE.equals(wflowModels.getIsStop())) {
//被禁用了 调2次状态机
stateMachineUtil.pass(constructProject);
stateMachineUtil.pass(constructProject);
projectStateMachineUtil.pass(constructProject);
projectStateMachineUtil.pass(constructProject);
constructProject.setUpdateOn(LocalDateTime.now());
projectService.updateById(constructProject);
return "因为建设方案流程被禁用了 直接跳过!";
@@ -171,7 +169,7 @@ public class ConstructionPlanManage {
}

private Project contructionPlanModifyProject(Project project, String instanceId) {
stateMachineUtil.pass(project);
projectStateMachineUtil.pass(project);
project.setUpdateOn(LocalDateTime.now());
project.setInstCode(instanceId);
projectService.updateById(project);
@@ -222,7 +220,7 @@ public class ConstructionPlanManage {
project.setInstCode(instanceId);
project.setConstructionPlanFile(constructionPlanFile);
//调用状态机 进入下一个通过状态
stateMachineUtil.pass(project);
projectStateMachineUtil.pass(project);
projectService.updateById(project);

//保存项目和实例的关系


+ 3
- 7
hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/FinalAcceptanceManage.java Прегледај датотеку

@@ -1,7 +1,6 @@
package com.hz.pm.api.projectdeclared.manage;

import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.ArrayUtil;
import com.alibaba.excel.EasyExcel;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Assert;
@@ -10,12 +9,10 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.google.common.collect.Lists;
import com.hz.pm.api.common.enumeration.ProjectProcessStageEnum;
import com.hz.pm.api.common.helper.UserInfoHelper;
import com.hz.pm.api.common.model.constant.BizConst;
import com.hz.pm.api.common.statemachine.util.StateMachineUtil;
import com.hz.pm.api.common.statemachine.util.ProjectStateMachineUtil;
import com.hz.pm.api.common.statemachine.util.TenderStateMachineUtil;
import com.hz.pm.api.common.util.ExcelDownUtil;
import com.hz.pm.api.common.util.ExcelExportStyle;
import com.hz.pm.api.common.util.StrUtils;
import com.hz.pm.api.projectdeclared.model.dto.DeclaredProjectExportDTO;
import com.hz.pm.api.projectdeclared.model.entity.Contract;
import com.hz.pm.api.projectdeclared.model.entity.Purchase;
@@ -52,7 +49,6 @@ import com.wflow.exception.BusinessException;
import com.wflow.workflow.bean.dto.OrgInfoDTO;
import com.wflow.workflow.bean.vo.ProcessStartParamsVo;
import com.wflow.workflow.service.ProcessInstanceService;
import com.wflow.workflow.service.ProcessModelService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
@@ -86,7 +82,7 @@ public class FinalAcceptanceManage {
private final DefaultDeclaredProjectManage declaredProjectManage;
private final IContractService contractService;
private final IProjectAnnualPaymentPlanService projectAnnualPaymentPlanService;
private final StateMachineUtil stateMachineUtil;
private final ProjectStateMachineUtil projectStateMachineUtil;
private final TenderStateMachineUtil tenderStateMachineUtil;
private final IProjectInstService projectInstService;
private final HandlerManage handlerManage;
@@ -296,7 +292,7 @@ public class FinalAcceptanceManage {
List<PurchaseInst> currPurchaseInstList = purchaseInstService.list(purchaseInstQuery);
Set<Long> finalInspectedBidIds = CollUtils.fieldSet(currPurchaseInstList, PurchaseInst::getBidId);
if (finalInspectedBidIds.size() == purchases.size()) {
stateMachineUtil.pass(project);
projectStateMachineUtil.pass(project);
projectService.updateById(project);
}
}


+ 3
- 3
hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/OperationManage.java Прегледај датотеку

@@ -4,7 +4,7 @@ import cn.hutool.core.bean.BeanUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Assert;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.hz.pm.api.common.statemachine.util.StateMachineUtil;
import com.hz.pm.api.common.statemachine.util.ProjectStateMachineUtil;
import com.hz.pm.api.common.statemachine.util.TenderStateMachineUtil;
import com.hz.pm.api.projectdeclared.model.dto.OperationReq;
import com.hz.pm.api.projectdeclared.model.entity.Operation;
@@ -47,7 +47,7 @@ public class OperationManage {
private final IPurchaseService purchaseService;
private final IProjectService projectService;
private final TenderStateMachineUtil tenderStateMachineUtil;
private final StateMachineUtil stateMachineUtil;
private final ProjectStateMachineUtil projectStateMachineUtil;

/**
* 获取实施详情
@@ -102,7 +102,7 @@ public class OperationManage {
long operationCount = operationService.countByBidIds(purchaseMap.keySet());
if (operationCount == purchaseMap.size()) {
// 修改项目状态
stateMachineUtil.pass(project);
projectStateMachineUtil.pass(project);
projectService.updateById(project);
}
// 修改标段状态


+ 3
- 3
hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/PrequalificationDeclaredProjectManage.java Прегледај датотеку

@@ -6,7 +6,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.google.common.collect.Lists;
import com.hz.pm.api.common.enumeration.ProjectProcessStageEnum;
import com.hz.pm.api.common.helper.UserInfoHelper;
import com.hz.pm.api.common.statemachine.util.StateMachineUtil;
import com.hz.pm.api.common.statemachine.util.ProjectStateMachineUtil;
import com.hz.pm.api.common.util.ExcelDownUtil;
import com.hz.pm.api.common.util.ExcelExportStyle;
import com.hz.pm.api.projectdeclared.model.dto.DefaultDeclaredDTO;
@@ -73,7 +73,7 @@ public class PrequalificationDeclaredProjectManage {

private final ProjectLibManage projectLibManage;

private final StateMachineUtil stateMachineUtil;
private final ProjectStateMachineUtil projectStateMachineUtil;

private final IProjectStagingService projectStagingService;

@@ -119,7 +119,7 @@ public class PrequalificationDeclaredProjectManage {
if (StringUtils.isNotBlank(projectDto.getHigherLineSuperOrgReviewComments())) {
projectInfo.setHigherLineSuperOrgReviewComments(projectDto.getHigherLineSuperOrgReviewComments());
}
stateMachineUtil.pass(projectInfo);
projectStateMachineUtil.pass(projectInfo);
String instanceId;
//如果是省级部门 需要联审的(申报金额大于1000万 并且是市级项目)
if (ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS


+ 3
- 3
hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/PurchaseManage.java Прегледај датотеку

@@ -106,7 +106,7 @@ public class PurchaseManage {
private final IContractService contractService;
private final IPurchaseService purchaseService;
private final TenderStateMachineUtil tenderStateMachineUtil;
private final StateMachineUtil stateMachineUtil;
private final ProjectStateMachineUtil projectStateMachineUtil;
private final MhApiClient mhApiClient;
private final MhFileClient mhFileClient;
private final FileService fileService;
@@ -307,7 +307,7 @@ public class PurchaseManage {
});

if (purchaseService.saveOrUpdateBatch(purchaseEntities)) {
stateMachineUtil.pass(project);
projectStateMachineUtil.pass(project);
project.setUpdateOn(LocalDateTime.now());

// 获取总的成交时间及金额
@@ -369,7 +369,7 @@ public class PurchaseManage {
return purchase;
}).collect(Collectors.toList());
purchaseService.saveOrUpdateBatch(purchases);
stateMachineUtil.pass(project);
projectStateMachineUtil.pass(project);
projectService.updateById(project);
// 发布采购公告
mhApiClient.publishPurchaseNotice(notices);


+ 2
- 2
hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/req/TestValidListReq.java Прегледај датотеку

@@ -23,10 +23,10 @@ public class TestValidListReq extends PagePo {

private Integer status;

@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime createOnMin;

@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime createOnMax;

private Boolean display;


+ 42
- 0
hz-pm-api/src/main/java/com/hz/pm/api/projectlib/entity/PurchaseStatusChange.java Прегледај датотеку

@@ -0,0 +1,42 @@
package com.hz.pm.api.projectlib.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
* <p>
* 标段状态变更记录
* </p>
*
* @author WendyYang
* @since 2024-04-01
*/
@Data
@TableName("ND_PURCHASE_STATUS_CHANGE")
public class PurchaseStatusChange implements Serializable {

private static final long serialVersionUID = 1L;

@TableId(value = "ID", type = IdType.AUTO)
private Long id;

private Long projectId;

private Integer beforeStatus;

private Integer afterStatus;

private String event;

private LocalDateTime createOn;

private String projectCode;

private Long bidId;

}

+ 4
- 4
hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/AnnualPlanHandle.java Прегледај датотеку

@@ -4,7 +4,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.hz.pm.api.common.model.constant.BizConst;
import com.hz.pm.api.common.model.constant.CommonConst;
import com.hz.pm.api.common.statemachine.event.ProjectStatusChangeEvent;
import com.hz.pm.api.common.statemachine.event.ProjectStateChangeEvent;
import com.hz.pm.api.projectlib.model.enumeration.ProjectStatusEnum;
import com.hz.pm.api.projectlib.model.entity.Project;
import com.hz.pm.api.projectlib.model.entity.ProjectStatusChange;
@@ -82,7 +82,7 @@ public class AnnualPlanHandle extends AbstractProcessBusinessHandle {
.last(BizConst.LIMIT_1);
if (ProjectStatusEnum.IN_THE_ANNUAL_PLAN.getCode().equals(status)) {
// 根据部门联审通过的时间获取
pscQuery.eq(ProjectStatusChange::getEvent, ProjectStatusChangeEvent.DEPARTMENT_UNITED_REVIEW_PASS);
pscQuery.eq(ProjectStatusChange::getEvent, ProjectStateChangeEvent.DEPARTMENT_UNITED_REVIEW_PASS);
ProjectStatusChange projectStatusChange = projectStatusChangeService.getOne(pscQuery);
if (Objects.nonNull(projectStatusChange)) {
processDetailVO.setFinishTime(projectStatusChange.getCreateOn());
@@ -90,7 +90,7 @@ public class AnnualPlanHandle extends AbstractProcessBusinessHandle {
}
} else if (ProjectStatusEnum.BE_SUSPENDED.getCode().equals(status)) {
// 根据年度计划暂缓的时间获取
pscQuery.eq(ProjectStatusChange::getEvent, ProjectStatusChangeEvent.ANNUAL_PLAN_SUSPEND);
pscQuery.eq(ProjectStatusChange::getEvent, ProjectStateChangeEvent.ANNUAL_PLAN_SUSPEND);
ProjectStatusChange projectStatusChange = projectStatusChangeService.getOne(pscQuery);
if (Objects.nonNull(projectStatusChange)) {
processDetailVO.setFinishTime(projectStatusChange.getCreateOn());
@@ -98,7 +98,7 @@ public class AnnualPlanHandle extends AbstractProcessBusinessHandle {
}
} else {
// 根据开启方案申报的时间获取
pscQuery.eq(ProjectStatusChange::getEvent, ProjectStatusChangeEvent.ANNUAL_PLAN_PROJECT_OPEN_PLAN_DECLARE);
pscQuery.eq(ProjectStatusChange::getEvent, ProjectStateChangeEvent.ANNUAL_PLAN_PROJECT_OPEN_PLAN_DECLARE);
ProjectStatusChange projectStatusChange = projectStatusChangeService.getOne(pscQuery);
if (Objects.nonNull(projectStatusChange)) {
processDetailVO.setFinishTime(projectStatusChange.getCreateOn());


+ 2
- 2
hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/ArchivedHandle.java Прегледај датотеку

@@ -13,7 +13,7 @@ import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.hz.pm.api.common.model.constant.CommonConst;
import com.hz.pm.api.common.statemachine.event.ProjectStatusChangeEvent;
import com.hz.pm.api.common.statemachine.event.ProjectStateChangeEvent;
import com.hz.pm.api.projectlib.model.enumeration.ProjectStatusEnum;
import com.hz.pm.api.projectlib.model.entity.ProjectStatusChange;
import com.hz.pm.api.projectlib.service.IProjectStatusChangeService;
@@ -56,7 +56,7 @@ public class ArchivedHandle extends AbstractProcessBusinessHandle {
// 根据项目终验获取归档时间
ProjectStatusChange projectStatusChange = projectStatusChangeService.getOne(Wrappers.lambdaQuery(ProjectStatusChange.class)
.in(ProjectStatusChange::getProjectId, allVersionProjectIds)
.eq(ProjectStatusChange::getEvent, ProjectStatusChangeEvent.FINAL_ACCEPTANCE_PASS.name())
.eq(ProjectStatusChange::getEvent, ProjectStateChangeEvent.FINAL_ACCEPTANCE_PASS.name())
.orderByDesc(ProjectStatusChange::getCreateOn)
.last(BizConst.LIMIT_1));
if(Objects.nonNull(projectStatusChange)){


+ 0
- 6
hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/ProcessExecuteChainHandle.java Прегледај датотеку

@@ -1,18 +1,12 @@
package com.hz.pm.api.projectlib.handle;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.google.common.collect.Lists;
import com.hz.pm.api.common.model.constant.BizConst;
import com.hz.pm.api.common.model.constant.ProjectDeclareConst;
import com.hz.pm.api.common.enumeration.ProjectProcessStageEnum;
import com.hz.pm.api.common.statemachine.util.StateMachineUtil;
import com.hz.pm.api.projectlib.model.entity.Project;
import com.hz.pm.api.projectlib.service.IProjectService;
import com.hz.pm.api.sys.manage.ProcessModelManage;
import com.wflow.bean.entity.WflowModels;
import com.wflow.workflow.bean.vo.ProcessDetailVO;
import com.wflow.workflow.enums.StepStatusEnum;
import com.wflow.workflow.service.ProcessModelService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Component;



+ 7
- 7
hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/ProjectApprovalHandle.java Прегледај датотеку

@@ -1,7 +1,7 @@
package com.hz.pm.api.projectlib.handle;

import com.hz.pm.api.common.model.constant.CommonConst;
import com.hz.pm.api.common.statemachine.event.ProjectStatusChangeEvent;
import com.hz.pm.api.common.statemachine.event.ProjectStateChangeEvent;
import com.hz.pm.api.projectlib.model.entity.Project;
import com.hz.pm.api.projectlib.model.entity.ProjectStatusChange;
import com.hz.pm.api.projectlib.model.enumeration.ProjectStatusEnum;
@@ -58,9 +58,9 @@ public class ProjectApprovalHandle extends AbstractProcessBusinessHandle {
|| ProjectStatusEnum.DECLARED_APPROVED_TO_BE_RECORD.eq(status)
|| ProjectStatusEnum.DECLARED_APPROVED_RECORD_AUDITING.eq(status)) {
// 根据建设方案评审通过的时间获取
final List<ProjectStatusChangeEvent> events = Arrays.asList(ProjectStatusChangeEvent.PLAN_REVIEW_PASS,
ProjectStatusChangeEvent.DECLARED_RECORD_SUBMIT,
ProjectStatusChangeEvent.DECLARED_RECORD_RESUBMIT);
final List<ProjectStateChangeEvent> events = Arrays.asList(ProjectStateChangeEvent.PLAN_REVIEW_PASS,
ProjectStateChangeEvent.DECLARED_RECORD_SUBMIT,
ProjectStateChangeEvent.DECLARED_RECORD_RESUBMIT);
ProjectStatusChange projectStatusChange = projectStatusChangeService.getLastOne(allProjectIds, events);
if (projectStatusChange != null) {
processDetail.setFinishTime(projectStatusChange.getCreateOn());
@@ -68,9 +68,9 @@ public class ProjectApprovalHandle extends AbstractProcessBusinessHandle {
processDetail.setStepStatus(StepStatusEnum.ON_GOING);
} else {
// 取 状态机 改变状态时间
final List<ProjectStatusChangeEvent> events = Arrays.asList(ProjectStatusChangeEvent.PLAN_REVIEW_PASS,
ProjectStatusChangeEvent.DECLARED_RECORD_FAILED,
ProjectStatusChangeEvent.DECLARED_RECORD_PASS);
final List<ProjectStateChangeEvent> events = Arrays.asList(ProjectStateChangeEvent.PLAN_REVIEW_PASS,
ProjectStateChangeEvent.DECLARED_RECORD_FAILED,
ProjectStateChangeEvent.DECLARED_RECORD_PASS);
ProjectStatusChange projectStatusChange = projectStatusChangeService.getLastOne(allProjectIds, events);
if (Objects.nonNull(projectStatusChange)) {
processDetail.setFinishTime(projectStatusChange.getCreateOn());


+ 2
- 2
hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/ProjectPreliminaryInspectionHandle.java Прегледај датотеку

@@ -15,7 +15,7 @@ import org.springframework.stereotype.Component;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.ningdatech.basic.util.CollUtils;
import com.hz.pm.api.common.model.constant.CommonConst;
import com.hz.pm.api.common.statemachine.event.ProjectStatusChangeEvent;
import com.hz.pm.api.common.statemachine.event.ProjectStateChangeEvent;
import com.hz.pm.api.projectlib.model.enumeration.ProjectStatusEnum;
import com.hz.pm.api.projectlib.model.entity.ProjectStatusChange;
import com.hz.pm.api.projectlib.model.entity.Project;
@@ -76,7 +76,7 @@ public class ProjectPreliminaryInspectionHandle extends AbstractProcessBusinessH
// 根据初验备案的时间获取
ProjectStatusChange projectStatusChange = projectStatusChangeService.getOne(Wrappers.lambdaQuery(ProjectStatusChange.class)
.in(ProjectStatusChange::getProjectId, allVersionProjectIds)
.eq(ProjectStatusChange::getEvent, ProjectStatusChangeEvent.PRELIMINARY_ACCEPTANCE_PUT_ON_RECORD.name())
.eq(ProjectStatusChange::getEvent, ProjectStateChangeEvent.PRELIMINARY_ACCEPTANCE_PUT_ON_RECORD.name())
.orderByDesc(ProjectStatusChange::getCreateOn)
.last(BizConst.LIMIT_1));
if(Objects.nonNull(projectStatusChange)){


+ 2
- 2
hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/TenderPurchaseHandle.java Прегледај датотеку

@@ -3,7 +3,7 @@ package com.hz.pm.api.projectlib.handle;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.hz.pm.api.common.model.constant.BizConst;
import com.hz.pm.api.common.model.constant.CommonConst;
import com.hz.pm.api.common.statemachine.event.ProjectStatusChangeEvent;
import com.hz.pm.api.common.statemachine.event.ProjectStateChangeEvent;
import com.hz.pm.api.projectlib.model.enumeration.ProjectStatusEnum;
import com.hz.pm.api.projectlib.model.entity.Project;
import com.hz.pm.api.projectlib.model.entity.ProjectStatusChange;
@@ -74,7 +74,7 @@ public class TenderPurchaseHandle extends AbstractProcessBusinessHandle {
// 根据采购备案的时间获取
ProjectStatusChange projectStatusChange = projectStatusChangeService.getOne(Wrappers.lambdaQuery(ProjectStatusChange.class)
.in(ProjectStatusChange::getProjectId, allVersionProjectIds)
.eq(ProjectStatusChange::getEvent, ProjectStatusChangeEvent.SUBMIT_PURCHASE_NOTICE.name())
.eq(ProjectStatusChange::getEvent, ProjectStateChangeEvent.SUBMIT_PURCHASE_NOTICE.name())
.orderByDesc(ProjectStatusChange::getCreateOn)
.last(BizConst.LIMIT_1));
if (projectStatusChange != null) {


+ 2
- 2
hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/AnnualPlanLibManage.java Прегледај датотеку

@@ -17,7 +17,7 @@ import com.hz.pm.api.common.model.constant.CommonConst;
import com.hz.pm.api.common.enumeration.CommonEnum;
import com.hz.pm.api.common.helper.UserInfoHelper;
import com.hz.pm.api.common.model.entity.ExcelExportWriter;
import com.hz.pm.api.common.statemachine.util.StateMachineUtil;
import com.hz.pm.api.common.statemachine.util.ProjectStateMachineUtil;
import com.hz.pm.api.common.util.BizUtils;
import com.hz.pm.api.common.util.ExcelDownUtil;
import com.hz.pm.api.datascope.model.DataScopeDTO;
@@ -82,7 +82,7 @@ public class AnnualPlanLibManage {
private final IProjectService projectService;
private final MhUnitCache mhUnitCache;
private final IProjectApplicationService applicationService;
private final StateMachineUtil stateMachine;
private final ProjectStateMachineUtil stateMachine;
private final UserInfoHelper userInfoHelper;
private final IProjectRenewalFundDeclarationService projectRenewalFundDeclarationService;



+ 4
- 4
hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/DeclaredRecordManage.java Прегледај датотеку

@@ -15,7 +15,7 @@ import com.hz.pm.api.common.enumeration.CommonEnum;
import com.hz.pm.api.common.enumeration.ProjectProcessStageEnum;
import com.hz.pm.api.common.helper.UserInfoHelper;
import com.hz.pm.api.common.model.constant.TypeReferenceConst;
import com.hz.pm.api.common.statemachine.event.ProjectStatusChangeEvent;
import com.hz.pm.api.common.statemachine.event.ProjectStateChangeEvent;
import com.hz.pm.api.common.util.BizUtils;
import com.hz.pm.api.datascope.model.DataScopeDTO;
import com.hz.pm.api.datascope.utils.DataScopeUtil;
@@ -334,7 +334,7 @@ public class DeclaredRecordManage {
ProjectProcessStageEnum.PROJECT_RECORD_APPROVAL_PROCESS);
// 保存状态变更
saveProjectStatusChangeLog(ProjectStatusEnum.DECLARED_APPROVED_TO_BE_RECORD,
newProj, ProjectStatusChangeEvent.DECLARED_RECORD_SUBMIT);
newProj, ProjectStateChangeEvent.DECLARED_RECORD_SUBMIT);
if (Objects.nonNull(projectInfo.getDraftId())) {
//如果是草稿箱提交 删除对应的草稿箱
projectDraftService.removeById(projectInfo.getDraftId());
@@ -417,7 +417,7 @@ public class DeclaredRecordManage {
instType);
// 保存状态变更
saveProjectStatusChangeLog(ProjectStatusEnum.DECLARED_APPROVED_RECORD_FAILED,
newProj, ProjectStatusChangeEvent.DECLARED_RECORD_RESUBMIT);
newProj, ProjectStateChangeEvent.DECLARED_RECORD_RESUBMIT);
//发送给第一个审批人消息
noticeManage.sendFirstUser(newProj, model.getFormName(), instId,
WorkNoticeConst.PASS_MSG_TEMPLATE, MsgTypeEnum.PROJECT_REVIEW);
@@ -425,7 +425,7 @@ public class DeclaredRecordManage {
return instId;
}

private void saveProjectStatusChangeLog(ProjectStatusEnum beforeStatus, Project project, ProjectStatusChangeEvent event) {
private void saveProjectStatusChangeLog(ProjectStatusEnum beforeStatus, Project project, ProjectStateChangeEvent event) {
ProjectStatusChange change = new ProjectStatusChange();
change.setAfterStatus(project.getStatus());
change.setProjectId(project.getId());


+ 5
- 5
hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/ProjectLibManage.java Прегледај датотеку

@@ -20,7 +20,7 @@ import com.hz.pm.api.common.enumeration.ProjectProcessStageEnum;
import com.hz.pm.api.common.helper.UserInfoHelper;
import com.hz.pm.api.common.model.constant.CommonConst;
import com.hz.pm.api.common.model.entity.ExcelExportWriter;
import com.hz.pm.api.common.statemachine.util.StateMachineUtil;
import com.hz.pm.api.common.statemachine.util.ProjectStateMachineUtil;
import com.hz.pm.api.common.util.BizUtils;
import com.hz.pm.api.common.util.ExcelDownUtil;
import com.hz.pm.api.common.util.StrUtils;
@@ -127,7 +127,7 @@ public class ProjectLibManage {
private final IProjectApplicationService projectApplicationService;
private final ProjectCodeGenUtil projectCodeGenUtil;
private final IProjectInstService projectInstService;
private final StateMachineUtil stateMachineUtil;
private final ProjectStateMachineUtil projectStateMachineUtil;
private final INdProjectDelayApplyService projectDelayApplyService;
private final INdProjectApplyBorrowService projectApplyBorrowService;
private final IPurchaseService purchaseService;
@@ -1040,7 +1040,7 @@ public class ProjectLibManage {
project.setCreateOn(LocalDateTime.now());
project.setUpdateOn(LocalDateTime.now());
project.setIsBackReject(Boolean.FALSE);
stateMachineUtil.pass(project);
projectStateMachineUtil.pass(project);
projectService.save(project);

oldProject.setIsBackReject(Boolean.TRUE);
@@ -1180,7 +1180,7 @@ public class ProjectLibManage {
project.setIsBackReject(isBackReject);
//终验材料
project.setFinalAcceptanceMaterials(dto.getFinalAcceptanceMaterials());
stateMachineUtil.pass(project);
projectStateMachineUtil.pass(project);

oldProject.setIsBackReject(isBackReject);
projectService.updateById(oldProject);
@@ -1215,7 +1215,7 @@ public class ProjectLibManage {
project.setUpdateOn(LocalDateTime.now());
// 标识保存的项目信息是否为建设方案申报项目
project.setIsConstruct(Boolean.FALSE);
stateMachineUtil.pass(project);
projectStateMachineUtil.pass(project);

oldProject.setIsBackReject(Boolean.TRUE);
projectService.updateById(oldProject);


+ 16
- 0
hz-pm-api/src/main/java/com/hz/pm/api/projectlib/mapper/PurchaseStatusChangeMapper.java Прегледај датотеку

@@ -0,0 +1,16 @@
package com.hz.pm.api.projectlib.mapper;

import com.hz.pm.api.projectlib.entity.PurchaseStatusChange;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;

/**
* <p>
* Mapper 接口
* </p>
*
* @author WendyYang
* @since 2024-04-01
*/
public interface PurchaseStatusChangeMapper extends BaseMapper<PurchaseStatusChange> {

}

+ 5
- 0
hz-pm-api/src/main/java/com/hz/pm/api/projectlib/mapper/PurchaseStatusChangeMapper.xml Прегледај датотеку

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.hz.pm.api.projectlib.mapper.PurchaseStatusChangeMapper">

</mapper>

+ 5
- 5
hz-pm-api/src/main/java/com/hz/pm/api/projectlib/service/IProjectStatusChangeService.java Прегледај датотеку

@@ -5,7 +5,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.IService;
import com.hz.pm.api.common.model.constant.BizConst;
import com.hz.pm.api.common.statemachine.event.ProjectStatusChangeEvent;
import com.hz.pm.api.common.statemachine.event.ProjectStateChangeEvent;
import com.hz.pm.api.projectlib.model.entity.ProjectStatusChange;

import java.util.Collection;
@@ -20,7 +20,7 @@ import java.util.Collection;
*/
public interface IProjectStatusChangeService extends IService<ProjectStatusChange> {

default ProjectStatusChange getLastOne(ProjectStatusChangeEvent event, Long projectId) {
default ProjectStatusChange getLastOne(ProjectStateChangeEvent event, Long projectId) {
Wrapper<ProjectStatusChange> query = Wrappers.lambdaQuery(ProjectStatusChange.class)
.eq(ProjectStatusChange::getEvent, event)
.eq(ProjectStatusChange::getProjectId, projectId)
@@ -29,7 +29,7 @@ public interface IProjectStatusChangeService extends IService<ProjectStatusChang
return getOne(query);
}

default ProjectStatusChange getLastOne(ProjectStatusChangeEvent event, Collection<Long> projectIds) {
default ProjectStatusChange getLastOne(ProjectStateChangeEvent event, Collection<Long> projectIds) {
Wrapper<ProjectStatusChange> query = Wrappers.lambdaQuery(ProjectStatusChange.class)
.in(ProjectStatusChange::getProjectId, projectIds)
.eq(ProjectStatusChange::getEvent, event)
@@ -38,7 +38,7 @@ public interface IProjectStatusChangeService extends IService<ProjectStatusChang
return getOne(query);
}

default ProjectStatusChange getLastOne(Collection<Long> projectIds, Collection<ProjectStatusChangeEvent> events) {
default ProjectStatusChange getLastOne(Collection<Long> projectIds, Collection<ProjectStateChangeEvent> events) {
LambdaQueryWrapper<ProjectStatusChange> pscQuery = Wrappers.lambdaQuery(ProjectStatusChange.class)
.in(ProjectStatusChange::getProjectId, projectIds)
.in(ProjectStatusChange::getEvent, events)
@@ -47,7 +47,7 @@ public interface IProjectStatusChangeService extends IService<ProjectStatusChang
return getOne(pscQuery);
}

default ProjectStatusChange getLastOne(String projectCode, Collection<ProjectStatusChangeEvent> events) {
default ProjectStatusChange getLastOne(String projectCode, Collection<ProjectStateChangeEvent> events) {
LambdaQueryWrapper<ProjectStatusChange> pscQuery = Wrappers.lambdaQuery(ProjectStatusChange.class)
.eq(ProjectStatusChange::getProjectCode, projectCode)
.in(ProjectStatusChange::getEvent, events)


+ 16
- 0
hz-pm-api/src/main/java/com/hz/pm/api/projectlib/service/IPurchaseStatusChangeService.java Прегледај датотеку

@@ -0,0 +1,16 @@
package com.hz.pm.api.projectlib.service;

import com.hz.pm.api.projectlib.entity.PurchaseStatusChange;
import com.baomidou.mybatisplus.extension.service.IService;

/**
* <p>
* 服务类
* </p>
*
* @author WendyYang
* @since 2024-04-01
*/
public interface IPurchaseStatusChangeService extends IService<PurchaseStatusChange> {

}

+ 20
- 0
hz-pm-api/src/main/java/com/hz/pm/api/projectlib/service/impl/PurchaseStatusChangeServiceImpl.java Прегледај датотеку

@@ -0,0 +1,20 @@
package com.hz.pm.api.projectlib.service.impl;

import com.hz.pm.api.projectlib.entity.PurchaseStatusChange;
import com.hz.pm.api.projectlib.mapper.PurchaseStatusChangeMapper;
import com.hz.pm.api.projectlib.service.IPurchaseStatusChangeService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

/**
* <p>
* 服务实现类
* </p>
*
* @author WendyYang
* @since 2024-04-01
*/
@Service
public class PurchaseStatusChangeServiceImpl extends ServiceImpl<PurchaseStatusChangeMapper, PurchaseStatusChange> implements IPurchaseStatusChangeService {

}

+ 3
- 3
hz-pm-api/src/main/java/com/hz/pm/api/scheduler/listener/ProcessStartListener.java Прегледај датотеку

@@ -3,7 +3,7 @@ package com.hz.pm.api.scheduler.listener;
import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.hz.pm.api.common.model.constant.BizConst;
import com.hz.pm.api.common.statemachine.util.StateMachineUtil;
import com.hz.pm.api.common.statemachine.util.ProjectStateMachineUtil;
import com.hz.pm.api.projectlib.model.entity.Project;
import com.hz.pm.api.projectlib.model.entity.ProjectInst;
import com.hz.pm.api.projectlib.service.IProjectInstService;
@@ -38,7 +38,7 @@ public class ProcessStartListener {
private final HistoryService historyService;
private final IProjectInstService projectInstService;
private final IProjectService projectService;
private final StateMachineUtil stateMachineUtil;
private final ProjectStateMachineUtil projectStateMachineUtil;

@Async
@EventListener
@@ -80,7 +80,7 @@ public class ProcessStartListener {
//如果真的没有实时任务和历史任务 那么说明 该项目没有人审批 需要去调用状态机
Long projectId = projectInst.getProjectId();
Project project = projectService.getNewProject(projectId);
stateMachineUtil.pass(project);
projectStateMachineUtil.pass(project);
project.setUpdateOn(LocalDateTime.now());
projectService.updateById(project);
}


+ 3
- 3
hz-pm-api/src/main/java/com/hz/pm/api/scheduler/task/CheckProvincialReviewResultTask.java Прегледај датотеку

@@ -7,7 +7,7 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.hz.pm.api.common.model.constant.BizConst;
import com.hz.pm.api.common.model.constant.ProjectDeclareConst;
import com.hz.pm.api.common.model.constant.RegionConst;
import com.hz.pm.api.common.statemachine.util.StateMachineUtil;
import com.hz.pm.api.common.statemachine.util.ProjectStateMachineUtil;
import com.hz.pm.api.projectlib.model.enumeration.ProjectStatusEnum;
import com.hz.pm.api.projectlib.model.entity.Project;
import com.hz.pm.api.projectlib.service.IProjectService;
@@ -42,7 +42,7 @@ public class CheckProvincialReviewResultTask {
private final IJoinReviewProvincialBureauService reviewProvincialBureauService;

private final IProjectService projectService;
private final StateMachineUtil stateMachineUtil;
private final ProjectStateMachineUtil projectStateMachineUtil;

@Value("${hostname:}")
private String HOST_NAME;
@@ -96,7 +96,7 @@ public class CheckProvincialReviewResultTask {
//在省级联审 才调状态机 否则 只改变 联审结果
if(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS.getCode().equals(
project.getStatus())){
stateMachineUtil.pass(project);
projectStateMachineUtil.pass(project);
}
log.info("已经审批完成 进入下一状态");
}


+ 5
- 5
hz-pm-api/src/main/java/com/hz/pm/api/todocenter/manage/HandlerManage.java Прегледај датотеку

@@ -87,7 +87,7 @@ public class HandlerManage {
private final TaskService taskService;
private final HistoryService historyService;
private final IProjectService projectService;
private final StateMachineUtil stateMachineUtil;
private final ProjectStateMachineUtil projectStateMachineUtil;
private final ProcessInstanceService processInstanceService;
private final IProjectApplicationService projectApplicationService;
private final IProjectStagingService projectStagingService;
@@ -303,7 +303,7 @@ public class HandlerManage {
return;
}
if (wflowHelper.allInstancesFinished(instCodes)) {
stateMachineUtil.pass(project);
projectStateMachineUtil.pass(project);
projectService.updateById(project);
}
}
@@ -521,7 +521,7 @@ public class HandlerManage {
*/
public void updatePassProjectStatus(Long userId, Project project) {
try {
stateMachineUtil.pass(project);
projectStateMachineUtil.pass(project);
project.setUpdateOn(LocalDateTime.now());
project.setUpdateBy(userId);
projectService.updateById(project);
@@ -541,7 +541,7 @@ public class HandlerManage {
* @since 2023/02/08
*/
private void updateRejectProjectStatus(Long userId, Project project, Integer instType) {
stateMachineUtil.reject(project);
projectStateMachineUtil.reject(project);
project.setUpdateOn(LocalDateTime.now());
project.setUpdateBy(userId);
projectService.updateById(project);
@@ -579,7 +579,7 @@ public class HandlerManage {
//删除项目的实例信息
historyService.deleteHistoricProcessInstance(project.getInstCode());

stateMachineUtil.withDraw(project);
projectStateMachineUtil.withDraw(project);
project.setUpdateOn(LocalDateTime.now());
project.setUpdateBy(userId);
project.setInstCode(TodoCenterConst.Declared.NULL_INST_CODE);


+ 3
- 3
hz-pm-api/src/test/java/com/hz/pm/api/sys/project/ProjectStateTest.java Прегледај датотеку

@@ -3,7 +3,7 @@ package com.hz.pm.api.sys.project;
import cn.hutool.core.date.StopWatch;
import com.alibaba.fastjson.JSON;
import com.hz.pm.api.AppTests;
import com.hz.pm.api.common.statemachine.util.StateMachineUtil;
import com.hz.pm.api.common.statemachine.util.ProjectStateMachineUtil;
import com.hz.pm.api.projectlib.model.enumeration.ProjectStatusEnum;
import com.hz.pm.api.projectlib.model.entity.Project;
import com.hz.pm.api.projectlib.service.IProjectService;
@@ -20,7 +20,7 @@ import javax.annotation.Resource;
public class ProjectStateTest extends AppTests {

@Resource
private StateMachineUtil stateMachineUtil;
private ProjectStateMachineUtil projectStateMachineUtil;

@Resource
private IProjectService projectService;
@@ -37,7 +37,7 @@ public class ProjectStateTest extends AppTests {
project.setStage(ProjectStatusEnum.NOT_APPROVED.getCode());
project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode());
//调用状态机 进入下一个通过状态
stateMachineUtil.pass(project);
projectStateMachineUtil.pass(project);

stopWatch.stop();
System.out.println("调用状态机结束 :" + stopWatch.getTotalTimeSeconds());


Loading…
Откажи
Сачувај