wsm-添加适配会签任务内再次会签的变量获取方法
This commit is contained in:
+55
@@ -304,6 +304,8 @@ public class FlowNodeExpression {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// /**
|
||||
// * 从当前流程实例的所有执行实例中获取指定的局部变量
|
||||
@@ -376,6 +378,59 @@ public class FlowNodeExpression {
|
||||
return usernames.get(0);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get subprocess variable.
|
||||
* Example: ${flowNodeExpression.getSonProcessVariable(execution, 'subApproveUser')}
|
||||
*
|
||||
* @param execution current execution
|
||||
* @param variableName subprocess variable name
|
||||
* @return username list
|
||||
*/
|
||||
public List<String> getSonProcessHqVariableList(DelegateExecution execution, String variableName) {
|
||||
if (execution == null || StringUtils.isBlank(variableName)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
try {
|
||||
String parentExecutionId = execution.getParentId();
|
||||
if(StringUtils.isBlank(parentExecutionId)){
|
||||
return Collections.emptyList();
|
||||
}
|
||||
if (execution.hasVariableLocal(variableName)) {
|
||||
return splitUsernames(execution.getVariableLocal(variableName));
|
||||
}
|
||||
|
||||
List<Execution> executions = runtimeService.createExecutionQuery()
|
||||
.processInstanceId(parentExecutionId)
|
||||
.list();
|
||||
for (Execution childExecution : executions) {
|
||||
if (execution.getId().equals(childExecution.getId())) {
|
||||
continue;
|
||||
}
|
||||
Object localVariable = runtimeService.getVariableLocal(childExecution.getId(), variableName);
|
||||
if (localVariable != null) {
|
||||
return splitUsernames(localVariable);
|
||||
}
|
||||
}
|
||||
Object variable = execution.getVariable(variableName);
|
||||
if (variable != null) {
|
||||
return splitUsernames(variable);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.warn("getSonProcessVariable failed, executionId={}, variableName={}",
|
||||
execution.getId(), variableName, e);
|
||||
}
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
public int getSonProcessHqVariableListLength(DelegateExecution execution, String variableName) {
|
||||
return this.getSonProcessHqVariableList(execution,variableName).size();
|
||||
}
|
||||
|
||||
public String getSonProcessHqVariableString(DelegateExecution execution, String variableName) {
|
||||
if(execution == null || StringUtils.isBlank(variableName) || getSonProcessHqVariableList(execution, variableName).isEmpty()) return StringUtils.EMPTY;
|
||||
return getSonProcessHqVariableList(execution, variableName).get(0);
|
||||
}
|
||||
/**
|
||||
* Save current task assignee as execution local variable.
|
||||
* Example: ${flowNodeExpression.saveCurrentTaskAssigneeLocal(task, 'subApproveUser')}
|
||||
|
||||
Reference in New Issue
Block a user