...
|
...
|
@@ -36,8 +36,21 @@ public class RouterController { |
|
|
@ApiOperation(value = "批量添加消息路由", notes = "超级管理修改其他用户密码")
|
|
|
@PostMapping("batchAdd")
|
|
|
public ResultJson batchAddRouter(@RequestBody MessageRouter messageRouter){
|
|
|
boolean result = routerService.batchAddRouter(messageRouter);
|
|
|
return result ? new ResultJson("200","success") :new ResultJson("400","error");
|
|
|
if (messageRouter.getSndrs()!=null && messageRouter.getTypes()!=null && messageRouter.getRcvrs()!=null){
|
|
|
List<String> senders = messageRouter.getSndrs();
|
|
|
if (senders!=null && !senders.isEmpty()){
|
|
|
for (String sndr: senders) {
|
|
|
MessageRouter record=new MessageRouter();
|
|
|
record.setSndr(sndr);
|
|
|
int count=messageRouterService.selectCountRouter(record);
|
|
|
if(count>0){
|
|
|
return new ResultJson("400","消息路由已存在!");
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
boolean result = routerService.batchAddRouter(messageRouter);
|
|
|
return result ? new ResultJson("200","success") :new ResultJson("400","error");
|
|
|
}
|
|
|
|
|
|
@GetMapping("searchBysndr")
|
...
|
...
|
@@ -50,17 +63,21 @@ public class RouterController { |
|
|
@PostMapping("/addRouter")
|
|
|
@Transactional
|
|
|
public ResultJson addRouter(@RequestBody MessageRouter messageRouter) throws Exception {
|
|
|
int count=messageRouterService.selectCountRouter(messageRouter);
|
|
|
if(count>0){
|
|
|
return new ResultJson("200","路由消息已存在!");
|
|
|
}
|
|
|
String routerid=UUID.randomUUID().toString();
|
|
|
String reciverid=UUID.randomUUID().toString();
|
|
|
messageRouter.setId(routerid);
|
|
|
int result=messageRouterService.addRouter(messageRouter);
|
|
|
if(messageRouter.getReciver()!=null){
|
|
|
if(messageRouter.getReciver().getRcvrTopic()!=null &&messageRouter.getReciver().getRcvrTopic()!=""){
|
|
|
MessageRouterReciver routerReciver=new MessageRouterReciver();
|
|
|
routerReciver.setId(reciverid);
|
|
|
routerReciver.setMessageRouterId(routerid);
|
|
|
routerReciver.setRcvrTopic(messageRouter.getReciver().getRcvrTopic());
|
|
|
messageRouterReciverService.addMessageRouterReciver(routerReciver);
|
|
|
if(messageRouter.getReciver().getReciverFilter()!=null){
|
|
|
if(messageRouter.getReciver().getReciverFilter().getFilter()!=null&& messageRouter.getReciver().getReciverFilter().getFilter()!=""){
|
|
|
MessageRouterReciverFilter routerReciverFilter=new MessageRouterReciverFilter();
|
|
|
routerReciverFilter.setId(UUID.randomUUID().toString());
|
|
|
routerReciverFilter.setMessageRouterReciverId(reciverid);
|
...
|
...
|
|