|
@@ -10,7 +10,10 @@ import org.flowable.common.engine.impl.el.ExpressionManager;
|
|
|
import org.flowable.engine.delegate.DelegateExecution;
|
|
|
import org.flowable.engine.impl.bpmn.behavior.UserTaskActivityBehavior;
|
|
|
import org.flowable.engine.impl.cfg.ProcessEngineConfigurationImpl;
|
|
|
+import org.flowable.engine.impl.persistence.entity.ProcessDefinitionEntity;
|
|
|
+import org.flowable.engine.impl.util.CommandContextUtil;
|
|
|
import org.flowable.engine.impl.util.TaskHelper;
|
|
|
+import org.flowable.engine.interceptor.CreateUserTaskBeforeContext;
|
|
|
import org.flowable.task.service.TaskService;
|
|
|
import org.flowable.task.service.impl.persistence.entity.TaskEntity;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
@@ -69,4 +72,15 @@ public class BpmUserTaskActivityBehavior extends UserTaskActivityBehavior {
|
|
|
return CollUtil.get(candidateUserIds, index);
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ protected void handleCategory(CreateUserTaskBeforeContext beforeContext, ExpressionManager expressionManager,
|
|
|
+ TaskEntity task, DelegateExecution execution) {
|
|
|
+ ProcessDefinitionEntity processDefinitionEntity = CommandContextUtil.getProcessDefinitionEntityManager().findById(execution.getProcessDefinitionId());
|
|
|
+ if (processDefinitionEntity == null) {
|
|
|
+ log.warn("[handleCategory][任务编号({}) 找不到流程定义({})]", task.getId(), execution.getProcessDefinitionId());
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ task.setCategory(processDefinitionEntity.getCategory());
|
|
|
+ }
|
|
|
+
|
|
|
}
|