Browse Source

增加用户组织树接口

tags/24080901
WendyYang 9 months ago
parent
commit
33c008dc40
62 changed files with 560 additions and 6075 deletions
  1. +2
    -3
      hz-pm-api/src/main/java/com/hz/pm/api/common/helper/impl/UserInfoHelperImpl.java
  2. +1
    -0
      hz-pm-api/src/main/java/com/hz/pm/api/common/model/constant/BizConst.java
  3. +1
    -1
      hz-pm-api/src/main/java/com/hz/pm/api/common/model/constant/RegionConst.java
  4. +3
    -3
      hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/HzProjectDeclareAction.java
  5. +2
    -2
      hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/ProjectDeclareAction.java
  6. +32
    -18
      hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/ProjectDeclareChoiceAction.java
  7. +0
    -279
      hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/ProjectDeclareJNAction.java
  8. +0
    -279
      hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/ProjectDeclareJYAction.java
  9. +0
    -279
      hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/ProjectDeclareKFBAction.java
  10. +0
    -279
      hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/ProjectDeclareLDAction.java
  11. +0
    -279
      hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/ProjectDeclareLQAction.java
  12. +0
    -279
      hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/ProjectDeclareQTAction.java
  13. +0
    -279
      hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/ProjectDeclareQYAction.java
  14. +0
    -287
      hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/ProjectDeclareSCAction.java
  15. +0
    -279
      hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/ProjectDeclareSYAction.java
  16. +0
    -280
      hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/ProjectDeclareYHAction.java
  17. +3
    -1
      hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/ProjectDeclareStateMachineBuilder.java
  18. +26
    -32
      hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/ProjectDeclareStateMachineBuilderImpl.java
  19. +0
    -284
      hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/ProjectDeclareStateMachineJNBuilder.java
  20. +0
    -285
      hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/ProjectDeclareStateMachineJYBuilder.java
  21. +0
    -285
      hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/ProjectDeclareStateMachineKFQBuilder.java
  22. +0
    -285
      hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/ProjectDeclareStateMachineLDBuilder.java
  23. +0
    -286
      hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/ProjectDeclareStateMachineLQBuilder.java
  24. +0
    -285
      hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/ProjectDeclareStateMachineQTBuilder.java
  25. +0
    -285
      hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/ProjectDeclareStateMachineQYBuilder.java
  26. +0
    -295
      hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/ProjectDeclareStateMachineSCBuilder.java
  27. +0
    -285
      hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/ProjectDeclareStateMachineSYBuilder.java
  28. +0
    -285
      hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/ProjectDeclareStateMachineYHBuilder.java
  29. +0
    -38
      hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/contant/RegionContant.java
  30. +0
    -57
      hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/util/MachineBuilderFounder.java
  31. +10
    -10
      hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/util/StateMachineUtil.java
  32. +2
    -2
      hz-pm-api/src/main/java/com/hz/pm/api/fiscal/controller/CompanyFiscalCodeController.java
  33. +16
    -20
      hz-pm-api/src/main/java/com/hz/pm/api/fiscal/manage/CompanyFiscalCodeManage.java
  34. +1
    -1
      hz-pm-api/src/main/java/com/hz/pm/api/fiscal/service/ICompanyFiscalCodeService.java
  35. +1
    -1
      hz-pm-api/src/main/java/com/hz/pm/api/fiscal/service/impl/CompanyFiscalCodeServiceImpl.java
  36. +7
    -2
      hz-pm-api/src/main/java/com/hz/pm/api/organization/controller/ProcDefController.java
  37. +84
    -77
      hz-pm-api/src/main/java/com/hz/pm/api/performance/manage/IndicatorConfigManage.java
  38. +0
    -3
      hz-pm-api/src/main/java/com/hz/pm/api/performance/model/dto/PerformanceIndicatorProjectTemplateSaveDTO.java
  39. +3
    -3
      hz-pm-api/src/main/java/com/hz/pm/api/portrait/controller/TagController.java
  40. +24
    -34
      hz-pm-api/src/main/java/com/hz/pm/api/portrait/manage/TagManage.java
  41. +1
    -9
      hz-pm-api/src/main/java/com/hz/pm/api/portrait/model/dto/TagDTO.java
  42. +3
    -5
      hz-pm-api/src/main/java/com/hz/pm/api/portrait/model/vo/TagVO.java
  43. +5
    -4
      hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/DeclaredProjectManage.java
  44. +8
    -2
      hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/ReviewChecklistManage.java
  45. +1
    -2
      hz-pm-api/src/main/java/com/hz/pm/api/projectlib/controller/ProjectRenewalFundDeclarationController.java
  46. +11
    -28
      hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/ProcessExecuteChainHandle.java
  47. +17
    -13
      hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/ProjectRenewalFundManage.java
  48. +0
    -3
      hz-pm-api/src/main/java/com/hz/pm/api/scheduler/task/CockpitStatsStatisticsTask.java
  49. +4
    -3
      hz-pm-api/src/main/java/com/hz/pm/api/sys/controller/FormController.java
  50. +5
    -3
      hz-pm-api/src/main/java/com/hz/pm/api/sys/controller/SysProcDefController.java
  51. +2
    -2
      hz-pm-api/src/main/java/com/hz/pm/api/sys/model/vo/WflowEarlyWarningRecordsVO.java
  52. +19
    -0
      hz-pm-api/src/main/java/com/hz/pm/api/user/controller/MhUnitController.java
  53. +94
    -0
      hz-pm-api/src/main/java/com/hz/pm/api/user/manage/MhUnitManage.java
  54. +8
    -18
      hz-pm-api/src/main/java/com/hz/pm/api/user/manage/UserInfoManage.java
  55. +41
    -0
      hz-pm-api/src/main/java/com/hz/pm/api/user/model/dto/MhUnitUserTreeDTO.java
  56. +16
    -0
      hz-pm-api/src/main/java/com/hz/pm/api/user/model/enumeration/UnitUserNodeType.java
  57. +23
    -0
      hz-pm-api/src/main/java/com/hz/pm/api/user/model/po/MhUnitListReq.java
  58. +20
    -0
      hz-pm-api/src/main/java/com/hz/pm/api/user/model/po/UserTreeReq.java
  59. +29
    -0
      hz-pm-api/src/main/java/com/hz/pm/api/user/model/vo/MhUnitListVO.java
  60. +14
    -0
      hz-pm-api/src/test/java/com/hz/pm/api/sys/service/IMenuServiceTest.java
  61. +18
    -15
      hz-pm-api/src/test/resources/application-dev.yml
  62. +3
    -1
      hz-pm-api/src/test/resources/security/auth-dev.yml

+ 2
- 3
hz-pm-api/src/main/java/com/hz/pm/api/common/helper/impl/UserInfoHelperImpl.java View File

@@ -77,12 +77,11 @@ public class UserInfoHelperImpl implements UserInfoHelper {
userFullInfo.setMhUserId(userInfo.getMhUserId());
userFullInfo.setIdentifier(userInfo.getRealName());
userFullInfo.setRealName(userInfo.getRealName());
userFullInfo.setMhUnitId(userFullInfo.getMhUnitId());
userFullInfo.setMhUnitName(userFullInfo.getMhUnitName());
userFullInfo.setMhUnitId(userInfo.getMhUnitId());
userFullInfo.setMhUnitName(userInfo.getMhUnitName());
userFullInfo.setUsername(userInfo.getRealName());
userFullInfo.setMobile(userInfo.getMobile());
userFullInfo.setAccountId(userInfo.getAccountId());

String available = userInfo.getAvailable();
if (StringUtils.isNotBlank(available)) {
userFullInfo.setAvailable(UserAvailableEnum.valueOf(available));


+ 1
- 0
hz-pm-api/src/main/java/com/hz/pm/api/common/model/constant/BizConst.java View File

@@ -65,6 +65,7 @@ public class BizConst {
* 浙江省的region_id
*/
public static final long ZJ_REGION_CODE = 330000L;

public static final String NINE_AREA_CODE_LAST = "000";

/**


+ 1
- 1
hz-pm-api/src/main/java/com/hz/pm/api/common/model/constant/RegionConst.java View File

@@ -25,7 +25,7 @@ public interface RegionConst {
//---------------------------------------地区编码(缩写RC)-------------------------------------------------------------

/**
* 丽水行政区划编码
* 杭州市行政区划编码
*/
String RC_HZ = "330100";
//丽水开发区


hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/ProjectDeclareSBJAction.java → hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/HzProjectDeclareAction.java View File

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

import com.hz.pm.api.common.model.constant.StateMachineConst;
import com.hz.pm.api.common.statemachine.contant.RegionContant;
import com.hz.pm.api.common.statemachine.builder.ProjectDeclareStateMachineBuilderImpl;
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;
@@ -17,8 +17,8 @@ import org.springframework.statemachine.annotation.WithStateMachine;
* @since 2023/02/08 13:48
*/
@Slf4j
@WithStateMachine(id = RegionContant.LS_SBJ_CODE)
public class ProjectDeclareSBJAction {
@WithStateMachine(id = ProjectDeclareStateMachineBuilderImpl.MACHINE_ID)
public class HzProjectDeclareAction {

private static final String PROJECT_DECLARE = StateMachineConst.PROJECT_DECLARE;


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

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

import com.hz.pm.api.common.model.constant.StateMachineConst;
import com.hz.pm.api.common.statemachine.contant.RegionContant;
import com.hz.pm.api.common.statemachine.builder.ProjectDeclareStateMachineBuilderImpl;
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;
@@ -17,7 +17,7 @@ import org.springframework.statemachine.annotation.WithStateMachine;
* @since 2023/02/08 13:48
*/
@Slf4j
@WithStateMachine(id = RegionContant.LS_SBJ_CODE)
@WithStateMachine(id = ProjectDeclareStateMachineBuilderImpl.MACHINE_ID)
public class ProjectDeclareAction {

private static final String PROJECT_DECLARE = StateMachineConst.PROJECT_DECLARE;


+ 32
- 18
hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/ProjectDeclareChoiceAction.java View File

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

import cn.hutool.core.collection.CollUtil;
import cn.hutool.json.JSONUtil;
import com.baomidou.mybatisplus.core.toolkit.Assert;
import com.hz.pm.api.common.model.constant.ProjectDeclareConst;
import com.hz.pm.api.common.model.constant.StateMachineConst;
import com.hz.pm.api.common.enumeration.CommonEnum;
@@ -32,7 +34,7 @@ public class ProjectDeclareChoiceAction implements Action<ProjectStatusEnum, Pro
public void execute(StateContext<ProjectStatusEnum, ProjectStatusChangeEvent> stateContext) {
log.info(String.valueOf(stateContext.getTarget().getId()));
ProjectStatusEnum projectStatusEnum = stateContext.getTarget().getId();
switch (projectStatusEnum){
switch (projectStatusEnum) {
case PENDING_PREQUALIFICATION_CHOICE:
preDeclareChoice(stateContext);
break;
@@ -48,49 +50,61 @@ public class ProjectDeclareChoiceAction implements Action<ProjectStatusEnum, Pro
}

private void approvedAfterChoice(StateContext<ProjectStatusEnum, ProjectStatusChangeEvent> stateContext) {
List<ProjectApplication> projectApplications = stateContext.getMessage().getHeaders().get(APPLICATION_DECLARE, List.class);
Project project = stateContext.getMessage().getHeaders().get(PROJECT_DECLARE, Project.class);
log.info("立项批复之后,项目的状态为:{}" + project.getStatus());
Project project = getProject(stateContext);
List<ProjectApplication> projectApplications = getProjectApplication(stateContext);
log.info("立项批复之后,项目的状态为:{}", project.getStatus());
// 判断 是否有初次创建的应用
if (CollUtil.isEmpty(projectApplications)){
if (CollUtil.isEmpty(projectApplications)) {
project.setStage(ProjectStatusEnum.PROJECT_APPROVED.getCode());
project.setStatus(ProjectStatusEnum.TO_BE_PURCHASED.getCode());
}
final Boolean[] isFirstApp = {Boolean.FALSE};
projectApplications.stream().forEach(app -> {
final boolean[] isFirstApp = {Boolean.FALSE};
projectApplications.forEach(app -> {
Integer isFirst = app.getIsFirst();
if(isFirst.equals(CommonEnum.YES.getCode())){
if (isFirst.equals(CommonEnum.YES.getCode())) {
isFirstApp[0] = Boolean.TRUE;
}
});
if(isFirstApp[0]){
if (isFirstApp[0]) {
project.setStage(ProjectStatusEnum.NOT_APPROVED.getCode());
project.setStatus(ProjectStatusEnum.TO_BE_APP_REGISTER.getCode());
}else{
} else {
project.setStage(ProjectStatusEnum.PROJECT_APPROVED.getCode());
project.setStatus(ProjectStatusEnum.TO_BE_PURCHASED.getCode());
}
}

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

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

private Project getProject(StateContext<ProjectStatusEnum, ProjectStatusChangeEvent> 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) {
return stateContext.getMessage().getHeaders().get(APPLICATION_DECLARE, List.class);
}

}

+ 0
- 279
hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/ProjectDeclareJNAction.java View File

@@ -1,279 +0,0 @@
package com.hz.pm.api.common.statemachine.action;

import com.hz.pm.api.common.model.constant.StateMachineConst;
import com.hz.pm.api.common.statemachine.contant.RegionContant;
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 lombok.extern.slf4j.Slf4j;
import org.springframework.messaging.Message;
import org.springframework.statemachine.annotation.OnTransition;
import org.springframework.statemachine.annotation.WithStateMachine;

/**
* 项目申报状态机action集合类
* 景宁畲族自治县
* @author CMM
* @since 2023/02/08 13:48
*/
@Slf4j
@WithStateMachine(id = RegionContant.LS_JN_CODE)
public class ProjectDeclareJNAction {

private static final String PROJECT_DECLARE = StateMachineConst.PROJECT_DECLARE;

@OnTransition(source = "UNDER_INTERNAL_AUDIT", target = "PENDING_PREQUALIFICATION")
public void UNDER_INTERNAL_PASS(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode());
}

@OnTransition(source = "UNDER_INTERNAL_AUDIT", target = "UNDER_INTERNAL_AUDIT_NOT_PASS")
public void UNDER_INTERNAL_REJECT(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS.getCode());
}

@OnTransition(source = "UNDER_INTERNAL_AUDIT", target = "TO_BE_DECLARED")
public void UNDER_INTERNAL_WITHDRAW(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.TO_BE_DECLARED.getCode());
}

@OnTransition(source = "UNDER_INTERNAL_AUDIT_NOT_PASS", target = "UNDER_INTERNAL_AUDIT")
public void UNDER_INTERNAL_REJECT_RESUBMIT(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT.getCode());
}


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

@OnTransition(source = "PENDING_PREQUALIFICATION", target = "UNDER_INTERNAL_AUDIT")
public void PENDING_PREQUALIFICATION_WITHDRAW(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT.getCode());
}


@OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS", target = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS")
public void PROVINCIAL_DEPARTMENT_REVIEW_PASS(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS.getCode());
}

@OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS", target = "PRE_APPLYING")
public void PROVINCIAL_PASS_TO_PRELIMINARY_REVIEW(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.PRE_APPLYING.getCode());
}

@OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS", target = "THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED")
public void PROVINCIAL_DEPARTMENT_REVIEW_REJECT(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED.getCode());
}

@OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS", target = "PENDING_PREQUALIFICATION")
public void JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_WITHDRAW(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode());
}

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

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

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

@OnTransition(source = "PRE_APPLYING", target = "PREQUALIFICATION_WITHDRAW_CHOICE")
public void PRE_APPLYING_WITHDRAW(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE.getCode());
}


@OnTransition(source = "DEPARTMENT_JOINT_REVIEW", target = "IN_THE_ANNUAL_PLAN")
public void DEPARTMENT_UNITED_REVIEW_PASS(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.IN_THE_ANNUAL_PLAN.getCode());
}

@OnTransition(source = "DEPARTMENT_JOINT_REVIEW", target = "DEPARTMENT_JOINT_REVIEW_FAILED")
public void DEPARTMENT_UNITED_REVIEW_REJECT(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW_FAILED.getCode());
}

@OnTransition(source = "DEPARTMENT_JOINT_REVIEW", target = "PRE_APPLYING")
public void DEPARTMENT_JOINT_REVIEW_WITHDRAW(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.PRE_APPLYING.getCode());
}


@OnTransition(source = "IN_THE_ANNUAL_PLAN", target = "PLAN_TO_BE_DECLARED")
public void ANNUAL_PLAN_PROJECT_OPEN_PLAN_DECLARE(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.PLAN_TO_BE_DECLARED.getCode());
}

@OnTransition(source = "IN_THE_ANNUAL_PLAN", target = "BE_SUSPENDED")
public void ANNUAL_PLAN_SUSPEND(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.BE_SUSPENDED.getCode());
}

@OnTransition(source = "IN_THE_ANNUAL_PLAN", target = "DEPARTMENT_JOINT_REVIEW")
public void IN_THE_ANNUAL_PLAN_WITHDRAW(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW.getCode());
}


@OnTransition(source = "PLAN_TO_BE_DECLARED", target = "SCHEME_UNDER_REVIEW")
public void DECLARE_PLAN(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode());
}

@OnTransition(source = "PLAN_TO_BE_DECLARED", target = "IN_THE_ANNUAL_PLAN")
public void PLAN_TO_DECLARE_WITHDRAW(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.IN_THE_ANNUAL_PLAN.getCode());
}

@OnTransition(source = "SCHEME_REVIEW_FAILED", target = "SCHEME_UNDER_REVIEW")
public void DECLARE_PLAN_RESUBMIT(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode());
}

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

@OnTransition(source = "SCHEME_UNDER_REVIEW", target = "SCHEME_REVIEW_FAILED")
public void PLAN_REVIEW_REJECT(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.SCHEME_REVIEW_FAILED.getCode());
}

@OnTransition(source = "SCHEME_REVIEW_FAILED", target = "SCHEME_UNDER_REVIEW")
public void PLAN_REVIEW_REJECT_RESUBMIT(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode());
}

@OnTransition(source = "SCHEME_UNDER_REVIEW", target = "PLAN_TO_BE_DECLARED")
public void SCHEME_UNDER_REVIEW_WITHDRAW(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.PLAN_TO_BE_DECLARED.getCode());
}


@OnTransition(source = "TO_BE_APPROVED", target = "TO_BE_PURCHASED")
public void PROJECT_APPROVAL(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
// 待立项批复批复后,项目一级状态变更为已立项
project.setStage(ProjectStatusEnum.PROJECT_APPROVED.getCode());
project.setStatus(ProjectStatusEnum.TO_BE_PURCHASED.getCode());
}

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


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

@OnTransition(source = "TO_BE_PURCHASED", target = "TO_BE_APPROVED")
public void TO_BE_PURCHASED_WITHDRAW(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
// 待采购状态撤回后,项目一级状态回退到未立项
project.setStage(ProjectStatusEnum.NOT_APPROVED.getCode());
project.setStatus(ProjectStatusEnum.TO_BE_APPROVED.getCode());
}


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

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


@OnTransition(source = "TO_BE_FINALLY_INSPECTED", target = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW")
public void FINAL_ACCEPTANCE_APPLICATION(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW.getCode());
}

@OnTransition(source = "TO_BE_FINALLY_INSPECTED", target = "UNDER_CONSTRUCTION")
public void TO_BE_FINALLY_INSPECTED_WITHDRAW(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.UNDER_CONSTRUCTION.getCode());
}


@OnTransition(source = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW", target = "ARCHIVED")
public void FINAL_ACCEPTANCE_PASS(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
// 终验审核通过后,项目一级状态变更为已归档
project.setStage(ProjectStatusEnum.ARCHIVED.getCode());
project.setStatus(ProjectStatusEnum.ACCEPTED.getCode());
}

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

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

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

+ 0
- 279
hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/ProjectDeclareJYAction.java View File

@@ -1,279 +0,0 @@
package com.hz.pm.api.common.statemachine.action;

import com.hz.pm.api.common.model.constant.StateMachineConst;
import com.hz.pm.api.common.statemachine.contant.RegionContant;
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 lombok.extern.slf4j.Slf4j;
import org.springframework.messaging.Message;
import org.springframework.statemachine.annotation.OnTransition;
import org.springframework.statemachine.annotation.WithStateMachine;

/**
* 项目申报状态机action集合类
* 缙云县
* @author CMM
* @since 2023/02/08 13:48
*/
@Slf4j
@WithStateMachine(id = RegionContant.LS_JY_CODE)
public class ProjectDeclareJYAction {

private static final String PROJECT_DECLARE = StateMachineConst.PROJECT_DECLARE;

@OnTransition(source = "UNDER_INTERNAL_AUDIT", target = "PENDING_PREQUALIFICATION")
public void UNDER_INTERNAL_PASS(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode());
}

@OnTransition(source = "UNDER_INTERNAL_AUDIT", target = "UNDER_INTERNAL_AUDIT_NOT_PASS")
public void UNDER_INTERNAL_REJECT(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS.getCode());
}

@OnTransition(source = "UNDER_INTERNAL_AUDIT", target = "TO_BE_DECLARED")
public void UNDER_INTERNAL_WITHDRAW(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.TO_BE_DECLARED.getCode());
}

@OnTransition(source = "UNDER_INTERNAL_AUDIT_NOT_PASS", target = "UNDER_INTERNAL_AUDIT")
public void UNDER_INTERNAL_REJECT_RESUBMIT(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT.getCode());
}


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

@OnTransition(source = "PENDING_PREQUALIFICATION", target = "UNDER_INTERNAL_AUDIT")
public void PENDING_PREQUALIFICATION_WITHDRAW(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT.getCode());
}


@OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS", target = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS")
public void PROVINCIAL_DEPARTMENT_REVIEW_PASS(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS.getCode());
}

@OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS", target = "PRE_APPLYING")
public void PROVINCIAL_PASS_TO_PRELIMINARY_REVIEW(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.PRE_APPLYING.getCode());
}

@OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS", target = "THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED")
public void PROVINCIAL_DEPARTMENT_REVIEW_REJECT(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED.getCode());
}

@OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS", target = "PENDING_PREQUALIFICATION")
public void JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_WITHDRAW(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode());
}

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

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

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

@OnTransition(source = "PRE_APPLYING", target = "PREQUALIFICATION_WITHDRAW_CHOICE")
public void PRE_APPLYING_WITHDRAW(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE.getCode());
}


@OnTransition(source = "DEPARTMENT_JOINT_REVIEW", target = "IN_THE_ANNUAL_PLAN")
public void DEPARTMENT_UNITED_REVIEW_PASS(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.IN_THE_ANNUAL_PLAN.getCode());
}

@OnTransition(source = "DEPARTMENT_JOINT_REVIEW", target = "DEPARTMENT_JOINT_REVIEW_FAILED")
public void DEPARTMENT_UNITED_REVIEW_REJECT(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW_FAILED.getCode());
}

@OnTransition(source = "DEPARTMENT_JOINT_REVIEW", target = "PRE_APPLYING")
public void DEPARTMENT_JOINT_REVIEW_WITHDRAW(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.PRE_APPLYING.getCode());
}


@OnTransition(source = "IN_THE_ANNUAL_PLAN", target = "PLAN_TO_BE_DECLARED")
public void ANNUAL_PLAN_PROJECT_OPEN_PLAN_DECLARE(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.PLAN_TO_BE_DECLARED.getCode());
}

@OnTransition(source = "IN_THE_ANNUAL_PLAN", target = "BE_SUSPENDED")
public void ANNUAL_PLAN_SUSPEND(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.BE_SUSPENDED.getCode());
}

@OnTransition(source = "IN_THE_ANNUAL_PLAN", target = "DEPARTMENT_JOINT_REVIEW")
public void IN_THE_ANNUAL_PLAN_WITHDRAW(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW.getCode());
}


@OnTransition(source = "PLAN_TO_BE_DECLARED", target = "SCHEME_UNDER_REVIEW")
public void DECLARE_PLAN(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode());
}

@OnTransition(source = "PLAN_TO_BE_DECLARED", target = "IN_THE_ANNUAL_PLAN")
public void PLAN_TO_DECLARE_WITHDRAW(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.IN_THE_ANNUAL_PLAN.getCode());
}

@OnTransition(source = "SCHEME_REVIEW_FAILED", target = "SCHEME_UNDER_REVIEW")
public void DECLARE_PLAN_RESUBMIT(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode());
}

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

@OnTransition(source = "SCHEME_UNDER_REVIEW", target = "SCHEME_REVIEW_FAILED")
public void PLAN_REVIEW_REJECT(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.SCHEME_REVIEW_FAILED.getCode());
}

@OnTransition(source = "SCHEME_REVIEW_FAILED", target = "SCHEME_UNDER_REVIEW")
public void PLAN_REVIEW_REJECT_RESUBMIT(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode());
}

@OnTransition(source = "SCHEME_UNDER_REVIEW", target = "PLAN_TO_BE_DECLARED")
public void SCHEME_UNDER_REVIEW_WITHDRAW(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.PLAN_TO_BE_DECLARED.getCode());
}


@OnTransition(source = "TO_BE_APPROVED", target = "TO_BE_PURCHASED")
public void PROJECT_APPROVAL(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
// 待立项批复批复后,项目一级状态变更为已立项
project.setStage(ProjectStatusEnum.PROJECT_APPROVED.getCode());
project.setStatus(ProjectStatusEnum.TO_BE_PURCHASED.getCode());
}

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

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

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

@OnTransition(source = "TO_BE_PURCHASED", target = "TO_BE_APPROVED")
public void TO_BE_PURCHASED_WITHDRAW(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
// 待采购状态撤回后,项目一级状态回退到未立项
project.setStage(ProjectStatusEnum.NOT_APPROVED.getCode());
project.setStatus(ProjectStatusEnum.TO_BE_APPROVED.getCode());
}


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

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


@OnTransition(source = "TO_BE_FINALLY_INSPECTED", target = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW")
public void FINAL_ACCEPTANCE_APPLICATION(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW.getCode());
}

@OnTransition(source = "TO_BE_FINALLY_INSPECTED", target = "UNDER_CONSTRUCTION")
public void TO_BE_FINALLY_INSPECTED_WITHDRAW(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.UNDER_CONSTRUCTION.getCode());
}


@OnTransition(source = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW", target = "ARCHIVED")
public void FINAL_ACCEPTANCE_PASS(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
// 终验审核通过后,项目一级状态变更为已归档
project.setStage(ProjectStatusEnum.ARCHIVED.getCode());
project.setStatus(ProjectStatusEnum.ACCEPTED.getCode());
}

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

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

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

+ 0
- 279
hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/ProjectDeclareKFBAction.java View File

@@ -1,279 +0,0 @@
package com.hz.pm.api.common.statemachine.action;

import com.hz.pm.api.common.model.constant.StateMachineConst;
import com.hz.pm.api.common.statemachine.contant.RegionContant;
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 lombok.extern.slf4j.Slf4j;
import org.springframework.messaging.Message;
import org.springframework.statemachine.annotation.OnTransition;
import org.springframework.statemachine.annotation.WithStateMachine;

/**
* 项目申报状态机action集合类
* 开发区
* @author CMM
* @since 2023/02/08 13:48
*/
@Slf4j
@WithStateMachine(id = RegionContant.LS_KFQ_CODE)
public class ProjectDeclareKFBAction {

private static final String PROJECT_DECLARE = StateMachineConst.PROJECT_DECLARE;

@OnTransition(source = "UNDER_INTERNAL_AUDIT", target = "PENDING_PREQUALIFICATION")
public void UNDER_INTERNAL_PASS(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode());
}

@OnTransition(source = "UNDER_INTERNAL_AUDIT", target = "UNDER_INTERNAL_AUDIT_NOT_PASS")
public void UNDER_INTERNAL_REJECT(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS.getCode());
}

@OnTransition(source = "UNDER_INTERNAL_AUDIT", target = "TO_BE_DECLARED")
public void UNDER_INTERNAL_WITHDRAW(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.TO_BE_DECLARED.getCode());
}

@OnTransition(source = "UNDER_INTERNAL_AUDIT_NOT_PASS", target = "UNDER_INTERNAL_AUDIT")
public void UNDER_INTERNAL_REJECT_RESUBMIT(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT.getCode());
}


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

@OnTransition(source = "PENDING_PREQUALIFICATION", target = "UNDER_INTERNAL_AUDIT")
public void PENDING_PREQUALIFICATION_WITHDRAW(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT.getCode());
}


@OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS", target = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS")
public void PROVINCIAL_DEPARTMENT_REVIEW_PASS(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS.getCode());
}

@OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS", target = "PRE_APPLYING")
public void PROVINCIAL_PASS_TO_PRELIMINARY_REVIEW(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.PRE_APPLYING.getCode());
}

@OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS", target = "THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED")
public void PROVINCIAL_DEPARTMENT_REVIEW_REJECT(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED.getCode());
}

@OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS", target = "PENDING_PREQUALIFICATION")
public void JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_WITHDRAW(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode());
}

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

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

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

@OnTransition(source = "PRE_APPLYING", target = "PREQUALIFICATION_WITHDRAW_CHOICE")
public void PRE_APPLYING_WITHDRAW(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE.getCode());
}


@OnTransition(source = "DEPARTMENT_JOINT_REVIEW", target = "IN_THE_ANNUAL_PLAN")
public void DEPARTMENT_UNITED_REVIEW_PASS(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.IN_THE_ANNUAL_PLAN.getCode());
}

@OnTransition(source = "DEPARTMENT_JOINT_REVIEW", target = "DEPARTMENT_JOINT_REVIEW_FAILED")
public void DEPARTMENT_UNITED_REVIEW_REJECT(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW_FAILED.getCode());
}

@OnTransition(source = "DEPARTMENT_JOINT_REVIEW", target = "PRE_APPLYING")
public void DEPARTMENT_JOINT_REVIEW_WITHDRAW(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.PRE_APPLYING.getCode());
}


@OnTransition(source = "IN_THE_ANNUAL_PLAN", target = "PLAN_TO_BE_DECLARED")
public void ANNUAL_PLAN_PROJECT_OPEN_PLAN_DECLARE(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.PLAN_TO_BE_DECLARED.getCode());
}

@OnTransition(source = "IN_THE_ANNUAL_PLAN", target = "BE_SUSPENDED")
public void ANNUAL_PLAN_SUSPEND(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.BE_SUSPENDED.getCode());
}

@OnTransition(source = "IN_THE_ANNUAL_PLAN", target = "DEPARTMENT_JOINT_REVIEW")
public void IN_THE_ANNUAL_PLAN_WITHDRAW(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW.getCode());
}


@OnTransition(source = "PLAN_TO_BE_DECLARED", target = "SCHEME_UNDER_REVIEW")
public void DECLARE_PLAN(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode());
}

@OnTransition(source = "PLAN_TO_BE_DECLARED", target = "IN_THE_ANNUAL_PLAN")
public void PLAN_TO_DECLARE_WITHDRAW(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.IN_THE_ANNUAL_PLAN.getCode());
}

@OnTransition(source = "SCHEME_REVIEW_FAILED", target = "SCHEME_UNDER_REVIEW")
public void DECLARE_PLAN_RESUBMIT(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode());
}

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

@OnTransition(source = "SCHEME_UNDER_REVIEW", target = "SCHEME_REVIEW_FAILED")
public void PLAN_REVIEW_REJECT(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.SCHEME_REVIEW_FAILED.getCode());
}

@OnTransition(source = "SCHEME_REVIEW_FAILED", target = "SCHEME_UNDER_REVIEW")
public void PLAN_REVIEW_REJECT_RESUBMIT(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode());
}

@OnTransition(source = "SCHEME_UNDER_REVIEW", target = "PLAN_TO_BE_DECLARED")
public void SCHEME_UNDER_REVIEW_WITHDRAW(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.PLAN_TO_BE_DECLARED.getCode());
}


@OnTransition(source = "TO_BE_APPROVED", target = "TO_BE_PURCHASED")
public void PROJECT_APPROVAL(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
// 待立项批复批复后,项目一级状态变更为已立项
project.setStage(ProjectStatusEnum.PROJECT_APPROVED.getCode());
project.setStatus(ProjectStatusEnum.TO_BE_PURCHASED.getCode());
}

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

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

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

@OnTransition(source = "TO_BE_PURCHASED", target = "TO_BE_APPROVED")
public void TO_BE_PURCHASED_WITHDRAW(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
// 待采购状态撤回后,项目一级状态回退到未立项
project.setStage(ProjectStatusEnum.NOT_APPROVED.getCode());
project.setStatus(ProjectStatusEnum.TO_BE_APPROVED.getCode());
}


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

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


@OnTransition(source = "TO_BE_FINALLY_INSPECTED", target = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW")
public void FINAL_ACCEPTANCE_APPLICATION(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW.getCode());
}

@OnTransition(source = "TO_BE_FINALLY_INSPECTED", target = "UNDER_CONSTRUCTION")
public void TO_BE_FINALLY_INSPECTED_WITHDRAW(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.UNDER_CONSTRUCTION.getCode());
}


@OnTransition(source = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW", target = "ARCHIVED")
public void FINAL_ACCEPTANCE_PASS(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
// 终验审核通过后,项目一级状态变更为已归档
project.setStage(ProjectStatusEnum.ARCHIVED.getCode());
project.setStatus(ProjectStatusEnum.ACCEPTED.getCode());
}

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

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

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

+ 0
- 279
hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/ProjectDeclareLDAction.java View File

@@ -1,279 +0,0 @@
package com.hz.pm.api.common.statemachine.action;

import com.hz.pm.api.common.model.constant.StateMachineConst;
import com.hz.pm.api.common.statemachine.contant.RegionContant;
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 lombok.extern.slf4j.Slf4j;
import org.springframework.messaging.Message;
import org.springframework.statemachine.annotation.OnTransition;
import org.springframework.statemachine.annotation.WithStateMachine;

/**
* 项目申报状态机action集合类
* 莲都区
* @author CMM
* @since 2023/02/08 13:48
*/
@Slf4j
@WithStateMachine(id = RegionContant.LS_LD_CODE)
public class ProjectDeclareLDAction {

private static final String PROJECT_DECLARE = StateMachineConst.PROJECT_DECLARE;

@OnTransition(source = "UNDER_INTERNAL_AUDIT", target = "PENDING_PREQUALIFICATION")
public void UNDER_INTERNAL_PASS(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode());
}

@OnTransition(source = "UNDER_INTERNAL_AUDIT", target = "UNDER_INTERNAL_AUDIT_NOT_PASS")
public void UNDER_INTERNAL_REJECT(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS.getCode());
}

@OnTransition(source = "UNDER_INTERNAL_AUDIT", target = "TO_BE_DECLARED")
public void UNDER_INTERNAL_WITHDRAW(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.TO_BE_DECLARED.getCode());
}

@OnTransition(source = "UNDER_INTERNAL_AUDIT_NOT_PASS", target = "UNDER_INTERNAL_AUDIT")
public void UNDER_INTERNAL_REJECT_RESUBMIT(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT.getCode());
}


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

@OnTransition(source = "PENDING_PREQUALIFICATION", target = "UNDER_INTERNAL_AUDIT")
public void PENDING_PREQUALIFICATION_WITHDRAW(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT.getCode());
}


@OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS", target = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS")
public void PROVINCIAL_DEPARTMENT_REVIEW_PASS(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS.getCode());
}

@OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS", target = "PRE_APPLYING")
public void PROVINCIAL_PASS_TO_PRELIMINARY_REVIEW(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.PRE_APPLYING.getCode());
}

@OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS", target = "THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED")
public void PROVINCIAL_DEPARTMENT_REVIEW_REJECT(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED.getCode());
}

@OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS", target = "PENDING_PREQUALIFICATION")
public void JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_WITHDRAW(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode());
}

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

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

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

@OnTransition(source = "PRE_APPLYING", target = "PREQUALIFICATION_WITHDRAW_CHOICE")
public void PRE_APPLYING_WITHDRAW(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE.getCode());
}


@OnTransition(source = "DEPARTMENT_JOINT_REVIEW", target = "IN_THE_ANNUAL_PLAN")
public void DEPARTMENT_UNITED_REVIEW_PASS(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.IN_THE_ANNUAL_PLAN.getCode());
}

@OnTransition(source = "DEPARTMENT_JOINT_REVIEW", target = "DEPARTMENT_JOINT_REVIEW_FAILED")
public void DEPARTMENT_UNITED_REVIEW_REJECT(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW_FAILED.getCode());
}

@OnTransition(source = "DEPARTMENT_JOINT_REVIEW", target = "PRE_APPLYING")
public void DEPARTMENT_JOINT_REVIEW_WITHDRAW(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.PRE_APPLYING.getCode());
}


@OnTransition(source = "IN_THE_ANNUAL_PLAN", target = "PLAN_TO_BE_DECLARED")
public void ANNUAL_PLAN_PROJECT_OPEN_PLAN_DECLARE(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.PLAN_TO_BE_DECLARED.getCode());
}

@OnTransition(source = "IN_THE_ANNUAL_PLAN", target = "BE_SUSPENDED")
public void ANNUAL_PLAN_SUSPEND(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.BE_SUSPENDED.getCode());
}

@OnTransition(source = "IN_THE_ANNUAL_PLAN", target = "DEPARTMENT_JOINT_REVIEW")
public void IN_THE_ANNUAL_PLAN_WITHDRAW(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW.getCode());
}


@OnTransition(source = "PLAN_TO_BE_DECLARED", target = "SCHEME_UNDER_REVIEW")
public void DECLARE_PLAN(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode());
}

@OnTransition(source = "PLAN_TO_BE_DECLARED", target = "IN_THE_ANNUAL_PLAN")
public void PLAN_TO_DECLARE_WITHDRAW(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.IN_THE_ANNUAL_PLAN.getCode());
}

@OnTransition(source = "SCHEME_REVIEW_FAILED", target = "SCHEME_UNDER_REVIEW")
public void DECLARE_PLAN_RESUBMIT(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode());
}

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

@OnTransition(source = "SCHEME_UNDER_REVIEW", target = "SCHEME_REVIEW_FAILED")
public void PLAN_REVIEW_REJECT(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.SCHEME_REVIEW_FAILED.getCode());
}

@OnTransition(source = "SCHEME_REVIEW_FAILED", target = "SCHEME_UNDER_REVIEW")
public void PLAN_REVIEW_REJECT_RESUBMIT(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode());
}

