[manager,common]邮件页面优化,fix告警级别未转译
This commit is contained in:
@@ -62,4 +62,19 @@ public class CommonUtil {
|
||||
return m.find();
|
||||
}
|
||||
|
||||
/**
|
||||
* 告警级别文字转换
|
||||
* @param priority 告警级别
|
||||
* @return 告警级别文字
|
||||
*/
|
||||
public static String transferAlertPriority(byte priority) {
|
||||
String priorityMsg = "警告告警";
|
||||
switch (priority) {
|
||||
case 0: priorityMsg = "紧急告警"; break;
|
||||
case 1: priorityMsg = "严重告警"; break;
|
||||
case 2: priorityMsg = "警告告警"; break;
|
||||
default: break;
|
||||
}
|
||||
return priorityMsg;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package com.usthe.manager.service.impl;
|
||||
|
||||
import com.usthe.common.entity.alerter.Alert;
|
||||
import com.usthe.common.util.CommonUtil;
|
||||
import com.usthe.manager.service.MailService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.thymeleaf.TemplateEngine;
|
||||
import org.thymeleaf.context.Context;
|
||||
@@ -16,7 +16,6 @@ import javax.annotation.Resource;
|
||||
* @author 花城
|
||||
* @version 1.0
|
||||
* @date 2022/2/19 6:13 下午
|
||||
* @Description
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
@@ -30,9 +29,9 @@ public class MailServiceImpl implements MailService {
|
||||
// 引入thymeleaf上下文参数渲染页面
|
||||
Context context = new Context();
|
||||
context.setVariable("target",alert.getTarget());
|
||||
context.setVariable("ID",alert.getMonitorId());
|
||||
context.setVariable("name",alert.getMonitorName());
|
||||
context.setVariable("priority",alert.getPriority());
|
||||
context.setVariable("monitorId",alert.getMonitorId());
|
||||
context.setVariable("monitorName",alert.getMonitorName());
|
||||
context.setVariable("priority", CommonUtil.transferAlertPriority(alert.getPriority()));
|
||||
context.setVariable("content",alert.getContent());
|
||||
return templateEngine.process("mailAlarm", context);
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user