通过配置实现不上传遥测数据

master
rszn 5 months ago
parent ec9e27714c
commit 0bad7f5ca5

@ -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;

@ -35,5 +35,8 @@
"Job": { "Job": {
"Enabled": false "Enabled": false
}, },
"Task": {
"Disabled": "UploadTelemetryData"
},
"AllowedHosts": "*" "AllowedHosts": "*"
} }

Loading…
Cancel
Save