@OnTransition(source = "SCHEME_UNDER_REVIEW", target = "PLAN_TO_BE_DECLARED")
public void SCHEME_UNDER_REVIEW_WITHDRAW(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.PLAN_TO_BE_DECLARED.getCode());
}


@OnTransition(source = "TO_BE_APPROVED", target = "TO_BE_PURCHASED")
public void PROJECT_APPROVAL(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
// 待立项批复批复后,项目一级状态变更为已立项
project.setStage(ProjectStatusEnum.PROJECT_APPROVED.getCode());
project.setStatus(ProjectStatusEnum.TO_BE_PURCHASED.getCode());
}

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

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

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

@OnTransition(source = "TO_BE_PURCHASED", target = "TO_BE_APPROVED")
public void TO_BE_PURCHASED_WITHDRAW(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
// 待采购状态撤回后,项目一级状态回退到未立项
project.setStage(ProjectStatusEnum.NOT_APPROVED.getCode());
project.setStatus(ProjectStatusEnum.TO_BE_APPROVED.getCode());
}


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

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


@OnTransition(source = "TO_BE_FINALLY_INSPECTED", target = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW")
public void FINAL_ACCEPTANCE_APPLICATION(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW.getCode());
}

@OnTransition(source = "TO_BE_FINALLY_INSPECTED", target = "UNDER_CONSTRUCTION")
public void TO_BE_FINALLY_INSPECTED_WITHDRAW(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.UNDER_CONSTRUCTION.getCode());
}


@OnTransition(source = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW", target = "ARCHIVED")
public void FINAL_ACCEPTANCE_PASS(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
// 终验审核通过后,项目一级状态变更为已归档
project.setStage(ProjectStatusEnum.ARCHIVED.getCode());
project.setStatus(ProjectStatusEnum.ACCEPTED.getCode());
}

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

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

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

+ 0
- 279
hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/ProjectDeclareLQAction.java View File

@@ -1,279 +0,0 @@
package com.hz.pm.api.common.statemachine.action;

import com.hz.pm.api.common.model.constant.StateMachineConst;
import com.hz.pm.api.common.statemachine.contant.RegionContant;
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 lombok.extern.slf4j.Slf4j;
import org.springframework.messaging.Message;
import org.springframework.statemachine.annotation.OnTransition;
import org.springframework.statemachine.annotation.WithStateMachine;

/**
* 项目申报状态机action集合类
* ;龙泉市
* @author CMM
* @since 2023/02/08 13:48
*/
@Slf4j
@WithStateMachine(id = RegionContant.LS_LQ_CODE)
public class ProjectDeclareLQAction {

private static final String PROJECT_DECLARE = StateMachineConst.PROJECT_DECLARE;

@OnTransition(source = "UNDER_INTERNAL_AUDIT", target = "PENDING_PREQUALIFICATION")
public void UNDER_INTERNAL_PASS(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode());
}

@OnTransition(source = "UNDER_INTERNAL_AUDIT", target = "UNDER_INTERNAL_AUDIT_NOT_PASS")
public void UNDER_INTERNAL_REJECT(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS.getCode());
}

@OnTransition(source = "UNDER_INTERNAL_AUDIT", target = "TO_BE_DECLARED")
public void UNDER_INTERNAL_WITHDRAW(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.TO_BE_DECLARED.getCode());
}

@OnTransition(source = "UNDER_INTERNAL_AUDIT_NOT_PASS", target = "UNDER_INTERNAL_AUDIT")
public void UNDER_INTERNAL_REJECT_RESUBMIT(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT.getCode());
}


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

@OnTransition(source = "PENDING_PREQUALIFICATION", target = "UNDER_INTERNAL_AUDIT")
public void PENDING_PREQUALIFICATION_WITHDRAW(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT.getCode());
}


@OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS", target = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS")
public void PROVINCIAL_DEPARTMENT_REVIEW_PASS(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS.getCode());
}

@OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS", target = "PRE_APPLYING")
public void PROVINCIAL_PASS_TO_PRELIMINARY_REVIEW(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.PRE_APPLYING.getCode());
}

@OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS", target = "THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED")
public void PROVINCIAL_DEPARTMENT_REVIEW_REJECT(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED.getCode());
}

@OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS", target = "PENDING_PREQUALIFICATION")
public void JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_WITHDRAW(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode());
}

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

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

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

@OnTransition(source = "PRE_APPLYING", target = "PREQUALIFICATION_WITHDRAW_CHOICE")
public void PRE_APPLYING_WITHDRAW(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE.getCode());
}


@OnTransition(source = "DEPARTMENT_JOINT_REVIEW", target = "PLAN_TO_BE_DECLARED")
public void DEPARTMENT_UNITED_REVIEW_PASS(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.PLAN_TO_BE_DECLARED.getCode());
}

@OnTransition(source = "DEPARTMENT_JOINT_REVIEW", target = "DEPARTMENT_JOINT_REVIEW_FAILED")
public void DEPARTMENT_UNITED_REVIEW_REJECT(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW_FAILED.getCode());
}

@OnTransition(source = "DEPARTMENT_JOINT_REVIEW", target = "PRE_APPLYING")
public void DEPARTMENT_JOINT_REVIEW_WITHDRAW(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.PRE_APPLYING.getCode());
}


@OnTransition(source = "IN_THE_ANNUAL_PLAN", target = "TO_BE_APPROVED")
public void ANNUAL_PLAN_PROJECT_OPEN_PLAN_DECLARE(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.TO_BE_APPROVED.getCode());
}

@OnTransition(source = "IN_THE_ANNUAL_PLAN", target = "BE_SUSPENDED")
public void ANNUAL_PLAN_SUSPEND(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.BE_SUSPENDED.getCode());
}

@OnTransition(source = "IN_THE_ANNUAL_PLAN", target = "DEPARTMENT_JOINT_REVIEW")
public void IN_THE_ANNUAL_PLAN_WITHDRAW(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW.getCode());
}


@OnTransition(source = "PLAN_TO_BE_DECLARED", target = "SCHEME_UNDER_REVIEW")
public void DECLARE_PLAN(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode());
}

@OnTransition(source = "PLAN_TO_BE_DECLARED", target = "IN_THE_ANNUAL_PLAN")
public void PLAN_TO_DECLARE_WITHDRAW(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.IN_THE_ANNUAL_PLAN.getCode());
}

@OnTransition(source = "SCHEME_REVIEW_FAILED", target = "SCHEME_UNDER_REVIEW")
public void DECLARE_PLAN_RESUBMIT(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode());
}

@OnTransition(source = "SCHEME_UNDER_REVIEW", target = "IN_THE_ANNUAL_PLAN")
public void PLAN_REVIEW_PASS(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.IN_THE_ANNUAL_PLAN.getCode());
}

@OnTransition(source = "SCHEME_UNDER_REVIEW", target = "SCHEME_REVIEW_FAILED")
public void PLAN_REVIEW_REJECT(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.SCHEME_REVIEW_FAILED.getCode());
}

@OnTransition(source = "SCHEME_REVIEW_FAILED", target = "SCHEME_UNDER_REVIEW")
public void PLAN_REVIEW_REJECT_RESUBMIT(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode());
}

@OnTransition(source = "SCHEME_UNDER_REVIEW", target = "PLAN_TO_BE_DECLARED")
public void SCHEME_UNDER_REVIEW_WITHDRAW(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.PLAN_TO_BE_DECLARED.getCode());
}


@OnTransition(source = "TO_BE_APPROVED", target = "TO_BE_PURCHASED")
public void PROJECT_APPROVAL(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
// 待立项批复批复后,项目一级状态变更为已立项
project.setStage(ProjectStatusEnum.PROJECT_APPROVED.getCode());
project.setStatus(ProjectStatusEnum.TO_BE_PURCHASED.getCode());
}

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

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

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

@OnTransition(source = "TO_BE_PURCHASED", target = "TO_BE_APPROVED")
public void TO_BE_PURCHASED_WITHDRAW(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
// 待采购状态撤回后,项目一级状态回退到未立项
project.setStage(ProjectStatusEnum.NOT_APPROVED.getCode());
project.setStatus(ProjectStatusEnum.TO_BE_APPROVED.getCode());
}


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

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


@OnTransition(source = "TO_BE_FINALLY_INSPECTED", target = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW")
public void FINAL_ACCEPTANCE_APPLICATION(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW.getCode());
}

@OnTransition(source = "TO_BE_FINALLY_INSPECTED", target = "UNDER_CONSTRUCTION")
public void TO_BE_FINALLY_INSPECTED_WITHDRAW(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.UNDER_CONSTRUCTION.getCode());
}


@OnTransition(source = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW", target = "ARCHIVED")
public void FINAL_ACCEPTANCE_PASS(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
// 终验审核通过后,项目一级状态变更为已归档
project.setStage(ProjectStatusEnum.ARCHIVED.getCode());
project.setStatus(ProjectStatusEnum.ACCEPTED.getCode());
}

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

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

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

+ 0
- 279
hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/ProjectDeclareQTAction.java View File

@@ -1,279 +0,0 @@
package com.hz.pm.api.common.statemachine.action;

import com.hz.pm.api.common.model.constant.StateMachineConst;
import com.hz.pm.api.common.statemachine.contant.RegionContant;
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 lombok.extern.slf4j.Slf4j;
import org.springframework.messaging.Message;
import org.springframework.statemachine.annotation.OnTransition;
import org.springframework.statemachine.annotation.WithStateMachine;

/**
* 项目申报状态机action集合类
* 青田县
* @author CMM
* @since 2023/02/08 13:48
*/
@Slf4j
@WithStateMachine(id = RegionContant.LS_QT_CODE)
public class ProjectDeclareQTAction {

private static final String PROJECT_DECLARE = StateMachineConst.PROJECT_DECLARE;

@OnTransition(source = "UNDER_INTERNAL_AUDIT", target = "PENDING_PREQUALIFICATION")
public void UNDER_INTERNAL_PASS(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode());
}

@OnTransition(source = "UNDER_INTERNAL_AUDIT", target = "UNDER_INTERNAL_AUDIT_NOT_PASS")
public void UNDER_INTERNAL_REJECT(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS.getCode());
}

@OnTransition(source = "UNDER_INTERNAL_AUDIT", target = "TO_BE_DECLARED")
public void UNDER_INTERNAL_WITHDRAW(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.TO_BE_DECLARED.getCode());
}

@OnTransition(source = "UNDER_INTERNAL_AUDIT_NOT_PASS", target = "UNDER_INTERNAL_AUDIT")
public void UNDER_INTERNAL_REJECT_RESUBMIT(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT.getCode());
}


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

@OnTransition(source = "PENDING_PREQUALIFICATION", target = "UNDER_INTERNAL_AUDIT")
public void PENDING_PREQUALIFICATION_WITHDRAW(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT.getCode());
}


@OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS", target = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS")
public void PROVINCIAL_DEPARTMENT_REVIEW_PASS(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS.getCode());
}

@OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS", target = "PRE_APPLYING")
public void PROVINCIAL_PASS_TO_PRELIMINARY_REVIEW(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.PRE_APPLYING.getCode());
}

@OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS", target = "THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED")
public void PROVINCIAL_DEPARTMENT_REVIEW_REJECT(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED.getCode());
}

@OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS", target = "PENDING_PREQUALIFICATION")
public void JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_WITHDRAW(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode());
}

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

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

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

@OnTransition(source = "PRE_APPLYING", target = "PREQUALIFICATION_WITHDRAW_CHOICE")
public void PRE_APPLYING_WITHDRAW(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE.getCode());
}


@OnTransition(source = "DEPARTMENT_JOINT_REVIEW", target = "IN_THE_ANNUAL_PLAN")
public void DEPARTMENT_UNITED_REVIEW_PASS(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.IN_THE_ANNUAL_PLAN.getCode());
}

@OnTransition(source = "DEPARTMENT_JOINT_REVIEW", target = "DEPARTMENT_JOINT_REVIEW_FAILED")
public void DEPARTMENT_UNITED_REVIEW_REJECT(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW_FAILED.getCode());
}

@OnTransition(source = "DEPARTMENT_JOINT_REVIEW", target = "PRE_APPLYING")
public void DEPARTMENT_JOINT_REVIEW_WITHDRAW(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.PRE_APPLYING.getCode());
}


@OnTransition(source = "IN_THE_ANNUAL_PLAN", target = "PLAN_TO_BE_DECLARED")
public void ANNUAL_PLAN_PROJECT_OPEN_PLAN_DECLARE(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.PLAN_TO_BE_DECLARED.getCode());
}

@OnTransition(source = "IN_THE_ANNUAL_PLAN", target = "BE_SUSPENDED")
public void ANNUAL_PLAN_SUSPEND(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.BE_SUSPENDED.getCode());
}

@OnTransition(source = "IN_THE_ANNUAL_PLAN", target = "DEPARTMENT_JOINT_REVIEW")
public void IN_THE_ANNUAL_PLAN_WITHDRAW(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW.getCode());
}


@OnTransition(source = "PLAN_TO_BE_DECLARED", target = "SCHEME_UNDER_REVIEW")
public void DECLARE_PLAN(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode());
}

@OnTransition(source = "PLAN_TO_BE_DECLARED", target = "IN_THE_ANNUAL_PLAN")
public void PLAN_TO_DECLARE_WITHDRAW(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.IN_THE_ANNUAL_PLAN.getCode());
}

@OnTransition(source = "SCHEME_REVIEW_FAILED", target = "SCHEME_UNDER_REVIEW")
public void DECLARE_PLAN_RESUBMIT(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode());
}

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

@OnTransition(source = "SCHEME_UNDER_REVIEW", target = "SCHEME_REVIEW_FAILED")
public void PLAN_REVIEW_REJECT(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.SCHEME_REVIEW_FAILED.getCode());
}

@OnTransition(source = "SCHEME_REVIEW_FAILED", target = "SCHEME_UNDER_REVIEW")
public void PLAN_REVIEW_REJECT_RESUBMIT(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode());
}

@OnTransition(source = "SCHEME_UNDER_REVIEW", target = "PLAN_TO_BE_DECLARED")
public void SCHEME_UNDER_REVIEW_WITHDRAW(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.PLAN_TO_BE_DECLARED.getCode());
}


@OnTransition(source = "TO_BE_APPROVED", target = "TO_BE_PURCHASED")
public void PROJECT_APPROVAL(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
// 待立项批复批复后,项目一级状态变更为已立项
project.setStage(ProjectStatusEnum.PROJECT_APPROVED.getCode());
project.setStatus(ProjectStatusEnum.TO_BE_PURCHASED.getCode());
}

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

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

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

@OnTransition(source = "TO_BE_PURCHASED", target = "TO_BE_APPROVED")
public void TO_BE_PURCHASED_WITHDRAW(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
// 待采购状态撤回后,项目一级状态回退到未立项
project.setStage(ProjectStatusEnum.NOT_APPROVED.getCode());
project.setStatus(ProjectStatusEnum.TO_BE_APPROVED.getCode());
}


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

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


@OnTransition(source = "TO_BE_FINALLY_INSPECTED", target = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW")
public void FINAL_ACCEPTANCE_APPLICATION(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW.getCode());
}

@OnTransition(source = "TO_BE_FINALLY_INSPECTED", target = "UNDER_CONSTRUCTION")
public void TO_BE_FINALLY_INSPECTED_WITHDRAW(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.UNDER_CONSTRUCTION.getCode());
}


@OnTransition(source = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW", target = "ARCHIVED")
public void FINAL_ACCEPTANCE_PASS(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
// 终验审核通过后,项目一级状态变更为已归档
project.setStage(ProjectStatusEnum.ARCHIVED.getCode());
project.setStatus(ProjectStatusEnum.ACCEPTED.getCode());
}

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

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

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

+ 0
- 279
hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/ProjectDeclareQYAction.java View File

@@ -1,279 +0,0 @@
package com.hz.pm.api.common.statemachine.action;

import com.hz.pm.api.common.model.constant.StateMachineConst;
import com.hz.pm.api.common.statemachine.contant.RegionContant;
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 lombok.extern.slf4j.Slf4j;
import org.springframework.messaging.Message;
import org.springframework.statemachine.annotation.OnTransition;
import org.springframework.statemachine.annotation.WithStateMachine;

/**
* 项目申报状态机action集合类
* 庆元县
* @author CMM
* @since 2023/02/08 13:48
*/
@Slf4j
@WithStateMachine(id = RegionContant.LS_QY_CODE)
public class ProjectDeclareQYAction {

private static final String PROJECT_DECLARE = StateMachineConst.PROJECT_DECLARE;

@OnTransition(source = "UNDER_INTERNAL_AUDIT", target = "PENDING_PREQUALIFICATION")
public void UNDER_INTERNAL_PASS(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode());
}

@OnTransition(source = "UNDER_INTERNAL_AUDIT", target = "UNDER_INTERNAL_AUDIT_NOT_PASS")
public void UNDER_INTERNAL_REJECT(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS.getCode());
}

@OnTransition(source = "UNDER_INTERNAL_AUDIT", target = "TO_BE_DECLARED")
public void UNDER_INTERNAL_WITHDRAW(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.TO_BE_DECLARED.getCode());
}

@OnTransition(source = "UNDER_INTERNAL_AUDIT_NOT_PASS", target = "UNDER_INTERNAL_AUDIT")
public void UNDER_INTERNAL_REJECT_RESUBMIT(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT.getCode());
}


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

@OnTransition(source = "PENDING_PREQUALIFICATION", target = "UNDER_INTERNAL_AUDIT")
public void PENDING_PREQUALIFICATION_WITHDRAW(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT.getCode());
}


@OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS", target = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS")
public void PROVINCIAL_DEPARTMENT_REVIEW_PASS(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS.getCode());
}

@OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS", target = "PRE_APPLYING")
public void PROVINCIAL_PASS_TO_PRELIMINARY_REVIEW(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.PRE_APPLYING.getCode());
}

@OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS", target = "THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED")
public void PROVINCIAL_DEPARTMENT_REVIEW_REJECT(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED.getCode());
}

@OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS", target = "PENDING_PREQUALIFICATION")
public void JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_WITHDRAW(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode());
}

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

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

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

@OnTransition(source = "PRE_APPLYING", target = "PREQUALIFICATION_WITHDRAW_CHOICE")
public void PRE_APPLYING_WITHDRAW(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE.getCode());
}


@OnTransition(source = "DEPARTMENT_JOINT_REVIEW", target = "IN_THE_ANNUAL_PLAN")
public void DEPARTMENT_UNITED_REVIEW_PASS(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.IN_THE_ANNUAL_PLAN.getCode());
}

@OnTransition(source = "DEPARTMENT_JOINT_REVIEW", target = "DEPARTMENT_JOINT_REVIEW_FAILED")
public void DEPARTMENT_UNITED_REVIEW_REJECT(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW_FAILED.getCode());
}

@OnTransition(source = "DEPARTMENT_JOINT_REVIEW", target = "PRE_APPLYING")
public void DEPARTMENT_JOINT_REVIEW_WITHDRAW(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.PRE_APPLYING.getCode());
}


@OnTransition(source = "IN_THE_ANNUAL_PLAN", target = "PLAN_TO_BE_DECLARED")
public void ANNUAL_PLAN_PROJECT_OPEN_PLAN_DECLARE(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.PLAN_TO_BE_DECLARED.getCode());
}

@OnTransition(source = "IN_THE_ANNUAL_PLAN", target = "BE_SUSPENDED")
public void ANNUAL_PLAN_SUSPEND(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.BE_SUSPENDED.getCode());
}

@OnTransition(source = "IN_THE_ANNUAL_PLAN", target = "DEPARTMENT_JOINT_REVIEW")
public void IN_THE_ANNUAL_PLAN_WITHDRAW(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW.getCode());
}


@OnTransition(source = "PLAN_TO_BE_DECLARED", target = "SCHEME_UNDER_REVIEW")
public void DECLARE_PLAN(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode());
}

@OnTransition(source = "PLAN_TO_BE_DECLARED", target = "IN_THE_ANNUAL_PLAN")
public void PLAN_TO_DECLARE_WITHDRAW(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.IN_THE_ANNUAL_PLAN.getCode());
}

@OnTransition(source = "SCHEME_REVIEW_FAILED", target = "SCHEME_UNDER_REVIEW")
public void DECLARE_PLAN_RESUBMIT(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode());
}

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

@OnTransition(source = "SCHEME_UNDER_REVIEW", target = "SCHEME_REVIEW_FAILED")
public void PLAN_REVIEW_REJECT(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.SCHEME_REVIEW_FAILED.getCode());
}

@OnTransition(source = "SCHEME_REVIEW_FAILED", target = "SCHEME_UNDER_REVIEW")
public void PLAN_REVIEW_REJECT_RESUBMIT(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode());
}

@OnTransition(source = "SCHEME_UNDER_REVIEW", target = "PLAN_TO_BE_DECLARED")
public void SCHEME_UNDER_REVIEW_WITHDRAW(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.PLAN_TO_BE_DECLARED.getCode());
}


@OnTransition(source = "TO_BE_APPROVED", target = "TO_BE_PURCHASED")
public void PROJECT_APPROVAL(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
// 待立项批复批复后,项目一级状态变更为已立项
project.setStage(ProjectStatusEnum.PROJECT_APPROVED.getCode());
project.setStatus(ProjectStatusEnum.TO_BE_PURCHASED.getCode());
}

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

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

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

@OnTransition(source = "TO_BE_PURCHASED", target = "TO_BE_APPROVED")
public void TO_BE_PURCHASED_WITHDRAW(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
// 待采购状态撤回后,项目一级状态回退到未立项
project.setStage(ProjectStatusEnum.NOT_APPROVED.getCode());
project.setStatus(ProjectStatusEnum.TO_BE_APPROVED.getCode());
}


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

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


@OnTransition(source = "TO_BE_FINALLY_INSPECTED", target = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW")
public void FINAL_ACCEPTANCE_APPLICATION(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW.getCode());
}

@OnTransition(source = "TO_BE_FINALLY_INSPECTED", target = "UNDER_CONSTRUCTION")
public void TO_BE_FINALLY_INSPECTED_WITHDRAW(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.UNDER_CONSTRUCTION.getCode());
}


@OnTransition(source = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW", target = "ARCHIVED")
public void FINAL_ACCEPTANCE_PASS(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
// 终验审核通过后,项目一级状态变更为已归档
project.setStage(ProjectStatusEnum.ARCHIVED.getCode());
project.setStatus(ProjectStatusEnum.ACCEPTED.getCode());
}

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

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

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

+ 0
- 287
hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/ProjectDeclareSCAction.java View File

@@ -1,287 +0,0 @@
package com.hz.pm.api.common.statemachine.action;

import com.hz.pm.api.common.model.constant.StateMachineConst;
import com.hz.pm.api.common.statemachine.contant.RegionContant;
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 lombok.extern.slf4j.Slf4j;
import org.springframework.messaging.Message;
import org.springframework.statemachine.annotation.OnTransition;
import org.springframework.statemachine.annotation.WithStateMachine;

/**
* 项目申报状态机action集合类
* 遂昌县
* @author CMM
* @since 2023/02/08 13:48
*/
@Slf4j
@WithStateMachine(id = RegionContant.LS_SC_CODE)
public class ProjectDeclareSCAction {

private static final String PROJECT_DECLARE = StateMachineConst.PROJECT_DECLARE;

@OnTransition(source = "UNDER_INTERNAL_AUDIT", target = "PENDING_PREQUALIFICATION")
public void UNDER_INTERNAL_PASS(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode());
}

@OnTransition(source = "UNDER_INTERNAL_AUDIT", target = "UNDER_INTERNAL_AUDIT_NOT_PASS")
public void UNDER_INTERNAL_REJECT(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS.getCode());
}

@OnTransition(source = "UNDER_INTERNAL_AUDIT", target = "TO_BE_DECLARED")
public void UNDER_INTERNAL_WITHDRAW(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.TO_BE_DECLARED.getCode());
}

@OnTransition(source = "UNDER_INTERNAL_AUDIT_NOT_PASS", target = "UNDER_INTERNAL_AUDIT")
public void UNDER_INTERNAL_REJECT_RESUBMIT(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT.getCode());
}


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

@OnTransition(source = "PENDING_PREQUALIFICATION", target = "UNDER_INTERNAL_AUDIT")
public void PENDING_PREQUALIFICATION_WITHDRAW(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT.getCode());
}


@OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS", target = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS")
public void PROVINCIAL_DEPARTMENT_REVIEW_PASS(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS.getCode());
}

@OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS", target = "PRE_APPLYING")
public void PROVINCIAL_PASS_TO_PRELIMINARY_REVIEW(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.PRE_APPLYING.getCode());
}

@OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS", target = "THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED")
public void PROVINCIAL_DEPARTMENT_REVIEW_REJECT(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED.getCode());
}

@OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS", target = "PENDING_PREQUALIFICATION")
public void JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_WITHDRAW(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode());
}

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

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

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

@OnTransition(source = "PRE_APPLYING", target = "PREQUALIFICATION_WITHDRAW_CHOICE")
public void PRE_APPLYING_WITHDRAW(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE.getCode());
}


@OnTransition(source = "DEPARTMENT_JOINT_REVIEW", target = "IN_THE_ANNUAL_PLAN")
public void DEPARTMENT_UNITED_REVIEW_PASS(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.IN_THE_ANNUAL_PLAN.getCode());
}

@OnTransition(source = "DEPARTMENT_JOINT_REVIEW", target = "DEPARTMENT_JOINT_REVIEW_FAILED")
public void DEPARTMENT_UNITED_REVIEW_REJECT(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW_FAILED.getCode());
}

@OnTransition(source = "DEPARTMENT_JOINT_REVIEW", target = "PRE_APPLYING")
public void DEPARTMENT_JOINT_REVIEW_WITHDRAW(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.PRE_APPLYING.getCode());
}


@OnTransition(source = "IN_THE_ANNUAL_PLAN", target = "PLAN_TO_BE_DECLARED")
public void ANNUAL_PLAN_PROJECT_OPEN_PLAN_DECLARE(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.PLAN_TO_BE_DECLARED.getCode());
}

@OnTransition(source = "IN_THE_ANNUAL_PLAN", target = "BE_SUSPENDED")
public void ANNUAL_PLAN_SUSPEND(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.BE_SUSPENDED.getCode());
}

@OnTransition(source = "IN_THE_ANNUAL_PLAN", target = "DEPARTMENT_JOINT_REVIEW")
public void IN_THE_ANNUAL_PLAN_WITHDRAW(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW.getCode());
}


@OnTransition(source = "PLAN_TO_BE_DECLARED", target = "SCHEME_UNDER_REVIEW")
public void DECLARE_PLAN(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode());
}

@OnTransition(source = "PLAN_TO_BE_DECLARED", target = "IN_THE_ANNUAL_PLAN")
public void PLAN_TO_DECLARE_WITHDRAW(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.IN_THE_ANNUAL_PLAN.getCode());
}

@OnTransition(source = "SCHEME_REVIEW_FAILED", target = "SCHEME_UNDER_REVIEW")
public void DECLARE_PLAN_RESUBMIT(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode());
}

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

@OnTransition(source = "SCHEME_UNDER_REVIEW", target = "SCHEME_REVIEW_FAILED")
public void PLAN_REVIEW_REJECT(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.SCHEME_REVIEW_FAILED.getCode());
}

@OnTransition(source = "SCHEME_REVIEW_FAILED", target = "SCHEME_UNDER_REVIEW")
public void PLAN_REVIEW_REJECT_RESUBMIT(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode());
}

@OnTransition(source = "SCHEME_UNDER_REVIEW", target = "PLAN_TO_BE_DECLARED")
public void SCHEME_UNDER_REVIEW_WITHDRAW(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.PLAN_TO_BE_DECLARED.getCode());
}


@OnTransition(source = "TO_BE_APPROVED", target = "APPROVED_AFTER_CHOICE")
public void PROJECT_APPROVAL(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
// 待立项批复批复后,项目一级状态变更为已立项
project.setStage(ProjectStatusEnum.NOT_APPROVED.getCode());
project.setStatus(ProjectStatusEnum.APPROVED_AFTER_CHOICE.getCode());
}

@OnTransition(source = "TO_BE_APP_REGISTER", target = "TO_BE_PURCHASED")
public void REGISTER_APP(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
// 待立项批复批复后,项目一级状态变更为已立项
project.setStage(ProjectStatusEnum.PROJECT_APPROVED.getCode());
project.setStatus(ProjectStatusEnum.TO_BE_PURCHASED.getCode());
}

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

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

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

@OnTransition(source = "TO_BE_PURCHASED", target = "TO_BE_APPROVED")
public void TO_BE_PURCHASED_WITHDRAW(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
// 待采购状态撤回后,项目一级状态回退到未立项
project.setStage(ProjectStatusEnum.NOT_APPROVED.getCode());
project.setStatus(ProjectStatusEnum.TO_BE_APPROVED.getCode());
}


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

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


@OnTransition(source = "TO_BE_FINALLY_INSPECTED", target = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW")
public void FINAL_ACCEPTANCE_APPLICATION(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW.getCode());
}

@OnTransition(source = "TO_BE_FINALLY_INSPECTED", target = "UNDER_CONSTRUCTION")
public void TO_BE_FINALLY_INSPECTED_WITHDRAW(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.UNDER_CONSTRUCTION.getCode());
}


@OnTransition(source = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW", target = "ARCHIVED")
public void FINAL_ACCEPTANCE_PASS(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
// 终验审核通过后,项目一级状态变更为已归档
project.setStage(ProjectStatusEnum.ARCHIVED.getCode());
project.setStatus(ProjectStatusEnum.ACCEPTED.getCode());
}

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

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

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

+ 0
- 279
hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/ProjectDeclareSYAction.java View File

@@ -1,279 +0,0 @@
package com.hz.pm.api.common.statemachine.action;

import com.hz.pm.api.common.model.constant.StateMachineConst;
import com.hz.pm.api.common.statemachine.contant.RegionContant;
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 lombok.extern.slf4j.Slf4j;
import org.springframework.messaging.Message;
import org.springframework.statemachine.annotation.OnTransition;
import org.springframework.statemachine.annotation.WithStateMachine;

/**
* 项目申报状态机action集合类
* 松阳县
* @author CMM
* @since 2023/02/08 13:48
*/
@Slf4j
@WithStateMachine(id = RegionContant.LS_SY_CODE)
public class ProjectDeclareSYAction {

private static final String PROJECT_DECLARE = StateMachineConst.PROJECT_DECLARE;

@OnTransition(source = "UNDER_INTERNAL_AUDIT", target = "PENDING_PREQUALIFICATION")
public void UNDER_INTERNAL_PASS(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode());
}

@OnTransition(source = "UNDER_INTERNAL_AUDIT", target = "UNDER_INTERNAL_AUDIT_NOT_PASS")
public void UNDER_INTERNAL_REJECT(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS.getCode());
}

@OnTransition(source = "UNDER_INTERNAL_AUDIT", target = "TO_BE_DECLARED")
public void UNDER_INTERNAL_WITHDRAW(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.TO_BE_DECLARED.getCode());
}

@OnTransition(source = "UNDER_INTERNAL_AUDIT_NOT_PASS", target = "UNDER_INTERNAL_AUDIT")
public void UNDER_INTERNAL_REJECT_RESUBMIT(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT.getCode());
}


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

@OnTransition(source = "PENDING_PREQUALIFICATION", target = "UNDER_INTERNAL_AUDIT")
public void PENDING_PREQUALIFICATION_WITHDRAW(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT.getCode());
}


@OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS", target = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS")
public void PROVINCIAL_DEPARTMENT_REVIEW_PASS(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS.getCode());
}

@OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS", target = "PRE_APPLYING")
public void PROVINCIAL_PASS_TO_PRELIMINARY_REVIEW(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.PRE_APPLYING.getCode());
}

@OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS", target = "THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED")
public void PROVINCIAL_DEPARTMENT_REVIEW_REJECT(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED.getCode());
}

@OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS", target = "PENDING_PREQUALIFICATION")
public void JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_WITHDRAW(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode());
}

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

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

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

@OnTransition(source = "PRE_APPLYING", target = "PREQUALIFICATION_WITHDRAW_CHOICE")
public void PRE_APPLYING_WITHDRAW(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE.getCode());
}


@OnTransition(source = "DEPARTMENT_JOINT_REVIEW", target = "IN_THE_ANNUAL_PLAN")
public void DEPARTMENT_UNITED_REVIEW_PASS(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.IN_THE_ANNUAL_PLAN.getCode());
}

@OnTransition(source = "DEPARTMENT_JOINT_REVIEW", target = "DEPARTMENT_JOINT_REVIEW_FAILED")
public void DEPARTMENT_UNITED_REVIEW_REJECT(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW_FAILED.getCode());
}

@OnTransition(source = "DEPARTMENT_JOINT_REVIEW", target = "PRE_APPLYING")
public void DEPARTMENT_JOINT_REVIEW_WITHDRAW(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.PRE_APPLYING.getCode());
}


@OnTransition(source = "IN_THE_ANNUAL_PLAN", target = "PLAN_TO_BE_DECLARED")
public void ANNUAL_PLAN_PROJECT_OPEN_PLAN_DECLARE(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.PLAN_TO_BE_DECLARED.getCode());
}

@OnTransition(source = "IN_THE_ANNUAL_PLAN", target = "BE_SUSPENDED")
public void ANNUAL_PLAN_SUSPEND(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.BE_SUSPENDED.getCode());
}

@OnTransition(source = "IN_THE_ANNUAL_PLAN", target = "DEPARTMENT_JOINT_REVIEW")
public void IN_THE_ANNUAL_PLAN_WITHDRAW(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW.getCode());
}


@OnTransition(source = "PLAN_TO_BE_DECLARED", target = "SCHEME_UNDER_REVIEW")
public void DECLARE_PLAN(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode());
}

@OnTransition(source = "PLAN_TO_BE_DECLARED", target = "IN_THE_ANNUAL_PLAN")
public void PLAN_TO_DECLARE_WITHDRAW(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.IN_THE_ANNUAL_PLAN.getCode());
}

@OnTransition(source = "SCHEME_REVIEW_FAILED", target = "SCHEME_UNDER_REVIEW")
public void DECLARE_PLAN_RESUBMIT(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode());
}

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

@OnTransition(source = "SCHEME_UNDER_REVIEW", target = "SCHEME_REVIEW_FAILED")
public void PLAN_REVIEW_REJECT(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.SCHEME_REVIEW_FAILED.getCode());
}

@OnTransition(source = "SCHEME_REVIEW_FAILED", target = "SCHEME_UNDER_REVIEW")
public void PLAN_REVIEW_REJECT_RESUBMIT(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode());
}

@OnTransition(source = "SCHEME_UNDER_REVIEW", target = "PLAN_TO_BE_DECLARED")
public void SCHEME_UNDER_REVIEW_WITHDRAW(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.PLAN_TO_BE_DECLARED.getCode());
}


@OnTransition(source = "TO_BE_APPROVED", target = "TO_BE_PURCHASED")
public void PROJECT_APPROVAL(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
// 待立项批复批复后,项目一级状态变更为已立项
project.setStage(ProjectStatusEnum.PROJECT_APPROVED.getCode());
project.setStatus(ProjectStatusEnum.TO_BE_PURCHASED.getCode());
}

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

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

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

@OnTransition(source = "TO_BE_PURCHASED", target = "TO_BE_APPROVED")
public void TO_BE_PURCHASED_WITHDRAW(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
// 待采购状态撤回后,项目一级状态回退到未立项
project.setStage(ProjectStatusEnum.NOT_APPROVED.getCode());
project.setStatus(ProjectStatusEnum.TO_BE_APPROVED.getCode());
}


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

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


@OnTransition(source = "TO_BE_FINALLY_INSPECTED", target = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW")
public void FINAL_ACCEPTANCE_APPLICATION(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW.getCode());
}

@OnTransition(source = "TO_BE_FINALLY_INSPECTED", target = "UNDER_CONSTRUCTION")
public void TO_BE_FINALLY_INSPECTED_WITHDRAW(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.UNDER_CONSTRUCTION.getCode());
}


@OnTransition(source = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW", target = "ARCHIVED")
public void FINAL_ACCEPTANCE_PASS(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
// 终验审核通过后,项目一级状态变更为已归档
project.setStage(ProjectStatusEnum.ARCHIVED.getCode());
project.setStatus(ProjectStatusEnum.ACCEPTED.getCode());
}

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

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

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

+ 0
- 280
hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/ProjectDeclareYHAction.java View File

@@ -1,280 +0,0 @@
package com.hz.pm.api.common.statemachine.action;

import com.hz.pm.api.common.model.constant.StateMachineConst;
import com.hz.pm.api.common.statemachine.contant.RegionContant;
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 lombok.extern.slf4j.Slf4j;
import org.springframework.messaging.Message;
import org.springframework.statemachine.annotation.OnTransition;
import org.springframework.statemachine.annotation.WithStateMachine;

/**
* 项目申报状态机action集合类
* 云和县
* @author CMM
* @since 2023/02/08 13:48
*/
@Slf4j
@WithStateMachine(id = RegionContant.LS_YH_CODE)
public class ProjectDeclareYHAction {

private static final String PROJECT_DECLARE = StateMachineConst.PROJECT_DECLARE;

@OnTransition(source = "UNDER_INTERNAL_AUDIT", target = "PENDING_PREQUALIFICATION")
public void UNDER_INTERNAL_PASS(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode());
}

@OnTransition(source = "UNDER_INTERNAL_AUDIT", target = "UNDER_INTERNAL_AUDIT_NOT_PASS")
public void UNDER_INTERNAL_REJECT(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS.getCode());
}

@OnTransition(source = "UNDER_INTERNAL_AUDIT", target = "TO_BE_DECLARED")
public void UNDER_INTERNAL_WITHDRAW(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.TO_BE_DECLARED.getCode());
}

@OnTransition(source = "UNDER_INTERNAL_AUDIT_NOT_PASS", target = "UNDER_INTERNAL_AUDIT")
public void UNDER_INTERNAL_REJECT_RESUBMIT(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT.getCode());
}


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

@OnTransition(source = "PENDING_PREQUALIFICATION", target = "UNDER_INTERNAL_AUDIT")
public void PENDING_PREQUALIFICATION_WITHDRAW(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT.getCode());
}


@OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS", target = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS")
public void PROVINCIAL_DEPARTMENT_REVIEW_PASS(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS.getCode());
}

@OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS", target = "PRE_APPLYING")
public void PROVINCIAL_PASS_TO_PRELIMINARY_REVIEW(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.PRE_APPLYING.getCode());
}

@OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS", target = "THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED")
public void PROVINCIAL_DEPARTMENT_REVIEW_REJECT(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED.getCode());
}

@OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS", target = "PENDING_PREQUALIFICATION")
public void JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_WITHDRAW(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode());
}

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

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

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

@OnTransition(source = "PRE_APPLYING", target = "PREQUALIFICATION_WITHDRAW_CHOICE")
public void PRE_APPLYING_WITHDRAW(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE.getCode());
}


@OnTransition(source = "DEPARTMENT_JOINT_REVIEW", target = "IN_THE_ANNUAL_PLAN")
public void DEPARTMENT_UNITED_REVIEW_PASS(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.IN_THE_ANNUAL_PLAN.getCode());
}

@OnTransition(source = "DEPARTMENT_JOINT_REVIEW", target = "DEPARTMENT_JOINT_REVIEW_FAILED")
public void DEPARTMENT_UNITED_REVIEW_REJECT(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW_FAILED.getCode());
}

@OnTransition(source = "DEPARTMENT_JOINT_REVIEW", target = "PRE_APPLYING")
public void DEPARTMENT_JOINT_REVIEW_WITHDRAW(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.PRE_APPLYING.getCode());
}


@OnTransition(source = "IN_THE_ANNUAL_PLAN", target = "PLAN_TO_BE_DECLARED")
public void ANNUAL_PLAN_PROJECT_OPEN_PLAN_DECLARE(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.PLAN_TO_BE_DECLARED.getCode());
}

@OnTransition(source = "IN_THE_ANNUAL_PLAN", target = "BE_SUSPENDED")
public void ANNUAL_PLAN_SUSPEND(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.BE_SUSPENDED.getCode());
}

@OnTransition(source = "IN_THE_ANNUAL_PLAN", target = "DEPARTMENT_JOINT_REVIEW")
public void IN_THE_ANNUAL_PLAN_WITHDRAW(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW.getCode());
}


@OnTransition(source = "PLAN_TO_BE_DECLARED", target = "SCHEME_UNDER_REVIEW")
public void DECLARE_PLAN(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode());
}

@OnTransition(source = "PLAN_TO_BE_DECLARED", target = "IN_THE_ANNUAL_PLAN")
public void PLAN_TO_DECLARE_WITHDRAW(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.IN_THE_ANNUAL_PLAN.getCode());
}

@OnTransition(source = "SCHEME_REVIEW_FAILED", target = "SCHEME_UNDER_REVIEW")
public void DECLARE_PLAN_RESUBMIT(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode());
}

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

@OnTransition(source = "SCHEME_UNDER_REVIEW", target = "SCHEME_REVIEW_FAILED")
public void PLAN_REVIEW_REJECT(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.SCHEME_REVIEW_FAILED.getCode());
}

@OnTransition(source = "SCHEME_REVIEW_FAILED", target = "SCHEME_UNDER_REVIEW")
public void PLAN_REVIEW_REJECT_RESUBMIT(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode());
}

@OnTransition(source = "SCHEME_UNDER_REVIEW", target = "PLAN_TO_BE_DECLARED")
public void SCHEME_UNDER_REVIEW_WITHDRAW(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.PLAN_TO_BE_DECLARED.getCode());
}


@OnTransition(source = "TO_BE_APPROVED", target = "TO_BE_PURCHASED")
public void PROJECT_APPROVAL(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
// 待立项批复批复后,项目一级状态变更为已立项
project.setStage(ProjectStatusEnum.PROJECT_APPROVED.getCode());
project.setStatus(ProjectStatusEnum.TO_BE_PURCHASED.getCode());
}

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


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

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

@OnTransition(source = "TO_BE_PURCHASED", target = "TO_BE_APPROVED")
public void TO_BE_PURCHASED_WITHDRAW(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
// 待采购状态撤回后,项目一级状态回退到未立项
project.setStage(ProjectStatusEnum.NOT_APPROVED.getCode());
project.setStatus(ProjectStatusEnum.TO_BE_APPROVED.getCode());
}


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

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


@OnTransition(source = "TO_BE_FINALLY_INSPECTED", target = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW")
public void FINAL_ACCEPTANCE_APPLICATION(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW.getCode());
}

@OnTransition(source = "TO_BE_FINALLY_INSPECTED", target = "UNDER_CONSTRUCTION")
public void TO_BE_FINALLY_INSPECTED_WITHDRAW(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.UNDER_CONSTRUCTION.getCode());
}


@OnTransition(source = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW", target = "ARCHIVED")
public void FINAL_ACCEPTANCE_PASS(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
// 终验审核通过后,项目一级状态变更为已归档
project.setStage(ProjectStatusEnum.ARCHIVED.getCode());
project.setStatus(ProjectStatusEnum.ACCEPTED.getCode());
}

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

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

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

+ 3
- 1
hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/ProjectDeclareStateMachineBuilder.java View File

@@ -14,10 +14,11 @@ import org.springframework.statemachine.persist.StateMachinePersister;
* @since 2023/02/07 15:56
*/
public interface ProjectDeclareStateMachineBuilder {

StateMachine<ProjectStatusEnum, ProjectStatusChangeEvent> build() throws Exception;
/**
* 构建状态机
* @param beanFactory
* @param beanFactory \
* @author CMM
* @since 2023/02/07 16:15
*/
@@ -29,4 +30,5 @@ public interface ProjectDeclareStateMachineBuilder {
* @since 2023/02/07 16:22
*/
StateMachinePersister<ProjectStatusEnum, ProjectStatusChangeEvent, Project> getProjectPersister();

}

hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/ProjectDeclareStateMachineSBJBuilder.java → hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/ProjectDeclareStateMachineBuilderImpl.java View File

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

import com.hz.pm.api.common.statemachine.action.ProjectDeclareChoiceAction;
import com.hz.pm.api.common.statemachine.contant.RegionContant;
import com.hz.pm.api.common.statemachine.event.ProjectStatusChangeEvent;
import com.hz.pm.api.common.statemachine.factory.ProjectDeclareGuardFactory;
import com.hz.pm.api.projectlib.model.enumeration.ProjectStatusEnum;
import com.hz.pm.api.projectlib.model.entity.Project;
import lombok.RequiredArgsConstructor;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.statemachine.StateMachine;
@@ -26,32 +24,32 @@ import java.util.EnumSet;
/**
* 项目申报状态机
* 市本级
*
* @author CMM
* @since 2023/02/07 15:56
*/
@Slf4j
@Component
@EnableStateMachine(name= ProjectDeclareStateMachineSBJBuilder.MACHINEID_TO)
@EnableStateMachine(name = ProjectDeclareStateMachineBuilderImpl.MACHINE_ID)
@RequiredArgsConstructor
public class ProjectDeclareStateMachineSBJBuilder implements ProjectDeclareStateMachineBuilder {
private static final ProjectDeclareGuardFactory projectDeclareGuardFactory = new ProjectDeclareGuardFactory();
private final BeanFactory beanFactory;
public class ProjectDeclareStateMachineBuilderImpl implements ProjectDeclareStateMachineBuilder {

private StateMachinePersister stateMachinePersister;
private Logger logger = LoggerFactory.getLogger(getClass());
/**
* TO状态机
*/
public final static String MACHINEID_TO = RegionContant.LS_SBJ_CODE;
public static final String MACHINE_ID = "projectDeclareStateMachine";

private static final ProjectDeclareGuardFactory PROJECT_DECLARE_GUARD_FACTORY = new ProjectDeclareGuardFactory();
private final BeanFactory beanFactory;

@Override
public StateMachine<ProjectStatusEnum, ProjectStatusChangeEvent> build() throws Exception {
StateMachine<ProjectStatusEnum, ProjectStatusChangeEvent> stateMachine = build(beanFactory);
logger.info("状态机ID:" + stateMachine.getId());
log.info("状态机ID:" + stateMachine.getId());
stateMachine.start();
return stateMachine;
}

/**
* 构建状态机
*
* @param beanFactory
* @author CMM
* @since 2023/02/07 16:15
@@ -61,7 +59,7 @@ public class ProjectDeclareStateMachineSBJBuilder implements ProjectDeclareState
StateMachineBuilder.Builder<ProjectStatusEnum, ProjectStatusChangeEvent> builder = StateMachineBuilder.builder();
builder.configureConfiguration()
.withConfiguration()
.machineId(MACHINEID_TO)
.machineId(MACHINE_ID)
.beanFactory(beanFactory);

builder.configureStates()
@@ -101,8 +99,8 @@ public class ProjectDeclareStateMachineSBJBuilder implements ProjectDeclareState
// 待预审申报,从待预审选择->省级部门联审中,预审中,完成其中一种状态
.withChoice()
.source(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE)
.first(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS,projectDeclareGuardFactory.new PendingPreQualificationChoiceGuard(),new ProjectDeclareChoiceAction())
.last(ProjectStatusEnum.PRE_APPLYING,new ProjectDeclareChoiceAction()).and()
.first(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS, PROJECT_DECLARE_GUARD_FACTORY.new PendingPreQualificationChoiceGuard(), new ProjectDeclareChoiceAction())
.last(ProjectStatusEnum.PRE_APPLYING, new ProjectDeclareChoiceAction()).and()

// 省级部门联审通过,从省级部门联审中到省级部门联审成功
.withExternal()
@@ -143,9 +141,9 @@ public class ProjectDeclareStateMachineSBJBuilder implements ProjectDeclareState
// 预审中撤回,从预审中撤回选择态->省级部门联审成功,待预审,完成其中一种状态
.withChoice()
.source(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE)
.first(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS,projectDeclareGuardFactory.new PendingPreQualificationChoiceGuard()
,new ProjectDeclareChoiceAction())
.last(ProjectStatusEnum.PENDING_PREQUALIFICATION,new ProjectDeclareChoiceAction()).and()
.first(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS, PROJECT_DECLARE_GUARD_FACTORY.new PendingPreQualificationChoiceGuard()
, new ProjectDeclareChoiceAction())
.last(ProjectStatusEnum.PENDING_PREQUALIFICATION, new ProjectDeclareChoiceAction()).and()
// 预审不通过重新提交,从预审不通过到待预审选择
.withExternal()
.source(ProjectStatusEnum.PREQUALIFICATION_FAILED)
@@ -154,8 +152,8 @@ public class ProjectDeclareStateMachineSBJBuilder implements ProjectDeclareState
// 预审不通过重新提交,从待预审选择->省级部门联审中,预审中,完成其中一种状态
.withChoice()
.source(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE)
.first(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS,projectDeclareGuardFactory.new PendingPreQualificationChoiceGuard(),new ProjectDeclareChoiceAction())
.last(ProjectStatusEnum.PRE_APPLYING,new ProjectDeclareChoiceAction()).and()
.first(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS, PROJECT_DECLARE_GUARD_FACTORY.new PendingPreQualificationChoiceGuard(), new ProjectDeclareChoiceAction())
.last(ProjectStatusEnum.PRE_APPLYING, new ProjectDeclareChoiceAction()).and()
// 部门联审通过,从部门联审中到年度计划中
.withExternal()
.source(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW)
@@ -257,29 +255,25 @@ public class ProjectDeclareStateMachineSBJBuilder implements ProjectDeclareState

/**
* 持久化配置
*
* @author CMM
* @since 2023/02/07 16:22
*/
@Bean(name = "projectDeclareStateMachineSBJPersister")
@Bean(name = "projectDeclareStatePersister")
@Override
public StateMachinePersister<ProjectStatusEnum, ProjectStatusChangeEvent, Project> getProjectPersister() {
StateMachinePersister sp = new DefaultStateMachinePersister<>(new StateMachinePersist<ProjectStatusEnum, ProjectStatusChangeEvent, Project>() {
return new DefaultStateMachinePersister<>(new StateMachinePersist<ProjectStatusEnum, ProjectStatusChangeEvent, Project>() {
@Override
public void write(StateMachineContext<ProjectStatusEnum, ProjectStatusChangeEvent> context, Project contextObj) {
log.info("当前项目为:{}", contextObj);
}

@Override
public StateMachineContext<ProjectStatusEnum, ProjectStatusChangeEvent> read(Project contextObj) {
StateMachineContext<ProjectStatusEnum, ProjectStatusChangeEvent> result = new DefaultStateMachineContext(ProjectStatusEnum.match(contextObj.getStatus()),
null, null, null, null, RegionContant.LS_SBJ_CODE);
return result;
return new DefaultStateMachineContext<>(ProjectStatusEnum.match(contextObj.getStatus()),
null, null, null, null);
}
});
stateMachinePersister = sp;
return sp;
}

public StateMachinePersister getStateMachinePersister(){
return stateMachinePersister;
}
}

+ 0
- 284
hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/ProjectDeclareStateMachineJNBuilder.java View File

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

import com.hz.pm.api.common.statemachine.action.ProjectDeclareChoiceAction;
import com.hz.pm.api.common.statemachine.contant.RegionContant;
import com.hz.pm.api.common.statemachine.event.ProjectStatusChangeEvent;
import com.hz.pm.api.common.statemachine.factory.ProjectDeclareGuardFactory;
import com.hz.pm.api.projectlib.model.enumeration.ProjectStatusEnum;
import com.hz.pm.api.projectlib.model.entity.Project;
import lombok.RequiredArgsConstructor;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.statemachine.StateMachine;
import org.springframework.statemachine.StateMachineContext;
import org.springframework.statemachine.StateMachinePersist;
import org.springframework.statemachine.config.EnableStateMachine;
import org.springframework.statemachine.config.StateMachineBuilder;
import org.springframework.statemachine.persist.DefaultStateMachinePersister;
import org.springframework.statemachine.persist.StateMachinePersister;
import org.springframework.statemachine.support.DefaultStateMachineContext;
import org.springframework.stereotype.Component;

import java.util.EnumSet;

/**
* 项目申报状态机
* 景宁畲族自治县
* @author CMM
* @since 2023/02/07 15:56
*/
@Component
@EnableStateMachine(name= ProjectDeclareStateMachineJNBuilder.MACHINEID_TO)
@RequiredArgsConstructor
public class ProjectDeclareStateMachineJNBuilder implements ProjectDeclareStateMachineBuilder{
private static final ProjectDeclareGuardFactory projectDeclareGuardFactory = new ProjectDeclareGuardFactory();
private final BeanFactory beanFactory;
private Logger logger = LoggerFactory.getLogger(getClass());

private StateMachinePersister stateMachinePersister;
/**
* TO状态机
*/
public final static String MACHINEID_TO = RegionContant.LS_JN_CODE;

@Override
public StateMachine<ProjectStatusEnum, ProjectStatusChangeEvent> build() throws Exception {
StateMachine<ProjectStatusEnum, ProjectStatusChangeEvent> stateMachine = build(beanFactory);
logger.info("状态机ID:" + stateMachine.getId());
stateMachine.start();
return stateMachine;
}
/**
* 构建状态机
* @param beanFactory
* @author CMM
* @since 2023/02/07 16:15
*/
@Override
public StateMachine<ProjectStatusEnum, ProjectStatusChangeEvent> build(BeanFactory beanFactory) throws Exception {
StateMachineBuilder.Builder<ProjectStatusEnum, ProjectStatusChangeEvent> builder = StateMachineBuilder.builder();
builder.configureConfiguration()
.withConfiguration()
.machineId(MACHINEID_TO)
.beanFactory(beanFactory);

builder.configureStates()
.withStates()
.initial(ProjectStatusEnum.UNDER_INTERNAL_AUDIT)
.choice(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE)
.choice(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE)
.states(EnumSet.allOf(ProjectStatusEnum.class));

builder.configureTransitions()
// 单位内部审核通过,从单位内部审核中到待预审
.withExternal()
.source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT)
.target(ProjectStatusEnum.PENDING_PREQUALIFICATION)
.event(ProjectStatusChangeEvent.UNDER_INTERNAL_PASS).and()
// 单位内部审核驳回,从单位内部审核中到单位内部审核不通过
.withExternal()
.source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT)
.target(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS)
.event(ProjectStatusChangeEvent.UNDER_INTERNAL_REJECT).and()
// 单位内部审核中撤回,从单位内部审核中到待申报
.withExternal()
.source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT)
.target(ProjectStatusEnum.TO_BE_DECLARED)
.event(ProjectStatusChangeEvent.UNDER_INTERNAL_WITHDRAW).and()
// 单位内部审核不通过重新提交,从单位内部审核不通过到单位内部审核中
.withExternal()
.source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS)
.target(ProjectStatusEnum.UNDER_INTERNAL_AUDIT)
.event(ProjectStatusChangeEvent.UNDER_INTERNAL_REJECT_RESUBMIT).and()

// 待预审预审申报,从待预审到待预审选择
.withExternal()
.source(ProjectStatusEnum.PENDING_PREQUALIFICATION)
.target(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE)
.event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_DECLARE).and()
// 待预审申报,从待预审选择->省级部门联审中,预审中,完成其中一种状态
.withChoice()
.source(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE)
.first(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS,projectDeclareGuardFactory.new PendingPreQualificationChoiceGuard(),new ProjectDeclareChoiceAction())
.last(ProjectStatusEnum.PRE_APPLYING,new ProjectDeclareChoiceAction()).and()

// 省级部门联审通过,从省级部门联审中到省级部门联审成功
.withExternal()
.source(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS)
.target(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS)
.event(ProjectStatusChangeEvent.PROVINCIAL_DEPARTMENT_REVIEW_PASS).and()
// 省级部门联审通过,从省级部门联审成功到预审中
.withExternal()
.source(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS)
.target(ProjectStatusEnum.PRE_APPLYING)
.event(ProjectStatusChangeEvent.PROVINCIAL_PASS_TO_PRELIMINARY_REVIEW).and()
// 省级部门联审不通过,从省级部门联审中到省级部门联审不通过
.withExternal()
.source(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS)
.target(ProjectStatusEnum.THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED)
.event(ProjectStatusChangeEvent.PROVINCIAL_DEPARTMENT_REVIEW_REJECT).and()
// 省级部门联审中撤回,从省级部门联审中到待预审
.withExternal()
.source(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS)
.target(ProjectStatusEnum.PENDING_PREQUALIFICATION)
.event(ProjectStatusChangeEvent.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_WITHDRAW).and()

// 预审通过,从预审中到部门联审中
.withExternal()
.source(ProjectStatusEnum.PRE_APPLYING)
.target(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW)
.event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_PASS).and()
// 预审驳回,从预审中到预审不通过
.withExternal()
.source(ProjectStatusEnum.PRE_APPLYING)
.target(ProjectStatusEnum.PREQUALIFICATION_FAILED)
.event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_REJECT).and()
// 预审中撤回,从预审中到预审中撤回选择态
.withExternal()
.source(ProjectStatusEnum.PRE_APPLYING)
.target(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE)
.event(ProjectStatusChangeEvent.PRE_APPLYING_WITHDRAW).and()
// 预审中撤回,从预审中撤回选择态->省级部门联审成功,待预审,完成其中一种状态
.withChoice()
.source(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE)
.first(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS,projectDeclareGuardFactory.new PendingPreQualificationChoiceGuard()
,new ProjectDeclareChoiceAction())
.last(ProjectStatusEnum.PENDING_PREQUALIFICATION,new ProjectDeclareChoiceAction()).and()
// 预审不通过重新提交,从预审不通过到待预审选择
.withExternal()
.source(ProjectStatusEnum.PREQUALIFICATION_FAILED)
.target(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE)
.event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_REJECT_RESUBMIT).and()
// 预审不通过重新提交,从待预审选择->省级部门联审中,预审中,完成其中一种状态
.withChoice()
.source(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE)
.first(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS,projectDeclareGuardFactory.new PendingPreQualificationChoiceGuard(),new ProjectDeclareChoiceAction())
.last(ProjectStatusEnum.PRE_APPLYING,new ProjectDeclareChoiceAction()).and()
// 部门联审通过,从部门联审中到年度计划中
.withExternal()
.source(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW)
.target(ProjectStatusEnum.IN_THE_ANNUAL_PLAN)
.event(ProjectStatusChangeEvent.DEPARTMENT_UNITED_REVIEW_PASS).and()
// 部门联审驳回,从部门联审中到部门联审不通过
.withExternal()
.source(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW)
.target(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW_FAILED)
.event(ProjectStatusChangeEvent.DEPARTMENT_UNITED_REVIEW_REJECT).and()
// 部门联审中撤回,从部门联审中到预审中
.withExternal()
.source(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW)
.target(ProjectStatusEnum.PRE_APPLYING)
.event(ProjectStatusChangeEvent.DEPARTMENT_JOINT_REVIEW_WITHDRAW).and()
// 年度计划中开启方案申报,从年度计划中到方案待申报
.withExternal()
.source(ProjectStatusEnum.IN_THE_ANNUAL_PLAN)
.target(ProjectStatusEnum.PLAN_TO_BE_DECLARED)
.event(ProjectStatusChangeEvent.ANNUAL_PLAN_PROJECT_OPEN_PLAN_DECLARE).and()
// 年度计划中暂缓,从年度计划中到被暂缓
.withExternal()
.source(ProjectStatusEnum.IN_THE_ANNUAL_PLAN)
.target(ProjectStatusEnum.BE_SUSPENDED)
.event(ProjectStatusChangeEvent.ANNUAL_PLAN_SUSPEND).and()
// 方案待申报申报方案,从方案待申报到方案评审中
.withExternal()
.source(ProjectStatusEnum.PLAN_TO_BE_DECLARED)
.target(ProjectStatusEnum.SCHEME_UNDER_REVIEW)
.event(ProjectStatusChangeEvent.DECLARE_PLAN).and()
// 方案评审通过,从方案评审中到待立项批复
.withExternal()
.source(ProjectStatusEnum.SCHEME_UNDER_REVIEW)
.target(ProjectStatusEnum.TO_BE_APPROVED)
.event(ProjectStatusChangeEvent.PLAN_REVIEW_PASS).and()
// 方案评审驳回,从方案评审中到方案评审不通过
.withExternal()
.source(ProjectStatusEnum.SCHEME_UNDER_REVIEW)
.target(ProjectStatusEnum.SCHEME_REVIEW_FAILED)
.event(ProjectStatusChangeEvent.PLAN_REVIEW_REJECT).and()
// 方案评审中撤回,从方案评审中到方案待申报
.withExternal()
.source(ProjectStatusEnum.SCHEME_UNDER_REVIEW)
.target(ProjectStatusEnum.PLAN_TO_BE_DECLARED)
.event(ProjectStatusChangeEvent.SCHEME_UNDER_REVIEW_WITHDRAW).and()
// 方案评审不通过重新提交,从方案评审不通过到方案评审中
.withExternal()
.source(ProjectStatusEnum.SCHEME_REVIEW_FAILED)
.target(ProjectStatusEnum.SCHEME_UNDER_REVIEW)
.event(ProjectStatusChangeEvent.PLAN_REVIEW_REJECT_RESUBMIT).and()
// 待立项批复批复,从待立项批复到待采购
.withExternal()
.source(ProjectStatusEnum.TO_BE_APPROVED)
.target(ProjectStatusEnum.TO_BE_PURCHASED)
.event(ProjectStatusChangeEvent.PROJECT_APPROVAL).and()
// 待采购采购备案,从待采购到实施中
.withExternal()
.source(ProjectStatusEnum.TO_BE_PURCHASED)
.target(ProjectStatusEnum.OPERATION)
.event(ProjectStatusChangeEvent.PURCHASE_PUT_ON_RECORD).and()
// 待开工 实施,从实施到建设中
.withExternal()
.source(ProjectStatusEnum.OPERATION)
.target(ProjectStatusEnum.UNDER_CONSTRUCTION)
.event(ProjectStatusChangeEvent.START_TO_WORK).and()
// 建设中初验备案,从建设中到待终验
.withExternal()
.source(ProjectStatusEnum.UNDER_CONSTRUCTION)
.target(ProjectStatusEnum.TO_BE_FINALLY_INSPECTED)
.event(ProjectStatusChangeEvent.PRELIMINARY_ACCEPTANCE_PUT_ON_RECORD).and()
// 待终验终验申请,从待终验到终验审核中
.withExternal()
.source(ProjectStatusEnum.TO_BE_FINALLY_INSPECTED)
.target(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW)
.event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_APPLICATION).and()
// 终审审核通过,从终审审核中到已归档
.withExternal()
.source(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW)
.target(ProjectStatusEnum.ARCHIVED)
.event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_PASS).and()
// 终审审核不通过,从终审审核中到终审审核不通过
.withExternal()
.source(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW)
.target(ProjectStatusEnum.FINAL_ACCEPTANCE_REVIEW_FAILED)
.event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_REJECT).and()
// 终审审核中撤回,从终审审核中到待终验
.withExternal()
.source(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW)
.target(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW)
.event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_IS_UNDER_REVIEW_WITHDRAW).and()
// 终验中 重新提交
.withExternal()
.source(ProjectStatusEnum.FINAL_ACCEPTANCE_REVIEW_FAILED)
.target(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW)
.event(ProjectStatusChangeEvent.FINAL_RE_ACCEPTANCE_APPLICATION).and();
return builder.build();
}

/**
* 持久化配置
* @author CMM
* @since 2023/02/07 16:22
*/
@Bean(name = "projectDeclareStateMachineJNPersister")
@Override
public StateMachinePersister<ProjectStatusEnum, ProjectStatusChangeEvent, Project> getProjectPersister() {
StateMachinePersister sp = new DefaultStateMachinePersister<>(new StateMachinePersist<ProjectStatusEnum, ProjectStatusChangeEvent, Project>() {
@Override
public void write(StateMachineContext<ProjectStatusEnum, ProjectStatusChangeEvent> context, Project contextObj) {
}

@Override
public StateMachineContext<ProjectStatusEnum, ProjectStatusChangeEvent> read(Project contextObj) {
StateMachineContext<ProjectStatusEnum, ProjectStatusChangeEvent> result = new DefaultStateMachineContext(ProjectStatusEnum.match(contextObj.getStatus()),
null, null, null, null, RegionContant.LS_JN_CODE);
return result;
}
});
stateMachinePersister = sp;
return sp;
}

public StateMachinePersister getStateMachinePersister(){
return stateMachinePersister;
}
}

+ 0
- 285
hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/ProjectDeclareStateMachineJYBuilder.java View File

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

import com.hz.pm.api.common.statemachine.action.ProjectDeclareChoiceAction;
import com.hz.pm.api.common.statemachine.contant.RegionContant;
import com.hz.pm.api.common.statemachine.event.ProjectStatusChangeEvent;
import com.hz.pm.api.common.statemachine.factory.ProjectDeclareGuardFactory;
import com.hz.pm.api.projectlib.model.enumeration.ProjectStatusEnum;
import com.hz.pm.api.projectlib.model.entity.Project;
import lombok.RequiredArgsConstructor;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.statemachine.StateMachine;
import org.springframework.statemachine.StateMachineContext;
import org.springframework.statemachine.StateMachinePersist;
import org.springframework.statemachine.config.EnableStateMachine;
import org.springframework.statemachine.config.StateMachineBuilder;
import org.springframework.statemachine.persist.DefaultStateMachinePersister;
import org.springframework.statemachine.persist.StateMachinePersister;
import org.springframework.statemachine.support.DefaultStateMachineContext;
import org.springframework.stereotype.Component;

import java.util.EnumSet;

/**
* 项目申报状态机
* 缙云县
* @author CMM
* @since 2023/02/07 15:56
*/
@Component
@EnableStateMachine(name= ProjectDeclareStateMachineJYBuilder.MACHINEID_TO)
@RequiredArgsConstructor
public class ProjectDeclareStateMachineJYBuilder implements ProjectDeclareStateMachineBuilder {
private static final ProjectDeclareGuardFactory projectDeclareGuardFactory = new ProjectDeclareGuardFactory();
private final BeanFactory beanFactory;
private Logger logger = LoggerFactory.getLogger(getClass());

private StateMachinePersister stateMachinePersister;
/**
* TO状态机
*/
public final static String MACHINEID_TO = RegionContant.LS_JY_CODE;

@Override
public StateMachine<ProjectStatusEnum, ProjectStatusChangeEvent> build() throws Exception {
StateMachine<ProjectStatusEnum, ProjectStatusChangeEvent> stateMachine = build(beanFactory);
logger.info("状态机ID:" + stateMachine.getId());
stateMachine.start();
return stateMachine;
}
/**
* 构建状态机
* @param beanFactory
* @author CMM
* @since 2023/02/07 16:15
*/
@Override
public StateMachine<ProjectStatusEnum, ProjectStatusChangeEvent> build(BeanFactory beanFactory) throws Exception {
StateMachineBuilder.Builder<ProjectStatusEnum, ProjectStatusChangeEvent> builder = StateMachineBuilder.builder();
builder.configureConfiguration()
.withConfiguration()
.machineId(MACHINEID_TO)
.beanFactory(beanFactory);

builder.configureStates()
.withStates()
.initial(ProjectStatusEnum.UNDER_INTERNAL_AUDIT)
.choice(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE)
.choice(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE)
.states(EnumSet.allOf(ProjectStatusEnum.class));

builder.configureTransitions()
// 单位内部审核通过,从单位内部审核中到待预审
.withExternal()
.source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT)
.target(ProjectStatusEnum.PENDING_PREQUALIFICATION)
.event(ProjectStatusChangeEvent.UNDER_INTERNAL_PASS).and()
// 单位内部审核驳回,从单位内部审核中到单位内部审核不通过
.withExternal()
.source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT)
.target(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS)
.event(ProjectStatusChangeEvent.UNDER_INTERNAL_REJECT).and()
// 单位内部审核中撤回,从单位内部审核中到待申报
.withExternal()
.source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT)
.target(ProjectStatusEnum.TO_BE_DECLARED)
.event(ProjectStatusChangeEvent.UNDER_INTERNAL_WITHDRAW).and()
// 单位内部审核不通过重新提交,从单位内部审核不通过到单位内部审核中
.withExternal()
.source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS)
.target(ProjectStatusEnum.UNDER_INTERNAL_AUDIT)
.event(ProjectStatusChangeEvent.UNDER_INTERNAL_REJECT_RESUBMIT).and()

// 待预审预审申报,从待预审到待预审选择
.withExternal()
.source(ProjectStatusEnum.PENDING_PREQUALIFICATION)
.target(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE)
.event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_DECLARE).and()
// 待预审申报,从待预审选择->省级部门联审中,预审中,完成其中一种状态
.withChoice()
.source(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE)
.first(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS,projectDeclareGuardFactory.new PendingPreQualificationChoiceGuard(),new ProjectDeclareChoiceAction())
.last(ProjectStatusEnum.PRE_APPLYING,new ProjectDeclareChoiceAction()).and()

// 省级部门联审通过,从省级部门联审中到省级部门联审成功
.withExternal()
.source(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS)
.target(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS)
.event(ProjectStatusChangeEvent.PROVINCIAL_DEPARTMENT_REVIEW_PASS).and()
// 省级部门联审通过,从省级部门联审成功到预审中
.withExternal()
.source(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS)
.target(ProjectStatusEnum.PRE_APPLYING)
.event(ProjectStatusChangeEvent.PROVINCIAL_PASS_TO_PRELIMINARY_REVIEW).and()
// 省级部门联审不通过,从省级部门联审中到省级部门联审不通过
.withExternal()
.source(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS)
.target(ProjectStatusEnum.THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED)
.event(ProjectStatusChangeEvent.PROVINCIAL_DEPARTMENT_REVIEW_REJECT).and()
// 省级部门联审中撤回,从省级部门联审中到待预审
.withExternal()
.source(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS)
.target(ProjectStatusEnum.PENDING_PREQUALIFICATION)
.event(ProjectStatusChangeEvent.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_WITHDRAW).and()

// 预审通过,从预审中到部门联审中
.withExternal()
.source(ProjectStatusEnum.PRE_APPLYING)
.target(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW)
.event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_PASS).and()
// 预审驳回,从预审中到预审不通过
.withExternal()
.source(ProjectStatusEnum.PRE_APPLYING)
.target(ProjectStatusEnum.PREQUALIFICATION_FAILED)
.event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_REJECT).and()
// 预审中撤回,从预审中到预审中撤回选择态
.withExternal()
.source(ProjectStatusEnum.PRE_APPLYING)
.target(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE)
.event(ProjectStatusChangeEvent.PRE_APPLYING_WITHDRAW).and()
// 预审中撤回,从预审中撤回选择态->省级部门联审成功,待预审,完成其中一种状态
.withChoice()
.source(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE)
.first(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS,projectDeclareGuardFactory.new PendingPreQualificationChoiceGuard()
,new ProjectDeclareChoiceAction())
.last(ProjectStatusEnum.PENDING_PREQUALIFICATION,new ProjectDeclareChoiceAction()).and()
// 预审不通过重新提交,从预审不通过到待预审选择
.withExternal()
.source(ProjectStatusEnum.PREQUALIFICATION_FAILED)
.target(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE)
.event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_REJECT_RESUBMIT).and()
// 预审不通过重新提交,从待预审选择->省级部门联审中,预审中,完成其中一种状态
.withChoice()
.source(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE)
.first(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS,projectDeclareGuardFactory.new PendingPreQualificationChoiceGuard(),new ProjectDeclareChoiceAction())
.last(ProjectStatusEnum.PRE_APPLYING,new ProjectDeclareChoiceAction()).and()
// 部门联审通过,从部门联审中到年度计划中
.withExternal()
.source(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW)
.target(ProjectStatusEnum.IN_THE_ANNUAL_PLAN)
.event(ProjectStatusChangeEvent.DEPARTMENT_UNITED_REVIEW_PASS).and()
// 部门联审驳回,从部门联审中到部门联审不通过
.withExternal()
.source(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW)
.target(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW_FAILED)
.event(ProjectStatusChangeEvent.DEPARTMENT_UNITED_REVIEW_REJECT).and()
// 部门联审中撤回,从部门联审中到预审中
.withExternal()
.source(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW)
.target(ProjectStatusEnum.PRE_APPLYING)
.event(ProjectStatusChangeEvent.DEPARTMENT_JOINT_REVIEW_WITHDRAW).and()
// 年度计划中开启方案申报,从年度计划中到方案待申报
.withExternal()
.source(ProjectStatusEnum.IN_THE_ANNUAL_PLAN)
.target(ProjectStatusEnum.PLAN_TO_BE_DECLARED)
.event(ProjectStatusChangeEvent.ANNUAL_PLAN_PROJECT_OPEN_PLAN_DECLARE).and()
// 年度计划中暂缓,从年度计划中到被暂缓
.withExternal()
.source(ProjectStatusEnum.IN_THE_ANNUAL_PLAN)
.target(ProjectStatusEnum.BE_SUSPENDED)
.event(ProjectStatusChangeEvent.ANNUAL_PLAN_SUSPEND).and()
// 方案待申报申报方案,从方案待申报到方案评审中
.withExternal()
.source(ProjectStatusEnum.PLAN_TO_BE_DECLARED)
.target(ProjectStatusEnum.SCHEME_UNDER_REVIEW)
.event(ProjectStatusChangeEvent.DECLARE_PLAN).and()
// 方案评审通过,从方案评审中到待立项批复
.withExternal()
.source(ProjectStatusEnum.SCHEME_UNDER_REVIEW)
.target(ProjectStatusEnum.TO_BE_APPROVED)
.event(ProjectStatusChangeEvent.PLAN_REVIEW_PASS).and()
// 方案评审驳回,从方案评审中到方案评审不通过
.withExternal()
.source(ProjectStatusEnum.SCHEME_UNDER_REVIEW)
.target(ProjectStatusEnum.SCHEME_REVIEW_FAILED)
.event(ProjectStatusChangeEvent.PLAN_REVIEW_REJECT).and()
// 方案评审中撤回,从方案评审中到方案待申报
.withExternal()
.source(ProjectStatusEnum.SCHEME_UNDER_REVIEW)
.target(ProjectStatusEnum.PLAN_TO_BE_DECLARED)
.event(ProjectStatusChangeEvent.SCHEME_UNDER_REVIEW_WITHDRAW).and()
// 方案评审不通过重新提交,从方案评审不通过到方案评审中
.withExternal()
.source(ProjectStatusEnum.SCHEME_REVIEW_FAILED)
.target(ProjectStatusEnum.SCHEME_UNDER_REVIEW)
.event(ProjectStatusChangeEvent.PLAN_REVIEW_REJECT_RESUBMIT).and()
// 待立项批复批复,从待立项批复到待采购
.withExternal()
.source(ProjectStatusEnum.TO_BE_APPROVED)
.target(ProjectStatusEnum.TO_BE_PURCHASED)
.event(ProjectStatusChangeEvent.PROJECT_APPROVAL).and()
// 待采购采购备案,从待采购到实施中
.withExternal()
.source(ProjectStatusEnum.TO_BE_PURCHASED)
.target(ProjectStatusEnum.OPERATION)
.event(ProjectStatusChangeEvent.PURCHASE_PUT_ON_RECORD).and()

// 待开工 实施,从实施到建设中
.withExternal()
.source(ProjectStatusEnum.OPERATION)
.target(ProjectStatusEnum.UNDER_CONSTRUCTION)
.event(ProjectStatusChangeEvent.START_TO_WORK).and()
// 建设中初验备案,从建设中到待终验
.withExternal()
.source(ProjectStatusEnum.UNDER_CONSTRUCTION)
.target(ProjectStatusEnum.TO_BE_FINALLY_INSPECTED)
.event(ProjectStatusChangeEvent.PRELIMINARY_ACCEPTANCE_PUT_ON_RECORD).and()
// 待终验终验申请,从待终验到终验审核中
.withExternal()
.source(ProjectStatusEnum.TO_BE_FINALLY_INSPECTED)
.target(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW)
.event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_APPLICATION).and()
// 终审审核通过,从终审审核中到已归档
.withExternal()
.source(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW)
.target(ProjectStatusEnum.ARCHIVED)
.event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_PASS).and()
// 终审审核不通过,从终审审核中到终审审核不通过
.withExternal()
.source(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW)
.target(ProjectStatusEnum.FINAL_ACCEPTANCE_REVIEW_FAILED)
.event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_REJECT).and()
// 终审审核中撤回,从终审审核中到待终验
.withExternal()
.source(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW)
.target(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW)
.event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_IS_UNDER_REVIEW_WITHDRAW).and()
// 终验中 重新提交
.withExternal()
.source(ProjectStatusEnum.FINAL_ACCEPTANCE_REVIEW_FAILED)
.target(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW)
.event(ProjectStatusChangeEvent.FINAL_RE_ACCEPTANCE_APPLICATION).and();
return builder.build();
}

