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.
42 lines
1.2 KiB
42 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));
|
|
|
|
public ChargeOrderRepository _chargeOrderRepository { get; set; }
|
|
|
|
protected override int Interval()
|
|
{
|
|
return 1000 * 10;
|
|
}
|
|
|
|
protected override void Handle()
|
|
{
|
|
List<ChargeOrder>? 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<string,ChargeOrder> grouping in group)
|
|
{
|
|
List<ChargeOrder> orders = grouping.ToList();
|
|
CloudClientMgr.CloudClient?.PublishChargeOrder(orders, 1);
|
|
}
|
|
}
|
|
}
|
|
|
|
protected override string Name()
|
|
{
|
|
return "ChargeOrderUploadTask";
|
|
}
|
|
} |