Browse Source

完截止后 调状态机

master
PoffyZhang 1 year ago
parent
commit
ee6dd4560c
2 changed files with 13 additions and 4 deletions
  1. +10
    -3
      pmapi/src/main/java/com/ningdatech/pmapi/scheduler/listener/ProcessEndListener.java
  2. +3
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/HandlerManage.java

+ 10
- 3
pmapi/src/main/java/com/ningdatech/pmapi/scheduler/listener/ProcessEndListener.java View File

@@ -8,12 +8,14 @@ import com.ningdatech.pmapi.projectlib.model.entity.Project;
import com.ningdatech.pmapi.projectlib.model.entity.ProjectInst;
import com.ningdatech.pmapi.projectlib.service.IProjectInstService;
import com.ningdatech.pmapi.projectlib.service.IProjectService;
import com.ningdatech.pmapi.todocenter.manage.HandlerManage;
import com.wflow.workflow.notify.event.ProcessEndEvent;
import com.wflow.workflow.notify.event.ProcessStartEvent;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.flowable.engine.HistoryService;
import org.flowable.engine.TaskService;
import org.flowable.engine.history.HistoricProcessInstance;
import org.flowable.task.api.Task;
import org.flowable.task.api.history.HistoricTaskInstance;
import org.springframework.context.event.EventListener;
@@ -43,6 +45,8 @@ public class ProcessEndListener {

private final StateMachineUtils stateMachineUtils;

private final HandlerManage handlerManage;

@Async
@EventListener
public void onApplicationEvent(ProcessEndEvent event) {
@@ -67,6 +71,8 @@ public class ProcessEndListener {
return;
}



List<Task> tasks = taskService.createTaskQuery()
.processInstanceId(instCode)
.active()
@@ -81,9 +87,10 @@ public class ProcessEndListener {
if (CollUtil.isEmpty(tasks) && CollUtil.isEmpty(historyTasks)) {
Long projectId = projectInst.getProjectId();
Project project = projectService.getNewProject(projectId);
stateMachineUtils.pass(project);
project.setUpdateOn(LocalDateTime.now());
projectService.updateById(project);
HistoricProcessInstance instance = historyService.createHistoricProcessInstanceQuery()
.processInstanceId(instCode).singleResult();
//通过审核后 所处理的逻辑
handlerManage.afterPassTodo(project,instance);
}
}
}

+ 3
- 1
pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/HandlerManage.java View File

@@ -12,6 +12,7 @@ import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.google.common.collect.Lists;
import com.ningdatech.basic.util.NdDateUtils;
import com.ningdatech.file.service.FileService;
import com.ningdatech.pmapi.common.constant.BizConst;
import com.ningdatech.pmapi.common.constant.ProjectDeclareConst;
import com.ningdatech.pmapi.filemanage.model.entity.ProjectApplyBorrow;
import com.ningdatech.pmapi.filemanage.service.INdProjectApplyBorrowService;
@@ -105,7 +106,8 @@ public class HandlerManage {
// 获取当前流程实例类型
String instanceId = newInstance.getId();
ProjectInst projectInst = projectInstService.getOne(Wrappers.lambdaQuery(ProjectInst.class)
.eq(ProjectInst::getInstCode, instanceId));
.eq(ProjectInst::getInstCode, instanceId)
.last(BizConst.LIMIT_1));
Integer instType = projectInst.getInstType();
InstTypeEnum instTypeEnum = InstTypeEnum.getByCode(instType);
if (Objects.isNull(instTypeEnum)){


Loading…
Cancel
Save