Beispiel #1
0
        public JsonResult PassOwnerMgr(int id)
        {
            JsonModel jm = new JsonModel();

            if (ModelState.IsValid)
            {
                IPropertyIdentityVerificationBLL propertyIdentityVerificationBll = BLLFactory <IPropertyIdentityVerificationBLL> .GetBLL("PropertyIdentityVerificationBLL");

                //获取要审批的业主信息
                var propertyIdentityVerification = propertyIdentityVerificationBll.GetEntity(m => m.Id == id);

                if (propertyIdentityVerification != null)
                {
                    //修改状态
                    propertyIdentityVerification.IsVerified = ConstantParam.IsVerified_YES;

                    //保存到数据库
                    propertyIdentityVerificationBll.Update(propertyIdentityVerification);

                    IUserPushBLL userPushBll = BLLFactory <IUserPushBLL> .GetBLL("UserPushBLL");

                    var userPush = userPushBll.GetEntity(u => u.UserId == propertyIdentityVerification.AppUserId);

                    if (userPush != null)
                    {
                        //设备Id
                        var registrationId = userPush.RegistrationId;

                        //通知消息
                        string alert = "尊敬的住户,您的身份已通过验证,开始体验新功能吧";
                        bool   flag  = PropertyUtils.SendPush("审批业主信息", alert, ConstantParam.MOBILE_TYPE_OWNER, registrationId);

                        if (!flag)
                        {
                            jm.Msg = "推送发生异常";
                        }
                    }

                    //记录日志
                    jm.Content = PropertyUtils.ModelToJsonString(userPush);
                }
                else
                {
                    jm.Msg = "该业主信息不存在";
                }
            }
            else
            {
                jm.Msg = ConstantParam.JSON_RESULT_MODEL_CHECK_ERROR;
            }

            return(Json(jm, JsonRequestBehavior.AllowGet));
        }
Beispiel #2
0
        /// <summary>
        /// 删除绑定的小区
        /// </summary>
        /// <param name="id">小区ID</param>
        /// <returns></returns>
        public JsonResult DelPlace(int id)
        {
            JsonModel jm = new JsonModel();

            try
            {
                var owner = GetCurrentUser();
                IPropertyPlaceBLL placeBll = BLLFactory <IPropertyPlaceBLL> .GetBLL("PropertyPlaceBLL");

                var place = placeBll.GetEntity(p => p.Id == id && p.DelFlag == ConstantParam.DEL_FLAG_DEFAULT);

                //如果该用户要删除的小区不存在
                if (place == null || owner.UserPlaces.Count(up => up.PropertyPlaceId == place.Id) <= 0)
                {
                    jm.Msg = "该用户未绑定该小区";
                }
                else
                {
                    //删除拥有小区的验证
                    IPropertyIdentityVerificationBLL identityVerificationBll = BLLFactory <IPropertyIdentityVerificationBLL> .GetBLL("PropertyIdentityVerificationBLL");

                    if (place.PlaceType == ConstantParam.PLACE_TYPE_HOUSE)
                    {
                        var identityVerification = identityVerificationBll.GetEntity(v => v.AppUserId == owner.Id && v.DoorId != null && v.BuildDoor.BuildUnit.Build.PropertyPlaceId == place.Id);
                        if (identityVerification != null)
                        {
                            identityVerificationBll.Delete(identityVerification);
                        }
                    }
                    else
                    {
                        var identityVerification = identityVerificationBll.GetEntity(v => v.AppUserId == owner.Id && v.BuildCompanyId != null && v.BuildCompany.PropertyPlaceId == place.Id);
                        if (identityVerification != null)
                        {
                            identityVerificationBll.Delete(identityVerification);
                        }
                    }
                    //删除拥有的小区
                    IUserBLL ownerBll = BLLFactory <IUserBLL> .GetBLL("UserBLL");

                    ownerBll.ExecuteSql("delete from R_UserPlace where UserId=" + owner.Id + " and PropertyPlaceId=" + id);
                }
            }
            catch
            {
                jm.Msg = "删除发生异常";
            }

            return(Json(jm, JsonRequestBehavior.AllowGet));
        }
Beispiel #3
0
        public ActionResult ApprovalOwnerList(ApprovalOwnerModel model)
        {
            //获取当前小区
            var propertyPlaceId = GetSessionModel().PropertyPlaceId.Value;

            //状态下来列表
            model.IsVerifiedList = GetIsVerifiedList();

            Expression <Func <R_PropertyIdentityVerification, bool> > where = u => u.BuildCompany.PropertyPlaceId == propertyPlaceId || u.BuildDoor.BuildUnit.Build.PropertyPlaceId == propertyPlaceId;

            //根据状态名称查询
            if (model.IsVerified != null)
            {
                where = PredicateBuilder.And(where, u => u.IsVerified == model.IsVerified);
            }

            //根据姓名进行查询
            if (!string.IsNullOrEmpty(model.Name))
            {
                where = Property.Common.PredicateBuilder.And(where, u => u.Name.Contains(model.Name));
            }

            //楼座 单元 单元户信息查询
            if (!string.IsNullOrEmpty(model.Kword))
            {
                IPropertyPlaceBLL placeBLL = BLLFactory <IPropertyPlaceBLL> .GetBLL("PropertyPlaceBLL");

                var place = placeBLL.GetEntity(p => p.Id == propertyPlaceId);
                if (place.PlaceType == ConstantParam.PLACE_TYPE_HOUSE)
                {
                    where = PredicateBuilder.And(where, u => u.BuildDoor.DoorName.Contains(model.Kword) ||
                                                 u.BuildDoor.BuildUnit.Build.BuildName.Contains(model.Kword) ||
                                                 u.BuildDoor.BuildUnit.UnitName.Contains(model.Kword));
                }
                else if (place.PlaceType == ConstantParam.PLACE_TYPE_COMPANY)
                {
                    where = PredicateBuilder.And(where, u => u.BuildCompany.Name.Contains(model.Kword));
                }
            }

            //获取要审批业主信息的分页数据
            IPropertyIdentityVerificationBLL propertyIdentityVerificationBll = BLLFactory <IPropertyIdentityVerificationBLL> .GetBLL("PropertyIdentityVerificationBLL");

            var sortName = this.SettingSorting("Id", false);

            model.DataList = propertyIdentityVerificationBll.GetPageList(where, sortName.SortName, sortName.IsAsc, model.PageIndex) as PagedList <R_PropertyIdentityVerification>;
            return(View(model));
        }
Beispiel #4
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));
        }