mirror of
https://github.com/BgaSol/sol-cloud
synced 2026-04-21 17:17:16 +00:00
fix(message): add null check for user ids in message envelope service
This commit is contained in:
parent
b1f4a92bef
commit
c9ee2c3e9c
1 changed files with 8 additions and 6 deletions
|
|
@ -46,12 +46,14 @@ public class MessageEnvelopeService extends BaseService<MessageEnvelopeEntity<?>
|
|||
.map(MessageEnvelopeEntity::getUserId)
|
||||
.filter(ObjectUtils::isNotEmpty)
|
||||
.collect(Collectors.toSet());
|
||||
Map<String, UserEntity> userEntityMap = userApi.findByIds(String.join(",", userIds)).getData().stream().collect(Collectors.toMap(UserEntity::getId, Function.identity()));
|
||||
list.forEach(e -> {
|
||||
if (ObjectUtils.isNotEmpty(e.getUserId())) {
|
||||
e.setUser(userEntityMap.get(e.getUserId()));
|
||||
}
|
||||
});
|
||||
if (ObjectUtils.isNotEmpty(userIds)) {
|
||||
Map<String, UserEntity> userEntityMap = userApi.findByIds(String.join(",", userIds)).getData().stream().collect(Collectors.toMap(UserEntity::getId, Function.identity()));
|
||||
list.forEach(e -> {
|
||||
if (ObjectUtils.isNotEmpty(e.getUserId())) {
|
||||
e.setUser(userEntityMap.get(e.getUserId()));
|
||||
}
|
||||
});
|
||||
}
|
||||
super.findOtherTable(list);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue