using Entity.DbModel.Station;
using HybirdFrameworkCore.Autofac.Attribute;
using HybirdFrameworkCore.AutoTask;
using log4net;
using Repository.Station;
using Service.Mgr;
namespace Service.BusinessTask.MyTask;
///
/// 充电结束上报云平台task
///
[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 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;
}
}