|
|
@ -10,6 +10,10 @@ import com.yxt.anrui.base.api.basetrailermodel.BaseTrailerModelDetailsVo; |
|
|
|
import com.yxt.anrui.base.api.basetrailermodel.BaseTrailerModelFeign; |
|
|
|
import com.yxt.anrui.base.api.basevehinstallmodel.BaseVehinstallmodelDetailsVo; |
|
|
|
import com.yxt.anrui.base.api.basevehinstallmodel.BaseVehinstallmodelFeign; |
|
|
|
import com.yxt.anrui.buscenter.api.bussalesordermodel.BusSalesOrderModel; |
|
|
|
import com.yxt.anrui.buscenter.api.bussalesordermodel.BusSalesOrderModelFeign; |
|
|
|
import com.yxt.anrui.buscenter.api.busvehicledatahandover.BusDataListPdfVo; |
|
|
|
import com.yxt.anrui.buscenter.api.busvehicledatahandover.BusVehicleDataHandoverPdfVo; |
|
|
|
import com.yxt.anrui.flowable.api.flow.FlowableFeign; |
|
|
|
import com.yxt.anrui.flowable.api.flow.UpdateFlowFieldVo; |
|
|
|
import com.yxt.anrui.flowable.api.flowtask.FlowTaskFeign; |
|
|
@ -48,22 +52,29 @@ import com.yxt.anrui.riskcenter.biz.loansolutionsdetail.LoanSolutionsDetailServi |
|
|
|
import com.yxt.anrui.riskcenter.biz.loansolutionsotherpolicy.LoanSolutionsOtherpolicyService; |
|
|
|
import com.yxt.anrui.riskcenter.biz.loantemplateinstall.LoanTemplateInstallService; |
|
|
|
import com.yxt.anrui.riskcenter.biz.loantemplatetrailer.LoanTemplateTrailerService; |
|
|
|
import com.yxt.common.base.config.component.DocPdfComponent; |
|
|
|
import com.yxt.common.base.config.component.FileUploadComponent; |
|
|
|
import com.yxt.common.base.service.MybatisBaseService; |
|
|
|
import com.yxt.common.base.utils.PagerUtil; |
|
|
|
import com.yxt.common.base.utils.StringUtils; |
|
|
|
import com.yxt.common.base.utils.WordConvertUtils; |
|
|
|
import com.yxt.common.core.query.PagerQuery; |
|
|
|
import com.yxt.common.core.result.ResultBean; |
|
|
|
import com.yxt.common.core.vo.PagerVo; |
|
|
|
import com.yxt.messagecenter.api.message.MessageFeign; |
|
|
|
import com.yxt.messagecenter.api.message.MessageFlowVo; |
|
|
|
import com.yxt.messagecenter.api.message.MessageFlowableQuery; |
|
|
|
import io.swagger.annotations.ApiModelProperty; |
|
|
|
import org.apache.tomcat.util.threads.ThreadPoolExecutor; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.context.annotation.Bean; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
|
|
|
|
import java.io.File; |
|
|
|
import java.io.InputStream; |
|
|
|
import java.math.BigDecimal; |
|
|
|
import java.text.SimpleDateFormat; |
|
|
|
import java.util.*; |
|
|
|
import java.util.concurrent.*; |
|
|
|
import java.util.stream.Collectors; |
|
|
@ -105,7 +116,10 @@ public class LoanTemplateService extends MybatisBaseService<LoanTemplateMapper, |
|
|
|
private LoanSolutionsOtherpolicyService loanSolutionsOtherpolicyService; |
|
|
|
@Autowired |
|
|
|
private LoanSolutionsDetailService loanSolutionsDetailService; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private BusSalesOrderModelFeign busSalesOrderModelFeign; |
|
|
|
@Autowired |
|
|
|
private DocPdfComponent docPdfComponent; |
|
|
|
|
|
|
|
public PagerVo<LoanTemplateVo> listPageVo(PagerQuery<LoanTemplateQuery> pq) { |
|
|
|
LoanTemplateQuery query = pq.getParams(); |
|
|
@ -740,4 +754,249 @@ public class LoanTemplateService extends MybatisBaseService<LoanTemplateMapper, |
|
|
|
} |
|
|
|
return rb.success(); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 预估报价单展示方式 |
|
|
|
* |
|
|
|
* @param query |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
public ResultBean<LoanTemplateQuotationVo> showTemplateQuotation(LoanTemplateQuotationQuery query) { |
|
|
|
ResultBean<LoanTemplateQuotationVo> rb = ResultBean.fireFail(); |
|
|
|
LoanTemplateQuotationVo vo = new LoanTemplateQuotationVo(); |
|
|
|
String salesOrderSid = query.getSalesOrderSid(); |
|
|
|
String typeKey = query.getRevalencySchemeKey(); |
|
|
|
BusSalesOrderModel model = busSalesOrderModelFeign.fetchByOrderSid(salesOrderSid).getData(); |
|
|
|
//-----------车型-----------
|
|
|
|
if (null != model) { |
|
|
|
if (StringUtils.isNotBlank(model.getModelName())) { |
|
|
|
vo.setVehModel(model.getModelName()); |
|
|
|
} |
|
|
|
} |
|
|
|
LoanSolutions loanSolutions = loanSolutionsService.selectBySaleOrderSid(salesOrderSid); |
|
|
|
StringBuffer sb = new StringBuffer(); |
|
|
|
if (null != loanSolutions) { |
|
|
|
//-----------融资项目-----------
|
|
|
|
if (null != loanSolutions.getMainVehicleAmount()) { |
|
|
|
sb.append("主车:" + loanSolutions.getMainVehicleAmount().toString() + "元").append(","); |
|
|
|
} |
|
|
|
if (null != loanSolutions.getAccessoriesAmount()) { |
|
|
|
sb.append("融资票据:" + loanSolutions.getAccessoriesAmount().toString() + "元").append(","); |
|
|
|
} |
|
|
|
if (null != loanSolutions.getTrailerAmount()) { |
|
|
|
sb.append("挂车:" + loanSolutions.getTrailerAmount().toString() + "元").append(","); |
|
|
|
} |
|
|
|
if (null != loanSolutions.getPremium()) { |
|
|
|
sb.append("保险:" + loanSolutions.getPremium().toString() + "元").append(","); |
|
|
|
} |
|
|
|
if (null != loanSolutions.getPurchaseTax()) { |
|
|
|
sb.append("购置税:" + loanSolutions.getPurchaseTax().toString() + "元").append(","); |
|
|
|
} |
|
|
|
if (sb.length() > 0) { |
|
|
|
sb.delete(sb.length() - 1, sb.length()); |
|
|
|
vo.setTemplateName("融资项目总额:" + loanSolutions.getLoanTotal().toString() + "元" + "(" + sb.toString() + ")"); |
|
|
|
} |
|
|
|
//-----------期数-----------
|
|
|
|
if (StringUtils.isNotBlank(loanSolutions.getLoanPeriod())) { |
|
|
|
vo.setLoanPeriod(loanSolutions.getLoanPeriod()); |
|
|
|
} |
|
|
|
LoanSolutionsOtherpolicy otherpolicy = loanSolutionsOtherpolicyService.selectByLoanSid(loanSolutions.getSid()); |
|
|
|
if (otherpolicy != null) { |
|
|
|
//----------前X期月还/剩余月还-------------
|
|
|
|
if (StringUtils.isNotBlank(otherpolicy.getPeriod())) { |
|
|
|
String period = otherpolicy.getPeriod(); |
|
|
|
String[] split = period.split("/"); |
|
|
|
String beforePeriod = split[0]; |
|
|
|
String afterPeriod = split[1]; |
|
|
|
if (beforePeriod.equals("0") && !afterPeriod.equals("0")) { |
|
|
|
vo.setTimes(afterPeriod); |
|
|
|
vo.setPreviousRepay("¥" + otherpolicy.getMonthlyRepay()); |
|
|
|
vo.setMonthlyRepay("-"); |
|
|
|
} else if (!beforePeriod.equals("0") && afterPeriod.equals("0")) { |
|
|
|
String monthlyRepay = otherpolicy.getMonthlyRepay(); |
|
|
|
vo.setTimes(beforePeriod); |
|
|
|
String[] splitMonthlyPepay = monthlyRepay.split("/"); |
|
|
|
String beforeMoney = splitMonthlyPepay[0]; |
|
|
|
vo.setPreviousRepay("¥" + beforeMoney); |
|
|
|
vo.setMonthlyRepay("-"); |
|
|
|
} else { |
|
|
|
String monthlyRepay = otherpolicy.getMonthlyRepay(); |
|
|
|
vo.setTimes(beforePeriod); |
|
|
|
String[] splitMonthlyPepay = monthlyRepay.split("/"); |
|
|
|
String beforeMoney = splitMonthlyPepay[0]; |
|
|
|
String afterMoney = splitMonthlyPepay[1]; |
|
|
|
vo.setPreviousRepay("¥" + beforeMoney); |
|
|
|
vo.setMonthlyRepay("¥" + afterMoney); |
|
|
|
} |
|
|
|
} |
|
|
|
//----------预计首期还款日-------------
|
|
|
|
if (StringUtils.isNotBlank(otherpolicy.getReturnTime())) { |
|
|
|
vo.setReturnTime(otherpolicy.getReturnTime()); |
|
|
|
} |
|
|
|
} |
|
|
|
LoanSolutionsDetail solutionsDetail = loanSolutionsDetailService.selectLoanSid(loanSolutions.getSid()); |
|
|
|
if (null != solutionsDetail) { |
|
|
|
//-----------名义价款-----------
|
|
|
|
if (null != solutionsDetail.getNominalPrice()) { |
|
|
|
vo.setNominalPrice("¥" + solutionsDetail.getNominalPrice().toString()); |
|
|
|
} |
|
|
|
//-----------方案234通用------------------
|
|
|
|
if (query.getRevalencySchemeKey().equals("002") || query.getRevalencySchemeKey().equals("003") || query.getRevalencySchemeKey().equals("004")) { |
|
|
|
//-----------预估应收合计------------------
|
|
|
|
if (null != solutionsDetail.getReceivableTotal()) { |
|
|
|
vo.setReceivableTotal("¥" + solutionsDetail.getReceivableTotal().toString()); |
|
|
|
} |
|
|
|
} |
|
|
|
//-----------方案34通用------------------
|
|
|
|
if (query.getRevalencySchemeKey().equals("003") || query.getRevalencySchemeKey().equals("004")) { |
|
|
|
//-----------贷款保证金------------------
|
|
|
|
if (null != solutionsDetail.getBondAmounts()) { |
|
|
|
vo.setBondAmounts("¥" + solutionsDetail.getBondAmounts().toString()); |
|
|
|
} |
|
|
|
//-----------落户保证金------------------
|
|
|
|
if (null != solutionsDetail.getDepositSettle()) { |
|
|
|
vo.setDepositSettle("¥" + solutionsDetail.getDepositSettle().toString()); |
|
|
|
} |
|
|
|
//-----------保险保证金------------------
|
|
|
|
if (null != solutionsDetail.getDepositPremium()) { |
|
|
|
vo.setDepositPremium("¥" + solutionsDetail.getDepositPremium().toString()); |
|
|
|
} |
|
|
|
} |
|
|
|
//-----------方案4通用------------------
|
|
|
|
if (query.getRevalencySchemeKey().equals("004")) { |
|
|
|
//-----------融资首付------------------
|
|
|
|
if (null != solutionsDetail.getDownPayAmounts()) { |
|
|
|
vo.setDownPayAmounts("¥" + solutionsDetail.getDownPayAmounts().toString()); |
|
|
|
} |
|
|
|
//-----------代收首年保险费------------------
|
|
|
|
if (null != solutionsDetail.getProxyPremium()) { |
|
|
|
vo.setProxyPremium("¥" + solutionsDetail.getProxyPremium().toString()); |
|
|
|
} |
|
|
|
//-----------代收购置税------------------
|
|
|
|
if (null != solutionsDetail.getProxyPurchasetax()) { |
|
|
|
vo.setProxyPurchasetax("¥" + solutionsDetail.getProxyPurchasetax().toString()); |
|
|
|
} |
|
|
|
//-----------代收意外险------------------
|
|
|
|
if (null != solutionsDetail.getProxyAccidentPremium()) { |
|
|
|
vo.setProxyAccidentPremium("¥" + solutionsDetail.getProxyAccidentPremium().toString()); |
|
|
|
} |
|
|
|
//-----------服务费------------------
|
|
|
|
if (null != solutionsDetail.getServiceAmount()) { |
|
|
|
vo.setServiceAmount("¥" + solutionsDetail.getServiceAmount().toString()); |
|
|
|
} |
|
|
|
//-----------补车价------------------
|
|
|
|
if (null != solutionsDetail.getVehOtherPrice()) { |
|
|
|
vo.setVehOtherPrice("¥" + solutionsDetail.getVehOtherPrice().toString()); |
|
|
|
} |
|
|
|
//-----------其他费用------------------
|
|
|
|
if (null != solutionsDetail.getOtherAmount()) { |
|
|
|
vo.setOtherAmount("¥" + solutionsDetail.getOtherAmount().toString()); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
return rb.success().setData(vo); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 预估报价单打印 |
|
|
|
* |
|
|
|
* @param query |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
public ResultBean<String> templateQuotationCreatePdf(LoanTemplateQuotationQuery query) { |
|
|
|
ResultBean<String> rb = ResultBean.fireFail(); |
|
|
|
String template = "/template/"; |
|
|
|
String s = templateQuotation(query); |
|
|
|
String filePath = s.substring(docPdfComponent.getUploadTemplateUrl().length()); |
|
|
|
return rb.success().setData(template + filePath); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 方案打印 |
|
|
|
* |
|
|
|
* @param query |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
public String templateQuotation(LoanTemplateQuotationQuery query) { |
|
|
|
LoanTemplateQuotationVo pdfVo = showTemplateQuotation(query).getData(); |
|
|
|
String path = ""; |
|
|
|
if (null != pdfVo) { |
|
|
|
Map<String, Object> dataMap = new HashMap<String, Object>(); |
|
|
|
dataMap.put("vehModel", pdfVo.getVehModel()); |
|
|
|
dataMap.put("templateName", pdfVo.getTemplateName()); |
|
|
|
dataMap.put("loanPeriod", pdfVo.getLoanPeriod()); |
|
|
|
dataMap.put("times", pdfVo.getTimes()); |
|
|
|
dataMap.put("previousRepay", pdfVo.getPreviousRepay()); |
|
|
|
dataMap.put("monthlyRepay", pdfVo.getMonthlyRepay()); |
|
|
|
dataMap.put("returnTime", pdfVo.getReturnTime()); |
|
|
|
dataMap.put("nominalPrice", pdfVo.getNominalPrice()); |
|
|
|
//-----------方案234通用------------------
|
|
|
|
if (query.getRevalencySchemeKey().equals("002") || query.getRevalencySchemeKey().equals("003") || query.getRevalencySchemeKey().equals("004")) { |
|
|
|
//-----------预估应收合计------------------
|
|
|
|
dataMap.put("receivableTotal", pdfVo.getReceivableTotal()); |
|
|
|
} |
|
|
|
//-----------方案34通用------------------
|
|
|
|
if (query.getRevalencySchemeKey().equals("003") || query.getRevalencySchemeKey().equals("004")) { |
|
|
|
//-----------贷款保证金------------------
|
|
|
|
dataMap.put("bondAmounts", pdfVo.getBondAmounts()); |
|
|
|
//-----------落户保证金------------------
|
|
|
|
dataMap.put("depositSettle", pdfVo.getDepositSettle()); |
|
|
|
//-----------保险保证金------------------
|
|
|
|
dataMap.put("depositPremium", pdfVo.getDepositPremium()); |
|
|
|
} |
|
|
|
//-----------方案4通用------------------
|
|
|
|
if (query.getRevalencySchemeKey().equals("004")) { |
|
|
|
//-----------融资首付------------------
|
|
|
|
dataMap.put("downPayAmounts", pdfVo.getDownPayAmounts()); |
|
|
|
//-----------代收首年保险费------------------
|
|
|
|
dataMap.put("proxyPremium", pdfVo.getProxyPremium()); |
|
|
|
//-----------代收购置税------------------
|
|
|
|
dataMap.put("proxyPurchasetax", pdfVo.getProxyPurchasetax()); |
|
|
|
//-----------代收意外险------------------
|
|
|
|
dataMap.put("proxyAccidentPremium", pdfVo.getProxyPremium()); |
|
|
|
//-----------服务费------------------
|
|
|
|
dataMap.put("serviceAmount", pdfVo.getServiceAmount()); |
|
|
|
//-----------补车价------------------
|
|
|
|
dataMap.put("vehOtherPrice", pdfVo.getVehOtherPrice()); |
|
|
|
//-----------其他费用------------------
|
|
|
|
dataMap.put("otherAmount", pdfVo.getOtherAmount()); |
|
|
|
} |
|
|
|
String targetPath = docPdfComponent.getUploadTemplateUrl(); |
|
|
|
try { |
|
|
|
String resourceAsStreamPath = ""; |
|
|
|
if (query.getRevalencySchemeKey().equals("001")) { |
|
|
|
resourceAsStreamPath = "ftl/templateQuotationOne.ftl"; |
|
|
|
} else if (query.getRevalencySchemeKey().equals("002")) { |
|
|
|
resourceAsStreamPath = "ftl/templateQuotationTwo.ftl"; |
|
|
|
} else if (query.getRevalencySchemeKey().equals("003")) { |
|
|
|
resourceAsStreamPath = "ftl/templateQuotationThree.ftl"; |
|
|
|
} else if (query.getRevalencySchemeKey().equals("004")) { |
|
|
|
resourceAsStreamPath = "ftl/templateQuotationFour.ftl"; |
|
|
|
} |
|
|
|
//获取模板
|
|
|
|
InputStream inputStream = this.getClass().getClassLoader().getResourceAsStream(resourceAsStreamPath); |
|
|
|
//生成word文件名
|
|
|
|
String dateStr = DateUtil.format(new Date(), "yyyyMMdd"); |
|
|
|
long seconds = System.currentTimeMillis(); |
|
|
|
String typeName = dateStr + seconds + ".doc"; |
|
|
|
File file = new File(targetPath + "templateQuotation" + seconds + ".ftl"); |
|
|
|
File dir = new File(targetPath); |
|
|
|
WordConvertUtils.inputStreamToFile(inputStream, file); |
|
|
|
WordConvertUtils.creatWord1(dataMap, file, targetPath, typeName, dir); |
|
|
|
//新生成的word路径
|
|
|
|
String wordPath = targetPath + typeName; |
|
|
|
//生成出门证文件名
|
|
|
|
String pdfName = "预估报价单" + dateStr + seconds + ".pdf"; |
|
|
|
WordConvertUtils.doc2pdf(wordPath, targetPath, pdfName); |
|
|
|
path = targetPath + pdfName; |
|
|
|
} catch (NoClassDefFoundError e) { |
|
|
|
e.printStackTrace(); |
|
|
|
path = targetPath; |
|
|
|
} |
|
|
|
return path; |
|
|
|
} else { |
|
|
|
return path; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|