From 794dee88f56de7b56da9e2f11984056184a9c9fa Mon Sep 17 00:00:00 2001 From: x ronger Date: Tue, 29 Sep 2020 21:40:25 +0800 Subject: [PATCH] =?UTF-8?q?:bug:=20=E6=B6=88=E6=81=AF=E9=80=9A=E7=9F=A5?= =?UTF-8?q?=E5=85=B3=E8=81=94=E6=95=B0=E6=8D=AE=E5=88=A0=E9=99=A4=E5=90=8E?= =?UTF-8?q?=E6=8A=A5=E9=94=99=E9=97=AE=E9=A2=98=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/NotificationServiceImpl.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/main/java/com/rymcu/vertical/service/impl/NotificationServiceImpl.java b/src/main/java/com/rymcu/vertical/service/impl/NotificationServiceImpl.java index 86fa52c..6d22435 100644 --- a/src/main/java/com/rymcu/vertical/service/impl/NotificationServiceImpl.java +++ b/src/main/java/com/rymcu/vertical/service/impl/NotificationServiceImpl.java @@ -39,6 +39,8 @@ public class NotificationServiceImpl extends AbstractService imple @Value("${resource.domain}") private String domain; + private final static String unRead = "0"; + @Override public List findUnreadNotifications(Integer idUser) { List list = notificationMapper.selectUnreadNotifications(idUser); @@ -51,8 +53,20 @@ public class NotificationServiceImpl extends AbstractService imple List notifications = new ArrayList<>(); list.forEach(notification -> { NotificationDTO notificationDTO = genNotification(notification); + // 判断关联数据是否已删除 if (Objects.nonNull(notificationDTO.getAuthor())) { notifications.add(notificationDTO); + } else { + // 关联数据已删除,且未读 + if (unRead.equals(notification.getHasRead())) { + notificationMapper.readNotification(notification.getIdNotification()); + } + NotificationDTO dto = new NotificationDTO(); + dto.setDataSummary("该消息已被撤销!"); + dto.setDataType("-1"); + dto.setHasRead("1"); + dto.setCreatedTime(notification.getCreatedTime()); + notifications.add(dto); } }); return notifications;