|
@@ -35,12 +35,14 @@ public class RedisSensorAlarmMessagePushService {
|
|
|
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();
|
|
|
-
|
|
|
- for (String openid : openids) {
|
|
|
+ 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);
|
|
|
continue;
|
|
|
}
|
|
|
+ // 只对当前人发送预警消息
|
|
|
+ alarm.setAlarmUsers(List.of(user));
|
|
|
for (NotificationChannel channel : alarm.getNotificationChannel()) {
|
|
|
MessagePushService pushService = pushServices.get(channel.name());
|
|
|
if (pushService != null) {
|