From bff8993501334c4f3c5f902216fe03253be747f8 Mon Sep 17 00:00:00 2001
From: xm <1271024303@qq.com>
Date: 星期三, 15 四月 2020 16:59:01 +0800
Subject: [PATCH] 合并新代码
---
ZigbeeApp20200414/Shared/Phone/UserCenter/Device/DoorLock/DoorLockHistoryLogForm.cs | 498 +++++++++++++++++++++++++++++++++++++------------------
1 files changed, 333 insertions(+), 165 deletions(-)
diff --git a/ZigbeeApp20200414/Shared/Phone/UserCenter/Device/DoorLock/DoorLockHistoryLogForm.cs b/ZigbeeApp20200414/Shared/Phone/UserCenter/Device/DoorLock/DoorLockHistoryLogForm.cs
index c309fd3..082f117 100755
--- a/ZigbeeApp20200414/Shared/Phone/UserCenter/Device/DoorLock/DoorLockHistoryLogForm.cs
+++ b/ZigbeeApp20200414/Shared/Phone/UserCenter/Device/DoorLock/DoorLockHistoryLogForm.cs
@@ -34,13 +34,17 @@
/// </summary>
private CommonDevice DeviceDoor = null;
/// <summary>
- /// 妫�绱㈠璞$殑ID(-1:鎵�鏈� 绌哄瓧绗︿覆:鍏朵粬)
+ /// 妫�绱㈠璞$殑ID(-1:鎵�鏈� -9999:鍏朵粬)
/// </summary>
private List<string> listSearchUserId = new List<string>() { "-1" };
/// <summary>
- /// 妫�绱㈠紑閿佹柟寮忕殑ID(-1:鎵�鏈� 0:瀵嗙爜 15:鎸囩汗 3:IC鍗�)
+ /// 妫�绱㈠紑閿佹柟寮忕殑ID(-1:鎵�鏈� 0:瀵嗙爜 15:鎸囩汗 3:IC鍗� 9000:甯稿紑妯″紡(鑷畾涔夌殑))
/// </summary>
private List<int> listSearchLockId = new List<int>() { -1 };
+ /// <summary>
+ /// 鑾峰彇鍒扮殑鍘嗗彶璁板綍
+ /// </summary>
+ private List<HistoryInfo> listHistoryInfo = null;
/// <summary>
/// 鍏朵粬娑堟伅鐨勪富閿�,瀹冨瓨鍦ㄥ彟澶栫殑涓�寮犳暟鎹簱琛ㄤ腑
/// </summary>
@@ -109,7 +113,7 @@
this.InitTitleSearchControl();
//鍒濆鍖栬褰曞垪琛�
- this.InitLogListInfo();
+ this.InitLogListInfo(true);
}
/// <summary>
@@ -134,37 +138,38 @@
dateFromControl.DateSelectEvent += (dateValue) =>
{
//鍒濆鍖栬褰曞垪琛�
- this.InitLogListInfo();
+ this.InitLogListInfo(true);
};
var btnTemp = new NormalViewControl(26, 58, true);
btnTemp.Y = Application.GetRealHeight(29);
- btnTemp.X = Application.GetRealWidth(357);
+ btnTemp.X = dateFromControl.Right + Application.GetRealWidth(12);
btnTemp.TextColor = UserCenterColor.Current.TextGrayColor1;
btnTemp.Text = "-";
frameTitle.AddChidren(btnTemp, ChidrenBindMode.NotBind);
dateToControl = new DateSelectControl(Language.StringByID(R.MyInternationalizationString.uEndDate));
dateToControl.Y = Application.GetRealHeight(35);
- dateToControl.X = Application.GetRealWidth(395);
+ dateToControl.X = btnTemp.Right + Application.GetRealWidth(12);
dateToControl.dateValue = DateTime.Now.ToString("yyyyMMdd");
frameTitle.AddChidren(dateToControl, ChidrenBindMode.NotBind);
dateToControl.DateSelectEvent += (dateValue) =>
{
//鍒濆鍖栬褰曞垪琛�
- this.InitLogListInfo();
+ this.InitLogListInfo(true);
};
//绫诲瀷绛涢��
var btnScreening = frameTitle.AddMostRightView(Language.StringByID(R.MyInternationalizationString.uScreeningType), 145);
- frameTitle.ChangedChidrenBindMode(btnScreening, ChidrenBindMode.NotBind);
btnScreening.TextSize = 12;
-
+ btnScreening.Width = btnScreening.GetRealWidthByText();
+ btnScreening.X = frameTitle.Width - Application.GetRealWidth(58) - btnScreening.Width;
btnScreening.ButtonClickEvent += (sender, e) =>
{
//鏄剧ず绫诲瀷绛涢�夌晫闈�
this.ShowDoorLockScreeningTypeForm();
};
+ frameTitle.ChangedChidrenBindMode(btnScreening, ChidrenBindMode.NotBind);
//绫诲瀷绛涢�夌殑鍥炬爣
var btnScreeningIcon = new IconViewControl(69);
btnScreeningIcon.X = btnScreening.X - Application.GetRealWidth(12) - btnScreeningIcon.IconSize;
@@ -188,7 +193,7 @@
listView.BeginHeaderRefreshingAction += () =>
{
//涓嬫媺鍒锋柊
- this.InitLogListInfo();
+ this.InitLogListInfo(true);
};
}
@@ -199,7 +204,8 @@
/// <summary>
/// 鍒濆鍖栬褰曞垪琛�
/// </summary>
- private void InitLogListInfo()
+ /// <param name="reReadData">鏄惁浠庢柊浠庝簯绔鍙栨暟鎹�</param>
+ private void InitLogListInfo(bool reReadData)
{
this.listView.frameTable.RemoveAll();
listView.frameTable.Height = bodyFrameLayout.Height - Application.GetRealHeight(115 - 3);
@@ -211,6 +217,12 @@
this.ShowMassage(ShowMsgType.Tip, Language.StringByID(R.MyInternationalizationString.uFromTimeIsOverToTime));
return;
}
+ if (reReadData == true)
+ {
+ //缃┖鍚�,閲嶆柊鑾峰彇
+ this.listHistoryInfo = null;
+ }
+
HdlThreadLogic.Current.RunThread(async () =>
{
//鎵撳紑杩涘害鏉�
@@ -223,8 +235,14 @@
this.CloseProgressBar(ShowReLoadMode.YES);
return;
}
+ //鎴愬憳淇℃伅
+ var dicMemberName = new Dictionary<string, string>();
+ for (int i = 0; i < listMenberInfo.Count; i++)
+ {
+ dicMemberName.Add(listMenberInfo[i].SubAccountDistributedMark, string.IsNullOrEmpty(listMenberInfo[i].UserName) == false ? listMenberInfo[i].UserName : listMenberInfo[i].Account);
+ }
//鍘嗗彶璁板綍
- var historyLog = await this.GetHistoryLogInfo();
+ var historyLog = await this.GetHistoryLogInfo(dicMemberName);
if (historyLog == null)
{
//鍏抽棴杩涘害鏉�
@@ -234,17 +252,12 @@
//鍏抽棴杩涘害鏉�
this.CloseProgressBar();
- var dic = new Dictionary<string, string>();
- for (int i = 0; i < listMenberInfo.Count; i++)
- {
- dic.Add(listMenberInfo[i].SubAccountDistributedMark, string.IsNullOrEmpty(listMenberInfo[i].UserName) == false ? listMenberInfo[i].UserName : listMenberInfo[i].Account);
- }
HdlThreadLogic.Current.RunMain(() =>
{
for (int i = 0; i < historyLog.Count; i++)
{
//娣诲姞璁板綍琛�
- this.AddLogInfoRow(historyLog[i], dic, i != historyLog.Count - 1);
+ this.AddLogInfoRow(historyLog[i], dicMemberName, i != historyLog.Count - 1);
}
//闅愯棌涓嬫媺鍒锋柊鐗规晥
listView.EndHeaderRefreshing();
@@ -322,9 +335,33 @@
this.listView.AddChidrenFrame2(frameTable);
//鍥炬爣
var btnIcon = frameTable.AddLeftIcon();
+ //淇℃伅
+ var btnMsg = frameTable.AddTopView("", 600);
+ //浜虹墿
+ string perName = dicName.ContainsKey(historyInfo.CloudAccountId) == true ? dicName[historyInfo.CloudAccountId] : Language.StringByID(R.MyInternationalizationString.uOther);
+ frameTable.AddBottomView(perName, 600);
+ //鏃堕棿
+ if (this.dateFromControl.dateValue == this.dateToControl.dateValue)
+ {
+ //濡傛灉鏃ユ湡鑼冨洿涓�鏍�,鍒欎笉鏄剧ず骞存湀鏃�
+ frameTable.AddMostRightView(UserCenterLogic.ConvertUtcTimeToLocalTime(historyInfo.UnlockTime).ToString("HH:mm:ss"), 400);
+ }
+ else
+ {
+ //濡傛灉鏃ユ湡鑼冨洿涓嶄竴鏍�,鍒欐樉绀哄勾鏈堟棩
+ frameTable.AddMostRightView(UserCenterLogic.ConvertUtcTimeToLocalTime(historyInfo.UnlockTime).ToString("yyyy/MM/dd HH:mm:ss"), 700);
+ }
+ //搴曠嚎
+ if (addLine == true)
+ {
+
+ frameTable.AddBottomLine();
+ }
+
+ //鍏朵粬娑堟伅
if (historyInfo.OpenLockMode == -1)
{
- //鍏朵粬娑堟伅
+ //鍥剧墖
var device = Common.LocalDevice.Current.GetDevice(historyInfo.DeviceMac, historyInfo.DeviceEpoint);
if (device == null)
{
@@ -334,25 +371,42 @@
{
Common.LocalDevice.Current.SetDeviceIconToControl(btnIcon, device);
}
- }
- else if (historyInfo.UnlockIsSuccess == true)
- {
- btnIcon.UnSelectedImagePath = "Item/UnLockSuccess.png";
- }
- else
- {
- btnIcon.UnSelectedImagePath = "Item/UnLockFail.png";
- }
-
- //淇℃伅
- var btnMsg = frameTable.AddTopView("", 600);
- if (historyInfo.OpenLockMode == -1)
- {
- //鍏朵粬娑堟伅
+ //娑堟伅
btnMsg.Text = historyInfo.AlarmMsg;
}
+ //闂ㄩ攣甯稿紑妯″紡
+ else if (historyInfo.OpenLockMode == 9000)
+ {
+ //鍥剧墖
+ btnIcon.UnSelectedImagePath = "Item/NormallyOpen.png";
+ //娑堟伅
+ if (historyInfo.OtherOpenLockMode == 9001)
+ {
+ //甯稿紑妯″紡鎵嬪姩寮�鍚�
+ btnMsg.TextID = R.MyInternationalizationString.uNormallyOpenModeManualOpen;
+ }
+ else if (historyInfo.OtherOpenLockMode == 9002)
+ {
+ //甯稿紑妯″紡鎵嬪姩鍙栨秷
+ btnMsg.TextID = R.MyInternationalizationString.uNormallyOpenModeManualClose;
+ }
+ else if (historyInfo.OtherOpenLockMode == 9003)
+ {
+ //甯稿紑妯″紡鍚敤{0}灏忔椂
+ btnMsg.Text = Language.StringByID(R.MyInternationalizationString.uNormallyOpenModeOpenSomeTime).Replace("{0}", historyInfo.NormallyOpenContinuedTime);
+ }
+ else
+ {
+ //涓婇潰鏄疉pp鎵嬪姩鎺ㄩ��,杩欓噷鏄綉鍏虫垨鑰呴棬閿佽嚜宸辨帹閫�
+ btnMsg.Text = historyInfo.AlarmMsg;
+ }
+ }
+ //寮�閿佹垚鍔�
else if (historyInfo.UnlockIsSuccess == true)
{
+ //鍥剧墖
+ btnIcon.UnSelectedImagePath = "Item/UnLockSuccess.png";
+ //娑堟伅
if (historyInfo.OpenLockMode == 0)
{
//瀵嗙爜寮�閿佹垚鍔�
@@ -369,8 +423,12 @@
btnMsg.TextID = R.MyInternationalizationString.uUnlockByFingerPrintSuccess;
}
}
+ //寮�閿佸け璐�
else
{
+ //鍥剧墖
+ btnIcon.UnSelectedImagePath = "Item/UnLockFail.png";
+ //娑堟伅
if (historyInfo.OpenLockMode == 0)
{
//瀵嗙爜寮�閿佸け璐�
@@ -386,28 +444,6 @@
//鎸囩汗寮�閿佸け璐�
btnMsg.TextID = R.MyInternationalizationString.uUnlockByFingerPrintFail;
}
- }
-
- //浜虹墿
- string perName = dicName.ContainsKey(historyInfo.CloudAccountId) == true ? dicName[historyInfo.CloudAccountId] : Language.StringByID(R.MyInternationalizationString.uOther);
- frameTable.AddBottomView(perName, 600);
-
- //鏃堕棿
- if (this.dateFromControl.dateValue == this.dateToControl.dateValue)
- {
- //濡傛灉鏃ユ湡鑼冨洿涓�鏍�,鍒欎笉鏄剧ず骞存湀鏃�
- frameTable.AddMostRightView(UserCenterLogic.ConvertUtcTimeToLocalTime(historyInfo.UnlockTime).ToString("HH:mm:ss"), 400);
- }
- else
- {
- //濡傛灉鏃ユ湡鑼冨洿涓嶄竴鏍�,鍒欐樉绀哄勾鏈堟棩
- frameTable.AddMostRightView(UserCenterLogic.ConvertUtcTimeToLocalTime(historyInfo.UnlockTime).ToString("yyyy/MM/dd HH:mm:ss"), 700);
- }
-
- if (addLine == true)
- {
- //搴曠嚎
- frameTable.AddBottomLine();
}
}
@@ -435,8 +471,112 @@
listSearchLockId.Clear();
listSearchLockId.AddRange(selectLock);
//鍒濆鍖栬褰曞垪琛�
- this.InitLogListInfo();
+ this.InitLogListInfo(false);
};
+ }
+
+ #endregion
+
+ #region 鈻� 绛涢�夎褰昣__________________________
+
+ /// <summary>
+ /// 绛涢�夊巻鍙茶褰�
+ /// </summary>
+ /// <returns></returns>
+ private List<HistoryInfo> ScreeningHistoryData(Dictionary<string, string> dicMemberName)
+ {
+ //鍘嗗彶璁板綍澶夯鐑︿簡,瀛樺湪涓嶅悓鐨勬暟鎹簱琛ㄩ噷,骞朵笖鏁版嵁杩樹笉涓�鏍�,鍙兘杩欐牱涓�涓釜鍒ゆ柇浜�
+ var listScreeningData = new List<HistoryInfo>();
+ //娓呴櫎鎺変箣鍓嶇殑璁板綍
+ this.listOtherUserId = new List<string>();
+ this.listOtherMsgId = new List<string>();
+
+ //鏄惁閫夋嫨鍏ㄩ�夌敤鎴�
+ bool selectAllUser = this.listSearchUserId.Contains("-1");
+ //鏄惁鍗曢�変簡鍏朵粬
+ bool selectOtherUser = this.listSearchUserId.Contains("-9999");
+ //鏄惁閫夋嫨鍏ㄩ�夊紑閿佹柟寮�
+ bool selectAllLockMode = this.listSearchLockId.Contains(-1);
+
+ //涓�涓釜鍘婚亶鍘�
+ foreach (var data in this.listHistoryInfo)
+ {
+ //妫�娴嬭鍘嗗彶璁板綍鑳藉惁鏄剧ず
+ bool result = this.CheckHistoryDataCanShow(data, dicMemberName, selectAllUser, selectOtherUser, selectAllLockMode);
+ if (result == true)
+ {
+ listScreeningData.Add(data);
+ }
+ }
+
+ return listScreeningData;
+ }
+
+ /// <summary>
+ /// 妫�娴嬭鍘嗗彶璁板綍鑳藉惁鏄剧ず
+ /// </summary>
+ /// <param name="info">妫�娴嬪璞�</param>
+ /// <param name="dicMemberName">鎴愬憳淇℃伅</param>
+ /// <param name="selectAllUser">鏄惁閫夋嫨鍏ㄩ�夌敤鎴�</param>
+ /// <param name="selectOtherUser">鏄惁鍗曢�変簡鍏朵粬</param>
+ /// <param name="slectAllLockMode">鏄惁閫夋嫨鍏ㄩ�夊紑閿佹柟寮�</param>
+ private bool CheckHistoryDataCanShow(HistoryInfo info, Dictionary<string, string> dicMemberName,
+ bool selectAllUser, bool selectOtherUser, bool slectAllLockMode)
+ {
+ //濡傛灉娌℃湁閫夋嫨 鍏ㄩ�夌敤鎴�
+ if (selectAllUser == false)
+ {
+ //濡傛灉杩欎釜鐢ㄦ埛ID涓嶅寘鍚湪鎸囧畾閫夋嫨鐨勬垚鍛樺垪琛ㄩ噷闈�
+ if (this.listSearchUserId.Contains(info.CloudAccountId) == false)
+ {
+ if (dicMemberName.ContainsKey(info.CloudAccountId) == true)
+ {
+ //濡傛灉鑳藉璇嗗埆杩欎釜id鐨勮瘽,鍒欒〃绀哄畠涓嶅睘浜庡叾浠栫被,骞朵笖涔熶笉鍐嶉�夋嫨鐩爣鍐�
+ return false;
+ }
+ //濡傛灉娌℃湁閫夋嫨 鍏朵粬鐨勮瘽,涓嶆樉绀�
+ if (selectOtherUser == false)
+ {
+ return false;
+ }
+ }
+ }
+ //濡傛灉鏄垚鍛樿韩浠�,骞朵笖鐢ㄦ埛ID涓嶄负绌�
+ if (UserCenterResourse.UserInfo.AuthorityNo == 3 && info.CloudAccountId != string.Empty)
+ {
+ //鎴愬憳涓嶈兘鐪嬪埌 鍏朵粬浜虹殑璁板綍(鎴愬憳鐨勬椂鍊�,杩欎釜鍙橀噺閲岄潰鍙湁浠栬嚜宸变竴涓�)
+ if (dicMemberName.ContainsKey(info.CloudAccountId) == false)
+ {
+ return false;
+ }
+ }
+ //濡傛灉娌℃湁閫夋嫨 鍏ㄩ�夊紑閿佹柟寮�
+ if (slectAllLockMode == false)
+ {
+ //濡傛灉杩欎釜寮�閿佹柟寮忎笉鍦ㄩ�夋嫨鐨勫垪琛ㄩ噷闈㈢殑璇�
+ if (this.listSearchLockId.Contains(info.OpenLockMode) == false)
+ {
+ return false;
+ }
+ }
+
+ //鍙︿竴寮犺〃鐨勬暟鎹富閿�
+ if (info.OpenLockMode == -1 || info.OpenLockMode == 9000)
+ {
+ if (info.MsgKeyId != string.Empty)
+ {
+ //鍏朵粬娑堟伅鐨勪富閿�,瀹冨瓨鍦ㄥ彟澶栫殑涓�寮犳暟鎹簱琛ㄤ腑
+ this.listOtherMsgId.Add(info.MsgKeyId);
+ }
+ }
+ if (info.CloudAccountId != string.Empty && dicMemberName.ContainsKey(info.CloudAccountId) == false
+ && this.listOtherUserId.Contains(info.CloudAccountId) == false)
+ {
+ //鏃犳硶璇嗗埆鐨勫紑閿佽褰曠殑鐢ㄦ埛ID(鍥犱负閭d釜瀵嗙爜鏈夊彲鑳芥病鏈夊垎閰嶇粰鎴愬憳)
+ this.listOtherUserId.Add(info.CloudAccountId);
+ }
+
+ return true;
}
#endregion
@@ -447,24 +587,18 @@
/// 鑾峰彇鍘嗗彶璁板綍
/// </summary>
/// <returns></returns>
- private async Task<List<HistoryInfo>> GetHistoryLogInfo()
+ private async Task<List<HistoryInfo>> GetHistoryLogInfo(Dictionary<string, string> dicMemberName)
{
- //鑾峰彇璁块棶浜戠鎺ュ彛鐨勫惎鍔ㄥ弬鏁�
- var pra = this.GetDbInterfacePra();
-
- //娓呯┖涓婁竴娆$殑鍏朵粬ID
- this.listOtherMsgId = new List<string>();
- this.listOtherUserId = new List<string>();
-
- //鍏ㄩ儴鎴愬憳淇℃伅
- var dicMemberName = new Dictionary<string, string>();
- for (int i = 0; i < listMenberInfo.Count; i++)
+ if (this.listHistoryInfo != null)
{
- dicMemberName.Add(listMenberInfo[i].SubAccountDistributedMark, string.IsNullOrEmpty(listMenberInfo[i].UserName) == false ? listMenberInfo[i].UserName : listMenberInfo[i].Account);
+ //涓嶄簩娆¤幏鍙�,涓昏閽堝鐨勬槸绛涢�夊姛鑳�
+ return this.ScreeningHistoryData(dicMemberName);
}
+ //鑾峰彇璁块棶浜戠鎺ュ彛鐨勫惎鍔ㄥ弬鏁�
+ var pra = this.GetReadHistoryPra();
//鑾峰彇闂ㄩ攣鐨勬墦寮�鍜屽叧闂褰�
- var listAllLog = await this.GetDoorOpenHistoryLog(pra, dicMemberName);
+ var listAllLog = await this.GetDoorOpenHistoryLog(pra);
//鑾峰彇闂ㄩ攣鐨勫叾浠栬褰�
var listOtherLog = await this.GetDoorOtherHistoryLog(pra.UnlockTimeBegin, pra.UnlockTimeEnd);
listAllLog.AddRange(listOtherLog);
@@ -472,19 +606,9 @@
//鎺掑簭涓�涓�
var dicAllData = new Dictionary<string, List<HistoryInfo>>();
var listSortTime = new List<string>();
- //鏄惁鍖呭惈鍏朵粬
- bool getOtherFlage = this.listSearchUserId.Contains("");
+
foreach (var data in listAllLog)
{
- //濡傛灉鍗曠嫭鎸囧畾鏈夎璐﹀彿,鍙互鏄剧ず
- if (this.listSearchUserId.Contains(data.CloudAccountId) == false)
- {
- //濡傛灉杩欎釜璐﹀彿娌℃湁鎸囧畾,骞朵笖鎸囧畾鏄剧ず鍏朵粬鐨勮瘽,骞朵笖鏃犳硶璇嗗埆杩欎釜鐢ㄦ埛ID鎵嶆樉绀�
- if (getOtherFlage == true && dicMemberName.ContainsKey(data.CloudAccountId) == true)
- {
- continue;
- }
- }
//鎸夋椂闂村垎缁�
if (dicAllData.ContainsKey(data.UnlockTime) == false)
{
@@ -496,13 +620,13 @@
//鎵ц鎺掑簭,鏃堕棿澶х殑鍦ㄥ墠闈�
listSortTime.Sort();
- var listSortLog = new List<HistoryInfo>();
+ this.listHistoryInfo = new List<HistoryInfo>();
for (int i = listSortTime.Count - 1; i >= 0; i--)
{
- listSortLog.AddRange(dicAllData[listSortTime[i]]);
+ this.listHistoryInfo.AddRange(dicAllData[listSortTime[i]]);
}
-
- return listSortLog;
+ //绛涢�夊巻鍙茶褰�
+ return this.ScreeningHistoryData(dicMemberName);
}
/// <summary>
@@ -510,7 +634,7 @@
/// </summary>
/// <param name="i_pra"></param>
/// <returns></returns>
- private async Task<List<HistoryInfo>> GetDoorOpenHistoryLog(GetHistoryDataPra i_pra, Dictionary<string, string> dicMemberName)
+ private async Task<List<HistoryInfo>> GetDoorOpenHistoryLog(GetHistoryDataPra i_pra)
{
var listLog = new List<HistoryInfo>();
@@ -524,16 +648,7 @@
return null;
}
var dataInfo = Newtonsoft.Json.JsonConvert.DeserializeObject<GetHistoryDataResult>(result);
- foreach (var data in dataInfo.PageData)
- {
- if (dicMemberName.ContainsKey(data.CloudAccountId) == false
- && this.listOtherUserId.Contains(data.CloudAccountId) == false)
- {
- //鏀堕泦鏃犳硶璇嗗埆鐨勭敤鎴稩D
- this.listOtherUserId.Add(data.CloudAccountId);
- }
- listLog.Add(data);
- }
+ listLog.AddRange(dataInfo.PageData);
if (dataInfo.HasNextPage == false)
{
@@ -555,47 +670,47 @@
{
var listLog = new List<HistoryInfo>();
- //鏄惁鍖呭惈鍏朵粬
- bool getOtherFlage = this.listSearchUserId.Contains("") || this.listSearchUserId.Contains("-1");
- if (getOtherFlage == true)
+ //鍘昏幏鍙栧叾浠栦俊鎭�
+ var pra2 = new MessageInfoPra();
+ pra2.BeginTime = beginTime;
+ pra2.EndTime = endTime;
+ pra2.Topic = "/Alarms/SendAlarmInform";
+ pra2.LoginAccessToken = UserCenterLogic.GetConnectMainToken();
+ var result = await UserCenterLogic.GetResponseDataByRequestHttps("MessageCenter/GetMessageCenterPagger", true, pra2);
+ if (result == null)
{
- //鍘昏幏鍙栧叾浠栦俊鎭�
- var pra2 = new MessageInfoPra();
- pra2.BeginTime = beginTime;
- pra2.EndTime = endTime;
- pra2.Topic = "/Alarms/SendAlarmInform";
- pra2.LoginAccessToken = UserCenterLogic.GetConnectMainToken();
- var result = await UserCenterLogic.GetResponseDataByRequestHttps("MessageCenter/GetMessageCenterPagger", true, pra2);
- if (result == null)
+ return null;
+ }
+ var dataInfo2 = Newtonsoft.Json.JsonConvert.DeserializeObject<MessageCentetInfo>(result);
+ string doorKey = this.DeviceDoor.DeviceAddr + "_" + this.DeviceDoor.DeviceEpoint;
+ foreach (var myInfo in dataInfo2.PageData)
+ {
+ //璁惧瀵硅薄
+ var jobject = Newtonsoft.Json.Linq.JObject.Parse(myInfo.PayloadJson);
+ string deviceAddr = jobject.Value<string>("DeviceAddr");
+ int deviceEpoint = jobject.Value<int>("Epoint");
+ if (doorKey != deviceAddr + "_" + deviceEpoint)
{
- return null;
+ //涓嶆槸鍚屼竴涓棬閿佺殑璁板綍
+ continue;
}
- var dataInfo2 = Newtonsoft.Json.JsonConvert.DeserializeObject<MessageCentetInfo>(result);
- string doorKey = this.DeviceDoor.DeviceAddr + "_" + this.DeviceDoor.DeviceEpoint;
- foreach (var myInfo in dataInfo2.PageData)
+
+ var data = new HistoryInfo();
+ data.DeviceMac = deviceAddr;
+ data.DeviceEpoint = deviceEpoint;
+ //娑堟伅
+ var msgInfo = HdlAlarmsLogic.Current.GetDoorLockAlarmInfo(jobject);
+ data.AlarmMsg = msgInfo != null ? msgInfo.AlarmMsg : Language.StringByID(R.MyInternationalizationString.uDoorLocksAlarmHadTriggered);
+ //鏃堕棿
+ data.UnlockTime = myInfo.CreatedOnUtc;
+ //涓婚敭
+ data.MsgKeyId = myInfo.Id;
+ //娑堟伅鍖哄垎
+ if (msgInfo.MsgDiv == 9000)
{
- //璁惧瀵硅薄
- var jobject = Newtonsoft.Json.Linq.JObject.Parse(myInfo.PayloadJson);
- string deviceAddr = jobject.Value<string>("DeviceAddr");
- int deviceEpoint = jobject.Value<int>("Epoint");
- if (doorKey != deviceAddr + "_" + deviceEpoint)
- {
- //涓嶆槸鍚屼竴涓棬閿佺殑璁板綍
- continue;
- }
-
- var data = new HistoryInfo();
- data.DeviceMac = deviceAddr;
- data.DeviceEpoint = deviceEpoint;
- //娑堟伅
- var msgInfo = HdlAlarmsLogic.Current.GetDoorLockAlarmInfo(jobject);
- data.AlarmMsg = msgInfo != null ? msgInfo.AlarmMsg : Language.StringByID(R.MyInternationalizationString.uDoorLocksAlarmHadTriggered);
- //鏃堕棿
- data.UnlockTime = myInfo.CreatedOnUtc;
-
- listLog.Add(data);
- this.listOtherMsgId.Add(myInfo.Id);
+ data.OpenLockMode = 9000;
}
+ listLog.Add(data);
}
return listLog;
@@ -611,28 +726,10 @@
private async void ClearAllHistoryLog()
{
//鑾峰彇璁块棶浜戠鎺ュ彛鐨勫惎鍔ㄥ弬鏁�
- var pra = this.GetDbInterfacePra();
- if (listSearchUserId.Contains("") == true)
- {
- //濡傛灉鎸囧畾鏈夊叾浠�,鍒欑敤鎴稩D閲嶆柊璁剧疆
- pra.CloudAccountIdArr = new List<string>();
- pra.CloudAccountIdArr.AddRange(listSearchUserId);
- pra.CloudAccountIdArr.Remove("");
- if (this.listOtherUserId.Count > 0)
- {
- pra.CloudAccountIdArr.AddRange(listOtherUserId);
- }
- else
- {
- //杩欎竴姝ュ緢閲嶈,涓嶇劧鏈夊彲鑳藉崟鐙�夋嫨鍏朵粬鐨勬椂鍊�
- //鍦ㄦ病鏈夋暟鎹殑鎯呭喌涓�,浼氭竻绌烘帀鍏ㄩ儴鐨勬暟鎹�
- pra.CloudAccountIdArr.Add("other");
- }
- }
+ var pra = this.GetDeleteDataPra();
//鎵撳紑杩涘害鏉�
this.ShowProgressBar();
-
var result = await UserCenterLogic.GetResultStatuByRequestHttps("DoorLock/ClearDoorLockHistory", true, pra);
if (result == false)
{
@@ -663,6 +760,9 @@
//娓呯┖
this.listOtherMsgId = new List<string>();
+ this.listOtherUserId = new List<string>();
+ this.listHistoryInfo = null;
+
HdlThreadLogic.Current.RunMain(() =>
{
this.listView.frameTable.RemoveAll();
@@ -678,24 +778,41 @@
/// 鑾峰彇璁块棶浜戠鎺ュ彛鐨勫惎鍔ㄥ弬鏁�
/// </summary>
/// <returns></returns>
- private GetHistoryDataPra GetDbInterfacePra()
+ private GetHistoryDataPra GetReadHistoryPra()
+ {
+ DateTime dateFrom = new DateTime(dateFromControl.Year, dateFromControl.Month, dateFromControl.Day, 0, 0, 0);
+ DateTime dateTo = new DateTime(dateToControl.Year, dateToControl.Month, dateToControl.Day, 23, 59, 59);
+
+ //鍏ㄩ儴璇诲彇
+ var pra = new GetHistoryDataPra();
+ pra.UnlockTimeBegin = dateFrom.ToUniversalTime().ToString();
+ pra.UnlockTimeEnd = dateTo.ToUniversalTime().ToString();
+ pra.LoginAccessToken = UserCenterLogic.GetConnectMainToken();
+ pra.DoorLockId = this.DeviceDoor.DeviceAddr + "_" + this.DeviceDoor.DeviceEpoint;
+
+ return pra;
+ }
+
+ /// <summary>
+ /// 鑾峰彇鍒犻櫎鏁版嵁鐨勪簯绔帴鍙g殑鍚姩鍙傛暟
+ /// </summary>
+ /// <returns></returns>
+ private DeleteHistoryDataPra GetDeleteDataPra()
{
DateTime dateFrom = new DateTime(dateFromControl.Year, dateFromControl.Month, dateFromControl.Day, 0, 0, 0);
DateTime dateTo = new DateTime(dateToControl.Year, dateToControl.Month, dateToControl.Day, 23, 59, 59);
List<string> listUser = null;
- //涓�鏃︽寚瀹氫簡鍏朵粬,鍒欓渶瑕佸叏閮ㄨ鍙�,鍥犱负鏈変簺寮�閿侊紝瀹冪敤鐨勫瘑鐮佸苟娌℃湁鍒嗛厤缁欐垚鍛�
- if (listSearchUserId.Contains("-1") == true || listSearchUserId.Contains("") == true)
+ //鎸囧畾鐢ㄦ埛
+ if (listSearchUserId.Contains("-1") == false)
{
- //鍏ㄩ�夊嵆涓篘ull
- }
- else
- {
- //鎸囧畾鐢ㄦ埛
listUser = new List<string>();
listUser.AddRange(listSearchUserId);
- //绉婚櫎鍏朵粬,鍥犱负浜戠鍥哄畾浼氱粰
- listUser.Remove("");
+ //濡傛灉鎸囧畾鏈夊叾浠�
+ if (listSearchUserId.Contains("-9999") == true)
+ {
+ listUser.AddRange(this.listOtherUserId);
+ }
}
//鍏ㄩ�夊垯涓簄ull
@@ -706,13 +823,13 @@
listLock.AddRange(listSearchLockId);
}
- var pra = new GetHistoryDataPra();
+ var pra = new DeleteHistoryDataPra();
pra.UnlockTimeBegin = dateFrom.ToUniversalTime().ToString();
pra.UnlockTimeEnd = dateTo.ToUniversalTime().ToString();
pra.LoginAccessToken = UserCenterLogic.GetConnectMainToken();
pra.DoorLockId = this.DeviceDoor.DeviceAddr + "_" + this.DeviceDoor.DeviceEpoint;
- pra.CloudAccountIdArr = listUser;
- pra.OpenLockModeArr = listLock;
+ pra.CloudAccountIds = listUser;
+ pra.OpenLockModes = listLock;
return pra;
}
@@ -784,12 +901,51 @@
}
/// <summary>
+ /// 鍒犻櫎鍘嗗彶璁板綍鏁版嵁
+ /// </summary>
+ private class DeleteHistoryDataPra : IfacePraCommon
+ {
+ /// <summary>
+ /// RequestVersion
+ /// </summary>
+ public string RequestVersion = Common.CommonPage.RequestVersion;
+ /// <summary>
+ /// Token
+ /// </summary>
+ public string LoginAccessToken = string.Empty;
+ /// <summary>
+ /// 浣忓畢ID
+ /// </summary>
+ public string HomeId = Common.Config.Instance.Home.Id;
+ /// <summary>
+ /// 闂ㄩ攣鐨凪ac鍦板潃
+ /// </summary>
+ public string DoorLockId = string.Empty;
+ /// <summary>
+ /// Config.Instance.Guid 鎴栬�� MemberInfoRes.SubAccountDistributedMark
+ /// </summary>
+ public List<string> CloudAccountIds = null;
+ /// <summary>
+ /// 寮�閿佹柟寮�(0:瀵嗙爜銆�15:鎸囩汗銆�3:IC鍗�)
+ /// </summary>
+ public List<int> OpenLockModes = null;
+ /// <summary>
+ /// 鎼滅储寮�閿佸紑濮嬫椂闂�
+ /// </summary>
+ public string UnlockTimeBegin;
+ /// <summary>
+ /// 鎼滅储寮�閿佺粨鏉熸椂闂�
+ /// </summary>
+ public string UnlockTimeEnd;
+ }
+
+ /// <summary>
/// 鍘嗗彶璁板綍鐨勭粨鏋�
/// </summary>
private class HistoryInfo
{
/// <summary>
- /// 寮�閿佹柟寮� 0:瀵嗙爜 15:鎸囩汗 3:IC鍗�
+ /// 寮�閿佹柟寮� 0:瀵嗙爜 15:鎸囩汗 3:IC鍗� 9000:甯稿紑妯″紡(鑷畾涔夌殑)
/// </summary>
public int OpenLockMode = -1;
/// <summary>
@@ -805,6 +961,14 @@
/// </summary>
public string CloudAccountId = string.Empty;
/// <summary>
+ /// 鍏朵粬寮�閿佹柟寮�(OpenLockMode=9000鏃舵湁鏁�) 9001:甯稿紑鎵撳紑 9002:甯稿紑鍙栨秷 9003:甯稿紑鎸佺画
+ /// </summary>
+ public int OtherOpenLockMode = -1;
+ /// <summary>
+ /// 甯稿紑鎸佺画鏃堕棿(1~72灏忔椂 OtherOpenLockMode=9003鐨勬椂鍊欐湁鏁�)
+ /// </summary>
+ public string NormallyOpenContinuedTime = string.Empty;
+ /// <summary>
/// 褰撳紑閿佹柟寮忎负-1鏃朵娇鐢�,瀹冨睘浜庡叾浠栫被
/// </summary>
public string AlarmMsg = string.Empty;
@@ -816,6 +980,10 @@
/// 褰撳紑閿佹柟寮忎负-1鏃朵娇鐢�,璁惧绔偣
/// </summary>
public int DeviceEpoint = 0;
+ /// <summary>
+ /// 褰撳紑閿佹柟寮忎负-1鏃朵娇鐢�,娑堟伅鐨勬暟鎹簱涓婚敭
+ /// </summary>
+ public string MsgKeyId = string.Empty;
}
#endregion
--
Gitblit v1.8.0