充电订单中换电订单取云平台订单号

master
CZ 5 months ago
parent 4ab5ab4700
commit ddc18e1787

@ -1,9 +1,13 @@
using Autofac; using Autofac;
using Entity.DbModel.Station;
using HybirdFrameworkCore.Autofac; using HybirdFrameworkCore.Autofac;
using HybirdFrameworkCore.Autofac.Attribute; using HybirdFrameworkCore.Autofac.Attribute;
using HybirdFrameworkCore.Redis; using HybirdFrameworkCore.Redis;
using log4net; using log4net;
using Newtonsoft.Json;
using Repository.Station; using Repository.Station;
using Service.Cloud.Msg;
using Service.Cloud.Msg.Host.Req;
using Service.Init; using Service.Init;
namespace Service.Cloud.Client; namespace Service.Cloud.Client;
@ -14,6 +18,7 @@ public class CloudClientMgr
private static readonly ILog Log = LogManager.GetLogger(typeof(CloudClientMgr)); private static readonly ILog Log = LogManager.GetLogger(typeof(CloudClientMgr));
public static CloudClient? CloudClient { get; set; } public static CloudClient? CloudClient { get; set; }
private static DateTime _dateTime = DateTime.Now.AddSeconds(-30);
public static void Init() public static void Init()
{ {
CloudClient = AppInfo.Container.Resolve<CloudClient>(); CloudClient = AppInfo.Container.Resolve<CloudClient>();
@ -36,7 +41,7 @@ public class CloudClientMgr
RedisHelper? redisHelper = AppInfo.Container.Resolve<RedisHelper>(); RedisHelper? redisHelper = AppInfo.Container.Resolve<RedisHelper>();
BinInfoRepository binInfoRepository = AppInfo.Container.Resolve<BinInfoRepository>(); BinInfoRepository binInfoRepository = AppInfo.Container.Resolve<BinInfoRepository>();
/*redisHelper?.GetSubscriber().Subscribe("UploadTelemetryData", (channel, value) => redisHelper?.GetSubscriber().Subscribe("UploadTelemetryData", (channel, value) =>
{ {
try try
{ {
@ -80,6 +85,13 @@ public class CloudClientMgr
ot = 0xFF, ot = 0xFF,
bt = DateTime.Now bt = DateTime.Now
}; };
if ((DateTime.Now - _dateTime).TotalSeconds <= 30)
{
return;
}
_dateTime = DateTime.Now;
CloudClient?.SendChargeDevDataInfo(req); CloudClient?.SendChargeDevDataInfo(req);
} }
} }
@ -88,6 +100,6 @@ public class CloudClientMgr
{ {
Log.Info("error", e); Log.Info("error", e);
} }
});*/ });
} }
} }

Loading…
Cancel
Save