增加几个功能
This commit is contained in:
@@ -33,6 +33,8 @@ namespace BLWLogProduce.Models
|
||||
{
|
||||
var o = JsonConvert.DeserializeObject<OnOffLineData>(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);
|
||||
|
||||
@@ -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<NewVersionLog>(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<SubscribeMessageEventArgs>(async (args) =>
|
||||
{
|
||||
string body = args.Body;
|
||||
|
||||
try
|
||||
{
|
||||
Kafka_XinTiao? poo = System.Text.Json.JsonSerializer.Deserialize<Kafka_XinTiao>(body);
|
||||
string TopicKey1 = KafkaKey.Blwlog4Nodejs_oldrcu_heartbeat_topic;
|
||||
string DetailKey1 = poo.hotel_id;
|
||||
|
||||
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);
|
||||
}
|
||||
}));
|
||||
|
||||
|
||||
//注册0xB1
|
||||
var TSLog_DingYue_ZhuCe = ("redis-0XB1", new Action<SubscribeMessageEventArgs>(async (args) =>
|
||||
{
|
||||
string body = args.Body;
|
||||
|
||||
try
|
||||
{
|
||||
RegisterInfo? poo = System.Text.Json.JsonSerializer.Deserialize<RegisterInfo>(body);
|
||||
string TopicKey1 = KafkaKey.blwlog4Nodejs_rcu_register_topic;
|
||||
string DetailKey1 =poo.device_id;
|
||||
|
||||
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);
|
||||
}
|
||||
}));
|
||||
|
||||
|
||||
var TSLog_DingYue_0X36 = ("redis-0X36-0X0F", new Action<SubscribeMessageEventArgs>(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<Interface3Log>(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<string, byte[]> { Key = DetailKey, Value = bytes });
|
||||
//var dr = await p.ProduceAsync(TopicKey, new Message<string, byte[]> { 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)
|
||||
{
|
||||
|
||||
BIN
BLWLogServer.suo
BIN
BLWLogServer.suo
Binary file not shown.
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<NameOfLastUsedPublishProfile>FolderProfile</NameOfLastUsedPublishProfile>
|
||||
<NameOfLastUsedPublishProfile>E:\tian\chongxin\NewGit\Web_BLSKafka_Server_Prod\BLWLogServer\Properties\PublishProfiles\FolderProfile.pubxml</NameOfLastUsedPublishProfile>
|
||||
<Controller_SelectedScaffolderID>ApiControllerEmptyScaffolder</Controller_SelectedScaffolderID>
|
||||
<Controller_SelectedScaffolderCategoryPath>root/Common/Api</Controller_SelectedScaffolderCategoryPath>
|
||||
</PropertyGroup>
|
||||
|
||||
@@ -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; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 1:下发,0:上报 默认0
|
||||
/// </summary>
|
||||
public ushort is_send { get; set; }
|
||||
public byte[] udp_raw { get; set; }
|
||||
public string extra { get; set; }
|
||||
|
||||
public int ip_type { get; set; }
|
||||
/// <summary>
|
||||
/// 机型编号
|
||||
/// </summary>
|
||||
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; }
|
||||
/// <summary>
|
||||
/// RCU 时间,年月日 那种
|
||||
/// </summary>
|
||||
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; }
|
||||
|
||||
/// <summary>
|
||||
/// 系统锁定状态
|
||||
/// </summary>
|
||||
public int sys_lock_status { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 授权时间
|
||||
/// </summary>
|
||||
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; }
|
||||
}
|
||||
/// <summary>
|
||||
/// ts 日志
|
||||
/// </summary>
|
||||
|
||||
@@ -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";
|
||||
|
||||
/// <summary>
|
||||
/// 注册
|
||||
/// </summary>
|
||||
public static string blwlog4Nodejs_rcu_register_topic= "blwlog4Nodejs-rcu-register-topic";
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\BLWLogProduce\BLWLogProduce.csproj" />
|
||||
<ProjectReference Include="..\CommonEntity\CommonEntity.csproj" />
|
||||
<ProjectReference Include="..\CommonTools\CommonTools.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
@@ -11,12 +11,110 @@ namespace ConsoleApp2
|
||||
{
|
||||
internal class Program
|
||||
{
|
||||
static void tsa(string body)
|
||||
{
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
NengHao? poo = System.Text.Json.JsonSerializer.Deserialize<NengHao>(body);
|
||||
|
||||
if (string.IsNullOrEmpty(poo.HostNumber))
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (poo.NengHaoList == null || poo.NengHaoList.Count == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
#region 宝镜系统使用的能耗数据结构
|
||||
List<DeviceData> la = new List<DeviceData>();
|
||||
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<SinglePowerChannelData> nenghaolist = new List<SinglePowerChannelData>();
|
||||
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<NengHao>(YYY111111);
|
||||
|
||||
var o = JsonConvert.DeserializeObject<CommonEntity.OnOffLineData>(YYY111111);
|
||||
string afds = "hello";
|
||||
string dda = afds;
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user