public void RunQueryThread()
        {
            //开启一个线程,不停的获取数据,然后查询数据
            System.Threading.Thread thread =
                new System.Threading.Thread(new System.Threading.ThreadStart(async() => {
                var db      = new ApplicationDbContext();
                var rep     = new PhotoImageRepository(db);
                var service = new UFaceService();
                while (true)
                {
                    var b = false;
                    lock (exitLock)
                    {
                        b = bExit;
                    }
                    if (b)
                    {
                        break;
                    }

                    if (queuePhoto.Count == 0)
                    {
                        System.Threading.Thread.Sleep(10);
                        continue;
                    }

                    PhotoImageQueryItem item = null;
                    lock (queueLock)
                    {
                        item = queuePhoto.Dequeue();
                    }

                    if (item == null)
                    {
                        continue;
                    }

                    try
                    {
                        //查询数据
                        var list = await service.FaceFind(item.Camera, item.PersonID);
                        if (list != null && list.Length > 0)
                        {
                            //找到对应的;然后更新
                            foreach (var v in list)
                            {
                                if (string.Compare(v.faceId, item.FaceID) == 0)
                                {
                                    var photo = new PhotoImage()
                                    {
                                        ID         = item.PhotoImageID,
                                        Feature    = v.feature,
                                        FeatureKey = v.featureKey,
                                    };
                                    rep.UpdateFeature(photo, null);
                                    break;
                                }
                            }
                        }
                    }
                    catch (Exception exp)
                    {
                        System.Diagnostics.Debug.WriteLine(exp);
                    }
                    //
                    System.Threading.Thread.Sleep(10);
                }
            }));
            thread.IsBackground = true;
            thread.Start();
        }
        async Task <PhotoImageQueryItem[]> CreatePersonToCamera(Employee entity, EmployeeCameraRelation c)
        {
            List <PhotoImageQueryItem> list = new List <PhotoImageQueryItem>();
            var ret = await service.personCreate(c.Camera, new Person()
            {
                id = entity.Code, idcardnum = entity.IDCard, name = entity.Name
            });

            if (ret.success)
            {
                try
                {
                    c.PersonID      = ret.data == null ? null : ret.data.id;
                    c.FirstPhotoID  = null;
                    c.SecondPhotoID = null;
                    c.ThirdPhotoID  = null;
                    if (entity.FirstPhoto != null)
                    {
                        var fi = new faceinfo()
                        {
                            faceid      = entity.FirstPhoto.ID.ToString().Replace("-", ""),
                            personid    = c.PersonID,
                            imagebase64 = Utils.Base64Converter.File2String(entity.FirstPhoto.FilePath)
                        };
                        var photo = await service.FaceCreate(c.Camera, fi);

                        if (photo.success)
                        {
                            c.FirstPhotoID = fi.faceid;
                            var item = new PhotoImageQueryItem()
                            {
                                Camera       = c.Camera,
                                PersonID     = c.PersonID,
                                FaceID       = c.FirstPhotoID,
                                PhotoImageID = entity.FirstPhoto.ID,
                            };
                            list.Add(item);
                        }
                        else
                        {
                            throw new Exception(string.Format("上传第一张照片到设备({0})失败", c.Camera.IP));
                        }
                    }
                    if (entity.SecondPhoto != null)
                    {
                        var fi = new faceinfo()
                        {
                            faceid      = entity.SecondPhoto.ID.ToString().Replace("-", ""),
                            personid    = c.PersonID,
                            imagebase64 = Utils.Base64Converter.File2String(entity.SecondPhoto.FilePath)
                        };
                        var photo = await service.FaceCreate(c.Camera, fi);

                        if (photo.success)
                        {
                            c.SecondPhotoID = fi.faceid;
                            var item = new PhotoImageQueryItem()
                            {
                                Camera       = c.Camera,
                                PersonID     = c.PersonID,
                                FaceID       = c.SecondPhotoID,
                                PhotoImageID = entity.SecondPhoto.ID,
                            };
                            list.Add(item);
                        }
                        else
                        {
                            throw new Exception(string.Format("上传第二张照片到设备({0})失败", c.Camera.IP));
                        }
                    }
                    if (entity.ThirdPhoto != null)
                    {
                        var fi = new faceinfo()
                        {
                            faceid      = entity.ThirdPhoto.ID.ToString().Replace("-", ""),
                            personid    = c.PersonID,
                            imagebase64 = Utils.Base64Converter.File2String(entity.ThirdPhoto.FilePath)
                        };
                        var photo = await service.FaceCreate(c.Camera, fi);

                        if (photo.success)
                        {
                            c.ThirdPhotoID = fi.faceid;
                            var item = new PhotoImageQueryItem()
                            {
                                Camera       = c.Camera,
                                PersonID     = c.PersonID,
                                FaceID       = c.ThirdPhotoID,
                                PhotoImageID = entity.ThirdPhoto.ID,
                            };
                            list.Add(item);
                        }
                        else
                        {
                            throw new Exception(string.Format("上传第三张照片到设备({0})失败", c.Camera.IP));
                        }
                    }

                    c.Status = 1;
                }
                catch (Exception exp)
                {
                    System.Diagnostics.Debug.WriteLine(exp);
                    throw exp;
                }
                //
            }

            return(list.ToArray());
        }