zhengyiming
2025-04-16 b463e74fdbc6cb88dd4c657783a9accccbf55675
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
using LifePayment.Application.Contracts;
using LifePayment.Domain;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using NPOI.SS.Formula.Functions;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Volo.Abp.BackgroundWorkers;
using Volo.Abp.Threading;
using Volo.Abp.Uow;
 
namespace LifePayment.Worker.Worker
{
    public class GetStaticsWorker : AsyncPeriodicBackgroundWorkerBase
    {
        private readonly IStatisticsService _statisticService;
        private readonly int _doWorkHour = 0;
        private readonly int _doWorkMinute = 30;
        public GetStaticsWorker(AbpAsyncTimer timer, IServiceScopeFactory serviceScopeFactory, IStatisticsService statisticService) : base(timer, serviceScopeFactory)
        {
            _statisticService = statisticService;
            timer.Period = PeriodTool.CalcuPeriodFromEveryDayTime(_doWorkHour, _doWorkMinute, 0);
            //timer.Period =1 * 60000;
        }
 
        [UnitOfWork]
        protected override async Task DoWorkAsync(PeriodicBackgroundWorkerContext workerContext)
        {
            try
            {
                await _statisticService.GetTopStatistics(new List<string>());
                Logger.LogError($"获取统计信息开始: {DateTime.Now}");
            }
            catch (Exception ex)
            {
                Logger.LogError($"获取统计信息错误: {DateTime.Now}" + ex.Message);
            }
 
 
        }
    }
 
}