fix:提示信息使用英语
This commit is contained in:
parent
f8ec9f6252
commit
754d55faae
|
@ -21,7 +21,8 @@ public interface SystemClient {
|
|||
Map<String, SysUser> findUserMap();
|
||||
|
||||
@GetMapping("/sys/sendMessage/send")
|
||||
void sendMessage(@RequestParam String message,
|
||||
void sendMessage(@RequestParam String title,
|
||||
@RequestParam String message,
|
||||
@RequestParam String groupId,
|
||||
@RequestParam String notific);
|
||||
|
||||
|
|
|
@ -29,6 +29,8 @@ import org.springframework.data.redis.connection.stream.ObjectRecord;
|
|||
import org.springframework.data.redis.connection.stream.RecordId;
|
||||
import org.springframework.data.redis.stream.StreamListener;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import static org.jeecg.common.constant.enums.MessageTypeEnum.*;
|
||||
import static org.jeecg.common.util.TokenUtils.getTempToken;
|
||||
|
||||
|
@ -139,7 +141,7 @@ public class AnalysisConsumer implements StreamListener<String, ObjectRecord<Str
|
|||
private void judge(Info info, Map<String,String> nuclidesCross){
|
||||
String ONE = "1";String TWO = "2";String THREE = "3";
|
||||
Set<String> nuclideNames = nuclidesCross.keySet();
|
||||
String alarmInfo = "";
|
||||
StringBuilder alarmInfo = new StringBuilder();
|
||||
List<String> firstDetected;
|
||||
List<NuclideInfo> moreThanAvg = new ArrayList<>();
|
||||
String conditionStr = info.getConditions();
|
||||
|
@ -150,8 +152,8 @@ public class AnalysisConsumer implements StreamListener<String, ObjectRecord<Str
|
|||
if (ONE.equals(con)){ // 首次发现该元素
|
||||
firstDetected = firstDetected(betaOrGamma,datasource,nuclideNames);
|
||||
if (CollUtil.isNotEmpty(firstDetected)){
|
||||
String message = "核素"+StrUtil.join(comma,firstDetected)+"首次发现";
|
||||
alarmInfo += message;
|
||||
String message = "First discovery of nuclides: [" + StrUtil.join(comma,firstDetected) + "]";
|
||||
alarmInfo.append(message);
|
||||
}
|
||||
} else if (TWO.equals(con)) { // 元素浓度高于均值
|
||||
moreThanAvg = moreThanAvg(datasource,nuclidesCross);
|
||||
|
@ -159,31 +161,32 @@ public class AnalysisConsumer implements StreamListener<String, ObjectRecord<Str
|
|||
for (NuclideInfo nuclideInfo : moreThanAvg) {
|
||||
String nuclide = nuclideInfo.getNuclide();
|
||||
String threshold = nuclideInfo.getThreshold();
|
||||
String message = "核素"+nuclide+"超出平均值:"+threshold;
|
||||
alarmInfo += comma + message;
|
||||
String message = "Nuclide " + nuclide + "is above average: " + threshold;
|
||||
alarmInfo.append(comma).append(message);
|
||||
}
|
||||
}
|
||||
} else if (THREE.equals(con)) { // 同时出现两种及以上核素
|
||||
if (nuclideNames.size() >= 2){
|
||||
String message = "同时检测到核素"+StrUtil.join(comma,nuclideNames);
|
||||
alarmInfo += comma + message;
|
||||
String message = "Simultaneously detecting nuclides: [" + StrUtil.join(comma,nuclideNames) + "]";
|
||||
alarmInfo.append(comma).append(message);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (StrUtil.isNotBlank(alarmInfo)){
|
||||
if (StrUtil.isNotBlank(alarmInfo.toString())){
|
||||
// 保存报警日志
|
||||
AlarmAnalysisLog logInfo = new AlarmAnalysisLog();
|
||||
BeanUtil.copyProperties(info,logInfo);
|
||||
if (alarmInfo.startsWith(comma))
|
||||
alarmInfo = StrUtil.sub(alarmInfo, 1, alarmInfo.length());
|
||||
logInfo.setAlarmInfo(alarmInfo);
|
||||
if (alarmInfo.toString().startsWith(comma))
|
||||
alarmInfo = new StringBuilder(StrUtil.sub(alarmInfo.toString(), 1, alarmInfo.length()));
|
||||
logInfo.setAlarmInfo(alarmInfo.toString());
|
||||
if (CollUtil.isNotEmpty(moreThanAvg))
|
||||
logInfo.setNuclideInfoList(moreThanAvg);
|
||||
logService.saveLog(logInfo);
|
||||
// 发送报警信息
|
||||
String groupId = info.getGroupId();
|
||||
if (StrUtil.isNotBlank(groupId))
|
||||
systemClient.sendMessage(alarmInfo,groupId, ALL.getValue());
|
||||
systemClient.sendMessage("Nuclide Analysis Warn Message",
|
||||
alarmInfo.toString(),groupId, ALL.getValue());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -12,6 +12,7 @@ import org.jeecg.modules.feignclient.AbnormalAlarmClient;
|
|||
import org.jeecg.modules.system.service.ISysUserService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
@ -48,9 +49,8 @@ public class SendMessage {
|
|||
* 根据联系人组id向用户推送消息
|
||||
*
|
||||
*/
|
||||
public void send(String message,String groupId,String notific){
|
||||
public void send(String title, String message, String groupId, String notific){
|
||||
// 封装MessageDTO消息体
|
||||
String title = "Nuclide System Warning Message";
|
||||
MessageDTO messageDTO = new MessageDTO(title,message);
|
||||
|
||||
Map<String, String> contact = getContact(groupId);
|
||||
|
|
|
@ -15,10 +15,11 @@ public class SendMessageController {
|
|||
private SendMessage sendMessage;
|
||||
|
||||
@GetMapping("send")
|
||||
public void sendMessage(@RequestParam String message,
|
||||
public void sendMessage(@RequestParam String title,
|
||||
@RequestParam String message,
|
||||
@RequestParam String groupId,
|
||||
@RequestParam String notific){
|
||||
sendMessage.send(message, groupId, notific);
|
||||
sendMessage.send(title, message, groupId, notific);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -113,7 +113,7 @@ public class DatabaseJob extends Monitor implements Job{
|
|||
// 发送报警信息
|
||||
String groupId = alarmRule.getContactId();
|
||||
String notific = alarmRule.getNotification();
|
||||
getSendMessage().send(message, groupId, notific);
|
||||
getSendMessage().send("Database Monitor Warn Message", message, groupId, notific);
|
||||
}
|
||||
} catch (JsonProcessingException e) {
|
||||
log.error("Database预警规则: {}解析失败,失败原因: {}", operator, e.getMessage());
|
||||
|
|
|
@ -99,7 +99,7 @@ public class EmailJob extends Monitor implements Job{
|
|||
// 发送报警信息
|
||||
String groupId = alarmRule.getContactId();
|
||||
String notific = alarmRule.getNotification();
|
||||
getSendMessage().send(message, groupId, notific);
|
||||
getSendMessage().send("Email Monitor Warn Message", message, groupId, notific);
|
||||
}
|
||||
} catch (JsonProcessingException e) {
|
||||
log.error("Email预警规则: {}解析失败,失败原因: {}", operator, e.getMessage());
|
||||
|
|
|
@ -112,7 +112,7 @@ public class ServerJob extends Monitor implements Job {
|
|||
// 发送报警信息
|
||||
String groupId = alarmRule.getContactId();
|
||||
String notific = alarmRule.getNotification();
|
||||
getSendMessage().send(message, groupId, notific);
|
||||
getSendMessage().send("Server Monitor Warn Message", message, groupId, notific);
|
||||
}
|
||||
} catch (JsonProcessingException e) {
|
||||
log.error("Server预警规则: {}解析失败,失败原因: {}", operator, e.getMessage());
|
||||
|
|
Loading…
Reference in New Issue
Block a user