Commit 75167383304c9f5c392af8553bc7e1e70736d043

Authored by YunaiV
1 parent 0ab54a9f

【缺陷修复】BPM:修复 task 的 category 不正确的问题

yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/framework/flowable/core/behavior/BpmUserTaskActivityBehavior.java
... ... @@ -10,7 +10,10 @@ import org.flowable.common.engine.impl.el.ExpressionManager;
10 10 import org.flowable.engine.delegate.DelegateExecution;
11 11 import org.flowable.engine.impl.bpmn.behavior.UserTaskActivityBehavior;
12 12 import org.flowable.engine.impl.cfg.ProcessEngineConfigurationImpl;
  13 +import org.flowable.engine.impl.persistence.entity.ProcessDefinitionEntity;
  14 +import org.flowable.engine.impl.util.CommandContextUtil;
13 15 import org.flowable.engine.impl.util.TaskHelper;
  16 +import org.flowable.engine.interceptor.CreateUserTaskBeforeContext;
14 17 import org.flowable.task.service.TaskService;
15 18 import org.flowable.task.service.impl.persistence.entity.TaskEntity;
16 19 import org.springframework.transaction.annotation.Transactional;
... ... @@ -69,4 +72,15 @@ public class BpmUserTaskActivityBehavior extends UserTaskActivityBehavior {
69 72 return CollUtil.get(candidateUserIds, index);
70 73 }
71 74  
  75 + @Override
  76 + protected void handleCategory(CreateUserTaskBeforeContext beforeContext, ExpressionManager expressionManager,
  77 + TaskEntity task, DelegateExecution execution) {
  78 + ProcessDefinitionEntity processDefinitionEntity = CommandContextUtil.getProcessDefinitionEntityManager().findById(execution.getProcessDefinitionId());
  79 + if (processDefinitionEntity == null) {
  80 + log.warn("[handleCategory][任务编号({}) 找不到流程定义({})]", task.getId(), execution.getProcessDefinitionId());
  81 + return;
  82 + }
  83 + task.setCategory(processDefinitionEntity.getCategory());
  84 + }
  85 +
72 86 }
... ...