Selaa lähdekoodia

状态机条件分支判断修改

tags/24080901
CMM 1 vuosi sitten
vanhempi
commit
d20d78afe5
6 muutettua tiedostoa jossa 16 lisäystä ja 24 poistoa
  1. +3
    -3
      pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/builder/ProjectDeclareStateMachineBuilder.java
  2. +0
    -6
      pmapi/src/main/java/com/ningdatech/pmapi/projectlib/controller/ProjectLibController.java
  3. +0
    -13
      pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectLibManage.java
  4. +4
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/TodoCenterManage.java
  5. +3
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/todocenter/model/dto/res/ResToBeProcessedDTO.java
  6. +6
    -2
      pmapi/src/test/java/com/ningdatech/pmapi/statemachine/StateMachineTest.java

+ 3
- 3
pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/builder/ProjectDeclareStateMachineBuilder.java Näytä tiedosto

@@ -91,7 +91,7 @@ public class ProjectDeclareStateMachineBuilder {
.withChoice()
.source(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE)
.first(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS,projectDeclareGuardFactory.new PendingPreQualificationChoiceGuard(),projectDeclareAction.new ProjectDeclareChoiceAction())
.last(ProjectStatusEnum.PRE_APPLYING).and()
.last(ProjectStatusEnum.PRE_APPLYING,projectDeclareAction.new ProjectDeclareChoiceAction()).and()
// 待预审撤回,从待预审到单位内部审核中
.withExternal()
.source(ProjectStatusEnum.PENDING_PREQUALIFICATION)
@@ -127,11 +127,11 @@ public class ProjectDeclareStateMachineBuilder {
.source(ProjectStatusEnum.PRE_APPLYING)
.target(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE)
.event(ProjectStatusChangeEvent.PRE_APPLYING_WITHDRAW).and()
// 预审中撤回,从待预审选择->省级部门联审中,预审,完成其中一种状态
// 预审中撤回,从待预审选择->省级部门联审中,预审,完成其中一种状态
.withChoice()
.source(ProjectStatusEnum.PRE_APPLYING)
.first(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS,projectDeclareGuardFactory.new PendingPreQualificationChoiceGuard(),new ProjectDeclareChoiceAction())
.last(ProjectStatusEnum.PRE_APPLYING).and()
.last(ProjectStatusEnum.PENDING_PREQUALIFICATION,projectDeclareAction.new ProjectDeclareChoiceAction()).and()
// 部门联审通过,从部门联审中到年度计划中
.withExternal()
.source(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW)


+ 0
- 6
pmapi/src/main/java/com/ningdatech/pmapi/projectlib/controller/ProjectLibController.java Näytä tiedosto

@@ -40,10 +40,4 @@ public class ProjectLibController {
return projectLibManage.getProjectDetail(id);
}

@GetMapping("/getProjectInfo")
@ApiOperation("获取申报项目信息")
private Project getProjectInfo (@RequestParam String processInstanceId){
return projectLibManage.getProjectInfo(processInstanceId);
}

}

+ 0
- 13
pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectLibManage.java Näytä tiedosto

@@ -95,17 +95,4 @@ public class ProjectLibManage {
return vo;
}

/**
*
* @param instanceCode 申报项目流程实例编号
* @return com.ningdatech.pmapi.projectlib.model.entity.Project
* @author CMM
* @since 2023/02/11 11:15
*/
public Project getProjectInfo(String instanceCode) {
// 查询项目申报信息
Project projectInfo = projectService.getOne(Wrappers.lambdaQuery(Project.class)
.eq(Project::getInstCode, instanceCode));
return projectInfo;
}
}

+ 4
- 0
pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/TodoCenterManage.java Näytä tiedosto

@@ -161,6 +161,7 @@ public class TodoCenterManage {
List<ResToBeProcessedDTO> resVos = results.stream().map(d -> {
ResToBeProcessedDTO res = new ResToBeProcessedDTO();
BeanUtils.copyProperties(d, res);
res.setProjectId(d.getId());
res.setProcessStatusName(ProcessStatusEnum.getDescByCode(d.getProcessStatus()));
LocalDateTime processLaunchTime = d.getCreateOn();
String format = NdDateUtils.format(processLaunchTime, "yyyy-MM-dd HH:mm");
@@ -952,6 +953,7 @@ public class TodoCenterManage {

ResToBeProcessedDTO res = new ResToBeProcessedDTO();
BeanUtils.copyProperties(d, res);
res.setProjectId(d.getId());
res.setProcessStatusName(ProcessStatusEnum.getDescByCode(d.getProcessStatus()));
LocalDateTime processLaunchTime = d.getCreateOn();
String launchTimeFormat = NdDateUtils.format(processLaunchTime, "yyyy-MM-dd HH:mm");
@@ -1124,6 +1126,7 @@ public class TodoCenterManage {
results.stream().map(d -> {
ResToBeProcessedDTO res = new ResToBeProcessedDTO();
BeanUtils.copyProperties(d, res);
res.setProjectId(d.getId());
res.setProcessStatusName(ProcessStatusEnum.getDescByCode(d.getProcessStatus()));
LocalDateTime processLaunchTime = d.getCreateOn();
String launchTimeFormat = NdDateUtils.format(processLaunchTime, "yyyy-MM-dd HH:mm");
@@ -1330,6 +1333,7 @@ public class TodoCenterManage {
results.stream().map(d -> {
ResToBeProcessedDTO res = new ResToBeProcessedDTO();
BeanUtils.copyProperties(d, res);
res.setProjectId(d.getId());
res.setProcessStatusName(ProcessStatusEnum.getDescByCode(d.getProcessStatus()));
LocalDateTime processLaunchTime = d.getCreateOn();
String launchTimeFormat = NdDateUtils.format(processLaunchTime, "yyyy-MM-dd HH:mm");


+ 3
- 0
pmapi/src/main/java/com/ningdatech/pmapi/todocenter/model/dto/res/ResToBeProcessedDTO.java Näytä tiedosto

@@ -29,6 +29,9 @@ import org.springframework.format.annotation.DateTimeFormat;
public class ResToBeProcessedDTO implements Serializable {
private static final long serialVersionUID = 1L;

@ApiModelProperty("项目ID")
private Long projectId;

@ApiModelProperty("流程实例编号")
private String instanceCode;



+ 6
- 2
pmapi/src/test/java/com/ningdatech/pmapi/statemachine/StateMachineTest.java Näytä tiedosto

@@ -8,6 +8,8 @@ import com.ningdatech.pmapi.projectlib.model.entity.Project;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;

import java.math.BigDecimal;

/**
* 状态机测试
*
@@ -22,7 +24,9 @@ public class StateMachineTest extends AppTests {
@Test
public void stateMachineTest() throws Exception {
Project project = new Project();
project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT.getCode());
stateMachineUtils.execute(project, ProjectStatusChangeEvent.UNDER_INTERNAL_PASS);
project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode());
project.setDeclareAmount(BigDecimal.valueOf(2000));
// stateMachineUtils.execute(project, ProjectStatusChangeEvent.UNDER_INTERNAL_PASS);
stateMachineUtils.execute(project, stateMachineUtils.getProjectStatusPassEvent(project.getStatus()));
}
}

Loading…
Peruuta
Tallenna