|
|
@ -1356,6 +1356,7 @@ public class LoanSolutionsService extends MybatisBaseService<LoanSolutionsMapper |
|
|
|
if (StringUtils.isBlank(otherPolicyAmount)) { |
|
|
|
return rb.setMsg("其他融贷款金额不能为空"); |
|
|
|
} |
|
|
|
|
|
|
|
if (StringUtils.isBlank(otherPolicyPeriod)) { |
|
|
|
otherPolicyPeriod = "0"; |
|
|
|
} |
|
|
@ -1383,7 +1384,44 @@ public class LoanSolutionsService extends MybatisBaseService<LoanSolutionsMapper |
|
|
|
downPayAmountsRatio = loanDownPay.divide(loanTotal, 4, BigDecimal.ROUND_CEILING).multiply(new BigDecimal("100")); |
|
|
|
downPayAmountsRatio = downPayAmountsRatio.setScale(0, BigDecimal.ROUND_HALF_UP); |
|
|
|
calculateVo.setDownPayAmountsRatio(downPayAmountsRatio.toString()); |
|
|
|
//
|
|
|
|
if (otherPolicyState) {//包含
|
|
|
|
//验证贷款金额是否不大于最高贷款金额
|
|
|
|
LoanFinOtherPolicy loanFinOtherPolicy = loanFinOtherPolicyService.fetchBySid(query.getOtherPolicySid()); |
|
|
|
if (loanFinOtherPolicy != null) { |
|
|
|
if (loanFinOtherPolicy.getMaxLoanAmount() != null && loanFinOtherPolicy.getMaxLoanRatio() != null) { |
|
|
|
//根据最高融资比例计算最高融资额
|
|
|
|
BigDecimal maxLoanAmountRat = new BigDecimal(query.getLoanTotal()).multiply(loanFinOtherPolicy.getMaxLoanRatio()).divide(new BigDecimal("100"), 4, BigDecimal.ROUND_CEILING); |
|
|
|
BigDecimal maxLoanAmount = loanFinOtherPolicy.getMaxLoanAmount(); |
|
|
|
if (maxLoanAmount.compareTo(maxLoanAmountRat) == 0) {//任一项与贷款金额作对比
|
|
|
|
if (maxLoanAmount.compareTo(new BigDecimal(query.getOtherPolicyAmount())) < 0) { |
|
|
|
return rb.setMsg("其他融贷款金额不能高于选择的其他融的最高贷款金额"); |
|
|
|
} |
|
|
|
} else { |
|
|
|
if (maxLoanAmount.compareTo(maxLoanAmountRat) < 0) {//maxLoanAmount与贷款金额作对比
|
|
|
|
if (maxLoanAmount.compareTo(new BigDecimal(query.getOtherPolicyAmount())) < 0) { |
|
|
|
return rb.setMsg("其他融贷款金额不能高于选择的其他融的最高贷款金额"); |
|
|
|
} |
|
|
|
} else {//maxLoanAmountRat与贷款金额作对比
|
|
|
|
if (maxLoanAmountRat.compareTo(new BigDecimal(query.getOtherPolicyAmount())) < 0) { |
|
|
|
return rb.setMsg("其他融贷款金额不能高于选择的其他融的最高贷款金额"); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} else if (loanFinOtherPolicy.getMaxLoanAmount() != null) { |
|
|
|
if (loanFinOtherPolicy.getMaxLoanAmount().compareTo(new BigDecimal(query.getOtherPolicyAmount())) < 0) { |
|
|
|
return rb.setMsg("其他融贷款金额不能高于选择的其他融的最高贷款金额"); |
|
|
|
} |
|
|
|
|
|
|
|
} else if (loanFinOtherPolicy.getMaxLoanRatio() != null) { |
|
|
|
//根据最高融资比例计算最高融资额
|
|
|
|
BigDecimal maxLoanAmountRat = new BigDecimal(query.getLoanTotal()).multiply(loanFinOtherPolicy.getMaxLoanRatio()).divide(new BigDecimal("100"), 4, BigDecimal.ROUND_CEILING); |
|
|
|
if (maxLoanAmountRat.compareTo(new BigDecimal(query.getOtherPolicyAmount())) < 0) { |
|
|
|
return rb.setMsg("其他融贷款金额不能高于选择的其他融的最高贷款金额"); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
BigDecimal downPayRatioLeast = loanFinPolicy.getDownPayRatioLeast(); |
|
|
|
if (downPayAmountsRatio.compareTo(downPayRatioLeast) < 0) { |
|
|
|
return rb.setMsg("实际首付比例不能低于产品政策中的最低首付比例"); |
|
|
|