瀏覽代碼

fix:【bpm】流程抄送时,可能缺少租户上下文的问题,对应 https://gitee.com/zhijiantianya/yudao-cloud/issues/IDEUQ6

YunaiV 5 月之前
父節點
當前提交
6d1c1f2095

+ 4 - 2
yudao-module-bpm/src/main/java/cn/iocoder/yudao/module/bpm/framework/flowable/core/listener/BpmCopyTaskDelegate.java

@@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.bpm.framework.flowable.core.listener;
 
 import cn.hutool.core.collection.CollUtil;
 import cn.iocoder.yudao.module.bpm.framework.flowable.core.candidate.BpmTaskCandidateInvoker;
+import cn.iocoder.yudao.module.bpm.framework.flowable.core.util.FlowableUtils;
 import cn.iocoder.yudao.module.bpm.service.task.BpmProcessInstanceCopyService;
 import jakarta.annotation.Resource;
 import org.flowable.bpmn.model.FlowElement;
@@ -40,8 +41,9 @@ public class BpmCopyTaskDelegate implements JavaDelegate {
         }
         // 2. 执行抄送
         FlowElement currentFlowElement = execution.getCurrentFlowElement();
-        processInstanceCopyService.createProcessInstanceCopy(userIds, null, execution.getProcessInstanceId(),
-                currentFlowElement.getId(), currentFlowElement.getName(), null);
+        FlowableUtils.execute(execution.getTenantId(), () ->
+                processInstanceCopyService.createProcessInstanceCopy(userIds, null, execution.getProcessInstanceId(),
+                        currentFlowElement.getId(), currentFlowElement.getName(), null));
     }
 
 }