...
|
...
|
@@ -5,6 +5,7 @@ import com.monitor.common.config.SendsmsConfig; |
|
|
import com.monitor.common.service.AlarmMsgService;
|
|
|
import com.monitor.common.service.HttpRestClientService;
|
|
|
import com.monitor.common.util.MD5Util;
|
|
|
import com.monitor.common.util.ZkClientUtil;
|
|
|
import com.monitor.influxdb.contants.InfluxDBContants;
|
|
|
import com.monitor.influxdb.mapper.MonitorAlarmMapper;
|
|
|
import com.monitor.model.domain.QcloudSms;
|
...
|
...
|
@@ -37,6 +38,9 @@ public class AlarmMsgServiceImpl implements AlarmMsgService { |
|
|
@Autowired
|
|
|
private MonitorAlarmMapper monitorAlarmMapper;
|
|
|
|
|
|
@Autowired
|
|
|
private ZkClientUtil zkClient;
|
|
|
|
|
|
private Logger logger = LoggerFactory.getLogger(AlarmMsgServiceImpl.class);
|
|
|
|
|
|
|
...
|
...
|
@@ -44,6 +48,9 @@ public class AlarmMsgServiceImpl implements AlarmMsgService { |
|
|
|
|
|
private Map<String, Long> msgSentLogMap = new HashMap<>();
|
|
|
|
|
|
private String ZK_PATH = "/yh/config/";
|
|
|
private String smsSendSwitch="ops.sendsms.open";
|
|
|
|
|
|
/**
|
|
|
* 发送短信
|
|
|
*
|
...
|
...
|
@@ -70,21 +77,18 @@ public class AlarmMsgServiceImpl implements AlarmMsgService { |
|
|
}
|
|
|
|
|
|
private boolean sendSmsPrivate(String type, String content, String alarmInfo, String mobile,boolean checkZkOpen) {
|
|
|
/*
|
|
|
//所有的发送信息都不需要校验了
|
|
|
if(checkZkOpen){
|
|
|
String open = zookeeperService.getData("ops.sendsms.open");
|
|
|
|
|
|
if (!"true".equals(open)){
|
|
|
logger.info("Send msg type {} content {} alarmInfo {} moniole {}...refused open {}", type, content, alarmInfo, mobile,open);
|
|
|
return false;
|
|
|
}
|
|
|
}*/
|
|
|
//无需发送
|
|
|
/* if (true) {
|
|
|
return true;
|
|
|
//根据zk的开关判断是否需要发送数据
|
|
|
String open="";
|
|
|
try{
|
|
|
//zkClient.getCuratorFramework().setData().forPath(ZK_PATH + smsSendSwitch,"true".getBytes("UTF-8"));
|
|
|
open = new String(zkClient.getCuratorFramework().getData().forPath(ZK_PATH + smsSendSwitch));
|
|
|
} catch (Exception e) {
|
|
|
logger.error("Send msg type get ZK_PATH smsSendSwitch error",e);
|
|
|
}
|
|
|
*/
|
|
|
if(StringUtils.isNotBlank(open)&&"false".equals(open)){
|
|
|
return false;//短信开关关掉了,不再发送短信
|
|
|
}
|
|
|
|
|
|
//无需发送
|
|
|
if (!checkSentOrNo(type, content, mobile)) {
|
|
|
return true;
|
...
|
...
|
|