|
|
@ -1236,6 +1236,9 @@ public class LoanSolutionsService extends MybatisBaseService<LoanSolutionsMapper |
|
|
|
} |
|
|
|
orderPrice = busSalesOrderPrice.getSingleFinalPrice(); |
|
|
|
} |
|
|
|
//(合同价+挂车+购置税+保险)
|
|
|
|
BigDecimal bilAll = BigDecimal.ZERO; |
|
|
|
bilAll = bilAll.add(orderPrice); |
|
|
|
CalculateVo calculateVo = new CalculateVo(); |
|
|
|
//计算的初始化
|
|
|
|
BigDecimal loanTotal = BigDecimal.ZERO;//融资项目总额
|
|
|
@ -1249,6 +1252,8 @@ public class LoanSolutionsService extends MybatisBaseService<LoanSolutionsMapper |
|
|
|
BigDecimal vehTotalPrice = BigDecimal.ZERO; |
|
|
|
BigDecimal interstAll = BigDecimal.ZERO; |
|
|
|
BigDecimal yueAll = BigDecimal.ZERO; |
|
|
|
//配件抵顶项
|
|
|
|
BigDecimal offsetAccessoriesBig = BigDecimal.ZERO; |
|
|
|
/***************相关计算及字段*****************/ |
|
|
|
BigDecimal AmountAll = BigDecimal.ZERO; |
|
|
|
|
|
|
@ -1280,13 +1285,16 @@ public class LoanSolutionsService extends MybatisBaseService<LoanSolutionsMapper |
|
|
|
//主车发票价
|
|
|
|
loanTotal = loanTotal.add(new BigDecimal(mainVehicleAmount)); |
|
|
|
AmountAll = AmountAll.add(new BigDecimal(mainVehicleAmount)); |
|
|
|
offsetAccessoriesBig = offsetAccessoriesBig.add(new BigDecimal(mainVehicleAmount)); |
|
|
|
} |
|
|
|
if (accessoriesAmountCb) {//包含配件
|
|
|
|
if (StringUtils.isNotBlank(accessoriesAmount)) { |
|
|
|
loanTotal = loanTotal.add(new BigDecimal(accessoriesAmount)); |
|
|
|
AmountAll = AmountAll.add(new BigDecimal(accessoriesAmount)); |
|
|
|
offsetAccessoriesBig = offsetAccessoriesBig.add(new BigDecimal(accessoriesAmount)); |
|
|
|
} |
|
|
|
} |
|
|
|
offsetAccessoriesBig = offsetAccessoriesBig.subtract(orderPrice); |
|
|
|
if(isOrder){ |
|
|
|
//判断成交价与主车发票价和配件之和
|
|
|
|
if(AmountAll.compareTo(orderPrice)<0){ |
|
|
@ -1296,6 +1304,7 @@ public class LoanSolutionsService extends MybatisBaseService<LoanSolutionsMapper |
|
|
|
if (trailerAmountCb) {//包含挂车
|
|
|
|
if (StringUtils.isNotBlank(trailerAmount)) { |
|
|
|
loanTotal = loanTotal.add(new BigDecimal(trailerAmount)); |
|
|
|
bilAll = bilAll.add(new BigDecimal(trailerAmount)); |
|
|
|
} |
|
|
|
} |
|
|
|
//判断是否打包
|
|
|
@ -1303,6 +1312,7 @@ public class LoanSolutionsService extends MybatisBaseService<LoanSolutionsMapper |
|
|
|
if (premiumCb) {//包含保险
|
|
|
|
if (StringUtils.isNotBlank(premium)) { |
|
|
|
loanTotal = loanTotal.add(new BigDecimal(premium)); |
|
|
|
bilAll = bilAll.add(new BigDecimal(premium)); |
|
|
|
} |
|
|
|
} else { |
|
|
|
if (StringUtils.isNotBlank(premium)) { |
|
|
@ -1312,6 +1322,7 @@ public class LoanSolutionsService extends MybatisBaseService<LoanSolutionsMapper |
|
|
|
if (purchaseTaxCb) {//包含购置税
|
|
|
|
if (StringUtils.isNotBlank(purchaseTax)) { |
|
|
|
loanTotal = loanTotal.add(new BigDecimal(purchaseTax)); |
|
|
|
bilAll = bilAll.add(new BigDecimal(purchaseTax)); |
|
|
|
} |
|
|
|
} else { |
|
|
|
if (StringUtils.isNotBlank(purchaseTax)) { |
|
|
@ -1502,10 +1513,18 @@ public class LoanSolutionsService extends MybatisBaseService<LoanSolutionsMapper |
|
|
|
} else { |
|
|
|
otherPolicyPeriod = "0"; |
|
|
|
} |
|
|
|
if(offsetAccessoriesBig.compareTo(BigDecimal.ZERO)>0){ |
|
|
|
calculateVo.setOffsetAccessories(offsetAccessoriesBig.toString()); |
|
|
|
}else{ |
|
|
|
offsetAccessoriesBig = BigDecimal.ZERO; |
|
|
|
calculateVo.setOffsetAccessories(offsetAccessoriesBig.toString()); |
|
|
|
} |
|
|
|
|
|
|
|
/************************计算融资首付********************************/ |
|
|
|
calculateVo.setLoanDownPay(loanDownPay.setScale(0, BigDecimal.ROUND_HALF_UP).toString()); |
|
|
|
//实际首付比例 = (融资首付/融资项目总额)x100
|
|
|
|
downPayAmountsRatio = loanDownPay.divide(loanTotal, 4, BigDecimal.ROUND_CEILING).multiply(new BigDecimal("100")); |
|
|
|
// downPayAmountsRatio = loanDownPay.divide(loanTotal, 4, BigDecimal.ROUND_CEILING).multiply(new BigDecimal("100"));
|
|
|
|
downPayAmountsRatio = loanDownPay.divide(bilAll, 4, BigDecimal.ROUND_CEILING).multiply(new BigDecimal("100")); |
|
|
|
downPayAmountsRatio = downPayAmountsRatio.setScale(2, BigDecimal.ROUND_HALF_UP); |
|
|
|
calculateVo.setDownPayAmountsRatio(downPayAmountsRatio.toString()); |
|
|
|
if (otherPolicyState) {//包含
|
|
|
@ -1658,6 +1677,7 @@ public class LoanSolutionsService extends MybatisBaseService<LoanSolutionsMapper |
|
|
|
if (StringUtils.isNotBlank(offsetPurchasetax)) { |
|
|
|
offsetTotal = offsetTotal.add(new BigDecimal(offsetPurchasetax)); |
|
|
|
} |
|
|
|
offsetTotal = offsetTotal.add(offsetAccessoriesBig); |
|
|
|
calculateVo.setOffsetTotal(offsetTotal.toString()); |
|
|
|
//实收合计 = 应收合计-抵顶合计
|
|
|
|
BigDecimal realTotal = receivableTotal.subtract(offsetTotal); |
|
|
@ -2364,6 +2384,14 @@ public class LoanSolutionsService extends MybatisBaseService<LoanSolutionsMapper |
|
|
|
offsetPurchasetaxValue = offsetPurchasetaxValue.append("抵顶购置税:").append("-"); |
|
|
|
} |
|
|
|
list.add(getValueSpanSize(offsetPurchasetaxValue.toString(), 1, 0, false)); |
|
|
|
//配件抵顶
|
|
|
|
StringBuilder offsetAccessoriesValue = new StringBuilder(); |
|
|
|
if (StringUtils.isNotBlank(solutionssVo.getOffsetAccessories())) { |
|
|
|
if(new BigDecimal(solutionssVo.getOffsetAccessories()).compareTo(BigDecimal.ZERO)>0){ |
|
|
|
offsetAccessoriesValue = offsetAccessoriesValue.append("配件抵顶:").append(solutionssVo.getOffsetAccessories()); |
|
|
|
list.add(getValueSpanSize(offsetAccessoriesValue.toString(), 1, 0, false)); |
|
|
|
} |
|
|
|
} |
|
|
|
//实收合计
|
|
|
|
StringBuilder realTotalValue = new StringBuilder(); |
|
|
|
if (StringUtils.isNotBlank(solutionssVo.getRealTotal())) { |
|
|
|