mirror of
https://github.com/weizhiqiang1995/erp-pro.git
synced 2024-12-25 00:53:20 +08:00
feat: 解决获取审批人报错的问题
This commit is contained in:
parent
d3d238bc28
commit
dcb7243ced
1 changed files with 19 additions and 2 deletions
|
@ -376,8 +376,25 @@ public class ActivitiProcessServiceImpl implements ActivitiProcessService {
|
|||
list.add(userMation);
|
||||
}
|
||||
}
|
||||
|
||||
return list.stream().collect(Collectors.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(p -> String.valueOf(p.get("id"))))), ArrayList::new));
|
||||
// 使用 Stream API 进行过滤、排序并最终收集到 ArrayList 中
|
||||
List<Map<String, Object>> resultList = list.stream()
|
||||
.filter(Objects::nonNull) // 确保 item 不是 null
|
||||
.map(item -> item.entrySet().stream()
|
||||
.filter(entry -> entry != null && entry.getKey() != null &&
|
||||
entry.getValue() != null && !"".equals(entry.getValue()))
|
||||
.collect(Collectors.toMap(
|
||||
Map.Entry::getKey,
|
||||
Map.Entry::getValue,
|
||||
(existing, replacement) -> existing, // 解决重复键的问题
|
||||
LinkedHashMap::new)) // 保持插入顺序
|
||||
)
|
||||
.filter(Objects::nonNull) // 确保转换后的 map 不是 null
|
||||
.sorted(Comparator.comparing(p -> String.valueOf(p.get("id")), Comparator.nullsLast(Comparator.naturalOrder())))
|
||||
.collect(Collectors.collectingAndThen(
|
||||
Collectors.toCollection(ArrayList::new),
|
||||
ArrayList::new
|
||||
));
|
||||
return resultList;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue