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>
    /// 1分钟采集数据
    /// </summary>
    public class SubscriberOneMinuteWorker : HangfireBackgroundWorkerBase, ITransientDependency,ICollectWorker
    {
        private readonly ILogger<SubscriberOneMinuteWorker> _logger;
        private readonly IScheduledMeterReadingService _scheduledMeterReadingService;

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


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

            //await _scheduledMeterReadingService.WatermeterScheduledMeterOneMinuteReading();

        }
    }
}
