diff --git a/CRICS_V3_1124.suo b/CRICS_V3_1124.suo
index 4725f48..db114a0 100644
Binary files a/CRICS_V3_1124.suo and b/CRICS_V3_1124.suo differ
diff --git a/Common/XuanZhuOperation.cs b/Common/XuanZhuOperation.cs
index 590762d..96c628d 100644
--- a/Common/XuanZhuOperation.cs
+++ b/Common/XuanZhuOperation.cs
@@ -72,6 +72,71 @@ namespace Common
}
}
+ public class XuanZhuHotelData
+ {
+ public static int[] dataArray = {
+ 1094, 1094, 1225, 1249, 1243, 1174, 1094, 1094, 1266, 1266,
+ 1094, 1237, 1317, 1317, 1325, 1329, 1001, 1333, 1283, 1371,
+ 1284, 1374, 1400, 1094, 3747, 1419, 1420, 1427, 1222, 1454,
+ 1489, 1989, 1515, 1527, 1524, 1557, 1337, 1332, 1490, 1672,
+ 1695, 1699, 1701, 1620, 1674};
+ }
+ public class XuanZhuRequest
+ {
+ ///
+ /// 酒店编码
+ ///
+ public string code { get; set; }
+ ///
+ /// 房号
+ ///
+ public string roomNumber { get; set; }
+ public string devicetype { get; set; }
+ ///
+ /// 回路地址
+ ///
+ public string address { get; set; }
+ ///
+ /// 回路名称
+ ///
+ public string name { get; set; }
+ ///
+ /// 状态
+ ///
+ public int status { get; set; }
+ ///
+ /// 异常类型
+ ///
+ public int faultType { get; set; }
+ ///
+ /// 异常值
+ ///
+ public int faultData { get; set; }
+ ///
+ /// 亮度
+ ///
+ public int brightness { get; set; }
+ ///
+ /// 当前温度
+ ///
+ public int currentTemp { get; set; }
+ ///
+ /// 设定温度
+ ///
+ public int settingTemp { get; set; }
+ ///
+ /// 风速
+ ///
+ public int fanSpeed { get; set; }
+ ///
+ /// 模式
+ ///
+ public int mode { get; set; }
+ ///
+ /// 阀门
+ ///
+ public int valve { get; set; }
+ }
public class XuanZhuResponse
{
///
diff --git a/CommonEntity/CacheKey.cs b/CommonEntity/CacheKey.cs
index abc50dc..ba3bfee 100644
--- a/CommonEntity/CacheKey.cs
+++ b/CommonEntity/CacheKey.cs
@@ -123,6 +123,7 @@ namespace CommonEntity
public static string WebChatDeviceFault = "WXFault";
public static string DuOSToken = "DuOSToken";
+ public static string XuanZhuKafka = "XZ_DeviceStatusChange";
}
public class ChangLiangValue
{
diff --git a/RCUHost/Implement/New_RoomStatusReceiver.cs b/RCUHost/Implement/New_RoomStatusReceiver.cs
index 2b7c74a..1198635 100644
--- a/RCUHost/Implement/New_RoomStatusReceiver.cs
+++ b/RCUHost/Implement/New_RoomStatusReceiver.cs
@@ -1264,6 +1264,39 @@ namespace RCUHost.Implement
}
+ #region kafka队列
+ var codesss = host.SysHotel.Code;
+ if (XuanZhuHotelData.dataArray.Contains(int.Parse(codesss)))
+ {
+ XuanZhuRequest resp5 = new XuanZhuRequest();
+ resp5.code = host.SysHotel.Code;
+ resp5.roomNumber = host.RoomNumber;
+ resp5.devicetype = hostModal.ModalType.ToString();
+ resp5.address = hostModal.Modal.ModalAddress;
+ resp5.name = hostModal.Modal.Name;
+ resp5.status = hostModal.Status;
+ if (resp5.status == 1)
+ {
+ resp5.brightness = hostModal.Brightness;
+ resp5.currentTemp = hostModal.AirConditionData.CurrentTemp;
+ resp5.settingTemp = hostModal.AirConditionData.SettingTemp;
+ resp5.mode = hostModal.AirConditionData.Mode;
+ resp5.fanSpeed = hostModal.AirConditionData.FanSpeed;
+ resp5.valve = hostModal.AirConditionData.Valve;
+ }
+ else
+ {
+ resp5.brightness = 0;
+ resp5.currentTemp = 0;
+ resp5.settingTemp = 0;
+ resp5.mode = 0;
+ resp5.fanSpeed = 0;
+ resp5.valve = 0;
+ }
+ var str111 = Newtonsoft.Json.JsonConvert.SerializeObject(resp5);
+ CSRedisCacheHelper.Publish("Redis-XuanZhuKafka", str111);
+ }
+ #endregion
#region 当设备或服务状态发生变化时,推送给指定的第三方接口
if (!string.IsNullOrEmpty(host.SysHotel.DeviceStatusPushURL))
diff --git a/RCUHost/Implement/RoomStatusReceiver.cs b/RCUHost/Implement/RoomStatusReceiver.cs
index b73f0f7..7139d04 100644
--- a/RCUHost/Implement/RoomStatusReceiver.cs
+++ b/RCUHost/Implement/RoomStatusReceiver.cs
@@ -1899,6 +1899,41 @@ namespace RCUHost.Implement
}, tup);
}
#endregion
+
+
+ var codesss = host.SysHotel.Code;
+ #region kafka队列
+ if (XuanZhuHotelData.dataArray.Contains(int.Parse(codesss)))
+ {
+ XuanZhuRequest resp1 = new XuanZhuRequest();
+ resp1.code = host.SysHotel.Code;
+ resp1.roomNumber = host.RoomNumber;
+ resp1.devicetype = hostModal.ModalType.ToString();
+ resp1.address = hostModal.Modal.ModalAddress;
+ resp1.name = hostModal.Modal.Name;
+ resp1.status = hostModal.Status;
+ if (resp1.status == 1)
+ {
+ resp1.brightness = hostModal.Brightness;
+ resp1.currentTemp = hostModal.AirConditionData.CurrentTemp;
+ resp1.settingTemp = hostModal.AirConditionData.SettingTemp;
+ resp1.mode = hostModal.AirConditionData.Mode;
+ resp1.fanSpeed = hostModal.AirConditionData.FanSpeed;
+ resp1.valve = hostModal.AirConditionData.Valve;
+ }
+ else
+ {
+ resp1.brightness = 0;
+ resp1.currentTemp = 0;
+ resp1.settingTemp = 0;
+ resp1.mode = 0;
+ resp1.fanSpeed = 0;
+ resp1.valve = 0;
+ }
+ var str111 = Newtonsoft.Json.JsonConvert.SerializeObject(resp1);
+ CSRedisCacheHelper.Publish("Redis-XuanZhuKafka", str111);
+ }
+ #endregion
}
else
{
diff --git a/Service/Implement/HostManager.cs b/Service/Implement/HostManager.cs
index 39a0f86..717f888 100644
--- a/Service/Implement/HostManager.cs
+++ b/Service/Implement/HostManager.cs
@@ -107,6 +107,7 @@ namespace Service.Implement
return list;
}
+
public IList LoadAll(string order, string sort, Group group, string roomNumber)
{
IList groups = GroupRepository.GetGroupList(group);
@@ -575,7 +576,7 @@ namespace Service.Implement
else
{
accessToken = SysOauth2Repository.GetXiaoDuToken();
- MemoryCacheHelper.Set(KKK,accessToken,DateTimeOffset.Now.AddMinutes(20));
+ MemoryCacheHelper.Set(KKK, accessToken, DateTimeOffset.Now.AddMinutes(20));
}
if (!string.IsNullOrEmpty(accessToken) && host.SysHotel.IsPowerOffResetXiaoDu)
{
@@ -769,7 +770,8 @@ namespace Service.Implement
request1.AddParameter("jsonData", jsstr);
- client1.ExecuteAsync(request1, (response) => { });
+ //client1.ExecuteAsync(request1, (response) => { });
+ client1.Execute(request1);
}
}
@@ -1316,13 +1318,32 @@ namespace Service.Implement
//1 为取电,2为没有取电
if (mm.Status != 1)
{
+ List hostModals = new List();
//获取启用的空调回路
- List hostModals = HostModalRepository.LoadByHostID(host_id).Where(r => r.Modal.Type == DeviceType.AirConditioner && r.Modal.ActiveIndicator).ToList();
-
- RoomNobodyHowTo nnn = RoomNoBodyMananger.LoadAll().FirstOrDefault(A => A.CurrentHotelID == hotel_id);
-
-
+ string Hkey = "HostManagerHostModal_" + host_id;
+ var ddd = MemoryCacheHelper.Get(Hkey);
+ if (ddd != null)
+ {
+ hostModals = ddd as List;
+ }
+ else
+ {
+ hostModals = HostModalRepository.LoadByHostID(host_id).Where(r => r.Modal.Type == DeviceType.AirConditioner && r.Modal.ActiveIndicator).ToList();
+ MemoryCacheHelper.Set(Hkey, hostModals, DateTimeOffset.Now.AddMinutes(30));
+ }
+ RoomNobodyHowTo nnn = null;
+ string RKey = "RNO_" + hotel_id;
+ var ooo = MemoryCacheHelper.Get(RKey);
+ if (ooo != null)
+ {
+ nnn = ooo as RoomNobodyHowTo;
+ }
+ else
+ {
+ nnn = RoomNoBodyMananger.LoadAll().FirstOrDefault(A => A.CurrentHotelID == hotel_id);
+ MemoryCacheHelper.Set(RKey, nnn, DateTimeOffset.Now.AddMinutes(30));
+ }
if (nnn != null)
{
foreach (HostModal hostModal in hostModals)
diff --git a/WebSite/Controllers/IoTController.cs b/WebSite/Controllers/IoTController.cs
index 7dbb2f5..16b09e8 100644
--- a/WebSite/Controllers/IoTController.cs
+++ b/WebSite/Controllers/IoTController.cs
@@ -6741,7 +6741,18 @@ namespace WebSite.Controllers
i.CommandDescription = sss;
SendMQTTData.Send(i);
}
- var hostModal = HostModalManager.GetByModalAddress(host.ID, modalAddress);//设备控制
+ string MKey = "XiaoDuAddress_" + host.ID + "_" + modalAddress;
+ var ddd = HttpContext.Cache.Get(MKey);
+ HostModal hostModal = null;
+ if (ddd != null)
+ {
+ hostModal = ddd as HostModal;
+ }
+ else
+ {
+ hostModal = HostModalManager.GetByModalAddress(host.ID, modalAddress);//设备控制
+ HttpContext.Cache.Insert(MKey,hostModal,null,DateTime.Now.AddMinutes(30),Cache.NoSlidingExpiration);
+ }
if (hostModal == null)
{
logger.Error(string.Format("{3}(酒店:{0},房号:{1})未找到对应的回路,Address:{2}", host.SysHotel.Code + host.SysHotel.Name, host.RoomNumber, modalAddress, platformName));