|
|
@ -1318,16 +1318,27 @@ public class LoanSolutionsService extends MybatisBaseService<LoanSolutionsMapper |
|
|
|
BigDecimal policyYearRatioNew = simpleCalculateRate(new BigDecimal(loanPeriod).doubleValue(), loanPayMoneyNew.doubleValue(), -loanAmount.doubleValue()).multiply(new BigDecimal("12")).multiply(new BigDecimal("100")); |
|
|
|
//四舍五入取两位小数
|
|
|
|
policyYearRatioNew = policyYearRatioNew.setScale(2, BigDecimal.ROUND_HALF_UP); |
|
|
|
if(policyYearRatioNew.compareTo(BigDecimal.ZERO)<0){ |
|
|
|
//根据年利率和期数、贷款金额计算月还
|
|
|
|
loanPayMoneyNew = calculatePMT(BigDecimal.ZERO.divide(new BigDecimal("100"), 4, BigDecimal.ROUND_CEILING).doubleValue(), new BigDecimal(loanPeriod).doubleValue(), loanAmount.doubleValue()); |
|
|
|
//根据月还计算利息总额=月还金额 乘以 期数 减去 本金
|
|
|
|
loanInterestNew = loanPayMoney.multiply(new BigDecimal(loanPeriod)).subtract(loanAmount); |
|
|
|
//四舍五入取整数
|
|
|
|
loanPayMoneyNew = loanPayMoney.setScale(0, BigDecimal.ROUND_HALF_UP); |
|
|
|
loanInterestNew = loanInterest.setScale(0, BigDecimal.ROUND_HALF_UP); |
|
|
|
loanPayMoneyAll = loanPayMoneyAll.add(loanPayMoneyNew); |
|
|
|
policyYearRatioNew = BigDecimal.ZERO.setScale(2, BigDecimal.ROUND_HALF_UP); |
|
|
|
}else{ |
|
|
|
//四舍五入取整数
|
|
|
|
loanPayMoneyNew = loanPayMoneyNew.setScale(0, BigDecimal.ROUND_HALF_UP); |
|
|
|
loanInterestNew = loanInterestNew.setScale(0, BigDecimal.ROUND_HALF_UP); |
|
|
|
} |
|
|
|
loanPayMoneyAll = loanPayMoneyAll.add(loanPayMoneyNew); |
|
|
|
interstAll = interstAll.add(loanInterestNew); |
|
|
|
yueAll = yueAll.add(loanPayMoneyNew.multiply(new BigDecimal(loanPeriod))); |
|
|
|
calculateVo.setLoanInterest(loanInterestNew.toString()); |
|
|
|
calculateVo.setPolicyYearRatio(policyYearRatioNew.toString()); |
|
|
|
calculateVo.setLoanPayMoney(loanPayMoneyNew.toString()); |
|
|
|
|
|
|
|
} else { |
|
|
|
//年利率
|
|
|
|
BigDecimal policyYearRatio = loanFinPolicy.getYearRatio(); |
|
|
@ -1364,6 +1375,42 @@ public class LoanSolutionsService extends MybatisBaseService<LoanSolutionsMapper |
|
|
|
if (StringUtils.isBlank(otherPolicyPeriod)) { |
|
|
|
otherPolicyPeriod = "0"; |
|
|
|
} |
|
|
|
//其他融贴息
|
|
|
|
String otherDiscount = query.getOtherDiscount(); |
|
|
|
if (StringUtils.isNotBlank(otherDiscount) && !"0".equals(otherDiscount)) { |
|
|
|
//根据年利率和期数、贷款金额计算旧月还
|
|
|
|
BigDecimal otherPolicyMonthlyRepay = calculatePMT(new BigDecimal(otherPolicyYearRatio).divide(new BigDecimal("100"), 4, BigDecimal.ROUND_CEILING).doubleValue(), new BigDecimal(loanPeriod).doubleValue(), loanAmount.doubleValue()); |
|
|
|
//根据月还计算旧利息总额=旧月还金额 乘以 期数 减去 本金
|
|
|
|
BigDecimal otherPolicyInterest = otherPolicyMonthlyRepay.multiply(new BigDecimal(otherPolicyPeriod)).subtract(new BigDecimal(otherPolicyAmount)); |
|
|
|
//根据旧利息总额和厂家贴息计算新利息总额
|
|
|
|
BigDecimal otherPolicyInterestNew = otherPolicyInterest.subtract(new BigDecimal(otherDiscount)); |
|
|
|
//再根据厂家贴息、旧月还计算新月还金额 = 旧月还金额 减去 厂家贴息 除以 期数
|
|
|
|
BigDecimal otherPolicyMonthlyRepayNew = otherPolicyMonthlyRepay.subtract(new BigDecimal(otherDiscount).divide(new BigDecimal(otherPolicyPeriod), 4, BigDecimal.ROUND_HALF_UP)); |
|
|
|
//根据新月还rate计算新年利率。
|
|
|
|
BigDecimal otherPolicyYearRatioNew = simpleCalculateRate(new BigDecimal(otherPolicyPeriod).doubleValue(), otherPolicyMonthlyRepayNew.doubleValue(), -new BigDecimal(otherPolicyAmount).doubleValue()).multiply(new BigDecimal("12")).multiply(new BigDecimal("100")); |
|
|
|
//四舍五入取两位小数
|
|
|
|
otherPolicyYearRatioNew = otherPolicyYearRatioNew.setScale(2, BigDecimal.ROUND_HALF_UP); |
|
|
|
if(otherPolicyYearRatioNew.compareTo(BigDecimal.ZERO)<0){ |
|
|
|
//根据年利率和期数、贷款金额计算月还
|
|
|
|
otherPolicyMonthlyRepayNew = calculatePMT(BigDecimal.ZERO.divide(new BigDecimal("100"), 4, BigDecimal.ROUND_CEILING).doubleValue(), new BigDecimal(otherPolicyPeriod).doubleValue(), new BigDecimal(otherPolicyAmount).doubleValue()); |
|
|
|
//根据月还计算利息总额=月还金额 乘以 期数 减去 本金
|
|
|
|
otherPolicyInterestNew = otherPolicyMonthlyRepay.multiply(new BigDecimal(otherPolicyPeriod)).subtract(new BigDecimal(otherPolicyAmount)); |
|
|
|
//四舍五入取整数
|
|
|
|
otherPolicyMonthlyRepayNew = otherPolicyMonthlyRepayNew.setScale(0, BigDecimal.ROUND_HALF_UP); |
|
|
|
otherPolicyInterestNew = otherPolicyInterestNew.setScale(0, BigDecimal.ROUND_HALF_UP); |
|
|
|
otherPolicyYearRatioNew = BigDecimal.ZERO.setScale(2, BigDecimal.ROUND_HALF_UP); |
|
|
|
}else{ |
|
|
|
//四舍五入取整数
|
|
|
|
otherPolicyMonthlyRepayNew = otherPolicyMonthlyRepayNew.setScale(0, BigDecimal.ROUND_HALF_UP); |
|
|
|
otherPolicyInterestNew = otherPolicyInterestNew.setScale(0, BigDecimal.ROUND_HALF_UP); |
|
|
|
} |
|
|
|
loanPayMoneyAll = loanPayMoneyAll.add(otherPolicyMonthlyRepayNew); |
|
|
|
interstAll = interstAll.add(otherPolicyInterestNew); |
|
|
|
yueAll = yueAll.add(otherPolicyMonthlyRepayNew.multiply(new BigDecimal(otherPolicyPeriod))); |
|
|
|
calculateVo.setOtherPolicyInterest(otherPolicyInterestNew.toString()); |
|
|
|
calculateVo.setOtherPolicyYearRatio(otherPolicyYearRatioNew.toString()); |
|
|
|
calculateVo.setOtherPolicyMonthlyRepay(otherPolicyMonthlyRepayNew.toString()); |
|
|
|
}else{ |
|
|
|
loanDownPay = loanDownPay.subtract(new BigDecimal(otherPolicyAmount)); |
|
|
|
//总贷款金额的计算
|
|
|
|
loanAmountTotal = loanAmountTotal.add(new BigDecimal(otherPolicyAmount)); |
|
|
@ -1379,6 +1426,8 @@ public class LoanSolutionsService extends MybatisBaseService<LoanSolutionsMapper |
|
|
|
yueAll = yueAll.add(otherPolicyMonthlyRepay.multiply(new BigDecimal(otherPolicyPeriod))); |
|
|
|
calculateVo.setOtherPolicyInterest(otherPolicyInterest.toString()); |
|
|
|
calculateVo.setOtherPolicyMonthlyRepay(otherPolicyMonthlyRepay.toString()); |
|
|
|
} |
|
|
|
|
|
|
|
} else { |
|
|
|
otherPolicyPeriod = "0"; |
|
|
|
} |
|
|
@ -1991,6 +2040,15 @@ public class LoanSolutionsService extends MybatisBaseService<LoanSolutionsMapper |
|
|
|
otherPolicyMonthlyRepayValue = otherPolicyMonthlyRepayValue.append("月还金额:").append("-"); |
|
|
|
} |
|
|
|
list.add(getValueSpanSize(otherPolicyMonthlyRepayValue.toString(), 2, 0, false)); |
|
|
|
//其他融贴息
|
|
|
|
StringBuilder otherDiscountValue = new StringBuilder(); |
|
|
|
if (StringUtils.isNotBlank(solutionssVo.getOtherPolicyMonthlyRepay())) { |
|
|
|
otherDiscountValue = otherDiscountValue.append("其它融贴息:").append(solutionssVo.getOtherDiscount()); |
|
|
|
|
|
|
|
} else { |
|
|
|
otherDiscountValue = otherDiscountValue.append("其它融贴息:").append("-"); |
|
|
|
} |
|
|
|
list.add(getValueSpanSize(otherDiscountValue.toString(), 2, 0, false)); |
|
|
|
} |
|
|
|
//方案汇总
|
|
|
|
list.add(getValueSpanSize("方案汇总", 2, 1, true)); |
|
|
|