|
|
@ -1,22 +1,21 @@ |
|
|
|
package com.yxt.anrui.base.biz.commoncontract; |
|
|
|
|
|
|
|
import cn.hutool.core.bean.BeanUtil; |
|
|
|
import cn.hutool.core.date.DateTime; |
|
|
|
import cn.hutool.core.date.DateUtil; |
|
|
|
import com.alibaba.fastjson.JSON; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
|
import com.google.common.util.concurrent.ThreadFactoryBuilder; |
|
|
|
import com.yxt.anrui.base.api.basedistributor.BaseDistributor; |
|
|
|
import com.yxt.anrui.base.api.basemodelconfig.BaseModelConfig; |
|
|
|
import com.yxt.anrui.base.api.basevehicle.BaseVehicle; |
|
|
|
import com.yxt.anrui.base.api.basevehicle.BaseVehicleFeign; |
|
|
|
import com.yxt.anrui.base.api.basevehicle.BaseVehicleSelectVo; |
|
|
|
import com.yxt.anrui.base.api.basevehiclemodel.BaseVehicleModel; |
|
|
|
import com.yxt.anrui.base.api.basevehiclemodel.BaseVehicleModelFeign; |
|
|
|
import com.yxt.anrui.base.api.commonappendix.CommonAppendix; |
|
|
|
import com.yxt.anrui.base.api.commonappendix.CommonAttachTypeEnum; |
|
|
|
import com.yxt.anrui.base.api.commoncontract.*; |
|
|
|
import com.yxt.anrui.base.api.commoncontract.flowable.*; |
|
|
|
import com.yxt.anrui.base.biz.basedistributor.BaseDistributorService; |
|
|
|
import com.yxt.anrui.base.biz.basemodelconfig.BaseModelConfigService; |
|
|
|
import com.yxt.anrui.base.biz.basemodelszconfig.BaseModelSzconfigService; |
|
|
|
import com.yxt.anrui.base.biz.basepurchasesystem.BasePurchaseSystemService; |
|
|
@ -43,8 +42,6 @@ import com.yxt.anrui.buscenter.api.busvehicleinformation.BusVehicleInformation; |
|
|
|
import com.yxt.anrui.buscenter.api.busvehicleinformation.BusVehicleInformationFeign; |
|
|
|
import com.yxt.anrui.buscenter.api.busvehicleinformationhandover.BusVehicleInformationHandover; |
|
|
|
import com.yxt.anrui.buscenter.api.busvehicleinformationhandover.BusVehicleInformationHandoverFeign; |
|
|
|
import com.yxt.anrui.buscenter.api.busvehicleinformationhandover.BusVehicleInformationHandoverQuery; |
|
|
|
import com.yxt.anrui.buscenter.api.busvehicleinformationhandover.BusVehicleInformationHandoverVo; |
|
|
|
import com.yxt.anrui.crm.api.crmcustomer.CrmCustomerFeign; |
|
|
|
import com.yxt.anrui.crm.api.crmcustomerfile.CrmCustomerFileFeign; |
|
|
|
import com.yxt.anrui.crm.api.crmcustomertemp.CrmCustomerFileDDto; |
|
|
@ -75,7 +72,6 @@ import com.yxt.anrui.portal.api.sysuser.PrivilegeQuery; |
|
|
|
import com.yxt.anrui.portal.api.sysuser.SysUserFeign; |
|
|
|
import com.yxt.anrui.portal.api.sysuser.SysUserVo; |
|
|
|
import com.yxt.anrui.portal.config.DictCommonType; |
|
|
|
import com.yxt.anrui.riskcenter.api.loancapitalcreditresult.LoanCapitalCreditResultVo; |
|
|
|
import com.yxt.anrui.riskcenter.api.loantemplate.LoanTemplateFeign; |
|
|
|
import com.yxt.anrui.riskcenter.api.loantemplate.LoanTemplateQuotationQuery; |
|
|
|
import com.yxt.anrui.scm.api.scmwarehouse.ScmWarehouseFeign; |
|
|
@ -204,6 +200,8 @@ public class CommonContractService extends MybatisBaseService<CommonContractMapp |
|
|
|
private BusVehicleInformationFeign busVehicleInformationFeign; |
|
|
|
@Autowired |
|
|
|
private LoanTemplateFeign loanTemplateFeign; |
|
|
|
@Autowired |
|
|
|
private BaseDistributorService baseDistributorService; |
|
|
|
|
|
|
|
|
|
|
|
private QueryWrapper<CommonContract> createQueryWrapper(CommonContractQuery query) { |
|
|
@ -821,16 +819,51 @@ public class CommonContractService extends MybatisBaseService<CommonContractMapp |
|
|
|
//单台成交价
|
|
|
|
String transactionPrice = priceInfo.getSingleFinalPrice(); |
|
|
|
String remarks = ""; |
|
|
|
CommonContract commonContract = baseMapper.selectByBusSidss(dto.getBusSid()); |
|
|
|
if (commonContract != null) { |
|
|
|
String date = DateUtil.format(commonContract.getCreateTime(), "yyyy-MM-dd"); |
|
|
|
List<String> dateString = Arrays.asList(date.split("-")); |
|
|
|
String year = dateString.get(0); |
|
|
|
String month = dateString.get(1); |
|
|
|
String day = dateString.get(2); |
|
|
|
map.put("year", year); |
|
|
|
map.put("month", month); |
|
|
|
map.put("day", day); |
|
|
|
} |
|
|
|
BusSalesOrder busSalesOrder = baseMapper.selectByBusSids(dto.getBusSid()); |
|
|
|
if (busSalesOrder.getAffiliatedCompanyType() == 0) { |
|
|
|
//根据挂靠公司sid查询信息
|
|
|
|
if (StringUtils.isNotBlank(busSalesOrder.getAffiliatedCompanySid())) { |
|
|
|
BaseDistributor baseDistributor = baseDistributorService.fetchBySid(busSalesOrder.getAffiliatedCompanySid()); |
|
|
|
if (baseDistributor != null) { |
|
|
|
map.put("invoiceName", busSalesOrder.getAffiliatedCompany());//开票名称
|
|
|
|
map.put("invoiceNo", baseDistributor.getRegistNum());//纳税人识别号
|
|
|
|
} |
|
|
|
} |
|
|
|
map.put("invoiceType", busSalesOrder.getBillingType());//开票类型
|
|
|
|
}else{ |
|
|
|
if(StringUtils.isNotBlank(busSalesOrder.getAffiliatedCompanySid())){ |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
//组装到文档相对应的字段中
|
|
|
|
if (StringUtils.isNotBlank(appOrderDetailsVo.getPurchaseSystemSid())) { |
|
|
|
ResultBean<FinCompanyInvoicingDetailsVo> invoicingDetailsVoResultBean = finCompanyInvoicingFeign.getDetailsByUseOrgAndSystem(appOrderDetailsVo.getUseOrgSid(), appOrderDetailsVo.getPurchaseSystemSid()); |
|
|
|
if (invoicingDetailsVoResultBean.getData() != null) { |
|
|
|
map.put("createOrgName", invoicingDetailsVoResultBean.getData().getName()); |
|
|
|
} |
|
|
|
} |
|
|
|
if ("现车".equals(appOrderDetailsVo.getOrderType())) { |
|
|
|
//获取模板
|
|
|
|
ftl = "existingvehicles"; |
|
|
|
if (stringList.size() > 0) { |
|
|
|
remarks = "数量" + num + "台,单台成交价:" + transactionPrice + "元。车架号:" + String.join("、", stringList); |
|
|
|
// remarks = "数量" + num + "台,单台成交价:" + transactionPrice + "元。车架号:" + String.join("、", stringList);
|
|
|
|
remarks = "数量" + num + "台,单台成交价:" + transactionPrice + "元。"; |
|
|
|
} else { |
|
|
|
remarks = "数量" + num + "台,单台成交价:" + transactionPrice + "元。"; |
|
|
|
} |
|
|
|
} else { |
|
|
|
map.put("dayOne", new BigDecimal(appOrderDetailsVo.getDepositInfo().getDeposit()).multiply(new BigDecimal(num)).toString()); |
|
|
|
map.put("dayOne", appOrderDetailsVo.getDepositInfo().getPayDepositDays()); |
|
|
|
//获取模板
|
|
|
|
ftl = "orderacar"; |
|
|
|
remarks = "数量" + num + "台,单台成交价:" + transactionPrice + "元。"; |
|
|
@ -892,16 +925,47 @@ public class CommonContractService extends MybatisBaseService<CommonContractMapp |
|
|
|
//单台成交价
|
|
|
|
String transactionPrice = priceInfo.getSingleFinalPrice(); |
|
|
|
String remarks = ""; |
|
|
|
CommonContract commonContract = baseMapper.selectByBusSidss(dto.getBusSid()); |
|
|
|
if (commonContract != null) { |
|
|
|
String date = DateUtil.format(commonContract.getCreateTime(), "yyyy-MM-dd"); |
|
|
|
List<String> dateString = Arrays.asList(date.split("-")); |
|
|
|
String year = dateString.get(0); |
|
|
|
String month = dateString.get(1); |
|
|
|
String day = dateString.get(2); |
|
|
|
map.put("year", year); |
|
|
|
map.put("month", month); |
|
|
|
map.put("day", day); |
|
|
|
} |
|
|
|
BusSalesOrder busSalesOrder = baseMapper.selectByBusSids(dto.getBusSid()); |
|
|
|
if (busSalesOrder.getAffiliatedCompanyType() == 0) { |
|
|
|
//根据挂靠公司sid查询信息
|
|
|
|
if (StringUtils.isNotBlank(busSalesOrder.getAffiliatedCompanySid())) { |
|
|
|
BaseDistributor baseDistributor = baseDistributorService.fetchBySid(busSalesOrder.getAffiliatedCompanySid()); |
|
|
|
if (baseDistributor != null) { |
|
|
|
map.put("invoiceName", busSalesOrder.getAffiliatedCompany());//开票名称
|
|
|
|
map.put("invoiceNo", baseDistributor.getRegistNum());//纳税人识别号
|
|
|
|
} |
|
|
|
} |
|
|
|
map.put("invoiceType", busSalesOrder.getBillingType());//开票类型
|
|
|
|
} |
|
|
|
//组装到文档相对应的字段中
|
|
|
|
if (StringUtils.isNotBlank(appOrderDetailsVo.getPurchaseSystemSid())) { |
|
|
|
ResultBean<FinCompanyInvoicingDetailsVo> invoicingDetailsVoResultBean = finCompanyInvoicingFeign.getDetailsByUseOrgAndSystem(appOrderDetailsVo.getUseOrgSid(), appOrderDetailsVo.getPurchaseSystemSid()); |
|
|
|
if (invoicingDetailsVoResultBean.getData() != null) { |
|
|
|
map.put("createOrgName", invoicingDetailsVoResultBean.getData().getName()); |
|
|
|
} |
|
|
|
} |
|
|
|
if ("现车".equals(appOrderDetailsVo.getOrderType())) { |
|
|
|
//获取模板
|
|
|
|
ftl = "existingvehicles"; |
|
|
|
if (stringList.size() > 0) { |
|
|
|
remarks = "数量" + num + "台,单台成交价:" + transactionPrice + "元。车架号:" + String.join("、", stringList); |
|
|
|
// remarks = "数量" + num + "台,单台成交价:" + transactionPrice + "元。车架号:" + String.join("、", stringList);
|
|
|
|
remarks = "数量" + num + "台,单台成交价:" + transactionPrice + "元。"; |
|
|
|
} else { |
|
|
|
remarks = "数量" + num + "台,单台成交价:" + transactionPrice + "元。"; |
|
|
|
} |
|
|
|
} else { |
|
|
|
map.put("dayOne", new BigDecimal(appOrderDetailsVo.getDepositInfo().getDeposit()).multiply(new BigDecimal(num)).toString()); |
|
|
|
map.put("dayOne", appOrderDetailsVo.getDepositInfo().getPayDepositDays()); |
|
|
|
//获取模板
|
|
|
|
ftl = "orderacar"; |
|
|
|
remarks = "数量" + num + "台,单台成交价:" + transactionPrice + "元。"; |
|
|
@ -972,7 +1036,7 @@ public class CommonContractService extends MybatisBaseService<CommonContractMapp |
|
|
|
remarks = "数量" + num + "台,单台成交价: 元。"; |
|
|
|
} |
|
|
|
map.put("remarks", remarks); |
|
|
|
InputStream inputStream = this.getClass().getClassLoader().getResourceAsStream("ftl/" + ftl + ".ftl"); |
|
|
|
InputStream inputStream = this.getClass().getClassLoader().getResourceAsStream("ftl2/" + ftl + ".ftl"); |
|
|
|
//生成word文件名
|
|
|
|
String targetPath = docPdfComponent.getUploadTemplateUrl(); |
|
|
|
String dateStr = DateUtil.format(new Date(), "yyyyMMdd"); |
|
|
@ -1022,7 +1086,7 @@ public class CommonContractService extends MybatisBaseService<CommonContractMapp |
|
|
|
remarks = "数量" + num + "台,单台成交价: 元。"; |
|
|
|
} |
|
|
|
map.put("remarks", remarks); |
|
|
|
InputStream inputStream = this.getClass().getClassLoader().getResourceAsStream("ftl/" + ftl + ".ftl"); |
|
|
|
InputStream inputStream = this.getClass().getClassLoader().getResourceAsStream("ftl2/" + ftl + ".ftl"); |
|
|
|
//生成word文件名
|
|
|
|
String targetPath = docPdfComponent.getUploadTemplateUrl(); |
|
|
|
String dateStr = DateUtil.format(new Date(), "yyyyMMdd"); |
|
|
@ -1051,7 +1115,7 @@ public class CommonContractService extends MybatisBaseService<CommonContractMapp |
|
|
|
map.put("vinNo", String.join(",", stringList)); |
|
|
|
}*/ |
|
|
|
String ftl = "receiveCar"; |
|
|
|
InputStream inputStream = this.getClass().getClassLoader().getResourceAsStream("ftl/" + ftl + ".ftl"); |
|
|
|
InputStream inputStream = this.getClass().getClassLoader().getResourceAsStream("ftl2/" + ftl + ".ftl"); |
|
|
|
//生成word文件名
|
|
|
|
String targetPath = docPdfComponent.getUploadTemplateUrl(); |
|
|
|
String dateStr = DateUtil.format(new Date(), "yyyyMMdd"); |
|
|
@ -1097,7 +1161,7 @@ public class CommonContractService extends MybatisBaseService<CommonContractMapp |
|
|
|
} |
|
|
|
map.put("invoicList", invoicMessageContractVos); |
|
|
|
String ftl = "invoicApply"; |
|
|
|
InputStream inputStream = this.getClass().getClassLoader().getResourceAsStream("ftl/" + ftl + ".ftl"); |
|
|
|
InputStream inputStream = this.getClass().getClassLoader().getResourceAsStream("ftl2/" + ftl + ".ftl"); |
|
|
|
//生成word文件名
|
|
|
|
String targetPath = docPdfComponent.getUploadTemplateUrl(); |
|
|
|
String dateStr = DateUtil.format(new Date(), "yyyyMMdd"); |
|
|
@ -1128,7 +1192,7 @@ public class CommonContractService extends MybatisBaseService<CommonContractMapp |
|
|
|
//查询销售订单的现车
|
|
|
|
//车款:money,大写:moneyDx
|
|
|
|
String ftl = "carFin"; |
|
|
|
InputStream inputStream = this.getClass().getClassLoader().getResourceAsStream("ftl/" + ftl + ".ftl"); |
|
|
|
InputStream inputStream = this.getClass().getClassLoader().getResourceAsStream("ftl2/" + ftl + ".ftl"); |
|
|
|
//生成word文件名
|
|
|
|
String targetPath = docPdfComponent.getUploadTemplateUrl(); |
|
|
|
String dateStr = DateUtil.format(new Date(), "yyyyMMdd"); |
|
|
@ -1152,7 +1216,7 @@ public class CommonContractService extends MybatisBaseService<CommonContractMapp |
|
|
|
//查询销售订单的现车
|
|
|
|
//车款:money,大写:moneyDx
|
|
|
|
String ftl = "moneyFin"; |
|
|
|
InputStream inputStream = this.getClass().getClassLoader().getResourceAsStream("ftl/" + ftl + ".ftl"); |
|
|
|
InputStream inputStream = this.getClass().getClassLoader().getResourceAsStream("ftl2/" + ftl + ".ftl"); |
|
|
|
//生成word文件名
|
|
|
|
String targetPath = docPdfComponent.getUploadTemplateUrl(); |
|
|
|
String dateStr = DateUtil.format(new Date(), "yyyyMMdd"); |
|
|
@ -1199,7 +1263,7 @@ public class CommonContractService extends MybatisBaseService<CommonContractMapp |
|
|
|
map.put("carLists", carContractListVos); |
|
|
|
} |
|
|
|
String ftl = "carContract"; |
|
|
|
InputStream inputStream = this.getClass().getClassLoader().getResourceAsStream("ftl/" + ftl + ".ftl"); |
|
|
|
InputStream inputStream = this.getClass().getClassLoader().getResourceAsStream("ftl2/" + ftl + ".ftl"); |
|
|
|
//生成word文件名
|
|
|
|
String targetPath = docPdfComponent.getUploadTemplateUrl(); |
|
|
|
String dateStr = DateUtil.format(new Date(), "yyyyMMdd"); |
|
|
@ -1696,13 +1760,13 @@ public class CommonContractService extends MybatisBaseService<CommonContractMapp |
|
|
|
} |
|
|
|
AppOrderDetailsVo appOrderDetailsVo = resultBean.getData(); |
|
|
|
HomeKcCust homeKcCust = dto.getHomeKcCust(); |
|
|
|
if (homeKcCust != null){ |
|
|
|
if (homeKcCust != null) { |
|
|
|
map.put("createOrgName", homeKcCust.getAccCompName()); |
|
|
|
}else { |
|
|
|
} else { |
|
|
|
map.put("createOrgName", dto.getCreateOrgName()); |
|
|
|
} |
|
|
|
map.put("customerName", dto.getCustomerName()); |
|
|
|
map.put("contractNo",dto.getContractNo()); |
|
|
|
map.put("contractNo", dto.getContractNo()); |
|
|
|
String carContract = getCarContract(dto, map, appOrderDetailsVo); |
|
|
|
return rb.success().setData(carContract); |
|
|
|
} |
|
|
@ -2022,16 +2086,6 @@ public class CommonContractService extends MybatisBaseService<CommonContractMapp |
|
|
|
} |
|
|
|
CrmCustomerTempVo crmCustomerTempVo = crmResultBean.getData(); |
|
|
|
String idNo = crmCustomerTempVo.getIDNumber(); |
|
|
|
//身份证号
|
|
|
|
//生成合同时如果为个人时,证件证号全款不是必须的、贷款必须。企业的证件号码不必须。
|
|
|
|
/*if("2".equals(appOrderDetailsVo.getPayTypeKey())){ |
|
|
|
if("1".equals(crmCustomerTempVo.getCustomerTypeKey())){ |
|
|
|
if (StringUtils.isBlank(idNo)) { |
|
|
|
return rb.setMessage(sid).setMsg("请先在客户洽谈的基础信息中补全客户的身份证号").setCode("515"); |
|
|
|
} |
|
|
|
} |
|
|
|
}*/ |
|
|
|
|
|
|
|
//查询销售订单的车型信息
|
|
|
|
AppOrderModelInfoVo appOrderModelInfoVo = appOrderDetailsVo.getModelInfo(); |
|
|
|
//根据车型sid查询车型的全称
|
|
|
@ -2139,7 +2193,6 @@ public class CommonContractService extends MybatisBaseService<CommonContractMapp |
|
|
|
if (StringUtils.isNotBlank(baseModelConfig.getTireCover()) && !"-".equals(baseModelConfig.getTireCover())) { |
|
|
|
modelAllName.append("、").append(baseModelConfig.getTireCover()); |
|
|
|
} |
|
|
|
// modelAllName.append("<w:p></w:p>");
|
|
|
|
StringBuilder modelAllName2 = new StringBuilder(); |
|
|
|
modelAllName2.append("\t"); |
|
|
|
//驾驶室
|
|
|
@ -2277,7 +2330,7 @@ public class CommonContractService extends MybatisBaseService<CommonContractMapp |
|
|
|
if (StringUtils.isNotBlank(appOrderDetailsVo.getPurchaseSystemSid())) { |
|
|
|
ResultBean<FinCompanyInvoicingDetailsVo> invoicingDetailsVoResultBean = finCompanyInvoicingFeign.getDetailsByUseOrgAndSystem(appOrderDetailsVo.getUseOrgSid(), appOrderDetailsVo.getPurchaseSystemSid()); |
|
|
|
if (invoicingDetailsVoResultBean.getData() != null) { |
|
|
|
map.put("createOrgName", invoicingDetailsVoResultBean.getData().getName()); |
|
|
|
// map.put("createOrgName", invoicingDetailsVoResultBean.getData().getName());
|
|
|
|
createOrgName = invoicingDetailsVoResultBean.getData().getName(); |
|
|
|
} else { |
|
|
|
return rb.setMsg("请与出纳人员联系完善开票信息"); |
|
|
@ -2285,14 +2338,11 @@ public class CommonContractService extends MybatisBaseService<CommonContractMapp |
|
|
|
} |
|
|
|
} |
|
|
|
map.put("modelConfigs", modelAllName2.toString()); |
|
|
|
map.put("customerName", customerName); |
|
|
|
/* map.put("customerName", customerName); |
|
|
|
map.put("mobile", mobile); |
|
|
|
map.put("idNo", idNo); |
|
|
|
map.put("idNo", idNo);*/ |
|
|
|
map.put("modelName", modelName); |
|
|
|
map.put("modelConfig", modelConfig); |
|
|
|
if ("1".equals(appOrderDetailsVo.getIsInsurance())) { |
|
|
|
map.put("insuranceInfo", insuranceInfo); |
|
|
|
} |
|
|
|
map.put("totalPrice", totalPrice); |
|
|
|
map.put("priceRemarks", priceRemarks); |
|
|
|
if ("0".equals(depositTotal)) { |
|
|
@ -2337,7 +2387,7 @@ public class CommonContractService extends MybatisBaseService<CommonContractMapp |
|
|
|
Future<String> future1_2 = pool.submit(() -> { |
|
|
|
return genCarSaleContract2(dto, map, appOrderDetailsVo); |
|
|
|
}); |
|
|
|
Future<String> future2 = pool.submit(() -> { |
|
|
|
/*Future<String> future2 = pool.submit(() -> { |
|
|
|
return genCarSaleContractBlank(dto, map, appOrderDetailsVo); |
|
|
|
}); |
|
|
|
Future<String> future2_2 = pool.submit(() -> { |
|
|
@ -2354,7 +2404,7 @@ public class CommonContractService extends MybatisBaseService<CommonContractMapp |
|
|
|
future8 = pool.submit(() -> { |
|
|
|
return getCarContract(null, map, appOrderDetailsVo); |
|
|
|
}); |
|
|
|
} |
|
|
|
}*/ |
|
|
|
List<File> filesList = new ArrayList<>(); |
|
|
|
if (future1 != null) { |
|
|
|
if (StringUtils.isNotBlank(future1.get())) { |
|
|
@ -2368,7 +2418,7 @@ public class CommonContractService extends MybatisBaseService<CommonContractMapp |
|
|
|
filesList.add(file); |
|
|
|
} |
|
|
|
} |
|
|
|
if (future2 != null) { |
|
|
|
/*if (future2 != null) { |
|
|
|
if (StringUtils.isNotBlank(future2.get())) { |
|
|
|
File file = new File(docPdfComponent.getUploadTemplateUrl() + future2.get()); |
|
|
|
filesList.add(file); |
|
|
@ -2390,7 +2440,7 @@ public class CommonContractService extends MybatisBaseService<CommonContractMapp |
|
|
|
if (StringUtils.isNotBlank(future4.get())) { |
|
|
|
File file = new File(docPdfComponent.getUploadTemplateUrl() + future4.get()); |
|
|
|
filesList.add(file); |
|
|
|
} |
|
|
|
}*/ |
|
|
|
|
|
|
|
if ("2".equals(appOrderDetailsVo.getPayTypeKey())) { |
|
|
|
Future<String> future10 = pool.submit(() -> { |
|
|
|