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.
75 lines
1.5 KiB
75 lines
1.5 KiB
using Entity.Constant;
|
|
using Entity.DbModel.Station;
|
|
using HybirdFrameworkCore.Autofac.Attribute;
|
|
using HybirdFrameworkCore.AutoTask;
|
|
using log4net;
|
|
using Repository.Station;
|
|
using Service.Execute.Api;
|
|
using Service.Init;
|
|
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 * 3;
|
|
}
|
|
|
|
public void Handle()
|
|
{
|
|
try
|
|
{
|
|
if (StationConstant.StationModel.Local ==
|
|
BaseEnumExtensions.GetEnumByCode<StationConstant.StationModel>(
|
|
StaticStationInfo.StationModel))
|
|
{
|
|
return;
|
|
}
|
|
|
|
List<SwapOrderReportCloud>
|
|
list = ReportCloudRepository.QueryListByClause(i => i.CloudReportStatus < 1);
|
|
|
|
|
|
|
|
|
|
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;
|
|
}
|
|
} |