|
|
@ -1326,14 +1326,17 @@ public class LoanSolutionsService extends MybatisBaseService<LoanSolutionsMapper |
|
|
|
//根据产品政策查询原利率
|
|
|
|
LoanFinPolicy loanFinPolicy = loanFinPolicyService.fetchBySid(policySid); |
|
|
|
if (StringUtils.isNotBlank(factoryDiscount) && !"0".equals(factoryDiscount)) { |
|
|
|
BigDecimal actualDiscount = BigDecimal.ZERO; |
|
|
|
//年利率
|
|
|
|
BigDecimal policyYearRatio = loanFinPolicy.getYearRatio(); |
|
|
|
//根据年利率和期数、贷款金额计算旧月还
|
|
|
|
BigDecimal loanPayMoney = calculatePMT(policyYearRatio.divide(new BigDecimal("100"), 4, BigDecimal.ROUND_CEILING).doubleValue(), new BigDecimal(loanPeriod).doubleValue(), loanAmount.doubleValue()); |
|
|
|
//根据月还计算旧利息总额=旧月还金额 乘以 期数 减去 本金
|
|
|
|
BigDecimal loanInterest = loanPayMoney.multiply(new BigDecimal(loanPeriod)).subtract(loanAmount); |
|
|
|
actualDiscount = actualDiscount.add(loanInterest); |
|
|
|
//根据旧利息总额和厂家贴息计算新利息总额
|
|
|
|
BigDecimal loanInterestNew = loanInterest.subtract(new BigDecimal(factoryDiscount)); |
|
|
|
actualDiscount = actualDiscount.subtract(loanInterestNew); |
|
|
|
//再根据厂家贴息、旧月还计算新月还金额 = 旧月还金额 减去 厂家贴息 除以 期数
|
|
|
|
BigDecimal loanPayMoneyNew = loanPayMoney.subtract(new BigDecimal(factoryDiscount).divide(new BigDecimal(loanPeriod), 4, BigDecimal.ROUND_HALF_UP)); |
|
|
|
//根据新月还rate计算新年利率。
|
|
|
@ -1361,6 +1364,8 @@ public class LoanSolutionsService extends MybatisBaseService<LoanSolutionsMapper |
|
|
|
calculateVo.setLoanInterest(loanInterestNew.toString()); |
|
|
|
calculateVo.setPolicyYearRatio(policyYearRatioNew.toString()); |
|
|
|
calculateVo.setLoanPayMoney(loanPayMoneyNew.toString()); |
|
|
|
String actualDiscountString = actualDiscount.setScale(0, BigDecimal.ROUND_HALF_UP).toString(); |
|
|
|
calculateVo.setActualDiscount(actualDiscountString); |
|
|
|
} else { |
|
|
|
//年利率
|
|
|
|
BigDecimal policyYearRatio = loanFinPolicy.getYearRatio(); |
|
|
@ -1406,6 +1411,7 @@ public class LoanSolutionsService extends MybatisBaseService<LoanSolutionsMapper |
|
|
|
//其他融贴息
|
|
|
|
String otherDiscount = query.getOtherDiscount(); |
|
|
|
if (StringUtils.isNotBlank(otherDiscount) && !"0".equals(otherDiscount)) { |
|
|
|
BigDecimal otherActualDiscount = BigDecimal.ZERO; |
|
|
|
loanDownPay = loanDownPay.subtract(new BigDecimal(otherPolicyAmount)); |
|
|
|
//总贷款金额的计算
|
|
|
|
loanAmountTotal = loanAmountTotal.add(new BigDecimal(otherPolicyAmount)); |
|
|
@ -1418,8 +1424,10 @@ public class LoanSolutionsService extends MybatisBaseService<LoanSolutionsMapper |
|
|
|
} |
|
|
|
//根据月还计算旧利息总额=旧月还金额 乘以 期数 减去 本金
|
|
|
|
BigDecimal otherPolicyInterest = otherPolicyMonthlyRepay.multiply(new BigDecimal(otherPolicyPeriod)).subtract(new BigDecimal(otherPolicyAmount)); |
|
|
|
otherActualDiscount = otherActualDiscount.add(otherPolicyInterest); |
|
|
|
//根据旧利息总额和厂家贴息计算新利息总额
|
|
|
|
BigDecimal otherPolicyInterestNew = otherPolicyInterest.subtract(new BigDecimal(otherDiscount)); |
|
|
|
otherActualDiscount = otherActualDiscount.subtract(otherPolicyInterestNew); |
|
|
|
//再根据厂家贴息、旧月还计算新月还金额 = 旧月还金额 减去 厂家贴息 除以 期数
|
|
|
|
BigDecimal otherPolicyMonthlyRepayNew = otherPolicyMonthlyRepay.subtract(new BigDecimal(otherDiscount).divide(new BigDecimal(otherPolicyPeriod), 4, BigDecimal.ROUND_HALF_UP)); |
|
|
|
//根据新月还rate计算新年利率。
|
|
|
@ -1447,6 +1455,8 @@ public class LoanSolutionsService extends MybatisBaseService<LoanSolutionsMapper |
|
|
|
calculateVo.setOtherPolicyInterest(otherPolicyInterestNew.toString()); |
|
|
|
calculateVo.setOtherPolicyYearRatio(otherPolicyYearRatioNew.toString()); |
|
|
|
calculateVo.setOtherPolicyMonthlyRepay(otherPolicyMonthlyRepayNew.toString()); |
|
|
|
String otherActualDiscountString = otherActualDiscount.setScale(0, BigDecimal.ROUND_HALF_UP).toString(); |
|
|
|
calculateVo.setOtherActualDiscount(otherActualDiscountString); |
|
|
|
} else { |
|
|
|
loanDownPay = loanDownPay.subtract(new BigDecimal(otherPolicyAmount)); |
|
|
|
//总贷款金额的计算
|
|
|
@ -1996,6 +2006,11 @@ public class LoanSolutionsService extends MybatisBaseService<LoanSolutionsMapper |
|
|
|
StringBuilder factoryDiscountValue = new StringBuilder(); |
|
|
|
if (StringUtils.isNotBlank(solutionssVo.getFactoryDiscount())) { |
|
|
|
factoryDiscountValue = factoryDiscountValue.append("厂家贴息:").append(solutionssVo.getFactoryDiscount()); |
|
|
|
if(StringUtils.isNotBlank(solutionssVo.getActualDiscount())){ |
|
|
|
if(new BigDecimal(solutionssVo.getActualDiscount()).compareTo(BigDecimal.ZERO) != 0){ |
|
|
|
factoryDiscountValue = factoryDiscountValue.append("(实贴").append(solutionssVo.getActualDiscount()).append(")"); |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
factoryDiscountValue = factoryDiscountValue.append("厂家贴息:").append("-"); |
|
|
|
} |
|
|
@ -2095,6 +2110,11 @@ public class LoanSolutionsService extends MybatisBaseService<LoanSolutionsMapper |
|
|
|
StringBuilder otherDiscountValue = new StringBuilder(); |
|
|
|
if (StringUtils.isNotBlank(solutionssVo.getOtherDiscount())) { |
|
|
|
otherDiscountValue = otherDiscountValue.append("其它融贴息:").append(solutionssVo.getOtherDiscount()); |
|
|
|
if(StringUtils.isNotBlank(solutionssVo.getOtherActualDiscount())){ |
|
|
|
if(new BigDecimal(solutionssVo.getOtherActualDiscount()).compareTo(BigDecimal.ZERO) != 0){ |
|
|
|
otherDiscountValue = otherDiscountValue.append("(实贴").append(solutionssVo.getOtherActualDiscount()).append(")"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} else { |
|
|
|
otherDiscountValue = otherDiscountValue.append("其它融贴息:").append("-"); |
|
|
|