diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/listener/ProcessEndListener.java b/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/listener/ProcessEndListener.java index fe2a7a4..9735e25 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/listener/ProcessEndListener.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/listener/ProcessEndListener.java @@ -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 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); } } } \ No newline at end of file diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/HandlerManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/HandlerManage.java index f850c1b..be686ef 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/HandlerManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/HandlerManage.java @@ -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)){