...
|
...
|
@@ -5,6 +5,8 @@ import com.monitor.common.config.SendsmsConfig; |
|
|
import com.monitor.common.service.DingDingService;
|
|
|
import com.monitor.common.service.HttpRestClientService;
|
|
|
import com.monitor.common.service.VoiceMsgService;
|
|
|
import com.monitor.common.sms.service.SmsLogService;
|
|
|
import com.monitor.common.sms.service.impl.SmsLogServiceImpl;
|
|
|
import com.monitor.common.util.MD5Util;
|
|
|
import com.monitor.common.util.OpsZkClientUtil;
|
|
|
import com.monitor.influxdb.contants.InfluxDBContants;
|
...
|
...
|
@@ -39,36 +41,10 @@ public class VoiceMsgServiceImpl implements VoiceMsgService { |
|
|
@Autowired
|
|
|
private DingDingService dingDingService;
|
|
|
|
|
|
public final Logger DEBUG = LoggerFactory.getLogger(getClass());
|
|
|
|
|
|
private String ZK_PATH = "/yh/config/";
|
|
|
private String smsSendVoiceSwitch="ops.sendvoicesms.open";
|
|
|
|
|
|
/* @Override
|
|
|
public void sendVoice(String mobile) throws UnsupportedEncodingException {
|
|
|
|
|
|
try {
|
|
|
VoiceSms voiceSms = new VoiceSms();
|
|
|
voiceSms.setMsg("YOHO");
|
|
|
voiceSms.setExt("nothing");
|
|
|
String[] mobiles = mobile.split(",");
|
|
|
for (String str : mobiles) {
|
|
|
VoiceSms.Tel tel = new VoiceSms.Tel();
|
|
|
tel.setNationcode("86");
|
|
|
tel.setPhone(str);
|
|
|
voiceSms.setSig(MD5Util.encryption(sendsmsConfig.getQcloudSmsKey() + str));
|
|
|
voiceSms.setTel(tel);
|
|
|
DEBUG.info("send voice msg,content:{}", JSON.toJSONString(voiceSms));
|
|
|
String result = httpRestClientService.doPostStringJson(sendsmsConfig.getQcloudVoiceUrl(), JSON.toJSONString(voiceSms));
|
|
|
DEBUG.info("send voice msg,result:{}", result);
|
|
|
}
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
DEBUG.error("sendVoide error ", e);
|
|
|
}
|
|
|
|
|
|
@Autowired
|
|
|
private SmsLogService smsLogService;
|
|
|
|
|
|
}*/
|
|
|
public final Logger DEBUG = LoggerFactory.getLogger(getClass());
|
|
|
|
|
|
|
|
|
@Override
|
...
|
...
|
@@ -81,8 +57,9 @@ public class VoiceMsgServiceImpl implements VoiceMsgService { |
|
|
//根据zk的开关判断是否需要发送数据
|
|
|
String open="";
|
|
|
try{
|
|
|
//zkClient.getCuratorFramework().setData().forPath(ZK_PATH + smsSendSwitch,"true".getBytes("UTF-8"));
|
|
|
open = new String(zkClient.getCuratorFramework().getData().forPath(ZK_PATH + smsSendVoiceSwitch));
|
|
|
if(smsLogService.checkExistPath(SmsLogServiceImpl.smsSendVoiceSwitch)){
|
|
|
open = new String(zkClient.getCuratorFramework().getData().forPath(SmsLogServiceImpl.ZK_PATH + SmsLogServiceImpl.smsSendVoiceSwitch));
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
DEBUG.error("Send msg type get ZK_PATH smsVoiceSendSwitch error",e);
|
|
|
}
|
...
|
...
|
|