public static decimal FC20152(DBMA1DataContext dbma1, string userSN) { //vip等级设置 A029 a029 = dbma1.A029s.First(); string a029Str = C101.FC10107(a029); //当前成长值 decimal currentGroupValue = Convert.ToInt32(dbma1.F006s.Where(c => c.userSN == userSN).Sum(c => c.groupUpValue)); //当前vip等级及奖励率 decimal rewardRate; if (currentGroupValue < a029.vip1_originateValue) { rewardRate = 0; } else if (currentGroupValue < a029.vip2_originateValue) { rewardRate = a029.vip1_rewardRate; } else if (currentGroupValue < a029.vip3_originateValue) { rewardRate = a029.vip2_rewardRate; } else if (currentGroupValue < a029.vip4_originateValue) { rewardRate = a029.vip3_rewardRate; } else if (currentGroupValue < a029.vip5_originateValue) { rewardRate = a029.vip4_rewardRate; } else if (currentGroupValue < a029.vip6_originateValue) { rewardRate = a029.vip5_rewardRate; } else if (currentGroupValue < a029.vip7_originateValue) { rewardRate = a029.vip6_rewardRate; } else { rewardRate = a029.vip7_rewardRate; } return(rewardRate); }
/// <summary> /// 获取融资方全部信息 /// </summary> public static string FC20143(string financierUserSN) { using (DBMA1DataContext dbma1 = new DBMA1DataContext()) { //案例情况 var caseStatus = dbma1.P102s.Where(c => c.financierUserSN == financierUserSN); int caseAmount = caseStatus.Count(); decimal?caseMoneyAmount = caseAmount == 0 ? 0 : caseStatus.Sum(c => c.investMoneyAmount); //当前债务情况 var debtStatus = dbma1.P102s.Where(c => c.financierUserSN == financierUserSN && c.closeCaseDate == null); int debtAmount = debtStatus.Count(); decimal?debtMoneyAmount = debtAmount == 0 ? 0 : debtStatus.Sum(c => c.investMoneyAmount); //当前逾期情况 var currentOverdueStatus = from c in dbma1.P102s where c.financierUserSN == financierUserSN && c.closeCaseDate == null && DateTime.Now > c.deadlineDate select c; int currentOverdueAmount = currentOverdueStatus.Count(); decimal?currentOverdueMoneyAmount = currentOverdueAmount == 0 ? 0 : currentOverdueStatus.Sum(c => c.investMoneyAmount); //历史逾期数量 var historyOverdueStatus = from c in dbma1.P102s from p in c.P103s where c.financierUserSN == financierUserSN && c.deadlineDate < p.repayDate && c.investSN == p.investSN select c; int historyOverdueAmount = historyOverdueStatus.Count(); //注册时间 DateTime regDatetime = dbma1.U000s.Where(c => c.userSN == financierUserSN).First().registerDate; string regDatetimeStr = C101.FC10107(regDatetime); //基本信息 var financierBasicData = (from c in dbma1.VP801001s where c.userSN == financierUserSN select c).First(); string financierBasicDataStr = C101.FC10107(financierBasicData); string res = string.Format("{{\"financierBasicData\":{0},\"caseAmount\":{1},\"caseMoneyAmount\":{2},\"debtAmount\":{3},\"debtMoneyAmount\":{4},\"currentOverdueAmount\":{5},\"currentOverdueMoneyAmount\":{6},\"historyOverdueAmount\":{7},\"regDatetime\":{8}}}", financierBasicDataStr, caseAmount, caseMoneyAmount, debtAmount, debtMoneyAmount, currentOverdueAmount, currentOverdueMoneyAmount, historyOverdueAmount, regDatetimeStr); return(res); } }
//获得投资参数 A023 /// <summary> /// 获得融资参数 A024 /// </summary> public static string FC20124(DBMA1DataContext dbma1) { var linqData = dbma1.A024s.First(); var financingMoneyAmount = new { Min = linqData.minFinancingMoneyAmount, Max = linqData.maxFinancingMoneyAmount }; var deadline = new { Min = linqData.minDeadline, Max = linqData.maxDeadline }; var dailyRate = new { Min = linqData.minDailyRate, Max = linqData.maxDailyRate }; var obtainCost = new { Min = linqData.minObtainCost, Max = linqData.maxObtainCost }; var marketValue = new { Min = linqData.minMarketValue, Max = linqData.maxMarketValue }; var registerCapital = new { Min = linqData.minRegisterCapital, Max = linqData.maxRegisterCapital }; var totalAssets = new { Min = linqData.minTotalAssets, Max = linqData.maxTotalAssets }; var totalLiability = new { Min = linqData.minTotalLiability, Max = linqData.maxTotalLiability }; var currentLoan = new { Min = linqData.minCurrentLoan, Max = linqData.maxCurrentLoan }; var netAssets = new { Min = linqData.minNetAssets, Max = linqData.maxNetAssets }; var turnover = new { Min = linqData.minTurnOver, Max = linqData.maxTurnOver }; var taxTurnover = new { Min = linqData.minTaxTurnOver, Max = linqData.maxTaxTurnOver }; var netProfit = new { Min = linqData.minNetProfit, Max = linqData.maxNetProfit }; var stockHolderNum = new { Min = linqData.minStockHolderNum, Max = linqData.maxStockHolderNum }; var staffNum = new { Min = linqData.minStaffNum, Max = linqData.maxStaffNum }; var financingFee = new { SvrFee = linqData.financePublishCost, SvrRate = linqData.serviceRateDaily }; var investorRecommendFee = new { SvrFee = linqData.investorRecommendCost, SvrRate = linqData.serviceRateDaily }; string financingMoneyAmountStr = C101.FC10107(financingMoneyAmount); string deadlineStr = C101.FC10107(deadline); string dailyRateStr = C101.FC10107(dailyRate); string obtainCostStr = C101.FC10107(obtainCost); string marketValueStr = C101.FC10107(marketValue); string registerCapitalStr = C101.FC10107(registerCapital); string totalAssetsStr = C101.FC10107(totalAssets); string totalLiabilityStr = C101.FC10107(totalLiability); string currentLoanStr = C101.FC10107(currentLoan); string netAssetsStr = C101.FC10107(netAssets); string turnoverStr = C101.FC10107(turnover); string taxTurnoverStr = C101.FC10107(taxTurnover); string netProfitStr = C101.FC10107(netProfit); string stockHolderNumStr = C101.FC10107(stockHolderNum); string staffNumStr = C101.FC10107(staffNum); string financingFeeStr = C101.FC10107(financingFee); string investorRecommendFeeStr = C101.FC10107(investorRecommendFee); string res = string.Format("\"BorrowAmt\":{0},\"BorrowLimit\":{1},\"DayRate\":{2},\"TCO\":{3},\"MarketAmt\":{4},\"RegAmt\":{5},\"TotalAsset\":{6},\"TotalBorrow\":{7},\"NowBorrow\":{8},\"ClearAsset\":{9},\"SalesAmt\":{10},\"TaxSalesAmt\":{11},\"ClearProfit\":{12},\"ShareHolderNum\":{13},\"StaffNum\":{14},\"BorrowSvr\":{15},\"SltInvestSvr\":{16}", financingMoneyAmountStr, deadlineStr, dailyRateStr, obtainCostStr, marketValueStr, registerCapitalStr, totalAssetsStr, totalLiabilityStr, currentLoanStr, netAssetsStr, turnoverStr, taxTurnoverStr, netProfitStr, stockHolderNumStr, staffNumStr, financingFeeStr, investorRecommendFeeStr); return(res); }
//顾问信息 public static string FC20145(string consultantUserSN, string crSN) { using (DBMA1DataContext dbma1 = new DBMA1DataContext()) { //基本信息 var consultantBasicData = (from c in dbma1.VP801001s where c.userSN == consultantUserSN select new { c.userSN, c.name, c.birthday, c.gender, c.registeredResidence, idCard = c.idCard.Substring(0, 6), c.phone, c.email, c.maritalStatusType, c.procreateStatus, c.currentAddressProvince, c.currentAddressCity, c.currentAddressDetails, c.graduateSchool, c.degreeType, c.industryType, c.enterpriseType, c.serviceProvince, c.serviceCity, c.investigate, c.assetsEvaluate, c.badLoanCollect, c.creditRightGuarantee, c.consultantDetails }).First(); string consultantBasicDataStr = C101.FC10107(consultantBasicData); //注册时间 DateTime regDatetime = dbma1.U000s.Where(c => c.userSN == consultantUserSN).First().registerDate; string regDatetimeStr = C101.FC10107(regDatetime); //案例数量 int caseAmount = (from c in dbma1.P500s where c.consultantUserSN == consultantUserSN select c).Count(); //成功案例 int successCaseAmount = (from c in dbma1.P102s join o in dbma1.P103s.Where(oo => oo.ifOverdue == false) on c.investSN equals o.investSN join p in dbma1.P500s.Where(pp => pp.consultantUserSN == consultantUserSN && pp.auditStatus == true) on c.reserveSN equals p.reserveSN select c).Count(); //当前坏账 int currentBadLoanCaseAmount = (from c in dbma1.P500s.Where(cc => cc.consultantUserSN == consultantUserSN && cc.auditStatus != false) join o in dbma1.P102s.Where(oo => oo.closeCaseDate == null && oo.deadlineDate.Date < DateTime.Now.Date) on c.reserveSN equals o.reserveSN select c).Count(); //历史坏账 int historyBadLoanCaseAmount = (from c in dbma1.P102s join o in dbma1.P103s.Where(oo => oo.ifOverdue == true) on c.investSN equals o.investSN join p in dbma1.P500s.Where(pp => pp.consultantUserSN == consultantUserSN && pp.auditStatus != false) on c.reserveSN equals p.reserveSN select c).Count(); //坏账数量 int badLoanCaseAmount = currentBadLoanCaseAmount + historyBadLoanCaseAmount; //报价 decimal quotePricePercent = (from c in dbma1.P101s where c.receiverUserSN == consultantUserSN && c.creditRightSN == crSN orderby c.sendTime descending select c).First().costPercent; decimal financingMoneyAmount = (from c in dbma1.P200s where c.creditRightSN == crSN select c).First().financingAmount; decimal quotePrice = financingMoneyAmount * quotePricePercent; return(string.Format("{{\"consultantBasicData\":{0},\"regDatetime\":{1},\"caseAmount\":\"{2}\",\"successCaseAmount\":\"{3}\",\"badLoanCaseAmount\":\"{4}\",\"currentBadLoanCaseAmount\":\"{5}\",\"quotePrice\":\"{6}\"}}", consultantBasicDataStr, regDatetimeStr, caseAmount, successCaseAmount, badLoanCaseAmount, currentBadLoanCaseAmount, quotePrice)); } }
/// <summary> /// 投资方信息 /// </summary> public static string FC20144(string investorUserSN) { using (DBMA1DataContext dbma1 = new DBMA1DataContext()) { var investorData = (from c in dbma1.VP801001s where c.userSN == investorUserSN select c).First(); var investStatus = dbma1.VP104011s.Where(c => c.investorUserSN == investorUserSN).First(); string res = string.Format("{{\"investorData\":{0},\"investCaseAmount\":{1},\"investMoneyAmount\":{2}}}", C101.FC10107(investorData), investStatus.investCaseAmount, investStatus.InvestMoneyAmount); return(res); } }