From a4924de3136289d10cabbf2f61a228387d44ded7 Mon Sep 17 00:00:00 2001
From: gxc <guoxuecheng@guoxuechengdeMacBook-Pro.local>
Date: 星期四, 07 十一月 2019 13:48:36 +0800
Subject: [PATCH] Merge branch 'dev-tzy' into DEV_GXC

---
 ZigbeeApp/Shared/Phone/ZigBee/Device/DoorLock.cs |  102 +++++++++++++++++++++++++++++++++++++--------------
 1 files changed, 74 insertions(+), 28 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/ZigBee/Device/DoorLock.cs b/ZigbeeApp/Shared/Phone/ZigBee/Device/DoorLock.cs
old mode 100755
new mode 100644
index 40777bc..0857931
--- a/ZigbeeApp/Shared/Phone/ZigBee/Device/DoorLock.cs
+++ b/ZigbeeApp/Shared/Phone/ZigBee/Device/DoorLock.cs
@@ -2,6 +2,7 @@
 using System.Collections.Generic;
 using System.Text;
 using System.Threading.Tasks;
+using Java.Util;
 using Newtonsoft.Json;
 using Newtonsoft.Json.Linq;
 using Shared;
@@ -20,20 +21,29 @@
 
         #region 闂ㄩ攣鏈湴鍙橀噺
         /// <summary>
-        /// 闂ㄩ攣鏈湴鐢ㄦ埛鍒楄〃
+        /// 鏈湴闂ㄩ攣鐢ㄦ埛鍜岃处鎴峰垪琛�
+        /// key:闂ㄩ攣鐢ㄦ埛ID
         /// </summary>
         /// <returns></returns>
         public Dictionary<int, LocaDoorLockObj> localDoorLockUserList = new Dictionary<int, LocaDoorLockObj>();
-        public string currentUserDisplayMethod = string.Empty;
+        /// <summary>
+        /// 鏈湴闂ㄨ处鎴峰垪琛�
+        /// key:璐︽埛ID锛堜富璐︽埛鏄疓UID锛屽瓙璐︽埛鏄垎浜繃鏉ョ殑璐︽埛ID锛�
+        /// </summary>
+        /// <returns></returns>
+        public Dictionary<string, LocaDoorLockObj> localDoorLockAccountList = new Dictionary<string, LocaDoorLockObj>();
+
+        public string currentUserDisplayMethod = string.Empty;//褰撳墠鐢ㄦ埛鏄剧ず鏂瑰紡
+        //鏈湴鎵�鏈夎处鎴峰垪琛�
         public List<Shared.Phone.UserCenter.MemberInfoRes> localAllAccountList = new List<Shared.Phone.UserCenter.MemberInfoRes> { };
-        public static int RemoteUnlockCount = 3;//杩滅▼寮�閿佹鏁伴檺鍒�
+        public static int RemoteUnlockCount = 5;//杩滅▼寮�閿佹鏁伴檺鍒�
         public static string RemoteUnlockPassword = string.Empty;//杩滅▼寮�閿佸瘑鐮�
         public static DateTime maxValue = DateTime.MaxValue;
         public static DateTime minValue = DateTime.MinValue;
-
         public string LocalTempPassword = string.Empty;//鏈湴鐢熸垚鐨勪复鏃跺瘑鐮�
-
-
+        public Dictionary<string, bool> IsFreezeAccount = new Dictionary<string, bool> { };//鏄惁鍐荤粨瀛愯处鎴�
+        public Dictionary<string, bool> HasRemoteUnlockAccess = new Dictionary<string, bool> { };//鏄惁缁欏瓙璐︽埛鎷ユ湁杩滅▼寮�閿佺殑鏉′欢
+        public Dictionary<string, bool> IsFailedToGetDoorLockInfo = new Dictionary<string, bool> { };//鏄惁鑾峰彇闂ㄩ攣鏁版嵁澶辫触
         #region 涓存椂瀵嗙爜淇℃伅
         /// <summary>
         /// 鐢ㄦ埛绠$悊鍙戦�佹暟鎹洖澶�
@@ -97,6 +107,11 @@
             /// 闂ㄩ攣鏈湴鐢ㄦ埛Id -->閿悕 : DoorLockLocalUserId
             /// </summary>
             public string DoorLockLocalUserId = "";
+
+            /// <summary>
+            /// IsOtherAccountCtrl 鏄惁涓哄瓙甯愬彿鎺у埗杩囨潵 -->閿悕 : IsOtherAccountCtrl
+            /// </summary>
+            public bool IsOtherAccountCtrl = false;
         }
         #endregion
 
