Browse Source

fix: 报警

jackzhou 7 months ago
parent
commit
d865ff6179

+ 3 - 2
snowy-plugin/snowy-plugin-coldchain/src/main/java/vip/xiaonuo/coldchain/core/alarm/service/messagepush/RedisSensorAlarmMessagePushService.java

@@ -34,11 +34,11 @@ public class RedisSensorAlarmMessagePushService {
     public void pushAlarmMessage(SensorAlarm alarm) {
         String deviceID = alarm.getDeviceId();
         String alarmType = alarm.getAlarmType();
-        List<String> openids = Optional.ofNullable(alarm.getAlarmUsers()).orElse(Collections.emptyList()).stream().filter(Objects::nonNull).map(SensorAlarmUser::getOpenId).filter(Objects::nonNull).toList();
+//        List<String> openids = Optional.ofNullable(alarm.getAlarmUsers()).orElse(Collections.emptyList()).stream().filter(Objects::nonNull).map(SensorAlarmUser::getOpenId).filter(Objects::nonNull).toList();
         for (SensorAlarmUser user : alarm.getAlarmUsers()) {
             String openid=user.getUserId();
             if (hasExceededPushLimit(openid, deviceID, alarmType)) {
-//                log.info("用户 {} 对设备 {} 的告警类型 {} \n在过去{}分钟内推送次数超过限制,跳过推送", openid, deviceID, alarmType, JfcloudColdChainConstants.MESS_PUSH_TIME_WINDOW / 60 / 1000);
+                log.info("用户 {} 对设备 {} 的告警类型 {} \n在过去{}分钟内推送次数超过限制,跳过推送", openid, deviceID, alarmType, JfcloudColdChainConstants.MESS_PUSH_TIME_WINDOW / 60 / 1000);
                 continue;
             }
             // 只对当前人发送预警消息
@@ -48,6 +48,7 @@ public class RedisSensorAlarmMessagePushService {
                 if (pushService != null) {
                     try {
                         pushService.sendAlarmMessage(alarm);
+                        log.info("Alarm message sent successfully {},{}",channel.name(), alarm);
                     } catch (Exception e) {
                         log.error("推送消息失败,渠道: {},错误: {}", channel.getChannelName(), e.getMessage());
                     }