Пример #1
0
        public ActionResult IdentityVerification(int placeId)
        {
            IPropertyPlaceBLL propertyPlaceBll = BLLFactory <IPropertyPlaceBLL> .GetBLL("PropertyPlaceBLL");

            var place = propertyPlaceBll.GetEntity(u => u.Id == placeId && u.DelFlag == ConstantParam.DEL_FLAG_DEFAULT);

            if (place == null)
            {
                return(RedirectToAction("Index"));
            }
            PlaceIdentityVerifyModel verifyModel = new PlaceIdentityVerifyModel();

            verifyModel.PlaceId   = placeId;
            verifyModel.PlaceName = place.Name;
            verifyModel.PlaceType = place.PlaceType;
            verifyModel.BuildList = GetBuildList(placeId);
            verifyModel.UnitList  = new List <SelectListItem>();
            verifyModel.DoorList  = new List <SelectListItem>();

            verifyModel.BuildCompanyList = GetBuildCompanyList(placeId);
            return(View(verifyModel));
        }
Пример #2
0
        public JsonResult IdentityVerification(PlaceIdentityVerifyModel model)
        {
            JsonModel jm    = new JsonModel();
            var       owner = GetCurrentUser();

            //获取要绑定验证的小区
            IPropertyPlaceBLL propertyPlaceBll = BLLFactory <IPropertyPlaceBLL> .GetBLL("PropertyPlaceBLL");

            var place = propertyPlaceBll.GetEntity(u => u.Id == model.PlaceId && u.DelFlag == ConstantParam.DEL_FLAG_DEFAULT);

            if (place == null)
            {
                jm.Msg = "小区已不存在";
                return(Json(jm, JsonRequestBehavior.AllowGet));
            }

            IPropertyIdentityVerificationBLL identityVerificationBll = BLLFactory <IPropertyIdentityVerificationBLL> .GetBLL("PropertyIdentityVerificationBLL");

            //如果小区类型为住宅小区
            if (place.PlaceType == ConstantParam.PLACE_TYPE_HOUSE)
            {
                //判断验证码是否正确
                IPhoneValidateBLL phoneValidateBll = BLLFactory <IPhoneValidateBLL> .GetBLL("PhoneValidateBLL");

                var val = phoneValidateBll.GetEntity(v => v.PhoneNum == model.Phone && v.ActionCode == 2);
                //判断验证码不准确
                if (val == null || model.VerityCode != val.ValidateCode)
                {
                    jm.Msg = APIMessage.VALIDATE_ERROR;
                    return(Json(jm, JsonRequestBehavior.AllowGet));
                }
                //验证码已失效
                if (val.InvalidTime < DateTime.Now)
                {
                    jm.Msg = APIMessage.VALIDATE_INVALID;
                    return(Json(jm, JsonRequestBehavior.AllowGet));
                }

                var identityVerification = identityVerificationBll.GetEntity(i => i.AppUserId == owner.Id && i.BuildDoor.BuildUnit.Build.PropertyPlaceId == place.Id);
                if (identityVerification != null)
                {
                    //如果存在审核中或已通过的验证信息
                    if (identityVerification.IsVerified != 2)
                    {
                        jm.Msg = APIMessage.VerifingOrYES;
                        return(Json(jm, JsonRequestBehavior.AllowGet));
                    }
                    else
                    {
                        identityVerification.DoorId = model.DoorId;
                        identityVerification.Name   = model.OwnerName;
                        identityVerification.Phone  = model.Phone;
                        //如果该小区不需要审批身份
                        if (place.IsValidate == 1)
                        {
                            identityVerification.IsVerified = ConstantParam.IsVerified_YES;
                        }
                        else
                        {
                            identityVerification.IsVerified = ConstantParam.IsVerified_DEFAULT;
                        }
                        //更新验证申请
                        identityVerificationBll.Update(identityVerification);
                    }
                }
                else
                {
                    identityVerification = new R_PropertyIdentityVerification()
                    {
                        AppUserId = owner.Id,
                        Name      = model.OwnerName,
                        Phone     = model.Phone,
                        DoorId    = model.DoorId,
                    };
                    //如果该小区不需要审批身份
                    if (place.IsValidate == 1)
                    {
                        identityVerification.IsVerified = ConstantParam.IsVerified_YES;
                    }
                    else
                    {
                        identityVerification.IsVerified = ConstantParam.IsVerified_DEFAULT;
                    }
                    //保存验证申请
                    identityVerificationBll.Save(identityVerification);
                }
            }
            //如果小区是办公楼小区
            else
            {
                var identityVerification = identityVerificationBll.GetEntity(i => i.AppUserId == owner.Id && i.BuildCompany.PropertyPlaceId == place.Id);
                if (identityVerification != null)
                {
                    //如果存在审核中或已通过的验证信息
                    if (identityVerification.IsVerified != 2)
                    {
                        jm.Msg = APIMessage.VerifingOrYES;
                        return(Json(jm, JsonRequestBehavior.AllowGet));
                    }
                    else
                    {
                        identityVerification.BuildCompanyId = model.DoorId;
                        identityVerification.Phone          = model.Phone;
                        //如果该小区不需要审批身份
                        if (place.IsValidate == 1)
                        {
                            identityVerification.IsVerified = ConstantParam.IsVerified_YES;
                        }
                        else
                        {
                            identityVerification.IsVerified = ConstantParam.IsVerified_DEFAULT;
                        }
                        //更新验证申请
                        identityVerificationBll.Update(identityVerification);
                    }
                }
                else
                {
                    identityVerification = new R_PropertyIdentityVerification()
                    {
                        AppUserId      = owner.Id,
                        Phone          = model.Phone,
                        BuildCompanyId = model.DoorId,
                    };
                    //如果该小区不需要审批身份
                    if (place.IsValidate == 1)
                    {
                        identityVerification.IsVerified = ConstantParam.IsVerified_YES;
                    }
                    else
                    {
                        identityVerification.IsVerified = ConstantParam.IsVerified_DEFAULT;
                    }
                    //保存验证申请
                    identityVerificationBll.Save(identityVerification);
                }
            }
            return(Json(jm, JsonRequestBehavior.AllowGet));
        }