Showing
3 changed files
with
59 additions
and
22 deletions
1 | +package com.ui.User; | ||
2 | + | ||
3 | +import com.ui.http.HttpRestClient; | ||
4 | +import org.apache.commons.lang.StringUtils; | ||
5 | +import org.springframework.beans.factory.annotation.Autowired; | ||
6 | +import org.springframework.stereotype.Component; | ||
7 | + | ||
8 | +import java.util.HashMap; | ||
9 | +import java.util.Map; | ||
10 | + | ||
11 | +/** | ||
12 | + * Created by craig.qin | ||
13 | + */ | ||
14 | +@Component | ||
15 | +public class DnsRefreshLocal { | ||
16 | + | ||
17 | + @Autowired | ||
18 | + HttpRestClient httpClient; | ||
19 | + | ||
20 | + public String dnsJustForShell(String domain, String cloud, String type, String operate, String record, String value) { | ||
21 | + if (StringUtils.isBlank(domain) || StringUtils.isBlank(cloud) || StringUtils.isBlank(operate)) { | ||
22 | + return "param error"; | ||
23 | + } | ||
24 | + Map<String, String> map=new HashMap<>(); | ||
25 | + map.put("domain",domain); | ||
26 | + map.put("cloud",cloud); | ||
27 | + map.put("operate",operate); | ||
28 | + | ||
29 | + map.put("record",StringUtils.isBlank(record)?"":record); | ||
30 | + map.put("type",StringUtils.isBlank(type)?"":type); | ||
31 | + map.put("value",StringUtils.isBlank(value)?"":value); | ||
32 | + return httpClient.defaultGet("/internalDns/justForShell",String.class,map); | ||
33 | + } | ||
34 | + | ||
35 | + public String dnsJustForShellUpdate( String cloud, String record, String value) { | ||
36 | + String domain="yohoops.org"; | ||
37 | + String operate="update"; | ||
38 | + String type=""; | ||
39 | + return this.dnsJustForShell(domain,cloud,type,operate,record,value); | ||
40 | + } | ||
41 | + | ||
42 | + public String dnsJustForShellCommit( String cloud) { | ||
43 | + String domain="yohoops.org"; | ||
44 | + String operate="commit"; | ||
45 | + return this.dnsJustForShell(domain,cloud,"",operate,"",""); | ||
46 | + } | ||
47 | + | ||
48 | +} |
1 | package com.ui.ctrl; | 1 | package com.ui.ctrl; |
2 | 2 | ||
3 | +import com.ui.User.DnsRefreshLocal; | ||
3 | import com.ui.contants.HttpUriContants; | 4 | import com.ui.contants.HttpUriContants; |
4 | import com.ui.http.HttpRestClient; | 5 | import com.ui.http.HttpRestClient; |
5 | import com.ui.model.BaseResponse; | 6 | import com.ui.model.BaseResponse; |
@@ -28,7 +29,7 @@ public class MysqlMonitorCtrl { | @@ -28,7 +29,7 @@ public class MysqlMonitorCtrl { | ||
28 | HttpRestClient httpRestClient; | 29 | HttpRestClient httpRestClient; |
29 | 30 | ||
30 | @Autowired | 31 | @Autowired |
31 | - OuterIntfCtrl outerIntfCtrl; | 32 | + DnsRefreshLocal dnsRefreshLocal; |
32 | 33 | ||
33 | @RequestMapping("/toMysqlMonitor") | 34 | @RequestMapping("/toMysqlMonitor") |
34 | public ModelAndView toMysqlMonitor() { | 35 | public ModelAndView toMysqlMonitor() { |
@@ -110,11 +111,11 @@ public class MysqlMonitorCtrl { | @@ -110,11 +111,11 @@ public class MysqlMonitorCtrl { | ||
110 | for(String cloud:cloud_array){ | 111 | for(String cloud:cloud_array){ |
111 | String record="write."+app; | 112 | String record="write."+app; |
112 | String value=ip; | 113 | String value=ip; |
113 | - outerIntfCtrl.dnsJustForShellUpdate(cloud,record,value); | 114 | + dnsRefreshLocal.dnsJustForShellUpdate(cloud,record,value); |
114 | 115 | ||
115 | infos.add("修改cloud"+cloud+"域名 "+record +"->"+ip); | 116 | infos.add("修改cloud"+cloud+"域名 "+record +"->"+ip); |
116 | infos.add("开始当前云刷新dns"); | 117 | infos.add("开始当前云刷新dns"); |
117 | - outerIntfCtrl.dnsJustForShellCommit(cloud); | 118 | + dnsRefreshLocal.dnsJustForShellCommit(cloud); |
118 | infos.add("域名刷新完成"); | 119 | infos.add("域名刷新完成"); |
119 | } | 120 | } |
120 | 121 |
@@ -3,6 +3,7 @@ package com.ui.ctrl; | @@ -3,6 +3,7 @@ package com.ui.ctrl; | ||
3 | import com.alibaba.fastjson.JSON; | 3 | import com.alibaba.fastjson.JSON; |
4 | import com.alibaba.fastjson.JSONArray; | 4 | import com.alibaba.fastjson.JSONArray; |
5 | import com.alibaba.fastjson.JSONObject; | 5 | import com.alibaba.fastjson.JSONObject; |
6 | +import com.ui.User.DnsRefreshLocal; | ||
6 | import com.ui.User.UserAuthLocal; | 7 | import com.ui.User.UserAuthLocal; |
7 | import com.ui.http.HttpRestClient; | 8 | import com.ui.http.HttpRestClient; |
8 | import com.ui.model.BaseResponse; | 9 | import com.ui.model.BaseResponse; |
@@ -48,6 +49,9 @@ public class OuterIntfCtrl { | @@ -48,6 +49,9 @@ public class OuterIntfCtrl { | ||
48 | @Autowired | 49 | @Autowired |
49 | UserAuthLocal userAuthLocal; | 50 | UserAuthLocal userAuthLocal; |
50 | 51 | ||
52 | + @Autowired | ||
53 | + DnsRefreshLocal dnsRefreshLocal; | ||
54 | + | ||
51 | /** | 55 | /** |
52 | * 对外接口,通用指标上报 | 56 | * 对外接口,通用指标上报 |
53 | */ | 57 | */ |
@@ -296,35 +300,19 @@ public class OuterIntfCtrl { | @@ -296,35 +300,19 @@ public class OuterIntfCtrl { | ||
296 | @RequestMapping("/dnsJustForShell") | 300 | @RequestMapping("/dnsJustForShell") |
297 | @ResponseBody | 301 | @ResponseBody |
298 | public String dnsJustForShell(String domain, String cloud, String type, String operate, String record, String value) { | 302 | public String dnsJustForShell(String domain, String cloud, String type, String operate, String record, String value) { |
299 | - if (StringUtils.isBlank(domain) || StringUtils.isBlank(cloud) || StringUtils.isBlank(operate)) { | ||
300 | - return "param error"; | ||
301 | - } | ||
302 | - Map<String, String> map=new HashMap<>(); | ||
303 | - map.put("domain",domain); | ||
304 | - map.put("cloud",cloud); | ||
305 | - map.put("operate",operate); | ||
306 | - | ||
307 | - map.put("record",StringUtils.isBlank(record)?"":record); | ||
308 | - map.put("type",StringUtils.isBlank(type)?"":type); | ||
309 | - map.put("value",StringUtils.isBlank(value)?"":value); | ||
310 | - return httpClient.defaultGet("/internalDns/justForShell",String.class,map); | 303 | + return dnsRefreshLocal.dnsJustForShell(domain, cloud, type, operate, record, value); |
311 | } | 304 | } |
312 | 305 | ||
313 | @RequestMapping("/dnsJustForShellUpdate") | 306 | @RequestMapping("/dnsJustForShellUpdate") |
314 | @ResponseBody | 307 | @ResponseBody |
315 | public String dnsJustForShellUpdate( String cloud, String record, String value) { | 308 | public String dnsJustForShellUpdate( String cloud, String record, String value) { |
316 | - String domain="yohoops.org"; | ||
317 | - String operate="update"; | ||
318 | - String type=""; | ||
319 | - return this.dnsJustForShell(domain,cloud,type,operate,record,value); | 309 | + return dnsRefreshLocal.dnsJustForShellUpdate(cloud,record,value); |
320 | } | 310 | } |
321 | 311 | ||
322 | @RequestMapping("/dnsJustForShellCommit") | 312 | @RequestMapping("/dnsJustForShellCommit") |
323 | @ResponseBody | 313 | @ResponseBody |
324 | public String dnsJustForShellCommit( String cloud) { | 314 | public String dnsJustForShellCommit( String cloud) { |
325 | - String domain="yohoops.org"; | ||
326 | - String operate="commit"; | ||
327 | - return this.dnsJustForShell(domain,cloud,"",operate,"",""); | 315 | + return dnsRefreshLocal.dnsJustForShellCommit(cloud); |
328 | } | 316 | } |
329 | 317 | ||
330 | 318 |
-
Please register or login to post a comment