using System;
using System.Threading;
using System.Threading.Tasks;
using Hangfire;
using JiShe.CollectBus.ScheduledMeterReading;
using Microsoft.Extensions.Logging;
using Volo.Abp.BackgroundWorkers.Hangfire;
using Volo.Abp.DependencyInjection;
using Volo.Abp.Uow;

namespace JiShe.CollectBus.Workers
{
    /// <summary>
    /// 5分钟采集数据
    /// </summary>
    public class SubscriberFiveMinuteWorker : HangfireBackgroundWorkerBase, ITransientDependency,ICollectWorker
    {
        private readonly ILogger<SubscriberFiveMinuteWorker> _logger;
        private readonly IScheduledMeterReadingService _scheduledMeterReadingService;

        /// <summary>
        /// Initializes a new instance of the <see cref="SubscriberFiveMinuteWorker"/> class.
        /// </summary>
        /// <param name="logger">The logger.</param>
        /// <param name="scheduledMeterReadingService">定时任务</param>
        public SubscriberFiveMinuteWorker(ILogger<SubscriberFiveMinuteWorker> logger, IScheduledMeterReadingService scheduledMeterReadingService)
        {
            _logger = logger;
            RecurringJobId = nameof(SubscriberFiveMinuteWorker);
            CronExpression = "0 0/5 * * * *";
            TimeZone = TimeZoneInfo.Local;
            this._scheduledMeterReadingService = scheduledMeterReadingService;
        }


        public override async Task DoWorkAsync(CancellationToken cancellationToken = new CancellationToken())
        {
            //await _scheduledMeterReadingService.AmmeterScheduledMeterFiveMinuteReading();
            //await _scheduledMeterReadingService.WatermeterScheduledMeterFiveMinuteReading();
        }
    }
}