@@ -166,10 +181,6 @@
             /// PrimaryId 闂ㄩ攣浜戠涓� 閿�(闈炴洿鏂板瓧娈�,浠ヤ笅鍧囦负鏇存柊瀛楁) -->閿悕 : PrimaryId榛樿鍊�: null
             /// </summary>
             public string PrimaryId = "";
-            /// <summary>
-            /// 浜戠甯愬彿Id -->閿悕 : CloudAccountId
-            /// </summary>
-            public string CloudAccountId = "";
             /// <summary>
             /// OpenLockMode 寮�閿佹柟寮�(瀵嗙爜銆佹寚绾广�両C鍗�) -->閿悕 : OpenLockMode (鍙��)
             /// </summary>
@@ -249,6 +260,10 @@
             /// 0:00:00] ValidEndTime 鏈夋晥缁撴潫鏃堕棿 -->閿悕 : ValidEndTime
             /// </summary>
             public DateTime ValidEndTime;
+            /// <summary>
+            /// IsOtherAccountCtrl 鏄惁涓哄瓙甯愬彿鎺у埗杩囨潵 -->閿悕 : IsOtherAccountCtrl
+            /// </summary>
+            public bool IsOtherAccountCtrl = false;
         }
 
         /// <summary>
@@ -281,6 +296,10 @@
             /// LocalDoorLockId 鎼滅储鏈湴闂ㄩ攣Id -->閿悕 : LocalDoorLockId  榛樿鍊�: null
             /// </summary>
             public string LocalDoorLockId = "";
+            /// <summary>
+            /// IsOtherAccountCtrl 鏄惁涓哄瓙甯愬彿鎺у埗杩囨潵 -->閿悕 : IsOtherAccountCtrl
+            /// </summary>
+            public bool IsOtherAccountCtrl = false;
         }
 
         /// <summary>
@@ -333,6 +352,10 @@
             /// 0:00:00] ValidEndTime 鏈夋晥缁撴潫鏃堕棿 -->閿悕 : ValidEndTime
             /// </summary>
             public DateTime ValidEndTime;
+            /// <summary>
+            /// IsOtherAccountCtrl 鏄惁涓哄瓙甯愬彿鎺у埗杩囨潵 -->閿悕 : IsOtherAccountCtrl
+            /// </summary>
+            public bool IsOtherAccountCtrl = false;
         }
 
         /// <summary>
@@ -381,11 +404,15 @@
             /// 0:00:00] ValidEndTime 鏈夋晥缁撴潫鏃堕棿 -->閿悕 : ValidEndTime
             /// </summary>
             public DateTime? ValidEndTime;
+            /// <summary>
+            /// IsOtherAccountCtrl 鏄惁涓哄瓙甯愬彿鎺у埗杩囨潵 -->閿悕 : IsOtherAccountCtrl
+            /// </summary>
+            public bool IsOtherAccountCtrl = false;
         }
 
         /// <summary>
         /// 鑾峰彇闂ㄩ攣涓存椂瀵嗙爜缁撴灉
-        /// </summary> 
+        /// </summary>
         [Serializable]
         public class GetDoorLockTempPasswordDataRes
         {
@@ -533,7 +560,7 @@
         }
 
         /// <summary>
