Commit 092fd478 by 李小龙

fix:

parent a20399eb
......@@ -155,11 +155,11 @@ public class BehaviorAlarm implements IAlarm {
log.error("未关联长者,设备id:"+platDevice.getId());
return;
}
PlatRoom platRoom = platAlarmCheckDTO.getPlatRoom();
List<PlatElder> platElderList = platAlarmCheckDTO.getPlatElderList();
if(CollectionUtils.isNotEmpty(platElderList)){
platAlarmRecordService.getElderListByDeviceId(platAlarmCheckDTO);
platElderList = platAlarmCheckDTO.getPlatElderList();
}
for (PlatElder platElder : platElderList) {
PlatDayDurationRecord durationRecord = new PlatDayDurationRecord();
......
......@@ -269,7 +269,8 @@ public class PlatAlarmRecordServiceImpl extends ServiceImpl<PlatAlarmRecordMappe
} else {
String notifyUser = alarmConfig.getNotifyUser();
if(StringUtils.isBlank(notifyUser)){
throw new BusinessException("告警内部人员未配置,告警配置id:"+alarmConfig.getId());
log.error("告警内部人员未配置,告警配置id:"+alarmConfig.getId());
return;
}
String[] userArray = notifyUser.split(",");
List<PlatUser> platUsers = platUserService.listByIds(Arrays.asList(userArray));
......@@ -277,7 +278,8 @@ public class PlatAlarmRecordServiceImpl extends ServiceImpl<PlatAlarmRecordMappe
}
platUserList.removeIf(Objects::isNull);
if (CollectionUtils.isEmpty(platUserList)) {
throw new BusinessException("通知工作人员时,找不到人员数据;" + "orgId:" + alarmConfig.getOrgId() + ",tenantId:" + alarmConfig.getTenantId() + "alarmConfigId:" + alarmConfig.getId());
log.error("通知工作人员时,找不到人员数据;" + "orgId:" + alarmConfig.getOrgId() + ",tenantId:" + alarmConfig.getTenantId() + "alarmConfigId:" + alarmConfig.getId());
return;
}
List<SendTypeEnum> notifyChannelList = Arrays.asList(SendTypeEnum.SMS, SendTypeEnum.VOICE_SMS, SendTypeEnum.MAIL);
Set<String> phoneSet = platUserList.stream().map(PlatUser::getMobile).collect(Collectors.toSet());
......@@ -364,7 +366,8 @@ public class PlatAlarmRecordServiceImpl extends ServiceImpl<PlatAlarmRecordMappe
//todo 要支持 设备绑定多个空间
List<PlatRoomBedDevice> platRoomBedDeviceList = platRoomBedDeviceService.list(roomBedDeviceLambdaQueryWrapper);
if(CollectionUtils.isNotEmpty(platRoomBedDeviceList)){
throw new BusinessException("设备没绑定房间:"+platDevice.getId());
log.error("设备没绑定房间:"+platDevice.getId());
return;
}
platRoomBedDeviceList.forEach(platRoomBedDevice -> {
......
......@@ -83,6 +83,7 @@ public class PushCallback implements MqttCallback {
HeaderInfo headers = device.getHeaders();
List<HeaderInfo.Bind> bindings = headers.getBindings();
for (HeaderInfo.Bind binding : bindings) {
try {
String iot_tenantId = binding.getId();
StopWatch stopWatch = new StopWatch();
stopWatch.start("checkAlarm-1");
......@@ -91,15 +92,15 @@ public class PushCallback implements MqttCallback {
JSONObject properties = device.getProperties();
//iot设备id
PlatDevice platDevice = deviceCacheUtil.get(deviceId+":"+iot_tenantId);
if(platDevice==null){
logger.error("获取设备信息异常,设备iot-id:"+deviceId);
PlatDevice platDevice = deviceCacheUtil.get(deviceId + ":" + iot_tenantId);
if (platDevice == null) {
logger.error("获取设备信息异常,设备iot-id:" + deviceId);
return;
}
List<PlatAlarmConfig> deviceAlarmConfigList = alarmConfigCacheUtil.getDeviceAlarmConfigMap(platDevice);
deviceAlarmConfigList.removeIf(Objects::isNull);
if (CollectionUtils.isEmpty(deviceAlarmConfigList)) {
logger.error("该设备没有告警配置,设备iot-id:"+deviceId);
logger.error("该设备没有告警配置,设备iot-id:" + deviceId);
return;
}
for (PlatAlarmConfig config : deviceAlarmConfigList) {
......@@ -121,6 +122,9 @@ public class PushCallback implements MqttCallback {
}
stopWatch.stop();
logger.info(stopWatch.prettyPrint());
}catch (Exception e){
logger.error("告警异常pushCallback:",e);
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment