feat(通用设置): 评审评论为空不用发送通知

--bug=1033257 --user=宋昌昌 【通用设置】github#27749,消息通知-设置用例评审评论发送邮件,用例评审批量编辑通过未评论也发送邮件 https://www.tapd.cn/55049933/s/1447074
This commit is contained in:
song-cc-rock 2023-12-21 17:02:07 +08:00 committed by 刘瑞斌
parent 0cc2336a3c
commit 1cb5b5b2f3
2 changed files with 8 additions and 5 deletions

View File

@ -14,6 +14,7 @@ import io.metersphere.commons.utils.JSON;
import io.metersphere.commons.utils.SessionUtils; import io.metersphere.commons.utils.SessionUtils;
import io.metersphere.constants.TestCaseCommentType; import io.metersphere.constants.TestCaseCommentType;
import io.metersphere.constants.TestCaseReviewCommentStatus; import io.metersphere.constants.TestCaseReviewCommentStatus;
import io.metersphere.dto.TestCaseCommentDTO;
import io.metersphere.i18n.Translator; import io.metersphere.i18n.Translator;
import io.metersphere.log.annotation.MsAuditLog; import io.metersphere.log.annotation.MsAuditLog;
import io.metersphere.log.utils.ReflexObjectUtil; import io.metersphere.log.utils.ReflexObjectUtil;
@ -21,15 +22,14 @@ import io.metersphere.log.vo.DetailColumn;
import io.metersphere.log.vo.OperatingLogDetails; import io.metersphere.log.vo.OperatingLogDetails;
import io.metersphere.log.vo.track.TestCaseReviewReference; import io.metersphere.log.vo.track.TestCaseReviewReference;
import io.metersphere.notice.annotation.SendNotice; import io.metersphere.notice.annotation.SendNotice;
import io.metersphere.dto.TestCaseCommentDTO;
import io.metersphere.request.testreview.SaveCommentRequest; import io.metersphere.request.testreview.SaveCommentRequest;
import io.metersphere.request.testreview.TestCaseReviewTestCaseEditRequest; import io.metersphere.request.testreview.TestCaseReviewTestCaseEditRequest;
import jakarta.annotation.Resource;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.shiro.authz.annotation.RequiresPermissions; import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import jakarta.annotation.Resource;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
@ -82,7 +82,7 @@ public class TestCaseCommentService {
} }
public void saveReviewCommentWithoutNotification(TestCaseReviewTestCaseEditRequest request) { public void saveReviewCommentWithoutNotification(TestCaseReviewTestCaseEditRequest request) {
// 不走String代理不会发送通知 // 不走Spring代理不会发送通知
saveReviewComment(request); saveReviewComment(request);
} }
@ -110,7 +110,7 @@ public class TestCaseCommentService {
} }
public List<TestCaseCommentDTO> getCaseComments(String caseId) { public List<TestCaseCommentDTO> getCaseComments(String caseId) {
return this.getCaseComments(caseId, null); return getCaseComments(caseId, null);
} }
public void deleteCaseComment(String caseId) { public void deleteCaseComment(String caseId) {

View File

@ -496,7 +496,10 @@ public class TestReviewTestCaseService {
testCaseReviewTestCase.setComment(request.getDescription()); testCaseReviewTestCase.setComment(request.getDescription());
testCaseReviewTestCase.setCaseId(caseId); testCaseReviewTestCase.setCaseId(caseId);
testCaseReviewTestCase.setReviewId(request.getReviewId()); testCaseReviewTestCase.setReviewId(request.getReviewId());
testCaseCommentService.saveReviewComment(testCaseReviewTestCase); if (StringUtils.isNotBlank(testCaseReviewTestCase.getComment())) {
// 批量编辑评论不为空, 保存并发送通知
testCaseCommentService.saveReviewComment(testCaseReviewTestCase);
}
}); });
} }