fix(消息通知): 修复异步发送消息时不能获取session的问题

This commit is contained in:
CaptainB 2022-03-23 10:27:30 +08:00 committed by CountryBuilder
parent c57c74e99d
commit e384e17a72
1 changed files with 2 additions and 8 deletions

View File

@ -174,14 +174,8 @@ public class ApiDefinitionExecResultService {
.build(); .build();
String taskType = NoticeConstants.TaskType.API_DEFINITION_TASK; String taskType = NoticeConstants.TaskType.API_DEFINITION_TASK;
if (SessionUtils.getUser() != null Project project = projectMapper.selectByPrimaryKey(apiTestCaseWithBLOBs.getProjectId());
&& StringUtils.equals(SessionUtils.getCurrentProjectId(), apiTestCaseWithBLOBs.getProjectId()) noticeSendService.send(project, taskType, noticeModel);
&& StringUtils.isNotEmpty(SessionUtils.getCurrentWorkspaceId())) {
noticeSendService.send(taskType, noticeModel);
} else {
Project project = projectMapper.selectByPrimaryKey(apiTestCaseWithBLOBs.getProjectId());
noticeSendService.send(project, taskType, noticeModel);
}
} catch (Exception e) { } catch (Exception e) {
LogUtil.error("消息发送失败:" + e.getMessage()); LogUtil.error("消息发送失败:" + e.getMessage());
} }