-        /// 鑾峰彇闂ㄩ攣缁欎簯鏈嶅姟鍣�
+        /// 鑾峰彇闂ㄩ攣浜戞湇鍔″櫒
         /// </summary>
         public static async System.Threading.Tasks.Task<GetDoorLockDataRes> GetDoorLockInfoFromServer(string RequestName, GetDoorLockData getDoorLockData)
         {
@@ -566,10 +593,27 @@
             {
                 //搴忓垪鍖栧璞�
                 var requestJson = JsonConvert.SerializeObject(obj);
+                var byteData = System.Text.Encoding.UTF8.GetBytes(requestJson);
+                byte[] result1 = null;
                 //璁块棶鎺ュ彛
-                var result = await CommonPage.Instance.RequestHttpsZigbeeAsync(RequestName, System.Text.Encoding.UTF8.GetBytes(requestJson));
-
-                return result;
+                if (UserCenterResourse.UserInfo.AuthorityNo == 1)
+                {
+                    result1 = await CommonPage.Instance.RequestHttpsZigbeeBytesResultAsync(RequestName, byteData);
+                }
+                else
+                {
+                    result1 = await CommonPage.Instance.RequestZigbeeHttpsByAdmin(RequestName, byteData);
+                }
+                if (result1 != null)
+                {
+                    var result2 = Encoding.UTF8.GetString(result1);
+                    if (result2 != null)
+                    {
+                        var result = Newtonsoft.Json.JsonConvert.DeserializeObject<Shared.Common.ResponseEntity.ResponsePack>(result2);
+                        return result;
+                    }
+                }
+                return null;
             }
             catch (Exception ex)
             {
@@ -586,12 +630,12 @@
         {
             DoorLockAccountList.Clear();
             return await System.Threading.Tasks.Task.Run((Func<System.Threading.Tasks.Task<List<Shared.Phone.UserCenter.MemberInfoRes>>>)(async () =>
-           {
-               var pra = new Shared.Phone.UserCenter.MemberListInfoPra();
-               string result = await UserCenterLogic.GetResponseDataByRequestHttps("ZigbeeUsers/GetSubAccountByDistributedMark", false, pra);
-               var listInfo = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Shared.Phone.UserCenter.MemberInfoRes>>(result);
-               return listInfo;
-           }));
+            {
+                var pra = new Shared.Phone.UserCenter.MemberListInfoPra();
+                string result = await UserCenterLogic.GetResponseDataByRequestHttps("ZigbeeUsers/GetSubAccountByDistributedMark", false, pra);
+                var listInfo = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Shared.Phone.UserCenter.MemberInfoRes>>(result);
+                return listInfo;
+            }));
         }
 
         /// <summary>
@@ -1086,7 +1130,7 @@
                             result = new DefaultControlResponseAllData { errorMessageBase = "缃戝叧杩斿洖鐨勬暟鎹负绌�" };
                         }
                         else
-                        {
+                        {
                             if (gatewayTemp.clientDataPassthroughResponseData?.PassData != null)
                             {
                                 var data = gatewayTemp.clientDataPassthroughResponseData.PassData;
@@ -1099,7 +1143,7 @@
                                         tempD.command = data[12].ToString() + data[13].ToString() + data[10].ToString() + data[11].ToString();
                                         tempD.status = Convert.ToInt32(data[14].ToString() + data[15].ToString(), 16);
                                         result = new DefaultControlResponseAllData { defaultControlResponseData = tempD };
-                                        DebugPrintLog($"UI鏀跺埌閫氱煡鍚庣殑涓婚_command:0402_{ topic}");
+                                        DebugPrintLog($"UI鏀跺埌閫氱煡鍚庣殑涓婚_command:0450_{ topic}");
                                     }
                                 }
                             }
@@ -1128,7 +1172,7 @@
                         break;
                     }
                 }
-                if ((DateTime.Now - dateTime).TotalMilliseconds > WaitReceiveDataTime)
+                if ((DateTime.Now - dateTime).TotalMilliseconds > 9000)
                 {
                     result = new DefaultControlResponseAllData { errorMessageBase = " 鍥炲瓒呮椂锛岃閲嶆柊鎿嶄綔" };
                 }
@@ -1924,6 +1968,8 @@
         public async System.Threading.Tasks.Task<DoorlockUserInfo> GetDoorlockUserInfoAsync()
         {
             DoorlockUserInfo result = null;
+            int totalNum = 0;
+            int currentNum = -1;
             DoorLockUserDetailData doorLockUserDetailData = new DoorLockUserDetailData { };
             if (Gateway == null)
             {
@@ -1989,15 +2035,15 @@
                     var data = new JObject { { "PassData", passData } };
                     jObject.Add("Data", data);
                     Gateway.Send(("ClientDataPassthrough"), jObject.ToString());
+
                 }
                 catch { }
 
-                //鎺ユ敹涓�涓寘鏈�澶氱瓑5绉掞紝娌℃湁鏀跺埌灏遍��鍑�
-                while ((DateTime.Now - dateTime).TotalMilliseconds < 5000)
+                //鎺ユ敹涓�涓寘鏈�澶氱瓑3绉掞紝娌℃湁鏀跺埌灏遍��鍑�
+                while ((DateTime.Now - dateTime).TotalMilliseconds < 3000)
                 {
                     await System.Threading.Tasks.Task.Delay(100);
                 }
-
                 Gateway.Actions -= action;
                 DebugPrintLog("ClientDataPassthrough_Actions 閫�鍑�" + System.DateTime.Now.ToString());
 
@@ -2088,4 +2134,4 @@
 
         #endregion
     }
-}
+}
\ No newline at end of file

--
Gitblit v1.8.0