using Entity.Constant;
using Entity.DbModel.Station;
using HybirdFrameworkCore.Autofac.Attribute;
using HybirdFrameworkCore.AutoTask;
using log4net;
using Repository.Station;
using Service.Init;
using Service.Mgr;
namespace Service.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 * 3;
}
public void Handle()
{
try
{
if (StationConstant.StationModel.Local ==
BaseEnumExtensions.GetEnumByCode(
StaticStationInfo.StationModel))
{
return;
}
List
list = ReportCloudRepository.QueryListByClause(i => i.CloudReportStatus == 0);
SwapOrderMgr.UploadCloud(list, 1);
}
catch (Exception e)
{
Log.Error($" SwapOrderReportCloudTask err e={e}");
}
}
public bool Stoped()
{
return _stop;
}
public void Stop()
{
_stop = true;
}
public void ResetStop()
{
_stop = false;
}
}