2025-06-12 17:55:19 +08:00
|
|
|
|
using JiShe.ServicePro.Core;
|
|
|
|
|
|
using JiShe.ServicePro.DeviceManagement.Focuses;
|
|
|
|
|
|
using JiShe.ServicePro.DeviceManagement.Meters;
|
|
|
|
|
|
using Microsoft.Extensions.Logging;
|
|
|
|
|
|
using System;
|
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
using System.Linq;
|
|
|
|
|
|
using System.Text;
|
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
|
2025-06-12 17:56:24 +08:00
|
|
|
|
namespace JiShe.IoT.Jobs.ToRedis
|
2025-06-12 17:55:19 +08:00
|
|
|
|
{
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 缓存集中器数据到Redis
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public class CacheFocusDataToRedisJob : SystemBackGroundWorkService
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
private readonly ILogger<CacheFocusDataToRedisJob> _logger;
|
|
|
|
|
|
public readonly FocusAppService _focusAppService;
|
|
|
|
|
|
public CacheFocusDataToRedisJob(ILogger<CacheFocusDataToRedisJob> logger, FocusAppService focusAppService) : base(logger)
|
|
|
|
|
|
{
|
|
|
|
|
|
_logger = logger;
|
|
|
|
|
|
_focusAppService= focusAppService;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
protected override Task DoWorkAsync(CancellationToken cancellationToken)
|
|
|
|
|
|
{
|
|
|
|
|
|
return _focusAppService.CacheFocusDataToRedisAsync();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
protected override TimeSpan GetInterval()
|
|
|
|
|
|
{
|
|
|
|
|
|
return TimeSpan.FromHours(1);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|