From e250244ee4f0d36bedd30223bba9c5bbc76047d4 Mon Sep 17 00:00:00 2001 From: smartwyy <645583145@qq.com> Date: Fri, 24 May 2024 16:23:33 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BA=91=E5=B9=B3=E5=8F=B0=E4=B8=8A=E4=BC=A0?= =?UTF-8?q?=E4=BB=BB=E5=8A=A1=E5=BC=80=E5=8F=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Client/MyTask/ChargeOrderUploadTask.cs | 45 +++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 Service/Cloud/Client/MyTask/ChargeOrderUploadTask.cs diff --git a/Service/Cloud/Client/MyTask/ChargeOrderUploadTask.cs b/Service/Cloud/Client/MyTask/ChargeOrderUploadTask.cs new file mode 100644 index 0000000..0d55097 --- /dev/null +++ b/Service/Cloud/Client/MyTask/ChargeOrderUploadTask.cs @@ -0,0 +1,45 @@ +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? 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"; + } +} \ No newline at end of file