fix(用例评审): 修复用例评审时评论通知不能发给维护人的问题

--bug=1020970 --user=刘瑞斌 【消息通知】github #20647,用例评审消息通知,设置评审通知,不生效 https://www.tapd.cn/55049933/s/1317406
This commit is contained in:
CaptainB 2022-12-20 12:02:53 +08:00 committed by 刘瑞斌
parent 4dfe74ebd5
commit fc133714ec
4 changed files with 30 additions and 12 deletions

View File

@ -190,9 +190,9 @@ public abstract class AbstractNoticeSender implements NoticeSender {
.collect(Collectors.toList());
toUsers.addAll(receivers);
}
// 评审评论时这个维护人是创建人
if (paramMap.containsKey("creator")) {
toUsers.add(new Receiver((String) paramMap.get("creator"), NotificationConstants.Type.SYSTEM_NOTICE.name()));
if (paramMap.containsKey("maintainer")) {
toUsers.add(new Receiver((String) paramMap.get("maintainer"), NotificationConstants.Type.SYSTEM_NOTICE.name()));
}
}
break;

View File

@ -0,0 +1,12 @@
package io.metersphere.dto;
import io.metersphere.base.domain.TestCaseReview;
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
public class TestCaseReviewWithMaintainer extends TestCaseReview {
private String maintainer;
}

View File

@ -65,7 +65,7 @@ public class TestCaseCommentService {
*/
@RequiresPermissions(PermissionConstants.PROJECT_TRACK_REVIEW_READ_COMMENT)
@MsAuditLog(module = OperLogModule.TRACK_TEST_CASE_REVIEW, type = OperLogConstants.CREATE, content = "#msClass.getLogDetails(#request.id)", msClass = TestCaseCommentService.class)
@SendNotice(taskType = NoticeConstants.TaskType.REVIEW_TASK, target = "#targetClass.getTestReview(#request.reviewId)", targetClass = TestCaseReviewService.class,
@SendNotice(taskType = NoticeConstants.TaskType.REVIEW_TASK, target = "#targetClass.getTestReviewWithMaintainer(#request)", targetClass = TestCaseReviewService.class,
event = NoticeConstants.Event.COMMENT, subject = "测试评审通知")
public void saveComment(TestCaseReviewTestCaseEditRequest request) {
SaveCommentRequest saveCommentRequest = new SaveCommentRequest();

View File

@ -14,7 +14,7 @@ import io.metersphere.commons.user.SessionUser;
import io.metersphere.commons.utils.JSON;
import io.metersphere.commons.utils.LogUtil;
import io.metersphere.commons.utils.SessionUtils;
import io.metersphere.dto.BaseSystemConfigDTO;
import io.metersphere.dto.*;
import io.metersphere.excel.converter.TestReviewCaseStatus;
import io.metersphere.log.utils.ReflexObjectUtil;
import io.metersphere.log.vo.DetailColumn;
@ -22,10 +22,6 @@ import io.metersphere.log.vo.OperatingLogDetails;
import io.metersphere.log.vo.track.TestCaseReviewReference;
import io.metersphere.notice.sender.NoticeModel;
import io.metersphere.notice.service.NoticeSendService;
import io.metersphere.dto.CountMapDTO;
import io.metersphere.dto.TestCaseDTO;
import io.metersphere.dto.TestCaseReviewDTO;
import io.metersphere.dto.TestReviewDTOWithMetric;
import io.metersphere.request.member.QueryMemberRequest;
import io.metersphere.request.testreview.*;
import org.apache.commons.beanutils.BeanMap;
@ -40,6 +36,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.lang.reflect.InvocationTargetException;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.stream.Collectors;
@ -386,6 +383,15 @@ public class TestCaseReviewService {
return Optional.ofNullable(testCaseReviewMapper.selectByPrimaryKey(reviewId)).orElse(new TestCaseReview());
}
public TestCaseReviewWithMaintainer getTestReviewWithMaintainer(TestCaseReviewTestCaseEditRequest request) throws Exception {
TestCaseReview testCaseReview = testCaseReviewMapper.selectByPrimaryKey(request.getReviewId());
TestCaseReviewWithMaintainer reviewWithMaintainer = new TestCaseReviewWithMaintainer();
BeanUtils.copyProperties(reviewWithMaintainer, testCaseReview);
TestCaseWithBLOBs testCaseWithBLOBs = testCaseMapper.selectByPrimaryKey(request.getCaseId());
reviewWithMaintainer.setMaintainer(testCaseWithBLOBs.getMaintainer());
return reviewWithMaintainer;
}
public void editTestReviewStatus(String reviewId) {
List<String> statusList = extTestReviewCaseMapper.getStatusByReviewId(reviewId);
TestCaseReview testCaseReview = new TestCaseReview();