예제 #1
0
        /// <summary>
        /// <see cref="IDoorControlService.GetEventList(Request.DoorEventQueryRequest)"/>
        /// </summary>
        public async Task <ListBaseResponse <Dto.DoorEventQueryResponse> > GetEventList(
            Request.DoorEventQueryRequest request)
        {
            var data = await _doorControlApi.AppendFormatToHik("/api/acs/v1/door/events")
                       .SetHiKSecreity()
                       .PostAsync(request)
                       .ReciveJsonResultAsync <HikVisionResponse <ListBaseResponse <DoorEventQueryResponse> > >();

            return(data?.Data);
        }
예제 #2
0
        /// <summary>
        /// <see cref="IDoorControlService.GetEventList(Request.DoorEventQueryRequest)"/>
        /// </summary>
        public async Task <ListBaseResponse <Dto.DoorEventQueryResponse> > GetEventList(
            Request.DoorEventQueryRequest request)
        {
            var data = await _hikHttp.PostAsync <HikVisionResponse <ListBaseResponse <DoorEventQueryResponse> > >("/api/acs/v1/door/events", new
            {
                startTime      = request.StartTime.GetTimeIosFormatter(),
                endTime        = request.EndTime.GetTimeIosFormatter(),
                personIds      = request.PersonIds?.Count > 0 ? request.PersonIds : new List <string>(),
                doorIndexCodes = request.DoorIndexCodes?.Count > 0 ? request.DoorIndexCodes : new List <string>(),
                pageNo         = request.PageNo,
                pageSize       = request.PageSize
            });

            var list = data?.Data;

            if (list?.List?.Count > 0)
            {
                List <string> personIds = list.List.Where(o => !string.IsNullOrWhiteSpace(o.PersonId)).Select(o => o.PersonId).ToList();
                var           userInfos = await _userService.GetDetailV2(personIds);

                foreach (var item in list.List)
                {
                    if (!string.IsNullOrWhiteSpace(item.OrgIndexCode))
                    {
                        var orgInfo = await _organizeService.GetList(new OrganizeRequest()
                        {
                            OrgIndexCodes = new List <string>()
                            {
                                item.OrgIndexCode
                            },
                            PageNo   = 1,
                            PageSize = 10
                        });

                        item.OrgName = orgInfo?.List?.FirstOrDefault()?.OrgName;
                    }

                    if (!string.IsNullOrWhiteSpace(item.PersonId))
                    {
                        var detail = userInfos?.FirstOrDefault(o => o.PersonId.Equals(item.PersonId));
                        item.PersonJobNo = detail?.JobNo;
                        item.PersonPhone = detail?.PhoneNo;
                    }
                }
            }
            return(list);
        }