You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

45 lines
1.2 KiB

using Entity.DbModel.Station;
using HybirdFrameworkCore.Autofac.Attribute;
using log4net;
using Repository.Station;
using Service.BusinessTask;
namespace Service.Cloud.Client.MyTask;
[Scope("SingleInstance")]
public class ChargeOrderUploadTask : AbstractTaskHandler
{
private static readonly ILog Log = LogManager.GetLogger(typeof(ChargeOrderUploadTask));
private readonly ChargeOrderRepository _chargeOrderRepository;
public ChargeOrderUploadTask(ChargeOrderRepository chargeOrderRepository)
{
_chargeOrderRepository = chargeOrderRepository;
}
protected override int Interval()
{
return 1000 * 10;
}
protected override void Handle()
{
List<ChargeOrder>? chargeOrders = _chargeOrderRepository.QueryListByClause(it => it.CloudReportStatus != 1);
Log.Info($"there are {chargeOrders?.Count ?? 0} to upload");
if (chargeOrders is { Count: > 0 })
{
foreach (ChargeOrder chargeOrder in chargeOrders)
{
//TODO
//CloudClientMgr.CloudClient?.Publish();
}
}
}
protected override string Name()
{
return "ChargeOrderUploadTask";
}
}