From b2469cb1c4a8b0f82ef25bc2689fff7822038838 Mon Sep 17 00:00:00 2001 From: wenyann <64353056+wenyann@users.noreply.github.com> Date: Fri, 30 Oct 2020 13:20:57 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=8E=92=E5=BA=8F=E7=A9=BA=E6=8C=87?= =?UTF-8?q?=E9=92=88=E5=BC=82=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../metersphere/notice/service/NoticeService.java | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/backend/src/main/java/io/metersphere/notice/service/NoticeService.java b/backend/src/main/java/io/metersphere/notice/service/NoticeService.java index 43e37fda9c..b8aa3847e0 100644 --- a/backend/src/main/java/io/metersphere/notice/service/NoticeService.java +++ b/backend/src/main/java/io/metersphere/notice/service/NoticeService.java @@ -91,10 +91,12 @@ public class NoticeService { messageDetail.setIsSet(m.getIsSet()); messageDetail.setCreateTime(m.getCreateTime()); } - messageDetail.setUserIds(new ArrayList(userIds)); + if (userIds != null || !"".equals(userIds)) { + messageDetail.setUserIds(new ArrayList(userIds)); + } scheduleMessageTask.add(messageDetail); }); - scheduleMessageTask.sort(Comparator.comparing(MessageDetail::getCreateTime).reversed()); + scheduleMessageTask.sort(Comparator.comparing(MessageDetail::getCreateTime, Comparator.nullsLast(Long::compareTo)).reversed()); return scheduleMessageTask; } @@ -123,13 +125,13 @@ public class NoticeService { MessageDetailList.add(messageDetail); }); List jenkinsTask = MessageDetailList.stream().filter(a -> a.getTaskType().equals(NoticeConstants.JENKINS_TASK)).collect(Collectors.toList()); - jenkinsTask.sort(Comparator.comparing(MessageDetail::getCreateTime).reversed()); + jenkinsTask.sort(Comparator.comparing(MessageDetail::getCreateTime, Comparator.nullsLast(Long::compareTo)).reversed()); List testCasePlanTask = MessageDetailList.stream().filter(a -> a.getTaskType().equals(NoticeConstants.TEST_PLAN_TASK)).collect(Collectors.toList()); - testCasePlanTask.sort(Comparator.comparing(MessageDetail::getCreateTime).reversed()); + testCasePlanTask.sort(Comparator.comparing(MessageDetail::getCreateTime, Comparator.nullsLast(Long::compareTo)).reversed()); List reviewTask = MessageDetailList.stream().filter(a -> a.getTaskType().equals(NoticeConstants.REVIEW_TASK)).collect(Collectors.toList()); - reviewTask.sort(Comparator.comparing(MessageDetail::getCreateTime).reversed()); + reviewTask.sort(Comparator.comparing(MessageDetail::getCreateTime, Comparator.nullsLast(Long::compareTo)).reversed()); List defectTask = MessageDetailList.stream().filter(a -> a.getTaskType().equals(NoticeConstants.DEFECT_TASK)).collect(Collectors.toList()); - defectTask.sort(Comparator.comparing(MessageDetail::getCreateTime).reversed()); + defectTask.sort(Comparator.comparing(MessageDetail::getCreateTime, Comparator.nullsLast(Long::compareTo)).reversed()); messageSettingDetail.setJenkinsTask(jenkinsTask); messageSettingDetail.setTestCasePlanTask(testCasePlanTask); messageSettingDetail.setReviewTask(reviewTask);