Authored by skinny.wu

短息告警服务 sendMsg()方法增加一个重载方法,比原来方法多一个String alarmInfo参数,兼容原来方法

@@ -6,4 +6,6 @@ package com.monitor.common.service; @@ -6,4 +6,6 @@ package com.monitor.common.service;
6 public interface AlarmMsgService { 6 public interface AlarmMsgService {
7 7
8 public boolean sendSms(String type, String content, String mobile); 8 public boolean sendSms(String type, String content, String mobile);
  9 +
  10 + boolean sendSms(String type, String content, String alarmInfo, String mobile);
9 } 11 }
@@ -46,6 +46,21 @@ public class AlarmMsgServiceImpl implements AlarmMsgService { @@ -46,6 +46,21 @@ public class AlarmMsgServiceImpl implements AlarmMsgService {
46 */ 46 */
47 @Override 47 @Override
48 public boolean sendSms(String type, String content, String mobile) { 48 public boolean sendSms(String type, String content, String mobile) {
  49 +
  50 + return sendSms(type, content, "", mobile);
  51 + }
  52 +
  53 + /**
  54 + * 发送短信
  55 + *
  56 + * @param type
  57 + * @param content
  58 + * @param alarmInfo
  59 + * @param mobile
  60 + * @return
  61 + */
  62 + @Override
  63 + public boolean sendSms(String type, String content, String alarmInfo, String mobile) {
49 Map<String, String> contentMap = new HashMap<String, String>(); 64 Map<String, String> contentMap = new HashMap<String, String>();
50 contentMap.put("OperID", sendsmsConfig.getUserName()); 65 contentMap.put("OperID", sendsmsConfig.getUserName());
51 contentMap.put("OperPass", sendsmsConfig.getPwd()); 66 contentMap.put("OperPass", sendsmsConfig.getPwd());
@@ -75,7 +90,7 @@ public class AlarmMsgServiceImpl implements AlarmMsgService { @@ -75,7 +90,7 @@ public class AlarmMsgServiceImpl implements AlarmMsgService {
75 } 90 }
76 91
77 try { 92 try {
78 - monitorAlarmMapper.insertAlarmMsg(InfluxDBContants.AWS, type, content, "", sendStatus ? "successed" : "failed"); 93 + monitorAlarmMapper.insertAlarmMsg(InfluxDBContants.AWS, type, content, alarmInfo, sendStatus ? "successed" : "failed");
79 }catch (Exception e){ 94 }catch (Exception e){
80 logger.error("insert sms into influxdb failed",e); 95 logger.error("insert sms into influxdb failed",e);
81 } 96 }