From 83e7712e26d9899754d55599c24e7414966e5f93 Mon Sep 17 00:00:00 2001 From: mmagi Date: Tue, 6 Jun 2023 21:16:10 +0800 Subject: [PATCH] fix: robot mute rule has no effect --- .../controller/services/impl/AlertRobotsServiceImpl.java | 2 +- .../org/cloud/sonic/controller/tools/robot/RobotFactory.java | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/sonic-server-controller/src/main/java/org/cloud/sonic/controller/services/impl/AlertRobotsServiceImpl.java b/sonic-server-controller/src/main/java/org/cloud/sonic/controller/services/impl/AlertRobotsServiceImpl.java index bfd16497..36523cf8 100644 --- a/sonic-server-controller/src/main/java/org/cloud/sonic/controller/services/impl/AlertRobotsServiceImpl.java +++ b/sonic-server-controller/src/main/java/org/cloud/sonic/controller/services/impl/AlertRobotsServiceImpl.java @@ -105,7 +105,7 @@ public void sendErrorDevice(int agentId, int errorType, int tem, String udId) { private void send(List robots, Message message) { for (var robot : robots) { try { - var messenger = robotFactory.getRobotMessenger(robot.getRobotType(), robot.getMuteRule()); + var messenger = robotFactory.getRobotMessenger(robot.getRobotType(), robot.getMuteRule(), message); if (messenger == null) continue; var template = robot.getTemplate(); messenger.sendMessage(restTemplate, robot.getRobotToken(), robot.getRobotSecret(), template, message); diff --git a/sonic-server-controller/src/main/java/org/cloud/sonic/controller/tools/robot/RobotFactory.java b/sonic-server-controller/src/main/java/org/cloud/sonic/controller/tools/robot/RobotFactory.java index 687111b2..bcf88c41 100644 --- a/sonic-server-controller/src/main/java/org/cloud/sonic/controller/tools/robot/RobotFactory.java +++ b/sonic-server-controller/src/main/java/org/cloud/sonic/controller/tools/robot/RobotFactory.java @@ -59,9 +59,9 @@ public RobotMessenger getRobotMessenger(int robotType) { return robotMessenger; } - public RobotMessenger getRobotMessenger(int robotType, String muteRule) { + public RobotMessenger getRobotMessenger(int robotType, String muteRule, Message message) { if (!muteRule.isEmpty()) { - var mute = RobotMessenger.parseTemplate(muteRule).getValue(RobotMessenger.ctx, String.class); + var mute = RobotMessenger.parseTemplate(muteRule).getValue(RobotMessenger.ctx, message, String.class); if ("true".equals(mute)) { return null; }