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 && it.CanUpload == 1); Log.Info($"there are {chargeOrders?.Count ?? 0} to upload"); if (chargeOrders is { Count: > 0 }) { var group = chargeOrders.GroupBy(it => it.CloudChargeOrder); foreach (IGrouping grouping in group) { List orders = grouping.ToList(); CloudClientMgr.CloudClient?.PublishChargeOrder(orders, 1); } } } protected override string Name() { return "ChargeOrderUploadTask"; } }