/**
* 持久化配置
* @author CMM
* @since 2023/02/07 16:22
*/
@Bean(name = "projectDeclareStateMachineJYPersister")
@Override
public StateMachinePersister<ProjectStatusEnum, ProjectStatusChangeEvent, Project> getProjectPersister() {
StateMachinePersister sp = new DefaultStateMachinePersister<>(new StateMachinePersist<ProjectStatusEnum, ProjectStatusChangeEvent, Project>() {
@Override
public void write(StateMachineContext<ProjectStatusEnum, ProjectStatusChangeEvent> context, Project contextObj) {
}

@Override
public StateMachineContext<ProjectStatusEnum, ProjectStatusChangeEvent> read(Project contextObj) {
StateMachineContext<ProjectStatusEnum, ProjectStatusChangeEvent> result = new DefaultStateMachineContext(ProjectStatusEnum.match(contextObj.getStatus()),
null, null, null, null, RegionContant.LS_JY_CODE);
return result;
}
});
stateMachinePersister = sp;
return sp;
}

public StateMachinePersister getStateMachinePersister(){
return stateMachinePersister;
}
}

+ 0
- 285
hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/ProjectDeclareStateMachineKFQBuilder.java View File

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

import com.hz.pm.api.common.statemachine.action.ProjectDeclareChoiceAction;
import com.hz.pm.api.common.statemachine.contant.RegionContant;
import com.hz.pm.api.common.statemachine.event.ProjectStatusChangeEvent;
import com.hz.pm.api.common.statemachine.factory.ProjectDeclareGuardFactory;
import com.hz.pm.api.projectlib.model.enumeration.ProjectStatusEnum;
import com.hz.pm.api.projectlib.model.entity.Project;
import lombok.RequiredArgsConstructor;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.statemachine.StateMachine;
import org.springframework.statemachine.StateMachineContext;
import org.springframework.statemachine.StateMachinePersist;
import org.springframework.statemachine.config.EnableStateMachine;
import org.springframework.statemachine.config.StateMachineBuilder;
import org.springframework.statemachine.persist.DefaultStateMachinePersister;
import org.springframework.statemachine.persist.StateMachinePersister;
import org.springframework.statemachine.support.DefaultStateMachineContext;
import org.springframework.stereotype.Component;

import java.util.EnumSet;

/**
* 项目申报状态机
* 开发区
* @author CMM
* @since 2023/02/07 15:56
*/
@Component
@EnableStateMachine(name= ProjectDeclareStateMachineKFQBuilder.MACHINEID_TO)
@RequiredArgsConstructor
public class ProjectDeclareStateMachineKFQBuilder implements ProjectDeclareStateMachineBuilder {
private static final ProjectDeclareGuardFactory projectDeclareGuardFactory = new ProjectDeclareGuardFactory();
private final BeanFactory beanFactory;
private Logger logger = LoggerFactory.getLogger(getClass());

private StateMachinePersister stateMachinePersister;
/**
* TO状态机
*/
public final static String MACHINEID_TO = RegionContant.LS_KFQ_CODE;

@Override
public StateMachine<ProjectStatusEnum, ProjectStatusChangeEvent> build() throws Exception {
StateMachine<ProjectStatusEnum, ProjectStatusChangeEvent> stateMachine = build(beanFactory);
logger.info("状态机ID:" + stateMachine.getId());
stateMachine.start();
return stateMachine;
}
/**
* 构建状态机
* @param beanFactory
* @author CMM
* @since 2023/02/07 16:15
*/
@Override
public StateMachine<ProjectStatusEnum, ProjectStatusChangeEvent> build(BeanFactory beanFactory) throws Exception {
StateMachineBuilder.Builder<ProjectStatusEnum, ProjectStatusChangeEvent> builder = StateMachineBuilder.builder();
builder.configureConfiguration()
.withConfiguration()
.machineId(MACHINEID_TO)
.beanFactory(beanFactory);

builder.configureStates()
.withStates()
.initial(ProjectStatusEnum.UNDER_INTERNAL_AUDIT)
.choice(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE)
.choice(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE)
.states(EnumSet.allOf(ProjectStatusEnum.class));

builder.configureTransitions()
// 单位内部审核通过,从单位内部审核中到待预审
.withExternal()
.source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT)
.target(ProjectStatusEnum.PENDING_PREQUALIFICATION)
.event(ProjectStatusChangeEvent.UNDER_INTERNAL_PASS).and()
// 单位内部审核驳回,从单位内部审核中到单位内部审核不通过
.withExternal()
.source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT)
.target(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS)
.event(ProjectStatusChangeEvent.UNDER_INTERNAL_REJECT).and()
// 单位内部审核中撤回,从单位内部审核中到待申报
.withExternal()
.source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT)
.target(ProjectStatusEnum.TO_BE_DECLARED)
.event(ProjectStatusChangeEvent.UNDER_INTERNAL_WITHDRAW).and()
// 单位内部审核不通过重新提交,从单位内部审核不通过到单位内部审核中
.withExternal()
.source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS)
.target(ProjectStatusEnum.UNDER_INTERNAL_AUDIT)
.event(ProjectStatusChangeEvent.UNDER_INTERNAL_REJECT_RESUBMIT).and()

// 待预审预审申报,从待预审到待预审选择
.withExternal()
.source(ProjectStatusEnum.PENDING_PREQUALIFICATION)
.target(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE)
.event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_DECLARE).and()
// 待预审申报,从待预审选择->省级部门联审中,预审中,完成其中一种状态
.withChoice()
.source(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE)
.first(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS,projectDeclareGuardFactory.new PendingPreQualificationChoiceGuard(),new ProjectDeclareChoiceAction())
.last(ProjectStatusEnum.PRE_APPLYING,new ProjectDeclareChoiceAction()).and()

// 省级部门联审通过,从省级部门联审中到省级部门联审成功
.withExternal()
.source(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS)
.target(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS)
.event(ProjectStatusChangeEvent.PROVINCIAL_DEPARTMENT_REVIEW_PASS).and()
// 省级部门联审通过,从省级部门联审成功到预审中
.withExternal()
.source(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS)
.target(ProjectStatusEnum.PRE_APPLYING)
.event(ProjectStatusChangeEvent.PROVINCIAL_PASS_TO_PRELIMINARY_REVIEW).and()
// 省级部门联审不通过,从省级部门联审中到省级部门联审不通过
.withExternal()
.source(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS)
.target(ProjectStatusEnum.THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED)
.event(ProjectStatusChangeEvent.PROVINCIAL_DEPARTMENT_REVIEW_REJECT).and()
// 省级部门联审中撤回,从省级部门联审中到待预审
.withExternal()
.source(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS)
.target(ProjectStatusEnum.PENDING_PREQUALIFICATION)
.event(ProjectStatusChangeEvent.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_WITHDRAW).and()

// 预审通过,从预审中到部门联审中
.withExternal()
.source(ProjectStatusEnum.PRE_APPLYING)
.target(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW)
.event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_PASS).and()
// 预审驳回,从预审中到预审不通过
.withExternal()
.source(ProjectStatusEnum.PRE_APPLYING)
.target(ProjectStatusEnum.PREQUALIFICATION_FAILED)
.event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_REJECT).and()
// 预审中撤回,从预审中到预审中撤回选择态
.withExternal()
.source(ProjectStatusEnum.PRE_APPLYING)
.target(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE)
.event(ProjectStatusChangeEvent.PRE_APPLYING_WITHDRAW).and()
// 预审中撤回,从预审中撤回选择态->省级部门联审成功,待预审,完成其中一种状态
.withChoice()
.source(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE)
.first(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS,projectDeclareGuardFactory.new PendingPreQualificationChoiceGuard()
,new ProjectDeclareChoiceAction())
.last(ProjectStatusEnum.PENDING_PREQUALIFICATION,new ProjectDeclareChoiceAction()).and()
// 预审不通过重新提交,从预审不通过到待预审选择
.withExternal()
.source(ProjectStatusEnum.PREQUALIFICATION_FAILED)
.target(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE)
.event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_REJECT_RESUBMIT).and()
// 预审不通过重新提交,从待预审选择->省级部门联审中,预审中,完成其中一种状态
.withChoice()
.source(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE)
.first(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS,projectDeclareGuardFactory.new PendingPreQualificationChoiceGuard(),new ProjectDeclareChoiceAction())
.last(ProjectStatusEnum.PRE_APPLYING,new ProjectDeclareChoiceAction()).and()
// 部门联审通过,从部门联审中到年度计划中
.withExternal()
.source(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW)
.target(ProjectStatusEnum.IN_THE_ANNUAL_PLAN)
.event(ProjectStatusChangeEvent.DEPARTMENT_UNITED_REVIEW_PASS).and()
// 部门联审驳回,从部门联审中到部门联审不通过
.withExternal()
.source(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW)
.target(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW_FAILED)
.event(ProjectStatusChangeEvent.DEPARTMENT_UNITED_REVIEW_REJECT).and()
// 部门联审中撤回,从部门联审中到预审中
.withExternal()
.source(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW)
.target(ProjectStatusEnum.PRE_APPLYING)
.event(ProjectStatusChangeEvent.DEPARTMENT_JOINT_REVIEW_WITHDRAW).and()
// 年度计划中开启方案申报,从年度计划中到方案待申报
.withExternal()
.source(ProjectStatusEnum.IN_THE_ANNUAL_PLAN)
.target(ProjectStatusEnum.PLAN_TO_BE_DECLARED)
.event(ProjectStatusChangeEvent.ANNUAL_PLAN_PROJECT_OPEN_PLAN_DECLARE).and()
// 年度计划中暂缓,从年度计划中到被暂缓
.withExternal()
.source(ProjectStatusEnum.IN_THE_ANNUAL_PLAN)
.target(ProjectStatusEnum.BE_SUSPENDED)
.event(ProjectStatusChangeEvent.ANNUAL_PLAN_SUSPEND).and()
// 方案待申报申报方案,从方案待申报到方案评审中
.withExternal()
.source(ProjectStatusEnum.PLAN_TO_BE_DECLARED)
.target(ProjectStatusEnum.SCHEME_UNDER_REVIEW)
.event(ProjectStatusChangeEvent.DECLARE_PLAN).and()
// 方案评审通过,从方案评审中到待立项批复
.withExternal()
.source(ProjectStatusEnum.SCHEME_UNDER_REVIEW)
.target(ProjectStatusEnum.TO_BE_APPROVED)
.event(ProjectStatusChangeEvent.PLAN_REVIEW_PASS).and()
// 方案评审驳回,从方案评审中到方案评审不通过
.withExternal()
.source(ProjectStatusEnum.SCHEME_UNDER_REVIEW)
.target(ProjectStatusEnum.SCHEME_REVIEW_FAILED)
.event(ProjectStatusChangeEvent.PLAN_REVIEW_REJECT).and()
// 方案评审中撤回,从方案评审中到方案待申报
.withExternal()
.source(ProjectStatusEnum.SCHEME_UNDER_REVIEW)
.target(ProjectStatusEnum.PLAN_TO_BE_DECLARED)
.event(ProjectStatusChangeEvent.SCHEME_UNDER_REVIEW_WITHDRAW).and()
// 方案评审不通过重新提交,从方案评审不通过到方案评审中
.withExternal()
.source(ProjectStatusEnum.SCHEME_REVIEW_FAILED)
.target(ProjectStatusEnum.SCHEME_UNDER_REVIEW)
.event(ProjectStatusChangeEvent.PLAN_REVIEW_REJECT_RESUBMIT).and()
// 待立项批复批复,从待立项批复到待采购
.withExternal()
.source(ProjectStatusEnum.TO_BE_APPROVED)
.target(ProjectStatusEnum.TO_BE_PURCHASED)
.event(ProjectStatusChangeEvent.PROJECT_APPROVAL).and()
// 待采购采购备案,从待采购到实施中
.withExternal()
.source(ProjectStatusEnum.TO_BE_PURCHASED)
.target(ProjectStatusEnum.OPERATION)
.event(ProjectStatusChangeEvent.PURCHASE_PUT_ON_RECORD).and()

// 待开工 实施,从实施到建设中
.withExternal()
.source(ProjectStatusEnum.OPERATION)
.target(ProjectStatusEnum.UNDER_CONSTRUCTION)
.event(ProjectStatusChangeEvent.START_TO_WORK).and()
// 建设中初验备案,从建设中到待终验
.withExternal()
.source(ProjectStatusEnum.UNDER_CONSTRUCTION)
.target(ProjectStatusEnum.TO_BE_FINALLY_INSPECTED)
.event(ProjectStatusChangeEvent.PRELIMINARY_ACCEPTANCE_PUT_ON_RECORD).and()
// 待终验终验申请,从待终验到终验审核中
.withExternal()
.source(ProjectStatusEnum.TO_BE_FINALLY_INSPECTED)
.target(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW)
.event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_APPLICATION).and()
// 终审审核通过,从终审审核中到已归档
.withExternal()
.source(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW)
.target(ProjectStatusEnum.ARCHIVED)
.event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_PASS).and()
// 终审审核不通过,从终审审核中到终审审核不通过
.withExternal()
.source(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW)
.target(ProjectStatusEnum.FINAL_ACCEPTANCE_REVIEW_FAILED)
.event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_REJECT).and()
// 终审审核中撤回,从终审审核中到待终验
.withExternal()
.source(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW)
.target(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW)
.event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_IS_UNDER_REVIEW_WITHDRAW).and()
// 终验中 重新提交
.withExternal()
.source(ProjectStatusEnum.FINAL_ACCEPTANCE_REVIEW_FAILED)
.target(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW)
.event(ProjectStatusChangeEvent.FINAL_RE_ACCEPTANCE_APPLICATION).and();
return builder.build();
}

/**
* 持久化配置
* @author CMM
* @since 2023/02/07 16:22
*/
@Bean(name = "projectDeclareStateMachineKFQPersister")
@Override
public StateMachinePersister<ProjectStatusEnum, ProjectStatusChangeEvent, Project> getProjectPersister() {
StateMachinePersister sp = new DefaultStateMachinePersister<>(new StateMachinePersist<ProjectStatusEnum, ProjectStatusChangeEvent, Project>() {
@Override
public void write(StateMachineContext<ProjectStatusEnum, ProjectStatusChangeEvent> context, Project contextObj) {
}

@Override
public StateMachineContext<ProjectStatusEnum, ProjectStatusChangeEvent> read(Project contextObj) {
StateMachineContext<ProjectStatusEnum, ProjectStatusChangeEvent> result = new DefaultStateMachineContext(ProjectStatusEnum.match(contextObj.getStatus()),
null, null, null, null, RegionContant.LS_KFQ_CODE);
return result;
}
});
stateMachinePersister = sp;
return sp;
}

public StateMachinePersister getStateMachinePersister(){
return stateMachinePersister;
}
}

+ 0
- 285
hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/ProjectDeclareStateMachineLDBuilder.java View File

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

import com.hz.pm.api.common.statemachine.action.ProjectDeclareChoiceAction;
import com.hz.pm.api.common.statemachine.contant.RegionContant;
import com.hz.pm.api.common.statemachine.event.ProjectStatusChangeEvent;
import com.hz.pm.api.common.statemachine.factory.ProjectDeclareGuardFactory;
import com.hz.pm.api.projectlib.model.enumeration.ProjectStatusEnum;
import com.hz.pm.api.projectlib.model.entity.Project;
import lombok.RequiredArgsConstructor;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.statemachine.StateMachine;
import org.springframework.statemachine.StateMachineContext;
import org.springframework.statemachine.StateMachinePersist;
import org.springframework.statemachine.config.EnableStateMachine;
import org.springframework.statemachine.config.StateMachineBuilder;
import org.springframework.statemachine.persist.DefaultStateMachinePersister;
import org.springframework.statemachine.persist.StateMachinePersister;
import org.springframework.statemachine.support.DefaultStateMachineContext;
import org.springframework.stereotype.Component;

import java.util.EnumSet;

/**
* 项目申报状态机
* 莲都区
* @author CMM
* @since 2023/02/07 15:56
*/
@Component
@EnableStateMachine(name= ProjectDeclareStateMachineLDBuilder.MACHINEID_TO)
@RequiredArgsConstructor
public class ProjectDeclareStateMachineLDBuilder implements ProjectDeclareStateMachineBuilder {
private static final ProjectDeclareGuardFactory projectDeclareGuardFactory = new ProjectDeclareGuardFactory();
private final BeanFactory beanFactory;

private StateMachinePersister stateMachinePersister;
private Logger logger = LoggerFactory.getLogger(getClass());
/**
* TO状态机
*/
public final static String MACHINEID_TO = RegionContant.LS_LD_CODE;

@Override
public StateMachine<ProjectStatusEnum, ProjectStatusChangeEvent> build() throws Exception {
StateMachine<ProjectStatusEnum, ProjectStatusChangeEvent> stateMachine = build(beanFactory);
logger.info("状态机ID:" + stateMachine.getId());
stateMachine.start();
return stateMachine;
}
/**
* 构建状态机
* @param beanFactory
* @author CMM
* @since 2023/02/07 16:15
*/
@Override
public StateMachine<ProjectStatusEnum, ProjectStatusChangeEvent> build(BeanFactory beanFactory) throws Exception {
StateMachineBuilder.Builder<ProjectStatusEnum, ProjectStatusChangeEvent> builder = StateMachineBuilder.builder();
builder.configureConfiguration()
.withConfiguration()
.machineId(MACHINEID_TO)
.beanFactory(beanFactory);

builder.configureStates()
.withStates()
.initial(ProjectStatusEnum.UNDER_INTERNAL_AUDIT)
.choice(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE)
.choice(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE)
.states(EnumSet.allOf(ProjectStatusEnum.class));

builder.configureTransitions()
// 单位内部审核通过,从单位内部审核中到待预审
.withExternal()
.source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT)
.target(ProjectStatusEnum.PENDING_PREQUALIFICATION)
.event(ProjectStatusChangeEvent.UNDER_INTERNAL_PASS).and()
// 单位内部审核驳回,从单位内部审核中到单位内部审核不通过
.withExternal()
.source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT)
.target(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS)
.event(ProjectStatusChangeEvent.UNDER_INTERNAL_REJECT).and()
// 单位内部审核中撤回,从单位内部审核中到待申报
.withExternal()
.source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT)
.target(ProjectStatusEnum.TO_BE_DECLARED)
.event(ProjectStatusChangeEvent.UNDER_INTERNAL_WITHDRAW).and()
// 单位内部审核不通过重新提交,从单位内部审核不通过到单位内部审核中
.withExternal()
.source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS)
.target(ProjectStatusEnum.UNDER_INTERNAL_AUDIT)
.event(ProjectStatusChangeEvent.UNDER_INTERNAL_REJECT_RESUBMIT).and()

// 待预审预审申报,从待预审到待预审选择
.withExternal()
.source(ProjectStatusEnum.PENDING_PREQUALIFICATION)
.target(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE)
.event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_DECLARE).and()
// 待预审申报,从待预审选择->省级部门联审中,预审中,完成其中一种状态
.withChoice()
.source(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE)
.first(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS,projectDeclareGuardFactory.new PendingPreQualificationChoiceGuard(),new ProjectDeclareChoiceAction())
.last(ProjectStatusEnum.PRE_APPLYING,new ProjectDeclareChoiceAction()).and()

// 省级部门联审通过,从省级部门联审中到省级部门联审成功
.withExternal()
.source(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS)
.target(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS)
.event(ProjectStatusChangeEvent.PROVINCIAL_DEPARTMENT_REVIEW_PASS).and()
// 省级部门联审通过,从省级部门联审成功到预审中
.withExternal()
.source(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS)
.target(ProjectStatusEnum.PRE_APPLYING)
.event(ProjectStatusChangeEvent.PROVINCIAL_PASS_TO_PRELIMINARY_REVIEW).and()
// 省级部门联审不通过,从省级部门联审中到省级部门联审不通过
.withExternal()
.source(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS)
.target(ProjectStatusEnum.THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED)
.event(ProjectStatusChangeEvent.PROVINCIAL_DEPARTMENT_REVIEW_REJECT).and()
// 省级部门联审中撤回,从省级部门联审中到待预审
.withExternal()
.source(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS)
.target(ProjectStatusEnum.PENDING_PREQUALIFICATION)
.event(ProjectStatusChangeEvent.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_WITHDRAW).and()

// 预审通过,从预审中到部门联审中
.withExternal()
.source(ProjectStatusEnum.PRE_APPLYING)
.target(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW)
.event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_PASS).and()
// 预审驳回,从预审中到预审不通过
.withExternal()
.source(ProjectStatusEnum.PRE_APPLYING)
.target(ProjectStatusEnum.PREQUALIFICATION_FAILED)
.event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_REJECT).and()
// 预审中撤回,从预审中到预审中撤回选择态
.withExternal()
.source(ProjectStatusEnum.PRE_APPLYING)
.target(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE)
.event(ProjectStatusChangeEvent.PRE_APPLYING_WITHDRAW).and()
// 预审中撤回,从预审中撤回选择态->省级部门联审成功,待预审,完成其中一种状态
.withChoice()
.source(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE)
.first(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS,projectDeclareGuardFactory.new PendingPreQualificationChoiceGuard()
,new ProjectDeclareChoiceAction())
.last(ProjectStatusEnum.PENDING_PREQUALIFICATION,new ProjectDeclareChoiceAction()).and()
// 预审不通过重新提交,从预审不通过到待预审选择
.withExternal()
.source(ProjectStatusEnum.PREQUALIFICATION_FAILED)
.target(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE)
.event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_REJECT_RESUBMIT).and()
// 预审不通过重新提交,从待预审选择->省级部门联审中,预审中,完成其中一种状态
.withChoice()
.source(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE)
.first(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS,projectDeclareGuardFactory.new PendingPreQualificationChoiceGuard(),new ProjectDeclareChoiceAction())
.last(ProjectStatusEnum.PRE_APPLYING,new ProjectDeclareChoiceAction()).and()
// 部门联审通过,从部门联审中到年度计划中
.withExternal()
.source(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW)
.target(ProjectStatusEnum.IN_THE_ANNUAL_PLAN)
.event(ProjectStatusChangeEvent.DEPARTMENT_UNITED_REVIEW_PASS).and()
// 部门联审驳回,从部门联审中到部门联审不通过
.withExternal()
.source(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW)
.target(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW_FAILED)
.event(ProjectStatusChangeEvent.DEPARTMENT_UNITED_REVIEW_REJECT).and()
// 部门联审中撤回,从部门联审中到预审中
.withExternal()
.source(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW)
.target(ProjectStatusEnum.PRE_APPLYING)
.event(ProjectStatusChangeEvent.DEPARTMENT_JOINT_REVIEW_WITHDRAW).and()
// 年度计划中开启方案申报,从年度计划中到方案待申报
.withExternal()
.source(ProjectStatusEnum.IN_THE_ANNUAL_PLAN)
.target(ProjectStatusEnum.PLAN_TO_BE_DECLARED)
.event(ProjectStatusChangeEvent.ANNUAL_PLAN_PROJECT_OPEN_PLAN_DECLARE).and()
// 年度计划中暂缓,从年度计划中到被暂缓
.withExternal()
.source(ProjectStatusEnum.IN_THE_ANNUAL_PLAN)
.target(ProjectStatusEnum.BE_SUSPENDED)
.event(ProjectStatusChangeEvent.ANNUAL_PLAN_SUSPEND).and()
// 方案待申报申报方案,从方案待申报到方案评审中
.withExternal()
.source(ProjectStatusEnum.PLAN_TO_BE_DECLARED)
.target(ProjectStatusEnum.SCHEME_UNDER_REVIEW)
.event(ProjectStatusChangeEvent.DECLARE_PLAN).and()
// 方案评审通过,从方案评审中到待立项批复
.withExternal()
.source(ProjectStatusEnum.SCHEME_UNDER_REVIEW)
.target(ProjectStatusEnum.TO_BE_APPROVED)
.event(ProjectStatusChangeEvent.PLAN_REVIEW_PASS).and()
// 方案评审驳回,从方案评审中到方案评审不通过
.withExternal()
.source(ProjectStatusEnum.SCHEME_UNDER_REVIEW)
.target(ProjectStatusEnum.SCHEME_REVIEW_FAILED)
.event(ProjectStatusChangeEvent.PLAN_REVIEW_REJECT).and()
// 方案评审中撤回,从方案评审中到方案待申报
.withExternal()
.source(ProjectStatusEnum.SCHEME_UNDER_REVIEW)
.target(ProjectStatusEnum.PLAN_TO_BE_DECLARED)
.event(ProjectStatusChangeEvent.SCHEME_UNDER_REVIEW_WITHDRAW).and()
// 方案评审不通过重新提交,从方案评审不通过到方案评审中
.withExternal()
.source(ProjectStatusEnum.SCHEME_REVIEW_FAILED)
.target(ProjectStatusEnum.SCHEME_UNDER_REVIEW)
.event(ProjectStatusChangeEvent.PLAN_REVIEW_REJECT_RESUBMIT).and()
// 待立项批复批复,从待立项批复到待采购
.withExternal()
.source(ProjectStatusEnum.TO_BE_APPROVED)
.target(ProjectStatusEnum.TO_BE_PURCHASED)
.event(ProjectStatusChangeEvent.PROJECT_APPROVAL).and()
// 待采购采购备案,从待采购到实施中
.withExternal()
.source(ProjectStatusEnum.TO_BE_PURCHASED)
.target(ProjectStatusEnum.OPERATION)
.event(ProjectStatusChangeEvent.PURCHASE_PUT_ON_RECORD).and()

// 待开工 实施,从实施到建设中
.withExternal()
.source(ProjectStatusEnum.OPERATION)
.target(ProjectStatusEnum.UNDER_CONSTRUCTION)
.event(ProjectStatusChangeEvent.START_TO_WORK).and()
// 建设中初验备案,从建设中到待终验
.withExternal()
.source(ProjectStatusEnum.UNDER_CONSTRUCTION)
.target(ProjectStatusEnum.TO_BE_FINALLY_INSPECTED)
.event(ProjectStatusChangeEvent.PRELIMINARY_ACCEPTANCE_PUT_ON_RECORD).and()
// 待终验终验申请,从待终验到终验审核中
.withExternal()
.source(ProjectStatusEnum.TO_BE_FINALLY_INSPECTED)
.target(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW)
.event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_APPLICATION).and()
// 终审审核通过,从终审审核中到已归档
.withExternal()
.source(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW)
.target(ProjectStatusEnum.ARCHIVED)
.event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_PASS).and()
// 终审审核不通过,从终审审核中到终审审核不通过
.withExternal()
.source(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW)
.target(ProjectStatusEnum.FINAL_ACCEPTANCE_REVIEW_FAILED)
.event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_REJECT).and()
// 终审审核中撤回,从终审审核中到待终验
.withExternal()
.source(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW)
.target(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW)
.event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_IS_UNDER_REVIEW_WITHDRAW).and()
// 终验中 重新提交
.withExternal()
.source(ProjectStatusEnum.FINAL_ACCEPTANCE_REVIEW_FAILED)
.target(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW)
.event(ProjectStatusChangeEvent.FINAL_RE_ACCEPTANCE_APPLICATION).and();
return builder.build();
}

/**
* 持久化配置
* @author CMM
* @since 2023/02/07 16:22
*/
@Bean(name = "projectDeclareStateMachineLDPersister")
@Override
public StateMachinePersister<ProjectStatusEnum, ProjectStatusChangeEvent, Project> getProjectPersister() {
StateMachinePersister sp = new DefaultStateMachinePersister<>(new StateMachinePersist<ProjectStatusEnum, ProjectStatusChangeEvent, Project>() {
@Override
public void write(StateMachineContext<ProjectStatusEnum, ProjectStatusChangeEvent> context, Project contextObj) {
}

@Override
public StateMachineContext<ProjectStatusEnum, ProjectStatusChangeEvent> read(Project contextObj) {
StateMachineContext<ProjectStatusEnum, ProjectStatusChangeEvent> result = new DefaultStateMachineContext(ProjectStatusEnum.match(contextObj.getStatus()),
null, null, null, null, RegionContant.LS_LD_CODE);
return result;
}
});
stateMachinePersister = sp;
return sp;
}

public StateMachinePersister getStateMachinePersister(){
return stateMachinePersister;
}
}

+ 0
- 286
hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/ProjectDeclareStateMachineLQBuilder.java View File

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

import com.hz.pm.api.common.statemachine.action.ProjectDeclareChoiceAction;
import com.hz.pm.api.common.statemachine.contant.RegionContant;
import com.hz.pm.api.common.statemachine.event.ProjectStatusChangeEvent;
import com.hz.pm.api.common.statemachine.factory.ProjectDeclareGuardFactory;
import com.hz.pm.api.projectlib.model.enumeration.ProjectStatusEnum;
import com.hz.pm.api.projectlib.model.entity.Project;
import lombok.RequiredArgsConstructor;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.statemachine.StateMachine;
import org.springframework.statemachine.StateMachineContext;
import org.springframework.statemachine.StateMachinePersist;
import org.springframework.statemachine.config.EnableStateMachine;
import org.springframework.statemachine.config.StateMachineBuilder;
import org.springframework.statemachine.persist.DefaultStateMachinePersister;
import org.springframework.statemachine.persist.StateMachinePersister;
import org.springframework.statemachine.support.DefaultStateMachineContext;
import org.springframework.stereotype.Component;

import java.util.EnumSet;

/**
* 项目申报状态机
* 龙泉市
* @author CMM
* @since 2023/02/07 15:56
*/
@Component
@EnableStateMachine(name= ProjectDeclareStateMachineLQBuilder.MACHINEID_TO)
@RequiredArgsConstructor
public class ProjectDeclareStateMachineLQBuilder implements ProjectDeclareStateMachineBuilder {
private static final ProjectDeclareGuardFactory projectDeclareGuardFactory = new ProjectDeclareGuardFactory();
private final BeanFactory beanFactory;

private StateMachinePersister stateMachinePersister;
private Logger logger = LoggerFactory.getLogger(getClass());
/**
* TO状态机
*/
public final static String MACHINEID_TO = RegionContant.LS_LQ_CODE;

@Override
public StateMachine<ProjectStatusEnum, ProjectStatusChangeEvent> build() throws Exception {
StateMachine<ProjectStatusEnum, ProjectStatusChangeEvent> stateMachine = build(beanFactory);
logger.info("状态机ID:" + stateMachine.getId());
stateMachine.start();
return stateMachine;
}
/**
* 构建状态机
* @param beanFactory
* @author CMM
* @since 2023/02/07 16:15
*/
@Override
public StateMachine<ProjectStatusEnum, ProjectStatusChangeEvent> build(BeanFactory beanFactory) throws Exception {
StateMachineBuilder.Builder<ProjectStatusEnum, ProjectStatusChangeEvent> builder = StateMachineBuilder.builder();
builder.configureConfiguration()
.withConfiguration()
.machineId(MACHINEID_TO)
.beanFactory(beanFactory);

builder.configureStates()
.withStates()
.initial(ProjectStatusEnum.UNDER_INTERNAL_AUDIT)
.choice(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE)
.choice(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE)
.states(EnumSet.allOf(ProjectStatusEnum.class));

builder.configureTransitions()
// 单位内部审核通过,从单位内部审核中到待预审
.withExternal()
.source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT)
.target(ProjectStatusEnum.PENDING_PREQUALIFICATION)
.event(ProjectStatusChangeEvent.UNDER_INTERNAL_PASS).and()
// 单位内部审核驳回,从单位内部审核中到单位内部审核不通过
.withExternal()
.source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT)
.target(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS)
.event(ProjectStatusChangeEvent.UNDER_INTERNAL_REJECT).and()
// 单位内部审核中撤回,从单位内部审核中到待申报
.withExternal()
.source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT)
.target(ProjectStatusEnum.TO_BE_DECLARED)
.event(ProjectStatusChangeEvent.UNDER_INTERNAL_WITHDRAW).and()
// 单位内部审核不通过重新提交,从单位内部审核不通过到单位内部审核中
.withExternal()
.source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS)
.target(ProjectStatusEnum.UNDER_INTERNAL_AUDIT)
.event(ProjectStatusChangeEvent.UNDER_INTERNAL_REJECT_RESUBMIT).and()

// 待预审预审申报,从待预审到待预审选择
.withExternal()
.source(ProjectStatusEnum.PENDING_PREQUALIFICATION)
.target(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE)
.event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_DECLARE).and()
// 待预审申报,从待预审选择->省级部门联审中,预审中,完成其中一种状态
.withChoice()
.source(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE)
.first(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS,projectDeclareGuardFactory.new PendingPreQualificationChoiceGuard(),new ProjectDeclareChoiceAction())
.last(ProjectStatusEnum.PRE_APPLYING,new ProjectDeclareChoiceAction()).and()

// 省级部门联审通过,从省级部门联审中到省级部门联审成功
.withExternal()
.source(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS)
.target(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS)
.event(ProjectStatusChangeEvent.PROVINCIAL_DEPARTMENT_REVIEW_PASS).and()
// 省级部门联审通过,从省级部门联审成功到预审中
.withExternal()
.source(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS)
.target(ProjectStatusEnum.PRE_APPLYING)
.event(ProjectStatusChangeEvent.PROVINCIAL_PASS_TO_PRELIMINARY_REVIEW).and()
// 省级部门联审不通过,从省级部门联审中到省级部门联审不通过
.withExternal()
.source(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS)
.target(ProjectStatusEnum.THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED)
.event(ProjectStatusChangeEvent.PROVINCIAL_DEPARTMENT_REVIEW_REJECT).and()
// 省级部门联审中撤回,从省级部门联审中到待预审
.withExternal()
.source(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS)
.target(ProjectStatusEnum.PENDING_PREQUALIFICATION)
.event(ProjectStatusChangeEvent.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_WITHDRAW).and()

// 预审通过,从预审中到部门联审中
.withExternal()
.source(ProjectStatusEnum.PRE_APPLYING)
.target(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW)
.event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_PASS).and()
// 预审驳回,从预审中到预审不通过
.withExternal()
.source(ProjectStatusEnum.PRE_APPLYING)
.target(ProjectStatusEnum.PREQUALIFICATION_FAILED)
.event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_REJECT).and()
// 预审中撤回,从预审中到预审中撤回选择态
.withExternal()
.source(ProjectStatusEnum.PRE_APPLYING)
.target(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE)
.event(ProjectStatusChangeEvent.PRE_APPLYING_WITHDRAW).and()
// 预审中撤回,从预审中撤回选择态->省级部门联审成功,待预审,完成其中一种状态
.withChoice()
.source(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE)
.first(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS,projectDeclareGuardFactory.new PendingPreQualificationChoiceGuard()
,new ProjectDeclareChoiceAction())
.last(ProjectStatusEnum.PENDING_PREQUALIFICATION,new ProjectDeclareChoiceAction()).and()
// 预审不通过重新提交,从预审不通过到待预审选择
.withExternal()
.source(ProjectStatusEnum.PREQUALIFICATION_FAILED)
.target(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE)
.event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_REJECT_RESUBMIT).and()
// 预审不通过重新提交,从待预审选择->省级部门联审中,预审中,完成其中一种状态
.withChoice()
.source(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE)
.first(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS,projectDeclareGuardFactory.new PendingPreQualificationChoiceGuard(),new ProjectDeclareChoiceAction())
.last(ProjectStatusEnum.PRE_APPLYING,new ProjectDeclareChoiceAction()).and()
// 部门联审通过,从部门联审中到
.withExternal()
.source(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW)
.target(ProjectStatusEnum.PLAN_TO_BE_DECLARED)
.event(ProjectStatusChangeEvent.DEPARTMENT_UNITED_REVIEW_PASS).and()
// 部门联审驳回,从部门联审中到部门联审不通过
.withExternal()
.source(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW)
.target(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW_FAILED)
.event(ProjectStatusChangeEvent.DEPARTMENT_UNITED_REVIEW_REJECT).and()
// 部门联审中撤回,从部门联审中到预审中
.withExternal()
.source(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW)
.target(ProjectStatusEnum.PRE_APPLYING)
.event(ProjectStatusChangeEvent.DEPARTMENT_JOINT_REVIEW_WITHDRAW).and()

// 年度计划中开启方案申报,从年度计划中到立项批复
.withExternal()
.source(ProjectStatusEnum.IN_THE_ANNUAL_PLAN)
.target(ProjectStatusEnum.TO_BE_APPROVED)
.event(ProjectStatusChangeEvent.ANNUAL_PLAN_PROJECT_OPEN_PLAN_DECLARE).and()
// 年度计划中暂缓,从年度计划中到被暂缓
.withExternal()
.source(ProjectStatusEnum.IN_THE_ANNUAL_PLAN)
.target(ProjectStatusEnum.BE_SUSPENDED)
.event(ProjectStatusChangeEvent.ANNUAL_PLAN_SUSPEND).and()
// 方案待申报申报方案,从方案待申报到方案评审中
.withExternal()
.source(ProjectStatusEnum.PLAN_TO_BE_DECLARED)
.target(ProjectStatusEnum.SCHEME_UNDER_REVIEW)
.event(ProjectStatusChangeEvent.DECLARE_PLAN).and()
// 方案评审通过,从方案评审中到待立项批复
.withExternal()
.source(ProjectStatusEnum.SCHEME_UNDER_REVIEW)
.target(ProjectStatusEnum.IN_THE_ANNUAL_PLAN)
.event(ProjectStatusChangeEvent.PLAN_REVIEW_PASS).and()
// 方案评审驳回,从方案评审中到方案评审不通过
.withExternal()
.source(ProjectStatusEnum.SCHEME_UNDER_REVIEW)
.target(ProjectStatusEnum.SCHEME_REVIEW_FAILED)
.event(ProjectStatusChangeEvent.PLAN_REVIEW_REJECT).and()
// 方案评审中撤回,从方案评审中到方案待申报
.withExternal()
.source(ProjectStatusEnum.SCHEME_UNDER_REVIEW)
.target(ProjectStatusEnum.PLAN_TO_BE_DECLARED)
.event(ProjectStatusChangeEvent.SCHEME_UNDER_REVIEW_WITHDRAW).and()
// 方案评审不通过重新提交,从方案评审不通过到方案评审中
.withExternal()
.source(ProjectStatusEnum.SCHEME_REVIEW_FAILED)
.target(ProjectStatusEnum.SCHEME_UNDER_REVIEW)
.event(ProjectStatusChangeEvent.PLAN_REVIEW_REJECT_RESUBMIT).and()
// 待立项批复批复,从待立项批复到待采购
.withExternal()
.source(ProjectStatusEnum.TO_BE_APPROVED)
.target(ProjectStatusEnum.TO_BE_PURCHASED)
.event(ProjectStatusChangeEvent.PROJECT_APPROVAL).and()
// 待采购采购备案,从待采购到实施中
.withExternal()
.source(ProjectStatusEnum.TO_BE_PURCHASED)
.target(ProjectStatusEnum.OPERATION)
.event(ProjectStatusChangeEvent.PURCHASE_PUT_ON_RECORD).and()

