perf(消息通知): 优化发送通知的性能
--bug=1010865 --user=刘瑞斌 【测试跟踪】批量移动功能用例耗时较长 https://www.tapd.cn/55049933/s/1114701
This commit is contained in:
parent
fb9ebd3811
commit
e9dfddd8c5
|
@ -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<MessageDetail> searchMessage(@PathVariable String type) {
|
||||
String projectId = SessionUtils.getCurrentProjectId();
|
||||
return noticeService.searchMessageByTypeAndProjectId(type, projectId);
|
||||
return noticeService.searchMessageByType(type);
|
||||
}
|
||||
|
||||
@GetMapping("/search/message/{testId}")
|
||||
|
|
|
@ -111,6 +111,16 @@ public class NoticeService {
|
|||
return scheduleMessageTask;
|
||||
}
|
||||
|
||||
public List<MessageDetail> 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<MessageDetail> searchMessageByTypeAndProjectId(String type, String projectId) {
|
||||
try {
|
||||
return getMessageDetails(type, projectId);
|
||||
|
@ -122,14 +132,8 @@ public class NoticeService {
|
|||
|
||||
public List<MessageDetail> 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<>();
|
||||
|
|
Loading…
Reference in New Issue