From 730d1944e3a13c517c77df2b0712df05645a38dd Mon Sep 17 00:00:00 2001 From: dengzedong <dengzedong@email> Date: 星期一, 06 一月 2025 16:00:58 +0800 Subject: [PATCH] chartParamList api --- iailab-module-bpm/iailab-module-bpm-biz/src/main/java/com/iailab/module/bpm/framework/flowable/core/candidate/strategy/other/BpmTaskCandidateExpressionStrategy.java | 17 +++++++++++++++-- 1 files changed, 15 insertions(+), 2 deletions(-) diff --git a/iailab-module-bpm/iailab-module-bpm-biz/src/main/java/com/iailab/module/bpm/framework/flowable/core/candidate/strategy/other/BpmTaskCandidateExpressionStrategy.java b/iailab-module-bpm/iailab-module-bpm-biz/src/main/java/com/iailab/module/bpm/framework/flowable/core/candidate/strategy/other/BpmTaskCandidateExpressionStrategy.java index 50d10e3..11ff269 100644 --- a/iailab-module-bpm/iailab-module-bpm-biz/src/main/java/com/iailab/module/bpm/framework/flowable/core/candidate/strategy/other/BpmTaskCandidateExpressionStrategy.java +++ b/iailab-module-bpm/iailab-module-bpm-biz/src/main/java/com/iailab/module/bpm/framework/flowable/core/candidate/strategy/other/BpmTaskCandidateExpressionStrategy.java @@ -1,13 +1,17 @@ package com.iailab.module.bpm.framework.flowable.core.candidate.strategy.other; import cn.hutool.core.convert.Convert; +import com.google.common.collect.Sets; import com.iailab.module.bpm.framework.flowable.core.candidate.BpmTaskCandidateStrategy; import com.iailab.module.bpm.framework.flowable.core.enums.BpmTaskCandidateStrategyEnum; import com.iailab.module.bpm.framework.flowable.core.util.FlowableUtils; +import lombok.extern.slf4j.Slf4j; import org.flowable.bpmn.model.BpmnModel; +import org.flowable.common.engine.api.FlowableException; import org.flowable.engine.delegate.DelegateExecution; import org.springframework.stereotype.Component; +import java.util.HashMap; import java.util.Map; import java.util.Set; @@ -17,6 +21,7 @@ * @author iailab */ @Component +@Slf4j public class BpmTaskCandidateExpressionStrategy implements BpmTaskCandidateStrategy { @Override @@ -38,8 +43,16 @@ @Override public Set<Long> calculateUsersByActivity(BpmnModel bpmnModel, String activityId, String param, Long startUserId, String processDefinitionId, Map<String, Object> processVariables) { - Object result = FlowableUtils.getExpressionValue(processVariables, param); - return Convert.toSet(Long.class, result); + Map<String, Object> variables = processVariables == null ? new HashMap<>() : processVariables; + try { + Object result = FlowableUtils.getExpressionValue(variables, param); + return Convert.toSet(Long.class, result); + } catch (FlowableException ex) { + // 预测未运行的节点时候,表达式如果包含 execution 或者不存在的流程变量会抛异常, + log.warn("[calculateUsersByActivity][表达式({}) 变量({}) 解析报错", param, variables, ex); + // 不能预测候选人,返回空列表, 避免流程无法进行 + return Sets.newHashSet(); + } } } \ No newline at end of file -- Gitblit v1.9.3