From e9dfddd8c5c06b37efa8f4b069c631d27741b576 Mon Sep 17 00:00:00 2001 From: CaptainB Date: Tue, 8 Mar 2022 12:31:32 +0800 Subject: [PATCH] =?UTF-8?q?perf(=E6=B6=88=E6=81=AF=E9=80=9A=E7=9F=A5):=20?= =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=8F=91=E9=80=81=E9=80=9A=E7=9F=A5=E7=9A=84?= =?UTF-8?q?=E6=80=A7=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1010865 --user=刘瑞斌 【测试跟踪】批量移动功能用例耗时较长 https://www.tapd.cn/55049933/s/1114701 --- .../notice/controller/NoticeController.java | 4 +--- .../notice/service/NoticeService.java | 20 +++++++++++-------- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/backend/src/main/java/io/metersphere/notice/controller/NoticeController.java b/backend/src/main/java/io/metersphere/notice/controller/NoticeController.java index 9dbecfb157..efd5b30723 100644 --- a/backend/src/main/java/io/metersphere/notice/controller/NoticeController.java +++ b/backend/src/main/java/io/metersphere/notice/controller/NoticeController.java @@ -2,7 +2,6 @@ package io.metersphere.notice.controller; import io.metersphere.commons.constants.OperLogConstants; import io.metersphere.commons.constants.OperLogModule; -import io.metersphere.commons.utils.SessionUtils; import io.metersphere.log.annotation.MsAuditLog; import io.metersphere.notice.domain.MessageDetail; import io.metersphere.notice.service.NoticeService; @@ -25,8 +24,7 @@ public class NoticeController { @GetMapping("/search/message/type/{type}") public List searchMessage(@PathVariable String type) { - String projectId = SessionUtils.getCurrentProjectId(); - return noticeService.searchMessageByTypeAndProjectId(type, projectId); + return noticeService.searchMessageByType(type); } @GetMapping("/search/message/{testId}") 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 278aeda102..815cc324ba 100644 --- a/backend/src/main/java/io/metersphere/notice/service/NoticeService.java +++ b/backend/src/main/java/io/metersphere/notice/service/NoticeService.java @@ -111,6 +111,16 @@ public class NoticeService { return scheduleMessageTask; } + public List searchMessageByType(String type) { + try { + String workspaceId = SessionUtils.getCurrentWorkspaceId(); + return getMessageDetails(type, workspaceId); + } catch (Exception e) { + LogUtil.error(e.getMessage(), e); + return new ArrayList<>(); + } + } + public List searchMessageByTypeAndProjectId(String type, String projectId) { try { return getMessageDetails(type, projectId); @@ -122,14 +132,8 @@ public class NoticeService { public List searchMessageByTypeBySend(String type, String projectId) { try { - String workspaceId = ""; - if (null == SessionUtils.getCurrentWorkspaceId()) { - Project project = projectMapper.selectByPrimaryKey(projectId); - workspaceId = project.getWorkspaceId(); - } else { - workspaceId = SessionUtils.getCurrentWorkspaceId(); - } - return getMessageDetails(type, workspaceId); + Project project = projectMapper.selectByPrimaryKey(projectId); + return getMessageDetails(type, project.getWorkspaceId()); } catch (Exception e) { LogUtil.error(e.getMessage(), e); return new ArrayList<>();