|
|
@ -1,31 +1,35 @@
|
|
|
|
using Entity.DbModel.Station;
|
|
|
|
using Entity.DbModel.Station;
|
|
|
|
using HybirdFrameworkCore.Autofac.Attribute;
|
|
|
|
using HybirdFrameworkCore.Autofac.Attribute;
|
|
|
|
|
|
|
|
using HybirdFrameworkCore.AutoTask;
|
|
|
|
using log4net;
|
|
|
|
using log4net;
|
|
|
|
using Repository.Station;
|
|
|
|
using Repository.Station;
|
|
|
|
using Service.BusinessTask;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
namespace Service.Cloud.Client.MyTask;
|
|
|
|
namespace Service.Cloud.Client.MyTask;
|
|
|
|
|
|
|
|
|
|
|
|
[Scope("SingleInstance")]
|
|
|
|
[Scope]
|
|
|
|
public class ChargeOrderUploadTask : AbstractTaskHandler
|
|
|
|
public class ChargeOrderUploadTask : ITask
|
|
|
|
{
|
|
|
|
{
|
|
|
|
private static readonly ILog Log = LogManager.GetLogger(typeof(ChargeOrderUploadTask));
|
|
|
|
private static readonly ILog Log = LogManager.GetLogger(typeof(ChargeOrderUploadTask));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private volatile bool _stop;
|
|
|
|
|
|
|
|
|
|
|
|
public ChargeOrderRepository _chargeOrderRepository { get; set; }
|
|
|
|
public ChargeOrderRepository _chargeOrderRepository { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
protected override int Interval()
|
|
|
|
public int Interval()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
return 1000 * 10;
|
|
|
|
return 1000 * 10;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
protected override void Handle()
|
|
|
|
public void Handle()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
try
|
|
|
|
{
|
|
|
|
{
|
|
|
|
List<ChargeOrder>? chargeOrders = _chargeOrderRepository.QueryListByClause(it => it.CloudReportStatus ==0 && it.CanUpload == 1);
|
|
|
|
List<ChargeOrder>? chargeOrders =
|
|
|
|
|
|
|
|
_chargeOrderRepository.QueryListByClause(it => it.CloudReportStatus == 0 && it.CanUpload == 1);
|
|
|
|
|
|
|
|
|
|
|
|
Log.Info($"there are {chargeOrders?.Count ?? 0} to upload");
|
|
|
|
Log.Info($"there are {chargeOrders?.Count ?? 0} to upload");
|
|
|
|
if (chargeOrders is { Count: > 0 })
|
|
|
|
if (chargeOrders is { Count: > 0 })
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
var group = chargeOrders.GroupBy(it => it.CloudChargeOrder);
|
|
|
|
var group = chargeOrders.GroupBy(it => it.CloudChargeOrder);
|
|
|
|
foreach (IGrouping<string, ChargeOrder> grouping in group)
|
|
|
|
foreach (IGrouping<string, ChargeOrder> grouping in group)
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -34,9 +38,29 @@ public class ChargeOrderUploadTask : AbstractTaskHandler
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
catch (Exception e)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
Log.Error(e);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
protected override string Name()
|
|
|
|
public string Name()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
return "ChargeOrderUploadTask";
|
|
|
|
return "ChargeOrderUploadTask";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public bool Stoped()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return _stop;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void Stop()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
_stop = true;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void ResetStop()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
_stop = false;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|