Commit 00d3aa41 by 杨伟程
parents 60f91638 70b3e0e0
...@@ -75,13 +75,21 @@ public class BehaviorAlarm implements IAlarm { ...@@ -75,13 +75,21 @@ public class BehaviorAlarm implements IAlarm {
PlatAlarmConfigBehaviorDTOVO ruleConfig = JsonUtil.toObj(ruleConfigStr, PlatAlarmConfigBehaviorDTOVO.class); PlatAlarmConfigBehaviorDTOVO ruleConfig = JsonUtil.toObj(ruleConfigStr, PlatAlarmConfigBehaviorDTOVO.class);
Integer duration = ruleConfig.getDuration();//分钟 Integer duration = ruleConfig.getDuration();//分钟
PlatDayDurationRecord platDayDurationRecord = dayDurationUtil.get(platDevice.getOriDeviceId()); PlatDayDurationRecord platDayDurationRecord = dayDurationUtil.get(platDevice.getOriDeviceId());
if (platDayDurationRecord == null) { // if (platDayDurationRecord == null) {
log.error("行为告警未找到行为异常平均时长,设备plat_id:" + platDevice.getId()); // log.error("行为告警未找到行为异常平均时长,设备plat_id:" + platDevice.getId());
return; // return;
// }
Integer duration1 = 0;
if (platDayDurationRecord!=null){
duration1 = Math.toIntExact(platDayDurationRecord.getDuration());
} }
Long duration1 = platDayDurationRecord.getDuration();
duration = duration * 60 + (int) (duration1 / 1000);
//duration+平均停留时长 //duration+平均停留时长
if (duration == null){
duration = 0;
}else {
duration = duration * 60 + (duration1 / 1000);
}
List<String> personStateList = Arrays.asList("0"); List<String> personStateList = Arrays.asList("0");
//有人 //有人
//计数 //计数
...@@ -104,9 +112,11 @@ public class BehaviorAlarm implements IAlarm { ...@@ -104,9 +112,11 @@ public class BehaviorAlarm implements IAlarm {
} }
long count = endLong - startLong; long count = endLong - startLong;
//进入空间时间满足告警时长,判断是否已经告警过了 //进入空间时间满足告警时长,判断是否已经告警过了
if (count / 1000 >= duration && StringUtils.equals(alarmRedisDTO.getAlarm(), CommonEnum.NO.getValue())) { if (duration!= 0 && count / 1000 >= duration && StringUtils.equals(alarmRedisDTO.getAlarm(), CommonEnum.NO.getValue())) {
log.error("空间雷达发出告警,设备plat_id:" + platDevice.getId()); log.error("空间雷达发出告警,设备plat_id:" + platDevice.getId());
notice(platAlarmCheckDTO); if(duration1 != 0) {
notice(platAlarmCheckDTO);
}
alarmRedisDTO.setAlarm(CommonEnum.YES.getValue()); alarmRedisDTO.setAlarm(CommonEnum.YES.getValue());
RedisUtil.set(RedisConst.ALARM_DEVICE_BEHAVIOR_ID + deviceId, alarmRedisDTO); RedisUtil.set(RedisConst.ALARM_DEVICE_BEHAVIOR_ID + deviceId, alarmRedisDTO);
......
...@@ -126,7 +126,8 @@ implements PlatRoleService { ...@@ -126,7 +126,8 @@ implements PlatRoleService {
} }
old = WrapperUtil.getOne(this, new QueryWrapper<PlatRole>().lambda() old = WrapperUtil.getOne(this, new QueryWrapper<PlatRole>().lambda()
.eq(PlatRole::getOrgId, dto.getOrgId())) .eq(PlatRole::getOrgId, dto.getOrgId())
.eq(PlatRole::getCode, dto.getCode()))
; ;
if (old != null && !old.getId().equals(dto.getId())) { if (old != null && !old.getId().equals(dto.getId())) {
throw new BusinessException(CodeMessageEnum.SYSTEM_ERROR_CODE_DUPLICATE); throw new BusinessException(CodeMessageEnum.SYSTEM_ERROR_CODE_DUPLICATE);
......
...@@ -13,5 +13,5 @@ import com.makeit.entity.saas.analysis.SaasModelManage; ...@@ -13,5 +13,5 @@ import com.makeit.entity.saas.analysis.SaasModelManage;
*/ */
public interface SaasModelManageService extends IService<SaasModelManage> { public interface SaasModelManageService extends IService<SaasModelManage> {
void updateEntity(String id, String sleep); void updateEntity(String id, String type);
} }
...@@ -51,6 +51,6 @@ public class SaasDiseaseModelServiceImpl extends ServiceImpl<SaasDiseaseModelMap ...@@ -51,6 +51,6 @@ public class SaasDiseaseModelServiceImpl extends ServiceImpl<SaasDiseaseModelMap
BeanUtils.copyProperties(dto,entity); BeanUtils.copyProperties(dto,entity);
saveOrUpdate(entity); saveOrUpdate(entity);
saasModelManageService.updateEntity(dto.getId(),"sleep"); saasModelManageService.updateEntity(dto.getId(),"disease");
} }
} }
...@@ -52,7 +52,7 @@ public class SaasSleepAnalysisModelServiceImpl extends ServiceImpl<SaasSleepAnal ...@@ -52,7 +52,7 @@ public class SaasSleepAnalysisModelServiceImpl extends ServiceImpl<SaasSleepAnal
BeanUtils.copyProperties(dto,entity); BeanUtils.copyProperties(dto,entity);
saveOrUpdate(entity); saveOrUpdate(entity);
saasModelManageService.updateEntity(dto.getId(),"disease"); saasModelManageService.updateEntity(dto.getId(),"sleep");
} }
} }
...@@ -107,6 +107,7 @@ public class IotSyncTask { ...@@ -107,6 +107,7 @@ public class IotSyncTask {
} }
platDevice.setOriDeviceId(iotDevice.getId()); platDevice.setOriDeviceId(iotDevice.getId());
platDevice.setName(iotDevice.getName()); platDevice.setName(iotDevice.getName());
platDevice.setOrgId(tenantId);
String productName = iotDevice.getProductName(); String productName = iotDevice.getProductName();
platDevice.setProductName(productName); platDevice.setProductName(productName);
platDevice.setProductId(iotDevice.getProductId()); platDevice.setProductId(iotDevice.getProductId());
......
...@@ -59,7 +59,7 @@ public class DayDurationUtil implements ApplicationRunner { ...@@ -59,7 +59,7 @@ public class DayDurationUtil implements ApplicationRunner {
public PlatDayDurationRecord get(String oriDeviceId) { public PlatDayDurationRecord get(String oriDeviceId) {
PlatDayDurationRecord platDayDurationRecord = RedisUtil.get(RedisConst.ELDER_DAY_DURATION_PREFIX + oriDeviceId); PlatDayDurationRecord platDayDurationRecord = RedisUtil.get(RedisConst.ELDER_DAY_DURATION_PREFIX + oriDeviceId);
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 + oriDeviceId);
} }
......
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