Showing
1 changed file
with
10 additions
and
12 deletions
@@ -16,24 +16,22 @@ import com.yoho.core.rest.client.ServiceCaller; | @@ -16,24 +16,22 @@ import com.yoho.core.rest.client.ServiceCaller; | ||
16 | import com.yoho.core.rest.client.hystrix.AsyncFuture; | 16 | import com.yoho.core.rest.client.hystrix.AsyncFuture; |
17 | 17 | ||
18 | /** | 18 | /** |
19 | - * @author ping.huang | ||
20 | - * 2016年6月2日 | 19 | + * @author ping.huang 2016年6月2日 |
21 | */ | 20 | */ |
22 | @Component | 21 | @Component |
23 | public class SendSMSHelper { | 22 | public class SendSMSHelper { |
24 | 23 | ||
25 | static Logger log = LoggerFactory.getLogger(SendSMSHelper.class); | 24 | static Logger log = LoggerFactory.getLogger(SendSMSHelper.class); |
26 | - | 25 | + |
27 | @Resource | 26 | @Resource |
28 | ServiceCaller serviceCaller; | 27 | ServiceCaller serviceCaller; |
29 | - | 28 | + |
30 | private String aesKey = "yoho96461qaz2wsx"; | 29 | private String aesKey = "yoho96461qaz2wsx"; |
31 | private String smsUrl = "http://211.147.239.62:9050/cgi-bin/sendsms"; | 30 | private String smsUrl = "http://211.147.239.62:9050/cgi-bin/sendsms"; |
32 | private String smsName = "yohoyx@yohoyx"; | 31 | private String smsName = "yohoyx@yohoyx"; |
33 | private String smsPwd = "EH+iuWSAfINJYwSdPgVqhA=="; | 32 | private String smsPwd = "EH+iuWSAfINJYwSdPgVqhA=="; |
34 | - | ||
35 | - | ||
36 | - public void sendNoticeSms(String mobile,String content){ | 33 | + |
34 | + public void sendNoticeSms(String mobile, String content) { | ||
37 | try { | 35 | try { |
38 | String pwd = AES.decrypt(aesKey, smsPwd); | 36 | String pwd = AES.decrypt(aesKey, smsPwd); |
39 | String text = URLEncoder.encode(content, "GBK"); | 37 | String text = URLEncoder.encode(content, "GBK"); |
@@ -41,10 +39,10 @@ public class SendSMSHelper { | @@ -41,10 +39,10 @@ public class SendSMSHelper { | ||
41 | AsyncFuture<String> response = serviceCaller.get("sms.sendSMS", url, null, String.class, null); | 39 | AsyncFuture<String> response = serviceCaller.get("sms.sendSMS", url, null, String.class, null); |
42 | String result = response.get(); | 40 | String result = response.get(); |
43 | log.info("sendSMS result is {}, mobile is {}", result, mobile); | 41 | log.info("sendSMS result is {}, mobile is {}", result, mobile); |
44 | - }catch (Exception e) { | ||
45 | - log.error("sendSMS error decrypt error with aesKey={}, smsPwd={}", aesKey, smsPwd, e); | ||
46 | - return; | ||
47 | - } | ||
48 | - | 42 | + } catch (Exception e) { |
43 | + log.error("sendSMS error decrypt error with aesKey={}, smsPwd={}", aesKey, smsPwd, e); | ||
44 | + return; | ||
45 | + } | ||
46 | + | ||
49 | } | 47 | } |
50 | } | 48 | } |
-
Please register or login to post a comment