From dfcb2a1844fd55b57bae23e290b30ec6380e8508 Mon Sep 17 00:00:00 2001
From: chenqiyang <1406175257@qq.com>
Date: 星期五, 26 八月 2022 15:04:22 +0800
Subject: [PATCH] 更新全视通dll
---
ZigbeeApp/Shared/Phone/UserCenter/UserMain/MessageManagementForm.cs | 227 +++++++++++++++++++++++++++++++++++++-------------------
1 files changed, 148 insertions(+), 79 deletions(-)
diff --git a/ZigbeeApp/Shared/Phone/UserCenter/UserMain/MessageManagementForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/UserMain/MessageManagementForm.cs
index 5388ddd..b071030 100755
--- a/ZigbeeApp/Shared/Phone/UserCenter/UserMain/MessageManagementForm.cs
+++ b/ZigbeeApp/Shared/Phone/UserCenter/UserMain/MessageManagementForm.cs
@@ -167,9 +167,9 @@
framBack.AddChidren(frameDate);
var btnDate = new NormalViewControl(500, 60, true);
btnDate.TextSize = 15;
- btnDate.X = HdlControlResourse.XXLeft;
+ btnDate.X = ControlCommonResourse.XXLeft;
btnDate.Y = Application.GetRealHeight(35);
- btnDate.Text = HdlCommonLogic.Current.ConvertUtcTimeToLocalTime2(listGroup[0][0].CreateTime).ToString("MM" + strMonth + "dd" + strDate);
+ btnDate.Text = Convert.ToDateTime(listGroup[0][0].CreatedOnUtc).ToString("MM" + strMonth + "dd" + strDate);
frameDate.AddChidren(btnDate);
}
@@ -179,7 +179,7 @@
for (int j = 0; j < listData[i].listMsg.Count; j++)
{
//璁剧疆宸茶鐨勫垵濮嬪��
- listData[i].ListReading.Add(listData[i].IsRead);
+ listData[i].ListReading.Add(listData[i].IsReading);
//娣诲姞淇℃伅琛�
bool addLine = i != listData.Count - 1 || j != listData[i].listMsg.Count - 1;
this.AddMsgRowControl(framBack, listData[i], j, addLine);
@@ -229,7 +229,7 @@
/// </summary>
private void ShowBottomMenu()
{
- bool authority = HdlUserCenterResourse.ResidenceOption.AuthorityNo == 1 || HdlUserCenterResourse.ResidenceOption.AuthorityNo == 2;
+ bool authority = UserCenterResourse.UserInfo.AuthorityNo == 1 || UserCenterResourse.UserInfo.AuthorityNo == 2;
var menuContr = new BottomMenuSelectForm();
menuContr.AddForm(authority == true ? 2 : 1);
@@ -284,7 +284,7 @@
var btnTime = rowControl.frameTable.AddMostRightView("", 200, 50);
btnTime.TextColor = UserCenterColor.Current.TextGrayColor1;
btnTime.Y = btnMsg.Bottom + Application.GetRealHeight(12);
- var convertTime = HdlCommonLogic.Current.ConvertUtcTimeToLocalTime2(recordInfo.CreateTime);
+ var convertTime = UserCenterLogic.ConvertUtcTimeToLocalTime(recordInfo.CreatedOnUtc);
btnTime.Text = convertTime.ToString("HH锛歮m");
rowControl.frameTable.AddChidren(btnTime, ChidrenBindMode.BindEvent);
//搴曠嚎
@@ -316,7 +316,7 @@
}
//涓昏涓讳汉鍜岀鐞嗗憳鑳藉鍒犻櫎
- if (HdlUserCenterResourse.ResidenceOption.AuthorityNo == 1 || HdlUserCenterResourse.ResidenceOption.AuthorityNo == 2)
+ if (UserCenterResourse.UserInfo.AuthorityNo == 1 || UserCenterResourse.UserInfo.AuthorityNo == 2)
{
//鍒犻櫎
var btnDelete = rowControl.AddDeleteControl();
@@ -332,7 +332,7 @@
}
//鐐瑰嚮
- rowControl.frameTable.ButtonClickEvent += (sender, e) =>
+ rowControl.frameTable.ButtonClickEvent += async (sender, e) =>
{
if (recordInfo.ListReading[msgIndex] == true)
{
@@ -363,7 +363,11 @@
/// <param name="strId"></param>
private bool SetTickIsRead(string strId)
{
- return HdlMessageLogic.Current.SetTickIsRead(strId);
+ var pra = new MessageReadStatuPra();
+ pra.LoginAccessToken = UserCenterLogic.GetConnectMainToken();
+ pra.Id = strId;
+ var result = UserCenterLogic.GetResultStatuByRequestHttps("MessageCenter/TagMessageMessageCenterItem", true, pra);
+ return result;
}
/// <summary>
@@ -383,8 +387,10 @@
//鎵撳紑杩涘害鏉�
this.ShowProgressBar();
- var result = HdlMessageLogic.Current.SetAllTickIsRead();
-
+ var pra = new MessageReadStatuPra();
+ pra.LoginAccessToken = UserCenterLogic.GetConnectMainToken();
+ pra.TagAllOrClearType = 0;
+ var result = UserCenterLogic.GetResultStatuByRequestHttps("MessageCenter/TagAllOrClearMessageCenter", true, pra);
//鍏抽棴杩涘害鏉�
this.CloseProgressBar();
if (result == false)
@@ -416,7 +422,10 @@
/// <param name="rowContr"></param>
private bool DeleteMsg(string strId, FrameListControl frameList, RowLayoutControl rowContr)
{
- var result = HdlMessageLogic.Current.DeleteCloundMessage(strId);
+ var pra = new MessageReadStatuPra();
+ pra.LoginAccessToken = UserCenterLogic.GetConnectMainToken();
+ pra.Id = strId;
+ var result = UserCenterLogic.GetResultStatuByRequestHttps("MessageCenter/DelMessageCenterItem", true, pra);
if (result == false)
{
return false;
@@ -453,7 +462,10 @@
//鎵撳紑杩涘害鏉�
this.ShowProgressBar();
- var result = HdlMessageLogic.Current.DeleteAllCloundMessage();
+ var pra = new MessageReadStatuPra();
+ pra.LoginAccessToken = UserCenterLogic.GetConnectMainToken();
+ pra.TagAllOrClearType = 1;
+ var result = UserCenterLogic.GetResultStatuByRequestHttps("MessageCenter/TagAllOrClearMessageCenter", true, pra);
if (result == false)
{
//鍏抽棴杩涘害鏉�
@@ -543,30 +555,98 @@
private Dictionary<string, List<List<MessageRecordInfo>>> GetMessageData()
{
this.dicAllRow = new Dictionary<string, RowLayoutControl>();
+ var allListData = new List<MessageRecordInfo>();
+
+ var pra = new MessageInfoPra();
+ pra.LoginAccessToken = UserCenterLogic.GetConnectMainToken();
+
+ //浼犳劅鍣ㄤ笂鎶�
+ pra.Topic = "/IASInfoReport";
+ var dataInfo = this.GetMessageDataFromDb(pra);
+ if (dataInfo == null)
+ {
+ return null;
+ }
+ allListData.AddRange(dataInfo);
+
+ //闂ㄩ攣涓婃姤
+ pra.Topic = "/Alarms/SendAlarmInform";
+ dataInfo = this.GetMessageDataFromDb(pra);
+ if (dataInfo == null)
+ {
+ return null;
+ }
+ allListData.AddRange(dataInfo);
+
+ //鎾ら槻
+ pra.Topic = "/Security/WithdrawMode_Respon";
+ dataInfo = this.GetMessageDataFromDb(pra);
+ if (dataInfo == null)
+ {
+ return null;
+ }
+ allListData.AddRange(dataInfo);
+
+ //甯冮槻
+ pra.Topic = "/Security/EnableMode_Respon";
+ dataInfo = this.GetMessageDataFromDb(pra);
+ if (dataInfo == null)
+ {
+ return null;
+ }
+ allListData.AddRange(dataInfo);
+
+ //閫昏緫瑙﹀彂涓婃姤
+ pra.Topic = "/Logic/Execute_Respon";
+ dataInfo = this.GetMessageDataFromDb(pra);
+ if (dataInfo == null)
+ {
+ return null;
+ }
+ allListData.AddRange(dataInfo);
+
+ //鍦烘櫙瑙﹀彂涓婃姤
+ pra.Topic = "/Scene/Exec_Respon";
+ dataInfo = this.GetMessageDataFromDb(pra);
+ if (dataInfo == null)
+ {
+ return null;
+ }
+ allListData.AddRange(dataInfo);
+
+ //鍚堝苟鏁版嵁
+ return this.MergeMessageRecordData(allListData);
+ }
+
+ /// <summary>
+ /// 浠庝簯绔幏鍙栨暟鎹�
+ /// </summary>
+ /// <param name="pra"></param>
+ /// <returns></returns>
+ private List<MessageRecordInfo> GetMessageDataFromDb(MessageInfoPra pra)
+ {
+ var result = UserCenterLogic.GetResponseDataByRequestHttps("MessageCenter/GetMessageCenterPagger", true, pra);
+ if (string.IsNullOrEmpty(result) == true)
+ {
+ return null;
+ }
+ var dataInfo = Newtonsoft.Json.JsonConvert.DeserializeObject<MessageCentetInfo>(result);
var listData = new List<MessageRecordInfo>();
- var listMsg = HdlMessageLogic.Current.GetListMessageFromDb();
- if (listMsg == null)
- {
- return new Dictionary<string, List<List<MessageRecordInfo>>>();
- }
-
- for (int i = 0; i < listMsg.Count; i++)
+ for (int i = 0; i < dataInfo.PageData.Count; i++)
{
try
{
- var data = listMsg[i];
+ var data = dataInfo.PageData[i];
//澶勭悊娑堟伅绫诲瀷
- if (this.AdjustMsgContent(ref data) == true)
- {
- listData.Add(data);
- }
+ this.AdjustMsgContent(ref data);
+
+ listData.Add(data);
}
catch { continue; }
}
- //鍚堝苟鏁版嵁
- return this.MergeMessageRecordData(listData);
+ return listData;
}
/// <summary>
@@ -583,12 +663,12 @@
var listSortKeys = new List<string>();
foreach (var data in dataInfo)
{
- if (dicTemp.ContainsKey(data.CreateTime) == false)
+ if (dicTemp.ContainsKey(data.CreatedOnUtc) == false)
{
- dicTemp[data.CreateTime] = new List<MessageRecordInfo>();
- listSortKeys.Add(data.CreateTime);
+ dicTemp[data.CreatedOnUtc] = new List<MessageRecordInfo>();
+ listSortKeys.Add(data.CreatedOnUtc);
}
- dicTemp[data.CreateTime].Add(data);
+ dicTemp[data.CreatedOnUtc].Add(data);
}
listSortKeys.Sort();
@@ -598,30 +678,30 @@
var listData = dicTemp[listSortKeys[i]];
foreach (var data2 in listData)
{
- try
+ if (data2.Topic == "/DoorLock/DoorLockOperatingEventNotificationCommand")
{
- if (data2.MessageTitle == "/DoorLock/DoorLockOperatingEventNotificationCommand")
- {
- //鏆傛椂涓嶅鐞嗚繖涓富棰�
- continue;
- }
- string strDay = HdlCommonLogic.Current.ConvertUtcTimeToLocalTime2(data2.CreateTime).ToString("yyyy/MM/dd");
- //鎸夋瘡澶╁垎缁�
- if (dicData.ContainsKey(strDay) == false)
- {
- listGroup = new List<MessageRecordInfo>();
- dicData[strDay] = new List<List<MessageRecordInfo>>();
- dicData[strDay].Add(listGroup);
- }
- if (listGroup.Count > 20)
- {
- //姣�20涓竴缁�
- listGroup = new List<MessageRecordInfo>();
- dicData[strDay].Add(listGroup);
- }
- listGroup.Add(data2);
+ //鏆傛椂涓嶅鐞嗚繖涓富棰�
+ continue;
}
- catch { }
+ string[] myArry = data2.CreatedOnUtc.Split(new string[] { "T" }, StringSplitOptions.RemoveEmptyEntries);
+ if (myArry.Length != 2)
+ {
+ continue;
+ }
+ string dicKeys = myArry[0];//鏃ユ湡
+ if (dicData.ContainsKey(dicKeys) == false)
+ {
+ listGroup = new List<MessageRecordInfo>();
+ dicData[dicKeys] = new List<List<MessageRecordInfo>>();
+ dicData[dicKeys].Add(listGroup);
+ }
+ if (listGroup.Count > 20)
+ {
+ //姣�20涓竴缁�
+ listGroup = new List<MessageRecordInfo>();
+ dicData[dicKeys].Add(listGroup);
+ }
+ listGroup.Add(data2);
}
}
return dicData;
@@ -635,50 +715,39 @@
/// 澶勭悊娑堟伅绫诲瀷
/// </summary>
/// <param name="recordInfo">娑堟伅鏁版嵁</param>
- private bool AdjustMsgContent(ref MessageRecordInfo recordInfo)
+ private void AdjustMsgContent(ref MessageRecordInfo recordInfo)
{
+ var jobject = JObject.Parse(recordInfo.PayloadJson);
//浼犳劅鍣ㄤ笂鎶�
- if (recordInfo.MessageTitle == "/IASInfoReport")
+ if (recordInfo.Topic == "/IASInfoReport")
{
- var jobject = JObject.Parse(recordInfo.MessageExpand);
this.SensorDeviceReportPush(jobject, ref recordInfo);
}
//闂ㄩ攣涓婃姤
- else if (recordInfo.MessageTitle == "/Alarms/SendAlarmInform")
+ else if (recordInfo.Topic == "/Alarms/SendAlarmInform")
{
- var jobject = JObject.Parse(recordInfo.MessageExpand);
this.DoorLockDeviceReportPush(jobject, ref recordInfo);
}
//鎾ら槻
- else if (recordInfo.MessageTitle == "/Security/WithdrawMode_Respon")
+ else if (recordInfo.Topic == "/Security/WithdrawMode_Respon")
{
- var jobject = JObject.Parse(recordInfo.MessageExpand);
this.RemoveSafetyGarrisonPush(jobject, ref recordInfo);
}
//甯冮槻
- else if (recordInfo.MessageTitle == "/Security/EnableMode_Respon")
+ else if (recordInfo.Topic == "/Security/EnableMode_Respon")
{
- var jobject = JObject.Parse(recordInfo.MessageExpand);
this.SetSafetyGarrisonPush(jobject, ref recordInfo);
}
//閫昏緫瑙﹀彂涓婃姤
- else if (recordInfo.MessageTitle == "/Logic/Execute_Respon")
+ else if (recordInfo.Topic == "/Logic/Execute_Respon")
{
- var jobject = JObject.Parse(recordInfo.MessageExpand);
this.LogicExecutePush(jobject, ref recordInfo);
}
//鍦烘櫙瑙﹀彂涓婃姤
- else if (recordInfo.MessageTitle == "/Scene/Exec_Respon")
+ else if (recordInfo.Topic == "/Scene/Exec_Respon")
{
- var jobject = JObject.Parse(recordInfo.MessageExpand);
this.SceneExecPush(jobject, ref recordInfo);
}
- else
- {
- //涓嶅鐞嗙殑涓婚
- return false;
- }
- return true;
}
#endregion
@@ -694,22 +763,22 @@
var ias = new IASZone() { DeviceAddr = receiveData.Value<string>("DeviceAddr"), DeviceEpoint = receiveData.Value<int>("Epoint") };
ias.iASInfo = Newtonsoft.Json.JsonConvert.DeserializeObject<IASZone.IASInfoData>(receiveData["Data"].ToString());
//鍥炬爣
- var localDevice = HdlDeviceCommonLogic.Current.GetDevice(ias.DeviceAddr, ias.DeviceEpoint);
+ var localDevice = Common.LocalDevice.Current.GetDevice(ias.DeviceAddr, ias.DeviceEpoint);
if (localDevice == null)
{
recordInfo.IconPath = "Device/Sensor.png";
//娑堟伅绫诲瀷:浼犳劅鍣�
- var infoContent = HdlDeviceCommonLogic.Current.GetDeviceModelIdNameInfo("A402");
+ var infoContent = Common.LocalDevice.Current.GetDeviceModelIdNameInfo("A402");
recordInfo.MsgObjectText = infoContent != null ? infoContent.A瀹樻柟鍚嶅瓧 : string.Empty;
}
else
{
string selectPath = string.Empty;
string unselecPath = string.Empty;
- HdlDeviceCommonLogic.Current.GetDeviceIcon(localDevice, ref unselecPath, ref selectPath);
+ Common.LocalDevice.Current.GetDeviceIcon(localDevice, ref unselecPath, ref selectPath);
recordInfo.IconPath = unselecPath;
//娑堟伅绫诲瀷
- recordInfo.MsgObjectText = HdlDeviceCommonLogic.Current.GetDeviceEpointName(localDevice);
+ recordInfo.MsgObjectText = Common.LocalDevice.Current.GetDeviceEpointName(localDevice);
}
//娑堟伅
@@ -753,22 +822,22 @@
private void DoorLockDeviceReportPush(JObject receiveData, ref MessageRecordInfo recordInfo)
{
//鍥炬爣
- var device = HdlDeviceCommonLogic.Current.GetDevice(receiveData.Value<string>("DeviceAddr"), receiveData.Value<int>("Epoint"));
+ var device = Common.LocalDevice.Current.GetDevice(receiveData.Value<string>("DeviceAddr"), receiveData.Value<int>("Epoint"));
if (device == null)
{
recordInfo.IconPath = "Device/IntelligentLocks.png";
//娑堟伅绫诲瀷:鏅鸿兘闂ㄩ攣
- var infoContent = HdlDeviceCommonLogic.Current.GetDeviceModelIdNameInfo("A405");
+ var infoContent = Common.LocalDevice.Current.GetDeviceModelIdNameInfo("A405");
recordInfo.MsgObjectText = infoContent != null ? infoContent.A瀹樻柟鍚嶅瓧 : string.Empty;
}
else
{
string selectPath = string.Empty;
string unselecPath = string.Empty;
- HdlDeviceCommonLogic.Current.GetDeviceIcon(device, ref unselecPath, ref selectPath);
+ Common.LocalDevice.Current.GetDeviceIcon(device, ref unselecPath, ref selectPath);
recordInfo.IconPath = unselecPath;
//娑堟伅绫诲瀷
- recordInfo.MsgObjectText = HdlDeviceCommonLogic.Current.GetDeviceEpointName(device);
+ recordInfo.MsgObjectText = Common.LocalDevice.Current.GetDeviceEpointName(device);
}
//娑堟伅
var msgInfo = HdlAlarmsLogic.Current.GetDoorLockAlarmInfo(receiveData);
--
Gitblit v1.8.0