2022年5月20日19:30:44

1.集成TDengine作为日志和监测数据存储库使用
2.实现简单的新增和查询功能接口
This commit is contained in:
wxy001
2022-05-20 19:32:14 +08:00
parent 303d6dc6b0
commit 44f682c3ba
17 changed files with 913 additions and 32 deletions

View File

@@ -2,6 +2,7 @@ package com.ruoyi.iot.service.impl;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.iot.domain.DeviceLog;
import com.ruoyi.iot.log.service.ILogService;
import com.ruoyi.iot.mapper.DeviceLogMapper;
import com.ruoyi.iot.model.MonitorModel;
import com.ruoyi.iot.service.IDeviceLogService;
@@ -22,6 +23,9 @@ public class DeviceLogServiceImpl implements IDeviceLogService
@Autowired
private DeviceLogMapper deviceLogMapper;
@Autowired
private ILogService logService;
/**
* 查询设备日志
*
@@ -43,7 +47,8 @@ public class DeviceLogServiceImpl implements IDeviceLogService
@Override
public List<DeviceLog> selectDeviceLogList(DeviceLog deviceLog)
{
return deviceLogMapper.selectDeviceLogList(deviceLog);
// deviceLogMapper.selectDeviceLogList(deviceLog);
return logService.selectDeviceLogList(deviceLog);
}
/**
@@ -55,7 +60,8 @@ public class DeviceLogServiceImpl implements IDeviceLogService
@Override
public List<MonitorModel> selectMonitorList(DeviceLog deviceLog)
{
return deviceLogMapper.selectMonitorList(deviceLog);
// return deviceLogMapper.selectMonitorList(deviceLog);
return logService.selectMonitorList(deviceLog);
}
/**
@@ -68,7 +74,8 @@ public class DeviceLogServiceImpl implements IDeviceLogService
public int insertDeviceLog(DeviceLog deviceLog)
{
deviceLog.setCreateTime(DateUtils.getNowDate());
return deviceLogMapper.insertDeviceLog(deviceLog);
// return deviceLogMapper.insertDeviceLog(deviceLog);
return logService.saveDeviceLog(deviceLog);
}
/**

View File

@@ -11,6 +11,7 @@ import com.ruoyi.common.utils.ip.IpUtils;
import com.ruoyi.iot.domain.Device;
import com.ruoyi.iot.domain.DeviceLog;
import com.ruoyi.iot.domain.Product;
import com.ruoyi.iot.log.service.ILogService;
import com.ruoyi.iot.mapper.DeviceLogMapper;
import com.ruoyi.iot.mapper.DeviceMapper;
import com.ruoyi.iot.mapper.DeviceUserMapper;
@@ -22,6 +23,7 @@ import com.ruoyi.iot.service.IDeviceService;
import com.ruoyi.iot.service.IProductService;
import com.ruoyi.iot.service.IToolService;
import com.ruoyi.system.service.ISysUserService;
import org.checkerframework.checker.units.qual.A;
import org.quartz.SchedulerException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -73,8 +75,11 @@ public class DeviceServiceImpl implements IDeviceService {
@Autowired
private ISysUserService userService;
// @Autowired
// private IDeviceLogService deviceLogService;
@Autowired
private IDeviceLogService deviceLogService;
private ILogService logService;
/**
* 查询设备
@@ -196,7 +201,8 @@ public class DeviceServiceImpl implements IDeviceService {
deviceLog.setCreateTime(DateUtils.getNowDate());
deviceLog.setIsMonitor(valueList.get(k).getIsMonitor());
deviceLog.setLogType(type);
deviceLogMapper.insertDeviceLog(deviceLog);
logService.saveDeviceLog(deviceLog);
// deviceLogMapper.insertDeviceLog(deviceLog);
break;
}
}
@@ -588,7 +594,8 @@ public class DeviceServiceImpl implements IDeviceService {
deviceLog.setIdentity("offline");
deviceLog.setLogType(6);
}
deviceLogService.insertDeviceLog(deviceLog);
logService.saveDeviceLog(deviceLog);
// deviceLogService.insertDeviceLog(deviceLog);
return result;
}