Commit 3acb9bc3 authored by 赵啸非's avatar 赵啸非

添加设备告警

parent 308bb8a5
......@@ -2,6 +2,7 @@ package com.mortals.xhx.daemon.task;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.core.json.JsonGeneratorImpl;
import com.mortals.framework.ap.GlobalSysInfo;
import com.mortals.framework.exception.AppException;
import com.mortals.framework.service.ITask;
......@@ -22,6 +23,7 @@ import com.mortals.xhx.module.device.service.DeviceAlarmService;
import com.mortals.xhx.module.device.service.DeviceLogService;
import com.mortals.xhx.module.device.service.DeviceService;
import lombok.extern.apachecommons.CommonsLog;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;
......@@ -36,7 +38,7 @@ import java.util.stream.Collectors;
* @author: zxfei
* @date: 2022/3/9 15:19
*/
@CommonsLog
@Slf4j
@Service("DeviceStatTask")
public class DeviceStatTaskImpl implements ITaskExcuteService {
......@@ -73,7 +75,6 @@ public class DeviceStatTaskImpl implements ITaskExcuteService {
// .filter(f -> f.getDeviceOnlineStatus() == DeviceOnlineStatusEnum.在线.getValue())
.map(device -> {
DeviceLogQuery query = new DeviceLogQuery();
query.setCreateTimeStart(DateUtils.getStrDateTime(new Date(System.currentTimeMillis() - timeout)));
DeviceLogEntity deviceLogEntity = deviceLogService.selectOne(query);
if (ObjectUtils.isEmpty(deviceLogEntity)) {
......@@ -84,6 +85,8 @@ public class DeviceStatTaskImpl implements ITaskExcuteService {
}
return null;
}).filter(f->f!=null).collect(Collectors.toList());
log.info("更新设备下线:{} ,时间:{}", JSON.toJSONString(collect),DateUtils.getStrDateTime(new Date(System.currentTimeMillis() - timeout));
deviceService.update(collect,null);
List<DeviceAlarmEntity> alarmEntityList = collect.stream().map(device -> {
......
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 to comment