diff --git a/BLWLogProduce/Models/MyPublishRedis.cs b/BLWLogProduce/Models/MyPublishRedis.cs index 7fc36f8..fbde536 100644 --- a/BLWLogProduce/Models/MyPublishRedis.cs +++ b/BLWLogProduce/Models/MyPublishRedis.cs @@ -33,6 +33,8 @@ namespace BLWLogProduce.Models { var o = JsonConvert.DeserializeObject(data_take); o.CurrentStatus = "off"; + o.CurrentTime = DateTime.Now; + o.UnixTime = DateTimeOffset.Now.ToUnixTimeSeconds(); string str = Newtonsoft.Json.JsonConvert.SerializeObject(o); redis6.Publish("redis-on_off_line", str); diff --git a/BLWLogProduce/Services/KafkaProduce.cs b/BLWLogProduce/Services/KafkaProduce.cs index 3bc4377..c6581b0 100644 --- a/BLWLogProduce/Services/KafkaProduce.cs +++ b/BLWLogProduce/Services/KafkaProduce.cs @@ -371,11 +371,15 @@ namespace BLWLogProduce.Services { return; } - if (poo.NengHaoList == null || poo.NengHaoList.Count == 0) - { - return; - } - //logger.Error("能耗:" + body); + //2026-03-04 麦工说,要重新启用能耗数据 + //if (poo.NengHaoList == null || poo.NengHaoList.Count == 0) + //{ + // return; + //} + //if (poo.HotelCode == 2302) + //{ + // logger.Error("能耗:" + body); + //} //string str= Newtonsoft.Json.JsonConvert.SerializeObject(poo); //Console.WriteLine("收到了"+str); //byte[] qf = MyMessagePacker.FastSerialize(poo); @@ -442,12 +446,15 @@ namespace BLWLogProduce.Services ese.CardEvent = poo.CardEvent; ese.PMSStatus = poo.PMS_Status; ese.BrightG = poo.Bright_G; + ese.Version = poo.Version; byte[] data = ese.ToByteArray(); string TopicKey1 = KafkaKey.BLWLog4BaoJing_RCU_Topic; string DetailKey1 = KafkaKey.UDPPackagePowerMonitor; - if (poo.HotelCode == 1085) + + + if (poo.HotelCode == 1003) { logger.Error("能耗数据:" + body); } @@ -515,6 +522,14 @@ namespace BLWLogProduce.Services { NewVersionLog? poo = System.Text.Json.JsonSerializer.Deserialize(body); poo.ts_ms = Tools.GetUnixTime_MS(); + if (poo.hotel_id.Equals("2144")&&poo.room_id.Equals("1006")||poo.room_id.Equals("1007")) + { + logger.Error("漏数据监控:"+poo.room_id+"##"+poo.comm_seq); + } + if (poo.hotel_id.Equals("1085")&&poo.room_id.Equals("8099")) + { + logger.Error("漏数据监控:"+poo.room_id+"##"+poo.comm_seq); + } if (string.IsNullOrEmpty(poo.hotel_id) || string.IsNullOrEmpty(poo.device_id)) { @@ -535,6 +550,51 @@ namespace BLWLogProduce.Services })); + var TSLog_DingYue_XinTiao = ("redis-heartbeat", new Action(async (args) => + { + string body = args.Body; + + try + { + Kafka_XinTiao? poo = System.Text.Json.JsonSerializer.Deserialize(body); + string TopicKey1 = KafkaKey.Blwlog4Nodejs_oldrcu_heartbeat_topic; + string DetailKey1 = poo.hotel_id; + + var jsonstr = JsonConvert.SerializeObject(poo); + await p.ProduceAsync(TopicKey1, new Message { Key = DetailKey1, Value = Encoding.UTF8.GetBytes(jsonstr) }); + + } + catch (Exception ex) + { + Console.WriteLine(ex.Message); + Console.WriteLine(ex.StackTrace); + } + })); + + + //注册0xB1 + var TSLog_DingYue_ZhuCe = ("redis-0XB1", new Action(async (args) => + { + string body = args.Body; + + try + { + RegisterInfo? poo = System.Text.Json.JsonSerializer.Deserialize(body); + string TopicKey1 = KafkaKey.blwlog4Nodejs_rcu_register_topic; + string DetailKey1 =poo.device_id; + + var jsonstr = JsonConvert.SerializeObject(poo); + await p.ProduceAsync(TopicKey1, new Message { Key = DetailKey1, Value = Encoding.UTF8.GetBytes(jsonstr) }); + + } + catch (Exception ex) + { + Console.WriteLine(ex.Message); + Console.WriteLine(ex.StackTrace); + } + })); + + var TSLog_DingYue_0X36 = ("redis-0X36-0X0F", new Action(async (args) => { string body = args.Body; @@ -548,7 +608,7 @@ namespace BLWLogProduce.Services { return; } - if (poo.cmd_word.Equals("0E")&&poo.fault_list.Count==0&&poo.device_list.Count==0) + if (poo.cmd_word.Equals("0E") && poo.fault_list.Count == 0 && poo.device_list.Count == 0) { return; } @@ -674,15 +734,15 @@ namespace BLWLogProduce.Services usa.UnixTime = Tools.GetUnixTime_MS(); if (string.IsNullOrEmpty(usa.EndPoint)) { - logger.Error("RCUOnOffLine:" + body); + //logger.Error("RCUOnOffLine:" + body); return; } if (string.IsNullOrEmpty(usa.HostNumber)) { - logger.Error("RCUOnOffLine:" + body); + //logger.Error("RCUOnOffLine:" + body); return; } - + string Key1 = KafkaKey.BLWLog4NodeJs_RCU_OnOffLine_Topic; string Key2 = usa.HostNumber; @@ -770,6 +830,7 @@ namespace BLWLogProduce.Services { string body = args.Body; + logger.Error("TCL:" + body); Interface3Log? usa = System.Text.Json.JsonSerializer.Deserialize(body); byte[] bytes = MyMessagePacker.FastSerialize(usa); @@ -779,7 +840,7 @@ namespace BLWLogProduce.Services //var partition = new Partition(1); // 指定分区号 //var topicPartition = new TopicPartition(TopicKey, partition); - var dr = await p.ProduceAsync(TopicKey, new Message { Key = DetailKey, Value = bytes }); + //var dr = await p.ProduceAsync(TopicKey, new Message { Key = DetailKey, Value = bytes }); } catch (Exception ex) { @@ -807,8 +868,8 @@ namespace BLWLogProduce.Services CurrentStatus = usa.CurrentStatus, CurrentTime = usa.CurrentTime, UnixTime = Tools.GetUnixTime_MS(), - LauncherVersion= usa.LauncherVersion, - RebootReason= usa.RebootReason + LauncherVersion = usa.LauncherVersion, + RebootReason = usa.RebootReason }; byte[] bytes = Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(rrr)); @@ -980,6 +1041,8 @@ namespace BLWLogProduce.Services CSRedisCacheHelper.redis3.Subscribe(TSLog_DingYue); CSRedisCacheHelper.redis3.Subscribe(TSLog_DingYue_0X36); CSRedisCacheHelper.redis3.Subscribe(DingYue11); + CSRedisCacheHelper.redis3.Subscribe(TSLog_DingYue_XinTiao); + CSRedisCacheHelper.redis3.Subscribe(TSLog_DingYue_ZhuCe); } catch (Exception ex) { diff --git a/BLWLogServer.suo b/BLWLogServer.suo index 06e3ea8..45f7726 100644 Binary files a/BLWLogServer.suo and b/BLWLogServer.suo differ diff --git a/BLWLogServer/BLWLogServer.csproj.user b/BLWLogServer/BLWLogServer.csproj.user index 2add57c..4418a07 100644 --- a/BLWLogServer/BLWLogServer.csproj.user +++ b/BLWLogServer/BLWLogServer.csproj.user @@ -1,7 +1,7 @@  - FolderProfile + E:\tian\chongxin\NewGit\Web_BLSKafka_Server_Prod\BLWLogServer\Properties\PublishProfiles\FolderProfile.pubxml ApiControllerEmptyScaffolder root/Common/Api diff --git a/CommonEntity/TSLog.cs b/CommonEntity/TSLog.cs index 62cbd4f..5d5fb22 100644 --- a/CommonEntity/TSLog.cs +++ b/CommonEntity/TSLog.cs @@ -58,6 +58,70 @@ namespace CommonEntity } + public class RegisterInfo + { + public long ts_ms { get; set; } + public long hotel_id { get; set; } + public string room_id { get; set; } + public string device_id { get; set; } + + + /// + /// 1:下发,0:上报 默认0 + /// + public ushort is_send { get; set; } + public byte[] udp_raw { get; set; } + public string extra { get; set; } + + public int ip_type { get; set; } + /// + /// 机型编号 + /// + public string model_num { get; set; } + public string server_ip { get; set; } + public string ip { get; set; } + public string subnet_mask { get; set; } + public string gateway { get; set; } + public string dns { get; set; } + public string app_version { get; set; } + /// + /// RCU 时间,年月日 那种 + /// + public string rcu_time { get; set; } + public string launcher_version { get; set; } + public string mac { get; set; } + public int room_type_id { get; set; } + public string config_version { get; set; } + public int room_status { get; set; } + public string season { get; set; } + + /// + /// 系统锁定状态 + /// + public int sys_lock_status { get; set; } + + /// + /// 授权时间 + /// + public string authorization_time { get; set; } + public string authorization_days { get; set; } + public string room_num_remark { get; set; } + public string room_type_remark { get; set; } + public string room_remark { get; set; } + + public string mcu_name { get; set; } + public string central_control_name { get; set; } + public string configure_hotel_name { get; set; } + public string configure_room_type_name { get; set; } + } + public record Kafka_XinTiao + { + public string current_time { get; set; } + public long ts_ms { get; set; } + public string device_id { get; set; } + public string hotel_id { get; set; } + public string room_id { get; set; } + } /// /// ts 日志 /// diff --git a/CommonEntity/UDPPackage.cs b/CommonEntity/UDPPackage.cs index 8136ea4..2b00a4b 100644 --- a/CommonEntity/UDPPackage.cs +++ b/CommonEntity/UDPPackage.cs @@ -37,6 +37,12 @@ namespace CommonEntity public static string BLWLog4NodeJs_RCU_Topic = "blwlog4Nodejs-rcu-heartbeat-topic"; public static string BLWLog4NodeJs_RCU_OnOffLine_Topic = "blwlog4Nodejs-rcu-onoffline-topic-0"; public static string BLWLog4NodeJs_RCU_Action_Topic = "blwlog4Nodejs-rcu-action-topic"; + public static string Blwlog4Nodejs_oldrcu_heartbeat_topic = "blwlog4Nodejs-oldrcu-heartbeat-topic"; + + /// + /// 注册 + /// + public static string blwlog4Nodejs_rcu_register_topic= "blwlog4Nodejs-rcu-register-topic"; #endregion diff --git a/ConsoleApp2/ConsoleApp2.csproj b/ConsoleApp2/ConsoleApp2.csproj index b780788..8eb0ca0 100644 --- a/ConsoleApp2/ConsoleApp2.csproj +++ b/ConsoleApp2/ConsoleApp2.csproj @@ -12,6 +12,7 @@ + diff --git a/ConsoleApp2/Program.cs b/ConsoleApp2/Program.cs index 427eefa..906feac 100644 --- a/ConsoleApp2/Program.cs +++ b/ConsoleApp2/Program.cs @@ -11,12 +11,110 @@ namespace ConsoleApp2 { internal class Program { + static void tsa(string body) + { + + + try + { + NengHao? poo = System.Text.Json.JsonSerializer.Deserialize(body); + + if (string.IsNullOrEmpty(poo.HostNumber)) + { + return; + } + if (poo.NengHaoList == null || poo.NengHaoList.Count == 0) + { + return; + } + + + #region 宝镜系统使用的能耗数据结构 + List la = new List(); + foreach (var item in poo.AllDeviceData) + { + DeviceData dd = new DeviceData(); + dd.HostID = item.HostID; + dd.DeviceType = item.DeviceType; + dd.Address = item.Address; + dd.Brightness = item.Brightness; + dd.Status = item.Status; + dd.CurrentTemp = item.CurrentTemp; + dd.SettingTemp = item.SettingTemp; + dd.Mode = item.Mode; + dd.FanSpeed = item.FanSpeed; + dd.Valve = item.Valve; + la.Add(dd); + } + + + List nenghaolist = new List(); + if (poo.NengHaoList != null && poo.NengHaoList.Count > 0) + { + foreach (var item in poo.NengHaoList) + { + SinglePowerChannelData gs1 = new SinglePowerChannelData(); + gs1.Address = item.address; + gs1.Dianliu = item.dianliu; + gs1.Dianya = item.dianya; + gs1.Gonglv = item.gonglv; + gs1.Nenghao = item.nenghao; + gs1.Zongnenghao = item.zongnenghao; + nenghaolist.Add(gs1); + } + + } + //宝镜系统使用 + //EnergyConsumption ese = new EnergyConsumption(); + //ese.HotelCode = poo.HotelCode; + //ese.HostNumber = poo.HostNumber; + //ese.Mac = poo.Mac; + //ese.EndPoint = poo.EndPoint; + //ese.PowerChannelList.AddRange(nenghaolist); + ////ese.V = poo.V; + ////ese.A = poo.A; + ////ese.P = poo.P; + ////ese.EnergyConsumption_ = poo.Energy_Consumption; + ////ese.SumEnergyConsumption = poo.Sum_Energy_Consumption; + //ese.CreateTime = poo.CreateTime; + //ese.RoomNumber = poo.RoomNumber ?? ""; + //ese.IsTakeCard = poo.IsTakeCard; + //ese.IsInsertCard = poo.IsInsertCard; + //ese.CarbonVIP = poo.CarbonVIP; + //ese.DeviceStatusList.AddRange(la); + //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; + //string DetailKey1 = KafkaKey.UDPPackagePowerMonitor; + + + + if (poo.HotelCode == 2302) + { + } + + #endregion + } + catch (Exception ex) + { + Console.WriteLine(ex.Message); + Console.WriteLine(ex.StackTrace); + } + } static void Main(string[] args) { - GoodRedis.redis6.Set("aaa", "bbb", 10); - Console.ReadLine(); string YYY111111 = File.ReadAllText("2.txt"); + + tsa(YYY111111); + Console.WriteLine("Hello, World!"); + + NengHao? csdn = System.Text.Json.JsonSerializer.Deserialize(YYY111111); + var o = JsonConvert.DeserializeObject(YYY111111); string afds = "hello"; string dda = afds; diff --git a/Redis定阅/bin/Debug/net8.0/CommonEntity.dll b/Redis定阅/bin/Debug/net8.0/CommonEntity.dll index 104c7c3..31fe7cd 100644 Binary files a/Redis定阅/bin/Debug/net8.0/CommonEntity.dll and b/Redis定阅/bin/Debug/net8.0/CommonEntity.dll differ diff --git a/Redis定阅/bin/Debug/net8.0/CommonEntity.pdb b/Redis定阅/bin/Debug/net8.0/CommonEntity.pdb index a79fe9f..eefcb13 100644 Binary files a/Redis定阅/bin/Debug/net8.0/CommonEntity.pdb and b/Redis定阅/bin/Debug/net8.0/CommonEntity.pdb differ diff --git a/Redis定阅/bin/Debug/net8.0/CommonTools.dll b/Redis定阅/bin/Debug/net8.0/CommonTools.dll index 70b818e..846dea8 100644 Binary files a/Redis定阅/bin/Debug/net8.0/CommonTools.dll and b/Redis定阅/bin/Debug/net8.0/CommonTools.dll differ diff --git a/Redis定阅/bin/Debug/net8.0/CommonTools.pdb b/Redis定阅/bin/Debug/net8.0/CommonTools.pdb index e472458..0bd2988 100644 Binary files a/Redis定阅/bin/Debug/net8.0/CommonTools.pdb and b/Redis定阅/bin/Debug/net8.0/CommonTools.pdb differ diff --git a/Redis定阅/bin/Debug/net8.0/Redis定阅.dll b/Redis定阅/bin/Debug/net8.0/Redis定阅.dll index a6c9a10..6c92f26 100644 Binary files a/Redis定阅/bin/Debug/net8.0/Redis定阅.dll and b/Redis定阅/bin/Debug/net8.0/Redis定阅.dll differ diff --git a/Redis定阅/bin/Debug/net8.0/Redis定阅.exe b/Redis定阅/bin/Debug/net8.0/Redis定阅.exe index 28612ae..8f4fd0d 100644 Binary files a/Redis定阅/bin/Debug/net8.0/Redis定阅.exe and b/Redis定阅/bin/Debug/net8.0/Redis定阅.exe differ diff --git a/Redis定阅/bin/Debug/net8.0/Redis定阅.pdb b/Redis定阅/bin/Debug/net8.0/Redis定阅.pdb index b3900b1..7e62d8e 100644 Binary files a/Redis定阅/bin/Debug/net8.0/Redis定阅.pdb and b/Redis定阅/bin/Debug/net8.0/Redis定阅.pdb differ