Browse Source

金融方案添加其他融贴息

master
dimengzhe 2 years ago
parent
commit
37fa92cdbe
  1. 9
      anrui-riskcenter/anrui-riskcenter-biz/src/main/java/com/yxt/anrui/riskcenter/biz/loansolutions/LoanSolutionsService.java

9
anrui-riskcenter/anrui-riskcenter-biz/src/main/java/com/yxt/anrui/riskcenter/biz/loansolutions/LoanSolutionsService.java

@ -1320,7 +1320,8 @@ public class LoanSolutionsService extends MybatisBaseService<LoanSolutionsMapper
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());
// loanPayMoneyNew = calculatePMT(BigDecimal.ZERO.divide(new BigDecimal("100"), 4, BigDecimal.ROUND_CEILING).doubleValue(), new BigDecimal(loanPeriod).doubleValue(), loanAmount.doubleValue());
loanPayMoneyNew = loanAmount.divide(new BigDecimal(loanPeriod),4,BigDecimal.ROUND_CEILING);
//根据月还计算利息总额=月还金额 乘以 期数 减去 本金
loanInterestNew = loanPayMoneyNew.multiply(new BigDecimal(loanPeriod)).subtract(loanAmount);
//四舍五入取整数
@ -1392,7 +1393,8 @@ public class LoanSolutionsService extends MybatisBaseService<LoanSolutionsMapper
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());
// otherPolicyMonthlyRepayNew = calculatePMT(BigDecimal.ZERO.divide(new BigDecimal("100"), 4, BigDecimal.ROUND_CEILING).doubleValue(), new BigDecimal(otherPolicyPeriod).doubleValue(), new BigDecimal(otherPolicyAmount).doubleValue());
otherPolicyMonthlyRepayNew = new BigDecimal(otherPolicyAmount).divide(new BigDecimal(otherPolicyPeriod),4,BigDecimal.ROUND_CEILING);
//根据月还计算利息总额=月还金额 乘以 期数 减去 本金
otherPolicyInterestNew = otherPolicyMonthlyRepay.multiply(new BigDecimal(otherPolicyPeriod)).subtract(new BigDecimal(otherPolicyAmount));
//四舍五入取整数
@ -1608,9 +1610,6 @@ public class LoanSolutionsService extends MybatisBaseService<LoanSolutionsMapper
public static BigDecimal calculatePMT(double rate, double nper, double pv) {
double v = (1 + (rate / 12));
double t = (-(nper / nper) * nper);
if(rate == 0.0){
return BigDecimal.ZERO;
}
double result = (pv * (rate / 12)) / (1 - Math.pow(v, t));
return new BigDecimal(result);
}

Loading…
Cancel
Save