Browse Source

modify:

1. 任务完成监听;
tags/24092001^0
WendyYang 3 months ago
parent
commit
38fc4bc147
1 changed files with 4 additions and 1 deletions
  1. +4
    -1
      hz-pm-api/src/main/java/com/hz/pm/api/scheduler/listener/TaskCreatedListener.java

+ 4
- 1
hz-pm-api/src/main/java/com/hz/pm/api/scheduler/listener/TaskCreatedListener.java View File

@@ -29,6 +29,7 @@ import com.wflow.workflow.notify.event.NodeCreateEvent;
import com.wflow.workflow.service.ProcessModelHistorysService; import com.wflow.workflow.service.ProcessModelHistorysService;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.flowable.engine.HistoryService;
import org.flowable.engine.TaskService; import org.flowable.engine.TaskService;
import org.flowable.task.api.Task; import org.flowable.task.api.Task;
import org.flowable.task.api.history.HistoricTaskInstance; import org.flowable.task.api.history.HistoricTaskInstance;
@@ -54,6 +55,7 @@ import static com.hz.pm.api.common.util.ThreadPoolUtil.SCHEDULER;
@RequiredArgsConstructor @RequiredArgsConstructor
public class TaskCreatedListener { public class TaskCreatedListener {


private final HistoryService historyService;
private final IProjectService projectService; private final IProjectService projectService;
private final IProjectInstService projectInstService; private final IProjectInstService projectInstService;
private final ProcessModelHistorysService processModelHistorysService; private final ProcessModelHistorysService processModelHistorysService;
@@ -165,7 +167,7 @@ public class TaskCreatedListener {
WflowModelHistorys models = processModelHistorysService.getByProcessDefId(procDefId); WflowModelHistorys models = processModelHistorysService.getByProcessDefId(procDefId);
ProjectProcessType procType = ProjectProcessType.getNoNull(models.getProcessType()); ProjectProcessType procType = ProjectProcessType.getNoNull(models.getProcessType());
WflowHelper wflowHelper = SpringUtil.getBean(WflowHelper.class); WflowHelper wflowHelper = SpringUtil.getBean(WflowHelper.class);
Task task = taskService.createTaskQuery()
HistoricTaskInstance task = historyService.createHistoricTaskInstanceQuery()
.taskId(event.getTaskId()) .taskId(event.getTaskId())
.singleResult(); .singleResult();
boolean orUserTask = wflowHelper.isOrUserTask(procDefId, task.getTaskDefinitionKey()); boolean orUserTask = wflowHelper.isOrUserTask(procDefId, task.getTaskDefinitionKey());
@@ -181,6 +183,7 @@ public class TaskCreatedListener {
case COMPLIANCE_REVIEW: case COMPLIANCE_REVIEW:
case PROJECT_REVIEW: case PROJECT_REVIEW:
MHTodoTypeEnum todoType = getMhTodoTypeEnum(procType); MHTodoTypeEnum todoType = getMhTodoTypeEnum(procType);
log.info("完成任务: {} 信产待办:{}", event.getTaskId(), todoType);
if (orUserTask) { if (orUserTask) {
List<HistoricTaskInstance> tasks = wflowHelper.listFinishedTasks(task.getTaskDefinitionKey()); List<HistoricTaskInstance> tasks = wflowHelper.listFinishedTasks(task.getTaskDefinitionKey());
Set<String> taskIds = CollUtils.fieldSet(tasks, HistoricTaskInstance::getId); Set<String> taskIds = CollUtils.fieldSet(tasks, HistoricTaskInstance::getId);


Loading…
Cancel
Save