Commit 00d3aa41 by 杨伟程
parents 60f91638 70b3e0e0
......@@ -75,13 +75,21 @@ public class BehaviorAlarm implements IAlarm {
PlatAlarmConfigBehaviorDTOVO ruleConfig = JsonUtil.toObj(ruleConfigStr, PlatAlarmConfigBehaviorDTOVO.class);
Integer duration = ruleConfig.getDuration();//分钟
PlatDayDurationRecord platDayDurationRecord = dayDurationUtil.get(platDevice.getOriDeviceId());
if (platDayDurationRecord == null) {
log.error("行为告警未找到行为异常平均时长,设备plat_id:" + platDevice.getId());
return;
// if (platDayDurationRecord == null) {
// log.error("行为告警未找到行为异常平均时长,设备plat_id:" + platDevice.getId());
// return;
// }
Integer duration1 = 0;
if (platDayDurationRecord!=null){
duration1 = Math.toIntExact(platDayDurationRecord.getDuration());
}
Long duration1 = platDayDurationRecord.getDuration();
duration = duration * 60 + (int) (duration1 / 1000);
//duration+平均停留时长
if (duration == null){
duration = 0;
}else {
duration = duration * 60 + (duration1 / 1000);
}
List<String> personStateList = Arrays.asList("0");
//有人
//计数
......@@ -104,9 +112,11 @@ public class BehaviorAlarm implements IAlarm {
}
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());
if(duration1 != 0) {
notice(platAlarmCheckDTO);
}
alarmRedisDTO.setAlarm(CommonEnum.YES.getValue());
RedisUtil.set(RedisConst.ALARM_DEVICE_BEHAVIOR_ID + deviceId, alarmRedisDTO);
......
......@@ -126,7 +126,8 @@ implements PlatRoleService {
}
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())) {
throw new BusinessException(CodeMessageEnum.SYSTEM_ERROR_CODE_DUPLICATE);
......
......@@ -13,5 +13,5 @@ import com.makeit.entity.saas.analysis.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
BeanUtils.copyProperties(dto,entity);
saveOrUpdate(entity);
saasModelManageService.updateEntity(dto.getId(),"sleep");
saasModelManageService.updateEntity(dto.getId(),"disease");
}
}
......@@ -52,7 +52,7 @@ public class SaasSleepAnalysisModelServiceImpl extends ServiceImpl<SaasSleepAnal
BeanUtils.copyProperties(dto,entity);
saveOrUpdate(entity);
saasModelManageService.updateEntity(dto.getId(),"disease");
saasModelManageService.updateEntity(dto.getId(),"sleep");
}
}
......@@ -107,6 +107,7 @@ public class IotSyncTask {
}
platDevice.setOriDeviceId(iotDevice.getId());
platDevice.setName(iotDevice.getName());
platDevice.setOrgId(tenantId);
String productName = iotDevice.getProductName();
platDevice.setProductName(productName);
platDevice.setProductId(iotDevice.getProductId());
......
......@@ -59,7 +59,7 @@ public class DayDurationUtil implements ApplicationRunner {
public PlatDayDurationRecord get(String oriDeviceId) {
PlatDayDurationRecord platDayDurationRecord = RedisUtil.get(RedisConst.ELDER_DAY_DURATION_PREFIX + oriDeviceId);
if(platDayDurationRecord==null){
getAll();
//getAll();
}
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