| | |
| | | using System;
|
| | | using System.Collections.Generic;
|
| | | using System.Text;
|
| | | using System.Threading.Tasks;
|
| | | using ZigBee.Device;
|
| | |
|
| | | namespace Shared.Phone.UserCenter.DeviceDoorLock
|
| | |
| | | /// </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<string> listOtherId = new List<string>();
|
| | | private List<DoorHistoryLogInfo> listHistoryInfo = null;
|
| | | /// <summary>
|
| | | /// 其他消息的主键,它存在另外的一张数据库表中
|
| | | /// </summary>
|
| | | private List<string> listOtherMsgId = new List<string>();
|
| | |
|
| | | #endregion
|
| | |
|
| | |
| | | /// <summary>
|
| | | /// 画面显示(底层会固定调用此方法,借以完成画面创建)
|
| | | /// </summary>
|
| | | /// <param name="i_DeviceMac">门锁的Mac地址</param> |
| | | public void ShowForm(string i_DeviceMac) |
| | | /// <param name="i_DeviceMac">门锁的Mac地址</param>
|
| | | public void ShowForm(string i_DeviceMac)
|
| | | {
|
| | | this.DeviceDoor = Common.LocalDevice.Current.GetDevicesByMac(i_DeviceMac, false)[0]; |
| | | |
| | | //设置头部信息 |
| | | base.SetTitleText(Language.StringByID(R.MyInternationalizationString.uHistoryLog)); |
| | | |
| | | //删除 |
| | | var btnDelete = new MostRightIconControl(69, 69); |
| | | btnDelete.UnSelectedImagePath = "Item/DeleteIcon2Selected.png"; |
| | | topFrameLayout.AddChidren(btnDelete); |
| | | btnDelete.InitControl(); |
| | | btnDelete.ButtonClickEvent += (sender, e) =>
|
| | | this.DeviceDoor = HdlDeviceCommonLogic.Current.GetDevicesByMac(i_DeviceMac, false)[0];
|
| | |
|
| | | //设置头部信息
|
| | | base.SetTitleText(Language.StringByID(R.MyInternationalizationString.uHistoryLog));
|
| | |
|
| | | //成员不允许清空记录
|
| | | if (HdlUserCenterResourse.ResidenceOption.AuthorityNo == 1 || HdlUserCenterResourse.ResidenceOption.AuthorityNo == 2)
|
| | | {
|
| | | var form = new TopRightMenuControl(1, 2);
|
| | | //清空记录
|
| | | form.AddRowMenu(Language.StringByID(R.MyInternationalizationString.uClearLog), "Item/DeleteIcon2.png", "Item/DeleteIcon2Selected.png", () =>
|
| | | //删除
|
| | | var btnDelete = new MostRightIconControl(69, 69);
|
| | | btnDelete.UnSelectedImagePath = "Item/DeleteIcon2Selected.png";
|
| | | topFrameLayout.AddChidren(btnDelete);
|
| | | btnDelete.InitControl();
|
| | | btnDelete.ButtonClickEvent += (sender, e) =>
|
| | | {
|
| | | if (this.listView.frameTable.ChildrenCount == 0)
|
| | | var form = new TopRightMenuControl(1, 2);
|
| | | //清空记录
|
| | | form.AddRowMenu(Language.StringByID(R.MyInternationalizationString.uClearLog), "Item/DeleteIcon2.png", "Item/DeleteIcon2Selected.png", () =>
|
| | | {
|
| | | //无数据可删
|
| | | return;
|
| | | }
|
| | | //确认清空当前记录?
|
| | | this.ShowMassage(ShowMsgType.Confirm, Language.StringByID(R.MyInternationalizationString.uConfirmClearNowLog), () =>
|
| | | {
|
| | | //清空所有记录
|
| | | this.ClearAllHistoryLog();
|
| | | if (this.listView.frameTable.ChildrenCount == 0)
|
| | | {
|
| | | //无数据可删
|
| | | return;
|
| | | }
|
| | | //确认清空当前记录?
|
| | | this.ShowMassage(ShowMsgType.Confirm, Language.StringByID(R.MyInternationalizationString.uConfirmClearNowLog), () =>
|
| | | {
|
| | | HdlThreadLogic.Current.RunThread(() =>
|
| | | {
|
| | | //清空所有记录
|
| | | this.ClearAllHistoryLog();
|
| | | });
|
| | | });
|
| | | });
|
| | | });
|
| | | }; |
| | | |
| | | //初始化中部信息 |
| | | this.InitMiddleFrame(); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 初始化中部信息 |
| | | /// </summary> |
| | | private void InitMiddleFrame() |
| | | };
|
| | | }
|
| | |
|
| | | //初始化中部信息
|
| | | this.InitMiddleFrame();
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 初始化中部信息
|
| | | /// </summary>
|
| | | private void InitMiddleFrame()
|
| | | {
|
| | | //清空bodyFrame
|
| | | this.ClearBodyFrame(); |
| | | |
| | | //初始化头部检索控件 |
| | | this.ClearBodyFrame();
|
| | |
|
| | | //初始化头部检索控件
|
| | | this.InitTitleSearchControl();
|
| | |
|
| | | //初始化记录列表
|
| | | this.InitLogListInfo();
|
| | | this.InitLogListInfo(true);
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | |
| | | /// </summary>
|
| | | private void InitTitleSearchControl()
|
| | | {
|
| | | var frameTitle = new FrameRowControl(); |
| | | frameTitle.UseClickStatu = false; |
| | | frameTitle.Height = Application.GetRealHeight(115); |
| | | frameTitle.BackgroundColor = topFrameLayout.BackgroundColor; |
| | | var frameTitle = new FrameRowControl();
|
| | | frameTitle.UseClickStatu = false;
|
| | | frameTitle.Height = Application.GetRealHeight(115);
|
| | | frameTitle.BackgroundColor = topFrameLayout.BackgroundColor;
|
| | | bodyFrameLayout.AddChidren(frameTitle);
|
| | |
|
| | | var btnDateIcon = frameTitle.AddLeftIcon(69);
|
| | |
| | | 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;
|
| | |
| | | listView.BeginHeaderRefreshingAction += () =>
|
| | | {
|
| | | //下拉刷新
|
| | | this.InitLogListInfo();
|
| | | this.InitLogListInfo(true);
|
| | | };
|
| | | }
|
| | |
|
| | |
| | | /// <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);
|
| | |
| | | this.ShowMassage(ShowMsgType.Tip, Language.StringByID(R.MyInternationalizationString.uFromTimeIsOverToTime));
|
| | | return;
|
| | | }
|
| | | HdlThreadLogic.Current.RunThread(async () =>
|
| | | if (reReadData == true)
|
| | | {
|
| | | //置空后,重新获取
|
| | | this.listHistoryInfo = null;
|
| | | }
|
| | |
|
| | | HdlThreadLogic.Current.RunThread(() =>
|
| | | {
|
| | | //打开进度条
|
| | | this.ShowProgressBar();
|
| | | //成员列表
|
| | | var result = await this.GetMemberListInfo();
|
| | | var result = this.GetMemberListInfo();
|
| | | if (result == false)
|
| | | {
|
| | | //关闭进度条
|
| | | this.CloseProgressBar(ShowReLoadMode.YES);
|
| | | return;
|
| | | }
|
| | | //成员信息
|
| | | var dicMemberName = new Dictionary<string, string>();
|
| | | for (int i = 0; i < listMenberInfo.Count; i++)
|
| | | {
|
| | | dicMemberName.Add(listMenberInfo[i].ChildAccountId, listMenberInfo[i].ShowName);
|
| | | }
|
| | | //历史记录
|
| | | var historyLog = await this.GetHistoryLogInfo();
|
| | | var historyLog = this.GetHistoryLogInfo(dicMemberName);
|
| | | if (historyLog == null)
|
| | | {
|
| | | //关闭进度条
|
| | |
| | | //关闭进度条
|
| | | 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();
|
| | |
| | | /// 获取成员列表信息
|
| | | /// </summary>
|
| | | /// <returns></returns>
|
| | | private async Task<bool> GetMemberListInfo()
|
| | | private bool GetMemberListInfo()
|
| | | {
|
| | | if (listMenberInfo != null)
|
| | | {
|
| | |
| | | //把自己也加进去
|
| | | var myInfo = new MemberInfoRes()
|
| | | {
|
| | | Account = UserCenterResourse.UserInfo.Account,
|
| | | UserName = UserCenterResourse.UserInfo.UserName,
|
| | | SubAccountDistributedMark = Common.Config.Instance.Guid
|
| | | ChildAccountEmail = HdlUserCenterResourse.UserInfo.UserEmail,
|
| | | ChildAccountPhone = HdlUserCenterResourse.UserInfo.UserPhone,
|
| | | ChildNickName = HdlUserCenterResourse.UserInfo.NickName,
|
| | | ChildAccountId = Common.Config.Instance.Guid
|
| | | };
|
| | | listMenberInfo.Add(myInfo);
|
| | | if (UserCenterResourse.UserInfo.AuthorityNo == 3)
|
| | | if (HdlUserCenterResourse.ResidenceOption.AuthorityNo == 3)
|
| | | {
|
| | | //成员只能看自己的
|
| | | return true;
|
| | | }
|
| | |
|
| | | var pra = new MemberListInfoPra();
|
| | | string result = await UserCenterLogic.GetResponseDataByRequestHttps("ZigbeeUsers/GetSubAccountByDistributedMark", false, pra);
|
| | | if (result == null)
|
| | | //获取成员列表
|
| | | var listInfo = HdlMemberLogic.Current.GetMemberListInfo(ShowNetCodeMode.YES);
|
| | | if (listInfo == null)
|
| | | {
|
| | | return false;
|
| | | }
|
| | | List<MemberInfoRes> listInfo = Newtonsoft.Json.JsonConvert.DeserializeObject<List<MemberInfoRes>>(result);
|
| | | var checkList = new List<string>();
|
| | | foreach (MemberInfoRes infoRes in listInfo)
|
| | | {
|
| | | if (checkList.Contains(infoRes.DistributedMark) == true)
|
| | | if (checkList.Contains(infoRes.ChildAccountId) == true)
|
| | | {
|
| | | continue;
|
| | | }
|
| | | checkList.Add(infoRes.DistributedMark);
|
| | | checkList.Add(infoRes.ChildAccountId);
|
| | | listMenberInfo.Add(infoRes);
|
| | | }
|
| | | return true;
|
| | |
| | | /// <param name="historyInfo">历史记录</param>
|
| | | /// <param name="dicName">名字</param>
|
| | | /// <param name="addLine">添加底线</param>
|
| | | private void AddLogInfoRow(HistoryInfo historyInfo, Dictionary<string, string> dicName, bool addLine = true)
|
| | | private void AddLogInfoRow(DoorHistoryLogInfo historyInfo, Dictionary<string, string> dicName, bool addLine = true)
|
| | | {
|
| | | var frameTable = new FrameRowControl(listView.rowSpace / 2);
|
| | | frameTable.UseClickStatu = false;
|
| | | this.listView.AddChidrenFrame2(frameTable);
|
| | | this.listView.AddChidren2(frameTable);
|
| | | //图标
|
| | | var btnIcon = frameTable.AddLeftIcon();
|
| | | if (historyInfo.OpenLockMode == -1)
|
| | | //信息
|
| | | var btnMsg = frameTable.AddTopView("", 600);
|
| | | //人物
|
| | | string perName = dicName.ContainsKey(historyInfo.UserId) == true ? dicName[historyInfo.UserId] : Language.StringByID(R.MyInternationalizationString.uOther);
|
| | | frameTable.AddBottomView(perName, 600);
|
| | | //时间
|
| | | if (this.dateFromControl.dateValue == this.dateToControl.dateValue)
|
| | | {
|
| | | //其他消息
|
| | | var device = Common.LocalDevice.Current.GetDevice(historyInfo.DeviceMac, historyInfo.DeviceEpoint);
|
| | | //如果日期范围一样,则不显示年月日
|
| | | frameTable.AddMostRightView(HdlCommonLogic.Current.ConvertUtcTimeToLocalTime2(historyInfo.UnlockTime).ToString("HH:mm:ss"), 400);
|
| | | }
|
| | | else
|
| | | {
|
| | | //如果日期范围不一样,则显示年月日
|
| | | frameTable.AddMostRightView(HdlCommonLogic.Current.ConvertUtcTimeToLocalTime2(historyInfo.UnlockTime).ToString("yyyy/MM/dd HH:mm:ss"), 700);
|
| | | }
|
| | | //底线
|
| | | if (addLine == true)
|
| | | {
|
| | | |
| | | frameTable.AddBottomLine();
|
| | | }
|
| | |
|
| | | //其他消息
|
| | | if (historyInfo.UnLockMode == -1)
|
| | | {
|
| | | //图片
|
| | | var device = HdlDeviceCommonLogic.Current.GetDevice(historyInfo.DeviceMac, historyInfo.DeviceEpoint);
|
| | | if (device == null)
|
| | | {
|
| | | btnIcon.UnSelectedImagePath = "Device/IntelligentLocks.png";
|
| | | }
|
| | | else
|
| | | {
|
| | | Common.LocalDevice.Current.SetDeviceIconToControl(btnIcon, device);
|
| | | HdlDeviceCommonLogic.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.UnlockIsSuccess == true)
|
| | | //门锁常开模式
|
| | | else if (historyInfo.UnLockMode == 9000)
|
| | | {
|
| | | if (historyInfo.OpenLockMode == 0)
|
| | | //图片
|
| | | btnIcon.UnSelectedImagePath = "Item/NormallyOpen.png";
|
| | | //这里是网关或者门锁自己推送
|
| | | btnMsg.Text = historyInfo.AlarmMsg;
|
| | | }
|
| | | //常开模式手动开启
|
| | | else if (historyInfo.UnLockMode == 9001)
|
| | | {
|
| | | //图片
|
| | | btnIcon.UnSelectedImagePath = "Item/NormallyOpen.png";
|
| | | btnMsg.TextID = R.MyInternationalizationString.uNormallyOpenModeManualOpen;
|
| | | }
|
| | | //常开模式手动取消
|
| | | else if (historyInfo.UnLockMode == 9002)
|
| | | {
|
| | | //图片
|
| | | btnIcon.UnSelectedImagePath = "Item/NormallyOpen.png";
|
| | | btnMsg.TextID = R.MyInternationalizationString.uNormallyOpenModeManualClose;
|
| | | }
|
| | | //常开模式启用{0}小时
|
| | | else if (historyInfo.UnLockMode == 9003)
|
| | | {
|
| | | //图片
|
| | | btnIcon.UnSelectedImagePath = "Item/NormallyOpen.png";
|
| | | btnMsg.Text = Language.StringByID(R.MyInternationalizationString.uNormallyOpenModeOpenSomeTime).Replace("{0}", historyInfo.NormallyOpenContinuedTime);
|
| | | }
|
| | | //常开自动化手动取消
|
| | | else if (historyInfo.UnLockMode == 9004)
|
| | | {
|
| | | //图片
|
| | | btnIcon.UnSelectedImagePath = "Item/NormallyOpen.png";
|
| | | btnMsg.Text = Language.StringByID(R.MyInternationalizationString.uNormallyOpenLogicManualClose);
|
| | | }
|
| | | //开锁成功
|
| | | else if (historyInfo.IsUnlockSuccess == true)
|
| | | {
|
| | | //图片
|
| | | btnIcon.UnSelectedImagePath = "Item/UnLockSuccess.png";
|
| | | //消息
|
| | | if (historyInfo.UnLockMode == 0)
|
| | | {
|
| | | //密码开锁成功
|
| | | btnMsg.TextID = R.MyInternationalizationString.uUnlockByPasswordSuccess;
|
| | | }
|
| | | else if (historyInfo.OpenLockMode == 3)
|
| | | else if (historyInfo.UnLockMode == 3)
|
| | | {
|
| | | //IC卡开锁成功
|
| | | btnMsg.TextID = R.MyInternationalizationString.uUnlockByICcardSuccess;
|
| | | }
|
| | | else if (historyInfo.OpenLockMode == 15)
|
| | | else if (historyInfo.UnLockMode == 13)
|
| | | {
|
| | | //静脉纹开锁成功
|
| | | btnMsg.TextID = R.MyInternationalizationString.uStriaVenosusUnLockSuccess;
|
| | | }
|
| | | else if (historyInfo.UnLockMode == 14)
|
| | | {
|
| | | //人脸识别开锁成功
|
| | | btnMsg.TextID = R.MyInternationalizationString.uFaceRecognitionUnLockSuccess;
|
| | | }
|
| | | else if (historyInfo.UnLockMode == 15)
|
| | | {
|
| | | //指纹开锁成功
|
| | | btnMsg.TextID = R.MyInternationalizationString.uUnlockByFingerPrintSuccess;
|
| | | }
|
| | | }
|
| | | //开锁失败
|
| | | else
|
| | | {
|
| | | if (historyInfo.OpenLockMode == 0)
|
| | | //图片
|
| | | btnIcon.UnSelectedImagePath = "Item/UnLockFail.png";
|
| | | //消息
|
| | | if (historyInfo.UnLockMode == 0)
|
| | | {
|
| | | //密码开锁失败
|
| | | btnMsg.TextID = R.MyInternationalizationString.uUnlockByPasswordFail;
|
| | | }
|
| | | else if (historyInfo.OpenLockMode == 3)
|
| | | else if (historyInfo.UnLockMode == 3)
|
| | | {
|
| | | //IC卡开锁失败
|
| | | btnMsg.TextID = R.MyInternationalizationString.uUnlockByICcardFail;
|
| | | }
|
| | | else if (historyInfo.OpenLockMode == 15)
|
| | | else if (historyInfo.UnLockMode == 13)
|
| | | {
|
| | | //静脉纹开锁失败
|
| | | btnMsg.TextID = R.MyInternationalizationString.uStriaVenosusUnLockFail;
|
| | | }
|
| | | else if (historyInfo.UnLockMode == 14)
|
| | | {
|
| | | //人脸识别开锁失败
|
| | | btnMsg.TextID = R.MyInternationalizationString.uFaceRecognitionUnLockFail;
|
| | | }
|
| | | else if (historyInfo.UnLockMode == 15)
|
| | | {
|
| | | //指纹开锁失败
|
| | | btnMsg.TextID = R.MyInternationalizationString.uUnlockByFingerPrintFail;
|
| | | }
|
| | | }
|
| | |
|
| | | //人物
|
| | | string perName = dicName.ContainsKey(historyInfo.CloudAccountId) == true ? dicName[historyInfo.CloudAccountId] : Language.StringByID(R.MyInternationalizationString.uOther);
|
| | | var btnpersion = 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();
|
| | | }
|
| | | }
|
| | |
|
| | |
| | | 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);
|
| | | dic.Add(listMenberInfo[i].ChildAccountId, listMenberInfo[i].ShowName);
|
| | | }
|
| | | //显示底部类型筛选
|
| | | var form = new DoorLockScreeningTypeForm();
|
| | |
| | | listSearchLockId.Clear();
|
| | | listSearchLockId.AddRange(selectLock);
|
| | | //初始化记录列表
|
| | | this.InitLogListInfo();
|
| | | this.InitLogListInfo(false);
|
| | | };
|
| | | }
|
| | |
|
| | | #endregion
|
| | |
|
| | | #region ■ 获取记录___________________________
|
| | | #region ■ 筛选记录___________________________
|
| | |
|
| | | /// <summary>
|
| | | /// 筛选历史记录
|
| | | /// </summary>
|
| | | /// <returns></returns>
|
| | | private List<DoorHistoryLogInfo> ScreeningHistoryData(Dictionary<string, string> dicMemberName)
|
| | | {
|
| | | //历史记录太麻烦了,存在不同的数据库表里,并且数据还不一样,只能这样一个个判断了
|
| | | var listScreeningData = new List<DoorHistoryLogInfo>();
|
| | | //清除掉之前的记录
|
| | | 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(DoorHistoryLogInfo info, Dictionary<string, string> dicMemberName,
|
| | | bool selectAllUser, bool selectOtherUser, bool slectAllLockMode)
|
| | | {
|
| | | //如果没有选择 全选用户
|
| | | if (selectAllUser == false)
|
| | | {
|
| | | //如果这个用户ID不包含在指定选择的成员列表里面
|
| | | if (this.listSearchUserId.Contains(info.UserId) == false)
|
| | | {
|
| | | if (dicMemberName.ContainsKey(info.UserId) == true)
|
| | | {
|
| | | //如果能够识别这个id的话,则表示它不属于其他类,并且也不再选择目标内
|
| | | return false;
|
| | | }
|
| | | //如果没有选择 其他的话,不显示
|
| | | if (selectOtherUser == false)
|
| | | {
|
| | | return false;
|
| | | }
|
| | | }
|
| | | }
|
| | | //如果是成员身份,并且用户ID不为空
|
| | | if (HdlUserCenterResourse.ResidenceOption.AuthorityNo == 3 && info.UserId != string.Empty)
|
| | | {
|
| | | //成员不能看到 其他人的记录(成员的时候,这个变量里面只有他自己一个)
|
| | | if (dicMemberName.ContainsKey(info.UserId) == false)
|
| | | {
|
| | | return false;
|
| | | }
|
| | | }
|
| | | //如果没有选择 全选开锁方式
|
| | | if (slectAllLockMode == false)
|
| | | {
|
| | | //如果这个开锁方式不在选择的列表里面的话
|
| | | if (this.listSearchLockId.Contains(info.UnLockMode) == false)
|
| | | {
|
| | | return false;
|
| | | }
|
| | | }
|
| | |
|
| | | //另一张表的数据主键
|
| | | if (info.UnLockMode == -1 || info.UnLockMode == 9000)
|
| | | {
|
| | | if (info.MsgKeyId != string.Empty)
|
| | | {
|
| | | //其他消息的主键,它存在另外的一张数据库表中
|
| | | this.listOtherMsgId.Add(info.MsgKeyId);
|
| | | }
|
| | | }
|
| | |
|
| | | return true;
|
| | | }
|
| | |
|
| | | #endregion
|
| | |
|
| | | #region ■ 获取门锁打开记录___________________
|
| | |
|
| | | /// <summary>
|
| | | /// 获取历史记录
|
| | | /// </summary>
|
| | | /// <returns></returns>
|
| | | private async Task<List<HistoryInfo>> GetHistoryLogInfo()
|
| | | private List<DoorHistoryLogInfo> GetHistoryLogInfo(Dictionary<string, string> dicMemberName)
|
| | | {
|
| | | //获取访问云端接口的启动参数
|
| | | var pra = this.GetDbInterfacePra();
|
| | |
|
| | | int nowPage = 0;
|
| | | var listLog = new List<HistoryInfo>();
|
| | | while (true)
|
| | | if (this.listHistoryInfo != null)
|
| | | {
|
| | | //访问云端
|
| | | var result = await UserCenterLogic.GetResponseDataByRequestHttps("DoorLock/GetDoorLockHistoryPager", true, pra);
|
| | | if (result == null)
|
| | | {
|
| | | return null;
|
| | | }
|
| | | var dataInfo = Newtonsoft.Json.JsonConvert.DeserializeObject<GetHistoryDataResult>(result);
|
| | | listLog.AddRange(dataInfo.PageData);
|
| | | if (dataInfo.HasNextPage == false)
|
| | | {
|
| | | break;
|
| | | }
|
| | | //获取下一页
|
| | | nowPage++;
|
| | | pra.PageSetting.Page = nowPage;
|
| | | //不二次获取,主要针对的是筛选功能
|
| | | return this.ScreeningHistoryData(dicMemberName);
|
| | | }
|
| | |
|
| | | var dateFrom = new DateTime(dateFromControl.Year, dateFromControl.Month, dateFromControl.Day, 0, 0, 0);
|
| | | var dateTo = new DateTime(dateToControl.Year, dateToControl.Month, dateToControl.Day, 23, 59, 59);
|
| | |
|
| | | //获取门锁的打开和关闭记录
|
| | | var listAllLog = HdlDeviceDoorLockLogic.Current.GetDoorHistoryLogInfo(this.GetDoorId(), dateFrom, dateTo);
|
| | |
|
| | | //获取门锁的其他记录
|
| | | var listOtherLog = this.GetDoorOtherHistoryLog(dateFrom, dateTo);
|
| | | listAllLog.AddRange(listOtherLog);
|
| | |
|
| | | //排序一下
|
| | | var dic = new Dictionary<string, List<HistoryInfo>>();
|
| | | var listSort = new List<string>();
|
| | | //清空上一次的其他ID
|
| | | this.listOtherId = new List<string>();
|
| | | //是否包含其他
|
| | | bool flage = this.listSearchUserId.Contains("") || this.listSearchUserId.Contains("-1");
|
| | | if (flage == true)
|
| | | {
|
| | | //去获取其他信息
|
| | | var pra2 = new MessageInfoPra();
|
| | | pra2.BeginTime = pra.UnlockTimeBegin;
|
| | | pra2.EndTime = pra.UnlockTimeEnd;
|
| | | 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);
|
| | | foreach (var myInfo in dataInfo2.PageData)
|
| | | {
|
| | | var data = new HistoryInfo();
|
| | | if (dic.ContainsKey(myInfo.CreatedOnUtc) == false)
|
| | | {
|
| | | dic[myInfo.CreatedOnUtc] = new List<HistoryInfo>();
|
| | | listSort.Add(myInfo.CreatedOnUtc);
|
| | | }
|
| | | |
| | | //设备对象
|
| | | var jobject = Newtonsoft.Json.Linq.JObject.Parse(myInfo.PayloadJson);
|
| | | data.DeviceMac = jobject.Value<string>("DeviceAddr");
|
| | | data.DeviceEpoint = jobject.Value<int>("Epoint");
|
| | | //消息
|
| | | var msgInfo = HdlAlarmsLogic.Current.GetDoorLockAlarmInfo(jobject);
|
| | | data.AlarmMsg = msgInfo != null ? msgInfo.AlarmMsg : Language.StringByID(R.MyInternationalizationString.uDoorLocksAlarmHadTriggered);
|
| | | dic[myInfo.CreatedOnUtc].Add(data);
|
| | | //时间
|
| | | data.UnlockTime = myInfo.CreatedOnUtc;
|
| | | var dicAllData = new Dictionary<string, List<DoorHistoryLogInfo>>();
|
| | | var listSortTime = new List<string>();
|
| | |
|
| | | this.listOtherId.Add(myInfo.Id);
|
| | | }
|
| | | }
|
| | | foreach (var data in listLog)
|
| | | foreach (var data in listAllLog)
|
| | | {
|
| | | if (flage == false && string.IsNullOrEmpty(data.CloudAccountId) == true)
|
| | | //按时间分组
|
| | | if (dicAllData.ContainsKey(data.UnlockTime) == false)
|
| | | {
|
| | | //没有指定显示其他
|
| | | continue;
|
| | | dicAllData[data.UnlockTime] = new List<DoorHistoryLogInfo>();
|
| | | listSortTime.Add(data.UnlockTime);
|
| | | }
|
| | | if (dic.ContainsKey(data.UnlockTime) == false)
|
| | | {
|
| | | dic[data.UnlockTime] = new List<HistoryInfo>();
|
| | | listSort.Add(data.UnlockTime);
|
| | | }
|
| | | dic[data.UnlockTime].Add(data);
|
| | | dicAllData[data.UnlockTime].Add(data);
|
| | | }
|
| | |
|
| | | //执行排序,时间大的在前面
|
| | | listSort.Sort();
|
| | | var listSortLog = new List<HistoryInfo>();
|
| | | for (int i = listSort.Count - 1; i >= 0; i--)
|
| | | listSortTime.Sort();
|
| | | this.listHistoryInfo = new List<DoorHistoryLogInfo>();
|
| | | for (int i = listSortTime.Count - 1; i >= 0; i--)
|
| | | {
|
| | | listSortLog.AddRange(dic[listSort[i]]);
|
| | | this.listHistoryInfo.AddRange(dicAllData[listSortTime[i]]);
|
| | | }
|
| | | //筛选历史记录
|
| | | return this.ScreeningHistoryData(dicMemberName);
|
| | | }
|
| | |
|
| | | #endregion
|
| | |
|
| | | #region ■ 获取门锁其他记录___________________
|
| | |
|
| | | /// <summary>
|
| | | /// 获取门锁的其他记录
|
| | | /// </summary>
|
| | | /// <returns></returns>
|
| | | private List<DoorHistoryLogInfo> GetDoorOtherHistoryLog(DateTime beginTime, DateTime endTime)
|
| | | {
|
| | | var listLog = new List<DoorHistoryLogInfo>();
|
| | | //转为utc时间
|
| | | var utcFrom = beginTime.ToUniversalTime();
|
| | | var utcTo = endTime.ToUniversalTime();
|
| | |
|
| | | //去另一张表去获取它的其他消息记录
|
| | | var listMsg = HdlMessageLogic.Current.GetListMessageFromDb();
|
| | | if (listMsg == null)
|
| | | {
|
| | | return listLog;
|
| | | }
|
| | | foreach (var msgInfo in listMsg)
|
| | | {
|
| | | //时间不是13位的都不理
|
| | | if (msgInfo.CreateTime.Length != 13) { continue; }
|
| | | //获取门锁其他类信息上报
|
| | | if (msgInfo.MessageTitle == "/Alarms/SendAlarmInform")
|
| | | {
|
| | | //判断是不是这个时间段
|
| | | var checkDate = HdlCommonLogic.Current.ConvertUtcTimeToLocalTime2(msgInfo.CreateTime);
|
| | | if (utcFrom <= checkDate && checkDate <= utcTo)
|
| | | {
|
| | | this.AdjustDoorOtherAlarmData(ref listLog, msgInfo);
|
| | | }
|
| | | }
|
| | | //从自动化中,获取常开模式记录
|
| | | else if (msgInfo.MessageTitle == "/Logic/Execute_Respon")
|
| | | {
|
| | | //判断是不是这个时间段
|
| | | var checkDate = HdlCommonLogic.Current.ConvertUtcTimeToLocalTime2(msgInfo.CreateTime);
|
| | | if (utcFrom <= checkDate && checkDate <= utcTo)
|
| | | {
|
| | | this.AdjustDoorNormallyOpenData(ref listLog, msgInfo);
|
| | | }
|
| | | }
|
| | | //获取门锁临时密码开锁记录
|
| | | else if (msgInfo.MessageTitle == "/DoorLock/DoorLockOperatingEventNotificationCommand")
|
| | | {
|
| | | //判断是不是这个时间段
|
| | | var checkDate = HdlCommonLogic.Current.ConvertUtcTimeToLocalTime2(msgInfo.CreateTime);
|
| | | if (utcFrom <= checkDate && checkDate <= utcTo)
|
| | | {
|
| | | this.AdjustDoorTemporaryPasswordData(ref listLog, msgInfo);
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | return listSortLog;
|
| | | return listLog;
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 处理门锁常开模式记录信息
|
| | | /// </summary>
|
| | | /// <param name="listLog"></param>
|
| | | /// <param name="i_msgData"></param>
|
| | | private void AdjustDoorOtherAlarmData(ref List<DoorHistoryLogInfo> listLog, MessageRecordInfo i_msgData)
|
| | | {
|
| | | string doorKey = this.GetDoorId();
|
| | | //设备对象
|
| | | var jobject = Newtonsoft.Json.Linq.JObject.Parse(i_msgData.MessageExpand);
|
| | | string deviceAddr = jobject.Value<string>("DeviceAddr");
|
| | | int deviceEpoint = jobject.Value<int>("Epoint");
|
| | | if (doorKey != deviceAddr + "_" + deviceEpoint)
|
| | | {
|
| | | //不是同一个门锁的记录
|
| | | return;
|
| | | }
|
| | |
|
| | | var data = new DoorHistoryLogInfo();
|
| | | 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 = i_msgData.CreateTime;
|
| | | //主键
|
| | | data.MsgKeyId = i_msgData.Id;
|
| | | //消息区分
|
| | | if (msgInfo.MsgDiv == 9000)
|
| | | {
|
| | | data.UnLockMode = 9000;
|
| | | }
|
| | | listLog.Add(data);
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 处理门锁常开模式信息上报
|
| | | /// </summary>
|
| | | /// <param name="listLog"></param>
|
| | | /// <param name="i_msgData"></param>
|
| | | private void AdjustDoorNormallyOpenData(ref List<DoorHistoryLogInfo> listLog, MessageRecordInfo i_msgData)
|
| | | {
|
| | | string doorKey = this.GetDoorId();
|
| | | var jobject = Newtonsoft.Json.Linq.JObject.Parse(i_msgData.MessageExpand);
|
| | | var myActionData = Newtonsoft.Json.JsonConvert.DeserializeObject<LogicPushResult>(jobject["Data"].ToString());
|
| | | if (myActionData.ActionData == null || myActionData.ActionData.Actiontype != 8)
|
| | | {
|
| | | //不是常开模式的自动化
|
| | | return;
|
| | | }
|
| | | string deviceAddr = myActionData.ActionData.MacStr;
|
| | | int deviceEpoint = myActionData.ActionData.Epoint;
|
| | | if (doorKey != deviceAddr + "_" + deviceEpoint)
|
| | | {
|
| | | //不是同一个门锁的记录
|
| | | return;
|
| | | }
|
| | |
|
| | | var data = new DoorHistoryLogInfo();
|
| | | data.DeviceMac = deviceAddr;
|
| | | data.DeviceEpoint = deviceEpoint;
|
| | | //消息
|
| | | if (myActionData.ActionData.PassDataString == "055704010112")
|
| | | {
|
| | | //常开模式开启(自动化触发)
|
| | | data.AlarmMsg = Language.StringByID(R.MyInternationalizationString.uDoorLockAlarmMsg11);
|
| | | }
|
| | | else if (myActionData.ActionData.PassDataString == "055704010113")
|
| | | {
|
| | | //常开模式结束(自动化触发)
|
| | | data.AlarmMsg = Language.StringByID(R.MyInternationalizationString.uDoorLockAlarmMsg12);
|
| | | }
|
| | | else
|
| | | {
|
| | | return;
|
| | | }
|
| | | //时间
|
| | | data.UnlockTime = i_msgData.CreateTime;
|
| | | //主键
|
| | | data.MsgKeyId = i_msgData.Id;
|
| | | //消息区分
|
| | | data.UnLockMode = 9000;
|
| | |
|
| | | listLog.Add(data);
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 处理门锁临时密码上报
|
| | | /// </summary>
|
| | | /// <param name="listLog"></param>
|
| | | /// <param name="i_msgData"></param>
|
| | | private void AdjustDoorTemporaryPasswordData(ref List<DoorHistoryLogInfo> listLog, MessageRecordInfo i_msgData)
|
| | | {
|
| | | string doorKey = this.GetDoorId();
|
| | | var jobject = Newtonsoft.Json.Linq.JObject.Parse(i_msgData.MessageExpand);
|
| | | string deviceAddr = jobject.Value<string>("DeviceAddr");
|
| | | int deviceEpoint = jobject.Value<int>("Epoint");
|
| | | if (doorKey != deviceAddr + "_" + deviceEpoint)
|
| | | {
|
| | | //不是同一个门锁的记录
|
| | | return;
|
| | | }
|
| | | var myActionData = Newtonsoft.Json.JsonConvert.DeserializeObject<PasswordOperationData>(jobject["Data"].ToString());
|
| | | if (myActionData.UserID != 246)
|
| | | {
|
| | | //不是临时密码
|
| | | return;
|
| | | }
|
| | | var data = new DoorHistoryLogInfo();
|
| | | data.DeviceMac = deviceAddr;
|
| | | data.DeviceEpoint = deviceEpoint;
|
| | | //消息
|
| | | if (myActionData.OperationEventCode == 2)
|
| | | {
|
| | | //临时密码开锁成功
|
| | | data.AlarmMsg = Language.StringByID(R.MyInternationalizationString.uDoorLockAlarmMsg13);
|
| | | }
|
| | | else
|
| | | {
|
| | | //临时密码开锁失败
|
| | | data.AlarmMsg = Language.StringByID(R.MyInternationalizationString.uDoorLockAlarmMsg14);
|
| | | }
|
| | | //时间
|
| | | data.UnlockTime = i_msgData.CreateTime;
|
| | | //主键
|
| | | data.MsgKeyId = i_msgData.Id;
|
| | |
|
| | | listLog.Add(data);
|
| | | }
|
| | |
|
| | | #endregion
|
| | |
| | | /// <summary>
|
| | | /// 清空所有记录
|
| | | /// </summary>
|
| | | private async void ClearAllHistoryLog()
|
| | | private void ClearAllHistoryLog()
|
| | | {
|
| | | //获取访问云端接口的启动参数
|
| | | var pra = this.GetDbInterfacePra();
|
| | | 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);
|
| | | //打开进度条
|
| | | this.ShowProgressBar();
|
| | | var result = await UserCenterLogic.GetResultStatuByRequestHttps("DoorLock/ClearDoorLockHistory", true, pra);
|
| | | if (result == false)
|
| | | {
|
| | | return;
|
| | | }
|
| | |
|
| | | //删除其他消息
|
| | | if (listOtherId.Count > 0)
|
| | | {
|
| | | var pra2 = new MessageReadStatuPra();
|
| | | pra2.LoginAccessToken = UserCenterLogic.GetConnectMainToken();
|
| | | for (int i = 0; i < listOtherId.Count; i++)
|
| | | {
|
| | | pra2.Id = listOtherId[i];
|
| | | result = await UserCenterLogic.GetResultStatuByRequestHttps("MessageCenter/DelMessageCenterItem", true, pra2);
|
| | | if (result == false)
|
| | | {
|
| | | return;
|
| | | }
|
| | | }
|
| | | }
|
| | | //关闭进度条
|
| | | this.CloseProgressBar();
|
| | | if (result == false)
|
| | | {
|
| | | return;
|
| | | }
|
| | | this.listView.frameTable.RemoveAll();
|
| | | listView.frameTable.Height = bodyFrameLayout.Height - Application.GetRealHeight(115 - 3);
|
| | | //不管结果
|
| | | var result = HdlDeviceDoorLockLogic.Current.ClearAllDoorHistoryLog(this.GetDoorId(), dateFrom, dateTo, listOtherMsgId);
|
| | |
|
| | | //清空
|
| | | this.listOtherId = new List<string>();
|
| | | this.listOtherMsgId = new List<string>();
|
| | | this.listHistoryInfo = null;
|
| | |
|
| | | HdlThreadLogic.Current.RunMain(() =>
|
| | | {
|
| | | //重新刷新界面
|
| | | this.InitLogListInfo(true);
|
| | | });
|
| | | }
|
| | |
|
| | | #endregion
|
| | |
| | | #region ■ 一般方法___________________________
|
| | |
|
| | | /// <summary>
|
| | | /// 获取访问云端接口的启动参数
|
| | | /// 获取访问云端的DoorID
|
| | | /// </summary>
|
| | | /// <returns></returns>
|
| | | private GetHistoryDataPra GetDbInterfacePra()
|
| | | private string GetDoorId()
|
| | | {
|
| | | 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 = new List<string>();
|
| | | if (listSearchUserId.Count == 1 && listSearchUserId[0] == "")
|
| | | {
|
| | | //如果单纯的只是选择其他,则让检索条件不成立即可
|
| | | listUser.Add("其他");
|
| | | }
|
| | | else if (listSearchUserId.Contains("-1") == true)
|
| | | {
|
| | | //全选
|
| | | for (int i = 0; i < listMenberInfo.Count; i++)
|
| | | {
|
| | | listUser.Add(listMenberInfo[i].SubAccountDistributedMark);
|
| | | }
|
| | | }
|
| | | else
|
| | | {
|
| | | //指定用户
|
| | | listUser.AddRange(listSearchUserId);
|
| | | //移除其他,因为云端固定会给
|
| | | listUser.Remove("");
|
| | | }
|
| | |
|
| | | //全选则为null
|
| | | List<int> listLock = null;
|
| | | if (listSearchLockId.Contains(-1) == false)
|
| | | {
|
| | | listLock = new List<int>();
|
| | | listLock.AddRange(listSearchLockId);
|
| | | }
|
| | |
|
| | | var pra = new GetHistoryDataPra();
|
| | | pra.LoginAccessToken = UserCenterLogic.GetConnectMainToken();
|
| | | pra.DoorLockId = this.DeviceDoor.DeviceAddr + "_" + this.DeviceDoor.DeviceEpoint;
|
| | | pra.CloudAccountIdArr = listUser;
|
| | | pra.OpenLockModeArr = listLock;
|
| | | pra.UnlockTimeBegin = dateFrom.ToUniversalTime().ToString(); |
| | | pra.UnlockTimeEnd = dateTo.ToUniversalTime().ToString();
|
| | | return pra;
|
| | | return this.DeviceDoor.DeviceAddr + "_" + this.DeviceDoor.DeviceEpoint;
|
| | | }
|
| | |
|
| | | #endregion
|
| | |
|
| | | #region ■ 结构体_____________________________
|
| | |
|
| | | /// <summary> |
| | | /// 获取历史记录数据 |
| | | /// </summary> |
| | | private class GetHistoryDataPra : 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>
|
| | | /// 门锁的Mac地址
|
| | | /// </summary>
|
| | | public string DoorLockId = string.Empty;
|
| | | /// <summary>
|
| | | /// Config.Instance.Guid 或者 MemberInfoRes.SubAccountDistributedMark
|
| | | /// </summary>
|
| | | public List<string> CloudAccountIdArr = new List<string>();
|
| | | /// <summary>
|
| | | /// 开锁方式(0:密码、15:指纹、3:IC卡)
|
| | | /// </summary>
|
| | | public List<int> OpenLockModeArr = null;
|
| | | /// <summary>
|
| | | /// 开锁是否成功
|
| | | /// </summary>
|
| | | public bool? UnlockIsSuccess = null;
|
| | | /// <summary>
|
| | | /// 搜索开锁开始时间
|
| | | /// </summary>
|
| | | public string UnlockTimeBegin;
|
| | | /// <summary>
|
| | | /// 搜索开锁结束时间
|
| | | /// </summary>
|
| | | public string UnlockTimeEnd;
|
| | | /// <summary>
|
| | | /// 页数
|
| | | /// </summary>
|
| | | public PageSettingInfo PageSetting = new PageSettingInfo() { PageSize = 100 };
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 获取历史记录的结果
|
| | | /// 临时密码数据
|
| | | /// </summary>
|
| | | private class GetHistoryDataResult
|
| | | private class PasswordOperationData
|
| | | {
|
| | | /// <summary>
|
| | | /// 数据
|
| | | /// 0:密码 15:指纹 3:IC卡
|
| | | /// </summary>
|
| | | public List<HistoryInfo> PageData = null;
|
| | | public int OperationEventSoure = -1;
|
| | | /// <summary>
|
| | | /// 是否存在下一页的数据
|
| | | /// 2:开锁成功
|
| | | /// </summary>
|
| | | public bool HasNextPage = false;
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 历史记录的结果
|
| | | /// </summary>
|
| | | private class HistoryInfo
|
| | | {
|
| | | public int OperationEventCode = -1;
|
| | | /// <summary>
|
| | | /// 开锁方式 0:密码 15:指纹 3:IC卡
|
| | | /// 246代表临时密码
|
| | | /// </summary>
|
| | | public int OpenLockMode = -1;
|
| | | /// <summary>
|
| | | /// 开锁时间
|
| | | /// </summary>
|
| | | public string UnlockTime = string.Empty;
|
| | | /// <summary>
|
| | | /// 开锁是否成功
|
| | | /// </summary>
|
| | | public bool UnlockIsSuccess = false;
|
| | | /// <summary>
|
| | | /// 账号的ID
|
| | | /// </summary>
|
| | | public string CloudAccountId = string.Empty;
|
| | | /// <summary>
|
| | | /// 当开锁方式为-1时使用,它属于其他类
|
| | | /// </summary>
|
| | | public string AlarmMsg = string.Empty;
|
| | | /// <summary>
|
| | | /// 当开锁方式为-1时使用,设备Mac
|
| | | /// </summary>
|
| | | public string DeviceMac = string.Empty;
|
| | | /// <summary>
|
| | | /// 当开锁方式为-1时使用,设备端点
|
| | | /// </summary>
|
| | | public int DeviceEpoint = 0;
|
| | | public int UserID = -1;
|
| | | }
|
| | |
|
| | | #endregion
|