给选住增加 设备变化推送接口
This commit is contained in:
@@ -71,6 +71,64 @@ namespace BLWLogProduce.Services
|
||||
}
|
||||
}));
|
||||
|
||||
///webapidata 采集数据
|
||||
var webapidata_fenxi = ("webapidata_consumer", new Action<SubscribeMessageEventArgs>(async (args) =>
|
||||
{
|
||||
try
|
||||
{
|
||||
string data = args.Body;
|
||||
var qs = JsonConvert.DeserializeObject<Dictionary<string, long>>(data);
|
||||
// 使用 TryGetValue 获取值,不存在则使用0
|
||||
qs.TryGetValue("GetRoomAirList", out long l1);
|
||||
qs.TryGetValue("SetRCUAir", out long l2);
|
||||
qs.TryGetValue("GetRoomSceneList", out long l3);
|
||||
qs.TryGetValue("SetRCUScene", out long l4);
|
||||
qs.TryGetValue("GetRoomLightList", out long l5);
|
||||
qs.TryGetValue("SetRCULight", out long l6);
|
||||
qs.TryGetValue("GetRoomCurtainList", out long l7);
|
||||
qs.TryGetValue("SetRCUCurtain", out long l8);
|
||||
qs.TryGetValue("GetRoomServiceList", out long l9);
|
||||
qs.TryGetValue("SetRCUService", out long l10);
|
||||
qs.TryGetValue("GetOperationLog", out long l11);
|
||||
qs.TryGetValue("GetRoomMusicList", out long l12);
|
||||
qs.TryGetValue("SetRCUMusic", out long l13);
|
||||
qs.TryGetValue("GetRCUStatus", out long l14);
|
||||
qs.TryGetValue("GetAirDetectList", out long l15);
|
||||
qs.TryGetValue("GetHostFaultList", out long l16);
|
||||
qs.TryGetValue("GetRoomTypeAndModalsList", out long l17);
|
||||
qs.TryGetValue("GetRCUInfoForPDU", out long l18);
|
||||
qs.TryGetValue("GetSessionKey", out long l19);
|
||||
qs.TryGetValue("GetPhoneNumber", out long l20);
|
||||
qs.TryGetValue("GetHotelInfoForWX", out long l21);
|
||||
|
||||
|
||||
WaiBuJianKong.data.GetRoomAirList = l1;
|
||||
WaiBuJianKong.data.SetRCUAir = l2;
|
||||
WaiBuJianKong.data.GetRoomSceneList = l3;
|
||||
WaiBuJianKong.data.SetRCUScene = l4;
|
||||
WaiBuJianKong.data.GetRoomLightList = l5;
|
||||
WaiBuJianKong.data.SetRCULight = l6;
|
||||
WaiBuJianKong.data.GetRoomCurtainList = l7;
|
||||
WaiBuJianKong.data.SetRCUCurtain = l8;
|
||||
WaiBuJianKong.data.GetRoomServiceList = l9;
|
||||
WaiBuJianKong.data.SetRCUService = l10;
|
||||
WaiBuJianKong.data.GetOperationLog = l11;
|
||||
WaiBuJianKong.data.GetRoomMusicList = l12;
|
||||
WaiBuJianKong.data.SetRCUMusic = l13;
|
||||
WaiBuJianKong.data.GetRCUStatus = l14;
|
||||
WaiBuJianKong.data.GetAirDetectList = l15;
|
||||
WaiBuJianKong.data.GetHostFaultList = l16;
|
||||
WaiBuJianKong.data.GetRoomTypeAndModalsList = l17;
|
||||
WaiBuJianKong.data.GetRCUInfoForPDU = l18;
|
||||
WaiBuJianKong.data.GetSessionKey = l19;
|
||||
WaiBuJianKong.data.GetPhoneNumber = l20;
|
||||
WaiBuJianKong.data.GetHotelInfoForWX = l21;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
|
||||
}
|
||||
}));
|
||||
///udp 采集数据
|
||||
var xiaofei_fenxi = ("udp_package_consumer", new Action<SubscribeMessageEventArgs>(async (args) =>
|
||||
{
|
||||
@@ -106,7 +164,7 @@ namespace BLWLogProduce.Services
|
||||
{
|
||||
var ts = WaiBuJianKong.data.Process_TH4;
|
||||
int? count = ts + 1;
|
||||
WaiBuJianKong.data.Process_TH4= count;
|
||||
WaiBuJianKong.data.Process_TH4 = count;
|
||||
}
|
||||
else if (key.Equals("task5"))
|
||||
{
|
||||
@@ -697,6 +755,50 @@ namespace BLWLogProduce.Services
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
//专门给选住的
|
||||
var DingYue20 = ("Redis-XuanZhuKafka", new Action<SubscribeMessageEventArgs>(async (args) =>
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
string body = args.Body;
|
||||
XuanZhuRequest? poo = System.Text.Json.JsonSerializer.Deserialize<XuanZhuRequest>(body);
|
||||
|
||||
//string ti = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
|
||||
DeviceActionChangeDataPush ese = new DeviceActionChangeDataPush();
|
||||
ese.Code =long.Parse(poo.code);
|
||||
ese.RoomNumber = poo.roomNumber;
|
||||
ese.HostNumber ="";
|
||||
ese.Devicetype = poo.devicetype;
|
||||
ese.Address = poo.address;
|
||||
ese.Brightness = poo.brightness;
|
||||
ese.Status = poo.status;
|
||||
ese.Name = poo.name;
|
||||
ese.CurrentTemp = poo.currentTemp;
|
||||
ese.SettingTemp = poo.settingTemp;
|
||||
ese.FanSpeed = poo.fanSpeed;
|
||||
ese.Mode = poo.mode;
|
||||
ese.Valve = poo.valve;
|
||||
ese.Createtime = Tools.GetUnixTime();
|
||||
|
||||
|
||||
byte[] data = ese.ToByteArray();
|
||||
string TopicKey = KafkaKey.BLWLog4XuanZhu_RCU_Topic;
|
||||
string DetailKey = KafkaKey.UDPPackageDeviceStatus;
|
||||
|
||||
await p.ProduceAsync(TopicKey, new Message<string, byte[]> { Key = DetailKey, Value = data });
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine(ex.Message);
|
||||
Console.WriteLine(ex.StackTrace);
|
||||
}
|
||||
}));
|
||||
|
||||
|
||||
CSRedisCacheHelper.redis3.Subscribe(webapidata_fenxi);
|
||||
|
||||
CSRedisCacheHelper.redis3.Subscribe(wireshark);
|
||||
CSRedisCacheHelper.redis3.Subscribe(xiaofei_fenxi);
|
||||
|
||||
@@ -723,6 +825,7 @@ namespace BLWLogProduce.Services
|
||||
//CSRedisCacheHelper.redis3.Subscribe(DingYue15);
|
||||
|
||||
//CSRedisCacheHelper.redis3.Subscribe(DingYue3_1);
|
||||
CSRedisCacheHelper.redis3.Subscribe(DingYue20);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user