|
|
@ -686,6 +686,9 @@ public class LoanSolutionsService extends MybatisBaseService<LoanSolutionsMapper |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public ResultBean saveDtoss(SolutionDetailsDto dto) { |
|
|
|
ResultBean rb = ResultBean.fireFail(); |
|
|
|
//查詢是否有金融方案
|
|
|
|
LoanSolutions loanSolutions = baseMapper.selectByApplySid(dto.getBusSid()); |
|
|
|
if(dto.isShowMore()){ |
|
|
|
String mainVehicleAmount = dto.getMainVehicleAmount(); |
|
|
|
if (StringUtils.isBlank(mainVehicleAmount)) { |
|
|
|
return rb.setMsg("主车发票价不能为空"); |
|
|
@ -753,8 +756,6 @@ public class LoanSolutionsService extends MybatisBaseService<LoanSolutionsMapper |
|
|
|
if (StringUtils.isBlank(loanPeriod)) { |
|
|
|
return rb.setMsg("主方案期数不能为空"); |
|
|
|
} |
|
|
|
//查詢是否有金融方案
|
|
|
|
LoanSolutions loanSolutions = baseMapper.selectByApplySid(dto.getBusSid()); |
|
|
|
if (loanSolutions != null) { |
|
|
|
baseMapper.deleteByOrderSid(dto.getBusSid()); |
|
|
|
loanSolutionsOtherpolicyService.deleteByLoanSid(loanSolutions.getSid()); |
|
|
@ -929,6 +930,36 @@ public class LoanSolutionsService extends MybatisBaseService<LoanSolutionsMapper |
|
|
|
loanSolutionsDetail.setNominalPrice(StringUtils.isNotBlank(nominalPrice) ? new BigDecimal(nominalPrice) : BigDecimal.ZERO); |
|
|
|
loanSolutionsDetail.setSolutionsSid(loanSolutions.getSid()); |
|
|
|
loanSolutionsDetailService.insert(loanSolutionsDetail); |
|
|
|
}else{ |
|
|
|
if (loanSolutions != null) { |
|
|
|
baseMapper.deleteByOrderSid(dto.getBusSid()); |
|
|
|
loanSolutionsOtherpolicyService.deleteByLoanSid(loanSolutions.getSid()); |
|
|
|
loanSolutionsDetailService.deleteByLoanSid(loanSolutions.getSid()); |
|
|
|
} |
|
|
|
loanSolutions = new LoanSolutions(); |
|
|
|
//产品政策名称
|
|
|
|
String policyName = dto.getPolicyName(); |
|
|
|
if (StringUtils.isNotBlank(policyName)) { |
|
|
|
loanSolutions.setPolicyName(policyName); |
|
|
|
} |
|
|
|
if (StringUtils.isBlank(dto.getFactoryDiscount())) { |
|
|
|
loanSolutions.setFactoryDiscount(new BigDecimal(BigInteger.ZERO)); |
|
|
|
} else { |
|
|
|
loanSolutions.setFactoryDiscount(new BigDecimal(dto.getFactoryDiscount())); |
|
|
|
} |
|
|
|
loanSolutions.setDiscountCar(StringUtils.isNotBlank(dto.getDiscountCar())?new BigDecimal(dto.getDiscountCar()):BigDecimal.ZERO); |
|
|
|
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.getBusSid()); |
|
|
|
loanSolutionsDetailService.insert(loanSolutionsDetail); |
|
|
|
baseMapper.insert(loanSolutions); |
|
|
|
} |
|
|
|
return rb.success(); |
|
|
|
} |
|
|
|
|
|
|
@ -940,6 +971,9 @@ public class LoanSolutionsService extends MybatisBaseService<LoanSolutionsMapper |
|
|
|
return rb; |
|
|
|
} |
|
|
|
BeanUtil.copyProperties(loanSolutions, solutionsDetailsVo); |
|
|
|
if (loanSolutions.getTrailerAmount() != null) { |
|
|
|
solutionsDetailsVo.setGcPrice(loanSolutions.getTrailerAmount().toString()); |
|
|
|
} |
|
|
|
LoanSolutionsOtherpolicy loanSolutionsOtherpolicy = loanSolutionsOtherpolicyService.selectByLoanSid(loanSolutions.getSid()); |
|
|
|
if (loanSolutionsOtherpolicy != null) { |
|
|
|
BeanUtil.copyProperties(loanSolutionsOtherpolicy, solutionsDetailsVo); |
|
|
@ -948,19 +982,21 @@ public class LoanSolutionsService extends MybatisBaseService<LoanSolutionsMapper |
|
|
|
if (loanSolutionsDetail != null) { |
|
|
|
BeanUtil.copyProperties(loanSolutionsDetail, solutionsDetailsVo); |
|
|
|
} |
|
|
|
//根据销售订单sid查询销售订单的信息
|
|
|
|
ResultBean<AppOrderDetailsVo> resultBean = busSalesOrderFeign.getSaleOrderDetails(loanSolutions.getSalesOrderSid()); |
|
|
|
//查询销售订单的状态
|
|
|
|
ResultBean<BusSalesOrdersVo> resultBean = busSalesOrderFeign.getSalesOrderOne(businessSid); |
|
|
|
if (resultBean.getData() != null) { |
|
|
|
AppOrderDetailsVo appOrderDetailsVo = resultBean.getData(); |
|
|
|
//单车主车、挂车、上装成交价
|
|
|
|
AppOrderPriceInfoVo appOrderPriceInfoVo = appOrderDetailsVo.getPriceInfo(); |
|
|
|
if (appOrderPriceInfoVo != null) { |
|
|
|
solutionsDetailsVo.setFinalPrice(appOrderPriceInfoVo.getTransactionPrice()); |
|
|
|
solutionsDetailsVo.setGcPrice(appOrderPriceInfoVo.getGcPrice()); |
|
|
|
solutionsDetailsVo.setSzPrice(appOrderPriceInfoVo.getSzPrice()); |
|
|
|
BusSalesOrdersVo busSalesOrdersVo = resultBean.getData(); |
|
|
|
solutionsDetailsVo.setSzPrice(busSalesOrdersVo.getSzPrice()); |
|
|
|
solutionsDetailsVo.setFinalPrice(busSalesOrdersVo.getFinalPrice()); |
|
|
|
if (busSalesOrdersVo.getBusSalesOrder() != null) { |
|
|
|
BusSalesOrder busSalesOrder = busSalesOrdersVo.getBusSalesOrder(); |
|
|
|
//全款且为三方金融
|
|
|
|
if ("1".equals(busSalesOrder.getPayTypeKey()) && "2".equals(busSalesOrder.getFinancePlan())) { |
|
|
|
solutionsDetailsVo.setShowMore(false); |
|
|
|
} else if ("2".equals(busSalesOrder.getPayTypeKey())) {//贷款
|
|
|
|
solutionsDetailsVo.setShowMore(true); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
return rb.success().setData(solutionsDetailsVo); |
|
|
|
} |
|
|
@ -973,6 +1009,9 @@ public class LoanSolutionsService extends MybatisBaseService<LoanSolutionsMapper |
|
|
|
return rb; |
|
|
|
} |
|
|
|
BeanUtil.copyProperties(loanSolutions, solutionsDetailsVo); |
|
|
|
if (loanSolutions.getTrailerAmount() != null) { |
|
|
|
solutionsDetailsVo.setGcPrice(loanSolutions.getTrailerAmount().toString()); |
|
|
|
} |
|
|
|
LoanSolutionsOtherpolicy loanSolutionsOtherpolicy = loanSolutionsOtherpolicyService.selectByLoanSid(loanSolutions.getSid()); |
|
|
|
if (loanSolutionsOtherpolicy != null) { |
|
|
|
BeanUtil.copyProperties(loanSolutionsOtherpolicy, solutionsDetailsVo); |
|
|
@ -981,6 +1020,22 @@ public class LoanSolutionsService extends MybatisBaseService<LoanSolutionsMapper |
|
|
|
if (loanSolutionsDetail != null) { |
|
|
|
BeanUtil.copyProperties(loanSolutionsDetail, solutionsDetailsVo); |
|
|
|
} |
|
|
|
//查询销售订单的状态
|
|
|
|
ResultBean<BusSalesOrdersVo> resultBean = busSalesOrderFeign.getSalesOrderOne(businessSid); |
|
|
|
if (resultBean.getData() != null) { |
|
|
|
BusSalesOrdersVo busSalesOrdersVo = resultBean.getData(); |
|
|
|
solutionsDetailsVo.setSzPrice(busSalesOrdersVo.getSzPrice()); |
|
|
|
solutionsDetailsVo.setFinalPrice(busSalesOrdersVo.getFinalPrice()); |
|
|
|
if (busSalesOrdersVo.getBusSalesOrder() != null) { |
|
|
|
BusSalesOrder busSalesOrder = busSalesOrdersVo.getBusSalesOrder(); |
|
|
|
//全款且为三方金融
|
|
|
|
if ("1".equals(busSalesOrder.getPayTypeKey()) && "2".equals(busSalesOrder.getFinancePlan())) { |
|
|
|
solutionsDetailsVo.setShowMore(false); |
|
|
|
} else if ("2".equals(busSalesOrder.getPayTypeKey())) {//贷款
|
|
|
|
solutionsDetailsVo.setShowMore(true); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
return rb.success().setData(solutionsDetailsVo); |
|
|
|
} |
|
|
|
|
|
|
@ -1456,6 +1511,12 @@ public class LoanSolutionsService extends MybatisBaseService<LoanSolutionsMapper |
|
|
|
solutionssVo.setOtherPolicySid(loanFinOtherPolicy.getSid()); |
|
|
|
solutionssVo.setOtherPolicyPeriod(String.valueOf(loanFinOtherPolicy.getPeriod())); |
|
|
|
solutionssVo.setOtherPolicyYearRatio(loanFinOtherPolicy.getYearRatio().toString()); |
|
|
|
solutionssVo.setOtherPolicyIsMain(true); |
|
|
|
} |
|
|
|
}else{ |
|
|
|
LoanFinOtherPolicy loanFinOtherPolicy = loanFinOtherPolicyService.selectByMainSid(loanSolutions.getPolicySid()); |
|
|
|
if (loanFinOtherPolicy != null) { |
|
|
|
solutionssVo.setOtherPolicyIsMain(true); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -1859,10 +1920,9 @@ public class LoanSolutionsService extends MybatisBaseService<LoanSolutionsMapper |
|
|
|
dealWayValue = dealWayValue.append("办理方式选择:").append("-"); |
|
|
|
} |
|
|
|
list.add(getValueSpanSize(dealWayValue.toString(), 2, 2, false)); |
|
|
|
//抵顶费用合计
|
|
|
|
StringBuilder proxyTotalValue = new StringBuilder(); |
|
|
|
if (StringUtils.isNotBlank(solutionssVo.getProxyTotal())) { |
|
|
|
proxyTotalValue = proxyTotalValue.append("代收合计:").append(solutionssVo.getOffsetTotal()); |
|
|
|
proxyTotalValue = proxyTotalValue.append("代收合计:").append(solutionssVo.getProxyTotal()); |
|
|
|
} else { |
|
|
|
proxyTotalValue = proxyTotalValue.append("代收合计:").append("-"); |
|
|
|
} |
|
|
@ -1971,9 +2031,9 @@ public class LoanSolutionsService extends MybatisBaseService<LoanSolutionsMapper |
|
|
|
//贴息抵车款
|
|
|
|
StringBuilder factoryDiscountUseMoneyValue = new StringBuilder(); |
|
|
|
if (StringUtils.isNotBlank(solutionssVo.getDiscountCar())) { |
|
|
|
factoryDiscountUseMoneyValue = factoryDiscountUseValue.append("贴息抵车款:").append(solutionssVo.getDiscountCar()); |
|
|
|
factoryDiscountUseMoneyValue = factoryDiscountUseMoneyValue.append("贴息抵车款:").append(solutionssVo.getDiscountCar()); |
|
|
|
} else { |
|
|
|
factoryDiscountUseMoneyValue = factoryDiscountUseValue.append("贴息抵车款:").append("-"); |
|
|
|
factoryDiscountUseMoneyValue = factoryDiscountUseMoneyValue.append("贴息抵车款:").append("-"); |
|
|
|
} |
|
|
|
list.add(getValueSpanSize(factoryDiscountUseMoneyValue.toString(), 1, 0, false)); |
|
|
|
list.add(getValueSpanSize("应收明细", 2, 1, true)); |
|
|
@ -2013,6 +2073,46 @@ public class LoanSolutionsService extends MybatisBaseService<LoanSolutionsMapper |
|
|
|
SolutionssVo solutionssVo = new SolutionssVo(); |
|
|
|
BeanUtil.copyProperties(query, solutionssVo); |
|
|
|
if (query.isShowMore()) { |
|
|
|
if (query.isPremiumCb()) { |
|
|
|
//保险
|
|
|
|
String premium = query.getPremium(); |
|
|
|
if (StringUtils.isBlank(premium)) { |
|
|
|
return rb.setMsg("请输入保险金额"); |
|
|
|
} else { |
|
|
|
if (StringUtils.isNotBlank(query.getOffsetPremium())) { |
|
|
|
if (new BigDecimal(query.getOffsetPremium()).compareTo(new BigDecimal(premium)) > 0) { |
|
|
|
return rb.setMsg("抵顶首年保险费不能超过保险费用"); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
if (StringUtils.isNotBlank(query.getOffsetPremium())) { |
|
|
|
if (new BigDecimal(query.getOffsetPremium()).compareTo(BigDecimal.ZERO) > 0) { |
|
|
|
return rb.setMsg("抵顶首年保险费不能超过保险费用"); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
//是否勾选购置税
|
|
|
|
if (query.isPurchaseTaxCb()) { |
|
|
|
//购置税
|
|
|
|
String purchaseTax = query.getPurchaseTax(); |
|
|
|
if (StringUtils.isBlank(purchaseTax)) { |
|
|
|
return rb.setMsg("请输入购置税"); |
|
|
|
} else { |
|
|
|
if (StringUtils.isNotBlank(query.getOffsetPurchasetax())) { |
|
|
|
if (new BigDecimal(query.getOffsetPurchasetax()).compareTo(new BigDecimal(purchaseTax)) > 0) { |
|
|
|
return rb.setMsg("抵顶购置税不能超过购置税"); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} else { |
|
|
|
if (StringUtils.isNotBlank(query.getOffsetPurchasetax())) { |
|
|
|
if (new BigDecimal(query.getOffsetPurchasetax()).compareTo(BigDecimal.ZERO) > 0) { |
|
|
|
return rb.setMsg("抵顶购置税不能超过购置税"); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
CalculateQuery calculateQuery = new CalculateQuery(); |
|
|
|
BeanUtil.copyProperties(query, calculateQuery); |
|
|
|
ResultBean<CalculateVo> resultBean = calculate(calculateQuery); |
|
|
@ -2027,6 +2127,10 @@ public class LoanSolutionsService extends MybatisBaseService<LoanSolutionsMapper |
|
|
|
return rb.success().setData(solutionssVo); |
|
|
|
} |
|
|
|
|
|
|
|
public LoanSolutions selectByApplySid(String sid) { |
|
|
|
return baseMapper.selectByApplySid(sid); |
|
|
|
} |
|
|
|
|
|
|
|
/* @Autowired |
|
|
|
private LoanSolutionsTopService loanSolutionsTopService; |
|
|
|
@Autowired |
|
|
|