1
0

修复上下文变量没有正常传递

This commit is contained in:
2025-01-03 12:37:04 +08:00
parent b69da9a4e4
commit 86f702db3e
2 changed files with 17 additions and 0 deletions

View File

@@ -2,6 +2,7 @@ package com.lanyuanxiaoyao.flowable.core.helper;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
import lombok.NoArgsConstructor;
/**
@@ -27,4 +28,19 @@ public class MapHelper {
public static Map<String, Object> empty() {
return new HashMap<>(0);
}
public static boolean isEmpty(Map<?, ?> map) {
return Objects.isNull(map) || map.isEmpty();
}
@SafeVarargs
public static <K, V> Map<K, V> concat(Map<K, V>... maps) {
Map<K, V> result = new HashMap<>();
for (Map<K, V> map : maps) {
if (Objects.nonNull(map)) {
result.putAll(map);
}
}
return result;
}
}

View File

@@ -107,6 +107,7 @@ public abstract class FlowableManager {
private void manualAction(String instanceId, FlowableAction action, String comment, Map<String, Object> metadata) {
FlowableInstance instance = repository.getInstance(instanceId);
FlowableNode node = repository.getNode(instance.getCurrentNodeId());
metadata = MapHelper.isEmpty(metadata) ? instance.getMetadata() : MapHelper.concat(metadata, instance.getMetadata());
action(instance, node, action, comment, metadata);
}