|
@ -73,7 +73,7 @@ public class LoanSolutionsService extends MybatisBaseService<LoanSolutionsMapper |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
if (loanSolutions == null) { |
|
|
if (loanSolutions == null) { |
|
|
return rb.success().setData(solutionsDetailsVo); |
|
|
return rb.success().setData(solutionsDetailsVo).setCode("20000"); |
|
|
} |
|
|
} |
|
|
return rb.success().setData(solutionsDetailsVo); |
|
|
return rb.success().setData(solutionsDetailsVo); |
|
|
} |
|
|
} |
|
@ -90,12 +90,25 @@ public class LoanSolutionsService extends MybatisBaseService<LoanSolutionsMapper |
|
|
} |
|
|
} |
|
|
//保存金融方案
|
|
|
//保存金融方案
|
|
|
loanSolutions = new LoanSolutions(); |
|
|
loanSolutions = new LoanSolutions(); |
|
|
|
|
|
if(StringUtils.isNotBlank(dto.getSaleOrderSid())){ |
|
|
|
|
|
loanSolutions.setSalesOrderSid(dto.getSaleOrderSid()); |
|
|
|
|
|
} |
|
|
//自营非担保和贷款的需要填写金融方案
|
|
|
//自营非担保和贷款的需要填写金融方案
|
|
|
if ("01".equals(dto.getTypeKey()) || StringUtils.isBlank(dto.getTypeKey())) { |
|
|
if ("01".equals(dto.getTypeKey()) || StringUtils.isBlank(dto.getTypeKey())) { |
|
|
|
|
|
if(StringUtils.isNotBlank(dto.getTypeKey())){ |
|
|
|
|
|
loanSolutions.setType(dto.getType()); |
|
|
|
|
|
loanSolutions.setTypeKey(dto.getTypeKey()); |
|
|
|
|
|
} |
|
|
//是否打包
|
|
|
//是否打包
|
|
|
String isPack = dto.getIsPack(); |
|
|
String isPack = dto.getIsPack(); |
|
|
|
|
|
if(StringUtils.isNotBlank(isPack)){ |
|
|
|
|
|
loanSolutions.setIsPack(isPack); |
|
|
|
|
|
} |
|
|
//产品政策名称
|
|
|
//产品政策名称
|
|
|
String policyName = dto.getPolicyName(); |
|
|
String policyName = dto.getPolicyName(); |
|
|
|
|
|
if(StringUtils.isNotBlank(policyName)){ |
|
|
|
|
|
loanSolutions.setPolicyName(policyName); |
|
|
|
|
|
} |
|
|
//融资项目总额 = 主车发票价+融资票据+挂车+保险+购置税+车损上浮
|
|
|
//融资项目总额 = 主车发票价+融资票据+挂车+保险+购置税+车损上浮
|
|
|
BigDecimal loanTotal = new BigDecimal(BigInteger.ZERO); |
|
|
BigDecimal loanTotal = new BigDecimal(BigInteger.ZERO); |
|
|
//主车发票价
|
|
|
//主车发票价
|
|
@ -191,7 +204,7 @@ public class LoanSolutionsService extends MybatisBaseService<LoanSolutionsMapper |
|
|
downPayAmount = downPayAmount.add(new BigDecimal(dto.getDownPayAmount())); |
|
|
downPayAmount = downPayAmount.add(new BigDecimal(dto.getDownPayAmount())); |
|
|
//首付款比例
|
|
|
//首付款比例
|
|
|
String downPayRatio = ""; |
|
|
String downPayRatio = ""; |
|
|
BigDecimal downPayRatio1 = downPayAmount.divide(loanTotal).multiply(new BigDecimal("100")); |
|
|
BigDecimal downPayRatio1 = downPayAmount.divide(loanTotal,BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100")).setScale(2, BigDecimal.ROUND_HALF_UP); |
|
|
downPayRatio = downPayRatio1.toString() + "%"; |
|
|
downPayRatio = downPayRatio1.toString() + "%"; |
|
|
//产品贷款金额 = 融资项目总额-首付金额
|
|
|
//产品贷款金额 = 融资项目总额-首付金额
|
|
|
loanAmount = loanTotal.subtract(downPayAmount); |
|
|
loanAmount = loanTotal.subtract(downPayAmount); |
|
@ -199,6 +212,8 @@ public class LoanSolutionsService extends MybatisBaseService<LoanSolutionsMapper |
|
|
loanSolutions.setDownPayRatio(downPayRatio); |
|
|
loanSolutions.setDownPayRatio(downPayRatio); |
|
|
} else { |
|
|
} else { |
|
|
loanAmount = loanTotal; |
|
|
loanAmount = loanTotal; |
|
|
|
|
|
loanSolutions.setDownPayAmount(BigDecimal.ZERO); |
|
|
|
|
|
loanSolutions.setDownPayRatio("0"); |
|
|
} |
|
|
} |
|
|
loanSolutions.setLoanAmount(loanAmount); |
|
|
loanSolutions.setLoanAmount(loanAmount); |
|
|
//产品期数
|
|
|
//产品期数
|
|
@ -213,10 +228,13 @@ public class LoanSolutionsService extends MybatisBaseService<LoanSolutionsMapper |
|
|
BigDecimal bondAmount = new BigDecimal(dto.getBondAmount()); |
|
|
BigDecimal bondAmount = new BigDecimal(dto.getBondAmount()); |
|
|
//贷款保证金比例
|
|
|
//贷款保证金比例
|
|
|
String bondRatio = ""; |
|
|
String bondRatio = ""; |
|
|
BigDecimal bondRatio1 = bondAmount.divide(loanAmount).multiply(new BigDecimal("100")); |
|
|
BigDecimal bondRatio1 = bondAmount.divide(loanAmount,BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100")).setScale(2, BigDecimal.ROUND_HALF_UP); |
|
|
bondRatio = bondRatio1.toString() + "%"; |
|
|
bondRatio = bondRatio1.toString() + "%"; |
|
|
loanSolutions.setBondAmount(bondAmount); |
|
|
loanSolutions.setBondAmount(bondAmount); |
|
|
loanSolutions.setBondRatio(bondRatio); |
|
|
loanSolutions.setBondRatio(bondRatio); |
|
|
|
|
|
} else { |
|
|
|
|
|
loanSolutions.setBondAmount(BigDecimal.ZERO); |
|
|
|
|
|
loanSolutions.setBondRatio("0"); |
|
|
} |
|
|
} |
|
|
//厂家贴息
|
|
|
//厂家贴息
|
|
|
String factoryDiscount = dto.getFactoryDiscount(); |
|
|
String factoryDiscount = dto.getFactoryDiscount(); |
|
@ -225,21 +243,32 @@ public class LoanSolutionsService extends MybatisBaseService<LoanSolutionsMapper |
|
|
} else { |
|
|
} else { |
|
|
loanSolutions.setFactoryDiscount(new BigDecimal(BigInteger.ZERO)); |
|
|
loanSolutions.setFactoryDiscount(new BigDecimal(BigInteger.ZERO)); |
|
|
} |
|
|
} |
|
|
|
|
|
//厂家贴息用途
|
|
|
|
|
|
String factoryDiscountUse = dto.getFactoryDiscountUse(); |
|
|
|
|
|
if (StringUtils.isNotBlank(factoryDiscountUse)) { |
|
|
|
|
|
loanSolutions.setFactoryDiscountUse(factoryDiscountUse); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
//年利率
|
|
|
//年利率
|
|
|
String policyYearRatio = dto.getPolicyYearRatio(); |
|
|
String policyYearRatio = dto.getPolicyYearRatio(); |
|
|
loanSolutions.setPolicyYearRatio(policyYearRatio); |
|
|
loanSolutions.setPolicyYearRatio(policyYearRatio); |
|
|
//月还金额
|
|
|
//月还金额
|
|
|
String loanPayMoney = dto.getLoanPayMoney(); |
|
|
String loanPayMoney = dto.getLoanPayMoney(); |
|
|
|
|
|
BigDecimal monthlyRepay1 = new BigDecimal(BigInteger.ZERO); |
|
|
if (StringUtils.isNotBlank(loanPayMoney)) { |
|
|
if (StringUtils.isNotBlank(loanPayMoney)) { |
|
|
loanSolutions.setLoanPayMoney(new BigDecimal(loanPayMoney)); |
|
|
loanSolutions.setLoanPayMoney(new BigDecimal(loanPayMoney)); |
|
|
|
|
|
monthlyRepay1 = monthlyRepay1.add(new BigDecimal(loanPayMoney)); |
|
|
|
|
|
} else { |
|
|
|
|
|
loanSolutions.setLoanPayMoney(BigDecimal.ZERO); |
|
|
} |
|
|
} |
|
|
//利息总额
|
|
|
//利息总额
|
|
|
//利息总额
|
|
|
|
|
|
BigDecimal interest = new BigDecimal(BigInteger.ZERO); |
|
|
BigDecimal interest = new BigDecimal(BigInteger.ZERO); |
|
|
String loanInterest = dto.getLoanInterest(); |
|
|
String loanInterest = dto.getLoanInterest(); |
|
|
if (StringUtils.isNotBlank(loanInterest)) { |
|
|
if (StringUtils.isNotBlank(loanInterest)) { |
|
|
loanSolutions.setLoanInterest(new BigDecimal(loanInterest)); |
|
|
loanSolutions.setLoanInterest(new BigDecimal(loanInterest)); |
|
|
interest.add(new BigDecimal(loanInterest)); |
|
|
interest.add(new BigDecimal(loanInterest)); |
|
|
|
|
|
} else { |
|
|
|
|
|
loanSolutions.setLoanInterest(BigDecimal.ZERO); |
|
|
} |
|
|
} |
|
|
BigDecimal otherPolicyAmount1 = new BigDecimal(BigInteger.ZERO); |
|
|
BigDecimal otherPolicyAmount1 = new BigDecimal(BigInteger.ZERO); |
|
|
int ii = 0; |
|
|
int ii = 0; |
|
@ -266,12 +295,17 @@ public class LoanSolutionsService extends MybatisBaseService<LoanSolutionsMapper |
|
|
String otherPolicyMonthlyRepay = dto.getOtherPolicyMonthlyRepay(); |
|
|
String otherPolicyMonthlyRepay = dto.getOtherPolicyMonthlyRepay(); |
|
|
if (StringUtils.isNotBlank(otherPolicyMonthlyRepay)) { |
|
|
if (StringUtils.isNotBlank(otherPolicyMonthlyRepay)) { |
|
|
loanSolutionsOtherpolicy.setOtherPolicyMonthlyRepay(new BigDecimal(otherPolicyMonthlyRepay)); |
|
|
loanSolutionsOtherpolicy.setOtherPolicyMonthlyRepay(new BigDecimal(otherPolicyMonthlyRepay)); |
|
|
|
|
|
monthlyRepay1 = monthlyRepay1.add(new BigDecimal(otherPolicyMonthlyRepay)); |
|
|
|
|
|
} else { |
|
|
|
|
|
loanSolutionsOtherpolicy.setOtherPolicyMonthlyRepay(BigDecimal.ZERO); |
|
|
} |
|
|
} |
|
|
//其它融利息总额
|
|
|
//其它融利息总额
|
|
|
String otherPolicyInterest = dto.getOtherPolicyInterest(); |
|
|
String otherPolicyInterest = dto.getOtherPolicyInterest(); |
|
|
if (StringUtils.isNotBlank(otherPolicyInterest)) { |
|
|
if (StringUtils.isNotBlank(otherPolicyInterest)) { |
|
|
loanSolutionsOtherpolicy.setOtherPolicyInterest(new BigDecimal(otherPolicyInterest)); |
|
|
loanSolutionsOtherpolicy.setOtherPolicyInterest(new BigDecimal(otherPolicyInterest)); |
|
|
interest = interest.add(new BigDecimal(otherPolicyInterest)); |
|
|
interest = interest.add(new BigDecimal(otherPolicyInterest)); |
|
|
|
|
|
} else { |
|
|
|
|
|
loanSolutionsOtherpolicy.setOtherPolicyInterest(BigDecimal.ZERO); |
|
|
} |
|
|
} |
|
|
//方案汇总==========================================
|
|
|
//方案汇总==========================================
|
|
|
//融资首付 = 首付金额-其它融贷款金额
|
|
|
//融资首付 = 首付金额-其它融贷款金额
|
|
@ -287,7 +321,18 @@ public class LoanSolutionsService extends MybatisBaseService<LoanSolutionsMapper |
|
|
String period = otherPolicyPeriod + "/" + i; |
|
|
String period = otherPolicyPeriod + "/" + i; |
|
|
loanSolutionsOtherpolicy.setPeriod(period); |
|
|
loanSolutionsOtherpolicy.setPeriod(period); |
|
|
//月还金额 = 总月还/贷款月还
|
|
|
//月还金额 = 总月还/贷款月还
|
|
|
String monthlyRepay = dto.getLoanPayMoney() + "/" + dto.getOtherPolicyMonthlyRepay(); |
|
|
String monthlyRepay = ""; |
|
|
|
|
|
if(StringUtils.isNotBlank(dto.getMonthlyRepay())){ |
|
|
|
|
|
if(loanPeriod.equals(otherPolicyPeriod)){ |
|
|
|
|
|
monthlyRepay = monthlyRepay1.toString() + "/-"; |
|
|
|
|
|
}else{ |
|
|
|
|
|
monthlyRepay = monthlyRepay1.toString() + "/" + dto.getLoanPayMoney(); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
}else{ |
|
|
|
|
|
monthlyRepay = monthlyRepay1.toString() + "/-"; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
//预计首期还款日
|
|
|
//预计首期还款日
|
|
|
String returnTime = dto.getReturnTime(); |
|
|
String returnTime = dto.getReturnTime(); |
|
|
loanSolutionsOtherpolicy.setMonthlyRepay(monthlyRepay); |
|
|
loanSolutionsOtherpolicy.setMonthlyRepay(monthlyRepay); |
|
@ -295,7 +340,9 @@ public class LoanSolutionsService extends MybatisBaseService<LoanSolutionsMapper |
|
|
//利息总额
|
|
|
//利息总额
|
|
|
loanSolutionsOtherpolicy.setInterest(interest); |
|
|
loanSolutionsOtherpolicy.setInterest(interest); |
|
|
loanSolutions.setOtherPolicyState(1); |
|
|
loanSolutions.setOtherPolicyState(1); |
|
|
|
|
|
loanSolutionsOtherpolicy.setOtherPolicyYearRatio(dto.getOtherPolicyYearRatio()); |
|
|
} else { |
|
|
} else { |
|
|
|
|
|
//不勾选其它融
|
|
|
//方案汇总
|
|
|
//方案汇总
|
|
|
//融资首付 = 首付金额-其它融贷款金额
|
|
|
//融资首付 = 首付金额-其它融贷款金额
|
|
|
BigDecimal loanDownPay = new BigDecimal(BigInteger.ZERO); |
|
|
BigDecimal loanDownPay = new BigDecimal(BigInteger.ZERO); |
|
@ -310,7 +357,7 @@ public class LoanSolutionsService extends MybatisBaseService<LoanSolutionsMapper |
|
|
String period = ii + "/" + i; |
|
|
String period = ii + "/" + i; |
|
|
loanSolutionsOtherpolicy.setPeriod(period); |
|
|
loanSolutionsOtherpolicy.setPeriod(period); |
|
|
//月还金额 = 总月还/贷款月还
|
|
|
//月还金额 = 总月还/贷款月还
|
|
|
String monthlyRepay = dto.getLoanPayMoney() + "/" + dto.getOtherPolicyMonthlyRepay(); |
|
|
String monthlyRepay = monthlyRepay1.toString(); |
|
|
//预计首期还款日
|
|
|
//预计首期还款日
|
|
|
String returnTime = dto.getReturnTime(); |
|
|
String returnTime = dto.getReturnTime(); |
|
|
loanSolutionsOtherpolicy.setMonthlyRepay(monthlyRepay); |
|
|
loanSolutionsOtherpolicy.setMonthlyRepay(monthlyRepay); |
|
@ -320,6 +367,7 @@ public class LoanSolutionsService extends MybatisBaseService<LoanSolutionsMapper |
|
|
loanSolutions.setOtherPolicyState(0); |
|
|
loanSolutions.setOtherPolicyState(0); |
|
|
} |
|
|
} |
|
|
baseMapper.insert(loanSolutions); |
|
|
baseMapper.insert(loanSolutions); |
|
|
|
|
|
loanSolutionsOtherpolicy.setSolutionsSid(loanSolutions.getSid()); |
|
|
loanSolutionsOtherpolicyService.insert(loanSolutionsOtherpolicy); |
|
|
loanSolutionsOtherpolicyService.insert(loanSolutionsOtherpolicy); |
|
|
//=========================应收明细
|
|
|
//=========================应收明细
|
|
|
LoanSolutionsDetail loanSolutionsDetail = new LoanSolutionsDetail(); |
|
|
LoanSolutionsDetail loanSolutionsDetail = new LoanSolutionsDetail(); |
|
@ -328,43 +376,54 @@ public class LoanSolutionsService extends MybatisBaseService<LoanSolutionsMapper |
|
|
//融资首付 = 首付金额-其它融贷款金额
|
|
|
//融资首付 = 首付金额-其它融贷款金额
|
|
|
BigDecimal downPayAmounts = new BigDecimal(BigInteger.ZERO); |
|
|
BigDecimal downPayAmounts = new BigDecimal(BigInteger.ZERO); |
|
|
downPayAmounts = downPayAmounts.add(downPayAmount).subtract(otherPolicyAmount1); |
|
|
downPayAmounts = downPayAmounts.add(downPayAmount).subtract(otherPolicyAmount1); |
|
|
loanSolutionsDetail.setDownPayAmount(downPayAmounts); |
|
|
loanSolutionsDetail.setDownPayAmounts(downPayAmounts); |
|
|
//贷款保证金
|
|
|
//贷款保证金
|
|
|
String bondAmounts = dto.getBondAmounts(); |
|
|
String bondAmounts = dto.getBondAmounts(); |
|
|
if (StringUtils.isNotBlank(bondAmounts)) { |
|
|
if (StringUtils.isNotBlank(bondAmounts)) { |
|
|
receivableTotal = receivableTotal.add(new BigDecimal(bondAmounts)); |
|
|
receivableTotal = receivableTotal.add(new BigDecimal(bondAmounts)); |
|
|
loanSolutionsDetail.setBondAmounts(new BigDecimal(bondAmounts)); |
|
|
loanSolutionsDetail.setBondAmounts(new BigDecimal(bondAmounts)); |
|
|
|
|
|
} else { |
|
|
|
|
|
loanSolutionsDetail.setBondAmounts(BigDecimal.ZERO); |
|
|
} |
|
|
} |
|
|
//保险保证金
|
|
|
//保险保证金
|
|
|
String depositPremium = dto.getDepositPremium(); |
|
|
String depositPremium = dto.getDepositPremium(); |
|
|
if (StringUtils.isNotBlank(depositPremium)) { |
|
|
if (StringUtils.isNotBlank(depositPremium)) { |
|
|
receivableTotal = receivableTotal.add(new BigDecimal(depositPremium)); |
|
|
receivableTotal = receivableTotal.add(new BigDecimal(depositPremium)); |
|
|
loanSolutionsDetail.setDepositPremium(new BigDecimal(depositPremium)); |
|
|
loanSolutionsDetail.setDepositPremium(new BigDecimal(depositPremium)); |
|
|
|
|
|
} else { |
|
|
|
|
|
loanSolutionsDetail.setDepositPremium(BigDecimal.ZERO); |
|
|
} |
|
|
} |
|
|
//落户保证金
|
|
|
//落户保证金
|
|
|
String depositSettle = dto.getDepositSettle(); |
|
|
String depositSettle = dto.getDepositSettle(); |
|
|
if (StringUtils.isNotBlank(depositSettle)) { |
|
|
if (StringUtils.isNotBlank(depositSettle)) { |
|
|
receivableTotal = receivableTotal.add(new BigDecimal(depositPremium)); |
|
|
receivableTotal = receivableTotal.add(new BigDecimal(depositPremium)); |
|
|
loanSolutionsDetail.setDepositSettle(new BigDecimal(depositSettle)); |
|
|
loanSolutionsDetail.setDepositSettle(new BigDecimal(depositSettle)); |
|
|
|
|
|
} else { |
|
|
|
|
|
loanSolutionsDetail.setDepositSettle(BigDecimal.ZERO); |
|
|
} |
|
|
} |
|
|
//服务费
|
|
|
//服务费
|
|
|
String serviceAmount = dto.getServiceAmount(); |
|
|
String serviceAmount = dto.getServiceAmount(); |
|
|
if (StringUtils.isNotBlank(serviceAmount)) { |
|
|
if (StringUtils.isNotBlank(serviceAmount)) { |
|
|
receivableTotal = receivableTotal.add(new BigDecimal(serviceAmount)); |
|
|
receivableTotal = receivableTotal.add(new BigDecimal(serviceAmount)); |
|
|
loanSolutionsDetail.setServiceAmount(new BigDecimal(serviceAmount)); |
|
|
loanSolutionsDetail.setServiceAmount(new BigDecimal(serviceAmount)); |
|
|
|
|
|
} else { |
|
|
|
|
|
loanSolutionsDetail.setServiceAmount(BigDecimal.ZERO); |
|
|
} |
|
|
} |
|
|
//代收意外险
|
|
|
//代收意外险
|
|
|
String proxyAccidentPremium = dto.getProxyAccidentPremium(); |
|
|
String proxyAccidentPremium = dto.getProxyAccidentPremium(); |
|
|
if (StringUtils.isNotBlank(proxyAccidentPremium)) { |
|
|
if (StringUtils.isNotBlank(proxyAccidentPremium)) { |
|
|
receivableTotal = receivableTotal.add(new BigDecimal(proxyAccidentPremium)); |
|
|
receivableTotal = receivableTotal.add(new BigDecimal(proxyAccidentPremium)); |
|
|
loanSolutionsDetail.setProxyAccidentPremium(new BigDecimal(proxyAccidentPremium)); |
|
|
loanSolutionsDetail.setProxyAccidentPremium(new BigDecimal(proxyAccidentPremium)); |
|
|
|
|
|
} else { |
|
|
|
|
|
loanSolutionsDetail.setProxyAccidentPremium(BigDecimal.ZERO); |
|
|
} |
|
|
} |
|
|
//上牌费
|
|
|
//上牌费
|
|
|
String registerAmount = dto.getRegisterAmount(); |
|
|
String registerAmount = dto.getRegisterAmount(); |
|
|
if (StringUtils.isNotBlank(registerAmount)) { |
|
|
if (StringUtils.isNotBlank(registerAmount)) { |
|
|
receivableTotal = receivableTotal.add(new BigDecimal(registerAmount)); |
|
|
receivableTotal = receivableTotal.add(new BigDecimal(registerAmount)); |
|
|
loanSolutionsDetail.setRegisterAmount(new BigDecimal(registerAmount)); |
|
|
loanSolutionsDetail.setRegisterAmount(new BigDecimal(registerAmount)); |
|
|
|
|
|
} else { |
|
|
|
|
|
loanSolutionsDetail.setRegisterAmount(BigDecimal.ZERO); |
|
|
} |
|
|
} |
|
|
//运管费
|
|
|
//运管费
|
|
|
String operationAmount = dto.getOperationAmount(); |
|
|
String operationAmount = dto.getOperationAmount(); |
|
@ -372,18 +431,24 @@ public class LoanSolutionsService extends MybatisBaseService<LoanSolutionsMapper |
|
|
receivableTotal = receivableTotal.add(new BigDecimal(operationAmount)); |
|
|
receivableTotal = receivableTotal.add(new BigDecimal(operationAmount)); |
|
|
loanSolutionsDetail.setOperationAmount(new BigDecimal(operationAmount)); |
|
|
loanSolutionsDetail.setOperationAmount(new BigDecimal(operationAmount)); |
|
|
|
|
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
loanSolutionsDetail.setOperationAmount(BigDecimal.ZERO); |
|
|
} |
|
|
} |
|
|
//补车价
|
|
|
//补车价
|
|
|
String vehOtherPrice = dto.getVehOtherPrice(); |
|
|
String vehOtherPrice = dto.getVehOtherPrice(); |
|
|
if (StringUtils.isNotBlank(vehOtherPrice)) { |
|
|
if (StringUtils.isNotBlank(vehOtherPrice)) { |
|
|
receivableTotal = receivableTotal.add(new BigDecimal(vehOtherPrice)); |
|
|
receivableTotal = receivableTotal.add(new BigDecimal(vehOtherPrice)); |
|
|
loanSolutionsDetail.setVehOtherPrice(new BigDecimal(vehOtherPrice)); |
|
|
loanSolutionsDetail.setVehOtherPrice(new BigDecimal(vehOtherPrice)); |
|
|
|
|
|
} else { |
|
|
|
|
|
loanSolutionsDetail.setVehOtherPrice(BigDecimal.ZERO); |
|
|
} |
|
|
} |
|
|
//其它费用
|
|
|
//其它费用
|
|
|
String otherAmount = dto.getOtherAmount(); |
|
|
String otherAmount = dto.getOtherAmount(); |
|
|
if (StringUtils.isNotBlank(otherAmount)) { |
|
|
if (StringUtils.isNotBlank(otherAmount)) { |
|
|
receivableTotal = receivableTotal.add(new BigDecimal(otherAmount)); |
|
|
receivableTotal = receivableTotal.add(new BigDecimal(otherAmount)); |
|
|
loanSolutionsDetail.setOtherAmount(new BigDecimal(otherAmount)); |
|
|
loanSolutionsDetail.setOtherAmount(new BigDecimal(otherAmount)); |
|
|
|
|
|
} else { |
|
|
|
|
|
loanSolutionsDetail.setOtherAmount(BigDecimal.ZERO); |
|
|
} |
|
|
} |
|
|
//其它费用说明
|
|
|
//其它费用说明
|
|
|
String otherAmountRemark = dto.getOtherAmountRemark(); |
|
|
String otherAmountRemark = dto.getOtherAmountRemark(); |
|
@ -391,17 +456,23 @@ public class LoanSolutionsService extends MybatisBaseService<LoanSolutionsMapper |
|
|
//办理方式选择
|
|
|
//办理方式选择
|
|
|
String dealWay = dto.getDealWay(); |
|
|
String dealWay = dto.getDealWay(); |
|
|
loanSolutionsDetail.setDealWay(dealWay); |
|
|
loanSolutionsDetail.setDealWay(dealWay); |
|
|
|
|
|
String dealWayKey = dto.getDealWayKey(); |
|
|
|
|
|
loanSolutionsDetail.setDealWayKey(dealWayKey); |
|
|
//代收首年保险费
|
|
|
//代收首年保险费
|
|
|
String proxyPremium = dto.getProxyPremium(); |
|
|
String proxyPremium = dto.getProxyPremium(); |
|
|
if (StringUtils.isNotBlank(proxyPremium)) { |
|
|
if (StringUtils.isNotBlank(proxyPremium)) { |
|
|
receivableTotal = receivableTotal.add(new BigDecimal(proxyPremium)); |
|
|
receivableTotal = receivableTotal.add(new BigDecimal(proxyPremium)); |
|
|
loanSolutionsDetail.setProxyPremium(new BigDecimal(proxyPremium)); |
|
|
loanSolutionsDetail.setProxyPremium(new BigDecimal(proxyPremium)); |
|
|
|
|
|
} else { |
|
|
|
|
|
loanSolutionsDetail.setProxyPremium(BigDecimal.ZERO); |
|
|
} |
|
|
} |
|
|
//代收购置费
|
|
|
//代收购置费
|
|
|
String proxyPurchasetax = dto.getProxyPurchasetax(); |
|
|
String proxyPurchasetax = dto.getProxyPurchasetax(); |
|
|
if (StringUtils.isNotBlank(proxyPurchasetax)) { |
|
|
if (StringUtils.isNotBlank(proxyPurchasetax)) { |
|
|
receivableTotal = receivableTotal.add(new BigDecimal(proxyPurchasetax)); |
|
|
receivableTotal = receivableTotal.add(new BigDecimal(proxyPurchasetax)); |
|
|
loanSolutionsDetail.setProxyPurchasetax(new BigDecimal(proxyPurchasetax)); |
|
|
loanSolutionsDetail.setProxyPurchasetax(new BigDecimal(proxyPurchasetax)); |
|
|
|
|
|
} else { |
|
|
|
|
|
loanSolutionsDetail.setProxyPurchasetax(BigDecimal.ZERO); |
|
|
} |
|
|
} |
|
|
//抵顶费用合计 = 抵顶首年保险费+抵顶购置税
|
|
|
//抵顶费用合计 = 抵顶首年保险费+抵顶购置税
|
|
|
BigDecimal offsetTotal = new BigDecimal(BigInteger.ZERO); |
|
|
BigDecimal offsetTotal = new BigDecimal(BigInteger.ZERO); |
|
@ -410,12 +481,16 @@ public class LoanSolutionsService extends MybatisBaseService<LoanSolutionsMapper |
|
|
if (StringUtils.isNotBlank(offsetPremium)) { |
|
|
if (StringUtils.isNotBlank(offsetPremium)) { |
|
|
offsetTotal = offsetTotal.add(new BigDecimal(offsetPremium)); |
|
|
offsetTotal = offsetTotal.add(new BigDecimal(offsetPremium)); |
|
|
loanSolutionsDetail.setOffsetPremium(new BigDecimal(offsetPremium)); |
|
|
loanSolutionsDetail.setOffsetPremium(new BigDecimal(offsetPremium)); |
|
|
|
|
|
} else { |
|
|
|
|
|
loanSolutionsDetail.setOffsetPremium(BigDecimal.ZERO); |
|
|
} |
|
|
} |
|
|
//抵顶购置税
|
|
|
//抵顶购置税
|
|
|
String offsetPurchasetax = dto.getOffsetPurchasetax(); |
|
|
String offsetPurchasetax = dto.getOffsetPurchasetax(); |
|
|
if (StringUtils.isNotBlank(offsetPurchasetax)) { |
|
|
if (StringUtils.isNotBlank(offsetPurchasetax)) { |
|
|
offsetTotal = offsetTotal.add(new BigDecimal(offsetPurchasetax)); |
|
|
offsetTotal = offsetTotal.add(new BigDecimal(offsetPurchasetax)); |
|
|
loanSolutionsDetail.setOffsetPurchasetax(new BigDecimal(offsetPurchasetax)); |
|
|
loanSolutionsDetail.setOffsetPurchasetax(new BigDecimal(offsetPurchasetax)); |
|
|
|
|
|
} else { |
|
|
|
|
|
loanSolutionsDetail.setOffsetPurchasetax(BigDecimal.ZERO); |
|
|
} |
|
|
} |
|
|
//实收合计 = 应收合计-抵顶合计
|
|
|
//实收合计 = 应收合计-抵顶合计
|
|
|
BigDecimal realTotal = receivableTotal.subtract(offsetTotal); |
|
|
BigDecimal realTotal = receivableTotal.subtract(offsetTotal); |
|
@ -428,19 +503,39 @@ public class LoanSolutionsService extends MybatisBaseService<LoanSolutionsMapper |
|
|
loanSolutionsDetail.setOffsetTotal(offsetTotal); |
|
|
loanSolutionsDetail.setOffsetTotal(offsetTotal); |
|
|
if (StringUtils.isNotBlank(vehTotalPrice)) { |
|
|
if (StringUtils.isNotBlank(vehTotalPrice)) { |
|
|
loanSolutionsDetail.setVehTotalPrice(new BigDecimal(vehTotalPrice)); |
|
|
loanSolutionsDetail.setVehTotalPrice(new BigDecimal(vehTotalPrice)); |
|
|
|
|
|
} else { |
|
|
|
|
|
loanSolutionsDetail.setVehTotalPrice(BigDecimal.ZERO); |
|
|
} |
|
|
} |
|
|
if (StringUtils.isNotBlank(nominalPrice)) { |
|
|
if (StringUtils.isNotBlank(nominalPrice)) { |
|
|
loanSolutionsDetail.setNominalPrice(new BigDecimal(nominalPrice)); |
|
|
loanSolutionsDetail.setNominalPrice(new BigDecimal(nominalPrice)); |
|
|
|
|
|
} else { |
|
|
|
|
|
loanSolutionsDetail.setNominalPrice(BigDecimal.ZERO); |
|
|
} |
|
|
} |
|
|
|
|
|
loanSolutionsDetail.setSolutionsSid(loanSolutions.getSid()); |
|
|
loanSolutionsDetailService.insert(loanSolutionsDetail); |
|
|
loanSolutionsDetailService.insert(loanSolutionsDetail); |
|
|
|
|
|
|
|
|
} else {//外部金融的只需要录入厂家贴息
|
|
|
} else {//外部金融的只需要录入厂家贴息
|
|
|
|
|
|
if(StringUtils.isNotBlank(dto.getTypeKey())){ |
|
|
|
|
|
loanSolutions.setType(dto.getType()); |
|
|
|
|
|
loanSolutions.setTypeKey(dto.getTypeKey()); |
|
|
|
|
|
} |
|
|
//查询金融方案
|
|
|
//查询金融方案
|
|
|
loanSolutions = new LoanSolutions(); |
|
|
loanSolutions = new LoanSolutions(); |
|
|
BeanUtil.copyProperties(dto, loanSolutions); |
|
|
|
|
|
if (StringUtils.isBlank(dto.getFactoryDiscount())) { |
|
|
if (StringUtils.isBlank(dto.getFactoryDiscount())) { |
|
|
loanSolutions.setFactoryDiscount(new BigDecimal(BigInteger.ZERO)); |
|
|
loanSolutions.setFactoryDiscount(new BigDecimal(BigInteger.ZERO)); |
|
|
|
|
|
}else{ |
|
|
|
|
|
loanSolutions.setFactoryDiscount(new BigDecimal(dto.getFactoryDiscount())); |
|
|
} |
|
|
} |
|
|
|
|
|
loanSolutions.setFactoryDiscountUse(dto.getFactoryDiscountUse()); |
|
|
|
|
|
LoanSolutionsDetail loanSolutionsDetail = new LoanSolutionsDetail(); |
|
|
|
|
|
if (StringUtils.isNotBlank(dto.getServiceAmount())) { |
|
|
|
|
|
loanSolutionsDetail.setServiceAmount(new BigDecimal(dto.getServiceAmount())); |
|
|
|
|
|
} else { |
|
|
|
|
|
loanSolutionsDetail.setServiceAmount(BigDecimal.ZERO); |
|
|
|
|
|
} |
|
|
|
|
|
loanSolutionsDetail.setSolutionsSid(loanSolutions.getSid()); |
|
|
|
|
|
loanSolutions.setSalesOrderSid(dto.getSaleOrderSid()); |
|
|
|
|
|
loanSolutionsDetailService.insert(loanSolutionsDetail); |
|
|
baseMapper.insert(loanSolutions); |
|
|
baseMapper.insert(loanSolutions); |
|
|
} |
|
|
} |
|
|
return rb.success(); |
|
|
return rb.success(); |
|
@ -454,8 +549,28 @@ public class LoanSolutionsService extends MybatisBaseService<LoanSolutionsMapper |
|
|
return rb; |
|
|
return rb; |
|
|
} |
|
|
} |
|
|
BeanUtil.copyProperties(loanSolutions, solutionsDetailsVo); |
|
|
BeanUtil.copyProperties(loanSolutions, solutionsDetailsVo); |
|
|
|
|
|
LoanSolutionsOtherpolicy loanSolutionsOtherpolicy = loanSolutionsOtherpolicyService.selectByLoanSid(loanSolutions.getSid()); |
|
|
|
|
|
if (loanSolutionsOtherpolicy != null) { |
|
|
|
|
|
BeanUtil.copyProperties(loanSolutionsOtherpolicy, solutionsDetailsVo); |
|
|
|
|
|
} |
|
|
|
|
|
LoanSolutionsDetail loanSolutionsDetail = loanSolutionsDetailService.selectLoanSid(loanSolutions.getSid()); |
|
|
|
|
|
if (loanSolutionsDetail != null) { |
|
|
|
|
|
BeanUtil.copyProperties(loanSolutionsDetail, solutionsDetailsVo); |
|
|
|
|
|
} |
|
|
return rb.success().setData(solutionsDetailsVo); |
|
|
return rb.success().setData(solutionsDetailsVo); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public ResultBean deleteByOrderSid(String sid) { |
|
|
|
|
|
ResultBean rb = ResultBean.fireFail(); |
|
|
|
|
|
//查询金融方案
|
|
|
|
|
|
LoanSolutions loanSolutions = baseMapper.selectBySaleOrderSid(sid); |
|
|
|
|
|
if (loanSolutions != null) { |
|
|
|
|
|
baseMapper.deleteByOrderSid(sid); |
|
|
|
|
|
loanSolutionsOtherpolicyService.deleteByLoanSid(loanSolutions.getSid()); |
|
|
|
|
|
loanSolutionsDetailService.deleteByLoanSid(loanSolutions.getSid()); |
|
|
|
|
|
} |
|
|
|
|
|
return rb.success(); |
|
|
|
|
|
} |
|
|
/* @Autowired |
|
|
/* @Autowired |
|
|
private LoanSolutionsTopService loanSolutionsTopService; |
|
|
private LoanSolutionsTopService loanSolutionsTopService; |
|
|
@Autowired |
|
|
@Autowired |
|
|