Beispiel #1
0
        protected void GetBorrowUserInfo()
        {
            if (ProjectId != null && ProjectId != Guid.Empty)
            {
                string sql = @"select b.Id as UserId, b.Birthday, b.TelNo, b.sex, b.AddDate, b.NickName, b.BankCity, b.CreditRatingName,b.UserTypeId,b.RealName, a.Type as ProjectType from Project a
                               inner join UserBasicInfo b with(nolock)  on b.Id=a.UserId
                               where a.Id=@projectId ";
                Dapper.DynamicParameters dyParams = new Dapper.DynamicParameters();
                dyParams.Add("@projectId", ProjectId);
                borrowerUserInfo = PublicConn.QuerySingle <BorrowUserInfo>(sql, ref dyParams);
                if (borrowerUserInfo == null)
                {
                    borrowerUserInfo = new BorrowUserInfo();
                }

                string phone = borrowerUserInfo.TelNo.ToText();
                if (!phone.IsEmpty())
                {
                    if (phone.Length > 11)
                    {
                        phone = phone.Left(11);
                    }
                }
                borrowerUserInfo.TelNo = phone;

                SimpleUserExt userBasicInfo_Ext = null;
                dyParams = new Dapper.DynamicParameters();
                dyParams.Add("@userid", borrowerUserInfo.UserId);
                sql = @"select Marriage,Graduation,IsHasChildren, IsHaveHouse,IsHaveCar,Address from t_UserBasicInfo_Ext with(nolock) where UserId=@userid";
                userBasicInfo_Ext = PublicConn.QuerySingle <SimpleUserExt>(sql, ref dyParams);

                if (userBasicInfo_Ext != null)
                {
                    borrowerUserInfo.Marriage   = userBasicInfo_Ext.Marriage;
                    borrowerUserInfo.Graduation = userBasicInfo_Ext.Graduation;
                    if (userBasicInfo_Ext.IsHasChildren == true)
                    {
                        borrowerUserInfo.IsHasChildren = "有";
                    }
                    else
                    {
                        borrowerUserInfo.IsHasChildren = "否";
                    }
                    borrowerUserInfo.IsHasHouse = userBasicInfo_Ext.IsHaveHouse ? "有" : "无";
                    if (borrowerUserInfo.BankCity.IsEmpty())
                    {
                        borrowerUserInfo.BankCity = StringHandler.MaskStarPre3(userBasicInfo_Ext.Address);
                    }
                }
                //是否项目集标的
                if (borrowerUserInfo.ProjectType.ToString().IsIn("24", "25", "27", "28", "29", "31", "33"))
                {
                    Fq_ItemSetsProjectInfo fq_ItemSetsProjectInfo = new fq_ItemSetsProjectBLL().GetFqItemSetsProjectInfoByPorjectId(ProjectId);
                    if (fq_ItemSetsProjectInfo != null)
                    {
                        borrowerUserInfo.BankCity   = StringHandler.MaskStartPre(Tool.WebFormHandler.CutString(fq_ItemSetsProjectInfo.Address, 6), 3);
                        borrowerUserInfo.Industry   = StringHandler.MaskStartPre(fq_ItemSetsProjectInfo.CompanyIndustryTypeId, 6);
                        borrowerUserInfo.Salary     = fq_ItemSetsProjectInfo.MonthlyIncome + "元";
                        borrowerUserInfo.IsHasHouse = fq_ItemSetsProjectInfo.IsHaveHouse ? "有" : "无";
                        borrowerUserInfo.Graduation = fq_ItemSetsProjectInfo.Education;
                        borrowerUserInfo.Marriage   = fq_ItemSetsProjectInfo.MarrayStatus ? "已婚" : "未婚";
                    }
                }
                if (borrowerUserInfo.ProjectType >= 39)
                {
                    sql      = "select ext from dbo.Project_Common where ProjectId=@ProjectId";
                    dyParams = new Dapper.DynamicParameters();
                    dyParams.Add("@ProjectId", ProjectId);
                    string ext = PublicConn.QuerySingle <string>(sql, ref dyParams);
                    if (ext.IsNotEmpty())
                    {
                        var borrowExtInfo = JsonConvert.DeserializeObject <BorrowExtInfo>(ext);
                        if (borrowExtInfo != null)
                        {
                            borrowerUserInfo.Marriage   = borrowExtInfo.marriage;
                            borrowerUserInfo.Graduation = borrowExtInfo.education;
                            borrowerUserInfo.IsHasHouse = borrowExtInfo.housingSituation.IsEmpty() ? "无" : borrowExtInfo.housingSituation;
                            borrowerUserInfo.BankCity   = borrowExtInfo.city;
                        }
                    }
                }

                //查询借款人合规表信息
                string strSQL = "select * from BorrowerComplianceInfo with(nolock) where ProjectId=@projectId";
                dyParams = new Dapper.DynamicParameters();
                dyParams.Add("@projectId", ProjectId);
                PageBorrowerComplianceInfo compInfo = PublicConn.QuerySingle <PageBorrowerComplianceInfo>(strSQL, ref dyParams);
                if (compInfo != null)
                {
                    borrowerUserInfo.IsShowExt = "1";
                    borrowerUserInfo.Industry  = compInfo.Trade;
                    if (compInfo.CompanyName.IsNotEmpty())
                    {
                        borrowerUserInfo.RealName = StringHandler.MaskStartPre(compInfo.CompanyName, 1);
                    }
                    borrowerUserInfo.Salary        = compInfo.IncomePerMonth.ToText() == "" ? "无" : compInfo.IncomePerMonth;
                    borrowerUserInfo.CurrentDebts  = compInfo.CurrentDebt.IsEmpty() ? "无" : compInfo.CurrentDebt;
                    borrowerUserInfo.OtherBorrow   = compInfo.OtherPlatformsBorrow.IsEmpty() ? "无" : compInfo.OverdueSituation;
                    borrowerUserInfo.CreditOverDue = compInfo.OverdueSituation.IsEmpty() ? "无" : compInfo.OtherPlatformsBorrow;
                    borrowerUserInfo.RegAmount     = compInfo.RegisteredCapital.IsEmpty() ? "无" : compInfo.RegisteredCapital;
                    borrowerUserInfo.RegAddress    = compInfo.RegisteredAddress.IsEmpty() ? "无" : StringHandler.MaskStartPre(compInfo.RegisteredAddress, 6);
                    borrowerUserInfo.RegDate       = compInfo.EstablishedTime.ToString("yyyy年MM月dd日");
                    borrowerUserInfo.LegalName     = compInfo.LegalPerson.IsEmpty() ? "无" : StringHandler.MaskStartPre(compInfo.LegalPerson, 1);
                }
            }
            else
            {
                borrowerUserInfo = new BorrowUserInfo();
            }
        }