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)); public ChargeOrderRepository _chargeOrderRepository { get; set; } protected override int Interval() { return 1000 * 10; } protected override void Handle() { List? chargeOrders = _chargeOrderRepository.QueryListByClause(it => it.CloudReportStatus ==0); Log.Info($"there are {chargeOrders?.Count ?? 0} to upload"); if (chargeOrders is { Count: > 0 }) { foreach (ChargeOrder chargeOrder in chargeOrders) { CloudClientMgr.CloudClient?.PublishChargeOrder(chargeOrder, 1); } } } protected override string Name() { return "ChargeOrderUploadTask"; } }