|
@@ -41,18 +41,10 @@ public class CascadeController { |
|
@@ -41,18 +41,10 @@ public class CascadeController { |
41
|
@GetMapping("/server")
|
41
|
@GetMapping("/server")
|
42
|
public ResultJson getServerList() {
|
42
|
public ResultJson getServerList() {
|
43
|
|
43
|
|
44
|
- ResultJson result = new ResultJson();
|
|
|
45
|
List<BusServer> busServers = busServerService.getServerList();
|
44
|
List<BusServer> busServers = busServerService.getServerList();
|
46
|
- int num = busServers.size();
|
|
|
47
|
- if (num > 0) {
|
|
|
48
|
- result.setCode("200");
|
|
|
49
|
- result.setData(busServers);
|
|
|
50
|
- result.setMsg("查询服务器列表,成功");
|
|
|
51
|
- } else {
|
|
|
52
|
- result.setCode("500");
|
|
|
53
|
- result.setMsg("查询服务器列表,失败");
|
|
|
54
|
- }
|
|
|
55
|
- return result;
|
45
|
+ return busServers.size() > 0
|
|
|
46
|
+ ? new ResultJson<>("200", "查询服务器列表,成功", busServers)
|
|
|
47
|
+ : new ResultJson<>("500", "查询服务器列表,失败");
|
56
|
}
|
48
|
}
|
57
|
|
49
|
|
58
|
|
50
|
|
|
@@ -64,21 +56,15 @@ public class CascadeController { |
|
@@ -64,21 +56,15 @@ public class CascadeController { |
64
|
*/
|
56
|
*/
|
65
|
@GetMapping("/host")
|
57
|
@GetMapping("/host")
|
66
|
public ResultJson getVirtualHostList(@RequestParam(value = "serverId", required = false) String serverId) {
|
58
|
public ResultJson getVirtualHostList(@RequestParam(value = "serverId", required = false) String serverId) {
|
67
|
- ResultJson result = new ResultJson();
|
59
|
+
|
68
|
VirtualHost virtualHost = new VirtualHost();
|
60
|
VirtualHost virtualHost = new VirtualHost();
|
69
|
// 获取参数,所属服务器ID
|
61
|
// 获取参数,所属服务器ID
|
70
|
virtualHost.setServerId(serverId);
|
62
|
virtualHost.setServerId(serverId);
|
|
|
63
|
+
|
71
|
List<VirtualHost> virtualHosts = virtualHostService.getVirtualHostList(virtualHost);
|
64
|
List<VirtualHost> virtualHosts = virtualHostService.getVirtualHostList(virtualHost);
|
72
|
- int num = virtualHosts.size();
|
|
|
73
|
- if (num > 0) {
|
|
|
74
|
- result.setCode("200");
|
|
|
75
|
- result.setData(virtualHosts);
|
|
|
76
|
- result.setMsg("查询虚拟主机,成功");
|
|
|
77
|
- } else {
|
|
|
78
|
- result.setCode("500");
|
|
|
79
|
- result.setMsg("查询虚拟主机,失败");
|
|
|
80
|
- }
|
|
|
81
|
- return result;
|
65
|
+ return virtualHosts.size() > 0
|
|
|
66
|
+ ? new ResultJson<>("200", "查询虚拟主机,成功", virtualHosts)
|
|
|
67
|
+ : new ResultJson<>("500", "查询虚拟主机,失败");
|
82
|
}
|
68
|
}
|
83
|
|
69
|
|
84
|
/**
|
70
|
/**
|
|
@@ -89,16 +75,15 @@ public class CascadeController { |
|
@@ -89,16 +75,15 @@ public class CascadeController { |
89
|
*/
|
75
|
*/
|
90
|
@GetMapping("/exchange")
|
76
|
@GetMapping("/exchange")
|
91
|
public ResultJson getExchangeList(@RequestParam(value = "virtualHostId", required = false) String virtualHostId) {
|
77
|
public ResultJson getExchangeList(@RequestParam(value = "virtualHostId", required = false) String virtualHostId) {
|
|
|
78
|
+
|
92
|
BusExchange busExchange = new BusExchange();
|
79
|
BusExchange busExchange = new BusExchange();
|
93
|
// 获取参数,所属虚拟主机ID
|
80
|
// 获取参数,所属虚拟主机ID
|
94
|
busExchange.setVirtualHostId(virtualHostId);
|
81
|
busExchange.setVirtualHostId(virtualHostId);
|
|
|
82
|
+
|
95
|
List<BusExchange> busExchanges = busExchangeService.getExchangeList(busExchange);
|
83
|
List<BusExchange> busExchanges = busExchangeService.getExchangeList(busExchange);
|
96
|
- int num = busExchanges.size();
|
|
|
97
|
- if (num > 0) {
|
|
|
98
|
- return new ResultJson("200", "查询交换机列表,成功", busExchanges);
|
|
|
99
|
- } else {
|
|
|
100
|
- return new ResultJson("500", "查询交换机列表,失败");
|
|
|
101
|
- }
|
84
|
+ return busExchanges.size() > 0
|
|
|
85
|
+ ? new ResultJson<>("200", "查询交换机列表,成功", busExchanges)
|
|
|
86
|
+ : new ResultJson<>("500", "查询交换机列表,失败");
|
102
|
}
|
87
|
}
|
103
|
|
88
|
|
104
|
/**
|
89
|
/**
|
|
@@ -109,16 +94,15 @@ public class CascadeController { |
|
@@ -109,16 +94,15 @@ public class CascadeController { |
109
|
*/
|
94
|
*/
|
110
|
@GetMapping("/queue")
|
95
|
@GetMapping("/queue")
|
111
|
public ResultJson getQueueList(@RequestParam(value = "virtualHostId", required = false) String virtualHostId) {
|
96
|
public ResultJson getQueueList(@RequestParam(value = "virtualHostId", required = false) String virtualHostId) {
|
|
|
97
|
+
|
112
|
BusQueue busQueue = new BusQueue();
|
98
|
BusQueue busQueue = new BusQueue();
|
113
|
// 获取参数,所属虚拟主机ID
|
99
|
// 获取参数,所属虚拟主机ID
|
114
|
busQueue.setVirtualHostId(virtualHostId);
|
100
|
busQueue.setVirtualHostId(virtualHostId);
|
|
|
101
|
+
|
115
|
List<BusQueue> busQueues = busQueueService.getQueueList(busQueue);
|
102
|
List<BusQueue> busQueues = busQueueService.getQueueList(busQueue);
|
116
|
- int num = busQueues.size();
|
|
|
117
|
- if (num > 0) {
|
|
|
118
|
- return new ResultJson("200", "查询队列列表,成功", busQueues);
|
|
|
119
|
- } else {
|
|
|
120
|
- return new ResultJson("500", "查询队列列表,失败");
|
|
|
121
|
- }
|
103
|
+ return busQueues.size() > 0
|
|
|
104
|
+ ? new ResultJson<>("200", "查询队列列表,成功", busQueues)
|
|
|
105
|
+ : new ResultJson<>("500", "查询队列列表,失败");
|
122
|
}
|
106
|
}
|
123
|
|
107
|
|
124
|
/**
|
108
|
/**
|
|
@@ -133,16 +117,11 @@ public class CascadeController { |
|
@@ -133,16 +117,11 @@ public class CascadeController { |
133
|
// 获取参数,交换机ID
|
117
|
// 获取参数,交换机ID
|
134
|
routingKey.setExchangeId(exchangeId);
|
118
|
routingKey.setExchangeId(exchangeId);
|
135
|
List<RoutingKey> routingKeys = routingKeyService.getRoutingKeyList(routingKey);
|
119
|
List<RoutingKey> routingKeys = routingKeyService.getRoutingKeyList(routingKey);
|
136
|
- int num = routingKeys.size();
|
|
|
137
|
- if (num > 0) {
|
|
|
138
|
- return new ResultJson("200", "查询路由键列表,成功", routingKeys);
|
|
|
139
|
- } else {
|
|
|
140
|
- return new ResultJson("500", "查询路由键列表,失败");
|
|
|
141
|
- }
|
|
|
142
|
-
|
120
|
+ return routingKeys.size() > 0
|
|
|
121
|
+ ? new ResultJson<>("200", "查询路由键列表,成功", routingKeys)
|
|
|
122
|
+ : new ResultJson<>("500", "查询路由键列表,失败");
|
143
|
}
|
123
|
}
|
144
|
|
124
|
|
145
|
-
|
|
|
146
|
/**
|
125
|
/**
|
147
|
* 服务器与虚拟主机是1:n的关系
|
126
|
* 服务器与虚拟主机是1:n的关系
|
148
|
* 查询,服务器列表(包含虚拟机)
|
127
|
* 查询,服务器列表(包含虚拟机)
|
|
@@ -151,14 +130,11 @@ public class CascadeController { |
|
@@ -151,14 +130,11 @@ public class CascadeController { |
151
|
*/
|
130
|
*/
|
152
|
@GetMapping("/server_host")
|
131
|
@GetMapping("/server_host")
|
153
|
public ResultJson getServerAndHostList() {
|
132
|
public ResultJson getServerAndHostList() {
|
154
|
- ResultJson result = new ResultJson();
|
133
|
+
|
155
|
List<BusServer> servers = busServerService.getServerAndHostList();
|
134
|
List<BusServer> servers = busServerService.getServerAndHostList();
|
156
|
- int num = servers.size();
|
|
|
157
|
- if (num > 0) {
|
|
|
158
|
- return new ResultJson("200", "查询服务器与虚拟主机信息,成功", servers);
|
|
|
159
|
- } else {
|
|
|
160
|
- return new ResultJson("500", "查询服务器与虚拟主机信息,失败");
|
|
|
161
|
- }
|
135
|
+ return servers.size() > 0
|
|
|
136
|
+ ? new ResultJson<>("200", "查询服务器与虚拟主机信息,成功", servers)
|
|
|
137
|
+ : new ResultJson<>("500", "查询服务器与虚拟主机信息,失败");
|
162
|
}
|
138
|
}
|
163
|
|
139
|
|
164
|
/**
|
140
|
/**
|
|
@@ -170,13 +146,9 @@ public class CascadeController { |
|
@@ -170,13 +146,9 @@ public class CascadeController { |
170
|
*/
|
146
|
*/
|
171
|
@GetMapping("/server_host_exchange")
|
147
|
@GetMapping("/server_host_exchange")
|
172
|
public ResultJson getServerAndHostAndExchangeList() {
|
148
|
public ResultJson getServerAndHostAndExchangeList() {
|
173
|
- ResultJson result = new ResultJson();
|
|
|
174
|
List<BusServer> servers = busServerService.getServerAndHostAndExchangeList();
|
149
|
List<BusServer> servers = busServerService.getServerAndHostAndExchangeList();
|
175
|
- int num = servers.size();
|
|
|
176
|
- if (num > 0) {
|
|
|
177
|
- return new ResultJson("200", "查询服务器与虚拟主机信息,成功", servers);
|
|
|
178
|
- } else {
|
|
|
179
|
- return new ResultJson("500", "查询服务器与虚拟主机信息,失败");
|
|
|
180
|
- }
|
150
|
+ return servers.size() > 0
|
|
|
151
|
+ ? new ResultJson<>("200", "查询服务器、虚拟主机、交换机信息,成功", servers)
|
|
|
152
|
+ : new ResultJson<>("500", "查询服务器、虚拟主机、交换机信息,失败");
|
181
|
}
|
153
|
}
|
182
|
} |
154
|
} |