From 7d6e64f337b7ae1990e2a1747c47b931c5af14c7 Mon Sep 17 00:00:00 2001 From: wangli <274027703@qq.com> Date: Tue, 9 Sep 2025 11:24:00 +0800 Subject: [PATCH 1/2] =?UTF-8?q?fix=20-=20=E8=80=81=E7=89=88=E6=9C=AC?= =?UTF-8?q?=E5=91=8A=E8=AD=A6=E5=AE=9E=E7=8E=B0=E5=A4=9A=E4=BD=99=E7=9A=84?= =?UTF-8?q?=E5=8A=A8=E4=BD=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../workflow/core/engine/cmd/CustomActivityTriggerCmd.java | 4 ---- 1 file changed, 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 2a930c561..3eb2e4b14 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 @@ -12,7 +12,6 @@ import org.flowable.common.engine.impl.interceptor.CommandContext; import org.flowable.engine.RuntimeService; import org.flowable.engine.impl.cfg.ProcessEngineConfigurationImpl; import org.flowable.engine.impl.util.CommandContextUtil; -import org.flowable.job.service.TimerJobService; import org.flowable.engine.impl.util.ProcessDefinitionUtil; import org.flowable.task.service.impl.persistence.entity.TaskEntity; import org.slf4j.Logger; @@ -66,9 +65,6 @@ public class CustomActivityTriggerCmd extends AbstractCommand implements S addComment(commandContext, task, COMMENT_TYPE_OPERATION_DESC, "已同意"); RuntimeService runtimeService = processEngineConfiguration.getRuntimeService(); - // 告警节点生产的定时任务需要删除,否则会因为外键约束导致触发功能会重试,并抛出触发节点不存在的问题 - TimerJobService timerJobService = CommandContextUtil.getTimerJobService(); - timerJobService.findTimerJobsByProcessInstanceId(task.getProcessInstanceId()).forEach(timerJobService::deleteTimerJob); runtimeService.trigger(dto.getTriggerId()); return null; } 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 2/2] =?UTF-8?q?fix=20-=20=E4=BF=AE=E6=94=B9=E4=B8=9A?= =?UTF-8?q?=E5=8A=A1=E8=8A=82=E7=82=B9=E8=A7=A6=E5=8F=91=E5=BC=82=E5=B8=B8?= =?UTF-8?q?=E7=9A=84=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()); }