|
|
@@ -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); |
|
|
|
} |
|
|
|
} |
|
|
|
} |