fix(bpm): 修复variablesMap在lambda中非effectively final的编译错误
去除冗余的=null初始化,使得try-catch中仅赋值一次,满足effectively final要求。 Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
+38
-1
@@ -348,6 +348,43 @@ public class ExtActProcessNodeController {
|
|||||||
return result;
|
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查询任务节点信息
|
* 根据流程实例id和任务id查询任务节点信息
|
||||||
* @param procInstId
|
* @param procInstId
|
||||||
@@ -422,7 +459,7 @@ public class ExtActProcessNodeController {
|
|||||||
//获取流程定义ID
|
//获取流程定义ID
|
||||||
String insId = extActFlowData.getProcessInstId();
|
String insId = extActFlowData.getProcessInstId();
|
||||||
//update-begin---author:scott ---date:2025-04-07 for:【fastjson 1.2.83升级到2.0.56导致】临时方案,解决敲敲云发布后,获取流程变量报错----
|
//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 {
|
try {
|
||||||
variablesMap = runtimeService.getVariables(insId);
|
variablesMap = runtimeService.getVariables(insId);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|||||||
Reference in New Issue
Block a user