From 038a26a7ccc6fa8950bca9d346a9e19b270dacac Mon Sep 17 00:00:00 2001 From: CaptainB Date: Fri, 11 Mar 2022 14:00:10 +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 --- .../notice/sender/AfterReturningNoticeSendService.java | 2 -- .../main/java/io/metersphere/notice/sender/NoticeSender.java | 2 -- .../java/io/metersphere/notice/service/NoticeSendService.java | 4 ++++ .../java/io/metersphere/notice/service/NoticeService.java | 3 --- 4 files changed, 4 insertions(+), 7 deletions(-) diff --git a/backend/src/main/java/io/metersphere/notice/sender/AfterReturningNoticeSendService.java b/backend/src/main/java/io/metersphere/notice/sender/AfterReturningNoticeSendService.java index d688d5d0ca..5011a680bd 100644 --- a/backend/src/main/java/io/metersphere/notice/sender/AfterReturningNoticeSendService.java +++ b/backend/src/main/java/io/metersphere/notice/sender/AfterReturningNoticeSendService.java @@ -9,7 +9,6 @@ import io.metersphere.notice.service.NoticeSendService; import io.metersphere.service.SystemParameterService; import org.apache.commons.beanutils.BeanMap; import org.apache.commons.lang3.StringUtils; -import org.springframework.scheduling.annotation.Async; import org.springframework.stereotype.Component; import javax.annotation.Resource; @@ -25,7 +24,6 @@ public class AfterReturningNoticeSendService { @Resource private NoticeSendService noticeSendService; - @Async public void sendNotice(SendNotice sendNotice, Object retValue, SessionUser sessionUser, String currentProjectId) { // List resources = new ArrayList<>(); diff --git a/backend/src/main/java/io/metersphere/notice/sender/NoticeSender.java b/backend/src/main/java/io/metersphere/notice/sender/NoticeSender.java index 11d348d365..a3186609d9 100644 --- a/backend/src/main/java/io/metersphere/notice/sender/NoticeSender.java +++ b/backend/src/main/java/io/metersphere/notice/sender/NoticeSender.java @@ -1,9 +1,7 @@ package io.metersphere.notice.sender; import io.metersphere.notice.domain.MessageDetail; -import org.springframework.scheduling.annotation.Async; public interface NoticeSender { - @Async void send(MessageDetail messageDetail, NoticeModel noticeModel); } diff --git a/backend/src/main/java/io/metersphere/notice/service/NoticeSendService.java b/backend/src/main/java/io/metersphere/notice/service/NoticeSendService.java index a8f948bab9..0f3c86dc78 100644 --- a/backend/src/main/java/io/metersphere/notice/service/NoticeSendService.java +++ b/backend/src/main/java/io/metersphere/notice/service/NoticeSendService.java @@ -9,6 +9,7 @@ import io.metersphere.notice.sender.NoticeModel; import io.metersphere.notice.sender.impl.*; import org.apache.commons.lang3.SerializationUtils; import org.apache.commons.lang3.StringUtils; +import org.springframework.scheduling.annotation.Async; import org.springframework.stereotype.Component; import javax.annotation.Resource; @@ -59,6 +60,7 @@ public class NoticeSendService { /** * 在线操作发送通知 */ + @Async public void send(String taskType, NoticeModel noticeModel) { try { String projectId = (String) noticeModel.getParamMap().get("projectId"); @@ -81,6 +83,7 @@ public class NoticeSendService { /** * jenkins 和定时任务触发的发送 */ + @Async public void send(String triggerMode, String taskType, NoticeModel noticeModel) { // api和定时任务调用不排除自己 noticeModel.setExcludeSelf(false); @@ -119,6 +122,7 @@ public class NoticeSendService { /** * 后台触发的发送,没有session */ + @Async public void send(Project project, String taskType, NoticeModel noticeModel) { try { List messageDetails; 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 e7ba9fe5e3..18612829f6 100644 --- a/backend/src/main/java/io/metersphere/notice/service/NoticeService.java +++ b/backend/src/main/java/io/metersphere/notice/service/NoticeService.java @@ -4,7 +4,6 @@ import com.alibaba.fastjson.JSON; import io.metersphere.base.domain.MessageTask; import io.metersphere.base.domain.MessageTaskExample; import io.metersphere.base.mapper.MessageTaskMapper; -import io.metersphere.base.mapper.ProjectMapper; import io.metersphere.commons.exception.MSException; import io.metersphere.commons.utils.LogUtil; import io.metersphere.commons.utils.SessionUtils; @@ -29,8 +28,6 @@ import java.util.stream.Collectors; public class NoticeService { @Resource private MessageTaskMapper messageTaskMapper; - @Resource - private ProjectMapper projectMapper; public void saveMessageTask(MessageDetail messageDetail) { MessageTaskExample example = new MessageTaskExample();