feat(项目设置): 邮件通知测试计划阶段调整为中文

--story=1012490 --user=宋昌昌 【BUG转需求】【富国基金】邮件发送模板,希望测试计划阶段调整为中文的。目前是(smoke,system) 英文显示的 https://www.tapd.cn/55049933/s/1397512
This commit is contained in:
song-cc-rock 2023-07-26 10:33:49 +08:00 committed by 刘瑞斌
parent b59d8e8abf
commit 015596d07b
1 changed files with 11 additions and 0 deletions

View File

@ -3,6 +3,7 @@ package io.metersphere.notice.sender;
import io.metersphere.commons.constants.NoticeConstants; import io.metersphere.commons.constants.NoticeConstants;
import io.metersphere.commons.user.SessionUser; import io.metersphere.commons.user.SessionUser;
import io.metersphere.dto.BaseSystemConfigDTO; import io.metersphere.dto.BaseSystemConfigDTO;
import io.metersphere.log.vo.StatusReference;
import io.metersphere.notice.annotation.SendNotice; import io.metersphere.notice.annotation.SendNotice;
import io.metersphere.notice.service.NoticeSendService; import io.metersphere.notice.service.NoticeSendService;
import io.metersphere.service.SystemParameterService; import io.metersphere.service.SystemParameterService;
@ -35,6 +36,8 @@ public class AfterReturningNoticeSendService {
paramMap.putIfAbsent("projectId", currentProjectId); paramMap.putIfAbsent("projectId", currentProjectId);
// 占位符 // 占位符
handleDefaultValues(paramMap); handleDefaultValues(paramMap);
// 处理resource中特殊值
handleSpecialValues(paramMap);
String context = getContext(sendNotice, paramMap); String context = getContext(sendNotice, paramMap);
@ -58,6 +61,14 @@ public class AfterReturningNoticeSendService {
paramMap.put("planShareUrl", StringUtils.EMPTY); // 占位符 paramMap.put("planShareUrl", StringUtils.EMPTY); // 占位符
} }
private void handleSpecialValues(Map paramMap) {
// 翻译${stage}占位符
String key = "stage";
if (paramMap.containsKey(key) && paramMap.get(key) != null) {
paramMap.put(key, StatusReference.statusMap.get(paramMap.get("stage").toString()));
}
}
private String getContext(SendNotice sendNotice, Map<String, Object> paramMap) { private String getContext(SendNotice sendNotice, Map<String, Object> paramMap) {
String operation = ""; String operation = "";
switch (sendNotice.event()) { switch (sendNotice.event()) {