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; }