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.

61 lines
1.2 KiB

using Entity.DbModel.Station;
using HybirdFrameworkCore.Autofac.Attribute;
using HybirdFrameworkCore.AutoTask;
using log4net;
using Repository.Station;
using Service.Mgr;
namespace Service.MyTask;
/// <summary>
/// 充电结束上报云平台task
/// </summary>
[Scope]
public class SwapOrderReportCloudTask : ITask
{
private static readonly ILog Log = LogManager.GetLogger(typeof(SwapOrderReportCloudTask));
private volatile bool _stop;
public SwapOrderReportCloudRepository? ReportCloudRepository { get; set; }
public SwapOrderMgr? SwapOrderMgr { get; set; }
public string Name()
{
return "SwapOrderReportCloudTask";
}
public int Interval()
{
return 1000 * 20;
}
public void Handle()
{
try
{
List<SwapOrderReportCloud> list = ReportCloudRepository.QueryListByClause(i => i.CloudReportStatus == 0);
SwapOrderMgr.UploadCloud(list);
}
catch (Exception e)
{
Log.Error($" SwapOrderReportCloudTask err e={e}");
}
}
public bool Stoped()
{
return _stop;
}
public void Stop()
{
_stop = true;
}
public void ResetStop()
{
_stop = false;
}
}