feat(REQ-4624) - 调整告警节点引起的 trigger API 问题

This commit is contained in:
wangli 2025-08-08 10:03:00 +08:00
parent aeda3ef08b
commit 89364d1f54

View File

@ -8,6 +8,7 @@ import org.flowable.common.engine.impl.interceptor.CommandContext;
import org.flowable.engine.RuntimeService; import org.flowable.engine.RuntimeService;
import org.flowable.engine.impl.cfg.ProcessEngineConfigurationImpl; import org.flowable.engine.impl.cfg.ProcessEngineConfigurationImpl;
import org.flowable.engine.impl.util.CommandContextUtil; import org.flowable.engine.impl.util.CommandContextUtil;
import org.flowable.job.service.TimerJobService;
import org.flowable.task.service.impl.persistence.entity.TaskEntity; import org.flowable.task.service.impl.persistence.entity.TaskEntity;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@ -54,6 +55,9 @@ public class CustomActivityTriggerCmd extends AbstractCommand<Void> implements S
} }
addComment(commandContext, task, COMMENT_TYPE_OPERATION_DESC, "已同意"); addComment(commandContext, task, COMMENT_TYPE_OPERATION_DESC, "已同意");
RuntimeService runtimeService = processEngineConfiguration.getRuntimeService(); RuntimeService runtimeService = processEngineConfiguration.getRuntimeService();
// 告警节点生产的定时任务需要删除否则会因为外键约束导致触发功能会重试并抛出触发节点不存在的问题
TimerJobService timerJobService = CommandContextUtil.getTimerJobService();
timerJobService.findTimerJobsByProcessInstanceId(task.getProcessInstanceId()).forEach(timerJobService::deleteTimerJob);
runtimeService.trigger(dto.getTriggerId()); runtimeService.trigger(dto.getTriggerId());
return null; return null;
} }