Commit 68eb3096 by 杨伟程
parents 9050c3cd 925f7211
...@@ -4,7 +4,6 @@ import com.alibaba.fastjson.JSONObject; ...@@ -4,7 +4,6 @@ import com.alibaba.fastjson.JSONObject;
import com.makeit.entity.platform.alarm.PlatAlarmConfig; import com.makeit.entity.platform.alarm.PlatAlarmConfig;
import com.makeit.entity.platform.device.PlatDevice; import com.makeit.entity.platform.device.PlatDevice;
import com.makeit.entity.platform.elder.PlatElder; import com.makeit.entity.platform.elder.PlatElder;
import com.makeit.entity.platform.space.PlatRegionSetting;
import com.makeit.entity.platform.space.PlatRoom; import com.makeit.entity.platform.space.PlatRoom;
import lombok.Data; import lombok.Data;
...@@ -32,7 +31,5 @@ public class PlatAlarmCheckDTO { ...@@ -32,7 +31,5 @@ public class PlatAlarmCheckDTO {
//异常值 //异常值
private String abnormalValue; private String abnormalValue;
private PlatRegionSetting platRegionSetting;
} }
...@@ -194,5 +194,8 @@ public class PlatElder extends BaseBusEntity { ...@@ -194,5 +194,8 @@ public class PlatElder extends BaseBusEntity {
@ApiModelProperty(value = "退住时间") @ApiModelProperty(value = "退住时间")
private LocalDateTime checkOutTime; private LocalDateTime checkOutTime;
@TableField(exist = false)
private String regionName;
} }
package com.makeit.enums.saas;
import lombok.AllArgsConstructor;
import lombok.Getter;
@AllArgsConstructor
@Getter
public enum ModelManageTypeEnum {
SLEEP("sleep","睡眠"),
DISEASE("disease","呼吸心率");
private String code;
private String value;
}
...@@ -8,6 +8,7 @@ import com.makeit.dto.platform.alarm.PlatAlarmCheckDTO; ...@@ -8,6 +8,7 @@ import com.makeit.dto.platform.alarm.PlatAlarmCheckDTO;
import com.makeit.dto.platform.alarm.PlatAlarmRecordQueryDTO; import com.makeit.dto.platform.alarm.PlatAlarmRecordQueryDTO;
import com.makeit.entity.platform.alarm.PlatAlarmConfig; import com.makeit.entity.platform.alarm.PlatAlarmConfig;
import com.makeit.entity.platform.alarm.PlatAlarmRecord; import com.makeit.entity.platform.alarm.PlatAlarmRecord;
import com.makeit.entity.platform.elder.PlatElder;
import com.makeit.vo.platform.alarm.PlatAlarmRecordVO; import com.makeit.vo.platform.alarm.PlatAlarmRecordVO;
/** /**
...@@ -55,7 +56,7 @@ public interface PlatAlarmRecordService extends IService<PlatAlarmRecord> { ...@@ -55,7 +56,7 @@ public interface PlatAlarmRecordService extends IService<PlatAlarmRecord> {
*/ */
void noticeDeviceAlarm(PlatAlarmConfig alarmConfig, PlatAlarmRecord alarmRecord); void noticeDeviceAlarm(PlatAlarmConfig alarmConfig, PlatAlarmRecord alarmRecord);
PlatAlarmRecord convertToPlatAlarmRecord(PlatAlarmCheckDTO platAlarmCheckDTO); PlatAlarmRecord convertToPlatAlarmRecord(PlatAlarmCheckDTO platAlarmCheckDTO, PlatElder platElder);
void getElderListByDeviceId(PlatAlarmCheckDTO platAlarmCheckDTO); void getElderListByDeviceId(PlatAlarmCheckDTO platAlarmCheckDTO);
......
...@@ -2,7 +2,6 @@ package com.makeit.service.platform.alarm.alarmStrategy; ...@@ -2,7 +2,6 @@ package com.makeit.service.platform.alarm.alarmStrategy;
import cn.hutool.core.convert.Convert; import cn.hutool.core.convert.Convert;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.makeit.common.entity.BaseEntity;
import com.makeit.dto.platform.alarm.PlatAlarmCheckDTO; import com.makeit.dto.platform.alarm.PlatAlarmCheckDTO;
import com.makeit.dto.platform.alarm.PlatAlarmConfigBehaviorDTOVO; import com.makeit.dto.platform.alarm.PlatAlarmConfigBehaviorDTOVO;
import com.makeit.entity.platform.alarm.PlatAlarmConfig; import com.makeit.entity.platform.alarm.PlatAlarmConfig;
...@@ -10,7 +9,6 @@ import com.makeit.entity.platform.alarm.PlatAlarmRecord; ...@@ -10,7 +9,6 @@ import com.makeit.entity.platform.alarm.PlatAlarmRecord;
import com.makeit.entity.platform.alarm.PlatDayDurationRecord; import com.makeit.entity.platform.alarm.PlatDayDurationRecord;
import com.makeit.entity.platform.device.PlatDevice; import com.makeit.entity.platform.device.PlatDevice;
import com.makeit.entity.platform.elder.PlatElder; import com.makeit.entity.platform.elder.PlatElder;
import com.makeit.entity.platform.space.PlatRegionSetting;
import com.makeit.entity.platform.space.PlatRoom; import com.makeit.entity.platform.space.PlatRoom;
import com.makeit.enums.CommonEnum; import com.makeit.enums.CommonEnum;
import com.makeit.enums.platform.alarm.PlatAlarmConfigEnum; import com.makeit.enums.platform.alarm.PlatAlarmConfigEnum;
...@@ -33,7 +31,6 @@ import java.util.ArrayList; ...@@ -33,7 +31,6 @@ import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.stream.Collectors;
@Component @Component
@Slf4j @Slf4j
...@@ -66,7 +63,7 @@ public class BehaviorAlarm implements IAlarm { ...@@ -66,7 +63,7 @@ public class BehaviorAlarm implements IAlarm {
String ruleConfigStr = config.getRuleConfig(); String ruleConfigStr = config.getRuleConfig();
JSONObject properties = platAlarmCheckDTO.getProperties(); JSONObject properties = platAlarmCheckDTO.getProperties();
PlatDevice platDevice = platAlarmCheckDTO.getPlatDevice(); PlatDevice platDevice = platAlarmCheckDTO.getPlatDevice();
String deviceId = platDevice.getOriDeviceId(); String deviceId = platDevice.getId();
if (StringUtils.isBlank(ruleConfigStr)) { if (StringUtils.isBlank(ruleConfigStr)) {
log.error("行为告警配置未配置,告警配置id:" + config.getId()); log.error("行为告警配置未配置,告警配置id:" + config.getId());
return; return;
...@@ -74,7 +71,7 @@ public class BehaviorAlarm implements IAlarm { ...@@ -74,7 +71,7 @@ public class BehaviorAlarm implements IAlarm {
String personState = Convert.toStr(properties.get("personState")); String personState = Convert.toStr(properties.get("personState"));
PlatAlarmConfigBehaviorDTOVO ruleConfig = JsonUtil.toObj(ruleConfigStr, PlatAlarmConfigBehaviorDTOVO.class); PlatAlarmConfigBehaviorDTOVO ruleConfig = JsonUtil.toObj(ruleConfigStr, PlatAlarmConfigBehaviorDTOVO.class);
Integer duration = ruleConfig.getAverageDuration();//分钟 Integer duration = ruleConfig.getAverageDuration();//分钟
PlatDayDurationRecord platDayDurationRecord = dayDurationUtil.get(platDevice.getOriDeviceId()); PlatDayDurationRecord platDayDurationRecord = dayDurationUtil.get(deviceId);
// if (platDayDurationRecord == null) { // if (platDayDurationRecord == null) {
// log.error("行为告警未找到行为异常平均时长,设备plat_id:" + platDevice.getId()); // log.error("行为告警未找到行为异常平均时长,设备plat_id:" + platDevice.getId());
// return; // return;
...@@ -148,7 +145,7 @@ public class BehaviorAlarm implements IAlarm { ...@@ -148,7 +145,7 @@ public class BehaviorAlarm implements IAlarm {
PlatAlarmConfig config = platAlarmCheckDTO.getPlatAlarmConfig(); PlatAlarmConfig config = platAlarmCheckDTO.getPlatAlarmConfig();
PlatDevice platDevice = platAlarmCheckDTO.getPlatDevice(); PlatDevice platDevice = platAlarmCheckDTO.getPlatDevice();
PlatRegionSetting platRegionSetting = platAlarmCheckDTO.getPlatRegionSetting();
Date now = new Date(); Date now = new Date();
long endLong = now.getTime(); long endLong = now.getTime();
long count = endLong - alarmRedisDTO.getStartLong(); long count = endLong - alarmRedisDTO.getStartLong();
...@@ -158,23 +155,26 @@ public class BehaviorAlarm implements IAlarm { ...@@ -158,23 +155,26 @@ public class BehaviorAlarm implements IAlarm {
log.error("未关联长者,设备id:"+platDevice.getId()); log.error("未关联长者,设备id:"+platDevice.getId());
return; return;
} }
PlatRoom platRoom = platAlarmCheckDTO.getPlatRoom();
List<PlatElder> platElderList = platAlarmCheckDTO.getPlatElderList(); List<PlatElder> platElderList = platAlarmCheckDTO.getPlatElderList();
PlatDayDurationRecord durationRecord = new PlatDayDurationRecord(); if(CollectionUtils.isNotEmpty(platElderList)){
durationRecord.setElderIds(platElderList.stream().map(BaseEntity::getId).collect(Collectors.joining(","))); platAlarmRecordService.getElderListByDeviceId(platAlarmCheckDTO);
durationRecord.setDuration(count); platElderList = platAlarmCheckDTO.getPlatElderList();
durationRecord.setOriDeviceId(platDevice.getOriDeviceId()); }
durationRecord.setDay(alarmRedisDTO.getStart()); for (PlatElder platElder : platElderList) {
durationRecord.setStartDate(alarmRedisDTO.getStart()); PlatDayDurationRecord durationRecord = new PlatDayDurationRecord();
durationRecord.setEndDate(now); durationRecord.setElderIds(platElder.getId());
durationRecord.setTenantId(config.getTenantId()); durationRecord.setRegionName(platElder.getRegionName());
durationRecord.setRoomId(platRoom.getId()); durationRecord.setDuration(count);
durationRecord.setDeviceId(platDevice.getId()); durationRecord.setOriDeviceId(platDevice.getOriDeviceId());
if (platRegionSetting != null) { durationRecord.setDay(alarmRedisDTO.getStart());
durationRecord.setRegionName(platRegionSetting.getRegionName()); durationRecord.setStartDate(alarmRedisDTO.getStart());
durationRecord.setEndDate(now);
durationRecord.setTenantId(config.getTenantId());
durationRecord.setRoomId(platElder.getRoomId());
durationRecord.setDeviceId(platDevice.getId());
platDayDurationRecordService.saveOrUpdate(durationRecord);
} }
platDayDurationRecordService.saveOrUpdate(durationRecord);
} }
@Override @Override
...@@ -202,7 +202,7 @@ public class BehaviorAlarm implements IAlarm { ...@@ -202,7 +202,7 @@ public class BehaviorAlarm implements IAlarm {
param.add(platElder.getName()); param.add(platElder.getName());
param.add(platRoom.getName()); param.add(platRoom.getName());
platAlarmCheckDTO.setParam(param); platAlarmCheckDTO.setParam(param);
PlatAlarmRecord platAlarmRecord = platAlarmRecordService.convertToPlatAlarmRecord(platAlarmCheckDTO); PlatAlarmRecord platAlarmRecord = platAlarmRecordService.convertToPlatAlarmRecord(platAlarmCheckDTO,platElder);
platAlarmRecord.setElderIds(platElder.getId()); platAlarmRecord.setElderIds(platElder.getId());
platAlarmRecord.setElderName(platElder.getName()); platAlarmRecord.setElderName(platElder.getName());
platAlarmRecordService.noticeDeviceAlarm(platAlarmCheckDTO.getPlatAlarmConfig(), platAlarmRecord); platAlarmRecordService.noticeDeviceAlarm(platAlarmCheckDTO.getPlatAlarmConfig(), platAlarmRecord);
......
...@@ -84,7 +84,7 @@ public class BreathAlarm implements IAlarm { ...@@ -84,7 +84,7 @@ public class BreathAlarm implements IAlarm {
Integer duration = ruleConfig.getDuration(); Integer duration = ruleConfig.getDuration();
JSONObject properties = platAlarmCheckDTO.getProperties(); JSONObject properties = platAlarmCheckDTO.getProperties();
PlatDevice platDevice = platAlarmCheckDTO.getPlatDevice(); PlatDevice platDevice = platAlarmCheckDTO.getPlatDevice();
String deviceId = platDevice.getOriDeviceId(); String deviceId = platDevice.getId();
String personState = Convert.toStr(properties.get("personState")); String personState = Convert.toStr(properties.get("personState"));
//呼吸率 //呼吸率
...@@ -163,7 +163,7 @@ public class BreathAlarm implements IAlarm { ...@@ -163,7 +163,7 @@ public class BreathAlarm implements IAlarm {
param.add(platElder.getName()); param.add(platElder.getName());
param.add(platAlarmCheckDTO.getRemark()); param.add(platAlarmCheckDTO.getRemark());
platAlarmCheckDTO.setParam(param); platAlarmCheckDTO.setParam(param);
PlatAlarmRecord platAlarmRecord = platAlarmRecordService.convertToPlatAlarmRecord(platAlarmCheckDTO); PlatAlarmRecord platAlarmRecord = platAlarmRecordService.convertToPlatAlarmRecord(platAlarmCheckDTO,platElder);
platAlarmRecord.setElderIds(platElder.getId()); platAlarmRecord.setElderIds(platElder.getId());
platAlarmRecord.setElderName(platElder.getName()); platAlarmRecord.setElderName(platElder.getName());
platAlarmRecordService.noticeDeviceAlarm(platAlarmCheckDTO.getPlatAlarmConfig(), platAlarmRecord); platAlarmRecordService.noticeDeviceAlarm(platAlarmCheckDTO.getPlatAlarmConfig(), platAlarmRecord);
......
...@@ -44,7 +44,7 @@ public class FallAlarm implements IAlarm { ...@@ -44,7 +44,7 @@ public class FallAlarm implements IAlarm {
public void checkConfig(PlatAlarmCheckDTO platAlarmCheckDTO) { public void checkConfig(PlatAlarmCheckDTO platAlarmCheckDTO) {
JSONObject properties = platAlarmCheckDTO.getProperties(); JSONObject properties = platAlarmCheckDTO.getProperties();
PlatDevice platDevice = platAlarmCheckDTO.getPlatDevice(); PlatDevice platDevice = platAlarmCheckDTO.getPlatDevice();
String deviceId = platDevice.getOriDeviceId(); String deviceId = platDevice.getId();
String personState = Convert.toStr(properties.get("personState")); String personState = Convert.toStr(properties.get("personState"));
AlarmRedisDTO alarmRedisDTO = RedisUtil.get(RedisConst.ALARM_DEVICE_FALL_ID + deviceId); AlarmRedisDTO alarmRedisDTO = RedisUtil.get(RedisConst.ALARM_DEVICE_FALL_ID + deviceId);
if(alarmRedisDTO==null){ if(alarmRedisDTO==null){
...@@ -54,7 +54,7 @@ public class FallAlarm implements IAlarm { ...@@ -54,7 +54,7 @@ public class FallAlarm implements IAlarm {
} }
if (StringUtils.equals(personState, CommonEnum.YES.getValue())) { if (StringUtils.equals(personState, CommonEnum.YES.getValue())) {
if (StringUtils.equals(alarmRedisDTO.getAlarm(),CommonEnum.YES.getValue())){ if (StringUtils.equals(alarmRedisDTO.getAlarm(),CommonEnum.YES.getValue())){
log.error("长者跌倒,已告警过,设备iot_id:"+deviceId); log.error("长者跌倒,已告警过,设备plat_id:"+deviceId);
return; return;
} }
notice(platAlarmCheckDTO); notice(platAlarmCheckDTO);
...@@ -83,7 +83,7 @@ public class FallAlarm implements IAlarm { ...@@ -83,7 +83,7 @@ public class FallAlarm implements IAlarm {
param.add(platElder.getName()); param.add(platElder.getName());
param.add(platRoom.getName()); param.add(platRoom.getName());
platAlarmCheckDTO.setParam(param); platAlarmCheckDTO.setParam(param);
PlatAlarmRecord platAlarmRecord = platAlarmRecordService.convertToPlatAlarmRecord(platAlarmCheckDTO); PlatAlarmRecord platAlarmRecord = platAlarmRecordService.convertToPlatAlarmRecord(platAlarmCheckDTO,platElder);
platAlarmRecord.setElderIds(platElder.getId()); platAlarmRecord.setElderIds(platElder.getId());
platAlarmRecord.setElderName(platElder.getName()); platAlarmRecord.setElderName(platElder.getName());
platAlarmRecordService.noticeDeviceAlarm(platAlarmCheckDTO.getPlatAlarmConfig(), platAlarmRecord); platAlarmRecordService.noticeDeviceAlarm(platAlarmCheckDTO.getPlatAlarmConfig(), platAlarmRecord);
......
...@@ -71,7 +71,7 @@ public class HeartAlarm implements IAlarm { ...@@ -71,7 +71,7 @@ public class HeartAlarm implements IAlarm {
JSONObject properties = platAlarmCheckDTO.getProperties(); JSONObject properties = platAlarmCheckDTO.getProperties();
PlatDevice platDevice = platAlarmCheckDTO.getPlatDevice(); PlatDevice platDevice = platAlarmCheckDTO.getPlatDevice();
String deviceId = platDevice.getOriDeviceId(); String deviceId = platDevice.getId();
Integer start = ruleConfig.getHeartRateStart(); Integer start = ruleConfig.getHeartRateStart();
Integer end = ruleConfig.getHeartRateeEnd(); Integer end = ruleConfig.getHeartRateeEnd();
Integer duration = ruleConfig.getDuration(); Integer duration = ruleConfig.getDuration();
...@@ -144,7 +144,7 @@ public class HeartAlarm implements IAlarm { ...@@ -144,7 +144,7 @@ public class HeartAlarm implements IAlarm {
param.add(platElder.getName()); param.add(platElder.getName());
param.add(platAlarmCheckDTO.getRemark()); param.add(platAlarmCheckDTO.getRemark());
platAlarmCheckDTO.setParam(param); platAlarmCheckDTO.setParam(param);
PlatAlarmRecord platAlarmRecord = platAlarmRecordService.convertToPlatAlarmRecord(platAlarmCheckDTO); PlatAlarmRecord platAlarmRecord = platAlarmRecordService.convertToPlatAlarmRecord(platAlarmCheckDTO,platElder);
platAlarmRecord.setElderIds(platElder.getId()); platAlarmRecord.setElderIds(platElder.getId());
platAlarmRecord.setElderName(platElder.getName()); platAlarmRecord.setElderName(platElder.getName());
platAlarmRecordService.noticeDeviceAlarm(platAlarmCheckDTO.getPlatAlarmConfig(), platAlarmRecord); platAlarmRecordService.noticeDeviceAlarm(platAlarmCheckDTO.getPlatAlarmConfig(), platAlarmRecord);
......
...@@ -39,7 +39,6 @@ import com.makeit.utils.msg.dto.MsgSendDTO; ...@@ -39,7 +39,6 @@ import com.makeit.utils.msg.dto.MsgSendDTO;
import com.makeit.utils.sql.join.JoinUtil; import com.makeit.utils.sql.join.JoinUtil;
import com.makeit.utils.user.common.CommonUserUtil; import com.makeit.utils.user.common.CommonUserUtil;
import com.makeit.utils.user.common.CommonUserVO; import com.makeit.utils.user.common.CommonUserVO;
import com.makeit.utils.user.wechat.WechatUserInfo;
import com.makeit.utils.user.wechat.WechatUserUtil; import com.makeit.utils.user.wechat.WechatUserUtil;
import com.makeit.vo.platform.alarm.PlatAlarmRecordVO; import com.makeit.vo.platform.alarm.PlatAlarmRecordVO;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
...@@ -112,11 +111,12 @@ public class PlatAlarmRecordServiceImpl extends ServiceImpl<PlatAlarmRecordMappe ...@@ -112,11 +111,12 @@ public class PlatAlarmRecordServiceImpl extends ServiceImpl<PlatAlarmRecordMappe
*/ */
@Override @Override
public PageVO<PlatAlarmRecordVO> childrenPage(PageReqDTO<PlatAlarmRecordQueryDTO> dto) { public PageVO<PlatAlarmRecordVO> childrenPage(PageReqDTO<PlatAlarmRecordQueryDTO> dto) {
WechatUserInfo userVO = WechatUserUtil.getUserVO(); PlatElderChildrenInfo platElderChildrenInfo = platElderChildrenInfoService.getById(WechatUserUtil.getUserId());
String elderId = userVO.getElderId(); log.info("子女端账号:"+platElderChildrenInfo.toString());
if (StringUtils.isBlank(elderId)) { if (platElderChildrenInfo == null) {
return new PageVO<>(); return new PageVO<>();
} }
String elderId = platElderChildrenInfo.getElderId();
String[] split = elderId.split(","); String[] split = elderId.split(",");
PlatAlarmRecordQueryDTO data = dto.getData(); PlatAlarmRecordQueryDTO data = dto.getData();
data.setElderIdList(Arrays.asList(split)); data.setElderIdList(Arrays.asList(split));
...@@ -269,7 +269,8 @@ public class PlatAlarmRecordServiceImpl extends ServiceImpl<PlatAlarmRecordMappe ...@@ -269,7 +269,8 @@ public class PlatAlarmRecordServiceImpl extends ServiceImpl<PlatAlarmRecordMappe
} else { } else {
String notifyUser = alarmConfig.getNotifyUser(); String notifyUser = alarmConfig.getNotifyUser();
if(StringUtils.isBlank(notifyUser)){ if(StringUtils.isBlank(notifyUser)){
throw new BusinessException("告警内部人员未配置,告警配置id:"+alarmConfig.getId()); log.error("告警内部人员未配置,告警配置id:"+alarmConfig.getId());
return;
} }
String[] userArray = notifyUser.split(","); String[] userArray = notifyUser.split(",");
List<PlatUser> platUsers = platUserService.listByIds(Arrays.asList(userArray)); List<PlatUser> platUsers = platUserService.listByIds(Arrays.asList(userArray));
...@@ -277,7 +278,8 @@ public class PlatAlarmRecordServiceImpl extends ServiceImpl<PlatAlarmRecordMappe ...@@ -277,7 +278,8 @@ public class PlatAlarmRecordServiceImpl extends ServiceImpl<PlatAlarmRecordMappe
} }
platUserList.removeIf(Objects::isNull); platUserList.removeIf(Objects::isNull);
if (CollectionUtils.isEmpty(platUserList)) { 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); List<SendTypeEnum> notifyChannelList = Arrays.asList(SendTypeEnum.SMS, SendTypeEnum.VOICE_SMS, SendTypeEnum.MAIL);
Set<String> phoneSet = platUserList.stream().map(PlatUser::getMobile).collect(Collectors.toSet()); Set<String> phoneSet = platUserList.stream().map(PlatUser::getMobile).collect(Collectors.toSet());
...@@ -321,13 +323,12 @@ public class PlatAlarmRecordServiceImpl extends ServiceImpl<PlatAlarmRecordMappe ...@@ -321,13 +323,12 @@ public class PlatAlarmRecordServiceImpl extends ServiceImpl<PlatAlarmRecordMappe
} }
@Override @Override
public PlatAlarmRecord convertToPlatAlarmRecord(PlatAlarmCheckDTO platAlarmCheckDTO) { public PlatAlarmRecord convertToPlatAlarmRecord(PlatAlarmCheckDTO platAlarmCheckDTO,PlatElder platElder) {
PlatAlarmConfig config = platAlarmCheckDTO.getPlatAlarmConfig(); PlatAlarmConfig config = platAlarmCheckDTO.getPlatAlarmConfig();
PlatDevice platDevice = platAlarmCheckDTO.getPlatDevice(); PlatDevice platDevice = platAlarmCheckDTO.getPlatDevice();
List<String> param = platAlarmCheckDTO.getParam(); List<String> param = platAlarmCheckDTO.getParam();
List<PlatElder> elderList = platAlarmCheckDTO.getPlatElderList();
PlatRegionSetting platRegionSetting = platAlarmCheckDTO.getPlatRegionSetting();
PlatAlarmRecord platAlarmRecord = new PlatAlarmRecord(); PlatAlarmRecord platAlarmRecord = new PlatAlarmRecord();
platAlarmRecord.setAlarmId(config.getId()); platAlarmRecord.setAlarmId(config.getId());
...@@ -341,13 +342,11 @@ public class PlatAlarmRecordServiceImpl extends ServiceImpl<PlatAlarmRecordMappe ...@@ -341,13 +342,11 @@ public class PlatAlarmRecordServiceImpl extends ServiceImpl<PlatAlarmRecordMappe
platAlarmRecord.setNotifyUser(config.getNotifyUser()); platAlarmRecord.setNotifyUser(config.getNotifyUser());
platAlarmRecord.setDeviceId(platDevice.getId()); platAlarmRecord.setDeviceId(platDevice.getId());
platAlarmRecord.setElderIds(elderList.stream().map(BaseEntity::getId).collect(Collectors.joining(","))); platAlarmRecord.setElderIds(platElder.getId());
platAlarmRecord.setTenantId(config.getTenantId()); platAlarmRecord.setTenantId(config.getTenantId());
platAlarmRecord.setRemark(platAlarmCheckDTO.getRemark()); platAlarmRecord.setRemark(platAlarmCheckDTO.getRemark());
platAlarmRecord.setAbnormalValue(platAlarmCheckDTO.getAbnormalValue()); platAlarmRecord.setAbnormalValue(platAlarmCheckDTO.getAbnormalValue());
if(platRegionSetting!=null) { platAlarmRecord.setRegionName(platElder.getRegionName());
platAlarmRecord.setRegionName(platRegionSetting.getRegionName());
}
return platAlarmRecord; return platAlarmRecord;
} }
...@@ -364,47 +363,64 @@ public class PlatAlarmRecordServiceImpl extends ServiceImpl<PlatAlarmRecordMappe ...@@ -364,47 +363,64 @@ public class PlatAlarmRecordServiceImpl extends ServiceImpl<PlatAlarmRecordMappe
roomBedDeviceLambdaQueryWrapper.eq(PlatRoomBedDevice::getDeviceId, platDevice.getId()) roomBedDeviceLambdaQueryWrapper.eq(PlatRoomBedDevice::getDeviceId, platDevice.getId())
.eq(BaseBusEntity::getTenantId,tenantId) .eq(BaseBusEntity::getTenantId,tenantId)
; ;
PlatRoomBedDevice platRoomBedDevice = platRoomBedDeviceService.getOne(roomBedDeviceLambdaQueryWrapper, false); //todo 要支持 设备绑定多个空间
if(platRoomBedDevice==null){ List<PlatRoomBedDevice> platRoomBedDeviceList = platRoomBedDeviceService.list(roomBedDeviceLambdaQueryWrapper);
throw new BusinessException("设备没绑定房间:"+platDevice.getId()); if(CollectionUtils.isEmpty(platRoomBedDeviceList)){
log.error("设备没绑定房间:"+platDevice.getId());
return;
} }
if(StringUtils.isNotBlank(platRoomBedDevice.getRoomId())) { platRoomBedDeviceList.forEach(platRoomBedDevice -> {
PlatRoom platRoom = platRoomService.getById(platRoomBedDevice.getRoomId()); //获取区域
platAlarmCheckDTO.setPlatRoom(platRoom); String regionName = null;
if(StringUtils.isNotBlank(platRoomBedDevice.getRoomId())) {
LambdaQueryWrapper<PlatRegionSetting> platRegionSettingLambdaQueryWrapper = new LambdaQueryWrapper<>(); PlatRoom platRoom = platRoomService.getById(platRoomBedDevice.getRoomId());
platRegionSettingLambdaQueryWrapper.eq(PlatRegionSetting::getRoomId, platRoom.getId()) platAlarmCheckDTO.setPlatRoom(platRoom);
.eq(PlatRegionSetting::getDeviceId, platDevice.getId())
.eq(BaseBusEntity::getTenantId,tenantId) LambdaQueryWrapper<PlatRegionSetting> platRegionSettingLambdaQueryWrapper = new LambdaQueryWrapper<>();
; platRegionSettingLambdaQueryWrapper.eq(PlatRegionSetting::getRoomId, platRoom.getId())
//区域设置 .eq(PlatRegionSetting::getDeviceId, platDevice.getId())
PlatRegionSetting platRegionSetting = platRegionSettingService.getOne(platRegionSettingLambdaQueryWrapper, false); .eq(BaseBusEntity::getTenantId,tenantId)
platAlarmCheckDTO.setPlatRegionSetting(platRegionSetting); ;
} //区域设置
String bedId = platRoomBedDevice.getBedId(); PlatRegionSetting platRegionSetting = platRegionSettingService.getOne(platRegionSettingLambdaQueryWrapper, false);
if (StringUtils.isNotBlank(bedId)) { if(platRegionSetting != null){
LambdaQueryWrapper<PlatElder> elderLambdaQueryWrapper = new LambdaQueryWrapper<>(); regionName = platRegionSetting.getRegionName();
elderLambdaQueryWrapper.eq(PlatElder::getBedId, bedId) }
.eq(BaseBusEntity::getTenantId,tenantId)
;
List<PlatElder> list = platElderService.list(elderLambdaQueryWrapper);
if(CollectionUtils.isNotEmpty(list)) {
platAlarmCheckDTO.setPlatElderList(list);
return;
} }
//获取床位长者
String bedId = platRoomBedDevice.getBedId();
if (StringUtils.isNotBlank(bedId)) {
LambdaQueryWrapper<PlatElder> elderLambdaQueryWrapper = new LambdaQueryWrapper<>();
elderLambdaQueryWrapper.eq(PlatElder::getBedId, bedId)
.eq(BaseBusEntity::getTenantId,tenantId)
;
List<PlatElder> list = platElderService.list(elderLambdaQueryWrapper);
if(CollectionUtils.isNotEmpty(list)) {
for (PlatElder platElder : list) {
platElder.setRegionName(regionName);
}
platAlarmCheckDTO.setPlatElderList(list);
return;
}
} }
//获取房间长者
String roomId = platRoomBedDevice.getRoomId();
if (StringUtils.isNotBlank(roomId)) {
LambdaQueryWrapper<PlatElder> elderLambdaQueryWrapper = new LambdaQueryWrapper<>();
elderLambdaQueryWrapper.eq(PlatElder::getRoomId, roomId)
.eq(BaseBusEntity::getTenantId,tenantId)
;
List<PlatElder> list = platElderService.list(elderLambdaQueryWrapper);
for (PlatElder platElder : list) {
platElder.setRegionName(regionName);
}
platAlarmCheckDTO.setPlatElderList(list);
}
}
);
String roomId = platRoomBedDevice.getRoomId();
if (StringUtils.isNotBlank(roomId)) {
LambdaQueryWrapper<PlatElder> elderLambdaQueryWrapper = new LambdaQueryWrapper<>();
elderLambdaQueryWrapper.eq(PlatElder::getRoomId, roomId)
.eq(BaseBusEntity::getTenantId,tenantId)
;
List<PlatElder> list = platElderService.list(elderLambdaQueryWrapper);
platAlarmCheckDTO.setPlatElderList(list);
}
} }
private String replaceParam(String oriContent,List<String> param) { private String replaceParam(String oriContent,List<String> param) {
......
...@@ -319,7 +319,6 @@ public class PlatOrgServiceImpl extends ServiceImpl<PlatOrgMapper, PlatOrg> ...@@ -319,7 +319,6 @@ public class PlatOrgServiceImpl extends ServiceImpl<PlatOrgMapper, PlatOrg>
LambdaUpdateWrapper<PlatSpace> platSpaceLambdaUpdateWrapper = Wrappers.lambdaUpdate(PlatSpace.class) LambdaUpdateWrapper<PlatSpace> platSpaceLambdaUpdateWrapper = Wrappers.lambdaUpdate(PlatSpace.class)
.set(PlatSpace::getAttribute, dto.getType()) .set(PlatSpace::getAttribute, dto.getType())
.eq(PlatSpace::getOrgId, dto.getId()) .eq(PlatSpace::getOrgId, dto.getId())
.set(PlatSpace::getParentId,dto.getParentId())
; ;
platSpaceService.update(platSpaceLambdaUpdateWrapper); platSpaceService.update(platSpaceLambdaUpdateWrapper);
} }
...@@ -405,7 +404,7 @@ public class PlatOrgServiceImpl extends ServiceImpl<PlatOrgMapper, PlatOrg> ...@@ -405,7 +404,7 @@ public class PlatOrgServiceImpl extends ServiceImpl<PlatOrgMapper, PlatOrg>
public List<PlatOrg> belongToOrgTree(PlatOrg param) { public List<PlatOrg> belongToOrgTree(PlatOrg param) {
PlatUserVO userVOCanNull = PlatUserUtil.getUserVOCanNull(); PlatUserVO userVOCanNull = PlatUserUtil.getUserVOCanNull();
String isTenant = userVOCanNull.getIsTenant(); String isTenant = userVOCanNull.getIsTenant();
//如果是租户账号 则有所有权限 //如果是租户账号 则有所有权限 返回最顶级
if (StringUtils.equals(isTenant, CommonEnum.YES.getValue())) { if (StringUtils.equals(isTenant, CommonEnum.YES.getValue())) {
List<PlatOrg> orgList = this.list(new LambdaQueryWrapper<PlatOrg>() List<PlatOrg> orgList = this.list(new LambdaQueryWrapper<PlatOrg>()
.eq(StringUtils.isNotEmpty(param.getType()), PlatOrg::getType, param.getType()) .eq(StringUtils.isNotEmpty(param.getType()), PlatOrg::getType, param.getType())
...@@ -414,7 +413,7 @@ public class PlatOrgServiceImpl extends ServiceImpl<PlatOrgMapper, PlatOrg> ...@@ -414,7 +413,7 @@ public class PlatOrgServiceImpl extends ServiceImpl<PlatOrgMapper, PlatOrg>
return getOrgTree(orgList, Collections.singletonList(TenantIdUtil.getTenantId())); return getOrgTree(orgList, Collections.singletonList(TenantIdUtil.getTenantId()));
} }
//平台账号 //平台账号 查询权限范围 生成不一定连续的树结构
Set<String> orgIdList = getOrgIdListByUserId(userVOCanNull.getId()); Set<String> orgIdList = getOrgIdListByUserId(userVOCanNull.getId());
List<PlatOrg> orgList = this.list(new LambdaQueryWrapper<PlatOrg>() List<PlatOrg> orgList = this.list(new LambdaQueryWrapper<PlatOrg>()
.eq(StringUtils.isNotEmpty(param.getType()), PlatOrg::getType, param.getType()) .eq(StringUtils.isNotEmpty(param.getType()), PlatOrg::getType, param.getType())
......
...@@ -155,6 +155,7 @@ public class PlatRegionSettingServiceImpl extends ServiceImpl<PlatRegionSettingM ...@@ -155,6 +155,7 @@ public class PlatRegionSettingServiceImpl extends ServiceImpl<PlatRegionSettingM
platRegionSetting.setToward(dto.getToward()); platRegionSetting.setToward(dto.getToward());
platRegionSetting.setRegionName(dto.getRegionName()); platRegionSetting.setRegionName(dto.getRegionName());
platRegionSetting.setRegionRange(dto.getRegionRange()); platRegionSetting.setRegionRange(dto.getRegionRange());
platRegionSetting.setRoomRange(dto.getRoomRange());
platRegionSetting.setDeviceId(dto.getDeviceId()); platRegionSetting.setDeviceId(dto.getDeviceId());
platRegionSetting.setRoomId(dto.getRoomId()); platRegionSetting.setRoomId(dto.getRoomId());
platRegionSetting.setBackground(dto.getBackground()); platRegionSetting.setBackground(dto.getBackground());
......
...@@ -111,7 +111,7 @@ public class PlatSpaceServiceImpl extends ServiceImpl<PlatSpaceMapper, PlatSpace ...@@ -111,7 +111,7 @@ public class PlatSpaceServiceImpl extends ServiceImpl<PlatSpaceMapper, PlatSpace
//上级空间 //上级空间
PlatSpace parentSpace = this.getById(dto.getParentId()); PlatSpace parentSpace = this.getById(dto.getParentId());
if (parentSpace!=null && parentSpace.getParentPath().contains(dto.getId())) { if (parentSpace!=null && parentSpace.getParentPath()!=null && parentSpace.getParentPath().contains(dto.getId())) {
throw new BusinessException(CodeMessageEnum.PLATFORM_ERROR_SPACE_NOT_DEL); throw new BusinessException(CodeMessageEnum.PLATFORM_ERROR_SPACE_NOT_DEL);
} }
......
...@@ -14,10 +14,13 @@ import com.makeit.entity.platform.elder.PlatElder; ...@@ -14,10 +14,13 @@ import com.makeit.entity.platform.elder.PlatElder;
import com.makeit.entity.platform.space.PlatBed; import com.makeit.entity.platform.space.PlatBed;
import com.makeit.entity.platform.space.PlatRoom; import com.makeit.entity.platform.space.PlatRoom;
import com.makeit.entity.platform.space.PlatSpace; import com.makeit.entity.platform.space.PlatSpace;
import com.makeit.entity.saas.analysis.SaasModelManage;
import com.makeit.entity.saas.analysis.SaasSleepAnalysisModel;
import com.makeit.enums.platform.alarm.PlatAlarmConfigEnum; import com.makeit.enums.platform.alarm.PlatAlarmConfigEnum;
import com.makeit.enums.platform.alarm.PlatAlarmRecordEnum; import com.makeit.enums.platform.alarm.PlatAlarmRecordEnum;
import com.makeit.enums.platform.auth.PlatOrgEnum; import com.makeit.enums.platform.auth.PlatOrgEnum;
import com.makeit.enums.platform.space.PlatBedStatusEnum; import com.makeit.enums.platform.space.PlatBedStatusEnum;
import com.makeit.enums.saas.ModelManageTypeEnum;
import com.makeit.service.platform.alarm.PlatAlarmRecordService; import com.makeit.service.platform.alarm.PlatAlarmRecordService;
import com.makeit.service.platform.auth.PlatOrgService; import com.makeit.service.platform.auth.PlatOrgService;
import com.makeit.service.platform.elder.PlatElderRealTimeService; import com.makeit.service.platform.elder.PlatElderRealTimeService;
...@@ -26,6 +29,8 @@ import com.makeit.service.platform.space.PlatBedService; ...@@ -26,6 +29,8 @@ import com.makeit.service.platform.space.PlatBedService;
import com.makeit.service.platform.space.PlatRoomService; import com.makeit.service.platform.space.PlatRoomService;
import com.makeit.service.platform.space.PlatSpaceService; import com.makeit.service.platform.space.PlatSpaceService;
import com.makeit.service.platform.workstation.WorkStationService; import com.makeit.service.platform.workstation.WorkStationService;
import com.makeit.service.saas.SaasModelManageService;
import com.makeit.service.saas.SaasSleepAnalysisModelService;
import com.makeit.utils.data.convert.PageUtil; import com.makeit.utils.data.convert.PageUtil;
import com.makeit.utils.data.convert.StreamUtil; import com.makeit.utils.data.convert.StreamUtil;
import com.makeit.utils.sql.join.JoinUtil; import com.makeit.utils.sql.join.JoinUtil;
...@@ -63,6 +68,10 @@ public class WorkStationServiceImpl implements WorkStationService { ...@@ -63,6 +68,10 @@ public class WorkStationServiceImpl implements WorkStationService {
private PlatOrgService platOrgService; private PlatOrgService platOrgService;
@Autowired @Autowired
private PlatElderRealTimeService platElderRealTimeService; private PlatElderRealTimeService platElderRealTimeService;
@Autowired
private SaasModelManageService saasModelManageService;
@Autowired
private SaasSleepAnalysisModelService saasSleepAnalysisModelService;
@Override @Override
public WorkStationInstitutionStatisticsVO institutionStatistics(WorkStationQueryDTO dto) { public WorkStationInstitutionStatisticsVO institutionStatistics(WorkStationQueryDTO dto) {
...@@ -207,12 +216,24 @@ public class WorkStationServiceImpl implements WorkStationService { ...@@ -207,12 +216,24 @@ public class WorkStationServiceImpl implements WorkStationService {
e.setPathName(StreamUtil.join(l, Objects::nonNull, PlatSpace::getName, "-")); e.setPathName(StreamUtil.join(l, Objects::nonNull, PlatSpace::getName, "-"));
}); });
//查询睡眠质量分析模型
// SaasModelManage modelManage = saasModelManageService.getOne(new QueryWrapper<SaasModelManage>().lambda()
// .eq(SaasModelManage::getModelType, ModelManageTypeEnum.SLEEP.getCode())
// .last(" limit 1"));
// Integer turnedComparison = 0;
// if(modelManage != null){
// SaasSleepAnalysisModel model = saasSleepAnalysisModelService.view(modelManage.getModelId());
// if(model != null && model.getTurnedComparison() != null){
// turnedComparison = Integer.valueOf(model.getTurnedComparison());
// }
// }
for (WorkStationInstitutionRoomVO vo : roomVOList) { for (WorkStationInstitutionRoomVO vo : roomVOList) {
vo.setPathName(vo.getPathName() + "-" + vo.getRoomName()); vo.setPathName(vo.getPathName() + "-" + vo.getRoomName());
if (bedMap.get(vo.getRoomId()) != null) { if (bedMap.get(vo.getRoomId()) != null) {
List<WorkStationInstitutionBedVO> roomBedVos = bedMap.get(vo.getRoomId()); List<WorkStationInstitutionBedVO> roomBedVos = bedMap.get(vo.getRoomId());
//获取告警类型及老人状态 //获取告警类型及老人状态
roomBedVos.forEach(r -> { for(WorkStationInstitutionBedVO r : roomBedVos){
if (StringUtil.isNotEmpty(r.getElderId()) ) { if (StringUtil.isNotEmpty(r.getElderId()) ) {
if(elderAlarmTypeMap.containsKey(r.getElderId())){ if(elderAlarmTypeMap.containsKey(r.getElderId())){
r.setAlarmTypeMap(elderAlarmTypeMap.get(r.getElderId())); r.setAlarmTypeMap(elderAlarmTypeMap.get(r.getElderId()));
...@@ -223,10 +244,20 @@ public class WorkStationServiceImpl implements WorkStationService { ...@@ -223,10 +244,20 @@ public class WorkStationServiceImpl implements WorkStationService {
platElderIdDTO.setElderId(r.getElderId()); platElderIdDTO.setElderId(r.getElderId());
platElderIdDTO.setDeviceId(r.getDeviceId()); platElderIdDTO.setDeviceId(r.getDeviceId());
PlatElderRealTimeNowVO nowStatus = platElderRealTimeService.nowStatus(platElderIdDTO); PlatElderRealTimeNowVO nowStatus = platElderRealTimeService.nowStatus(platElderIdDTO);
//离床:雷达状态上报无人
//翻身:雷达上报的数据符合IOT平台睡眠质量分析模型中配置的翻身规则
//睡眠:雷达上报的数据符合IOT平台睡眠质量分析模型中的入睡时间,状态变更为睡眠
//静息:雷达上报有人,且非睡眠
// if("0".equals(nowStatus.getStatus())){
// r.setElderStatus(nowStatus.getStatus());
// }else if(nowStatus.getBodyMove()!=null && nowStatus.getBodyMove() > turnedComparison){
//
// }
r.setElderStatus(nowStatus.getStatus()); r.setElderStatus(nowStatus.getStatus());
} }
} }
}); }
vo.setList(roomBedVos); vo.setList(roomBedVos);
} }
} }
......
...@@ -39,7 +39,7 @@ public class DayDurationUtil implements ApplicationRunner { ...@@ -39,7 +39,7 @@ public class DayDurationUtil implements ApplicationRunner {
if(CollectionUtils.isEmpty(platDayDurationRecords)){ if(CollectionUtils.isEmpty(platDayDurationRecords)){
return; return;
} }
Map<String, List<PlatDayDurationRecord>> deviceIdMap = platDayDurationRecords.stream().collect(Collectors.groupingBy(PlatDayDurationRecord::getOriDeviceId)); Map<String, List<PlatDayDurationRecord>> deviceIdMap = platDayDurationRecords.stream().collect(Collectors.groupingBy(PlatDayDurationRecord::getDeviceId));
deviceIdMap.entrySet().stream().map(vo -> { deviceIdMap.entrySet().stream().map(vo -> {
List<PlatDayDurationRecord> value = vo.getValue(); List<PlatDayDurationRecord> value = vo.getValue();
int size = value.size(); int size = value.size();
...@@ -52,16 +52,16 @@ public class DayDurationUtil implements ApplicationRunner { ...@@ -52,16 +52,16 @@ public class DayDurationUtil implements ApplicationRunner {
} }
public void put(PlatDayDurationRecord platDayDurationRecord) { public void put(PlatDayDurationRecord platDayDurationRecord) {
RedisUtil.set(RedisConst.ELDER_DAY_DURATION_PREFIX + platDayDurationRecord.getOriDeviceId(), platDayDurationRecord); RedisUtil.set(RedisConst.ELDER_DAY_DURATION_PREFIX + platDayDurationRecord.getDeviceId(), platDayDurationRecord);
} }
public PlatDayDurationRecord get(String oriDeviceId) { public PlatDayDurationRecord get(String platDeviceId) {
PlatDayDurationRecord platDayDurationRecord = RedisUtil.get(RedisConst.ELDER_DAY_DURATION_PREFIX + oriDeviceId); PlatDayDurationRecord platDayDurationRecord = RedisUtil.get(RedisConst.ELDER_DAY_DURATION_PREFIX + platDeviceId);
if(platDayDurationRecord==null){ if(platDayDurationRecord==null){
//getAll(); //getAll();
} }
return RedisUtil.get(RedisConst.ELDER_DAY_DURATION_PREFIX + oriDeviceId); return RedisUtil.get(RedisConst.ELDER_DAY_DURATION_PREFIX + platDeviceId);
} }
/** /**
......
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
</sql> </sql>
<select id="getDayMaxDurationList" resultType="com.makeit.entity.platform.alarm.PlatDayDurationRecord"> <select id="getDayMaxDurationList" resultType="com.makeit.entity.platform.alarm.PlatDayDurationRecord">
select select
pddr.ori_device_id, pddr.device_id,
pddr.day, pddr.day,
max(pddr.duration) as duration max(pddr.duration) as duration
from plat_day_duration_record pddr from plat_day_duration_record pddr
...@@ -47,7 +47,7 @@ ...@@ -47,7 +47,7 @@
</foreach> </foreach>
</if> </if>
</where> </where>
group by pddr.ori_device_id, pddr.day group by pddr.device_id, pddr.day
order by duration order by duration
</select> </select>
</mapper> </mapper>
...@@ -83,44 +83,48 @@ public class PushCallback implements MqttCallback { ...@@ -83,44 +83,48 @@ public class PushCallback implements MqttCallback {
HeaderInfo headers = device.getHeaders(); HeaderInfo headers = device.getHeaders();
List<HeaderInfo.Bind> bindings = headers.getBindings(); List<HeaderInfo.Bind> bindings = headers.getBindings();
for (HeaderInfo.Bind binding : bindings) { for (HeaderInfo.Bind binding : bindings) {
String iot_tenantId = binding.getId(); try {
StopWatch stopWatch = new StopWatch(); String iot_tenantId = binding.getId();
stopWatch.start("checkAlarm-1"); StopWatch stopWatch = new StopWatch();
String deviceId = device.getDeviceId(); stopWatch.start("checkAlarm-1");
String deviceId = device.getDeviceId();
JSONObject properties = device.getProperties();
JSONObject properties = device.getProperties();
//iot设备id
PlatDevice platDevice = deviceCacheUtil.get(deviceId+":"+iot_tenantId); //iot设备id
if(platDevice==null){ PlatDevice platDevice = deviceCacheUtil.get(deviceId + ":" + iot_tenantId);
logger.error("获取设备信息异常,设备iot-id:"+deviceId); if (platDevice == null) {
return; logger.error("获取设备信息异常,设备iot-id,iot_tenantId:" + deviceId+","+iot_tenantId);
} return;
List<PlatAlarmConfig> deviceAlarmConfigList = alarmConfigCacheUtil.getDeviceAlarmConfigMap(platDevice); }
deviceAlarmConfigList.removeIf(Objects::isNull); List<PlatAlarmConfig> deviceAlarmConfigList = alarmConfigCacheUtil.getDeviceAlarmConfigMap(platDevice);
if (CollectionUtils.isEmpty(deviceAlarmConfigList)) { deviceAlarmConfigList.removeIf(Objects::isNull);
logger.error("该设备没有告警配置,设备iot-id:"+deviceId); if (CollectionUtils.isEmpty(deviceAlarmConfigList)) {
return; logger.error("该设备没有告警配置,设备iot-id,iot_tenantId:" + deviceId+","+iot_tenantId);
} return;
for (PlatAlarmConfig config : deviceAlarmConfigList) { }
String alarmType = config.getAlarmType(); for (PlatAlarmConfig config : deviceAlarmConfigList) {
String alarmType = config.getAlarmType();
PlatAlarmCheckDTO platAlarmCheckDTO = new PlatAlarmCheckDTO();
//告警配置 PlatAlarmCheckDTO platAlarmCheckDTO = new PlatAlarmCheckDTO();
platAlarmCheckDTO.setPlatAlarmConfig(config); //告警配置
//设备信息 platAlarmCheckDTO.setPlatAlarmConfig(config);
platAlarmCheckDTO.setPlatDevice(platDevice); //设备信息
//iot上报数据 platAlarmCheckDTO.setPlatDevice(platDevice);
platAlarmCheckDTO.setProperties(properties); //iot上报数据
platAlarmCheckDTO.setProperties(properties);
for (IAlarm alarm : alarmList) {
if (alarm.support(alarmType)) { for (IAlarm alarm : alarmList) {
alarm.checkConfig(platAlarmCheckDTO); if (alarm.support(alarmType)) {
alarm.checkConfig(platAlarmCheckDTO);
}
} }
} }
stopWatch.stop();
logger.info(stopWatch.prettyPrint());
}catch (Exception e){
logger.error("告警异常pushCallback:",e);
} }
stopWatch.stop();
logger.info(stopWatch.prettyPrint());
} }
......
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