| | |
| | | using System;
|
| | | using System.Collections.Generic;
|
| | | using System.Text;
|
| | | using System.Threading.Tasks;
|
| | | using ZigBee.Device;
|
| | |
|
| | | namespace Shared.Phone.UserCenter.DeviceDoorLock
|
| | |
| | | this.listHistoryInfo = null;
|
| | | }
|
| | |
|
| | | HdlThreadLogic.Current.RunThread(async () =>
|
| | | HdlThreadLogic.Current.RunThread(() =>
|
| | | {
|
| | | //打开进度条
|
| | | this.ShowProgressBar();
|
| | | //成员列表
|
| | | var result = await this.GetMemberListInfo();
|
| | | var result = this.GetMemberListInfo();
|
| | | if (result == false)
|
| | | {
|
| | | //关闭进度条
|
| | |
| | | dicMemberName.Add(listMenberInfo[i].SubAccountDistributedMark, string.IsNullOrEmpty(listMenberInfo[i].UserName) == false ? listMenberInfo[i].UserName : listMenberInfo[i].Account);
|
| | | }
|
| | | //历史记录
|
| | | var historyLog = await this.GetHistoryLogInfo(dicMemberName);
|
| | | var historyLog = this.GetHistoryLogInfo(dicMemberName);
|
| | | if (historyLog == null)
|
| | | {
|
| | | //关闭进度条
|
| | |
| | | /// 获取成员列表信息
|
| | | /// </summary>
|
| | | /// <returns></returns>
|
| | | private async Task<bool> GetMemberListInfo()
|
| | | private bool GetMemberListInfo()
|
| | | {
|
| | | if (listMenberInfo != null)
|
| | | {
|
| | |
| | | }
|
| | |
|
| | | var pra = new MemberListInfoPra();
|
| | | string result = await UserCenterLogic.GetResponseDataByRequestHttps("ZigbeeUsers/GetSubAccountByDistributedMark", false, pra);
|
| | | if (result == null)
|
| | | string result = UserCenterLogic.GetResponseDataByRequestHttps("ZigbeeUsers/GetSubAccountByDistributedMark", false, pra);
|
| | | if (string.IsNullOrEmpty(result) == true)
|
| | | {
|
| | | return false;
|
| | | }
|
| | |
| | | /// 获取历史记录
|
| | | /// </summary>
|
| | | /// <returns></returns>
|
| | | private async Task<List<HistoryInfo>> GetHistoryLogInfo(Dictionary<string, string> dicMemberName)
|
| | | private List<HistoryInfo> GetHistoryLogInfo(Dictionary<string, string> dicMemberName)
|
| | | {
|
| | | if (this.listHistoryInfo != null)
|
| | | {
|
| | |
| | | var pra = this.GetReadHistoryPra();
|
| | |
|
| | | //获取门锁的打开和关闭记录
|
| | | var listAllLog = await this.GetDoorOpenHistoryLog(pra);
|
| | | var listAllLog = this.GetDoorOpenHistoryLog(pra);
|
| | | //获取门锁的其他记录
|
| | | var listOtherLog = await this.GetDoorOtherHistoryLog(pra.UnlockTimeBegin, pra.UnlockTimeEnd);
|
| | | var listOtherLog = this.GetDoorOtherHistoryLog(pra.UnlockTimeBegin, pra.UnlockTimeEnd);
|
| | | listAllLog.AddRange(listOtherLog);
|
| | |
|
| | | //排序一下
|
| | |
| | | /// </summary>
|
| | | /// <param name="i_pra"></param>
|
| | | /// <returns></returns>
|
| | | private async Task<List<HistoryInfo>> GetDoorOpenHistoryLog(GetHistoryDataPra i_pra)
|
| | | private List<HistoryInfo> GetDoorOpenHistoryLog(GetHistoryDataPra i_pra)
|
| | | {
|
| | | var listLog = new List<HistoryInfo>();
|
| | |
|
| | |
| | | while (true)
|
| | | {
|
| | | //访问云端
|
| | | var result = await UserCenterLogic.GetResponseDataByRequestHttps("DoorLock/GetDoorLockHistoryPager", true, i_pra);
|
| | | if (result == null)
|
| | | var result = UserCenterLogic.GetResponseDataByRequestHttps("DoorLock/GetDoorLockHistoryPager", true, i_pra);
|
| | | if (string.IsNullOrEmpty(result) == true)
|
| | | {
|
| | | return null;
|
| | | }
|
| | |
| | | /// 获取门锁的其他记录
|
| | | /// </summary>
|
| | | /// <returns></returns>
|
| | | private async Task<List<HistoryInfo>> GetDoorOtherHistoryLog(string beginTime, string endTime)
|
| | | private List<HistoryInfo> GetDoorOtherHistoryLog(string beginTime, string endTime)
|
| | | {
|
| | | var listLog = new List<HistoryInfo>();
|
| | |
|
| | |
| | | pra2.EndTime = endTime;
|
| | | pra2.Topic = "/Alarms/SendAlarmInform";
|
| | | pra2.LoginAccessToken = UserCenterLogic.GetConnectMainToken();
|
| | | var result = await UserCenterLogic.GetResponseDataByRequestHttps("MessageCenter/GetMessageCenterPagger", true, pra2);
|
| | | if (result == null)
|
| | | var result = UserCenterLogic.GetResponseDataByRequestHttps("MessageCenter/GetMessageCenterPagger", true, pra2);
|
| | | if (string.IsNullOrEmpty(result) == true)
|
| | | {
|
| | | return null;
|
| | | }
|
| | |
| | |
|
| | | //从自动化中,获取常开模式记录
|
| | | pra2.Topic = "/Logic/Execute_Respon";
|
| | | result = await UserCenterLogic.GetResponseDataByRequestHttps("MessageCenter/GetMessageCenterPagger", true, pra2);
|
| | | if (result == null)
|
| | | result = UserCenterLogic.GetResponseDataByRequestHttps("MessageCenter/GetMessageCenterPagger", true, pra2);
|
| | | if (string.IsNullOrEmpty(result) == true)
|
| | | {
|
| | | return null;
|
| | | }
|
| | |
| | |
|
| | | //获取门锁临时密码开锁记录
|
| | | pra2.Topic = "/DoorLock/DoorLockOperatingEventNotificationCommand";
|
| | | result = await UserCenterLogic.GetResponseDataByRequestHttps("MessageCenter/GetMessageCenterPagger", true, pra2);
|
| | | if (result == null)
|
| | | result = UserCenterLogic.GetResponseDataByRequestHttps("MessageCenter/GetMessageCenterPagger", true, pra2);
|
| | | if (string.IsNullOrEmpty(result) == true)
|
| | | {
|
| | | return null;
|
| | | }
|
| | |
| | | /// <summary>
|
| | | /// 清空所有记录
|
| | | /// </summary>
|
| | | private async void ClearAllHistoryLog()
|
| | | private void ClearAllHistoryLog()
|
| | | {
|
| | | //获取访问云端接口的启动参数(2020.05.08:全部清空)
|
| | | var pra = this.GetDeleteDataPra();
|
| | |
|
| | | //打开进度条
|
| | | this.ShowProgressBar();
|
| | | var result = await UserCenterLogic.GetResultStatuByRequestHttps("DoorLock/ClearDoorLockHistory", true, pra);
|
| | | var result = UserCenterLogic.GetResultStatuByRequestHttps("DoorLock/ClearDoorLockHistory", true, pra);
|
| | | if (result == false)
|
| | | {
|
| | | return;
|
| | |
| | | for (int i = 0; i < listOtherMsgId.Count; i++)
|
| | | {
|
| | | pra2.Id = listOtherMsgId[i];
|
| | | result = await UserCenterLogic.GetResultStatuByRequestHttps("MessageCenter/DelMessageCenterItem", true, pra2);
|
| | | result = UserCenterLogic.GetResultStatuByRequestHttps("MessageCenter/DelMessageCenterItem", true, pra2);
|
| | | if (result == false)
|
| | | {
|
| | | return;
|