Sfoglia il codice sorgente

Merge remote-tracking branch 'origin/master'

# Conflicts:
#	pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/util/StateMachineUtils.java
tags/24080901
CMM 1 anno fa
parent
commit
429a1f2cf9
5 ha cambiato i file con 35 aggiunte e 51 eliminazioni
  1. +25
    -27
      pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/util/StateMachineUtils.java
  2. +1
    -7
      pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/PrequalificationDeclaredProjectManage.java
  3. +2
    -2
      pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/AnnualPlanLibManage.java
  4. +6
    -14
      pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/TodoCenterManage.java
  5. +1
    -1
      pmapi/src/test/java/com/ningdatech/pmapi/statemachine/StateMachineTest.java

+ 25
- 27
pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/util/StateMachineUtils.java Vedi File

@@ -9,6 +9,7 @@ import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum;
import com.ningdatech.pmapi.projectlib.model.entity.ProjectStatusChange;
import com.ningdatech.pmapi.projectlib.model.entity.Project;
import com.ningdatech.pmapi.projectlib.service.INdProjectStatusChangeService;
import com.wflow.exception.BusinessException;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.messaging.Message;
@@ -41,37 +42,34 @@ public class StateMachineUtils {
@Resource(name = "projectDeclareStateMachinePersister")
private StateMachinePersister projectDeclareStateMachinePersister;

/**
* 审核通过
* @param project
* @return void
* @author CMM
* @since 2023/03/10 13:40
*/
public void pass(Project project) throws Exception {
execute(project,getProjectStatusPassEvent(project.getStatus()));
//通过审核
public void pass(Project project) {
try{
execute(project,getProjectStatusPassEvent(project.getStatus()));
}catch (Exception e){
log.info("状态机 通过失败 :{}",e.getMessage());
throw new BusinessException("状态机 通过失败: " + e);
}
}

/**
* 审核驳回
* @param project
* @return void
* @author CMM
* @since 2023/03/10 13:40
*/
public void reject(Project project) throws Exception {
execute(project,getProjectStatusRejectEvent(project.getStatus()));
//拒绝
public void reject(Project project) {
try{
execute(project,getProjectStatusRejectEvent(project.getStatus()));
}catch (Exception e){
log.info("状态机 拒绝失败 :{}",e.getMessage());
throw new BusinessException("状态机 拒绝失败: " + e);
}
}

/**
* 审核撤回
* @param project
* @return void
* @author CMM
* @since 2023/03/10 13:40
*/
public void withDraw(Project project) throws Exception {
execute(project,getProjectStatusWithdrawEvent(project.getStatus()));
//撤回
public void withDraw(Project project) {
try{
execute(project,getProjectStatusWithdrawEvent(project.getStatus()));
}catch (Exception e){
log.info("状态机 撤回失败 :{}",e.getMessage());
throw new BusinessException("状态机 撤回失败: " + e);
}
}

public void execute(Project project, ProjectStatusChangeEvent event) throws Exception {


+ 1
- 7
pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/PrequalificationDeclaredProjectManage.java Vedi File

@@ -121,13 +121,7 @@ public class PrequalificationDeclaredProjectManage {
//TODO 再判断 该项目是否 真实走完 单位内部审批

//使用状态机 进入下一步 看看需不需要走省级审批
try {
stateMachineUtils.pass(projectInfo);
} catch (Exception e) {
log.error("项目 调用状态机出错:",e);
throw new BusinessException(projectInfo.getId() + "项目 调用状态机出错 :" + e.getMessage());
}

stateMachineUtils.pass(projectInfo);
String instanceId = null;
//如果是省级部门 需要联审的(申报金额大于1000万 并且是市级项目)
if(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS


+ 2
- 2
pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/AnnualPlanLibManage.java Vedi File

@@ -131,7 +131,7 @@ public class AnnualPlanLibManage {
}

@Transactional(rollbackFor = Exception.class)
public void projectApproved(ProjectApprovedReq req) throws Exception {
public void projectApproved(ProjectApprovedReq req) {
Project project = projectService.getById(req.getProjectId());
stateMachine.pass(project);
LambdaUpdateWrapper<Project> update = Wrappers.lambdaUpdate(Project.class)
@@ -145,7 +145,7 @@ public class AnnualPlanLibManage {
}

@Transactional(rollbackFor = Exception.class)
public void suspendAnnualPlan(ProjectIdReq req) throws Exception {
public void suspendAnnualPlan(ProjectIdReq req) {
Project project = projectService.getById(req.getProjectId());
stateMachine.reject(project);
projectService.updateById(project);


+ 6
- 14
pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/TodoCenterManage.java Vedi File

@@ -422,13 +422,9 @@ public class TodoCenterManage {
* @since 2023/02/08
*/
private void updateRejectProjectStatus(Long userId, Project declaredProject) {
try {
stateMachineUtils.reject(declaredProject);
declaredProject.setUpdateOn(LocalDateTime.now());
declaredProject.setUpdateBy(userId);
} catch (Exception e) {
throw new BizException("状态机执行失败!");
}
stateMachineUtils.reject(declaredProject);
declaredProject.setUpdateOn(LocalDateTime.now());
declaredProject.setUpdateBy(userId);
projectService.updateById(declaredProject);
}

@@ -479,13 +475,9 @@ public class TodoCenterManage {
* @since 2023/02/08
*/
private void updatePassProjectStatus(Long userId, Project declaredProject) {
try {
stateMachineUtils.pass(declaredProject);
declaredProject.setUpdateOn(LocalDateTime.now());
declaredProject.setUpdateBy(userId);
} catch (Exception e) {
throw new BizException("状态机执行失败!");
}
stateMachineUtils.pass(declaredProject);
declaredProject.setUpdateOn(LocalDateTime.now());
declaredProject.setUpdateBy(userId);
projectService.updateById(declaredProject);
}



+ 1
- 1
pmapi/src/test/java/com/ningdatech/pmapi/statemachine/StateMachineTest.java Vedi File

@@ -22,7 +22,7 @@ public class StateMachineTest extends AppTests {
private StateMachineUtils stateMachineUtils;

@Test
public void stateMachineTest() throws Exception {
public void stateMachineTest() {
Project project = new Project();
project.setStage(ProjectStatusEnum.PROJECT_APPROVED.getCode());
project.setStatus(ProjectStatusEnum.IN_THE_ANNUAL_PLAN.getCode());


Loading…
Annulla
Salva