fix: i18n

This commit is contained in:
wenyann 2020-11-13 17:06:40 +08:00
parent e26d3a668e
commit eba91d88d2
4 changed files with 17 additions and 12 deletions

View File

@ -24,6 +24,7 @@ import org.apache.commons.collections4.MapUtils;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.RegExUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.mail.MailException;
import org.springframework.mail.javamail.JavaMailSenderImpl;
import org.springframework.mail.javamail.MimeMessageHelper;
import org.springframework.stereotype.Service;
@ -99,10 +100,10 @@ public class MailService {
MimeMessageHelper helper = new MimeMessageHelper(mimeMessage, true);
helper.setFrom(javaMailSender.getUsername());
if (StringUtils.equals(type, NoticeConstants.API)) {
helper.setSubject("MeterSphere平台" + Translator.get("task_notification"));
helper.setSubject("MeterSphere平台" + Translator.get("task_notification_jenkins"));
}
if (StringUtils.equals(type, NoticeConstants.SCHEDULE)) {
helper.setSubject("MeterSphere平台" + Translator.get("task_notification_"));
helper.setSubject("MeterSphere平台" + Translator.get("task_notification"));
}
String[] users;
List<String> emails = new ArrayList<>();
@ -113,7 +114,11 @@ public class MailService {
users = emails.toArray(new String[0]);
helper.setText(getContent(Template, context), true);
helper.setTo(users);
javaMailSender.send(mimeMessage);
try {
javaMailSender.send(mimeMessage);
} catch (MailException e) {
LogUtil.error(e);
}
}
//测试评审
@ -341,7 +346,7 @@ public class MailService {
JavaMailSenderImpl javaMailSender = new JavaMailSenderImpl();
List<SystemParameter> paramList = systemParameterService.getParamList(ParamConstants.Classify.MAIL.getValue());
javaMailSender.setDefaultEncoding("UTF-8");
javaMailSender.setProtocol("smtp");
javaMailSender.setProtocol("smtps");
for (SystemParameter p : paramList) {
switch (p.getParamKey()) {
case "smtp.host":
@ -362,8 +367,8 @@ public class MailService {
}
Properties props = new Properties();
props.put("mail.smtp.auth", "true");
props.put("mail.smtp.starttls.enable", "false");
props.put("mail.smtp.starttls.required", "false");
props.put("mail.smtp.starttls.enable", "true");
props.put("mail.smtp.starttls.required", "true");
props.put("mail.smtp.timeout", "30000");
props.put("mail.smtp.connectiontimeout", "5000");
javaMailSender.setJavaMailProperties(props);

View File

@ -167,8 +167,8 @@ check_owner_comment=The current user does not have permission to manipulate this
upload_content_is_null=Imported content is empty
test_plan_notification=Test plan notification
task_defect_notification=Task defect notification
task_notification=Jenkins Task notification
task_notification_=Timing task result notification
task_notification_jenkins=Jenkins Task notification
task_notification=Result notification

View File

@ -168,5 +168,5 @@ check_owner_comment=当前用户没有操作此评论的权限
upload_content_is_null=导入内容为空
test_plan_notification=测试计划通知
task_defect_notification=缺陷任务通知
task_notification=jenkins任务通知
task_notification_=定时任务结果通知
task_notification_jenkins=jenkins任务通知
task_notification=任务通知

View File

@ -169,6 +169,6 @@ check_owner_comment=當前用戶沒有操作此評論的權限
upload_content_is_null=導入內容為空
test_plan_notification=測試計畫通知
task_defect_notification=缺陷任務通知
task_notification=jenkins任務通知
task_notification_=定時任務通知
task_notification_jenkins=jenkins任務通知
task_notification=任務通知