// 待开工 实施,从实施到建设中
.withExternal()
.source(ProjectStatusEnum.OPERATION)
.target(ProjectStatusEnum.UNDER_CONSTRUCTION)
.event(ProjectStatusChangeEvent.START_TO_WORK).and()
// 建设中初验备案,从建设中到待终验
.withExternal()
.source(ProjectStatusEnum.UNDER_CONSTRUCTION)
.target(ProjectStatusEnum.TO_BE_FINALLY_INSPECTED)
.event(ProjectStatusChangeEvent.PRELIMINARY_ACCEPTANCE_PUT_ON_RECORD).and()
// 待终验终验申请,从待终验到终验审核中
.withExternal()
.source(ProjectStatusEnum.TO_BE_FINALLY_INSPECTED)
.target(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW)
.event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_APPLICATION).and()
// 终审审核通过,从终审审核中到已归档
.withExternal()
.source(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW)
.target(ProjectStatusEnum.ARCHIVED)
.event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_PASS).and()
// 终审审核不通过,从终审审核中到终审审核不通过
.withExternal()
.source(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW)
.target(ProjectStatusEnum.FINAL_ACCEPTANCE_REVIEW_FAILED)
.event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_REJECT).and()
// 终审审核中撤回,从终审审核中到待终验
.withExternal()
.source(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW)
.target(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW)
.event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_IS_UNDER_REVIEW_WITHDRAW).and()
// 终验中 重新提交
.withExternal()
.source(ProjectStatusEnum.FINAL_ACCEPTANCE_REVIEW_FAILED)
.target(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW)
.event(ProjectStatusChangeEvent.FINAL_RE_ACCEPTANCE_APPLICATION).and();
return builder.build();
}

/**
* 持久化配置
* @author CMM
* @since 2023/02/07 16:22
*/
@Bean(name = "projectDeclareStateMachineLQPersister")
@Override
public StateMachinePersister<ProjectStatusEnum, ProjectStatusChangeEvent, Project> getProjectPersister() {
StateMachinePersister<ProjectStatusEnum, ProjectStatusChangeEvent, Project> sp = new DefaultStateMachinePersister<>(new StateMachinePersist<ProjectStatusEnum, ProjectStatusChangeEvent, Project>() {
@Override
public void write(StateMachineContext<ProjectStatusEnum, ProjectStatusChangeEvent> context, Project contextObj) {
logger.info(contextObj.toString());
}

@Override
public StateMachineContext<ProjectStatusEnum, ProjectStatusChangeEvent> read(Project contextObj) {
return new DefaultStateMachineContext<>(ProjectStatusEnum.match(contextObj.getStatus()),
null, null, null, null, RegionContant.LS_LQ_CODE);
}
});
stateMachinePersister = sp;
return sp;
}

public StateMachinePersister getStateMachinePersister(){
return stateMachinePersister;
}
}

+ 0
- 285
hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/ProjectDeclareStateMachineQTBuilder.java View File

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

import com.hz.pm.api.common.statemachine.action.ProjectDeclareChoiceAction;
import com.hz.pm.api.common.statemachine.contant.RegionContant;
import com.hz.pm.api.common.statemachine.event.ProjectStatusChangeEvent;
import com.hz.pm.api.common.statemachine.factory.ProjectDeclareGuardFactory;
import com.hz.pm.api.projectlib.model.enumeration.ProjectStatusEnum;
import com.hz.pm.api.projectlib.model.entity.Project;
import lombok.RequiredArgsConstructor;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.statemachine.StateMachine;
import org.springframework.statemachine.StateMachineContext;
import org.springframework.statemachine.StateMachinePersist;
import org.springframework.statemachine.config.EnableStateMachine;
import org.springframework.statemachine.config.StateMachineBuilder;
import org.springframework.statemachine.persist.DefaultStateMachinePersister;
import org.springframework.statemachine.persist.StateMachinePersister;
import org.springframework.statemachine.support.DefaultStateMachineContext;
import org.springframework.stereotype.Component;

import java.util.EnumSet;

/**
* 项目申报状态机
* 青田县
* @author CMM
* @since 2023/02/07 15:56
*/
@Component
@EnableStateMachine(name= ProjectDeclareStateMachineQTBuilder.MACHINEID_TO)
@RequiredArgsConstructor
public class ProjectDeclareStateMachineQTBuilder implements ProjectDeclareStateMachineBuilder {
private static final ProjectDeclareGuardFactory projectDeclareGuardFactory = new ProjectDeclareGuardFactory();
private final BeanFactory beanFactory;

private StateMachinePersister stateMachinePersister;
private Logger logger = LoggerFactory.getLogger(getClass());
/**
* TO状态机
*/
public final static String MACHINEID_TO = RegionContant.LS_QT_CODE;

@Override
public StateMachine<ProjectStatusEnum, ProjectStatusChangeEvent> build() throws Exception {
StateMachine<ProjectStatusEnum, ProjectStatusChangeEvent> stateMachine = build(beanFactory);
logger.info("状态机ID:" + stateMachine.getId());
stateMachine.start();
return stateMachine;
}
/**
* 构建状态机
* @param beanFactory
* @author CMM
* @since 2023/02/07 16:15
*/
@Override
public StateMachine<ProjectStatusEnum, ProjectStatusChangeEvent> build(BeanFactory beanFactory) throws Exception {
StateMachineBuilder.Builder<ProjectStatusEnum, ProjectStatusChangeEvent> builder = StateMachineBuilder.builder();
builder.configureConfiguration()
.withConfiguration()
.machineId(MACHINEID_TO)
.beanFactory(beanFactory);

builder.configureStates()
.withStates()
.initial(ProjectStatusEnum.UNDER_INTERNAL_AUDIT)
.choice(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE)
.choice(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE)
.states(EnumSet.allOf(ProjectStatusEnum.class));

builder.configureTransitions()
// 单位内部审核通过,从单位内部审核中到待预审
.withExternal()
.source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT)
.target(ProjectStatusEnum.PENDING_PREQUALIFICATION)
.event(ProjectStatusChangeEvent.UNDER_INTERNAL_PASS).and()
// 单位内部审核驳回,从单位内部审核中到单位内部审核不通过
.withExternal()
.source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT)
.target(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS)
.event(ProjectStatusChangeEvent.UNDER_INTERNAL_REJECT).and()
// 单位内部审核中撤回,从单位内部审核中到待申报
.withExternal()
.source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT)
.target(ProjectStatusEnum.TO_BE_DECLARED)
.event(ProjectStatusChangeEvent.UNDER_INTERNAL_WITHDRAW).and()
// 单位内部审核不通过重新提交,从单位内部审核不通过到单位内部审核中
.withExternal()
.source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS)
.target(ProjectStatusEnum.UNDER_INTERNAL_AUDIT)
.event(ProjectStatusChangeEvent.UNDER_INTERNAL_REJECT_RESUBMIT).and()

// 待预审预审申报,从待预审到待预审选择
.withExternal()
.source(ProjectStatusEnum.PENDING_PREQUALIFICATION)
.target(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE)
.event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_DECLARE).and()
// 待预审申报,从待预审选择->省级部门联审中,预审中,完成其中一种状态
.withChoice()
.source(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE)
.first(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS,projectDeclareGuardFactory.new PendingPreQualificationChoiceGuard(),new ProjectDeclareChoiceAction())
.last(ProjectStatusEnum.PRE_APPLYING,new ProjectDeclareChoiceAction()).and()

// 省级部门联审通过,从省级部门联审中到省级部门联审成功
.withExternal()
.source(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS)
.target(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS)
.event(ProjectStatusChangeEvent.PROVINCIAL_DEPARTMENT_REVIEW_PASS).and()
// 省级部门联审通过,从省级部门联审成功到预审中
.withExternal()
.source(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS)
.target(ProjectStatusEnum.PRE_APPLYING)
.event(ProjectStatusChangeEvent.PROVINCIAL_PASS_TO_PRELIMINARY_REVIEW).and()
// 省级部门联审不通过,从省级部门联审中到省级部门联审不通过
.withExternal()
.source(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS)
.target(ProjectStatusEnum.THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED)
.event(ProjectStatusChangeEvent.PROVINCIAL_DEPARTMENT_REVIEW_REJECT).and()
// 省级部门联审中撤回,从省级部门联审中到待预审
.withExternal()
.source(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS)
.target(ProjectStatusEnum.PENDING_PREQUALIFICATION)
.event(ProjectStatusChangeEvent.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_WITHDRAW).and()

// 预审通过,从预审中到部门联审中
.withExternal()
.source(ProjectStatusEnum.PRE_APPLYING)
.target(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW)
.event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_PASS).and()
// 预审驳回,从预审中到预审不通过
.withExternal()
.source(ProjectStatusEnum.PRE_APPLYING)
.target(ProjectStatusEnum.PREQUALIFICATION_FAILED)
.event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_REJECT).and()
// 预审中撤回,从预审中到预审中撤回选择态
.withExternal()
.source(ProjectStatusEnum.PRE_APPLYING)
.target(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE)
.event(ProjectStatusChangeEvent.PRE_APPLYING_WITHDRAW).and()
// 预审中撤回,从预审中撤回选择态->省级部门联审成功,待预审,完成其中一种状态
.withChoice()
.source(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE)
.first(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS,projectDeclareGuardFactory.new PendingPreQualificationChoiceGuard()
,new ProjectDeclareChoiceAction())
.last(ProjectStatusEnum.PENDING_PREQUALIFICATION,new ProjectDeclareChoiceAction()).and()
// 预审不通过重新提交,从预审不通过到待预审选择
.withExternal()
.source(ProjectStatusEnum.PREQUALIFICATION_FAILED)
.target(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE)
.event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_REJECT_RESUBMIT).and()
// 预审不通过重新提交,从待预审选择->省级部门联审中,预审中,完成其中一种状态
.withChoice()
.source(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE)
.first(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS,projectDeclareGuardFactory.new PendingPreQualificationChoiceGuard(),new ProjectDeclareChoiceAction())
.last(ProjectStatusEnum.PRE_APPLYING,new ProjectDeclareChoiceAction()).and()
// 部门联审通过,从部门联审中到年度计划中
.withExternal()
.source(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW)
.target(ProjectStatusEnum.IN_THE_ANNUAL_PLAN)
.event(ProjectStatusChangeEvent.DEPARTMENT_UNITED_REVIEW_PASS).and()
// 部门联审驳回,从部门联审中到部门联审不通过
.withExternal()
.source(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW)
.target(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW_FAILED)
.event(ProjectStatusChangeEvent.DEPARTMENT_UNITED_REVIEW_REJECT).and()
// 部门联审中撤回,从部门联审中到预审中
.withExternal()
.source(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW)
.target(ProjectStatusEnum.PRE_APPLYING)
.event(ProjectStatusChangeEvent.DEPARTMENT_JOINT_REVIEW_WITHDRAW).and()
// 年度计划中开启方案申报,从年度计划中到方案待申报
.withExternal()
.source(ProjectStatusEnum.IN_THE_ANNUAL_PLAN)
.target(ProjectStatusEnum.PLAN_TO_BE_DECLARED)
.event(ProjectStatusChangeEvent.ANNUAL_PLAN_PROJECT_OPEN_PLAN_DECLARE).and()
// 年度计划中暂缓,从年度计划中到被暂缓
.withExternal()
.source(ProjectStatusEnum.IN_THE_ANNUAL_PLAN)
.target(ProjectStatusEnum.BE_SUSPENDED)
.event(ProjectStatusChangeEvent.ANNUAL_PLAN_SUSPEND).and()
// 方案待申报申报方案,从方案待申报到方案评审中
.withExternal()
.source(ProjectStatusEnum.PLAN_TO_BE_DECLARED)
.target(ProjectStatusEnum.SCHEME_UNDER_REVIEW)
.event(ProjectStatusChangeEvent.DECLARE_PLAN).and()
// 方案评审通过,从方案评审中到待立项批复
.withExternal()
.source(ProjectStatusEnum.SCHEME_UNDER_REVIEW)
.target(ProjectStatusEnum.TO_BE_APPROVED)
.event(ProjectStatusChangeEvent.PLAN_REVIEW_PASS).and()
// 方案评审驳回,从方案评审中到方案评审不通过
.withExternal()
.source(ProjectStatusEnum.SCHEME_UNDER_REVIEW)
.target(ProjectStatusEnum.SCHEME_REVIEW_FAILED)
.event(ProjectStatusChangeEvent.PLAN_REVIEW_REJECT).and()
// 方案评审中撤回,从方案评审中到方案待申报
.withExternal()
.source(ProjectStatusEnum.SCHEME_UNDER_REVIEW)
.target(ProjectStatusEnum.PLAN_TO_BE_DECLARED)
.event(ProjectStatusChangeEvent.SCHEME_UNDER_REVIEW_WITHDRAW).and()
// 方案评审不通过重新提交,从方案评审不通过到方案评审中
.withExternal()
.source(ProjectStatusEnum.SCHEME_REVIEW_FAILED)
.target(ProjectStatusEnum.SCHEME_UNDER_REVIEW)
.event(ProjectStatusChangeEvent.PLAN_REVIEW_REJECT_RESUBMIT).and()
// 待立项批复批复,从待立项批复到待采购
.withExternal()
.source(ProjectStatusEnum.TO_BE_APPROVED)
.target(ProjectStatusEnum.TO_BE_PURCHASED)
.event(ProjectStatusChangeEvent.PROJECT_APPROVAL).and()
// 待采购采购备案,从待采购到实施中
.withExternal()
.source(ProjectStatusEnum.TO_BE_PURCHASED)
.target(ProjectStatusEnum.OPERATION)
.event(ProjectStatusChangeEvent.PURCHASE_PUT_ON_RECORD).and()

// 待开工 实施,从实施到建设中
.withExternal()
.source(ProjectStatusEnum.OPERATION)
.target(ProjectStatusEnum.UNDER_CONSTRUCTION)
.event(ProjectStatusChangeEvent.START_TO_WORK).and()
// 建设中初验备案,从建设中到待终验
.withExternal()
.source(ProjectStatusEnum.UNDER_CONSTRUCTION)
.target(ProjectStatusEnum.TO_BE_FINALLY_INSPECTED)
.event(ProjectStatusChangeEvent.PRELIMINARY_ACCEPTANCE_PUT_ON_RECORD).and()
// 待终验终验申请,从待终验到终验审核中
.withExternal()
.source(ProjectStatusEnum.TO_BE_FINALLY_INSPECTED)
.target(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW)
.event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_APPLICATION).and()
// 终审审核通过,从终审审核中到已归档
.withExternal()
.source(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW)
.target(ProjectStatusEnum.ARCHIVED)
.event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_PASS).and()
// 终审审核不通过,从终审审核中到终审审核不通过
.withExternal()
.source(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW)
.target(ProjectStatusEnum.FINAL_ACCEPTANCE_REVIEW_FAILED)
.event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_REJECT).and()
// 终审审核中撤回,从终审审核中到待终验
.withExternal()
.source(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW)
.target(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW)
.event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_IS_UNDER_REVIEW_WITHDRAW).and()
// 终验中 重新提交
.withExternal()
.source(ProjectStatusEnum.FINAL_ACCEPTANCE_REVIEW_FAILED)
.target(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW)
.event(ProjectStatusChangeEvent.FINAL_RE_ACCEPTANCE_APPLICATION).and();
return builder.build();
}

/**
* 持久化配置
* @author CMM
* @since 2023/02/07 16:22
*/
@Bean(name = "projectDeclareStateMachineQTPersister")
@Override
public StateMachinePersister<ProjectStatusEnum, ProjectStatusChangeEvent, Project> getProjectPersister() {
StateMachinePersister sp = new DefaultStateMachinePersister<>(new StateMachinePersist<ProjectStatusEnum, ProjectStatusChangeEvent, Project>() {
@Override
public void write(StateMachineContext<ProjectStatusEnum, ProjectStatusChangeEvent> context, Project contextObj) {
}

@Override
public StateMachineContext<ProjectStatusEnum, ProjectStatusChangeEvent> read(Project contextObj) {
StateMachineContext<ProjectStatusEnum, ProjectStatusChangeEvent> result = new DefaultStateMachineContext(ProjectStatusEnum.match(contextObj.getStatus()),
null, null, null, null, RegionContant.LS_QT_CODE);
return result;
}
});
stateMachinePersister = sp;
return sp;
}

public StateMachinePersister getStateMachinePersister(){
return stateMachinePersister;
}
}

+ 0
- 285
hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/ProjectDeclareStateMachineQYBuilder.java View File

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

import com.hz.pm.api.common.statemachine.action.ProjectDeclareChoiceAction;
import com.hz.pm.api.common.statemachine.contant.RegionContant;
import com.hz.pm.api.common.statemachine.event.ProjectStatusChangeEvent;
import com.hz.pm.api.common.statemachine.factory.ProjectDeclareGuardFactory;
import com.hz.pm.api.projectlib.model.enumeration.ProjectStatusEnum;
import com.hz.pm.api.projectlib.model.entity.Project;
import lombok.RequiredArgsConstructor;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.statemachine.StateMachine;
import org.springframework.statemachine.StateMachineContext;
import org.springframework.statemachine.StateMachinePersist;
import org.springframework.statemachine.config.EnableStateMachine;
import org.springframework.statemachine.config.StateMachineBuilder;
import org.springframework.statemachine.persist.DefaultStateMachinePersister;
import org.springframework.statemachine.persist.StateMachinePersister;
import org.springframework.statemachine.support.DefaultStateMachineContext;
import org.springframework.stereotype.Component;

import java.util.EnumSet;

/**
* 项目申报状态机
* 庆元县
* @author CMM
* @since 2023/02/07 15:56
*/
@Component
@EnableStateMachine(name= ProjectDeclareStateMachineQYBuilder.MACHINEID_TO)
@RequiredArgsConstructor
public class ProjectDeclareStateMachineQYBuilder implements ProjectDeclareStateMachineBuilder {
private static final ProjectDeclareGuardFactory projectDeclareGuardFactory = new ProjectDeclareGuardFactory();
private final BeanFactory beanFactory;

private StateMachinePersister stateMachinePersister;
private Logger logger = LoggerFactory.getLogger(getClass());
/**
* TO状态机
*/
public final static String MACHINEID_TO = RegionContant.LS_QY_CODE;

@Override
public StateMachine<ProjectStatusEnum, ProjectStatusChangeEvent> build() throws Exception {
StateMachine<ProjectStatusEnum, ProjectStatusChangeEvent> stateMachine = build(beanFactory);
logger.info("状态机ID:" + stateMachine.getId());
stateMachine.start();
return stateMachine;
}
/**
* 构建状态机
* @param beanFactory
* @author CMM
* @since 2023/02/07 16:15
*/
@Override
public StateMachine<ProjectStatusEnum, ProjectStatusChangeEvent> build(BeanFactory beanFactory) throws Exception {
StateMachineBuilder.Builder<ProjectStatusEnum, ProjectStatusChangeEvent> builder = StateMachineBuilder.builder();
builder.configureConfiguration()
.withConfiguration()
.machineId(MACHINEID_TO)
.beanFactory(beanFactory);

builder.configureStates()
.withStates()
.initial(ProjectStatusEnum.UNDER_INTERNAL_AUDIT)
.choice(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE)
.choice(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE)
.states(EnumSet.allOf(ProjectStatusEnum.class));

builder.configureTransitions()
// 单位内部审核通过,从单位内部审核中到待预审
.withExternal()
.source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT)
.target(ProjectStatusEnum.PENDING_PREQUALIFICATION)
.event(ProjectStatusChangeEvent.UNDER_INTERNAL_PASS).and()
// 单位内部审核驳回,从单位内部审核中到单位内部审核不通过
.withExternal()
.source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT)
.target(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS)
.event(ProjectStatusChangeEvent.UNDER_INTERNAL_REJECT).and()
// 单位内部审核中撤回,从单位内部审核中到待申报
.withExternal()
.source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT)
.target(ProjectStatusEnum.TO_BE_DECLARED)
.event(ProjectStatusChangeEvent.UNDER_INTERNAL_WITHDRAW).and()
// 单位内部审核不通过重新提交,从单位内部审核不通过到单位内部审核中
.withExternal()
.source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS)
.target(ProjectStatusEnum.UNDER_INTERNAL_AUDIT)
.event(ProjectStatusChangeEvent.UNDER_INTERNAL_REJECT_RESUBMIT).and()

// 待预审预审申报,从待预审到待预审选择
.withExternal()
.source(ProjectStatusEnum.PENDING_PREQUALIFICATION)
.target(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE)
.event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_DECLARE).and()
// 待预审申报,从待预审选择->省级部门联审中,预审中,完成其中一种状态
.withChoice()
.source(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE)
.first(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS,projectDeclareGuardFactory.new PendingPreQualificationChoiceGuard(),new ProjectDeclareChoiceAction())
.last(ProjectStatusEnum.PRE_APPLYING,new ProjectDeclareChoiceAction()).and()

// 省级部门联审通过,从省级部门联审中到省级部门联审成功
.withExternal()
.source(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS)
.target(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS)
.event(ProjectStatusChangeEvent.PROVINCIAL_DEPARTMENT_REVIEW_PASS).and()
// 省级部门联审通过,从省级部门联审成功到预审中
.withExternal()
.source(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS)
.target(ProjectStatusEnum.PRE_APPLYING)
.event(ProjectStatusChangeEvent.PROVINCIAL_PASS_TO_PRELIMINARY_REVIEW).and()
// 省级部门联审不通过,从省级部门联审中到省级部门联审不通过
.withExternal()
.source(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS)
.target(ProjectStatusEnum.THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED)
.event(ProjectStatusChangeEvent.PROVINCIAL_DEPARTMENT_REVIEW_REJECT).and()
// 省级部门联审中撤回,从省级部门联审中到待预审
.withExternal()
.source(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS)
.target(ProjectStatusEnum.PENDING_PREQUALIFICATION)
.event(ProjectStatusChangeEvent.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_WITHDRAW).and()

// 预审通过,从预审中到部门联审中
.withExternal()
.source(ProjectStatusEnum.PRE_APPLYING)
.target(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW)
.event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_PASS).and()
// 预审驳回,从预审中到预审不通过
.withExternal()
.source(ProjectStatusEnum.PRE_APPLYING)
.target(ProjectStatusEnum.PREQUALIFICATION_FAILED)
.event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_REJECT).and()
// 预审中撤回,从预审中到预审中撤回选择态
.withExternal()
.source(ProjectStatusEnum.PRE_APPLYING)
.target(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE)
.event(ProjectStatusChangeEvent.PRE_APPLYING_WITHDRAW).and()
// 预审中撤回,从预审中撤回选择态->省级部门联审成功,待预审,完成其中一种状态
.withChoice()
.source(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE)
.first(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS,projectDeclareGuardFactory.new PendingPreQualificationChoiceGuard()
,new ProjectDeclareChoiceAction())
.last(ProjectStatusEnum.PENDING_PREQUALIFICATION,new ProjectDeclareChoiceAction()).and()
// 预审不通过重新提交,从预审不通过到待预审选择
.withExternal()
.source(ProjectStatusEnum.PREQUALIFICATION_FAILED)
.target(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE)
.event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_REJECT_RESUBMIT).and()
// 预审不通过重新提交,从待预审选择->省级部门联审中,预审中,完成其中一种状态
.withChoice()
.source(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE)
.first(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS,projectDeclareGuardFactory.new PendingPreQualificationChoiceGuard(),new ProjectDeclareChoiceAction())
.last(ProjectStatusEnum.PRE_APPLYING,new ProjectDeclareChoiceAction()).and()
// 部门联审通过,从部门联审中到年度计划中
.withExternal()
.source(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW)
.target(ProjectStatusEnum.IN_THE_ANNUAL_PLAN)
.event(ProjectStatusChangeEvent.DEPARTMENT_UNITED_REVIEW_PASS).and()
// 部门联审驳回,从部门联审中到部门联审不通过
.withExternal()
.source(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW)
.target(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW_FAILED)
.event(ProjectStatusChangeEvent.DEPARTMENT_UNITED_REVIEW_REJECT).and()
// 部门联审中撤回,从部门联审中到预审中
.withExternal()
.source(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW)
.target(ProjectStatusEnum.PRE_APPLYING)
.event(ProjectStatusChangeEvent.DEPARTMENT_JOINT_REVIEW_WITHDRAW).and()
// 年度计划中开启方案申报,从年度计划中到方案待申报
.withExternal()
.source(ProjectStatusEnum.IN_THE_ANNUAL_PLAN)
.target(ProjectStatusEnum.PLAN_TO_BE_DECLARED)
.event(ProjectStatusChangeEvent.ANNUAL_PLAN_PROJECT_OPEN_PLAN_DECLARE).and()
// 年度计划中暂缓,从年度计划中到被暂缓
.withExternal()
.source(ProjectStatusEnum.IN_THE_ANNUAL_PLAN)
.target(ProjectStatusEnum.BE_SUSPENDED)
.event(ProjectStatusChangeEvent.ANNUAL_PLAN_SUSPEND).and()
// 方案待申报申报方案,从方案待申报到方案评审中
.withExternal()
.source(ProjectStatusEnum.PLAN_TO_BE_DECLARED)
.target(ProjectStatusEnum.SCHEME_UNDER_REVIEW)
.event(ProjectStatusChangeEvent.DECLARE_PLAN).and()
// 方案评审通过,从方案评审中到待立项批复
.withExternal()
.source(ProjectStatusEnum.SCHEME_UNDER_REVIEW)
.target(ProjectStatusEnum.TO_BE_APPROVED)
.event(ProjectStatusChangeEvent.PLAN_REVIEW_PASS).and()
// 方案评审驳回,从方案评审中到方案评审不通过
.withExternal()
.source(ProjectStatusEnum.SCHEME_UNDER_REVIEW)
.target(ProjectStatusEnum.SCHEME_REVIEW_FAILED)
.event(ProjectStatusChangeEvent.PLAN_REVIEW_REJECT).and()
// 方案评审中撤回,从方案评审中到方案待申报
.withExternal()
.source(ProjectStatusEnum.SCHEME_UNDER_REVIEW)
.target(ProjectStatusEnum.PLAN_TO_BE_DECLARED)
.event(ProjectStatusChangeEvent.SCHEME_UNDER_REVIEW_WITHDRAW).and()
// 方案评审不通过重新提交,从方案评审不通过到方案评审中
.withExternal()
.source(ProjectStatusEnum.SCHEME_REVIEW_FAILED)
.target(ProjectStatusEnum.SCHEME_UNDER_REVIEW)
.event(ProjectStatusChangeEvent.PLAN_REVIEW_REJECT_RESUBMIT).and()
// 待立项批复批复,从待立项批复到待采购
.withExternal()
.source(ProjectStatusEnum.TO_BE_APPROVED)
.target(ProjectStatusEnum.TO_BE_PURCHASED)
.event(ProjectStatusChangeEvent.PROJECT_APPROVAL).and()
// 待采购采购备案,从待采购到实施中
.withExternal()
.source(ProjectStatusEnum.TO_BE_PURCHASED)
.target(ProjectStatusEnum.OPERATION)
.event(ProjectStatusChangeEvent.PURCHASE_PUT_ON_RECORD).and()

// 待开工 实施,从实施到建设中
.withExternal()
.source(ProjectStatusEnum.OPERATION)
.target(ProjectStatusEnum.UNDER_CONSTRUCTION)
.event(ProjectStatusChangeEvent.START_TO_WORK).and()
// 建设中初验备案,从建设中到待终验
.withExternal()
.source(ProjectStatusEnum.UNDER_CONSTRUCTION)
.target(ProjectStatusEnum.TO_BE_FINALLY_INSPECTED)
.event(ProjectStatusChangeEvent.PRELIMINARY_ACCEPTANCE_PUT_ON_RECORD).and()
// 待终验终验申请,从待终验到终验审核中
.withExternal()
.source(ProjectStatusEnum.TO_BE_FINALLY_INSPECTED)
.target(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW)
.event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_APPLICATION).and()
// 终审审核通过,从终审审核中到已归档
.withExternal()
.source(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW)
.target(ProjectStatusEnum.ARCHIVED)
.event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_PASS).and()
// 终审审核不通过,从终审审核中到终审审核不通过
.withExternal()
.source(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW)
.target(ProjectStatusEnum.FINAL_ACCEPTANCE_REVIEW_FAILED)
.event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_REJECT).and()
// 终审审核中撤回,从终审审核中到待终验
.withExternal()
.source(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW)
.target(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW)
.event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_IS_UNDER_REVIEW_WITHDRAW).and()
// 终验中 重新提交
.withExternal()
.source(ProjectStatusEnum.FINAL_ACCEPTANCE_REVIEW_FAILED)
.target(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW)
.event(ProjectStatusChangeEvent.FINAL_RE_ACCEPTANCE_APPLICATION).and();
return builder.build();
}

/**
* 持久化配置
* @author CMM
* @since 2023/02/07 16:22
*/
@Bean(name = "projectDeclareStateMachineQYPersister")
@Override
public StateMachinePersister<ProjectStatusEnum, ProjectStatusChangeEvent, Project> getProjectPersister() {
StateMachinePersister sp = new DefaultStateMachinePersister<>(new StateMachinePersist<ProjectStatusEnum, ProjectStatusChangeEvent, Project>() {
@Override
public void write(StateMachineContext<ProjectStatusEnum, ProjectStatusChangeEvent> context, Project contextObj) {
}

@Override
public StateMachineContext<ProjectStatusEnum, ProjectStatusChangeEvent> read(Project contextObj) {
StateMachineContext<ProjectStatusEnum, ProjectStatusChangeEvent> result = new DefaultStateMachineContext(ProjectStatusEnum.match(contextObj.getStatus()),
null, null, null, null, RegionContant.LS_QY_CODE);
return result;
}
});
stateMachinePersister = sp;
return sp;
}

public StateMachinePersister getStateMachinePersister(){
return stateMachinePersister;
}
}

+ 0
- 295
hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/ProjectDeclareStateMachineSCBuilder.java View File

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

import com.hz.pm.api.common.statemachine.action.ProjectDeclareChoiceAction;
import com.hz.pm.api.common.statemachine.contant.RegionContant;
import com.hz.pm.api.common.statemachine.event.ProjectStatusChangeEvent;
import com.hz.pm.api.common.statemachine.factory.ProjectDeclareGuardFactory;
import com.hz.pm.api.projectlib.model.enumeration.ProjectStatusEnum;
import com.hz.pm.api.projectlib.model.entity.Project;
import lombok.RequiredArgsConstructor;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.statemachine.StateMachine;
import org.springframework.statemachine.StateMachineContext;
import org.springframework.statemachine.StateMachinePersist;
import org.springframework.statemachine.config.EnableStateMachine;
import org.springframework.statemachine.config.StateMachineBuilder;
import org.springframework.statemachine.persist.DefaultStateMachinePersister;
import org.springframework.statemachine.persist.StateMachinePersister;
import org.springframework.statemachine.support.DefaultStateMachineContext;
import org.springframework.stereotype.Component;

import java.util.EnumSet;

/**
* 项目申报状态机
* 遂昌县
* @author CMM
* @since 2023/02/07 15:56
*/
@Component
@EnableStateMachine(name= ProjectDeclareStateMachineSCBuilder.MACHINEID_TO)
@RequiredArgsConstructor
public class ProjectDeclareStateMachineSCBuilder implements ProjectDeclareStateMachineBuilder{
private static final ProjectDeclareGuardFactory projectDeclareGuardFactory = new ProjectDeclareGuardFactory();
private final BeanFactory beanFactory;

private StateMachinePersister stateMachinePersister;
private Logger logger = LoggerFactory.getLogger(getClass());
/**
* TO状态机
*/
public final static String MACHINEID_TO = RegionContant.LS_SC_CODE;

@Override
public StateMachine<ProjectStatusEnum, ProjectStatusChangeEvent> build() throws Exception {
StateMachine<ProjectStatusEnum, ProjectStatusChangeEvent> stateMachine = build(beanFactory);
logger.info("状态机ID:" + stateMachine.getId());
stateMachine.start();
return stateMachine;
}
/**
* 构建状态机
* @param beanFactory
* @author CMM
* @since 2023/02/07 16:15
*/
@Override
public StateMachine<ProjectStatusEnum, ProjectStatusChangeEvent> build(BeanFactory beanFactory) throws Exception {
StateMachineBuilder.Builder<ProjectStatusEnum, ProjectStatusChangeEvent> builder = StateMachineBuilder.builder();
builder.configureConfiguration()
.withConfiguration()
.machineId(MACHINEID_TO)
.beanFactory(beanFactory);

builder.configureStates()
.withStates()
.initial(ProjectStatusEnum.UNDER_INTERNAL_AUDIT)
.choice(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE)
.choice(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE)
.choice(ProjectStatusEnum.APPROVED_AFTER_CHOICE)
.states(EnumSet.allOf(ProjectStatusEnum.class));

builder.configureTransitions()
// 单位内部审核通过,从单位内部审核中到待预审
.withExternal()
.source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT)
.target(ProjectStatusEnum.PENDING_PREQUALIFICATION)
.event(ProjectStatusChangeEvent.UNDER_INTERNAL_PASS).and()
// 单位内部审核驳回,从单位内部审核中到单位内部审核不通过
.withExternal()
.source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT)
.target(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS)
.event(ProjectStatusChangeEvent.UNDER_INTERNAL_REJECT).and()
// 单位内部审核中撤回,从单位内部审核中到待申报
.withExternal()
.source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT)
.target(ProjectStatusEnum.TO_BE_DECLARED)
.event(ProjectStatusChangeEvent.UNDER_INTERNAL_WITHDRAW).and()
// 单位内部审核不通过重新提交,从单位内部审核不通过到单位内部审核中
.withExternal()
.source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS)
.target(ProjectStatusEnum.UNDER_INTERNAL_AUDIT)
.event(ProjectStatusChangeEvent.UNDER_INTERNAL_REJECT_RESUBMIT).and()

// 待预审预审申报,从待预审到待预审选择
.withExternal()
.source(ProjectStatusEnum.PENDING_PREQUALIFICATION)
.target(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE)
.event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_DECLARE).and()
// 待预审申报,从待预审选择->省级部门联审中,预审中,完成其中一种状态
.withChoice()
.source(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE)
.first(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS,projectDeclareGuardFactory.new PendingPreQualificationChoiceGuard(),new ProjectDeclareChoiceAction())
.last(ProjectStatusEnum.PRE_APPLYING,new ProjectDeclareChoiceAction()).and()

// 省级部门联审通过,从省级部门联审中到省级部门联审成功
.withExternal()
.source(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS)
.target(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS)
.event(ProjectStatusChangeEvent.PROVINCIAL_DEPARTMENT_REVIEW_PASS).and()
// 省级部门联审通过,从省级部门联审成功到预审中
.withExternal()
.source(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS)
.target(ProjectStatusEnum.PRE_APPLYING)
.event(ProjectStatusChangeEvent.PROVINCIAL_PASS_TO_PRELIMINARY_REVIEW).and()
// 省级部门联审不通过,从省级部门联审中到省级部门联审不通过
.withExternal()
.source(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS)
.target(ProjectStatusEnum.THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED)
.event(ProjectStatusChangeEvent.PROVINCIAL_DEPARTMENT_REVIEW_REJECT).and()
// 省级部门联审中撤回,从省级部门联审中到待预审
.withExternal()
.source(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS)
.target(ProjectStatusEnum.PENDING_PREQUALIFICATION)
.event(ProjectStatusChangeEvent.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_WITHDRAW).and()

