| | |
| | |
|
| | | #endregion
|
| | |
|
| | | #region ■ 获取记录___________________________
|
| | | #region ■ 获取门锁打开记录___________________
|
| | |
|
| | | /// <summary>
|
| | | /// 获取历史记录
|
| | |
| | | return null;
|
| | | }
|
| | | var dataInfo = Newtonsoft.Json.JsonConvert.DeserializeObject<GetHistoryDataResult>(result);
|
| | | listLog.AddRange(dataInfo.PageData);
|
| | | foreach (var data in dataInfo.PageData)
|
| | | {
|
| | | //不知道为什么会有上报了虚拟9000的那个特殊的东西
|
| | | if (data.OpenLockMode == 9000 && data.OtherOpenLockMode <= 9000)
|
| | | {
|
| | | continue;
|
| | | }
|
| | | listLog.Add(data);
|
| | | }
|
| | |
|
| | | if (dataInfo.HasNextPage == false)
|
| | | {
|
| | |
| | | return listLog;
|
| | | }
|
| | |
|
| | | #endregion
|
| | |
|
| | | #region ■ 获取门锁其他记录___________________
|
| | |
|
| | | /// <summary>
|
| | | /// 获取门锁的其他记录
|
| | | /// </summary>
|
| | |
| | | {
|
| | | var listLog = new List<HistoryInfo>();
|
| | |
|
| | | //去获取其他信息
|
| | | //获取门锁其他类信息上报
|
| | | var pra2 = new MessageInfoPra();
|
| | | pra2.BeginTime = beginTime;
|
| | | pra2.EndTime = endTime;
|
| | |
| | | {
|
| | | return null;
|
| | | }
|
| | | this.AdjustDoorOtherAlarmData(ref listLog, result);
|
| | |
|
| | | //从自动化中,获取常开模式记录
|
| | | pra2.Topic = "/Logic/Execute_Respon";
|
| | | result = await UserCenterLogic.GetResponseDataByRequestHttps("MessageCenter/GetMessageCenterPagger", true, pra2);
|
| | | if (result == null)
|
| | | {
|
| | | return null;
|
| | | }
|
| | | this.AdjustDoorNormallyOpenData(ref listLog, result);
|
| | |
|
| | | //获取门锁临时密码开锁记录
|
| | | pra2.Topic = "/DoorLock/DoorLockOperatingEventNotificationCommand";
|
| | | result = await UserCenterLogic.GetResponseDataByRequestHttps("MessageCenter/GetMessageCenterPagger", true, pra2);
|
| | | if (result == null)
|
| | | {
|
| | | return null;
|
| | | }
|
| | | this.AdjustDoorTemporaryPasswordData(ref listLog, result);
|
| | |
|
| | | return listLog;
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 处理门锁常开模式记录信息
|
| | | /// </summary>
|
| | | /// <param name="listLog"></param>
|
| | | /// <param name="result"></param>
|
| | | private void AdjustDoorOtherAlarmData(ref List<HistoryInfo> listLog, string result)
|
| | | {
|
| | | var dataInfo2 = Newtonsoft.Json.JsonConvert.DeserializeObject<MessageCentetInfo>(result);
|
| | | string doorKey = this.DeviceDoor.DeviceAddr + "_" + this.DeviceDoor.DeviceEpoint;
|
| | | string doorKey = this.DeviceDoor.DeviceAddr + "_200";
|
| | | foreach (var myInfo in dataInfo2.PageData)
|
| | | {
|
| | | //设备对象
|
| | |
| | | }
|
| | | listLog.Add(data);
|
| | | }
|
| | | }
|
| | |
|
| | | return listLog;
|
| | | /// <summary>
|
| | | /// 处理门锁常开模式信息上报
|
| | | /// </summary>
|
| | | /// <param name="listLog"></param>
|
| | | /// <param name="result"></param>
|
| | | private void AdjustDoorNormallyOpenData(ref List<HistoryInfo> listLog, string result)
|
| | | {
|
| | | var dataInfo2 = Newtonsoft.Json.JsonConvert.DeserializeObject<MessageCentetInfo>(result);
|
| | | string doorKey = this.DeviceDoor.DeviceAddr + "_200";
|
| | | foreach (var myInfo in dataInfo2.PageData)
|
| | | {
|
| | | var jobject = Newtonsoft.Json.Linq.JObject.Parse(myInfo.PayloadJson);
|
| | | var myActionData = Newtonsoft.Json.JsonConvert.DeserializeObject<LogicPushResult>(jobject["Data"].ToString());
|
| | | if (myActionData.ActionData == null || myActionData.ActionData.Actiontype != 8)
|
| | | {
|
| | | //不是常开模式的自动化
|
| | | continue;
|
| | | }
|
| | | string deviceAddr = myActionData.ActionData.MacStr;
|
| | | int deviceEpoint = myActionData.ActionData.Epoint;
|
| | | if (doorKey != deviceAddr + "_" + deviceEpoint)
|
| | | {
|
| | | //不是同一个门锁的记录
|
| | | continue;
|
| | | }
|
| | |
|
| | | var data = new HistoryInfo();
|
| | | 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
|
| | | {
|
| | | continue;
|
| | | }
|
| | | //时间
|
| | | data.UnlockTime = myInfo.CreatedOnUtc;
|
| | | //主键
|
| | | data.MsgKeyId = myInfo.Id;
|
| | | //消息区分
|
| | | data.OpenLockMode = 9000;
|
| | |
|
| | | listLog.Add(data);
|
| | | }
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 处理门锁临时密码上报
|
| | | /// </summary>
|
| | | /// <param name="listLog"></param>
|
| | | /// <param name="result"></param>
|
| | | private void AdjustDoorTemporaryPasswordData(ref List<HistoryInfo> listLog, string result)
|
| | | {
|
| | | var dataInfo2 = Newtonsoft.Json.JsonConvert.DeserializeObject<MessageCentetInfo>(result);
|
| | | string doorKey = this.DeviceDoor.DeviceAddr + "_200";
|
| | | 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)
|
| | | {
|
| | | //不是同一个门锁的记录
|
| | | continue;
|
| | | }
|
| | | var myActionData = Newtonsoft.Json.JsonConvert.DeserializeObject<PasswordOperationData>(jobject["Data"].ToString());
|
| | | if (myActionData.UserID != 246)
|
| | | {
|
| | | //不是临时密码
|
| | | continue;
|
| | | }
|
| | | var data = new HistoryInfo();
|
| | | 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 = myInfo.CreatedOnUtc;
|
| | | //主键
|
| | | data.MsgKeyId = myInfo.Id;
|
| | |
|
| | | listLog.Add(data);
|
| | | }
|
| | | }
|
| | |
|
| | | #endregion
|
| | |
| | | pra.UnlockTimeBegin = dateFrom.ToUniversalTime().ToString();
|
| | | pra.UnlockTimeEnd = dateTo.ToUniversalTime().ToString();
|
| | | pra.LoginAccessToken = UserCenterLogic.GetConnectMainToken();
|
| | | pra.DoorLockId = this.DeviceDoor.DeviceAddr + "_" + this.DeviceDoor.DeviceEpoint;
|
| | | pra.DoorLockId = this.DeviceDoor.DeviceAddr + "_200";
|
| | |
|
| | | return pra;
|
| | | }
|
| | |
| | | pra.UnlockTimeBegin = dateFrom.ToUniversalTime().ToString();
|
| | | pra.UnlockTimeEnd = dateTo.ToUniversalTime().ToString();
|
| | | pra.LoginAccessToken = UserCenterLogic.GetConnectMainToken();
|
| | | pra.DoorLockId = this.DeviceDoor.DeviceAddr + "_" + this.DeviceDoor.DeviceEpoint;
|
| | | pra.DoorLockId = this.DeviceDoor.DeviceAddr + "_200";
|
| | | pra.CloudAccountIds = listUser;
|
| | | pra.OpenLockModes = listLock;
|
| | |
|
| | |
| | | public string MsgKeyId = string.Empty;
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 临时密码数据
|
| | | /// </summary>
|
| | | private class PasswordOperationData
|
| | | {
|
| | | /// <summary>
|
| | | /// 0:密码 15:指纹 3:IC卡
|
| | | /// </summary>
|
| | | public int OperationEventSoure = -1;
|
| | | /// <summary>
|
| | | /// 2:开锁成功
|
| | | /// </summary>
|
| | | public int OperationEventCode = -1;
|
| | | /// <summary>
|
| | | /// 246代表临时密码
|
| | | /// </summary>
|
| | | public int UserID = -1;
|
| | | }
|
| | |
|
| | | #endregion
|
| | | }
|
| | | }
|