|
|
@ -1,5 +1,6 @@
|
|
|
|
using DotNetty.Transport.Channels;
|
|
|
|
using DotNetty.Transport.Channels;
|
|
|
|
using HybirdFrameworkCore.Autofac.Attribute;
|
|
|
|
using HybirdFrameworkCore.Autofac.Attribute;
|
|
|
|
|
|
|
|
using HybirdFrameworkCore.Configuration;
|
|
|
|
using HybirdFrameworkCore.Redis;
|
|
|
|
using HybirdFrameworkCore.Redis;
|
|
|
|
using log4net;
|
|
|
|
using log4net;
|
|
|
|
using Newtonsoft.Json;
|
|
|
|
using Newtonsoft.Json;
|
|
|
@ -17,7 +18,7 @@ namespace Service.Charger.Handler
|
|
|
|
public class UploadTelemetryDataHandler : SimpleChannelInboundHandler<UploadTelemetryData>, IBaseHandler
|
|
|
|
public class UploadTelemetryDataHandler : SimpleChannelInboundHandler<UploadTelemetryData>, IBaseHandler
|
|
|
|
{
|
|
|
|
{
|
|
|
|
private static readonly ILog Log = LogManager.GetLogger(typeof(UploadTelemetryDataHandler));
|
|
|
|
private static readonly ILog Log = LogManager.GetLogger(typeof(UploadTelemetryDataHandler));
|
|
|
|
|
|
|
|
|
|
|
|
public RedisHelper RedisHelper { get; set; }
|
|
|
|
public RedisHelper RedisHelper { get; set; }
|
|
|
|
protected override void ChannelRead0(IChannelHandlerContext ctx, UploadTelemetryData msg)
|
|
|
|
protected override void ChannelRead0(IChannelHandlerContext ctx, UploadTelemetryData msg)
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -26,8 +27,11 @@ namespace Service.Charger.Handler
|
|
|
|
msg.ChargerNo = sn;
|
|
|
|
msg.ChargerNo = sn;
|
|
|
|
Log.Info($"receive {msg} from {sn}");
|
|
|
|
Log.Info($"receive {msg} from {sn}");
|
|
|
|
|
|
|
|
|
|
|
|
RedisHelper.PublishAsync("UploadTelemetryData", JsonConvert.SerializeObject(msg));
|
|
|
|
if (!AppSettingsConstVars.DisabledTask.Contains("UploadTelemetryData"))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
RedisHelper.PublishAsync("UploadTelemetryData", JsonConvert.SerializeObject(msg));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
client.UploadTelemetryData = msg;
|
|
|
|
client.UploadTelemetryData = msg;
|
|
|
|
//充电机实时充电功率
|
|
|
|
//充电机实时充电功率
|
|
|
|
client.RealTimeChargePower = msg.HighVoltageAcquisitionCurrent * msg.HighVoltageAcquisitionVoltage;
|
|
|
|
client.RealTimeChargePower = msg.HighVoltageAcquisitionCurrent * msg.HighVoltageAcquisitionVoltage;
|
|
|
|