// 预审通过,从预审中到部门联审中
.withExternal()
.source(ProjectStatusEnum.PRE_APPLYING)
.target(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW)
.event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_PASS).and()
// 预审驳回,从预审中到预审不通过
.withExternal()
.source(ProjectStatusEnum.PRE_APPLYING)
.target(ProjectStatusEnum.PREQUALIFICATION_FAILED)
.event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_REJECT).and()
// 预审中撤回,从预审中到预审中撤回选择态
.withExternal()
.source(ProjectStatusEnum.PRE_APPLYING)
.target(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE)
.event(ProjectStatusChangeEvent.PRE_APPLYING_WITHDRAW).and()
// 预审中撤回,从预审中撤回选择态->省级部门联审成功,待预审,完成其中一种状态
.withChoice()
.source(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE)
.first(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS,projectDeclareGuardFactory.new PendingPreQualificationChoiceGuard()
,new ProjectDeclareChoiceAction())
.last(ProjectStatusEnum.PENDING_PREQUALIFICATION,new ProjectDeclareChoiceAction()).and()
// 预审不通过重新提交,从预审不通过到待预审选择
.withExternal()
.source(ProjectStatusEnum.PREQUALIFICATION_FAILED)
.target(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE)
.event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_REJECT_RESUBMIT).and()
// 预审不通过重新提交,从待预审选择->省级部门联审中,预审中,完成其中一种状态
.withChoice()
.source(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE)
.first(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS,projectDeclareGuardFactory.new PendingPreQualificationChoiceGuard(),new ProjectDeclareChoiceAction())
.last(ProjectStatusEnum.PRE_APPLYING,new ProjectDeclareChoiceAction()).and()
// 部门联审通过,从部门联审中到年度计划中
.withExternal()
.source(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW)
.target(ProjectStatusEnum.IN_THE_ANNUAL_PLAN)
.event(ProjectStatusChangeEvent.DEPARTMENT_UNITED_REVIEW_PASS).and()
// 部门联审驳回,从部门联审中到部门联审不通过
.withExternal()
.source(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW)
.target(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW_FAILED)
.event(ProjectStatusChangeEvent.DEPARTMENT_UNITED_REVIEW_REJECT).and()
// 部门联审中撤回,从部门联审中到预审中
.withExternal()
.source(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW)
.target(ProjectStatusEnum.PRE_APPLYING)
.event(ProjectStatusChangeEvent.DEPARTMENT_JOINT_REVIEW_WITHDRAW).and()
// 年度计划中开启方案申报,从年度计划中到方案待申报
.withExternal()
.source(ProjectStatusEnum.IN_THE_ANNUAL_PLAN)
.target(ProjectStatusEnum.PLAN_TO_BE_DECLARED)
.event(ProjectStatusChangeEvent.ANNUAL_PLAN_PROJECT_OPEN_PLAN_DECLARE).and()
// 年度计划中暂缓,从年度计划中到被暂缓
.withExternal()
.source(ProjectStatusEnum.IN_THE_ANNUAL_PLAN)
.target(ProjectStatusEnum.BE_SUSPENDED)
.event(ProjectStatusChangeEvent.ANNUAL_PLAN_SUSPEND).and()
// 方案待申报申报方案,从方案待申报到方案评审中
.withExternal()
.source(ProjectStatusEnum.PLAN_TO_BE_DECLARED)
.target(ProjectStatusEnum.SCHEME_UNDER_REVIEW)
.event(ProjectStatusChangeEvent.DECLARE_PLAN).and()
// 方案评审通过,从方案评审中到待立项批复
.withExternal()
.source(ProjectStatusEnum.SCHEME_UNDER_REVIEW)
.target(ProjectStatusEnum.TO_BE_APPROVED)
.event(ProjectStatusChangeEvent.PLAN_REVIEW_PASS).and()
// 方案评审驳回,从方案评审中到方案评审不通过
.withExternal()
.source(ProjectStatusEnum.SCHEME_UNDER_REVIEW)
.target(ProjectStatusEnum.SCHEME_REVIEW_FAILED)
.event(ProjectStatusChangeEvent.PLAN_REVIEW_REJECT).and()
// 方案评审中撤回,从方案评审中到方案待申报
.withExternal()
.source(ProjectStatusEnum.SCHEME_UNDER_REVIEW)
.target(ProjectStatusEnum.PLAN_TO_BE_DECLARED)
.event(ProjectStatusChangeEvent.SCHEME_UNDER_REVIEW_WITHDRAW).and()
// 方案评审不通过重新提交,从方案评审不通过到方案评审中
.withExternal()
.source(ProjectStatusEnum.SCHEME_REVIEW_FAILED)
.target(ProjectStatusEnum.SCHEME_UNDER_REVIEW)
.event(ProjectStatusChangeEvent.PLAN_REVIEW_REJECT_RESUBMIT).and()
// 待立项批复批复,从待立项批复到待采购
.withExternal()
.source(ProjectStatusEnum.TO_BE_APPROVED)
.target(ProjectStatusEnum.APPROVED_AFTER_CHOICE)
.event(ProjectStatusChangeEvent.PROJECT_APPROVAL).and()
.withChoice()
.source(ProjectStatusEnum.APPROVED_AFTER_CHOICE)
.first(ProjectStatusEnum.TO_BE_APP_REGISTER,projectDeclareGuardFactory.new ApprovedAfterChoiceGuard(),new ProjectDeclareChoiceAction())
.last(ProjectStatusEnum.TO_BE_PURCHASED,new ProjectDeclareChoiceAction()).and()
//待所有应用都注册 并且 绑定了关系后 再进入下一状态 待采购
.withExternal()
.source(ProjectStatusEnum.TO_BE_APP_REGISTER)
.target(ProjectStatusEnum.TO_BE_PURCHASED)
.event(ProjectStatusChangeEvent.REGISTER_APP).and()
// 待采购采购备案,从待采购到实施中
.withExternal()
.source(ProjectStatusEnum.TO_BE_PURCHASED)
.target(ProjectStatusEnum.OPERATION)
.event(ProjectStatusChangeEvent.PURCHASE_PUT_ON_RECORD).and()

// 待开工 实施,从实施到建设中
.withExternal()
.source(ProjectStatusEnum.OPERATION)
.target(ProjectStatusEnum.UNDER_CONSTRUCTION)
.event(ProjectStatusChangeEvent.START_TO_WORK).and()
// 建设中初验备案,从建设中到待终验
.withExternal()
.source(ProjectStatusEnum.UNDER_CONSTRUCTION)
.target(ProjectStatusEnum.TO_BE_FINALLY_INSPECTED)
.event(ProjectStatusChangeEvent.PRELIMINARY_ACCEPTANCE_PUT_ON_RECORD).and()
// 待终验终验申请,从待终验到终验审核中
.withExternal()
.source(ProjectStatusEnum.TO_BE_FINALLY_INSPECTED)
.target(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW)
.event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_APPLICATION).and()
// 终审审核通过,从终审审核中到已归档
.withExternal()
.source(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW)
.target(ProjectStatusEnum.ARCHIVED)
.event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_PASS).and()
// 终审审核不通过,从终审审核中到终审审核不通过
.withExternal()
.source(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW)
.target(ProjectStatusEnum.FINAL_ACCEPTANCE_REVIEW_FAILED)
.event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_REJECT).and()
// 终审审核中撤回,从终审审核中到待终验
.withExternal()
.source(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW)
.target(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW)
.event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_IS_UNDER_REVIEW_WITHDRAW).and()
// 终验中 重新提交
.withExternal()
.source(ProjectStatusEnum.FINAL_ACCEPTANCE_REVIEW_FAILED)
.target(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW)
.event(ProjectStatusChangeEvent.FINAL_RE_ACCEPTANCE_APPLICATION).and();
return builder.build();
}

/**
* 持久化配置
* @author CMM
* @since 2023/02/07 16:22
*/
@Bean(name = "projectDeclareStateMachineSCPersister")
@Override
public StateMachinePersister<ProjectStatusEnum, ProjectStatusChangeEvent, Project> getProjectPersister() {
StateMachinePersister sp = new DefaultStateMachinePersister<>(new StateMachinePersist<ProjectStatusEnum, ProjectStatusChangeEvent, Project>() {
@Override
public void write(StateMachineContext<ProjectStatusEnum, ProjectStatusChangeEvent> context, Project contextObj) {
}

@Override
public StateMachineContext<ProjectStatusEnum, ProjectStatusChangeEvent> read(Project contextObj) {
StateMachineContext<ProjectStatusEnum, ProjectStatusChangeEvent> result = new DefaultStateMachineContext(ProjectStatusEnum.match(contextObj.getStatus()),
null, null, null, null, RegionContant.LS_SC_CODE);
return result;
}
});
stateMachinePersister = sp;
return sp;
}

public StateMachinePersister getStateMachinePersister(){
return stateMachinePersister;
}
}

+ 0
- 285
hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/ProjectDeclareStateMachineSYBuilder.java View File

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

import com.hz.pm.api.common.statemachine.action.ProjectDeclareChoiceAction;
import com.hz.pm.api.common.statemachine.contant.RegionContant;
import com.hz.pm.api.common.statemachine.event.ProjectStatusChangeEvent;
import com.hz.pm.api.common.statemachine.factory.ProjectDeclareGuardFactory;
import com.hz.pm.api.projectlib.model.enumeration.ProjectStatusEnum;
import com.hz.pm.api.projectlib.model.entity.Project;
import lombok.RequiredArgsConstructor;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.statemachine.StateMachine;
import org.springframework.statemachine.StateMachineContext;
import org.springframework.statemachine.StateMachinePersist;
import org.springframework.statemachine.config.EnableStateMachine;
import org.springframework.statemachine.config.StateMachineBuilder;
import org.springframework.statemachine.persist.DefaultStateMachinePersister;
import org.springframework.statemachine.persist.StateMachinePersister;
import org.springframework.statemachine.support.DefaultStateMachineContext;
import org.springframework.stereotype.Component;

import java.util.EnumSet;

/**
* 项目申报状态机
* 松阳县
* @author CMM
* @since 2023/02/07 15:56
*/
@Component
@EnableStateMachine(name= ProjectDeclareStateMachineSYBuilder.MACHINEID_TO)
@RequiredArgsConstructor
public class ProjectDeclareStateMachineSYBuilder implements ProjectDeclareStateMachineBuilder {
private static final ProjectDeclareGuardFactory projectDeclareGuardFactory = new ProjectDeclareGuardFactory();
private final BeanFactory beanFactory;

private StateMachinePersister stateMachinePersister;
private Logger logger = LoggerFactory.getLogger(getClass());
/**
* TO状态机
*/
public final static String MACHINEID_TO = RegionContant.LS_SY_CODE;

@Override
public StateMachine<ProjectStatusEnum, ProjectStatusChangeEvent> build() throws Exception {
StateMachine<ProjectStatusEnum, ProjectStatusChangeEvent> stateMachine = build(beanFactory);
logger.info("状态机ID:" + stateMachine.getId());
stateMachine.start();
return stateMachine;
}
/**
* 构建状态机
* @param beanFactory
* @author CMM
* @since 2023/02/07 16:15
*/
@Override
public StateMachine<ProjectStatusEnum, ProjectStatusChangeEvent> build(BeanFactory beanFactory) throws Exception {
StateMachineBuilder.Builder<ProjectStatusEnum, ProjectStatusChangeEvent> builder = StateMachineBuilder.builder();
builder.configureConfiguration()
.withConfiguration()
.machineId(MACHINEID_TO)
.beanFactory(beanFactory);

builder.configureStates()
.withStates()
.initial(ProjectStatusEnum.UNDER_INTERNAL_AUDIT)
.choice(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE)
.choice(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE)
.states(EnumSet.allOf(ProjectStatusEnum.class));

builder.configureTransitions()
// 单位内部审核通过,从单位内部审核中到待预审
.withExternal()
.source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT)
.target(ProjectStatusEnum.PENDING_PREQUALIFICATION)
.event(ProjectStatusChangeEvent.UNDER_INTERNAL_PASS).and()
// 单位内部审核驳回,从单位内部审核中到单位内部审核不通过
.withExternal()
.source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT)
.target(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS)
.event(ProjectStatusChangeEvent.UNDER_INTERNAL_REJECT).and()
// 单位内部审核中撤回,从单位内部审核中到待申报
.withExternal()
.source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT)
.target(ProjectStatusEnum.TO_BE_DECLARED)
.event(ProjectStatusChangeEvent.UNDER_INTERNAL_WITHDRAW).and()
// 单位内部审核不通过重新提交,从单位内部审核不通过到单位内部审核中
.withExternal()
.source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS)
.target(ProjectStatusEnum.UNDER_INTERNAL_AUDIT)
.event(ProjectStatusChangeEvent.UNDER_INTERNAL_REJECT_RESUBMIT).and()

// 待预审预审申报,从待预审到待预审选择
.withExternal()
.source(ProjectStatusEnum.PENDING_PREQUALIFICATION)
.target(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE)
.event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_DECLARE).and()
// 待预审申报,从待预审选择->省级部门联审中,预审中,完成其中一种状态
.withChoice()
.source(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE)
.first(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS,projectDeclareGuardFactory.new PendingPreQualificationChoiceGuard(),new ProjectDeclareChoiceAction())
.last(ProjectStatusEnum.PRE_APPLYING,new ProjectDeclareChoiceAction()).and()

// 省级部门联审通过,从省级部门联审中到省级部门联审成功
.withExternal()
.source(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS)
.target(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS)
.event(ProjectStatusChangeEvent.PROVINCIAL_DEPARTMENT_REVIEW_PASS).and()
// 省级部门联审通过,从省级部门联审成功到预审中
.withExternal()
.source(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS)
.target(ProjectStatusEnum.PRE_APPLYING)
.event(ProjectStatusChangeEvent.PROVINCIAL_PASS_TO_PRELIMINARY_REVIEW).and()
// 省级部门联审不通过,从省级部门联审中到省级部门联审不通过
.withExternal()
.source(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS)
.target(ProjectStatusEnum.THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED)
.event(ProjectStatusChangeEvent.PROVINCIAL_DEPARTMENT_REVIEW_REJECT).and()
// 省级部门联审中撤回,从省级部门联审中到待预审
.withExternal()
.source(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS)
.target(ProjectStatusEnum.PENDING_PREQUALIFICATION)
.event(ProjectStatusChangeEvent.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_WITHDRAW).and()

// 预审通过,从预审中到部门联审中
.withExternal()
.source(ProjectStatusEnum.PRE_APPLYING)
.target(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW)
.event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_PASS).and()
// 预审驳回,从预审中到预审不通过
.withExternal()
.source(ProjectStatusEnum.PRE_APPLYING)
.target(ProjectStatusEnum.PREQUALIFICATION_FAILED)
.event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_REJECT).and()
// 预审中撤回,从预审中到预审中撤回选择态
.withExternal()
.source(ProjectStatusEnum.PRE_APPLYING)
.target(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE)
.event(ProjectStatusChangeEvent.PRE_APPLYING_WITHDRAW).and()
// 预审中撤回,从预审中撤回选择态->省级部门联审成功,待预审,完成其中一种状态
.withChoice()
.source(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE)
.first(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS,projectDeclareGuardFactory.new PendingPreQualificationChoiceGuard()
,new ProjectDeclareChoiceAction())
.last(ProjectStatusEnum.PENDING_PREQUALIFICATION,new ProjectDeclareChoiceAction()).and()
// 预审不通过重新提交,从预审不通过到待预审选择
.withExternal()
.source(ProjectStatusEnum.PREQUALIFICATION_FAILED)
.target(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE)
.event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_REJECT_RESUBMIT).and()
// 预审不通过重新提交,从待预审选择->省级部门联审中,预审中,完成其中一种状态
.withChoice()
.source(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE)
.first(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS,projectDeclareGuardFactory.new PendingPreQualificationChoiceGuard(),new ProjectDeclareChoiceAction())
.last(ProjectStatusEnum.PRE_APPLYING,new ProjectDeclareChoiceAction()).and()
// 部门联审通过,从部门联审中到年度计划中
.withExternal()
.source(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW)
.target(ProjectStatusEnum.IN_THE_ANNUAL_PLAN)
.event(ProjectStatusChangeEvent.DEPARTMENT_UNITED_REVIEW_PASS).and()
// 部门联审驳回,从部门联审中到部门联审不通过
.withExternal()
.source(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW)
.target(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW_FAILED)
.event(ProjectStatusChangeEvent.DEPARTMENT_UNITED_REVIEW_REJECT).and()
// 部门联审中撤回,从部门联审中到预审中
.withExternal()
.source(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW)
.target(ProjectStatusEnum.PRE_APPLYING)
.event(ProjectStatusChangeEvent.DEPARTMENT_JOINT_REVIEW_WITHDRAW).and()
// 年度计划中开启方案申报,从年度计划中到方案待申报
.withExternal()
.source(ProjectStatusEnum.IN_THE_ANNUAL_PLAN)
.target(ProjectStatusEnum.PLAN_TO_BE_DECLARED)
.event(ProjectStatusChangeEvent.ANNUAL_PLAN_PROJECT_OPEN_PLAN_DECLARE).and()
// 年度计划中暂缓,从年度计划中到被暂缓
.withExternal()
.source(ProjectStatusEnum.IN_THE_ANNUAL_PLAN)
.target(ProjectStatusEnum.BE_SUSPENDED)
.event(ProjectStatusChangeEvent.ANNUAL_PLAN_SUSPEND).and()
// 方案待申报申报方案,从方案待申报到方案评审中
.withExternal()
.source(ProjectStatusEnum.PLAN_TO_BE_DECLARED)
.target(ProjectStatusEnum.SCHEME_UNDER_REVIEW)
.event(ProjectStatusChangeEvent.DECLARE_PLAN).and()
// 方案评审通过,从方案评审中到待立项批复
.withExternal()
.source(ProjectStatusEnum.SCHEME_UNDER_REVIEW)
.target(ProjectStatusEnum.TO_BE_APPROVED)
.event(ProjectStatusChangeEvent.PLAN_REVIEW_PASS).and()
// 方案评审驳回,从方案评审中到方案评审不通过
.withExternal()
.source(ProjectStatusEnum.SCHEME_UNDER_REVIEW)
.target(ProjectStatusEnum.SCHEME_REVIEW_FAILED)
.event(ProjectStatusChangeEvent.PLAN_REVIEW_REJECT).and()
// 方案评审中撤回,从方案评审中到方案待申报
.withExternal()
.source(ProjectStatusEnum.SCHEME_UNDER_REVIEW)
.target(ProjectStatusEnum.PLAN_TO_BE_DECLARED)
.event(ProjectStatusChangeEvent.SCHEME_UNDER_REVIEW_WITHDRAW).and()
// 方案评审不通过重新提交,从方案评审不通过到方案评审中
.withExternal()
.source(ProjectStatusEnum.SCHEME_REVIEW_FAILED)
.target(ProjectStatusEnum.SCHEME_UNDER_REVIEW)
.event(ProjectStatusChangeEvent.PLAN_REVIEW_REJECT_RESUBMIT).and()
// 待立项批复批复,从待立项批复到待采购
.withExternal()
.source(ProjectStatusEnum.TO_BE_APPROVED)
.target(ProjectStatusEnum.TO_BE_PURCHASED)
.event(ProjectStatusChangeEvent.PROJECT_APPROVAL).and()
// 待采购采购备案,从待采购到实施中
.withExternal()
.source(ProjectStatusEnum.TO_BE_PURCHASED)
.target(ProjectStatusEnum.OPERATION)
.event(ProjectStatusChangeEvent.PURCHASE_PUT_ON_RECORD).and()

// 待开工 实施,从实施到建设中
.withExternal()
.source(ProjectStatusEnum.OPERATION)
.target(ProjectStatusEnum.UNDER_CONSTRUCTION)
.event(ProjectStatusChangeEvent.START_TO_WORK).and()
// 建设中初验备案,从建设中到待终验
.withExternal()
.source(ProjectStatusEnum.UNDER_CONSTRUCTION)
.target(ProjectStatusEnum.TO_BE_FINALLY_INSPECTED)
.event(ProjectStatusChangeEvent.PRELIMINARY_ACCEPTANCE_PUT_ON_RECORD).and()
// 待终验终验申请,从待终验到终验审核中
.withExternal()
.source(ProjectStatusEnum.TO_BE_FINALLY_INSPECTED)
.target(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW)
.event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_APPLICATION).and()
// 终审审核通过,从终审审核中到已归档
.withExternal()
.source(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW)
.target(ProjectStatusEnum.ARCHIVED)
.event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_PASS).and()
// 终审审核不通过,从终审审核中到终审审核不通过
.withExternal()
.source(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW)
.target(ProjectStatusEnum.FINAL_ACCEPTANCE_REVIEW_FAILED)
.event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_REJECT).and()
// 终审审核中撤回,从终审审核中到待终验
.withExternal()
.source(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW)
.target(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW)
.event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_IS_UNDER_REVIEW_WITHDRAW).and()
// 终验中 重新提交
.withExternal()
.source(ProjectStatusEnum.FINAL_ACCEPTANCE_REVIEW_FAILED)
.target(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW)
.event(ProjectStatusChangeEvent.FINAL_RE_ACCEPTANCE_APPLICATION).and();
return builder.build();
}

/**
* 持久化配置
* @author CMM
* @since 2023/02/07 16:22
*/
@Bean(name = "projectDeclareStateMachineSYPersister")
@Override
public StateMachinePersister<ProjectStatusEnum, ProjectStatusChangeEvent, Project> getProjectPersister() {
StateMachinePersister sp = new DefaultStateMachinePersister<>(new StateMachinePersist<ProjectStatusEnum, ProjectStatusChangeEvent, Project>() {
@Override
public void write(StateMachineContext<ProjectStatusEnum, ProjectStatusChangeEvent> context, Project contextObj) {
}

@Override
public StateMachineContext<ProjectStatusEnum, ProjectStatusChangeEvent> read(Project contextObj) {
StateMachineContext<ProjectStatusEnum, ProjectStatusChangeEvent> result = new DefaultStateMachineContext(ProjectStatusEnum.match(contextObj.getStatus()),
null, null, null, null, RegionContant.LS_SY_CODE);
return result;
}
});
stateMachinePersister = sp;
return sp;
}

public StateMachinePersister getStateMachinePersister(){
return stateMachinePersister;
}
}

+ 0
- 285
hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/ProjectDeclareStateMachineYHBuilder.java View File

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

import com.hz.pm.api.common.statemachine.action.ProjectDeclareChoiceAction;
import com.hz.pm.api.common.statemachine.contant.RegionContant;
import com.hz.pm.api.common.statemachine.event.ProjectStatusChangeEvent;
import com.hz.pm.api.common.statemachine.factory.ProjectDeclareGuardFactory;
import com.hz.pm.api.projectlib.model.enumeration.ProjectStatusEnum;
import com.hz.pm.api.projectlib.model.entity.Project;
import lombok.RequiredArgsConstructor;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.statemachine.StateMachine;
import org.springframework.statemachine.StateMachineContext;
import org.springframework.statemachine.StateMachinePersist;
import org.springframework.statemachine.config.EnableStateMachine;
import org.springframework.statemachine.config.StateMachineBuilder;
import org.springframework.statemachine.persist.DefaultStateMachinePersister;
import org.springframework.statemachine.persist.StateMachinePersister;
import org.springframework.statemachine.support.DefaultStateMachineContext;
import org.springframework.stereotype.Component;

import java.util.EnumSet;

/**
* 项目申报状态机
* 云和县
* @author CMM
* @since 2023/02/07 15:56
*/
@Component
@EnableStateMachine(name= ProjectDeclareStateMachineYHBuilder.MACHINEID_TO)
@RequiredArgsConstructor
public class ProjectDeclareStateMachineYHBuilder implements ProjectDeclareStateMachineBuilder {
private static final ProjectDeclareGuardFactory projectDeclareGuardFactory = new ProjectDeclareGuardFactory();
private final BeanFactory beanFactory;

private StateMachinePersister stateMachinePersister;
private Logger logger = LoggerFactory.getLogger(getClass());
/**
* TO状态机
*/
public final static String MACHINEID_TO = RegionContant.LS_YH_CODE;

@Override
public StateMachine<ProjectStatusEnum, ProjectStatusChangeEvent> build() throws Exception {
StateMachine<ProjectStatusEnum, ProjectStatusChangeEvent> stateMachine = build(beanFactory);
logger.info("状态机ID:" + stateMachine.getId());
stateMachine.start();
return stateMachine;
}
/**
* 构建状态机
* @param beanFactory
* @author CMM
* @since 2023/02/07 16:15
*/
@Override
public StateMachine<ProjectStatusEnum, ProjectStatusChangeEvent> build(BeanFactory beanFactory) throws Exception {
StateMachineBuilder.Builder<ProjectStatusEnum, ProjectStatusChangeEvent> builder = StateMachineBuilder.builder();
builder.configureConfiguration()
.withConfiguration()
.machineId(MACHINEID_TO)
.beanFactory(beanFactory);

builder.configureStates()
.withStates()
.initial(ProjectStatusEnum.UNDER_INTERNAL_AUDIT)
.choice(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE)
.choice(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE)
.states(EnumSet.allOf(ProjectStatusEnum.class));

builder.configureTransitions()
// 单位内部审核通过,从单位内部审核中到待预审
.withExternal()
.source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT)
.target(ProjectStatusEnum.PENDING_PREQUALIFICATION)
.event(ProjectStatusChangeEvent.UNDER_INTERNAL_PASS).and()
// 单位内部审核驳回,从单位内部审核中到单位内部审核不通过
.withExternal()
.source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT)
.target(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS)
.event(ProjectStatusChangeEvent.UNDER_INTERNAL_REJECT).and()
// 单位内部审核中撤回,从单位内部审核中到待申报
.withExternal()
.source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT)
.target(ProjectStatusEnum.TO_BE_DECLARED)
.event(ProjectStatusChangeEvent.UNDER_INTERNAL_WITHDRAW).and()
// 单位内部审核不通过重新提交,从单位内部审核不通过到单位内部审核中
.withExternal()
.source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS)
.target(ProjectStatusEnum.UNDER_INTERNAL_AUDIT)
.event(ProjectStatusChangeEvent.UNDER_INTERNAL_REJECT_RESUBMIT).and()

// 待预审预审申报,从待预审到待预审选择
.withExternal()
.source(ProjectStatusEnum.PENDING_PREQUALIFICATION)
.target(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE)
.event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_DECLARE).and()
// 待预审申报,从待预审选择->省级部门联审中,预审中,完成其中一种状态
.withChoice()
.source(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE)
.first(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS,projectDeclareGuardFactory.new PendingPreQualificationChoiceGuard(),new ProjectDeclareChoiceAction())
.last(ProjectStatusEnum.PRE_APPLYING,new ProjectDeclareChoiceAction()).and()

// 省级部门联审通过,从省级部门联审中到省级部门联审成功
.withExternal()
.source(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS)
.target(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS)
.event(ProjectStatusChangeEvent.PROVINCIAL_DEPARTMENT_REVIEW_PASS).and()
// 省级部门联审通过,从省级部门联审成功到预审中
.withExternal()
.source(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS)
.target(ProjectStatusEnum.PRE_APPLYING)
.event(ProjectStatusChangeEvent.PROVINCIAL_PASS_TO_PRELIMINARY_REVIEW).and()
// 省级部门联审不通过,从省级部门联审中到省级部门联审不通过
.withExternal()
.source(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS)
.target(ProjectStatusEnum.THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED)
.event(ProjectStatusChangeEvent.PROVINCIAL_DEPARTMENT_REVIEW_REJECT).and()
// 省级部门联审中撤回,从省级部门联审中到待预审
.withExternal()
.source(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS)
.target(ProjectStatusEnum.PENDING_PREQUALIFICATION)
.event(ProjectStatusChangeEvent.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_WITHDRAW).and()

// 预审通过,从预审中到部门联审中
.withExternal()
.source(ProjectStatusEnum.PRE_APPLYING)
.target(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW)
.event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_PASS).and()
// 预审驳回,从预审中到预审不通过
.withExternal()
.source(ProjectStatusEnum.PRE_APPLYING)
.target(ProjectStatusEnum.PREQUALIFICATION_FAILED)
.event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_REJECT).and()
// 预审中撤回,从预审中到预审中撤回选择态
.withExternal()
.source(ProjectStatusEnum.PRE_APPLYING)
.target(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE)
.event(ProjectStatusChangeEvent.PRE_APPLYING_WITHDRAW).and()
// 预审中撤回,从预审中撤回选择态->省级部门联审成功,待预审,完成其中一种状态
.withChoice()
.source(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE)
.first(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS,projectDeclareGuardFactory.new PendingPreQualificationChoiceGuard()
,new ProjectDeclareChoiceAction())
.last(ProjectStatusEnum.PENDING_PREQUALIFICATION,new ProjectDeclareChoiceAction()).and()
// 预审不通过重新提交,从预审不通过到待预审选择
.withExternal()
.source(ProjectStatusEnum.PREQUALIFICATION_FAILED)
.target(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE)
.event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_REJECT_RESUBMIT).and()
// 预审不通过重新提交,从待预审选择->省级部门联审中,预审中,完成其中一种状态
.withChoice()
.source(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE)
.first(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS,projectDeclareGuardFactory.new PendingPreQualificationChoiceGuard(),new ProjectDeclareChoiceAction())
.last(ProjectStatusEnum.PRE_APPLYING,new ProjectDeclareChoiceAction()).and()
// 部门联审通过,从部门联审中到年度计划中
.withExternal()
.source(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW)
.target(ProjectStatusEnum.IN_THE_ANNUAL_PLAN)
.event(ProjectStatusChangeEvent.DEPARTMENT_UNITED_REVIEW_PASS).and()
// 部门联审驳回,从部门联审中到部门联审不通过
.withExternal()
.source(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW)
.target(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW_FAILED)
.event(ProjectStatusChangeEvent.DEPARTMENT_UNITED_REVIEW_REJECT).and()
// 部门联审中撤回,从部门联审中到预审中
.withExternal()
.source(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW)
.target(ProjectStatusEnum.PRE_APPLYING)
.event(ProjectStatusChangeEvent.DEPARTMENT_JOINT_REVIEW_WITHDRAW).and()
// 年度计划中开启方案申报,从年度计划中到方案待申报
.withExternal()
.source(ProjectStatusEnum.IN_THE_ANNUAL_PLAN)
.target(ProjectStatusEnum.PLAN_TO_BE_DECLARED)
.event(ProjectStatusChangeEvent.ANNUAL_PLAN_PROJECT_OPEN_PLAN_DECLARE).and()
// 年度计划中暂缓,从年度计划中到被暂缓
.withExternal()
.source(ProjectStatusEnum.IN_THE_ANNUAL_PLAN)
.target(ProjectStatusEnum.BE_SUSPENDED)
.event(ProjectStatusChangeEvent.ANNUAL_PLAN_SUSPEND).and()
// 方案待申报申报方案,从方案待申报到方案评审中
.withExternal()
.source(ProjectStatusEnum.PLAN_TO_BE_DECLARED)
.target(ProjectStatusEnum.SCHEME_UNDER_REVIEW)
.event(ProjectStatusChangeEvent.DECLARE_PLAN).and()
// 方案评审通过,从方案评审中到待立项批复
.withExternal()
.source(ProjectStatusEnum.SCHEME_UNDER_REVIEW)
.target(ProjectStatusEnum.TO_BE_APPROVED)
.event(ProjectStatusChangeEvent.PLAN_REVIEW_PASS).and()
// 方案评审驳回,从方案评审中到方案评审不通过
.withExternal()
.source(ProjectStatusEnum.SCHEME_UNDER_REVIEW)
.target(ProjectStatusEnum.SCHEME_REVIEW_FAILED)
.event(ProjectStatusChangeEvent.PLAN_REVIEW_REJECT).and()
// 方案评审中撤回,从方案评审中到方案待申报
.withExternal()
.source(ProjectStatusEnum.SCHEME_UNDER_REVIEW)
.target(ProjectStatusEnum.PLAN_TO_BE_DECLARED)
.event(ProjectStatusChangeEvent.SCHEME_UNDER_REVIEW_WITHDRAW).and()
// 方案评审不通过重新提交,从方案评审不通过到方案评审中
.withExternal()
.source(ProjectStatusEnum.SCHEME_REVIEW_FAILED)
.target(ProjectStatusEnum.SCHEME_UNDER_REVIEW)
.event(ProjectStatusChangeEvent.PLAN_REVIEW_REJECT_RESUBMIT).and()
// 待立项批复批复,从待立项批复到待采购
.withExternal()
.source(ProjectStatusEnum.TO_BE_APPROVED)
.target(ProjectStatusEnum.TO_BE_PURCHASED)
.event(ProjectStatusChangeEvent.PROJECT_APPROVAL).and()
// 待采购采购备案,从待采购到实施中
.withExternal()
.source(ProjectStatusEnum.TO_BE_PURCHASED)
.target(ProjectStatusEnum.OPERATION)
.event(ProjectStatusChangeEvent.PURCHASE_PUT_ON_RECORD).and()

// 待开工 实施,从实施到建设中
.withExternal()
.source(ProjectStatusEnum.OPERATION)
.target(ProjectStatusEnum.UNDER_CONSTRUCTION)
.event(ProjectStatusChangeEvent.START_TO_WORK).and()
// 建设中初验备案,从建设中到待终验
.withExternal()
.source(ProjectStatusEnum.UNDER_CONSTRUCTION)
.target(ProjectStatusEnum.TO_BE_FINALLY_INSPECTED)
.event(ProjectStatusChangeEvent.PRELIMINARY_ACCEPTANCE_PUT_ON_RECORD).and()
// 待终验终验申请,从待终验到终验审核中
.withExternal()
.source(ProjectStatusEnum.TO_BE_FINALLY_INSPECTED)
.target(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW)
.event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_APPLICATION).and()
// 终审审核通过,从终审审核中到已归档
.withExternal()
.source(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW)
.target(ProjectStatusEnum.ARCHIVED)
.event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_PASS).and()
// 终审审核不通过,从终审审核中到终审审核不通过
.withExternal()
.source(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW)
.target(ProjectStatusEnum.FINAL_ACCEPTANCE_REVIEW_FAILED)
.event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_REJECT).and()
// 终审审核中撤回,从终审审核中到待终验
.withExternal()
.source(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW)
.target(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW)
.event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_IS_UNDER_REVIEW_WITHDRAW).and()
// 终验中 重新提交
.withExternal()
.source(ProjectStatusEnum.FINAL_ACCEPTANCE_REVIEW_FAILED)
.target(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW)
.event(ProjectStatusChangeEvent.FINAL_RE_ACCEPTANCE_APPLICATION).and();
return builder.build();
}

/**
* 持久化配置
* @author CMM
* @since 2023/02/07 16:22
*/
@Bean(name = "projectDeclareStateMachineYHPersister")
@Override
public StateMachinePersister<ProjectStatusEnum, ProjectStatusChangeEvent, Project> getProjectPersister() {
StateMachinePersister sp = new DefaultStateMachinePersister<>(new StateMachinePersist<ProjectStatusEnum, ProjectStatusChangeEvent, Project>() {
@Override
public void write(StateMachineContext<ProjectStatusEnum, ProjectStatusChangeEvent> context, Project contextObj) {
}

@Override
public StateMachineContext<ProjectStatusEnum, ProjectStatusChangeEvent> read(Project contextObj) {
StateMachineContext<ProjectStatusEnum, ProjectStatusChangeEvent> result = new DefaultStateMachineContext(ProjectStatusEnum.match(contextObj.getStatus()),
null, null, null, null, RegionContant.LS_YH_CODE);
return result;
}
});
stateMachinePersister = sp;
return sp;
}

public StateMachinePersister getStateMachinePersister(){
return stateMachinePersister;
}
}

+ 0
- 38
hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/contant/RegionContant.java View File

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

/**
* @Classname RegionContant
* @Description
* @Date 2023/6/13 13:57
* @Author PoffyZhang
*/
public class RegionContant {

private RegionContant() {
}

//市本级
public static final String LS_SBJ_CODE = "330100";
//莲都区
public static final String LS_LD_CODE = "331102";
//青田县
public static final String LS_QT_CODE = "331121";
//缙云县
public static final String LS_JY_CODE = "331122";
//遂昌县
public static final String LS_SC_CODE = "331123";
//松阳县
public static final String LS_SY_CODE = "331124";
//云和县
public static final String LS_YH_CODE = "331125";
//庆元县
public static final String LS_QY_CODE = "331126";
//景宁畲族自治县
public static final String LS_JN_CODE = "331127";
//龙泉市
public static final String LS_LQ_CODE = "331181";
//开发区
public static final String LS_KFQ_CODE = "331199";

public static final String MORE_CODE = "000";
}

+ 0
- 57
hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/util/MachineBuilderFounder.java View File

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

import com.hz.pm.api.common.statemachine.builder.*;
import com.hz.pm.api.common.statemachine.contant.RegionContant;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;
import java.util.HashMap;
import java.util.Map;

/**
* 项目申报状态机
*
* @author CMM
* @since 2023/02/07 15:56
*/
@Slf4j
@Component
@RequiredArgsConstructor
public class MachineBuilderFounder {

private static final Map<String, ProjectDeclareStateMachineBuilder> MACHINE_BUILDER_MAP = new HashMap<>(16);

public static ProjectDeclareStateMachineBuilder getByRegion(String regionCode) {
return MACHINE_BUILDER_MAP.get(regionCode);
}

private final ProjectDeclareStateMachineSBJBuilder projectDeclareStateMachineSBJBuilder;
private final ProjectDeclareStateMachineLDBuilder projectDeclareStateMachineLDBuilder;
private final ProjectDeclareStateMachineQTBuilder projectDeclareStateMachineQTBuilder;
private final ProjectDeclareStateMachineJYBuilder projectDeclareStateMachineJYBuilder;
private final ProjectDeclareStateMachineSCBuilder projectDeclareStateMachineSCBuilder;
private final ProjectDeclareStateMachineSYBuilder projectDeclareStateMachineSYBuilder;
private final ProjectDeclareStateMachineYHBuilder projectDeclareStateMachineYHBuilder;
private final ProjectDeclareStateMachineQYBuilder projectDeclareStateMachineQYBuilder;
private final ProjectDeclareStateMachineJNBuilder projectDeclareStateMachineJNBuilder;
private final ProjectDeclareStateMachineLQBuilder projectDeclareStateMachineLQBuilder;
private final ProjectDeclareStateMachineKFQBuilder projectDeclareStateMachineKFQBuilder;

@PostConstruct
public void machineBuilderFounder(){
MACHINE_BUILDER_MAP.put(RegionContant.LS_SBJ_CODE, projectDeclareStateMachineSBJBuilder);
MACHINE_BUILDER_MAP.put(RegionContant.LS_LD_CODE, projectDeclareStateMachineLDBuilder);
MACHINE_BUILDER_MAP.put(RegionContant.LS_QT_CODE, projectDeclareStateMachineQTBuilder);
MACHINE_BUILDER_MAP.put(RegionContant.LS_JY_CODE, projectDeclareStateMachineJYBuilder);
MACHINE_BUILDER_MAP.put(RegionContant.LS_SC_CODE, projectDeclareStateMachineSCBuilder);
MACHINE_BUILDER_MAP.put(RegionContant.LS_SY_CODE, projectDeclareStateMachineSYBuilder);
MACHINE_BUILDER_MAP.put(RegionContant.LS_YH_CODE, projectDeclareStateMachineYHBuilder);
MACHINE_BUILDER_MAP.put(RegionContant.LS_QY_CODE, projectDeclareStateMachineQYBuilder);
MACHINE_BUILDER_MAP.put(RegionContant.LS_JN_CODE, projectDeclareStateMachineJNBuilder);
MACHINE_BUILDER_MAP.put(RegionContant.LS_LQ_CODE, projectDeclareStateMachineLQBuilder);
MACHINE_BUILDER_MAP.put(RegionContant.LS_KFQ_CODE, projectDeclareStateMachineKFQBuilder);
}

}

+ 10
- 10
hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/util/StateMachineUtil.java View File

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

