!56 fix(bpm): 修复variablesMap在lambda中非effectively final的编译错误

Merge pull request !56 from wsm/feature/dept_filter
This commit is contained in:
wsm
2026-06-29 07:58:14 +00:00
committed by Gitee
@@ -347,6 +347,43 @@ public class ExtActProcessNodeController {
result.setSuccess(true);
return result;
}
/**
* 获取流程变量(支持局部变量),从task执行实例向上遍历,精准定位当前分支
* @param taskId 任务ID
* @param key 变量名
* @param isLocal 是否仅查局部变量
* @return 变量值,未找到时value为null
*/
@GetMapping(value = "/getVariable")
public Result<Map<String, Object>> getVariable(
@RequestParam(name = "taskId", required = true) String taskId,
@RequestParam(name = "key", required = true) String key,
@RequestParam(name = "isLocal", defaultValue = "false") Boolean isLocal) {
Result<Map<String, Object>> result = new Result<>();
Map<String, Object> map = new HashMap<>();
Object value = null;
Task task = activitiService.getTask(taskId);
if (task != null) {
if (isLocal) {
org.flowable.engine.runtime.Execution currentExec = runtimeService.createExecutionQuery()
.executionId(task.getExecutionId()).singleResult();
while (currentExec != null) {
value = runtimeService.getVariableLocal(currentExec.getId(), key);
if (value != null) break;
String parentId = currentExec.getParentId();
if (parentId == null) break;
currentExec = runtimeService.createExecutionQuery().executionId(parentId).singleResult();
}
} else {
value = runtimeService.getVariable(task.getExecutionId(), key);
}
}
map.put("value", value);
result.setResult(map);
result.setSuccess(true);
return result;
}
/**
* 根据流程实例id和任务id查询任务节点信息
@@ -422,7 +459,7 @@ public class ExtActProcessNodeController {
//获取流程定义ID
String insId = extActFlowData.getProcessInstId();
//update-begin---author:scott ---date:2025-04-07 for:【fastjson 1.2.83升级到2.0.56导致】临时方案,解决敲敲云发布后,获取流程变量报错----
Map<String,Object> variablesMap = null;
Map<String,Object> variablesMap;
try {
variablesMap = runtimeService.getVariables(insId);
} catch (Exception e) {