正在显示
14 个修改的文件
包含
133 行增加
和
39 行删除
@@ -59,11 +59,15 @@ public class BusExchangeController { | @@ -59,11 +59,15 @@ public class BusExchangeController { | ||
59 | * @return {@link ResultJson} | 59 | * @return {@link ResultJson} |
60 | */ | 60 | */ |
61 | @DeleteMapping("/delete") | 61 | @DeleteMapping("/delete") |
62 | - public ResultJson deleteBusExchange(@RequestBody BusExchange busExchange) throws IOException, TimeoutException | 62 | + public ResultJson deleteBusExchange(@RequestBody BusExchange busExchange) |
63 | { | 63 | { |
64 | + try { | ||
64 | return busExchangeService.deleteByPrimaryKey(busExchange.getId()) > 0 | 65 | return busExchangeService.deleteByPrimaryKey(busExchange.getId()) > 0 |
65 | ? new ResultJson<>("200", "删除MQ交换机,成功") | 66 | ? new ResultJson<>("200", "删除MQ交换机,成功") |
66 | : new ResultJson<>("500", "删除MQ交换机,失败"); | 67 | : new ResultJson<>("500", "删除MQ交换机,失败"); |
68 | + } catch (IOException | TimeoutException e) { | ||
69 | + return new ResultJson<>("500", "服务器异常,删除MQ交换机,失败"); | ||
70 | + } | ||
67 | } | 71 | } |
68 | 72 | ||
69 | /** | 73 | /** |
@@ -73,11 +77,15 @@ public class BusExchangeController { | @@ -73,11 +77,15 @@ public class BusExchangeController { | ||
73 | * @return {@link ResultJson} | 77 | * @return {@link ResultJson} |
74 | */ | 78 | */ |
75 | @GetMapping("/batchRemove") | 79 | @GetMapping("/batchRemove") |
76 | - public ResultJson batchRemoveBusExchange(String ids) throws IOException, TimeoutException | 80 | + public ResultJson batchRemoveBusExchange(String ids) |
77 | { | 81 | { |
82 | + try { | ||
78 | return busExchangeService.deleteByPrimaryKey(ids) > 0 | 83 | return busExchangeService.deleteByPrimaryKey(ids) > 0 |
79 | ? new ResultJson<>("200", "批量删除MQ交换机,成功") | 84 | ? new ResultJson<>("200", "批量删除MQ交换机,成功") |
80 | : new ResultJson<>("500", "批量删除MQ交换机,失败"); | 85 | : new ResultJson<>("500", "批量删除MQ交换机,失败"); |
86 | + } catch (IOException | TimeoutException e) { | ||
87 | + return new ResultJson<>("500", "服务器异常,批量删除MQ交换机,失败"); | ||
88 | + } | ||
81 | } | 89 | } |
82 | 90 | ||
83 | /** | 91 | /** |
@@ -106,8 +114,9 @@ public class BusExchangeController { | @@ -106,8 +114,9 @@ public class BusExchangeController { | ||
106 | * @return {@link ResultJson} | 114 | * @return {@link ResultJson} |
107 | */ | 115 | */ |
108 | @PostMapping("/insert") | 116 | @PostMapping("/insert") |
109 | - public ResultJson insertBusExchange(@RequestBody BusExchange busExchange) throws IOException, TimeoutException | 117 | + public ResultJson insertBusExchange(@RequestBody BusExchange busExchange) |
110 | { | 118 | { |
119 | + try { | ||
111 | //先验证,增加的虚拟主机的核心信息(交换机名称)是否已存在 | 120 | //先验证,增加的虚拟主机的核心信息(交换机名称)是否已存在 |
112 | String message = validateBusExchange(busExchange); | 121 | String message = validateBusExchange(busExchange); |
113 | // 设置id | 122 | // 设置id |
@@ -117,6 +126,9 @@ public class BusExchangeController { | @@ -117,6 +126,9 @@ public class BusExchangeController { | ||
117 | ? new ResultJson<>("200", "新增MQ交换机信息,成功") | 126 | ? new ResultJson<>("200", "新增MQ交换机信息,成功") |
118 | : new ResultJson<>("500", "新增MQ交换机信息,失败") | 127 | : new ResultJson<>("500", "新增MQ交换机信息,失败") |
119 | : new ResultJson<>("400", message); | 128 | : new ResultJson<>("400", message); |
129 | + } catch (IOException | TimeoutException e) { | ||
130 | + return new ResultJson<>("500", "新增MQ交换机信息,失败"); | ||
131 | + } | ||
120 | } | 132 | } |
121 | 133 | ||
122 | 134 |
@@ -67,11 +67,15 @@ public class BusQueueController { | @@ -67,11 +67,15 @@ public class BusQueueController { | ||
67 | * @return {@link ResultJson} | 67 | * @return {@link ResultJson} |
68 | */ | 68 | */ |
69 | @DeleteMapping("/delete") | 69 | @DeleteMapping("/delete") |
70 | - public ResultJson deleteBusQueue(@RequestBody BusQueue busQueue) throws IOException, TimeoutException | 70 | + public ResultJson deleteBusQueue(@RequestBody BusQueue busQueue) |
71 | { | 71 | { |
72 | + try { | ||
72 | return busQueueService.deleteByPrimaryKey(busQueue.getId()) > 0 | 73 | return busQueueService.deleteByPrimaryKey(busQueue.getId()) > 0 |
73 | ? new ResultJson<>("200", "删除消息队列,成功") | 74 | ? new ResultJson<>("200", "删除消息队列,成功") |
74 | : new ResultJson<>("500", "删除消息队列,失败"); | 75 | : new ResultJson<>("500", "删除消息队列,失败"); |
76 | + } catch (IOException | TimeoutException e) { | ||
77 | + return new ResultJson<>("500", "服务器异常,删除消息队列,失败"); | ||
78 | + } | ||
75 | } | 79 | } |
76 | 80 | ||
77 | /** | 81 | /** |
@@ -81,11 +85,15 @@ public class BusQueueController { | @@ -81,11 +85,15 @@ public class BusQueueController { | ||
81 | * @return {@link ResultJson} | 85 | * @return {@link ResultJson} |
82 | */ | 86 | */ |
83 | @GetMapping("/batchRemove") | 87 | @GetMapping("/batchRemove") |
84 | - public ResultJson batchRemoveBusQueue(String ids) throws IOException, TimeoutException | 88 | + public ResultJson batchRemoveBusQueue(String ids) |
85 | { | 89 | { |
90 | + try { | ||
86 | return busQueueService.deleteByPrimaryKey(ids) > 0 | 91 | return busQueueService.deleteByPrimaryKey(ids) > 0 |
87 | - ? new ResultJson<>("200", "批量删除消息队列,成功") | ||
88 | - : new ResultJson<>("500", "批量删除消息队列,失败"); | 92 | + ? new ResultJson<>("200", "批量删除MQ消息队列,成功") |
93 | + : new ResultJson<>("500", "批量删除MQ消息队列,失败"); | ||
94 | + } catch (IOException | TimeoutException e) { | ||
95 | + return new ResultJson<>("500", "服务器异常,批量删除MQ消息队列,失败"); | ||
96 | + } | ||
89 | } | 97 | } |
90 | 98 | ||
91 | /** | 99 | /** |
@@ -101,8 +109,8 @@ public class BusQueueController { | @@ -101,8 +109,8 @@ public class BusQueueController { | ||
101 | String message = validateBusQueue(busQueue); | 109 | String message = validateBusQueue(busQueue); |
102 | return message == null | 110 | return message == null |
103 | ? busQueueService.updateByPrimaryKeySelective(busQueue) > 0 | 111 | ? busQueueService.updateByPrimaryKeySelective(busQueue) > 0 |
104 | - ? new ResultJson<>("200", "编辑消息队列信息,成功") | ||
105 | - : new ResultJson<>("500", "编辑消息队列信息,失败") | 112 | + ? new ResultJson<>("200", "编辑MQ消息队列信息,成功") |
113 | + : new ResultJson<>("500", "编辑MQ消息队列信息,失败") | ||
106 | : new ResultJson<>("400", message); | 114 | : new ResultJson<>("400", message); |
107 | } | 115 | } |
108 | 116 | ||
@@ -113,13 +121,17 @@ public class BusQueueController { | @@ -113,13 +121,17 @@ public class BusQueueController { | ||
113 | * @return {@link ResultJson} | 121 | * @return {@link ResultJson} |
114 | */ | 122 | */ |
115 | @PostMapping("/insert") | 123 | @PostMapping("/insert") |
116 | - public ResultJson insertBusQueue(@RequestBody BusQueue busQueue) throws IOException, TimeoutException | 124 | + public ResultJson insertBusQueue(@RequestBody BusQueue busQueue) |
117 | { | 125 | { |
126 | + try { | ||
118 | String message = validateBusQueue(busQueue); | 127 | String message = validateBusQueue(busQueue); |
119 | //验证通过 | 128 | //验证通过 |
120 | return message == null | 129 | return message == null |
121 | ? busQueueService.insertSelective(busQueue) | 130 | ? busQueueService.insertSelective(busQueue) |
122 | : new ResultJson<>("400", message); | 131 | : new ResultJson<>("400", message); |
132 | + } catch (IOException | TimeoutException e) { | ||
133 | + return new ResultJson<>("500", "服务器异常,新增MQ消息队列信息,失败"); | ||
134 | + } | ||
123 | } | 135 | } |
124 | 136 | ||
125 | /** | 137 | /** |
@@ -58,11 +58,15 @@ public class BusServerController { | @@ -58,11 +58,15 @@ public class BusServerController { | ||
58 | * @return {@link ResultJson} | 58 | * @return {@link ResultJson} |
59 | */ | 59 | */ |
60 | @DeleteMapping("/delete") | 60 | @DeleteMapping("/delete") |
61 | - public ResultJson deleteBusServer(@RequestBody BusServer busServer) throws IOException, TimeoutException | 61 | + public ResultJson deleteBusServer(@RequestBody BusServer busServer) |
62 | { | 62 | { |
63 | + try { | ||
63 | return busServerService.deleteByPrimaryKey(busServer.getId()) > 0 | 64 | return busServerService.deleteByPrimaryKey(busServer.getId()) > 0 |
64 | ? new ResultJson<>("200", "删除MQ服务器,成功") | 65 | ? new ResultJson<>("200", "删除MQ服务器,成功") |
65 | : new ResultJson<>("500", "删除MQ服务器,失败"); | 66 | : new ResultJson<>("500", "删除MQ服务器,失败"); |
67 | + } catch (IOException | TimeoutException e) { | ||
68 | + return new ResultJson<>("500", "服务器异常,删除MQ服务器失败"); | ||
69 | + } | ||
66 | } | 70 | } |
67 | 71 | ||
68 | /** | 72 | /** |
@@ -72,11 +76,15 @@ public class BusServerController { | @@ -72,11 +76,15 @@ public class BusServerController { | ||
72 | * @return {@link ResultJson} | 76 | * @return {@link ResultJson} |
73 | */ | 77 | */ |
74 | @GetMapping("/batchRemove") | 78 | @GetMapping("/batchRemove") |
75 | - public ResultJson batchRemoveBusServer(String ids) throws IOException, TimeoutException | 79 | + public ResultJson batchRemoveBusServer(String ids) |
76 | { | 80 | { |
81 | + try { | ||
77 | return busServerService.deleteByPrimaryKey(ids) > 0 | 82 | return busServerService.deleteByPrimaryKey(ids) > 0 |
78 | ? new ResultJson<>("200", "批量删除服务器,成功") | 83 | ? new ResultJson<>("200", "批量删除服务器,成功") |
79 | : new ResultJson<>("500", "批量删除服务器,失败"); | 84 | : new ResultJson<>("500", "批量删除服务器,失败"); |
85 | + } catch (IOException | TimeoutException e) { | ||
86 | + return new ResultJson<>("500", "服务器异常,批量删除服务器,失败"); | ||
87 | + } | ||
80 | } | 88 | } |
81 | 89 | ||
82 | /** | 90 | /** |
@@ -12,6 +12,7 @@ import javax.annotation.Resource; | @@ -12,6 +12,7 @@ import javax.annotation.Resource; | ||
12 | import javax.validation.constraints.NotNull; | 12 | import javax.validation.constraints.NotNull; |
13 | import java.io.IOException; | 13 | import java.io.IOException; |
14 | import java.util.Date; | 14 | import java.util.Date; |
15 | +import java.util.concurrent.TimeoutException; | ||
15 | 16 | ||
16 | /** | 17 | /** |
17 | * @author 子诚 | 18 | * @author 子诚 |
@@ -151,11 +152,15 @@ public class MessageNoteController { | @@ -151,11 +152,15 @@ public class MessageNoteController { | ||
151 | * @return {@link ResultJson} | 152 | * @return {@link ResultJson} |
152 | */ | 153 | */ |
153 | @PostMapping("/insert") | 154 | @PostMapping("/insert") |
154 | - public ResultJson insertMessageNote(@RequestBody @NotNull MessageNote messageNote) throws Exception | 155 | + public ResultJson insertMessageNote(@RequestBody @NotNull MessageNote messageNote) |
155 | { | 156 | { |
157 | + try { | ||
156 | return messageNoteService.insertSelective(messageNote) > 0 | 158 | return messageNoteService.insertSelective(messageNote) > 0 |
157 | - ? new ResultJson<>("200", "编辑-消息收发记录,成功") | ||
158 | - : new ResultJson<>("500", "编辑-消息收发记录,失败"); | 159 | + ? new ResultJson<>("200", "新增-消息收发记录,成功") |
160 | + : new ResultJson<>("500", "新增-消息收发记录,失败"); | ||
161 | + } catch (IOException | TimeoutException e) { | ||
162 | + return new ResultJson<>("500", "服务器异常,编辑-消息收发记录,失败"); | ||
163 | + } | ||
159 | } | 164 | } |
160 | 165 | ||
161 | /** | 166 | /** |
@@ -84,8 +84,9 @@ public class RabbitController { | @@ -84,8 +84,9 @@ public class RabbitController { | ||
84 | @RequestParam(value = "SEQN", required = false) String SEQN, | 84 | @RequestParam(value = "SEQN", required = false) String SEQN, |
85 | @RequestParam(value = "VSHT") String VSHT, | 85 | @RequestParam(value = "VSHT") String VSHT, |
86 | @RequestParam(value = "SERV") String SERV, | 86 | @RequestParam(value = "SERV") String SERV, |
87 | - @RequestParam(value = "content") String content) throws Exception | 87 | + @RequestParam(value = "content") String content) |
88 | { | 88 | { |
89 | + try { | ||
89 | // 1、获取数据 | 90 | // 1、获取数据 |
90 | XmlData xmlData = XmlData.builder() | 91 | XmlData xmlData = XmlData.builder() |
91 | .sender(SNDR) | 92 | .sender(SNDR) |
@@ -112,9 +113,12 @@ public class RabbitController { | @@ -112,9 +113,12 @@ public class RabbitController { | ||
112 | } | 113 | } |
113 | // 4、mq发送消息,数据库中保存消息并保存至ES | 114 | // 4、mq发送消息,数据库中保存消息并保存至ES |
114 | return sendAndSave(sentData); | 115 | return sendAndSave(sentData); |
116 | + } catch (IOException | TimeoutException e) { | ||
117 | + return ResultJson.error(CustomExceptionType.SERVER_EXCEPTION); | ||
118 | + } | ||
115 | } | 119 | } |
116 | 120 | ||
117 | - public ResultJson sendAndSave(XmlData sentData) throws Exception | 121 | + public ResultJson sendAndSave(XmlData sentData) throws IOException, TimeoutException |
118 | { | 122 | { |
119 | // 4、mq发送消息,数据库中保存消息 | 123 | // 4、mq发送消息,数据库中保存消息 |
120 | ResultJson result = directUtils.sendMessage(sentData); | 124 | ResultJson result = directUtils.sendMessage(sentData); |
@@ -59,11 +59,15 @@ public class RoutingKeyController { | @@ -59,11 +59,15 @@ public class RoutingKeyController { | ||
59 | * @return {@link ResultJson} | 59 | * @return {@link ResultJson} |
60 | */ | 60 | */ |
61 | @DeleteMapping("/delete") | 61 | @DeleteMapping("/delete") |
62 | - public ResultJson deleteRoutingKey(@RequestBody RoutingKey routingKey) throws IOException, TimeoutException | 62 | + public ResultJson deleteRoutingKey(@RequestBody RoutingKey routingKey) |
63 | { | 63 | { |
64 | + try { | ||
64 | return routingKeyService.deleteByPrimaryKey(routingKey.getId()) > 0 | 65 | return routingKeyService.deleteByPrimaryKey(routingKey.getId()) > 0 |
65 | ? new ResultJson<>("200", "删除路由键,成功") | 66 | ? new ResultJson<>("200", "删除路由键,成功") |
66 | : new ResultJson<>("500", "删除路由键,失败"); | 67 | : new ResultJson<>("500", "删除路由键,失败"); |
68 | + } catch (IOException | TimeoutException e) { | ||
69 | + return new ResultJson<>("500", "服务器异常,删除路由键,失败"); | ||
70 | + } | ||
67 | } | 71 | } |
68 | 72 | ||
69 | /** | 73 | /** |
@@ -73,11 +77,15 @@ public class RoutingKeyController { | @@ -73,11 +77,15 @@ public class RoutingKeyController { | ||
73 | * @return {@link ResultJson} | 77 | * @return {@link ResultJson} |
74 | */ | 78 | */ |
75 | @GetMapping("/batchRemove") | 79 | @GetMapping("/batchRemove") |
76 | - public ResultJson batchRemoveRoutingKey(String ids) throws IOException, TimeoutException | 80 | + public ResultJson batchRemoveRoutingKey(String ids) |
77 | { | 81 | { |
82 | + try { | ||
78 | return routingKeyService.deleteByPrimaryKey(ids) > 0 | 83 | return routingKeyService.deleteByPrimaryKey(ids) > 0 |
79 | ? new ResultJson<>("200", "删除路由键,成功") | 84 | ? new ResultJson<>("200", "删除路由键,成功") |
80 | : new ResultJson<>("500", "删除路由键,失败"); | 85 | : new ResultJson<>("500", "删除路由键,失败"); |
86 | + } catch (IOException | TimeoutException e) { | ||
87 | + return new ResultJson<>("500", "服务器异常,删除路由键,失败"); | ||
88 | + } | ||
81 | } | 89 | } |
82 | 90 | ||
83 | /** | 91 | /** |
@@ -108,7 +116,6 @@ public class RoutingKeyController { | @@ -108,7 +116,6 @@ public class RoutingKeyController { | ||
108 | @PostMapping("/insert") | 116 | @PostMapping("/insert") |
109 | public ResultJson insertRoutingKey(@RequestBody RoutingKey routingKey) | 117 | public ResultJson insertRoutingKey(@RequestBody RoutingKey routingKey) |
110 | { | 118 | { |
111 | - | ||
112 | //先验证,增加的服务器的核心信息(ip和port,同时存在)是否已存在 | 119 | //先验证,增加的服务器的核心信息(ip和port,同时存在)是否已存在 |
113 | String message = validateRoutingKey(routingKey); | 120 | String message = validateRoutingKey(routingKey); |
114 | // 设置id | 121 | // 设置id |
@@ -134,7 +141,6 @@ public class RoutingKeyController { | @@ -134,7 +141,6 @@ public class RoutingKeyController { | ||
134 | } | 141 | } |
135 | 142 | ||
136 | // 如果id不为空,则是 update 操作 | 143 | // 如果id不为空,则是 update 操作 |
137 | - | ||
138 | if (routingKey.getId() != null && routingKey.getId().length() != 0) { | 144 | if (routingKey.getId() != null && routingKey.getId().length() != 0) { |
139 | // 根据 id 查询出原来的 路由键 信息 | 145 | // 根据 id 查询出原来的 路由键 信息 |
140 | RoutingKey oldRoutingKey = routingKeyService.selectByPrimaryKey(routingKey.getId()); | 146 | RoutingKey oldRoutingKey = routingKeyService.selectByPrimaryKey(routingKey.getId()); |
@@ -86,9 +86,13 @@ public class UserInfoController { | @@ -86,9 +86,13 @@ public class UserInfoController { | ||
86 | * @return | 86 | * @return |
87 | */ | 87 | */ |
88 | @PutMapping("/updatePassword") | 88 | @PutMapping("/updatePassword") |
89 | - public ResultJson updatePassword(@RequestBody UserInfo userInfo) throws IOException, URISyntaxException | 89 | + public ResultJson updatePassword(@RequestBody UserInfo userInfo) |
90 | { | 90 | { |
91 | + try { | ||
91 | return userInfoService.updatePassword(userInfo); | 92 | return userInfoService.updatePassword(userInfo); |
93 | + } catch (IOException | URISyntaxException e) { | ||
94 | + return new ResultJson<>("500", "服务器异常,修改密码失败"); | ||
95 | + } | ||
92 | } | 96 | } |
93 | 97 | ||
94 | /** | 98 | /** |
@@ -75,11 +75,14 @@ public class UserMessageBindingController { | @@ -75,11 +75,14 @@ public class UserMessageBindingController { | ||
75 | */ | 75 | */ |
76 | @DeleteMapping("/delete") | 76 | @DeleteMapping("/delete") |
77 | public ResultJson deleteUserMessageBinding(@RequestBody UserMessageBinding userMessageBinding) | 77 | public ResultJson deleteUserMessageBinding(@RequestBody UserMessageBinding userMessageBinding) |
78 | - throws IOException, TimeoutException | ||
79 | { | 78 | { |
79 | + try { | ||
80 | return userMessageBindingService.deleteByPrimaryKey(userMessageBinding.getId()) > 0 | 80 | return userMessageBindingService.deleteByPrimaryKey(userMessageBinding.getId()) > 0 |
81 | - ? new ResultJson<>("200", "删除-账户消息配置信息,成功") | ||
82 | - : new ResultJson<>("500", "删除-账户消息配置信息,失败"); | 81 | + ? new ResultJson<>("200", "删除-用户户消息配置信息,成功") |
82 | + : new ResultJson<>("500", "删除-用户户消息配置信息,失败"); | ||
83 | + } catch (IOException | TimeoutException e) { | ||
84 | + return new ResultJson<>("500", "服务器异常,删除-用户户消息配置信息,失败"); | ||
85 | + } | ||
83 | } | 86 | } |
84 | 87 | ||
85 | /** | 88 | /** |
@@ -90,11 +93,14 @@ public class UserMessageBindingController { | @@ -90,11 +93,14 @@ public class UserMessageBindingController { | ||
90 | */ | 93 | */ |
91 | @GetMapping("/batchRemove") | 94 | @GetMapping("/batchRemove") |
92 | public ResultJson batchRemoveUserMessageBinding(String ids) | 95 | public ResultJson batchRemoveUserMessageBinding(String ids) |
93 | - throws IOException, TimeoutException | ||
94 | { | 96 | { |
97 | + try { | ||
95 | return userMessageBindingService.deleteByPrimaryKey(ids) > 0 | 98 | return userMessageBindingService.deleteByPrimaryKey(ids) > 0 |
96 | ? new ResultJson<>("200", "批量删除-账户消息配置信息,成功") | 99 | ? new ResultJson<>("200", "批量删除-账户消息配置信息,成功") |
97 | : new ResultJson<>("500", "批量删除-账户消息配置信息,失败"); | 100 | : new ResultJson<>("500", "批量删除-账户消息配置信息,失败"); |
101 | + } catch (IOException | TimeoutException e) { | ||
102 | + return new ResultJson<>("500", "服务器异常,批量删除-用户户消息配置信息,失败"); | ||
103 | + } | ||
98 | } | 104 | } |
99 | 105 | ||
100 | /** | 106 | /** |
@@ -119,10 +125,13 @@ public class UserMessageBindingController { | @@ -119,10 +125,13 @@ public class UserMessageBindingController { | ||
119 | */ | 125 | */ |
120 | @PostMapping("/insert") | 126 | @PostMapping("/insert") |
121 | public ResultJson insertUserMessageBinding(@RequestBody UserMessageBinding userMessageBinding) | 127 | public ResultJson insertUserMessageBinding(@RequestBody UserMessageBinding userMessageBinding) |
122 | - throws IOException, TimeoutException | ||
123 | { | 128 | { |
129 | + try { | ||
124 | return userMessageBindingService.insertSelective(userMessageBinding) > 0 | 130 | return userMessageBindingService.insertSelective(userMessageBinding) > 0 |
125 | - ? new ResultJson<>("200", "添加-账户消息配置-信息,成功") | ||
126 | - : new ResultJson<>("500", "添加-账户消息配置-信息,失败"); | 131 | + ? new ResultJson<>("200", "新增-账户消息配置-信息,成功") |
132 | + : new ResultJson<>("500", "新增-账户消息配置-信息,失败"); | ||
133 | + } catch (IOException | TimeoutException e) { | ||
134 | + return new ResultJson<>("500", "服务器异常,新增-用户户消息配置信息,失败"); | ||
135 | + } | ||
127 | } | 136 | } |
128 | } | 137 | } |
@@ -27,6 +27,8 @@ public enum CustomExceptionType { | @@ -27,6 +27,8 @@ public enum CustomExceptionType { | ||
27 | EXCHANGE_NO_EXIST("20405", "报文数据错误,交换机不存在!"), | 27 | EXCHANGE_NO_EXIST("20405", "报文数据错误,交换机不存在!"), |
28 | ROUTING_KEY_NO_EXIST("20406", "报文数据错误,路由键不存在!"), | 28 | ROUTING_KEY_NO_EXIST("20406", "报文数据错误,路由键不存在!"), |
29 | 29 | ||
30 | + SERVER_EXCEPTION("50500", "服务器异常,发送消息失败!"), | ||
31 | + | ||
30 | CLIENT_ERROR("400", "客户端异常"), | 32 | CLIENT_ERROR("400", "客户端异常"), |
31 | SYSTEM_ERROR("500", "系统服务异常"), | 33 | SYSTEM_ERROR("500", "系统服务异常"), |
32 | OTHER_ERROR("999", "其他未知异常"); | 34 | OTHER_ERROR("999", "其他未知异常"); |
@@ -94,7 +94,7 @@ public class DirectUtils { | @@ -94,7 +94,7 @@ public class DirectUtils { | ||
94 | * @return 返回链接 | 94 | * @return 返回链接 |
95 | * @throws Exception | 95 | * @throws Exception |
96 | */ | 96 | */ |
97 | - public static Connection getConnection(String hostIp, int hostPort, String vHostName, String userName, String password) throws Exception | 97 | + public static Connection getConnection(String hostIp, int hostPort, String vHostName, String userName, String password) throws IOException, TimeoutException |
98 | { | 98 | { |
99 | String base = EncryptionUtils.decryptBase64(password); | 99 | String base = EncryptionUtils.decryptBase64(password); |
100 | String[] split = base.split("\\."); | 100 | String[] split = base.split("\\."); |
@@ -243,7 +243,7 @@ public class DirectUtils { | @@ -243,7 +243,7 @@ public class DirectUtils { | ||
243 | } | 243 | } |
244 | 244 | ||
245 | 245 | ||
246 | - public ResultJson sendMessage(XmlData xmlData) throws Exception | 246 | + public ResultJson sendMessage(XmlData xmlData) throws IOException, TimeoutException |
247 | { | 247 | { |
248 | /** | 248 | /** |
249 | * 可以在这里根据类型的不同,进行不同的消息发送 | 249 | * 可以在这里根据类型的不同,进行不同的消息发送 |
@@ -253,15 +253,16 @@ public class DirectUtils { | @@ -253,15 +253,16 @@ public class DirectUtils { | ||
253 | 253 | ||
254 | /** | 254 | /** |
255 | * 发送消息,使用中 | 255 | * 发送消息,使用中 |
256 | + * | ||
256 | * @param xmlData {@link XmlData} | 257 | * @param xmlData {@link XmlData} |
257 | * @return | 258 | * @return |
258 | * @throws Exception | 259 | * @throws Exception |
259 | */ | 260 | */ |
260 | - public ResultJson directProducer(XmlData xmlData) throws Exception | 261 | + public ResultJson directProducer(XmlData xmlData) throws IOException, TimeoutException |
261 | { | 262 | { |
262 | // 1、创建Connection | 263 | // 1、创建Connection |
263 | Connection connection = getConnection(xmlData.getServerIp(), xmlData.getServerPort(), | 264 | Connection connection = getConnection(xmlData.getServerIp(), xmlData.getServerPort(), |
264 | - xmlData.getVirtualHostName(),xmlData.getSuperUsername(), xmlData.getSuperPassword()); | 265 | + xmlData.getVirtualHostName(), xmlData.getSuperUsername(), xmlData.getSuperPassword()); |
265 | // 2、 通过Connection创建一个新的Channel | 266 | // 2、 通过Connection创建一个新的Channel |
266 | Channel channel = connection.createChannel(); | 267 | Channel channel = connection.createChannel(); |
267 | // 3、开启消息的确认机制(confirm:保证消息能够发送到 exchange) | 268 | // 3、开启消息的确认机制(confirm:保证消息能够发送到 exchange) |
@@ -4,6 +4,9 @@ import com.github.pagehelper.PageInfo; | @@ -4,6 +4,9 @@ import com.github.pagehelper.PageInfo; | ||
4 | import com.sunyo.wlpt.message.bus.service.domain.MessageNote; | 4 | import com.sunyo.wlpt.message.bus.service.domain.MessageNote; |
5 | import com.sunyo.wlpt.message.bus.service.domain.XmlData; | 5 | import com.sunyo.wlpt.message.bus.service.domain.XmlData; |
6 | 6 | ||
7 | +import java.io.IOException; | ||
8 | +import java.util.concurrent.TimeoutException; | ||
9 | + | ||
7 | /** | 10 | /** |
8 | * @author 子诚 | 11 | * @author 子诚 |
9 | * Description: | 12 | * Description: |
@@ -31,9 +34,8 @@ public interface MessageNoteService { | @@ -31,9 +34,8 @@ public interface MessageNoteService { | ||
31 | * 新增,选择性 | 34 | * 新增,选择性 |
32 | * @param record the record | 35 | * @param record the record |
33 | * @return insert count | 36 | * @return insert count |
34 | - * @throws Exception 异常 | ||
35 | */ | 37 | */ |
36 | - int insertSelective(MessageNote record) throws Exception; | 38 | + int insertSelective(MessageNote record) throws IOException, TimeoutException; |
37 | 39 | ||
38 | /** | 40 | /** |
39 | * 查询,根据主键 | 41 | * 查询,根据主键 |
@@ -15,7 +15,9 @@ import org.springframework.transaction.annotation.Propagation; | @@ -15,7 +15,9 @@ import org.springframework.transaction.annotation.Propagation; | ||
15 | import org.springframework.transaction.annotation.Transactional; | 15 | import org.springframework.transaction.annotation.Transactional; |
16 | 16 | ||
17 | import javax.annotation.Resource; | 17 | import javax.annotation.Resource; |
18 | +import java.io.IOException; | ||
18 | import java.util.List; | 19 | import java.util.List; |
20 | +import java.util.concurrent.TimeoutException; | ||
19 | 21 | ||
20 | /** | 22 | /** |
21 | * @author 子诚 | 23 | * @author 子诚 |
@@ -89,7 +91,7 @@ public class MessageNoteServiceImpl implements MessageNoteService { | @@ -89,7 +91,7 @@ public class MessageNoteServiceImpl implements MessageNoteService { | ||
89 | } | 91 | } |
90 | 92 | ||
91 | @Override | 93 | @Override |
92 | - public int insertSelective(MessageNote record) throws Exception | 94 | + public int insertSelective(MessageNote record) throws IOException, TimeoutException |
93 | { | 95 | { |
94 | return validateNoteAndFill(record); | 96 | return validateNoteAndFill(record); |
95 | } | 97 | } |
@@ -237,7 +239,7 @@ public class MessageNoteServiceImpl implements MessageNoteService { | @@ -237,7 +239,7 @@ public class MessageNoteServiceImpl implements MessageNoteService { | ||
237 | * @param messageNote {@link MessageNote} | 239 | * @param messageNote {@link MessageNote} |
238 | * @return 发送信息记录的条数 | 240 | * @return 发送信息记录的条数 |
239 | */ | 241 | */ |
240 | - public int validateNoteAndFill(MessageNote messageNote) throws Exception | 242 | + public int validateNoteAndFill(MessageNote messageNote) throws IOException, TimeoutException |
241 | { | 243 | { |
242 | if (validateNote(messageNote)) { | 244 | if (validateNote(messageNote)) { |
243 | // 填充,服务器名称 | 245 | // 填充,服务器名称 |
@@ -102,6 +102,10 @@ public class UserInfoServiceImpl implements UserInfoService { | @@ -102,6 +102,10 @@ public class UserInfoServiceImpl implements UserInfoService { | ||
102 | { | 102 | { |
103 | String password = userInfo.getPassword(); | 103 | String password = userInfo.getPassword(); |
104 | String virtualHostId = userInfo.getVirtualHostId(); | 104 | String virtualHostId = userInfo.getVirtualHostId(); |
105 | + if (StringUtil.isNullOrEmpty(virtualHostId)) { | ||
106 | + return new ResultJson<>("400", "用户关系不能为空,情务必选择!"); | ||
107 | + } | ||
108 | + | ||
105 | String splitItem = ","; | 109 | String splitItem = ","; |
106 | if (virtualHostId.contains(splitItem)) { | 110 | if (virtualHostId.contains(splitItem)) { |
107 | int index = 0; | 111 | int index = 0; |
@@ -312,6 +316,18 @@ public class UserInfoServiceImpl implements UserInfoService { | @@ -312,6 +316,18 @@ public class UserInfoServiceImpl implements UserInfoService { | ||
312 | @Override | 316 | @Override |
313 | public ResultJson deleteUserRelation(UserInfo userInfo) throws IOException, URISyntaxException | 317 | public ResultJson deleteUserRelation(UserInfo userInfo) throws IOException, URISyntaxException |
314 | { | 318 | { |
319 | + String virtualHostName = userInfo.getVirtualHostName(); | ||
320 | + String userInfoId = userInfo.getId(); | ||
321 | + | ||
322 | + String splitItem = ","; | ||
323 | + if (virtualHostName.contains(splitItem)) { | ||
324 | + String[] split = virtualHostName.split(splitItem); | ||
325 | + for (int i = 0; i < split.length; i++) { | ||
326 | + | ||
327 | + } | ||
328 | + } | ||
329 | + | ||
330 | + | ||
315 | int num = userInfoMapper.deleteByPrimaryKey(userInfo.getId()); | 331 | int num = userInfoMapper.deleteByPrimaryKey(userInfo.getId()); |
316 | BusServer busServer = busServerService.selectByPrimaryKey(userInfo.getServerId()); | 332 | BusServer busServer = busServerService.selectByPrimaryKey(userInfo.getServerId()); |
317 | ClientUtils.clearPermissions(busServer, userInfo.getVirtualHostName(), userInfo.getUsername()); | 333 | ClientUtils.clearPermissions(busServer, userInfo.getVirtualHostName(), userInfo.getUsername()); |
@@ -226,8 +226,17 @@ | @@ -226,8 +226,17 @@ | ||
226 | </select> | 226 | </select> |
227 | 227 | ||
228 | <select id="selectUserInfoList" resultMap="BaseResultMap"> | 228 | <select id="selectUserInfoList" resultMap="BaseResultMap"> |
229 | - select | ||
230 | - <include refid="Base_Column_List"/> | 229 | + select group_concat(id) as id, |
230 | + username, | ||
231 | + `password`, | ||
232 | + server_id, | ||
233 | + `server_name`, | ||
234 | + group_concat(virtual_host_id) as virtual_host_id, | ||
235 | + group_concat(virtual_host_name) as virtual_host_name, | ||
236 | + real_name, | ||
237 | + description, | ||
238 | + gmt_create, | ||
239 | + gmt_modified | ||
231 | from user_info | 240 | from user_info |
232 | <where> | 241 | <where> |
233 | <if test="username != null and username != ''"> | 242 | <if test="username != null and username != ''"> |
@@ -240,7 +249,9 @@ | @@ -240,7 +249,9 @@ | ||
240 | and virtual_host_name = #{virtualHostName,jdbcType=VARCHAR} | 249 | and virtual_host_name = #{virtualHostName,jdbcType=VARCHAR} |
241 | </if> | 250 | </if> |
242 | </where> | 251 | </where> |
252 | + group by username, server_name, server_id | ||
243 | </select> | 253 | </select> |
254 | + | ||
244 | <select id="validateUserInfo" resultType="com.sunyo.wlpt.message.bus.service.domain.UserInfo"> | 255 | <select id="validateUserInfo" resultType="com.sunyo.wlpt.message.bus.service.domain.UserInfo"> |
245 | select | 256 | select |
246 | <include refid="Base_Column_List"/> | 257 | <include refid="Base_Column_List"/> |
-
请 注册 或 登录 后发表评论