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()); .collect(Collectors.toList());
toUsers.addAll(receivers); toUsers.addAll(receivers);
} }
// 评审评论时这个维护人是创建人
if (paramMap.containsKey("creator")) { if (paramMap.containsKey("maintainer")) {
toUsers.add(new Receiver((String) paramMap.get("creator"), NotificationConstants.Type.SYSTEM_NOTICE.name())); toUsers.add(new Receiver((String) paramMap.get("maintainer"), NotificationConstants.Type.SYSTEM_NOTICE.name()));
} }
} }
break; 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) @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) @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 = "测试评审通知") event = NoticeConstants.Event.COMMENT, subject = "测试评审通知")
public void saveComment(TestCaseReviewTestCaseEditRequest request) { public void saveComment(TestCaseReviewTestCaseEditRequest request) {
SaveCommentRequest saveCommentRequest = new SaveCommentRequest(); 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.JSON;
import io.metersphere.commons.utils.LogUtil; import io.metersphere.commons.utils.LogUtil;
import io.metersphere.commons.utils.SessionUtils; import io.metersphere.commons.utils.SessionUtils;
import io.metersphere.dto.BaseSystemConfigDTO; import io.metersphere.dto.*;
import io.metersphere.excel.converter.TestReviewCaseStatus; import io.metersphere.excel.converter.TestReviewCaseStatus;
import io.metersphere.log.utils.ReflexObjectUtil; import io.metersphere.log.utils.ReflexObjectUtil;
import io.metersphere.log.vo.DetailColumn; 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.log.vo.track.TestCaseReviewReference;
import io.metersphere.notice.sender.NoticeModel; import io.metersphere.notice.sender.NoticeModel;
import io.metersphere.notice.service.NoticeSendService; 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.member.QueryMemberRequest;
import io.metersphere.request.testreview.*; import io.metersphere.request.testreview.*;
import org.apache.commons.beanutils.BeanMap; import org.apache.commons.beanutils.BeanMap;
@ -40,6 +36,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.lang.reflect.InvocationTargetException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -131,7 +128,7 @@ public class TestCaseReviewService {
return new ArrayList<>(); return new ArrayList<>();
}*/ }*/
//update reviewerId //update reviewerId
if(StringUtils.equalsIgnoreCase(request.getReviewerId(),"currentUserId")){ if (StringUtils.equalsIgnoreCase(request.getReviewerId(), "currentUserId")) {
request.setReviewerId(SessionUtils.getUserId()); request.setReviewerId(SessionUtils.getUserId());
} }
return extTestCaseReviewMapper.list(request); return extTestCaseReviewMapper.list(request);
@ -256,7 +253,7 @@ public class TestCaseReviewService {
TestCaseReviewFollowExample example = new TestCaseReviewFollowExample(); TestCaseReviewFollowExample example = new TestCaseReviewFollowExample();
example.createCriteria().andReviewIdEqualTo(id).andFollowIdNotIn(follows); example.createCriteria().andReviewIdEqualTo(id).andFollowIdNotIn(follows);
testCaseReviewFollowMapper.deleteByExample(example); testCaseReviewFollowMapper.deleteByExample(example);
}else { } else {
TestCaseReviewFollowExample example = new TestCaseReviewFollowExample(); TestCaseReviewFollowExample example = new TestCaseReviewFollowExample();
example.createCriteria().andReviewIdEqualTo(testCaseReview.getId()); example.createCriteria().andReviewIdEqualTo(testCaseReview.getId());
testCaseReviewFollowMapper.deleteByExample(example); testCaseReviewFollowMapper.deleteByExample(example);
@ -386,6 +383,15 @@ public class TestCaseReviewService {
return Optional.ofNullable(testCaseReviewMapper.selectByPrimaryKey(reviewId)).orElse(new TestCaseReview()); 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) { public void editTestReviewStatus(String reviewId) {
List<String> statusList = extTestReviewCaseMapper.getStatusByReviewId(reviewId); List<String> statusList = extTestReviewCaseMapper.getStatusByReviewId(reviewId);
TestCaseReview testCaseReview = new TestCaseReview(); TestCaseReview testCaseReview = new TestCaseReview();
@ -395,7 +401,7 @@ public class TestCaseReviewService {
testCaseReview.setStatus(TestCaseReviewStatus.Underway.name()); testCaseReview.setStatus(TestCaseReviewStatus.Underway.name());
testCaseReviewMapper.updateByPrimaryKeySelective(testCaseReview); testCaseReviewMapper.updateByPrimaryKeySelective(testCaseReview);
return; return;
} else if(statusList.contains(TestReviewCaseStatus.UnPass.name())){ } else if (statusList.contains(TestReviewCaseStatus.UnPass.name())) {
testCaseReview.setStatus(TestCaseReviewStatus.Finished.name()); testCaseReview.setStatus(TestCaseReviewStatus.Finished.name());
testCaseReviewMapper.updateByPrimaryKeySelective(testCaseReview); testCaseReviewMapper.updateByPrimaryKeySelective(testCaseReview);
return; return;