|
|
package com.sunyo.wlpt.message.bus.service.controller;
|
|
|
|
|
|
|
|
|
import com.sunyo.wlpt.message.bus.service.domain.BusExchange;
|
|
|
import com.sunyo.wlpt.message.bus.service.domain.BusServer;
|
|
|
import com.sunyo.wlpt.message.bus.service.domain.VirtualHost;
|
|
|
import com.sunyo.wlpt.message.bus.service.domain.*;
|
|
|
import com.sunyo.wlpt.message.bus.service.response.ResultJson;
|
|
|
import com.sunyo.wlpt.message.bus.service.service.BusExchangeService;
|
|
|
import com.sunyo.wlpt.message.bus.service.service.BusServerService;
|
|
|
import com.sunyo.wlpt.message.bus.service.service.VirtualHostService;
|
|
|
import com.sunyo.wlpt.message.bus.service.service.*;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import javax.annotation.Resource;
|
...
|
...
|
@@ -31,6 +27,12 @@ public class CascadeController { |
|
|
@Resource
|
|
|
private BusExchangeService busExchangeService;
|
|
|
|
|
|
@Resource
|
|
|
private BusQueueService busQueueService;
|
|
|
|
|
|
@Resource
|
|
|
private RoutingKeyService routingKeyService;
|
|
|
|
|
|
/**
|
|
|
* 仅,查询服务器列表
|
|
|
*
|
...
|
...
|
@@ -53,15 +55,20 @@ public class CascadeController { |
|
|
return result;
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 仅,查询虚拟主机列表
|
|
|
*
|
|
|
* @param serverId 所属服务器ID
|
|
|
* @return {@link ResultJson}
|
|
|
*/
|
|
|
@GetMapping("/host")
|
|
|
public ResultJson getVirtualHostList() {
|
|
|
public ResultJson getVirtualHostList(@RequestParam(value = "serverId", required = false) String serverId) {
|
|
|
ResultJson result = new ResultJson();
|
|
|
List<VirtualHost> virtualHosts = virtualHostService.getVirtualHostList();
|
|
|
VirtualHost virtualHost = new VirtualHost();
|
|
|
// 获取参数,所属服务器ID
|
|
|
virtualHost.setServerId(serverId);
|
|
|
List<VirtualHost> virtualHosts = virtualHostService.getVirtualHostList(virtualHost);
|
|
|
int num = virtualHosts.size();
|
|
|
if (num > 0) {
|
|
|
result.setCode("200");
|
...
|
...
|
@@ -74,9 +81,18 @@ public class CascadeController { |
|
|
return result;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 仅查询交换机的列表
|
|
|
*
|
|
|
* @param virtualHostId 所属虚拟主机的ID
|
|
|
* @return
|
|
|
*/
|
|
|
@GetMapping("/exchange")
|
|
|
public ResultJson getExchangeList() {
|
|
|
List<BusExchange> busExchanges = busExchangeService.getExchangeList();
|
|
|
public ResultJson getExchangeList(@RequestParam(value = "virtualHostId", required = false) String virtualHostId) {
|
|
|
BusExchange busExchange = new BusExchange();
|
|
|
// 获取参数,所属虚拟主机ID
|
|
|
busExchange.setVirtualHostId(virtualHostId);
|
|
|
List<BusExchange> busExchanges = busExchangeService.getExchangeList(busExchange);
|
|
|
int num = busExchanges.size();
|
|
|
if (num > 0) {
|
|
|
return new ResultJson("200", "查询交换机列表,成功", busExchanges);
|
...
|
...
|
@@ -86,6 +102,48 @@ public class CascadeController { |
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 仅,查询队列列表
|
|
|
*
|
|
|
* @param virtualHostId 所属虚拟主机ID
|
|
|
* @return {@link ResultJson}
|
|
|
*/
|
|
|
@GetMapping("/queue")
|
|
|
public ResultJson getQueueList(@RequestParam(value = "virtualHostId", required = false) String virtualHostId) {
|
|
|
BusQueue busQueue = new BusQueue();
|
|
|
// 获取参数,所属虚拟主机ID
|
|
|
busQueue.setVirtualHostId(virtualHostId);
|
|
|
List<BusQueue> busQueues = busQueueService.getQueueList(busQueue);
|
|
|
int num = busQueues.size();
|
|
|
if (num > 0) {
|
|
|
return new ResultJson("200", "查询队列列表,成功", busQueues);
|
|
|
} else {
|
|
|
return new ResultJson("500", "查询队列列表,失败");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 仅,查询路由键列表
|
|
|
*
|
|
|
* @param exchangeId 所属交换机ID
|
|
|
* @return {@link ResultJson}
|
|
|
*/
|
|
|
@GetMapping("/routing")
|
|
|
public ResultJson getRoutingKeyList(@RequestParam(value = "exchangeId", required = false) String exchangeId) {
|
|
|
RoutingKey routingKey = new RoutingKey();
|
|
|
// 获取参数,交换机ID
|
|
|
routingKey.setExchangeId(exchangeId);
|
|
|
List<RoutingKey> routingKeys = routingKeyService.getRoutingKeyList(routingKey);
|
|
|
int num = routingKeys.size();
|
|
|
if (num > 0) {
|
|
|
return new ResultJson("200", "查询路由键列表,成功", routingKeys);
|
|
|
} else {
|
|
|
return new ResultJson("500", "查询路由键列表,失败");
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 服务器与虚拟主机是1:n的关系
|
|
|
* 查询,服务器列表(包含虚拟机)
|
|
|
*
|
...
|
...
|
|