Authored by qinchao

手机号码改为通过组加载

package com.monitor.common.config;
import com.util.GetUsersInfoUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import javax.annotation.PostConstruct;
/**
* 告警任务的短信号码 Created by yoho on 2016/5/4.
*/
@Component("snsMobileConfig")
public class SnsMobileConfig {
public static final Logger logger = LoggerFactory.getLogger(SnsMobileConfig.class);
@Autowired
private GetUsersInfoUtil getUsersInfoUtil;
@Value("${base_mobile}")
private String baseMobile;
... ... @@ -30,9 +41,49 @@ public class SnsMobileConfig {
@Value("${java_api_error}")
private String javaApiError;
@Value("${bigdata_mobile}")
private String bigdataMobile;
@PostConstruct
public void init(){
//大数据报警
bigdataMobile=getUsersInfoUtil.getMobileByAlarmGroup("大数据报警");
if(bigdataMobile==null){
bigdataMobile="";
}
/* //JAVAAPI错误报警
javaApiError =getUsersInfoUtil.getMobileByAlarmGroup("JAVAAPI错误报警");
if(javaApiError==null){
javaApiError="";
}
//JAVASERVICE错误报警
javaServiceMobile=getUsersInfoUtil.getMobileByAlarmGroup("JAVASERVICE错误报警");
if(javaServiceMobile==null){
javaServiceMobile="";
}
//REDIS异常报警
redisMobile=getUsersInfoUtil.getMobileByAlarmGroup("REDIS异常报警");
if(redisMobile==null){
redisMobile="";
}
//基础组
baseMobile=getUsersInfoUtil.getMobileByAlarmGroup("基础组");
if(redisMobile==null){
baseMobile="";
}*/
logger.info("初始化手机号码");
logger.info("JAVAAPI错误报警 javaApiError :"+javaApiError);
logger.info("大数据报警 bigdataMobile :"+bigdataMobile);
logger.info("JAVASERVICE错误报警 javaServiceMobile :"+javaServiceMobile);
logger.info("REDIS异常报警 redisMobile :"+redisMobile);
logger.info("基础组 baseMobile :"+baseMobile);
}
public String getBaseMobile() {
return baseMobile;
... ...
... ... @@ -22,9 +22,6 @@ import java.util.*;
public class SwitchService {
private final static Logger logger = LoggerFactory.getLogger("switchLogger");
@Value("${switch_mobile}")
private String switchMobile;
@Autowired
private AlarmMsgService alarmMsgService;
... ... @@ -77,7 +74,7 @@ public class SwitchService {
set.add(code);
String mobile_yunwei_switch_center = getUsersInfoUtil.getMobileByAlarmGroup(AlarmGroupContants.GROUP_NAME_YUNWEI_SWITCH_CENTER);
if(StringUtils.isBlank(mobile_yunwei_switch_center)){
mobile_yunwei_switch_center=switchMobile;
mobile_yunwei_switch_center="18751986615";
}
alarmMsgService.sendSms("switch_mobile", "即将进行双中心切换,请输入以下数字:" + code+"。一分钟内有效", mobile_yunwei_switch_center);
... ... @@ -101,7 +98,7 @@ public class SwitchService {
public void sendSmsCode(String msgCode) {
String mobile_yunwei_switch_center = getUsersInfoUtil.getMobileByAlarmGroup(AlarmGroupContants.GROUP_NAME_YUNWEI_SWITCH_CENTER);
if(StringUtils.isBlank(mobile_yunwei_switch_center)){
mobile_yunwei_switch_center=switchMobile;
mobile_yunwei_switch_center="18751986615";
}
alarmMsgService.sendSms("switch_mobile", "即将进行双中心切换,请输入以下数字:" + msgCode+"。一分钟内有效", mobile_yunwei_switch_center);
}
... ...
... ... @@ -9,7 +9,6 @@ qcloud_sms_url=https://yun.tim.qq.com/v3/tlssmssvr/sendmultisms2?sdkappid=140002
qcloud_sms_key=6e56f948f6f1c0a1bc359e23f7acc140
base_mobile=18751986615,18652008443,18252034289,17361900581,18751886435,17314953523
switch_mobile=18751986615
dns_exception_mobile=18751986615,18652008443,18252034289,17361900581
... ... @@ -20,8 +19,6 @@ java_service_alarm_flag=true
java_service_alarm_cost_threshold=300
java_service_alarm_count_threshold=50
bigdata_mobile=18652925653,18600623107,18651650543,18021522255
java_api_error=18751986615,18652008443,18252034289,13951882433,17361900581,18602555621
SWITCH_DB_URL=http://172.31.56.59:8011/switchdb/switchMysql
\ No newline at end of file
... ...
... ... @@ -9,7 +9,6 @@ qcloud_sms_url=https://yun.tim.qq.com/v3/tlssmssvr/sendmultisms2?sdkappid=140002
qcloud_sms_key=6e56f948f6f1c0a1bc359e23f7acc140
base_mobile=18751986615,18652008443,18252034289,17361900581
switch_mobile=18751986615
dns_exception_mobile=18751986615,18652008443,18252034289,17361900581
... ...
... ... @@ -13,7 +13,6 @@ sendsms.pwd=NCftHmJ9
sendsms.notice.productid=8
base_mobile=15905144483
switch_mobile=17314953523
dns_exception_mobile=15905144483
... ... @@ -26,6 +25,5 @@ java_service_alarm_count_threshold=50
java_api_error=15905144483
bigdata_mobile=18652925653,18502542319
SWITCH_DB_URL=http://127.0.0.1:8011/switchdb/switchMysql
\ No newline at end of file
... ...