From 03148df3d379872b96b0432c1e0145f797260938 Mon Sep 17 00:00:00 2001 From: wangli <274027703@qq.com> Date: Wed, 17 Sep 2025 11:54:00 +0800 Subject: [PATCH] =?UTF-8?q?fix=20-=20=E4=BF=AE=E6=94=B9=E4=B8=9A=E5=8A=A1?= =?UTF-8?q?=E8=8A=82=E7=82=B9=E8=A7=A6=E5=8F=91=E5=BC=82=E5=B8=B8=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../core/engine/cmd/CustomActivityTriggerCmd.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/workflow-engine-core/src/main/java/cn/axzo/workflow/core/engine/cmd/CustomActivityTriggerCmd.java b/workflow-engine-core/src/main/java/cn/axzo/workflow/core/engine/cmd/CustomActivityTriggerCmd.java index 3eb2e4b14..917e61aca 100644 --- a/workflow-engine-core/src/main/java/cn/axzo/workflow/core/engine/cmd/CustomActivityTriggerCmd.java +++ b/workflow-engine-core/src/main/java/cn/axzo/workflow/core/engine/cmd/CustomActivityTriggerCmd.java @@ -13,6 +13,7 @@ import org.flowable.engine.RuntimeService; import org.flowable.engine.impl.cfg.ProcessEngineConfigurationImpl; import org.flowable.engine.impl.util.CommandContextUtil; import org.flowable.engine.impl.util.ProcessDefinitionUtil; +import org.flowable.task.api.TaskQuery; import org.flowable.task.service.impl.persistence.entity.TaskEntity; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -50,10 +51,12 @@ public class CustomActivityTriggerCmd extends AbstractCommand implements S ProcessEngineConfigurationImpl processEngineConfiguration = CommandContextUtil.getProcessEngineConfiguration(commandContext); - TaskEntity task = (TaskEntity) processEngineConfiguration.getTaskService().createTaskQuery() - .executionId(dto.getTriggerId()) - .taskDefinitionKey(StringUtils.isBlank(dto.getActivityId()) ? null : dto.getActivityId()) - .singleResult(); + TaskQuery taskQuery = processEngineConfiguration.getTaskService().createTaskQuery() + .executionId(dto.getTriggerId()); + if (StringUtils.isNotBlank(dto.getActivityId())) { + taskQuery.taskDefinitionKey(dto.getActivityId()); + } + TaskEntity task = (TaskEntity) taskQuery.singleResult(); if (Objects.isNull(task)) { throw new WorkflowEngineException(ACTIVITY_TRIGGER_NOT_EXISTS, dto.getTriggerId()); }