|
|
package com.monitor.other.sms.service.impl;
|
|
|
|
|
|
import com.model.SMSLogs;
|
|
|
import com.monitor.common.service.AlarmMsgService;
|
|
|
import com.monitor.common.util.ApplicationUtil;
|
|
|
import com.monitor.common.util.ZkClientUtil;
|
|
|
import com.monitor.model.domain.PageBean;
|
|
|
import com.monitor.model.page.PageRequest;
|
...
|
...
|
@@ -8,6 +10,7 @@ import com.monitor.model.response.BaseResponse; |
|
|
import com.monitor.model.response.PageResponse;
|
|
|
import com.monitor.mysql.mapper.SMSLogsMapper;
|
|
|
import com.monitor.other.sms.service.SmsLogService;
|
|
|
import com.util.GetUsersInfoUtil;
|
|
|
import org.apache.zookeeper.data.Stat;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
...
|
...
|
@@ -30,6 +33,9 @@ public class SmsLogServiceImpl implements SmsLogService { |
|
|
@Autowired
|
|
|
private ZkClientUtil zkClient;
|
|
|
|
|
|
@Autowired
|
|
|
private AlarmMsgService alarmMsgService;
|
|
|
|
|
|
private String ZK_PATH = "/yh/config/";
|
|
|
private String smsSendSwitch="ops.sendsms.open";
|
|
|
private String smsSendVoiceSwitch="ops.sendvoicesms.open";
|
...
|
...
|
@@ -69,6 +75,21 @@ public class SmsLogServiceImpl implements SmsLogService { |
|
|
String value="true";
|
|
|
if("off".equals(key)){
|
|
|
value="false";
|
|
|
GetUsersInfoUtil getUsersInfoUtil = (GetUsersInfoUtil) ApplicationUtil.getBean(GetUsersInfoUtil.class);
|
|
|
String mobiles = getUsersInfoUtil.getMobileByAlarmGroup("告警开关切换组");
|
|
|
String content = "";
|
|
|
switch (pathCode){
|
|
|
case "ops.sendsms.open":
|
|
|
content = "运维ops短信告警开关is off";
|
|
|
break;
|
|
|
case "ops.sendvoicesms.open":
|
|
|
content = "运维ops语音告警开关is off";
|
|
|
break;
|
|
|
case "devops.sendsms.open":
|
|
|
content = "监控dev短信告警开关is off";
|
|
|
break;
|
|
|
}
|
|
|
alarmMsgService.sendSms("msgSwitch", content, "", mobiles);
|
|
|
}
|
|
|
Stat stat=zkClient.getCuratorFramework().checkExists().forPath(ZK_PATH + pathCode);
|
|
|
// Stat 就是对zonde所有属性的一个映射, stat=null表示节点不存在!
|
...
|
...
|
|