refactor: 发送邮件代码重构
This commit is contained in:
parent
b5ea0a3d50
commit
c4f1e23291
|
@ -118,6 +118,19 @@ public class MailService {
|
|||
}
|
||||
}
|
||||
|
||||
public void sendCommentNotice(List<String> userIds, SaveCommentRequest request, TestCaseWithBLOBs testCaseWithBLOBs) {
|
||||
Map<String, String> context = new HashMap<>();
|
||||
context.put("maintainer", testCaseWithBLOBs.getMaintainer());
|
||||
context.put("testCaseName", testCaseWithBLOBs.getName());
|
||||
context.put("description", request.getDescription());
|
||||
|
||||
try {
|
||||
String commentTemplate = IOUtils.toString(this.getClass().getResource("/mail/comment.html"), StandardCharsets.UTF_8);
|
||||
sendHtml(userIds, context, commentTemplate);
|
||||
} catch (Exception e) {
|
||||
LogUtil.error(e);
|
||||
}
|
||||
}
|
||||
|
||||
public void sendReviewerNotice(List<String> userIds, SaveTestCaseReviewRequest reviewRequest) {
|
||||
Map<String, String> context = getReviewContext(reviewRequest);
|
||||
|
@ -150,20 +163,6 @@ public class MailService {
|
|||
javaMailSender.send(mimeMessage);
|
||||
}
|
||||
|
||||
public void sendCommentNotice(List<String> userIds, SaveCommentRequest request, TestCaseWithBLOBs testCaseWithBLOBs) {
|
||||
Map<String, String> context = new HashMap<>();
|
||||
context.put("maintainer", testCaseWithBLOBs.getMaintainer());
|
||||
context.put("testCaseName", testCaseWithBLOBs.getName());
|
||||
context.put("description", request.getDescription());
|
||||
|
||||
try {
|
||||
String commentTemplate = IOUtils.toString(this.getClass().getResource("/mail/comment.html"), StandardCharsets.UTF_8);
|
||||
sendHtml(userIds, context, commentTemplate);
|
||||
} catch (Exception e) {
|
||||
LogUtil.error(e);
|
||||
}
|
||||
}
|
||||
|
||||
private Map<String, String> getReviewContext(SaveTestCaseReviewRequest reviewRequest) {
|
||||
Long startTime = reviewRequest.getCreateTime();
|
||||
Long endTime = reviewRequest.getEndTime();
|
||||
|
|
Loading…
Reference in New Issue