fix(message): add null check for user ids in message envelope service

This commit is contained in:
sol 2026-03-17 17:15:21 +08:00
parent b1f4a92bef
commit c9ee2c3e9c

View file

@ -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);
}