diff --git a/src/main/java/com/ai/da/service/impl/MessageCenterServiceImpl.java b/src/main/java/com/ai/da/service/impl/MessageCenterServiceImpl.java index 74a19386..b5e5a4f4 100644 --- a/src/main/java/com/ai/da/service/impl/MessageCenterServiceImpl.java +++ b/src/main/java/com/ai/da/service/impl/MessageCenterServiceImpl.java @@ -106,7 +106,11 @@ public class MessageCenterServiceImpl extends ServiceImpl convert = notificationPage.convert(o -> { NotificationVO notificationVO = CopyUtil.copyObject(o, NotificationVO.class); Account senderAccount = accountService.getById(notificationVO.getSenderId()); - notificationVO.setUserName(senderAccount.getUserName()); + if (Objects.nonNull(senderAccount)){ + notificationVO.setUserName(senderAccount.getUserName()); + }else { + notificationVO.setUserName("--"); + } // notificationVO.setSenderUserAvatar(StringUtils.isNullOrEmpty(senderAccount.getAvatar()) ? null : minioUtil.getPreSignedUrl(senderAccount.getAvatar(), CommonConstant.MINIO_IMAGE_EXPIRE_TIME)); if (Objects.isNull(notificationVO.getPortfolioId())){ notificationVO.setPortfolioId(null);