using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using IStation.RedisCache;
namespace IStation.Service
{
///
/// 实时监测记录
///
public partial class MonitorRecord
{
#region 最近一条记录
///
/// 获取最近一条记录
///
public Model.MonitorRecord GetLastRecord(long monitorPointId)
{
var redisHelper = new MonitorRecordCacheHelper();
var record = redisHelper.GetLastRecord(monitorPointId);
return record;
}
///
/// 获取最近一条记录
///
public List GetLastRecord(IEnumerable monitorPointIds)
{
if (monitorPointIds == null || monitorPointIds.Count() < 1)
return default;
var redisHelper = new MonitorRecordCacheHelper();
var record = redisHelper.GetLastRecord(monitorPointIds);
return record;
}
#endregion
#region Insert
///
/// 插入最近多条记录
///
public bool InsertsLastRecord(List list)
{
if (list == null || list.Count() < 1)
return default;
var queueHelper = new RabbitMqQueueHelper();
var bol = queueHelper.Push(ConfigHelper.StoreQueueName, list);
if (bol)
{
var redisHelper = new MonitorRecordCacheHelper();
redisHelper.SetLastRecord(list, out string info);
}
return bol;
}
#endregion
}
}