增加日志

This commit is contained in:
2026-02-03 08:54:16 +08:00
parent 10bf712006
commit 3de5990573
33 changed files with 865 additions and 43 deletions

View File

@@ -9,6 +9,7 @@ using Google.Protobuf;
using MessagePack;
using Microsoft.CodeAnalysis.Host.Mef;
using Microsoft.Extensions.Caching.Memory;
using Microsoft.Extensions.ObjectPool;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using NLog;
@@ -374,14 +375,14 @@ namespace BLWLogProduce.Services
{
return;
}
logger.Error("能耗:" + body);
//logger.Error("能耗:" + body);
//string str= Newtonsoft.Json.JsonConvert.SerializeObject(poo);
//Console.WriteLine("收到了"+str);
byte[] qf = MyMessagePacker.FastSerialize(poo);
//byte[] qf = MyMessagePacker.FastSerialize(poo);
string TopicKey = KafkaKey.BLWLog_RCU_Topic;
string DetailKey = KafkaKey.UDPPackagePowerMonitor;
await p.ProduceAsync(TopicKey, new Message<string, byte[]> { Key = DetailKey, Value = qf });
//string TopicKey = KafkaKey.BLWLog_RCU_Topic;
//string DetailKey = KafkaKey.UDPPackagePowerMonitor;
//await p.ProduceAsync(TopicKey, new Message<string, byte[]> { Key = DetailKey, Value = qf });
#region 使
@@ -440,6 +441,7 @@ namespace BLWLogProduce.Services
ese.IdentityInfo = poo.IdentityInfo;
ese.CardEvent = poo.CardEvent;
ese.PMSStatus = poo.PMS_Status;
ese.BrightG = poo.Bright_G;
byte[] data = ese.ToByteArray();
string TopicKey1 = KafkaKey.BLWLog4BaoJing_RCU_Topic;
@@ -514,6 +516,10 @@ namespace BLWLogProduce.Services
NewVersionLog? poo = System.Text.Json.JsonSerializer.Deserialize<NewVersionLog>(body);
poo.ts_ms = Tools.GetUnixTime_MS();
if (string.IsNullOrEmpty(poo.hotel_id) || string.IsNullOrEmpty(poo.device_id))
{
return;
}
string TopicKey1 = KafkaKey.BLWLog4NodeJs_RCU_Topic;
string DetailKey1 = poo.comm_seq.ToString();
@@ -529,6 +535,35 @@ namespace BLWLogProduce.Services
}));
var TSLog_DingYue_0X36 = ("redis-0X36-0X0F", new Action<SubscribeMessageEventArgs>(async (args) =>
{
string body = args.Body;
try
{
DeviceActionData? poo = System.Text.Json.JsonSerializer.Deserialize<DeviceActionData>(body);
poo.ts_ms = Tools.GetUnixTime_MS();
if (string.IsNullOrEmpty(poo.hotel_id) || string.IsNullOrEmpty(poo.device_id))
{
return;
}
string TopicKey1 = KafkaKey.BLWLog4NodeJs_RCU_Action_Topic;
string DetailKey1 = poo.frame_id.ToString();
var jsonstr = JsonConvert.SerializeObject(poo);
await p.ProduceAsync(TopicKey1, new Message<string, byte[]> { Key = DetailKey1, Value = Encoding.UTF8.GetBytes(jsonstr) });
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
Console.WriteLine(ex.StackTrace);
}
}));
#region
//var DingYue3_1 = ("redis-carbon_trigger", new Action<SubscribeMessageEventArgs>(async (args) =>
//{
@@ -630,6 +665,8 @@ namespace BLWLogProduce.Services
string body = args.Body;
CommonEntity.OnOffLineData? usa = System.Text.Json.JsonSerializer.Deserialize<CommonEntity.OnOffLineData>(body);
//poo.ts_ms = Tools.GetUnixTime_MS();
usa.UnixTime = Tools.GetUnixTime_MS();
if (string.IsNullOrEmpty(usa.EndPoint))
{
logger.Error("RCUOnOffLine:" + body);
@@ -640,6 +677,12 @@ namespace BLWLogProduce.Services
logger.Error("RCUOnOffLine:" + body);
return;
}
string Key1 = KafkaKey.BLWLog4NodeJs_RCU_OnOffLine_Topic;
string Key2 = usa.HostNumber;
byte[] nnn = Encoding.UTF8.GetBytes(body);
var dr = await p.ProduceAsync(Key1, new Message<string, byte[]> { Key = Key2, Value = nnn });
BLWData.Entity.OnOffLineData ese = new BLWData.Entity.OnOffLineData();
ese.HotelCode = usa.HotelCode;
ese.HostNumber = usa.HostNumber;
@@ -649,7 +692,6 @@ namespace BLWLogProduce.Services
ese.Mac = usa.MAC ?? "";
ese.CurrentTime = usa.CurrentTime.ToString("yyyy-MM-dd HH:mm:ss.fff");
byte[] data = ese.ToByteArray();
string TopicKey1 = KafkaKey.BLWLog4BaoJing_RCU_Topic;
string DetailKey1 = KafkaKey.RCUOnLineStatus;
@@ -913,6 +955,7 @@ namespace BLWLogProduce.Services
//新版本日志
CSRedisCacheHelper.redis3.Subscribe(TSLog_DingYue);
CSRedisCacheHelper.redis3.Subscribe(TSLog_DingYue_0X36);
}
catch (Exception ex)
{