mirror of
https://gitee.com/fit2cloud-feizhiyun/MeterSphere.git
synced 2024-12-05 05:29:29 +08:00
fix(缺陷管理): 修复缺陷评论通知及关注人通知相关问题
--bug=1036462 --user=宋昌昌 【项目管理】消息管理-缺陷评论-关注人-发送消息后飞书可以收到,其他未收到 https://www.tapd.cn/55049933/s/1467978
This commit is contained in:
parent
c810f8b8d3
commit
e9ddb78d89
@ -55,12 +55,12 @@ public class BugCommentNoticeService {
|
||||
* 发送缺陷通知
|
||||
*/
|
||||
@Async
|
||||
public void sendNotice(BugCommentEditRequest request, BugCommentNoticeDTO noticeDTO, String currentUser) {
|
||||
public void sendNotice(String event, BugCommentNoticeDTO noticeDTO, String currentUser) {
|
||||
User user = userMapper.selectByPrimaryKey(currentUser);
|
||||
Map<String, String> defaultTemplateMap = MessageTemplateUtils.getDefaultTemplateMap();
|
||||
String template = defaultTemplateMap.get(NoticeConstants.TaskType.BUG_TASK + "_" + request.getEvent());
|
||||
String template = defaultTemplateMap.get(NoticeConstants.TaskType.BUG_TASK + "_" + event);
|
||||
Map<String, String> defaultSubjectMap = MessageTemplateUtils.getDefaultTemplateSubjectMap();
|
||||
String subject = defaultSubjectMap.get(NoticeConstants.TaskType.BUG_TASK + "_" + request.getEvent());
|
||||
String subject = defaultSubjectMap.get(NoticeConstants.TaskType.BUG_TASK + "_" + event);
|
||||
BeanMap beanMap = new BeanMap(noticeDTO);
|
||||
Map paramMap = new HashMap<>(beanMap);
|
||||
paramMap.put(NoticeConstants.RelatedUser.OPERATOR, user.getName());
|
||||
@ -69,7 +69,7 @@ public class BugCommentNoticeService {
|
||||
.context(template)
|
||||
.subject(subject)
|
||||
.paramMap(paramMap)
|
||||
.event(request.getEvent())
|
||||
.event(event)
|
||||
.status((String) paramMap.get("status"))
|
||||
.excludeSelf(true)
|
||||
.relatedUsers(getRelateUser(noticeDTO.getNotifier()))
|
||||
@ -91,7 +91,7 @@ public class BugCommentNoticeService {
|
||||
|
||||
/**
|
||||
* 评论通知@用户处理与功能用例保持一致即可, 根据事件类型设置通知人
|
||||
* 如果是REPLAY事件,需要判断有无@的人,如果有@的人且和当前被回复的人不是同一人,这里只被回复的人,如果是同一人,这里通知人为空,走AT事件
|
||||
* 如果是REPLAY事件, 需要判断有无@的人, 如果有@的人且和当前被回复的人不是同一人, 这里只通知被回复的人; 如果是同一人, 这里通知人为空, 走AT事件
|
||||
* 如果不是REPLAY事件,需要判断有无被回复的人,如果被回复的人不在被@人里,则用页面参数传递的通知人,如果在,则排除这个人,如果没有被回复的人,用页面数据
|
||||
*
|
||||
* @param request 页面请求参数
|
||||
|
@ -161,11 +161,11 @@ public class BugCommentService {
|
||||
bugCommentMapper.insertSelective(bugComment);
|
||||
// 回复通知
|
||||
BugCommentNoticeDTO bugCommentNotice = bugCommentNoticeService.getBugCommentNotice(request);
|
||||
bugCommentNoticeService.sendNotice(request, bugCommentNotice, currentUser);
|
||||
bugCommentNoticeService.sendNotice(NoticeConstants.Event.REPLY, bugCommentNotice, currentUser);
|
||||
// @通知
|
||||
request.setEvent(NoticeConstants.Event.AT);
|
||||
bugCommentNotice = bugCommentNoticeService.getBugCommentNotice(request);
|
||||
bugCommentNoticeService.sendNotice(request, bugCommentNotice, currentUser);
|
||||
bugCommentNoticeService.sendNotice(NoticeConstants.Event.AT, bugCommentNotice, currentUser);
|
||||
return bugComment;
|
||||
}
|
||||
|
||||
@ -184,10 +184,10 @@ public class BugCommentService {
|
||||
* 如果通知@人为空, 只发送评论通知.
|
||||
*/
|
||||
BugCommentNoticeDTO bugCommentNotice = bugCommentNoticeService.getBugCommentNotice(request);
|
||||
bugCommentNoticeService.sendNotice(request, bugCommentNotice, currentUser);
|
||||
bugCommentNoticeService.sendNotice(request.getEvent(), bugCommentNotice, currentUser);
|
||||
if (StringUtils.equals(request.getEvent(), NoticeConstants.Event.AT)) {
|
||||
request.setEvent(NoticeConstants.Event.COMMENT);
|
||||
bugCommentNoticeService.sendNotice(request, bugCommentNotice, currentUser);
|
||||
// 评论通知
|
||||
bugCommentNoticeService.sendNotice(NoticeConstants.Event.COMMENT, bugCommentNotice, currentUser);
|
||||
}
|
||||
return bugComment;
|
||||
}
|
||||
@ -213,7 +213,7 @@ public class BugCommentService {
|
||||
request.setEvent(NoticeConstants.Event.AT);
|
||||
}
|
||||
BugCommentNoticeDTO bugCommentNotice = bugCommentNoticeService.getBugCommentNotice(request);
|
||||
bugCommentNoticeService.sendNotice(request, bugCommentNotice, currentUser);
|
||||
bugCommentNoticeService.sendNotice(request.getEvent(), bugCommentNotice, currentUser);
|
||||
return bugComment;
|
||||
}
|
||||
|
||||
|
@ -44,6 +44,7 @@ public class BugNoticeService {
|
||||
// 获取状态选项, 处理人选项
|
||||
Map<String, String> statusMap = getStatusMap(request.getProjectId());
|
||||
Map<String, String> handlerMap = getHandleMap(request.getProjectId());
|
||||
if (StringUtils.isEmpty(request.getId())) {
|
||||
// 构建通知对象
|
||||
BugNoticeDTO notice = new BugNoticeDTO();
|
||||
notice.setTitle(request.getTitle());
|
||||
@ -71,6 +72,10 @@ public class BugNoticeService {
|
||||
notice.setCustomFields(fields);
|
||||
}
|
||||
return notice;
|
||||
} else {
|
||||
// 需设置业务ID(用来通知关注人), 创建人
|
||||
return getNoticeById(request.getId());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -15,6 +15,9 @@ import java.util.List;
|
||||
@AllArgsConstructor
|
||||
public class BugNoticeDTO {
|
||||
|
||||
@Schema(description ="message.domain.bug_num")
|
||||
private String id;
|
||||
|
||||
@Schema(description ="message.domain.bug_title")
|
||||
private String title;
|
||||
|
||||
|
@ -7,6 +7,9 @@ import io.metersphere.api.domain.ApiScenarioFollower;
|
||||
import io.metersphere.api.domain.ApiScenarioFollowerExample;
|
||||
import io.metersphere.api.mapper.ApiDefinitionFollowerMapper;
|
||||
import io.metersphere.api.mapper.ApiScenarioFollowerMapper;
|
||||
import io.metersphere.bug.domain.BugFollower;
|
||||
import io.metersphere.bug.domain.BugFollowerExample;
|
||||
import io.metersphere.bug.mapper.BugFollowerMapper;
|
||||
import io.metersphere.functional.domain.CaseReviewFollower;
|
||||
import io.metersphere.functional.domain.CaseReviewFollowerExample;
|
||||
import io.metersphere.functional.domain.FunctionalCaseFollower;
|
||||
@ -41,6 +44,8 @@ import java.util.stream.Collectors;
|
||||
|
||||
public abstract class AbstractNoticeSender implements NoticeSender {
|
||||
|
||||
@Resource
|
||||
private BugFollowerMapper bugFollowerMapper;
|
||||
@Resource
|
||||
private TestPlanFollowerMapper testPlanFollowerMapper;
|
||||
@Resource
|
||||
@ -212,6 +217,15 @@ public abstract class AbstractNoticeSender implements NoticeSender {
|
||||
.map(t -> new Receiver(t.getUserId(), NotificationConstants.Type.SYSTEM_NOTICE.name()))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
case NoticeConstants.TaskType.BUG_TASK -> {
|
||||
BugFollowerExample bugFollowerExample = new BugFollowerExample();
|
||||
bugFollowerExample.createCriteria().andBugIdEqualTo(id);
|
||||
List<BugFollower> bugFollowers = bugFollowerMapper.selectByExample(bugFollowerExample);
|
||||
receivers = bugFollowers
|
||||
.stream()
|
||||
.map(t -> new Receiver(t.getUserId(), NotificationConstants.Type.SYSTEM_NOTICE.name()))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
default -> {
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user