fix: 字段合并,合并值而不是键

This commit is contained in:
杨元
2025-03-05 10:40:38 +08:00
parent 43869a3059
commit 221fcb8909

View File

@@ -6,6 +6,7 @@ import org.springframework.stereotype.Component;
import java.util.Arrays; import java.util.Arrays;
import java.util.Map; import java.util.Map;
import java.util.Optional;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
@@ -35,8 +36,8 @@ public class ALLINONE implements PluginServiceV2 {
if (sourceField == null || sourceField.length == 0) { if (sourceField == null || sourceField.length == 0) {
return ""; return "";
} }
String str = Arrays.asList(sourceField).stream() String str = Arrays.stream(sourceField)
.map(f -> jsonInfo.get(f) == null ? "" : f.toString()) .map(f -> Optional.ofNullable(jsonInfo.get(f)).map(Object::toString).orElse(""))
.collect(Collectors.joining("_")); .collect(Collectors.joining("_"));
return str; return str;
} }