import com.ningdatech.basic.exception.BizException;
import com.ningdatech.basic.function.VUtils;
import com.hz.pm.api.common.model.constant.RegionConst;
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.enumeration.ProjectStatusEnum;
import com.hz.pm.api.projectlib.model.entity.ProjectStatusChange;
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.INdProjectStatusChangeService;
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;
@@ -39,6 +38,10 @@ public class StateMachineUtil {

private static final String APPLICATION_DECLARE = StateMachineConst.APPLICATION_DECLARE;

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

private final ProjectDeclareStateMachineBuilder projectDeclareStateMachineBuilder;

private final INdProjectStatusChangeService projectStatusChangeService;

private final IProjectApplicationService projectApplicationService;
@@ -79,17 +82,14 @@ public class StateMachineUtil {
ProjectStatusChange projectStatusChange = new ProjectStatusChange();
projectStatusChange.setBeforeStatus(project.getStatus());

ProjectDeclareStateMachineBuilder builder = MachineBuilderFounder.getByRegion(project.getAreaCode());

VUtils.isTrue(Objects.isNull(builder)).throwMessage("状态机初始化失败!");
//获取TO状态机
StateMachine<ProjectStatusEnum, ProjectStatusChangeEvent> stateMachine = builder.build();
// 获取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 = builder.getProjectPersister();
StateMachinePersister<ProjectStatusEnum, ProjectStatusChangeEvent, Project> projectDeclareStateMachinePersister = projectDeclareStateMachineBuilder.getProjectPersister();
projectDeclareStateMachinePersister.restore(stateMachine, project);
stateMachine.sendEvent(message);
projectStatusChange.setProjectId(project.getId());


+ 2
- 2
hz-pm-api/src/main/java/com/hz/pm/api/fiscal/controller/CompanyFiscalCodeController.java View File

@@ -35,8 +35,8 @@ public class CompanyFiscalCodeController {
@ApiOperation(value = "财政编码-配置", notes = "财政编码配置")
@PostMapping("/fiscal-and-seal/configure")
@WebLog("财政编码-配置")
public void fiscalAndSealCodeConfigure(@Valid @RequestBody CompanyFiscalCodeAndSealSnReq companyFiscalCodeAndSealSnReq) {
companyFiscalCodeManage.fiscalCodeConfigure(companyFiscalCodeAndSealSnReq);
public void fiscalAndSealCodeConfigure(@Valid @RequestBody CompanyFiscalCodeAndSealSnReq req) {
companyFiscalCodeManage.fiscalCodeConfigure(req);
}

@ApiOperation(value = "获取财政编码-配置", notes = "获取财政编码配置")


+ 16
- 20
hz-pm-api/src/main/java/com/hz/pm/api/fiscal/manage/CompanyFiscalCodeManage.java View File

@@ -1,6 +1,5 @@
package com.hz.pm.api.fiscal.manage;

import com.hz.pm.api.common.helper.UserInfoHelper;
import com.hz.pm.api.common.util.StrUtils;
import com.hz.pm.api.fiscal.entity.CompanyFiscalCode;
import com.hz.pm.api.fiscal.model.po.CompanyFiscalCodeAndSealSnReq;
@@ -25,10 +24,8 @@ import java.util.Objects;
@RequiredArgsConstructor
public class CompanyFiscalCodeManage {

private final UserInfoHelper userInfoHelper;

private final ICompanyFiscalCodeService iCompanyFiscalCodeService;
private final ICompanySignatureService iCompanySignatureService;
private final ICompanyFiscalCodeService fiscalCodeService;
private final ICompanySignatureService signatureService;


public void fiscalCodeConfigure(CompanyFiscalCodeAndSealSnReq req) {
@@ -39,9 +36,8 @@ public class CompanyFiscalCodeManage {
} else {
temOrgCode = req.getOrganizationCode();
}
// TODO 校验用户权限
// 保存财政编码配置
CompanyFiscalCode companyFiscalCode = iCompanyFiscalCodeService.getByOrganizationCode(temOrgCode);
// 保存财政编码配置 TODO 校验用户权限
CompanyFiscalCode companyFiscalCode = fiscalCodeService.getByOrgCode(temOrgCode);
if (Objects.isNull(companyFiscalCode)) {
companyFiscalCode = new CompanyFiscalCode();
companyFiscalCode.setOrganizationCode(temOrgCode);
@@ -52,11 +48,11 @@ public class CompanyFiscalCodeManage {
companyFiscalCode.setFiscalCode(fiscalCode);
companyFiscalCode.setUpdateOn(LocalDateTime.now());
companyFiscalCode.setUpdateBy(userDetail.getUserId());
iCompanyFiscalCodeService.saveOrUpdate(companyFiscalCode);
fiscalCodeService.saveOrUpdate(companyFiscalCode);


// 保存印章配置
CompanySignature signature = iCompanySignatureService.getByOrganizationCode(temOrgCode);
CompanySignature signature = signatureService.getByOrganizationCode(temOrgCode);
if (Objects.isNull(signature)) {
signature = new CompanySignature();
signature.setOrganizationCode(temOrgCode);
@@ -67,7 +63,7 @@ public class CompanyFiscalCodeManage {
signature.setUpdateOn(LocalDateTime.now());
signature.setCreateBy(userDetail.getUserId());
signature.setUpdateBy(userDetail.getUserId());
iCompanySignatureService.saveOrUpdate(signature);
signatureService.saveOrUpdate(signature);
}

public CompanyFiscalCodeAndSealSnVO getFiscalCodeConfigure(ReqGetCompanyFiscalCodeAndSealSnPO request) {
@@ -78,16 +74,16 @@ public class CompanyFiscalCodeManage {
} else {
temOrgCode = request.getOrganizationCode();
}
CompanySignature companySignature = iCompanySignatureService.getByOrganizationCode(temOrgCode);
if (Objects.isNull(companySignature)) {
CompanySignature signature = signatureService.getByOrganizationCode(temOrgCode);
if (Objects.isNull(signature)) {
return null;
}
CompanyFiscalCode companyFiscalCode = iCompanyFiscalCodeService.getByOrganizationCode(temOrgCode);
CompanyFiscalCodeAndSealSnVO returnVO = new CompanyFiscalCodeAndSealSnVO();
returnVO.setCreateTime(companySignature.getCreateOn());
returnVO.setUpdateTime(companySignature.getUpdateOn());
returnVO.setFiscalCode(companyFiscalCode.getFiscalCode());
returnVO.setSealSn(companySignature.getSealSn());
return returnVO;
CompanyFiscalCode cfc = fiscalCodeService.getByOrgCode(temOrgCode);
CompanyFiscalCodeAndSealSnVO res = new CompanyFiscalCodeAndSealSnVO();
res.setCreateTime(signature.getCreateOn());
res.setUpdateTime(signature.getUpdateOn());
res.setFiscalCode(cfc.getFiscalCode());
res.setSealSn(signature.getSealSn());
return res;
}
}

+ 1
- 1
hz-pm-api/src/main/java/com/hz/pm/api/fiscal/service/ICompanyFiscalCodeService.java View File

@@ -16,7 +16,7 @@ import java.util.Map;
*/
public interface ICompanyFiscalCodeService extends IService<CompanyFiscalCode> {

CompanyFiscalCode getByOrganizationCode(String orgCode);
CompanyFiscalCode getByOrgCode(String orgCode);

/**
* 获取 key orgCode fiscalCode


+ 1
- 1
hz-pm-api/src/main/java/com/hz/pm/api/fiscal/service/impl/CompanyFiscalCodeServiceImpl.java View File

@@ -29,7 +29,7 @@ public class CompanyFiscalCodeServiceImpl extends ServiceImpl<NdCompanyFiscalCod


@Override
public CompanyFiscalCode getByOrganizationCode(String orgCode) {
public CompanyFiscalCode getByOrgCode(String orgCode) {
if (StringUtils.isBlank(orgCode)) {
return null;
}


+ 7
- 2
hz-pm-api/src/main/java/com/hz/pm/api/organization/controller/ProcDefController.java View File

@@ -1,5 +1,7 @@
package com.hz.pm.api.organization.controller;

import com.hz.pm.api.common.util.StrUtils;
import com.hz.pm.api.user.util.LoginUserUtil;
import com.ningdatech.basic.model.PageVo;
import com.ningdatech.log.annotation.WebLog;
import com.hz.pm.api.organization.manage.ProcDefManage;
@@ -50,8 +52,11 @@ public class ProcDefController {
@ApiOperation(value = "单位流程配置保存", notes = "单位流程配置保存")
@PostMapping("/save")
@WebLog("单位流程配置保存")
public String save(@Validated @RequestBody WflowOrgProcdefDto wflowOrgProcdefDto) {
return orgProcessModelService.saveProcessLs(wflowOrgProcdefDto);
public String save(@Validated @RequestBody WflowOrgProcdefDto req) {
if (StrUtils.isBlank(req.getOrgCode())) {
req.setOrgCode(LoginUserUtil.loginUserDetail().getMhUnitIdStr());
}
return orgProcessModelService.saveProcessLs(req);
}

@ApiOperation(value = "单位流程配置启用", notes = "单位流程配置启用")


+ 84
- 77
hz-pm-api/src/main/java/com/hz/pm/api/performance/manage/IndicatorConfigManage.java View File

@@ -3,9 +3,12 @@ package com.hz.pm.api.performance.manage;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Assert;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.google.common.collect.Lists;
import com.hz.pm.api.common.util.BizUtils;
import com.hz.pm.api.common.util.StrUtils;
import com.ningdatech.basic.exception.BizException;
import com.ningdatech.basic.function.VUtils;
import com.ningdatech.basic.model.PageVo;
@@ -67,18 +70,18 @@ public class IndicatorConfigManage {

/**
* 模板列表
*
* @param req
* @return
*/
public PageVo<ProjectIndexTemplateVO> projectIndexTemplateList(PerformanceAppraisalListReq req) {
Page<PerformanceIndicatorProjectTemplate> page = req.page();
LambdaQueryWrapper<PerformanceIndicatorProjectTemplate> wrapper = Wrappers.lambdaQuery(PerformanceIndicatorProjectTemplate.class)
.like(StringUtils.isNotBlank(req.getTemplateName()), PerformanceIndicatorProjectTemplate::getName, req.getTemplateName())
.eq(StringUtils.isNotBlank(req.getRegionCode()), PerformanceIndicatorProjectTemplate::getRegionCode,req.getRegionCode())
.like(StrUtils.isNotBlank(req.getTemplateName()), PerformanceIndicatorProjectTemplate::getName, req.getTemplateName())
.orderByDesc(PerformanceIndicatorProjectTemplate::getCreateOn);
indicatorProjectTemplateService.page(page,wrapper);
indicatorProjectTemplateService.page(page, wrapper);

if(CollUtil.isEmpty(page.getRecords())){
if (CollUtil.isEmpty(page.getRecords())) {
return PageVo.empty();
}

@@ -86,40 +89,40 @@ public class IndicatorConfigManage {
.map(p -> BeanUtil.copyProperties(p, ProjectIndexTemplateVO.class))
.collect(Collectors.toList());

return PageVo.of(res,page.getTotal());
return PageVo.of(res, page.getTotal());
}

/**
* 查询项目模板详情
* @param id
* @return
*
* @param id \
* @return \
*/
public ProjectIndexTemplateVO projectDetail(Long id) {
PerformanceIndicatorProjectTemplate template = indicatorProjectTemplateService.getById(id);
if(Objects.isNull(template)){
if (Objects.isNull(template)) {
return null;
}
ProjectIndexTemplateVO vo = BeanUtil.copyProperties(template,
ProjectIndexTemplateVO.class);
String projectTagIds = template.getProjectTagIds();
if (StringUtils.isNotBlank(projectTagIds)){
List<Long> proTagIdList = Arrays.stream(projectTagIds.split(StrPool.COMMA)).map(Long::valueOf).collect(Collectors.toList());
vo.setProjectTagIds(proTagIdList);
if (StringUtils.isNotBlank(projectTagIds)) {
vo.setProjectTagIds(BizUtils.splitToLong(projectTagIds));
}
// 获取模版绩效指标详情
List<PerformanceIndicatorProjectTemplateDetail> templateDetails = indicatorProjectTemplateDetailService.list(Wrappers.lambdaQuery(PerformanceIndicatorProjectTemplateDetail.class)
.eq(PerformanceIndicatorProjectTemplateDetail::getTemplateId, id)
.eq(PerformanceIndicatorProjectTemplateDetail::getIsAdditional,Boolean.FALSE));
.eq(PerformanceIndicatorProjectTemplateDetail::getIsAdditional, Boolean.FALSE));
// 获取模版附加绩效指标详情
List<PerformanceIndicatorProjectTemplateDetail> additionalTemplateDetails = indicatorProjectTemplateDetailService.list(Wrappers.lambdaQuery(PerformanceIndicatorProjectTemplateDetail.class)
.eq(PerformanceIndicatorProjectTemplateDetail::getTemplateId, id)
.eq(PerformanceIndicatorProjectTemplateDetail::getIsAdditional,Boolean.TRUE));
if(CollUtil.isNotEmpty(templateDetails)){
.eq(PerformanceIndicatorProjectTemplateDetail::getIsAdditional, Boolean.TRUE));
if (CollUtil.isNotEmpty(templateDetails)) {
List<ProjectTemplateDetailVO> templateDetailVos = templateDetailBuildHelper.buildTemplateDetail(templateDetails, null, null);
vo.setTemplateDetails(templateDetailVos);
}

if (CollUtil.isNotEmpty(additionalTemplateDetails)){
if (CollUtil.isNotEmpty(additionalTemplateDetails)) {
List<ProjectTemplateDetailVO> additionalTemplateDetailVos = templateDetailBuildHelper.buildTemplateDetail(additionalTemplateDetails, null, null);
vo.setAdditionalIndexDetails(additionalTemplateDetailVos);
}
@@ -128,6 +131,7 @@ public class IndicatorConfigManage {

/**
* 项目指标 模板保存
*
* @param dto
* @return
*/
@@ -138,35 +142,35 @@ public class IndicatorConfigManage {
List<Long> projectTagIds = dto.getProjectTagIds();
List<String> tagIdList = projectTagIds.stream().map(String::valueOf).collect(Collectors.toList());
template.setProjectTagIds(String.join(StrPool.COMMA, tagIdList));
if (Objects.isNull(dto.getStatus())){
if (Objects.isNull(dto.getStatus())) {
// 默认模版禁用
template.setStatus(0);
}
if(Objects.nonNull(dto.getId())){
if (Objects.nonNull(dto.getId())) {
PerformanceIndicatorProjectTemplate old = indicatorProjectTemplateService.getById(dto.getId());
VUtils.isTrue(Objects.isNull(old)).throwMessage("该模板不存在!");
template.setId(old.getId());
}else{
} else {
template.setId(null);
template.setCreateOn(LocalDateTime.now());
template.setCreateBy(user.getUsername());
}
template.setUpdateOn(LocalDateTime.now());
template.setUpdateBy(user.getUsername());
if(indicatorProjectTemplateService.saveOrUpdate(template)){
if (indicatorProjectTemplateService.saveOrUpdate(template)) {
//保存 模板指标的详情
if(CollUtil.isNotEmpty(dto.getTemplateDetails())){
if (CollUtil.isNotEmpty(dto.getTemplateDetails())) {
//先删除
indicatorProjectTemplateDetailService.remove(Wrappers.lambdaQuery(PerformanceIndicatorProjectTemplateDetail.class)
.eq(PerformanceIndicatorProjectTemplateDetail::getTemplateId,dto.getId())
.eq(PerformanceIndicatorProjectTemplateDetail::getIsAdditional,Boolean.FALSE));
analysisTemplateDetails(dto.getTemplateDetails(),template.getId());
.eq(PerformanceIndicatorProjectTemplateDetail::getTemplateId, dto.getId())
.eq(PerformanceIndicatorProjectTemplateDetail::getIsAdditional, Boolean.FALSE));
analysisTemplateDetails(dto.getTemplateDetails(), template.getId());
//校检 所有3级指标(不包括附加指标) 总分是不是100
List<PerformanceIndicatorProjectTemplateDetail> indexList = indicatorProjectTemplateDetailService.list(Wrappers.lambdaQuery(PerformanceIndicatorProjectTemplateDetail.class)
.eq(PerformanceIndicatorProjectTemplateDetail::getTemplateId, template.getId())
.eq(PerformanceIndicatorProjectTemplateDetail::getIsAdditional,Boolean.FALSE)
.eq(PerformanceIndicatorProjectTemplateDetail::getType,PerformanceTemplateTypeEnum.THIRD_INDEX.getCode()));
if(CollUtil.isNotEmpty(indexList)){
.eq(PerformanceIndicatorProjectTemplateDetail::getIsAdditional, Boolean.FALSE)
.eq(PerformanceIndicatorProjectTemplateDetail::getType, PerformanceTemplateTypeEnum.THIRD_INDEX.getCode()));
if (CollUtil.isNotEmpty(indexList)) {
BigDecimal sum = indexList.stream()
.map(PerformanceIndicatorProjectTemplateDetail::getIndexScore)
.filter(Objects::nonNull)
@@ -176,11 +180,11 @@ public class IndicatorConfigManage {
}
}
// 保存 模版附加指标详情
if (CollUtil.isNotEmpty(dto.getAdditionalIndexDetails())){
if (CollUtil.isNotEmpty(dto.getAdditionalIndexDetails())) {
indicatorProjectTemplateDetailService.remove(Wrappers.lambdaQuery(PerformanceIndicatorProjectTemplateDetail.class)
.eq(PerformanceIndicatorProjectTemplateDetail::getTemplateId,dto.getId())
.eq(PerformanceIndicatorProjectTemplateDetail::getIsAdditional,Boolean.TRUE));
analysisAdditionalTemplateDetails(dto.getAdditionalIndexDetails(),template.getId());
.eq(PerformanceIndicatorProjectTemplateDetail::getTemplateId, dto.getId())
.eq(PerformanceIndicatorProjectTemplateDetail::getIsAdditional, Boolean.TRUE));
analysisAdditionalTemplateDetails(dto.getAdditionalIndexDetails(), template.getId());
}
return BizConst.SAVE_SUCCESS;
}
@@ -189,37 +193,39 @@ public class IndicatorConfigManage {

/**
* 解析 项目考核指标
*
* @param templateDetails
* @return
*/
public void analysisTemplateDetails(
List<ProjectTemplateDetailDTO> templateDetails,Long templateId) {
if(CollUtil.isEmpty(templateDetails)){
List<ProjectTemplateDetailDTO> templateDetails, Long templateId) {
if (CollUtil.isEmpty(templateDetails)) {
return;
}
analysisTemplateDetailsInner(templateDetails,templateId,null);
analysisTemplateDetailsInner(templateDetails, templateId, null);
}

/**
* 解析 项目附加考核指标
*
* @param additionalTemplateDetails
* @return
*/
public void analysisAdditionalTemplateDetails(
List<ProjectTemplateDetailDTO> additionalTemplateDetails,Long templateId) {
if(CollUtil.isEmpty(additionalTemplateDetails)){
List<ProjectTemplateDetailDTO> additionalTemplateDetails, Long templateId) {
if (CollUtil.isEmpty(additionalTemplateDetails)) {
return;
}
analysisAdditionalTemplateDetailsInner(additionalTemplateDetails,templateId,null);
analysisAdditionalTemplateDetailsInner(additionalTemplateDetails, templateId, null);
}

public void analysisTemplateDetailsInner(List<ProjectTemplateDetailDTO> templateDetails,
Long templateId,Long parentId) {
if(CollUtil.isEmpty(templateDetails)){
Long templateId, Long parentId) {
if (CollUtil.isEmpty(templateDetails)) {
return;
}
UserInfoDetails user = LoginUserUtil.loginUserDetail();
for(ProjectTemplateDetailDTO detail : templateDetails){
for (ProjectTemplateDetailDTO detail : templateDetails) {
//计算阶段的
PerformanceIndicatorProjectTemplateDetail templateDetail = BeanUtil.copyProperties(detail, PerformanceIndicatorProjectTemplateDetail.class);
templateDetail.setCreateBy(user.getUsername());
@@ -233,19 +239,19 @@ public class IndicatorConfigManage {

indicatorProjectTemplateDetailService.save(templateDetail);

if(CollUtil.isNotEmpty(detail.getChildren())){
analysisTemplateDetailsInner(detail.getChildren(),templateId,templateDetail.getId());
if (CollUtil.isNotEmpty(detail.getChildren())) {
analysisTemplateDetailsInner(detail.getChildren(), templateId, templateDetail.getId());
}
}
}

public void analysisAdditionalTemplateDetailsInner(List<ProjectTemplateDetailDTO> templateDetails,
Long templateId,Long parentId) {
if(CollUtil.isEmpty(templateDetails)){
Long templateId, Long parentId) {
if (CollUtil.isEmpty(templateDetails)) {
return;
}
UserInfoDetails user = LoginUserUtil.loginUserDetail();
for(ProjectTemplateDetailDTO detail : templateDetails){
for (ProjectTemplateDetailDTO detail : templateDetails) {
//计算阶段的
PerformanceIndicatorProjectTemplateDetail templateDetail = BeanUtil.copyProperties(detail, PerformanceIndicatorProjectTemplateDetail.class);
templateDetail.setCreateBy(user.getUsername());
@@ -260,14 +266,15 @@ public class IndicatorConfigManage {

indicatorProjectTemplateDetailService.save(templateDetail);

if(CollUtil.isNotEmpty(detail.getChildren())){
analysisAdditionalTemplateDetailsInner(detail.getChildren(),templateId,templateDetail.getId());
if (CollUtil.isNotEmpty(detail.getChildren())) {
analysisAdditionalTemplateDetailsInner(detail.getChildren(), templateId, templateDetail.getId());
}
}
}

/**
* 装配 模板详情
*
* @param templateDetails
* @return
*/
@@ -310,11 +317,11 @@ public class IndicatorConfigManage {
}
return res;
}

/**
* 删除项目模板
*
*
* @param id
* @return
*/
@@ -328,8 +335,8 @@ public class IndicatorConfigManage {

if (indicatorProjectTemplateService.removeById(id)) {
indicatorProjectTemplateDetailService
.remove(Wrappers.lambdaQuery(PerformanceIndicatorProjectTemplateDetail.class)
.eq(PerformanceIndicatorProjectTemplateDetail::getTemplateId, id));
.remove(Wrappers.lambdaQuery(PerformanceIndicatorProjectTemplateDetail.class)
.eq(PerformanceIndicatorProjectTemplateDetail::getTemplateId, id));
return "删除成功";
}
return "操作失败";
@@ -337,7 +344,7 @@ public class IndicatorConfigManage {

public Boolean enOrDisProjectIndexTemplate(Long templateId, boolean active) {
PerformanceIndicatorProjectTemplate projectTemplate = indicatorProjectTemplateService.getById(templateId);
if (Boolean.TRUE.equals(active)){
if (Boolean.TRUE.equals(active)) {
// 根据创建模板时选择的项目类型、预算年度、项目金额、项目标签
// 判断模板是否可以启用(同一套组合只能启用一套模板)
PerformanceIndicatorProjectTemplate template = indicatorProjectTemplateService.getOne(Wrappers.lambdaQuery(PerformanceIndicatorProjectTemplate.class)
@@ -345,12 +352,12 @@ public class IndicatorConfigManage {
.eq(PerformanceIndicatorProjectTemplate::getProjectYear, projectTemplate.getProjectYear())
.eq(PerformanceIndicatorProjectTemplate::getAmountRange, projectTemplate.getAmountRange())
.eq(PerformanceIndicatorProjectTemplate::getProjectTagIds, projectTemplate.getProjectTagIds())
.eq(PerformanceIndicatorProjectTemplate::getStatus,CommonEnum.YES.getCode()));
if (Objects.nonNull(template)){
.eq(PerformanceIndicatorProjectTemplate::getStatus, CommonEnum.YES.getCode()));
if (Objects.nonNull(template)) {
throw new BizException("相同配置的模板已存在,当前模板无法启用!");
}
projectTemplate.setStatus(CommonEnum.YES.getCode());
}else {
} else {
projectTemplate.setStatus(CommonEnum.NO.getCode());
}
return indicatorProjectTemplateService.updateById(projectTemplate);
@@ -361,7 +368,7 @@ public class IndicatorConfigManage {
UserInfoDetails user = LoginUserUtil.loginUserDetail();
PerformanceIndicatorProjectTemplate projectTemplate = indicatorProjectTemplateService.getById(templateId);
PerformanceIndicatorProjectTemplate newTemplate = new PerformanceIndicatorProjectTemplate();
BeanUtils.copyProperties(projectTemplate,newTemplate);
BeanUtils.copyProperties(projectTemplate, newTemplate);
// 复制后,项目模版名称变更为xxx副本,状态为禁用
newTemplate.setName(projectTemplate.getName() + CommonConst.COPY);
newTemplate.setStatus(CommonEnum.NO.getCode());
@@ -381,7 +388,7 @@ public class IndicatorConfigManage {
List<PerformanceIndicatorProjectTemplateDetail> thirdList = projectTemplateDetails.stream()
.filter(p -> PerformanceTemplateTypeEnum.THIRD_INDEX.getCode().equals(p.getType()))
.collect(Collectors.toList());
if (CollUtil.isEmpty(thirdList)){
if (CollUtil.isEmpty(thirdList)) {
throw new BizException("当前模板未配置三级指!");
}
List<PerformanceIndicatorProjectTemplateDetail> templateDetails = Lists.newArrayList();
@@ -400,7 +407,7 @@ public class IndicatorConfigManage {
// 再保存关联的二级指标
Long thirdParentId = templateDetail.getParentId();
PerformanceIndicatorProjectTemplateDetail secondTemplateDetail = detailMap.get(thirdParentId);
if (Objects.isNull(secondTemplateDetail)){
if (Objects.isNull(secondTemplateDetail)) {
throw new BizException("三级指标:" + templateDetail.getName() + "对应的二级指标不存在");
}
PerformanceIndicatorProjectTemplateDetail newSecondTemplateDetail = new PerformanceIndicatorProjectTemplateDetail();
@@ -420,7 +427,7 @@ public class IndicatorConfigManage {
// 再保存关联的一级指标
Long secondParentId = secondTemplateDetail.getParentId();
PerformanceIndicatorProjectTemplateDetail firstTemplateDetail = detailMap.get(secondParentId);
if (Objects.isNull(firstTemplateDetail)){
if (Objects.isNull(firstTemplateDetail)) {
throw new BizException("二级指标:" + secondTemplateDetail.getName() + "对应的一级指标不存在");
}
PerformanceIndicatorProjectTemplateDetail newFirstTemplateDetail = new PerformanceIndicatorProjectTemplateDetail();
@@ -453,32 +460,32 @@ public class IndicatorConfigManage {
.eq(Objects.nonNull(req.getIndexLevel()), PerformanceAppraisalProjectIndicator::getIndexLevel, req.getIndexLevel())
.eq(StringUtils.isNotBlank(req.getRegionCode()), PerformanceAppraisalProjectIndicator::getRegionCode, req.getRegionCode())
.orderByDesc(PerformanceAppraisalProjectIndicator::getCreateOn);
projectIndicatorService.page(page,wrapper);
projectIndicatorService.page(page, wrapper);

if (CollUtil.isEmpty(page.getRecords())){
if (CollUtil.isEmpty(page.getRecords())) {
return PageVo.empty();
}
List<ProjectIndexVO> result = page.getRecords().stream()
.map(i -> BeanUtil.copyProperties(i, ProjectIndexVO.class))
.collect(Collectors.toList());
return PageVo.of(result,page.getTotal());
return PageVo.of(result, page.getTotal());
}

public String projectIndexSave(PerformanceIndicatorProjectIndexSaveDTO dto) {
UserInfoDetails user = LoginUserUtil.loginUserDetail();
PerformanceAppraisalProjectIndicator projectIndicator = BeanUtil.copyProperties(dto, PerformanceAppraisalProjectIndicator.class);
if(Objects.nonNull(dto.getId())){
if (Objects.nonNull(dto.getId())) {
PerformanceAppraisalProjectIndicator old = projectIndicatorService.getById(dto.getId());
VUtils.isTrue(Objects.isNull(old)).throwMessage("该项目指标不存在!");
Assert.notNull(old, "该项目指标不存在!");
projectIndicator.setId(old.getId());
}else{
} else {
projectIndicator.setId(null);
projectIndicator.setCreateOn(LocalDateTime.now());
projectIndicator.setCreateBy(user.getUsername());
}
projectIndicator.setUpdateOn(LocalDateTime.now());
projectIndicator.setUpdateBy(user.getUsername());
if(projectIndicatorService.saveOrUpdate(projectIndicator)){
if (projectIndicatorService.saveOrUpdate(projectIndicator)) {
return "指标新增成功";
}
return "指标新增失败";
@@ -495,7 +502,7 @@ public class IndicatorConfigManage {

public ProjectIndexVO projectIndexDetail(Long id) {
PerformanceAppraisalProjectIndicator projectIndex = projectIndicatorService.getById(id);
if(Objects.isNull(projectIndex)){
if (Objects.isNull(projectIndex)) {
return null;
}
return BeanUtil.copyProperties(projectIndex, ProjectIndexVO.class);
@@ -505,33 +512,33 @@ public class IndicatorConfigManage {
Page<PerformanceAppraisalAppIndicator> page = req.page();
LambdaQueryWrapper<PerformanceAppraisalAppIndicator> wrapper = Wrappers.lambdaQuery(PerformanceAppraisalAppIndicator.class)
.like(StringUtils.isNotBlank(req.getIndexName()), PerformanceAppraisalAppIndicator::getIndexName, req.getIndexName())
.orderBy(Boolean.FALSE,Boolean.TRUE, PerformanceAppraisalAppIndicator::getSort);
appIndicatorService.page(page,wrapper);
.orderBy(Boolean.FALSE, Boolean.TRUE, PerformanceAppraisalAppIndicator::getSort);
appIndicatorService.page(page, wrapper);

if (CollUtil.isEmpty(page.getRecords())){
if (CollUtil.isEmpty(page.getRecords())) {
return PageVo.empty();
}
List<AppIndexVO> result = page.getRecords().stream()
.map(i -> BeanUtil.copyProperties(i, AppIndexVO.class))
.collect(Collectors.toList());
return PageVo.of(result,page.getTotal());
return PageVo.of(result, page.getTotal());
}

public String appIndexSave(PerformanceIndicatorAppIndexSaveDTO dto) {
UserInfoDetails user = LoginUserUtil.loginUserDetail();
PerformanceAppraisalAppIndicator appIndicator = BeanUtil.copyProperties(dto, PerformanceAppraisalAppIndicator.class);
if(Objects.nonNull(dto.getId())){
if (Objects.nonNull(dto.getId())) {
PerformanceAppraisalAppIndicator old = appIndicatorService.getById(dto.getId());
VUtils.isTrue(Objects.isNull(old)).throwMessage("该项目指标不存在!");
Assert.notNull(old, "该项目指标不存在!");
appIndicator.setId(old.getId());
}else{
} else {
appIndicator.setId(null);
appIndicator.setCreateOn(LocalDateTime.now());
appIndicator.setCreateBy(user.getUsername());
}
appIndicator.setUpdateOn(LocalDateTime.now());
appIndicator.setUpdateBy(user.getUsername());
if(appIndicatorService.saveOrUpdate(appIndicator)){
if (appIndicatorService.saveOrUpdate(appIndicator)) {
return "指标新增成功";
}
return "指标新增失败";
@@ -548,7 +555,7 @@ public class IndicatorConfigManage {

public AppIndexVO appIndexDetail(Long id) {
PerformanceAppraisalAppIndicator appIndex = appIndicatorService.getById(id);
if(Objects.isNull(appIndex)){
if (Objects.isNull(appIndex)) {
return null;
}
return BeanUtil.copyProperties(appIndex, AppIndexVO.class);
@@ -556,9 +563,9 @@ public class IndicatorConfigManage {

public Boolean enOrDisAppIndex(Long appId, Boolean state) {
PerformanceAppraisalAppIndicator appIndicator = appIndicatorService.getById(appId);
if (Boolean.TRUE.equals(state)){
if (Boolean.TRUE.equals(state)) {
appIndicator.setIsDisplay(Boolean.TRUE);
}else {
} else {
appIndicator.setIsDisplay(Boolean.FALSE);
}
return appIndicatorService.updateById(appIndicator);


+ 0
- 3
hz-pm-api/src/main/java/com/hz/pm/api/performance/model/dto/PerformanceIndicatorProjectTemplateSaveDTO.java View File

@@ -25,9 +25,6 @@ public class PerformanceIndicatorProjectTemplateSaveDTO implements Serializable
@ApiModelProperty("模板名称")
private String name;

@ApiModelProperty("丽水 区域code")
private String regionCode;

@ApiModelProperty("项目年度")
private Integer projectYear;



+ 3
- 3
hz-pm-api/src/main/java/com/hz/pm/api/portrait/controller/TagController.java View File

@@ -28,10 +28,10 @@ import java.util.List;
public class TagController {
private final TagManage tagManage;

@GetMapping("/list/{areaCode}")
@GetMapping("/list")
@ApiOperation("按区域查询标签列表")
public PageVo<TagVO> list(@PathVariable String areaCode, TagPageReq req) {
return tagManage.list(areaCode,req);
public PageVo<TagVO> list(TagPageReq req) {
return tagManage.list(req);
}

@PostMapping("/save")


+ 24
- 34
hz-pm-api/src/main/java/com/hz/pm/api/portrait/manage/TagManage.java View File

@@ -3,14 +3,12 @@ package com.hz.pm.api.portrait.manage;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Assert;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ningdatech.basic.function.VUtils;
import com.ningdatech.basic.model.PageVo;
import com.ningdatech.basic.util.CollUtils;
import com.hz.pm.api.common.model.constant.BizConst;
import com.hz.pm.api.common.model.constant.RegionConst;
import com.hz.pm.api.common.helper.RegionCacheHelper;
import com.hz.pm.api.common.model.constant.BizConst;
import com.hz.pm.api.common.util.StrUtils;
import com.hz.pm.api.gov.model.entity.GovBizProjectBaseinfo;
import com.hz.pm.api.gov.service.IGovBizProjectBaseinfoService;
import com.hz.pm.api.portrait.model.dto.TagDTO;
@@ -23,9 +21,11 @@ import com.hz.pm.api.portrait.service.IProjectTagService;
import com.hz.pm.api.portrait.service.ITagService;
import com.hz.pm.api.projectlib.model.entity.Project;
import com.hz.pm.api.projectlib.service.IProjectService;
import com.hz.pm.api.sys.model.dto.RegionDTO;
import com.hz.pm.api.user.security.model.UserInfoDetails;
import com.hz.pm.api.user.util.LoginUserUtil;
import com.ningdatech.basic.function.VUtils;
import com.ningdatech.basic.model.PageVo;
import com.ningdatech.basic.util.CollUtils;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
@@ -37,10 +37,12 @@ import java.util.Objects;
import java.util.stream.Collectors;

/**
* @Classname TagManage
* @Description
* @Date 2023/8/2 14:10
* @Author PoffyZhang
* <p>
* TagManage-项目标签管理
* </p>
*
* @author WendyYang
* @since 11:37 2024/1/15
*/
@Component
@Slf4j
@@ -60,26 +62,21 @@ public class TagManage {
/**
* 标签分页
*
* @param areaCode
* @param req
* @return
* @param req \
* @return \
*/
public PageVo<TagVO> list(String areaCode, TagPageReq req) {
RegionDTO regionDto = regionCacheHelper.getByCodeAndLevel(areaCode, RegionConst.RL_COUNTY);
String regionCode = Objects.nonNull(regionDto) ? regionDto.getRegionCode() : null;
public PageVo<TagVO> list(TagPageReq req) {
LambdaQueryWrapper<Tag> query = Wrappers.lambdaQuery(Tag.class)
.eq(Objects.nonNull(regionCode), Tag::getAreaCode, regionCode)
.like(StringUtils.isNotBlank(req.getName()), Tag::getName, req.getName())
.like(StrUtils.isNotBlank(req.getName()), Tag::getName, req.getName())
.orderByDesc(Tag::getUpdateOn);
checkAuth(query, LoginUserUtil.loginUserDetail());
Page<Tag> page = tagService.page(req.page(), query);
long total;
if ((total = page.getTotal()) == 0) {
if (page.getTotal() == 0) {
return PageVo.empty();
}
List<TagVO> records = CollUtils.convert(page.getRecords(),
t -> BeanUtil.copyProperties(t, TagVO.class));
return PageVo.of(records, total);
return PageVo.of(records, page.getTotal());
}

/**
@@ -110,7 +107,7 @@ public class TagManage {
Tag entity = BeanUtil.copyProperties(dto, Tag.class);
if (Objects.nonNull(dto.getId())) {
Tag old = tagService.getById(dto.getId());
VUtils.isTrue(Objects.isNull(old)).throwMessage("此id标签不存在!");
Assert.notNull(old, "此id标签不存在!");
entity.setId(old.getId());
} else {
entity.setId(null);
@@ -131,11 +128,11 @@ public class TagManage {
*/
private void deduplicationName(TagDTO dto) {
if (StringUtils.isNotBlank(dto.getName())) {
long count = tagService.count(Wrappers.lambdaQuery(Tag.class)
.eq(Tag::getAreaCode, dto.getAreaCode())
LambdaQueryWrapper<Tag> query = Wrappers.lambdaQuery(Tag.class)
.eq(Tag::getName, dto.getName())
.ne(Objects.nonNull(dto.getId()), Tag::getId, dto.getId()));
VUtils.isTrue(count > 0).throwMessage("保存失败!此区域标签名重复!");
.ne(Objects.nonNull(dto.getId()), Tag::getId, dto.getId());
long count = tagService.count(query);
Assert.isTrue(count == 0, "保存失败!此区域标签名重复!");
}
}

@@ -158,8 +155,6 @@ public class TagManage {
Long tagId = dto.getTagId();
Tag tag = tagService.getById(tagId);
VUtils.isTrue(Objects.isNull(tag)).throwMessage("标签不存在!");
VUtils.isTrue(!tag.getAreaCode().equals(project.getAreaCode()))
.throwMessage("项目和标签不是一个区域的!");
ProjectTag projectTag = new ProjectTag();
projectTag.setProjectCode(projectCode);
projectTag.setTagId(tagId);
@@ -182,16 +177,11 @@ public class TagManage {
Long tagId = dto.getTagId();
Tag tag = tagService.getById(tagId);
VUtils.isTrue(Objects.isNull(tag)).throwMessage("标签不存在!");

VUtils.isTrue(!tag.getAreaCode().equals(project.getAreaCode()))
.throwMessage("项目和标签不是一个区域的!");

ProjectTag pt = projectTagService.getOne(Wrappers.lambdaQuery(ProjectTag.class)
.eq(ProjectTag::getProjectCode, projectCode)
.eq(ProjectTag::getTagId, tagId));

VUtils.isTrue(Objects.isNull(pt))
.throwMessage("该项目没有绑定此标签!");
Assert.notNull(pt, "该项目没有绑定此标签!");
projectTagService.removeById(pt.getId());

return "删除成功";


+ 1
- 9
hz-pm-api/src/main/java/com/hz/pm/api/portrait/model/dto/TagDTO.java View File

@@ -4,9 +4,6 @@ import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.constraints.NotNull;
import java.io.Serializable;

/**
* <p>
* 标签
@@ -17,9 +14,7 @@ import java.io.Serializable;
*/
@Data
@ApiModel(value = "Tag对象", description = "标签")
public class TagDTO implements Serializable {

private static final long serialVersionUID = 1L;
public class TagDTO {

@ApiModelProperty("主键")
private Long id;
@@ -30,7 +25,4 @@ public class TagDTO implements Serializable {
@ApiModelProperty("备注")
private String remark;

@ApiModelProperty("区域CODE")
@NotNull(message = "区域CODE必填")
private String areaCode;
}

+ 3
- 5
hz-pm-api/src/main/java/com/hz/pm/api/portrait/model/vo/TagVO.java View File

@@ -17,9 +17,7 @@ import java.time.LocalDateTime;
*/
@Data
@ApiModel(value = "Tag对象", description = "标签")
public class TagVO implements Serializable {

private static final long serialVersionUID = 1L;
public class TagVO {

@ApiModelProperty("主键")
private Long id;
@@ -33,8 +31,8 @@ public class TagVO implements Serializable {
@ApiModelProperty("区域CODE")
private String areaCode;

private LocalDateTime createOn;
private LocalDateTime updateOn;
private String createBy;
private String updateBy;

}

+ 5
- 4
hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/DeclaredProjectManage.java View File

@@ -145,7 +145,7 @@ public class DeclaredProjectManage {
.last(BizConst.LIMIT_1));

if (Objects.isNull(model)) {
throw new BusinessException("找不到单位流程配置");
throw BizException.wrap("找不到单位流程配置");
}

ProcessStartParamsVo params = new ProcessStartParamsVo();
@@ -363,13 +363,14 @@ public class DeclaredProjectManage {
//当非预审申报的时候 是自己单位 当是预审申报的时候 要主管单位 并且他是单位管理员
private void preQuery(LambdaQueryWrapper<Project> query, UserFullInfoDTO user) {
//如果当前登录是单位管理员
String mhUnitId = user.getMhUnitIdStr();
if (user.getIsOrgAdmin()) {
query.and(s1 -> s1.eq(Project::getStatus, ProjectStatusEnum.PREQUALIFICATION_FAILED.getCode())
.eq(Project::getSuperOrgCode, user.getMhUnitId())
.or(q2 -> q2.eq(Project::getBuildOrgCode, user.getMhUnitId())));
.eq(Project::getSuperOrgCode, mhUnitId)
.or(q2 -> q2.eq(Project::getBuildOrgCode, mhUnitId)));
} else {
//否则 只能看到 非预审 并且
query.and(q2 -> q2.eq(Project::getBuildOrgCode, user.getMhUnitId()));
query.and(q2 -> q2.eq(Project::getBuildOrgCode, mhUnitId));
}
}



+ 8
- 2
hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/ReviewChecklistManage.java View File

@@ -98,8 +98,14 @@ public class ReviewChecklistManage {
} else {
reviewHumans = new ArrayList<>();
}
List<UserFullInfoDTO> users = userInfoHelper.listUserFullInfoByUserIds(reviewHumans);
Map<Long, String> userMap = CollUtils.listToMap(users, UserFullInfoDTO::getUserId, UserFullInfoDTO::getUsername);
Map<Long, String> userMap;
if (!reviewHumans.isEmpty()) {
List<UserFullInfoDTO> users = userInfoHelper.listUserFullInfoByUserIds(reviewHumans);
userMap = CollUtils.listToMap(users, UserFullInfoDTO::getUserId, UserFullInfoDTO::getUsername);
} else {
userMap = Collections.emptyMap();
}

List<ProjectReviewCheckListItemVO> records = CollUtils.convert(page.getRecords(), w -> {
ProjectReviewCheckListItemVO item = new ProjectReviewCheckListItemVO();
item.setId(w.getId());


+ 1
- 2
hz-pm-api/src/main/java/com/hz/pm/api/projectlib/controller/ProjectRenewalFundDeclarationController.java View File

@@ -48,8 +48,7 @@ public class ProjectRenewalFundDeclarationController {
@GetMapping("/project-list")
@ApiOperation("项目续建资金库能关联的项目列表")
public PageVo<ProjectLibListItemVO> projectlist(ProjectRenewalListReq req) {
UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId());
return projectRenewalFundManage.projectList(req,user);
return projectRenewalFundManage.projectList(req);
}

@GetMapping("/{id}")


+ 11
- 28
hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/ProcessExecuteChainHandle.java View File

@@ -5,13 +5,13 @@ 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.contant.RegionContant;
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.wflow.bean.entity.WflowModels;
import com.wflow.workflow.bean.vo.ProcessDetailVO;
import com.wflow.workflow.service.ProcessModelService;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@@ -27,27 +27,21 @@ import java.util.Objects;
* @since 2023/02/26 21:36
*/
@Component
@RequiredArgsConstructor
public class ProcessExecuteChainHandle {

@Autowired
private IProjectService projectService;

@Autowired
private ProcessModelService processModelService;
private final IProjectService projectService;
private final ProcessModelService processModelService;

/**
* 具体处理者的集合
*/
private List<AbstractProcessBusinessHandle> processBusinessHandles;

public ProcessExecuteChainHandle(List<AbstractProcessBusinessHandle> processBusinessHandles) {
this.processBusinessHandles = processBusinessHandles;
}
private final List<AbstractProcessBusinessHandle> processBusinessHandles;

/**
* 遍历处理链,通过前缀判断能否处理逻辑,如果不能继续遍历
*
* @param projectId
* @param projectId \
* @return void
* @author CMM
* @since 2023/02/26
@@ -57,30 +51,19 @@ public class ProcessExecuteChainHandle {

List<AbstractProcessBusinessHandle> handles = Lists.newArrayList();
for (AbstractProcessBusinessHandle processBusinessHandle : processBusinessHandles) {
if (Objects.nonNull(project) && RegionContant.LS_LQ_CODE.equals(project.getAreaCode())) {
if (processBusinessHandle instanceof AnnualPlanHandle) {
processBusinessHandle.setOrder(7);
} else if (processBusinessHandle instanceof ConstructionPlanReviewHandle) {
processBusinessHandle.setOrder(6);
}
} else {
if (processBusinessHandle instanceof AnnualPlanHandle) {
processBusinessHandle.setOrder(6);
} else if (processBusinessHandle instanceof ConstructionPlanReviewHandle) {
processBusinessHandle.setOrder(7);
}
if (processBusinessHandle instanceof AnnualPlanHandle) {
processBusinessHandle.setOrder(6);
} else if (processBusinessHandle instanceof ConstructionPlanReviewHandle) {
processBusinessHandle.setOrder(7);
}

//建设方案
if (processBusinessHandle instanceof ConstructionPlanReviewHandle) {
WflowModels model = processModelService.getOne(Wrappers.lambdaQuery(WflowModels.class)
.eq(WflowModels::getRegionCode, project.getAreaCode())
.eq(WflowModels::getProcessType, ProjectProcessStageEnum.CONSTRUCTION_PROJECT_APPROVAL_PROCESS.getCode())
.last(BizConst.LIMIT_1));
if (Objects.nonNull(model)) {
if (!model.getIsStop()) {
if (Objects.nonNull(model) && (Boolean.FALSE.equals(model.getIsStop()))) {
handles.add(processBusinessHandle);
}
}
} else if (processBusinessHandle instanceof ProvinceUnitedReviewHandle) {
//省级联审


+ 17
- 13
hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/ProjectRenewalFundManage.java View File

@@ -3,11 +3,14 @@ package com.hz.pm.api.projectlib.manage;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.excel.EasyExcel;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.hz.pm.api.user.security.model.UserInfoDetails;
import com.hz.pm.api.user.util.LoginUserUtil;
import com.ningdatech.basic.exception.BizException;
import com.ningdatech.basic.function.VUtils;
import com.ningdatech.basic.model.PageVo;
@@ -114,7 +117,8 @@ public class ProjectRenewalFundManage {
return PageVo.of(records, total);
}

public PageVo<ProjectLibListItemVO> projectList(ProjectRenewalListReq req, UserFullInfoDTO user) {
public PageVo<ProjectLibListItemVO> projectList(ProjectRenewalListReq req) {
UserInfoDetails user = LoginUserUtil.loginUserDetail();
LambdaQueryWrapper<Project> query = ProjectRenewFundHelper.projectQuery(req);
//项目查最新
query.eq(Project::getNewest, Boolean.TRUE);
@@ -126,19 +130,20 @@ public class ProjectRenewalFundManage {
if (CollUtil.isEmpty(page.getRecords())) {
return PageVo.empty();
}
UserFullInfoDTO finalUser = user;

Set<String> projectCodes = page.getRecords().stream()
.map(Project::getProjectCode).collect(Collectors.toSet());
List<String> projectCodes = CollUtils.fieldList(page.getRecords(), Project::getProjectCode);

Map<Long, List<ProjectRenewalFundDeclaration>> renewalMap = Maps.newHashMap();
Map<Long, List<ProjectRenewalFundDeclaration>> renewalMap;
if (CollUtil.isNotEmpty(projectCodes)) {
List<ProjectRenewalFundDeclaration> renewalDeclarations = projectRenewalFundDeclarationService.list(Wrappers.lambdaQuery(ProjectRenewalFundDeclaration.class)
Wrapper<ProjectRenewalFundDeclaration> prfQuery = Wrappers.lambdaQuery(ProjectRenewalFundDeclaration.class)
.in(ProjectRenewalFundDeclaration::getProjectCode, projectCodes)
.eq(ProjectRenewalFundDeclaration::getApprovalStatus, ProjectRenewalApprovalStatusEnum.PASS.name())
.eq(ProjectRenewalFundDeclaration::getDeleted, Boolean.FALSE)
.orderByAsc(ProjectRenewalFundDeclaration::getProjectYear));
renewalMap = renewalDeclarations.stream().collect(Collectors.groupingBy(ProjectRenewalFundDeclaration::getProjectId));
.orderByAsc(ProjectRenewalFundDeclaration::getProjectYear);
List<ProjectRenewalFundDeclaration> renewalDeclarations = projectRenewalFundDeclarationService.list(prfQuery);
renewalMap = CollUtils.group(renewalDeclarations, ProjectRenewalFundDeclaration::getProjectId);
} else {
renewalMap = Collections.emptyMap();
}

Map<Long, List<ProjectRenewalFundDeclaration>> finalRenewalMap = renewalMap;
@@ -160,10 +165,10 @@ public class ProjectRenewalFundManage {
item.setProcessStatus(w.getProcessStatus());
item.setInstCode(w.getInstCode());
item.setIsHigherSuperOrg(w.getIsHigherSuperOrg());
if (finalUser.getIsOrgAdmin() &&
ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode().equals(item.getStatus())
if (user.getIsOrgAdmin() &&
ProjectStatusEnum.PENDING_PREQUALIFICATION.eq(item.getStatus())
&& StringUtils.isNotBlank(w.getSuperOrgCode())
&& w.getSuperOrgCode().equals(finalUser.getMhUnitIdStr())) {
&& w.getSuperOrgCode().equals(user.getMhUnitIdStr())) {
item.setCanPreDeclared(Boolean.TRUE);
}
item.setApprovedAmount(w.getApprovalAmount());
@@ -249,7 +254,6 @@ public class ProjectRenewalFundManage {
}
vo.setProjectName(baseinfo.getBaseProjName());
vo.setProjectType(baseinfo.getBaseProjType());
// vo.setStage(project.getStage());
vo.setStatus(StringUtils.isNotBlank(baseinfo.getBaseProjSetProg()) ?
Integer.parseInt(baseinfo.getBaseProjSetProg()) : null);
vo.setBuildOrgName(baseinfo.getBaseBuildDeprt());
@@ -294,7 +298,7 @@ public class ProjectRenewalFundManage {
annualAmounts.add(AnnualAmountVO.builder()
.projectId(operationBaseinfo.getId())
.projectCode(operationBaseinfo.getBaseProjId())
.projectYear(StringUtils.isNotBlank(apply.getBaseProjSetYear()) ? Integer.parseInt(apply.getBaseProjSetYear()) : null)
.projectYear(StrUtil.isNotBlank(apply.getBaseProjSetYear()) ? Integer.parseInt(apply.getBaseProjSetYear()) : null)
.annualAmount(apply.getBaseProjDeclAmount())
.build());
List<ProjectRenewalFundDeclaration> renewalDeclarations = projectRenewalFundDeclarationService.list(Wrappers.lambdaQuery(ProjectRenewalFundDeclaration.class)


+ 0
- 3
hz-pm-api/src/main/java/com/hz/pm/api/scheduler/task/CockpitStatsStatisticsTask.java View File

@@ -11,7 +11,6 @@ import com.google.common.collect.Lists;
import com.hz.pm.api.common.helper.RegionCacheHelper;
import com.hz.pm.api.common.model.constant.BizConst;
import com.hz.pm.api.common.model.constant.RegionConst;
import com.hz.pm.api.common.statemachine.contant.RegionContant;
import com.hz.pm.api.common.util.BizUtils;
import com.hz.pm.api.dashboard.constant.DashboardConstant;
import com.hz.pm.api.dashboard.model.entity.CockpitStats;
@@ -202,8 +201,6 @@ public class CockpitStatsStatisticsTask {
if (CollUtil.isNotEmpty(yearProjIds)) {
baseInfos = baseinfoService.list(Wrappers.lambdaQuery(GovBizProjectBaseinfo.class)
.eq(GovBizProjectBaseinfo::getDeleted, Boolean.FALSE)
.eq(StringUtils.isNotBlank(regionCode) && !DashboardConstant.CockpitStats.TOTAL.equals(regionCode),
GovBizProjectBaseinfo::getBaseAreaCode, regionCode + RegionContant.MORE_CODE)
.in(GovBizProjectBaseinfo::getBaseProjId, yearProjIds));
}



+ 4
- 3
hz-pm-api/src/main/java/com/hz/pm/api/sys/controller/FormController.java View File

@@ -1,5 +1,6 @@
package com.hz.pm.api.sys.controller;

import com.hz.pm.api.common.model.constant.RegionConst;
import com.ningdatech.log.annotation.WebLog;
import com.wflow.bean.dto.WflowFormsDto;
import com.wflow.bean.vo.WflowFormVo;
@@ -28,9 +29,9 @@ public class FormController {
private final WflowFormsService formService;

@ApiOperation(value = "获取系统表单", notes = "获取系统表单")
@GetMapping("/{regionCode}")
public WflowFormVo detail(@PathVariable(value = "regionCode") String regionCode) {
return formService.getFormByRegionCode(regionCode);
@GetMapping
public WflowFormVo detail() {
return formService.getFormByRegionCode(RegionConst.RC_HZ);
}

@ApiOperation(value = "编辑系统表单", notes = "编辑系统表单")


+ 5
- 3
hz-pm-api/src/main/java/com/hz/pm/api/sys/controller/SysProcDefController.java View File

@@ -1,5 +1,7 @@
package com.hz.pm.api.sys.controller;

import com.hz.pm.api.common.model.constant.BizConst;
import com.hz.pm.api.common.model.constant.RegionConst;
import com.ningdatech.basic.model.PageVo;
import com.ningdatech.log.annotation.WebLog;
import com.wflow.bean.dto.WflowModelHistorysDto;
@@ -33,9 +35,9 @@ public class SysProcDefController {

@ApiOperation(value = "系统流程配置列表", notes = "系统流程配置列表")
@GetMapping("/list")
public PageVo<WflowModelVo> list(@RequestParam String regionCode, @RequestParam(defaultValue = "1") Integer pageNumber,
public PageVo<WflowModelVo> list(@RequestParam(defaultValue = "1") Integer pageNumber,
@RequestParam(defaultValue = "10") Integer pageSize) {
return modelGroupService.getModelsPage(regionCode,pageNumber,pageSize);
return modelGroupService.getModelsPage(RegionConst.RC_HZ, pageNumber, pageSize);
}

@ApiOperation(value = "系统流程配置详情", notes = "系统流程配置详情")
@@ -56,7 +58,7 @@ public class SysProcDefController {
public String enOrDisModel(@PathVariable String formId,
@PathVariable Boolean state) {
modelGroupService.enOrDisModel(formId, !state);
return Boolean.TRUE.equals(state) ? "启用流程成功":"停用流程成功";
return Boolean.TRUE.equals(state) ? "启用流程成功" : "停用流程成功";
}

@ApiOperation(value = "系统流程配置发布", notes = "系统流程配置发布")


+ 2
- 2
hz-pm-api/src/main/java/com/hz/pm/api/sys/model/vo/WflowEarlyWarningRecordsVO.java View File

@@ -74,7 +74,7 @@ public class WflowEarlyWarningRecordsVO implements Serializable {
* 预警员工号
*/
@ApiModelProperty(value = "预警员工号")
private String warningEmployeecode;
private String warningUserId;

/**
* 通知方式
@@ -112,7 +112,7 @@ public class WflowEarlyWarningRecordsVO implements Serializable {
@ApiModelProperty(value = "路径")
private String path;
@ApiModelProperty(value = "这一批要通知的员工号")
private String batchEmployees;
private String batchUserIds;

private LocalDateTime createOn;
private String createBy;


+ 19
- 0
hz-pm-api/src/main/java/com/hz/pm/api/user/controller/MhUnitController.java View File

@@ -2,6 +2,12 @@ package com.hz.pm.api.user.controller;

import com.hz.pm.api.user.manage.MhUnitManage;
import com.hz.pm.api.user.model.dto.MhUnitTreeDTO;
import com.hz.pm.api.user.model.dto.MhUnitUserTreeDTO;
import com.hz.pm.api.user.model.po.MhUnitListReq;
import com.hz.pm.api.user.model.po.UserTreeReq;
import com.hz.pm.api.user.model.vo.MhUnitListVO;
import com.ningdatech.basic.model.PageVo;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
@@ -25,8 +31,21 @@ public class MhUnitController {
private final MhUnitManage mhUnitManage;

@GetMapping("/tree")
@ApiOperation("单位树")
public List<MhUnitTreeDTO> getMhUnitTree() {
return mhUnitManage.getMhUnitTree();
}

@GetMapping("/page")
@ApiOperation("单位列表")
public PageVo<MhUnitListVO> page(MhUnitListReq req) {
return mhUnitManage.page(req);
}

@GetMapping("/user/tree")
@ApiOperation("用户组织树")
public List<MhUnitUserTreeDTO> getUserTree(UserTreeReq req) {
return mhUnitManage.getUserTree(req);
}

}

+ 94
- 0
hz-pm-api/src/main/java/com/hz/pm/api/user/manage/MhUnitManage.java View File

@@ -3,15 +3,28 @@ package com.hz.pm.api.user.manage;
import cn.hutool.core.bean.BeanUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hz.pm.api.common.util.StrUtils;
import com.hz.pm.api.user.helper.MhUnitCache;
import com.hz.pm.api.user.model.dto.MhUnitDTO;
import com.hz.pm.api.user.model.dto.MhUnitTreeDTO;
import com.hz.pm.api.user.model.dto.MhUnitUserTreeDTO;
import com.hz.pm.api.user.model.entity.MhUnit;
import com.hz.pm.api.user.model.entity.UserInfo;
import com.hz.pm.api.user.model.enumeration.UnitUserNodeType;
import com.hz.pm.api.user.model.po.MhUnitListReq;
import com.hz.pm.api.user.model.po.UserTreeReq;
import com.hz.pm.api.user.model.vo.MhUnitListVO;
import com.hz.pm.api.user.service.IMhUnitService;
import com.hz.pm.api.user.service.IUserInfoService;
import com.ningdatech.basic.model.PageVo;
import com.ningdatech.basic.util.CollUtils;
import com.ningdatech.basic.util.TreeUtil;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Component;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

/**
@@ -28,6 +41,7 @@ public class MhUnitManage {

private final IMhUnitService mhUnitService;
private final MhUnitCache mhUnitCache;
private final IUserInfoService userInfoService;

public List<MhUnitTreeDTO> getMhUnitTree() {
List<MhUnitDTO> allUnits = mhUnitCache.all();
@@ -35,4 +49,84 @@ public class MhUnitManage {
return TreeUtil.convertToTree(nodes, 0L);
}

public PageVo<MhUnitListVO> page(MhUnitListReq req) {
LambdaQueryWrapper<MhUnit> query = Wrappers.lambdaQuery(MhUnit.class)
.like(StrUtils.isNotBlank(req.getName()), MhUnit::getName, req.getName());
Page<MhUnit> page = mhUnitService.page(req.page(), query);
if (page.getTotal() == 0) {
return PageVo.empty();
}
List<MhUnitListVO> records = BeanUtil.copyToList(page.getRecords(), MhUnitListVO.class);
return PageVo.of(records, page.getTotal());
}

public List<MhUnitUserTreeDTO> getUserTree(UserTreeReq req) {
List<Long> selectedUnitIds = new ArrayList<>();
List<MhUnitUserTreeDTO> selectedUsers = new ArrayList<>();
List<MhUnitUserTreeDTO> selectedUnits = new ArrayList<>();
if (req.getId() != null) {
// 查询单位
LambdaQueryWrapper<MhUnit> unitQuery = Wrappers.lambdaQuery(MhUnit.class)
.select(MhUnit::getId)
.like(StrUtils.isNotBlank(req.getName()), MhUnit::getName, req.getName())
.eq(MhUnit::getParentId, req.getId());
List<MhUnit> units = mhUnitService.list(unitQuery);
selectedUnitIds.addAll(CollUtils.fieldList(units, MhUnit::getId));
// 查询用户
LambdaQueryWrapper<UserInfo> userQuery = Wrappers.lambdaQuery(UserInfo.class)
.select(UserInfo::getMhUnitId, UserInfo::getId, UserInfo::getRealName)
.like(StrUtils.isNotBlank(req.getName()), UserInfo::getRealName, req.getName())
.eq(UserInfo::getMhUnitId, req.getId())
.last("limit 100");
List<UserInfo> userInfos = userInfoService.list(userQuery);
selectedUnitIds.addAll(CollUtils.fieldList(userInfos, UserInfo::getMhUnitId));
userInfos.forEach(w -> selectedUsers.add(getMhUnitUserTree(w)));
if (selectedUnitIds.isEmpty()) {
return Collections.emptyList();
}
String rootId = UnitUserNodeType.UNIT + "#" + req.getId();
selectedUnitIds.forEach(w -> {
MhUnitDTO unit = mhUnitCache.getById(w);
if (unit != null) {
selectedUnits.add(getMhUnitUserTree(unit));
}
});
selectedUnits.addAll(selectedUsers);
return TreeUtil.convertToTree(selectedUnits, rootId);
} else {
// 如果没有查询指定组织,那么直接查询第一级组织
List<MhUnitDTO> childrenUnits = mhUnitCache.getChildren(0L);
if (childrenUnits.isEmpty()) {
return Collections.emptyList();
}
for (MhUnitDTO unit : childrenUnits) {
selectedUnits.add(getMhUnitUserTree(unit));
}
selectedUnits.sort(selectedUnits.get(0).comparator());
return selectedUnits;
}
}

private MhUnitUserTreeDTO getMhUnitUserTree(MhUnitDTO unit) {
MhUnitUserTreeDTO node = new MhUnitUserTreeDTO();
node.setSort(unit.getSort());
node.setName(unit.getName());
node.setBizId(unit.getId());
node.setParentId(UnitUserNodeType.UNIT.name() + "#" + unit.getParentId());
node.setId(UnitUserNodeType.UNIT.name() + "#" + unit.getId());
node.setType(UnitUserNodeType.UNIT);
return node;
}

private MhUnitUserTreeDTO getMhUnitUserTree(UserInfo w) {
MhUnitUserTreeDTO node = new MhUnitUserTreeDTO();
node.setSort((short) 1);
node.setName(w.getRealName());
node.setBizId(w.getId());
node.setParentId(UnitUserNodeType.UNIT.name() + "#" + w.getMhUnitId());
node.setId(UnitUserNodeType.USER.name() + "#" + w.getId());
node.setType(UnitUserNodeType.USER);
return node;
}

}

+ 8
- 18
hz-pm-api/src/main/java/com/hz/pm/api/user/manage/UserInfoManage.java View File

@@ -5,13 +5,11 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hz.pm.api.common.helper.RegionCacheHelper;
import com.hz.pm.api.common.helper.UserInfoHelper;
import com.hz.pm.api.common.util.BizUtils;
import com.hz.pm.api.common.util.StrUtils;
import com.hz.pm.api.organization.model.entity.DingEmployeeInfo;
import com.hz.pm.api.organization.service.IDingEmployeeInfoService;
import com.hz.pm.api.organization.service.IDingOrganizationService;
import com.hz.pm.api.sys.model.entity.Role;
import com.hz.pm.api.sys.model.entity.UserRole;
import com.hz.pm.api.sys.service.IRoleService;
@@ -19,8 +17,8 @@ import com.hz.pm.api.sys.service.IUserRoleService;
import com.hz.pm.api.user.model.entity.UserInfo;
import com.hz.pm.api.user.model.enumeration.UserAvailableEnum;
import com.hz.pm.api.user.model.po.ReqUserDetailEditPO;
import com.hz.pm.api.user.model.po.UserDetailReq;
import com.hz.pm.api.user.model.po.ReqUserDisableOrEnablePO;
import com.hz.pm.api.user.model.po.UserDetailReq;
import com.hz.pm.api.user.model.po.UserInfoListReq;
import com.hz.pm.api.user.model.vo.ResUserDetailVO;
import com.hz.pm.api.user.model.vo.UserInfoListVO;
@@ -31,8 +29,6 @@ import com.hz.pm.api.user.util.LoginUserUtil;
import com.ningdatech.basic.exception.BizException;
import com.ningdatech.basic.model.PageVo;
import com.ningdatech.basic.util.CollUtils;
import com.ningdatech.zwdd.ZwddIntegrationProperties;
import com.ningdatech.zwdd.client.ZwddClient;
import com.wflow.workflow.bean.dto.ProcessInstanceUserDto;
import lombok.RequiredArgsConstructor;
import org.springframework.aop.framework.AopContext;
@@ -54,29 +50,21 @@ public class UserInfoManage {
private final UserAuthManage userAuthManage;
private final IUserInfoService userInfoService;
private final IRoleService roleService;
private final IDingOrganizationService dingOrganizationService;
private final IDingEmployeeInfoService dingEmployeeInfoService;
private final IUserRoleService userRoleService;
private final UserInfoHelper userInfoHelper;
private final RegionCacheHelper regionCacheHelper;
private final ZwddIntegrationProperties zwddIntegrationProperties;
private final ZwddClient zwddClient;

public PageVo<UserInfoListVO> list(UserInfoListReq req) {
String phoneNo = req.getPhoneNo();
String name = req.getName();
String mhUnitName = req.getMhUnitName();

List<Long> userIdList = getRoleCompliantUserIdList(req.getUserRoleList());
if (userIdList != null && userIdList.isEmpty()) {
return PageVo.empty();
}

LambdaQueryWrapper<UserInfo> wrapper = Wrappers.lambdaQuery(UserInfo.class)
.like(StrUtils.isNotBlank(phoneNo), UserInfo::getMobile, phoneNo)
.like(StrUtils.isNotBlank(name), UserInfo::getRealName, name)
.eq(StrUtils.isNotBlank(req.getPhoneNo()), UserInfo::getMobile, req.getPhoneNo())
.like(StrUtils.isNotBlank(req.getName()), UserInfo::getRealName, req.getName())
.in(Objects.nonNull(userIdList), UserInfo::getId, userIdList)
.like(StrUtils.isNotBlank(mhUnitName), UserInfo::getMhUnitName, mhUnitName)
.like(StrUtils.isNotBlank(req.getMhUnitName()), UserInfo::getMhUnitName, req.getMhUnitName())
.eq(Objects.nonNull(req.getMhUnitId()), UserInfo::getMhUnitId, req.getMhUnitId())
.orderByDesc(UserInfo::getUpdateOn);

Page<UserInfo> page = userInfoService.page(req.page(), wrapper);
@@ -114,6 +102,8 @@ public class UserInfoManage {
return null;
}
List<Long> roleIds = CollUtils.fieldList(userRoles, UserRoleVO::getId);
LambdaQueryWrapper<UserRole> urQuery = Wrappers.lambdaQuery(UserRole.class)
.select(UserRole::getUserId).in(UserRole::getRoleId,roleIds);
return userRoleService.listUserIdByRoleIds(roleIds);
}

@@ -332,7 +322,7 @@ public class UserInfoManage {
// 装配用户角色信息列表
List<UserRole> userRoleList = userRoleService.listByUserId(userId);
if (CollUtil.isNotEmpty(userRoleList)) {
List<Long> roleIdList = CollUtils.fieldList(userRoleList,UserRole::getRoleId);
List<Long> roleIdList = CollUtils.fieldList(userRoleList, UserRole::getRoleId);
List<Role> roleList = roleService.listByIds(roleIdList);
List<UserRoleVO> userRoles = roleList.stream().map(r -> {
UserRoleVO userRole = new UserRoleVO();


+ 41
- 0
hz-pm-api/src/main/java/com/hz/pm/api/user/model/dto/MhUnitUserTreeDTO.java View File

@@ -0,0 +1,41 @@
package com.hz.pm.api.user.model.dto;

import com.hz.pm.api.user.model.enumeration.UnitUserNodeType;
import com.ningdatech.basic.model.ITree;
import lombok.Data;

import java.util.Comparator;
import java.util.List;

/**
* <p>
* MhUnitTreeDTO
* </p>
*
* @author WendyYang
* @since 15:29 2024/1/10
*/
@Data
public class MhUnitUserTreeDTO implements ITree<String, MhUnitUserTreeDTO> {

private String id;

private String parentId;

private String name;

private Long bizId;

private UnitUserNodeType type;

private Short sort;

private List<MhUnitUserTreeDTO> children;

@Override
public Comparator<? super MhUnitUserTreeDTO> comparator() {
return Comparator.comparing(MhUnitUserTreeDTO::getType, Comparator.reverseOrder())
.thenComparing(MhUnitUserTreeDTO::getSort);
}

}

+ 16
- 0
hz-pm-api/src/main/java/com/hz/pm/api/user/model/enumeration/UnitUserNodeType.java View File

@@ -0,0 +1,16 @@
package com.hz.pm.api.user.model.enumeration;

/**
* <p>
* UnitUserNodeType
* </p>
*
* @author WendyYang
* @since 09:55 2024/1/16
*/
public enum UnitUserNodeType {

USER,
UNIT

}

+ 23
- 0
hz-pm-api/src/main/java/com/hz/pm/api/user/model/po/MhUnitListReq.java View File

@@ -0,0 +1,23 @@
package com.hz.pm.api.user.model.po;

import com.ningdatech.basic.model.PagePo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;

/**
* <p>
* MhUnitListReq
* </p>
*
* @author WendyYang
* @since 10:21 2024/1/15
*/
@Data
@EqualsAndHashCode(callSuper = true)
public class MhUnitListReq extends PagePo {

@ApiModelProperty("单位名称")
private String name;

}

+ 20
- 0
hz-pm-api/src/main/java/com/hz/pm/api/user/model/po/UserTreeReq.java View File

@@ -0,0 +1,20 @@
package com.hz.pm.api.user.model.po;

import lombok.Data;

/**
* <p>
* UserTreeReq
* </p>
*
* @author WendyYang
* @since 09:46 2024/1/16
*/
@Data
public class UserTreeReq {

private String name;

private Long id;

}

+ 29
- 0
hz-pm-api/src/main/java/com/hz/pm/api/user/model/vo/MhUnitListVO.java View File

@@ -0,0 +1,29 @@
package com.hz.pm.api.user.model.vo;

import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

/**
* <p>
* MhUnitListVO
* </p>
*
* @author WendyYang
* @since 10:20 2024/1/15
*/
@Data
public class MhUnitListVO {

@ApiModelProperty("单位ID")
private Long id;

@ApiModelProperty("单位名称")
private String name;

@ApiModelProperty("上级单位ID")
private Long parentId;

@ApiModelProperty("排序号")
private Short sort;

}

+ 14
- 0
hz-pm-api/src/test/java/com/hz/pm/api/sys/service/IMenuServiceTest.java View File

@@ -6,11 +6,13 @@ import cn.hutool.db.Db;
import cn.hutool.db.Entity;
import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.hz.pm.api.AppTests;
import com.hz.pm.api.sys.model.entity.Menu;
import com.hz.pm.api.sys.model.entity.Role;
import com.hz.pm.api.sys.model.entity.RoleMenu;
import com.hz.pm.api.sys.model.entity.UserRole;
import com.hz.pm.api.user.model.enumeration.RoleEnum;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
@@ -110,4 +112,16 @@ class IMenuServiceTest extends AppTests {
});
}

@Test
public void test1(){
List<Integer> roleIds = Arrays.asList(1, 2);
LambdaQueryWrapper<UserRole> urQuery = Wrappers.lambdaQuery(UserRole.class)
.select(UserRole::getUserId).in(UserRole::getRoleId,roleIds);
System.out.println(urQuery.toString());
System.out.println(urQuery.getSqlSelect());
System.out.println(urQuery.getTargetSql());
System.out.println(urQuery.getSqlComment());
System.out.println(urQuery.getSqlSet());
}

}

+ 18
- 15
hz-pm-api/src/test/resources/application-dev.yml View File

@@ -43,7 +43,7 @@ spring:
datasource:
type: com.zaxxer.hikari.HikariDataSource
driverClassName: dm.jdbc.driver.DmDriver
url: jdbc:dm://47.98.125.47:5236/HZ_PROJECT_MANAGEMENT?zeroDateTimeBehavior=convertToNull&useUnicode=true&characterEncoding=utf-8
url: jdbc:dm://47.98.125.47:5236/HZ_PROJECT_MANAGEMENT1?zeroDateTimeBehavior=convertToNull&useUnicode=true&characterEncoding=utf-8
username: SYSDBA
password: SYSDBA
# 数据源
@@ -159,7 +159,7 @@ organization:
- GO_ff70e47bae684fdba0d64f4acab85661

yxt:
# wsdl-url: http://115.239.137.23:9501/ws/v1?wsdl
# wsdl-url: http://115.239.137.23:9501/ws/v1?wsdl
wsdl-url: classpath:/wsdl.xml
#账号
user-code: hzndkj
@@ -171,7 +171,7 @@ yxt:

#省局联审 请求信息
provincial:
# host: http://zj.ningdatech.com/prometheus-zhejiang_foreign
# host: http://zj.ningdatech.com/prometheus-zhejiang_foreign
host: http://223.4.72.75/prometheus-zhejiang_foreign
pushUrl: /api/v1/foreign/importantPro
detailUrl: /api/v1/foreign/importantProView
@@ -238,22 +238,25 @@ project:
login:
phone-verify-code:
skip: true
url: http://lspm.ningdatech.com/login
web:
url: http://lspm.ningdatech.com
# 专家报名验证码校验
expert-registration:
verify-code:
check: false
sync-mh-expert:
open: false
sync-mh-unit:
open: false
sync-mh-user:
open: false
sync-mh-company:
open: false
mh:
# sso:
# client-id: ningda-74a5e5da-3bc3-414a-b9e6-004b7d87e310
# client-secret: ningda-df746ce4-0c79-4242-b3c7-90ff8630c9742c6727cd-3ae7-48ae-87ad-2b39188ebabd
api-host: http://10.54.38.13:8081/mh-gateway/auth-single
expert-qr-code-url: https://jiema.wwei.cn/uploads/2023/12/28/658d7a3f15f06.jpg
# sso:
# client-id: ningda-74a5e5da-3bc3-414a-b9e6-004b7d87e310
# client-secret: ningda-df746ce4-0c79-4242-b3c7-90ff8630c9742c6727cd-3ae7-48ae-87ad-2b39188ebabd
# api-host: http://10.54.38.13:8081/mh-gateway/auth-single
expert-qr-code-url: https://jiema.wwei.cn/uploads/2023/12/28/658d7a3f15f06.jpg
file:
down-url: https://weixin.hzszxc.hzswb.cn:8443/mh-gateway/oss/oss/previewFileLogin
detail-url: https://weixin.hzszxc.hzswb.cn:8443/mh-gateway/oss/ossfile/getFileInfoList
auth-code:
secret-key: nqkmzqojg5j4eiypr3rb8s7nb4noa8b2
agent-login:
proxy:
secret-key: nqkwiqojg7g4eiypr3rb8s7nb4noa8b2

+ 3
- 1
hz-pm-api/src/test/resources/security/auth-dev.yml View File

@@ -3,7 +3,7 @@ security:
auth-require-url: /api/v1/user/auth/auth-require
invalid-session-url: /api/v1/user/auth/invalid-session
password-login-url: /api/v1/user/auth/login
agent-login-url: /api/v1/user/auth/agent-login
auth-code-login-url: /api/v1/user/auth/authCodeLogin
mh-login-url: /api/v1/user/auth/mh-login
logout-url: /api/v1/user/auth/logout
common-login-url: /api/v1/user/auth/common-login
@@ -19,6 +19,7 @@ security:
- /api/v1/user/auth/login/password
- /api/v1/user/auth/forget-password
- /api/v1/user/auth/common-login
- /api/v1/user/auth/common-login
- /doc.html
- /ok.html
- /open/api/**
@@ -40,6 +41,7 @@ security:
- /api/v1/wps-convert/**
- /api/v1/belong-org/business-strip/list
- /expert/ephemeral/*/registration
- /api/v1/mh/sync/**
ignore-csrf-urls:
- /api/v1/user/auth/**
- /v2/api-docs


Loading…
Cancel
Save